Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,75 @@ equal(activeStatusSourceForUrl(added.catalog, null, added.source.statusUrl, base
const configuredHosts = parseConfiguredSshHostCatalog({
ok: true,
schema_version: "ssh_host_catalog_v0",
hosts: [{ alias: "remote-lab" }, { alias: "*.example" }, { alias: "remote-lab" }, { alias: "jump_box" }],
hosts: [{ alias: "remote-lab" }, { alias: "*.example" }, { alias: "remote-lab" }, { alias: "jump_box" }, { alias: "desk-box" }, { alias: "task-worker" }],
});
equal(defaultConfiguredSshHostsUrl, "/ssh-hosts", "configured Host discovery stays on the active local Dashboard origin");
deepEqual(configuredHosts.hosts, [{ alias: "remote-lab" }, { alias: "jump_box" }], "only explicit safe SSH aliases enter the browser catalog");
deepEqual(
configuredHosts.hosts,
[{ alias: "remote-lab" }, { alias: "jump_box" }, { alias: "desk-box" }, { alias: "task-worker" }],
"only explicit safe SSH aliases enter the browser catalog and feature-off rows keep exact { alias } shape",
);

const observedHosts = parseConfiguredSshHostCatalog({
ok: true,
schema_version: "ssh_host_catalog_v0",
hosts: [
{
alias: "desk-box",
observation: {
schema_version: "session_fabric_ssh_observation_v0",
alias: "desk-box",
connection_state: "connected",
failure_code: null,
checked_at: "2026-11-20T00:00:00Z",
tunnel_latency_ms: 12,
},
},
{ alias: "task-worker" },
],
});
deepEqual(
observedHosts.hosts,
[
{
alias: "desk-box",
observation: {
schema_version: "session_fabric_ssh_observation_v0",
alias: "desk-box",
connection_state: "connected",
failure_code: null,
checked_at: "2026-11-20T00:00:00Z",
tunnel_latency_ms: 12,
},
},
{ alias: "task-worker" },
],
"optional validated L0 SSH observations round-trip without altering unobserved entries",
);

let invalidObservationRejected = false;
try {
parseConfiguredSshHostCatalog({
ok: true,
schema_version: "ssh_host_catalog_v0",
hosts: [
{
alias: "desk-box",
observation: {
schema_version: "session_fabric_ssh_observation_v0",
alias: "other-host",
connection_state: "connected",
failure_code: null,
checked_at: null,
tunnel_latency_ms: null,
},
},
],
});
} catch {
invalidObservationRejected = true;
}
assert(invalidObservationRejected, "mismatched or invalid SSH observations fail closed");
const configuredDraft = configuredSshTunnelDraft("remote-lab", "8876");
assert("command" in configuredDraft, "a configured Host and valid local port produce a tunnel draft");
equal(configuredDraft.command, "ssh -N -L 8876:127.0.0.1:8766 remote-lab", "the UI generates one exact OpenSSH command");
Expand Down
33 changes: 26 additions & 7 deletions apps/presentation/dashboard/src/data/ssh-host-catalog.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import {
decodeSshHostObservationWith,
isSafeHostAlias,
type SshHostObservation,
} from "../../../../../loopx/control_plane/collaboration/session_quota_fabric_contract.js";
import { parseIsoTimestamp } from "../../../../../loopx/control_plane/runtime_timestamp.js";

export const defaultConfiguredSshHostsUrl = "/ssh-hosts";

export type ConfiguredSshHost = {
alias: string;
observation?: SshHostObservation;
};

export type ConfiguredSshHostCatalog = {
hosts: ConfiguredSshHost[];
schemaVersion: "ssh_host_catalog_v0";
};

const safeAliasPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;

export function isConfiguredSshHostAlias(value: unknown): value is string {
return typeof value === "string" && safeAliasPattern.test(value.trim());
return isSafeHostAlias(value);
}

export function parseConfiguredSshHostCatalog(value: unknown): ConfiguredSshHostCatalog {
Expand All @@ -24,12 +30,25 @@ export function parseConfiguredSshHostCatalog(value: unknown): ConfiguredSshHost
throw new Error("SSH Host 列表协议不兼容,请更新本机 LoopX 服务。");
}
const seen = new Set<string>();
const hosts = payload.hosts.flatMap((value) => {
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
const alias = String((value as Record<string, unknown>).alias ?? "").trim();
const hosts = payload.hosts.flatMap((item): ConfiguredSshHost[] => {
if (!item || typeof item !== "object" || Array.isArray(item)) return [];
const record = item as Record<string, unknown>;
const alias = String(record.alias ?? "").trim();
if (!isConfiguredSshHostAlias(alias) || seen.has(alias)) return [];
seen.add(alias);
return [{ alias }];
if (record.observation === undefined || record.observation === null) {
return [{ alias }];
}
const observation = decodeSshHostObservationWith(record.observation, {
fail: (message) => {
throw new Error(`SSH Host observation 无效:${message}`);
},
parseTimestamp: parseIsoTimestamp,
});
if (observation.alias !== alias) {
throw new Error(`SSH Host observation 别名不匹配:${observation.alias} !== ${alias}`);
}
return [{ alias, observation }];
});
return { hosts, schemaVersion: "ssh_host_catalog_v0" };
}
Expand Down
11 changes: 11 additions & 0 deletions docs/architecture/rfcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,17 @@ Paired diffs do not certify translation accuracy.
the Desktop frontends RFC, local service lifecycle with the daemon RFC, and
continuation with the manager RFC. Optional preview hosts, session
rotation, and host promotion remain unapproved.
- [Session and Quota Fabric for Single-Workbench Convergence v0](session-and-quota-fabric-v0.md)
([中文版](session-and-quota-fabric-v0.zh-CN.md))
- **Delivery on `main`:** Partial; typed L0 codecs, additive
`ssh_host_catalog_v0` readiness projection, and Turn/lease-fenced handover
guards (`loopx/control_plane/collaboration/session_quota_fabric.ts`) ship on
this baseline while downstream UI/daemon convergence milestones remain
staged.
- **Current boundary:** Extracts SSH host observation and quota-aware handover
from Calli/LooChat proposals into an optional L0 contract converging into
the single Goal Workbench (`apps/presentation/dashboard`) instead of a second
frontend shell or parallel Task authority.
- [Goal Channel Collaboration v0](goal-channel-collaboration-v0.md)
([中文版](goal-channel-collaboration-v0.zh-CN.md))
- **Delivery on `main`:** Lark vertical implemented.
Expand Down
3 changes: 2 additions & 1 deletion docs/architecture/rfcs/STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ appendix may keep dated history, but no dated log heading may precede it.

[中文版](STATUS.zh-CN.md) is the semantic mirror of this file.

## Accepted (52)
## Accepted (53)

| RFC | Header status | Supersedes / closes | Ledger |
| --- | --- | --- | --- |
Expand Down Expand Up @@ -69,6 +69,7 @@ appendix may keep dated history, but no dated log heading may precede it.
| [RFC: Research Exploration Control Plane v0](research-exploration-control-plane-v0.md) | Accepted | none | — |
| [Preserve the selected runtime during rollback](self-update-explicit-runtime-route-v0.md) | Accepted | none | — |
| [RFC: Semantic Vocabulary Convergence and Commit-Time Drift Checks (v0)](semantic-vocabulary-convergence-v0.md) | Accepted | none | [7 entries](ledger/semantic-vocabulary-convergence-v0/) |
| [RFC: Session and Quota Fabric for Single-Workbench Convergence (v0)](session-and-quota-fabric-v0.md) | Accepted | none | — |
| [RFC: Shared Goal Alignment and Governed Amendment Protocol (v0)](shared-goal-alignment-and-governed-amendment-v0.md) | Accepted | none | [2 entries](ledger/shared-goal-alignment-and-governed-amendment-v0/) |
| [RFC: LoopX Shared Control-Plane Authority and Pluggable State Providers (v0)](shared-goal-authority-state-provider-v0.md) | Accepted | none | [24 entries](ledger/shared-goal-authority-state-provider-v0/) |
| [RFC: Single-Owner Local Daemon (v0)](single-owner-local-daemon-v0.md) | Accepted | none | — |
Expand Down
3 changes: 2 additions & 1 deletion docs/architecture/rfcs/STATUS.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

[English](STATUS.md) 与本文互为语义镜像。

## 已接受 (52)
## 已接受 (53)

| RFC | 头部状态 | 替代 / 关闭 | Ledger |
| --- | --- | --- | --- |
Expand Down Expand Up @@ -66,6 +66,7 @@
| [RFC:研究型探索控制面 v0](research-exploration-control-plane-v0.zh-CN.md) | 已接受 | 无 | — |
| [回滚全程保留所选运行目录](self-update-explicit-runtime-route-v0.zh-CN.md) | 已接受 | 无 | — |
| [RFC:语义词表收敛与提交期漂移检查(v0)](semantic-vocabulary-convergence-v0.zh-CN.md) | 已接受 | 无 | [7 条](ledger/semantic-vocabulary-convergence-v0/) |
| [RFC:面向单一工作台收敛的 L0 会话与额度底座(v0)](session-and-quota-fabric-v0.zh-CN.md) | 已接受 | 无 | — |
| [RFC:共享 Goal 对齐与受治理 Amendment 协议(v0)](shared-goal-alignment-and-governed-amendment-v0.zh-CN.md) | 已接受 | 无 | [2 条](ledger/shared-goal-alignment-and-governed-amendment-v0/) |
| [RFC:LoopX 共享控制面权威与可插拔状态 Provider(v0)](shared-goal-authority-state-provider-v0.zh-CN.md) | 已接受 | 无 | [24 条](ledger/shared-goal-authority-state-provider-v0/) |
| [RFC: Single-Owner Local Daemon (v0)](single-owner-local-daemon-v0.md) | 已接受 | none | — |
Expand Down
Loading
Loading