@cotal-ai/cli 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cotal-skills/skills/team-topology/SKILL.md +1 -1
- package/dist/commands/agents.d.ts +10 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +73 -13
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +17 -0
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +49 -4
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/meshes-wizard.d.ts +3 -0
- package/dist/commands/meshes-wizard.d.ts.map +1 -1
- package/dist/commands/meshes-wizard.js +78 -6
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/meshes.d.ts +4 -0
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +14 -4
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +117 -6
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +12 -3
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +96 -5
- package/dist/commands/up.js.map +1 -1
- package/dist/ext-loader.d.ts.map +1 -1
- package/dist/ext-loader.js +1 -0
- package/dist/ext-loader.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/control.d.ts +49 -2
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +73 -11
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/join-target.d.ts +112 -0
- package/dist/lib/join-target.d.ts.map +1 -0
- package/dist/lib/join-target.js +130 -0
- package/dist/lib/join-target.js.map +1 -0
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +29 -0
- package/dist/seed/reconcile.js.map +1 -1
- package/dist/view/mesh-view.d.ts +7 -0
- package/dist/view/mesh-view.d.ts.map +1 -1
- package/dist/view/mesh-view.js +28 -5
- package/dist/view/mesh-view.js.map +1 -1
- package/package.json +3 -3
|
@@ -88,7 +88,7 @@ The lifecycle is **design → present → agree → deploy**, and agreement is a
|
|
|
88
88
|
|
|
89
89
|
## Substrate notes
|
|
90
90
|
|
|
91
|
-
- **Cotal mesh**: each peer is its own process + minted credential under a manager (name the runtime: pty/orca/tmux/cmux). Confine via persona `allowSubscribe`/`allowPublish` frontmatter; author the `.cotal/agents/<name>.md` first, then (re)spawn so the credential is minted with the ACL. Spawn with an explicit `cwd` (the default roots peers in the manager's workspace). Verify your own subscriptions after joining every channel. Survey before spawning: roster + manager liveness (a dead manager inside `up` needs `supervise`; a stale long-lived manager pins pre-merge code and split-brains spawns), never reuse a dead agent's name, set channel replay deliberately (a joiner with replay ON back-reads history; a channel's durable backstop only activates on leave+rejoin, a bare re-join no-ops). Never disturb a live shared broker: kill by PID, no broad pkill. `mesh-teams` runs the review/implement/test loop; this skill specifies the shape it runs in.
|
|
91
|
+
- **Cotal mesh**: each peer is its own process + minted credential under a manager (name the runtime: pty/orca/tmux/cmux/herdr). Confine via persona `allowSubscribe`/`allowPublish` frontmatter; author the `.cotal/agents/<name>.md` first, then (re)spawn so the credential is minted with the ACL. Spawn with an explicit `cwd` (the default roots peers in the manager's workspace). Verify your own subscriptions after joining every channel. Survey before spawning: roster + manager liveness (a dead manager inside `up` needs `supervise`; a stale long-lived manager pins pre-merge code and split-brains spawns), never reuse a dead agent's name, set channel replay deliberately (a joiner with replay ON back-reads history; a channel's durable backstop only activates on leave+rejoin, a bare re-join no-ops). Never disturb a live shared broker: kill by PID, no broad pkill. `mesh-teams` runs the review/implement/test loop; this skill specifies the shape it runs in.
|
|
92
92
|
- **Harness subagents / workflows**: the coordinator is the main session; prefer a streaming pipeline over barrier-synchronized stages; give parallel writers isolated workspaces; and use structured, schema-validated returns where the harness supports them.
|
|
93
93
|
|
|
94
94
|
## Worked example (one instantiation, not the template)
|
|
@@ -19,6 +19,11 @@ export declare const stopFlags: readonly [{
|
|
|
19
19
|
readonly type: "string";
|
|
20
20
|
readonly value: "<n>";
|
|
21
21
|
readonly description: string;
|
|
22
|
+
}, {
|
|
23
|
+
readonly name: "on";
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
readonly value: "<instance>";
|
|
26
|
+
readonly description: "target a specific manager instance id (multi-manager space); default = class anycast";
|
|
22
27
|
}];
|
|
23
28
|
export declare const psFlags: readonly [{
|
|
24
29
|
readonly name: "space";
|
|
@@ -61,6 +66,11 @@ export declare const attachFlags: readonly [{
|
|
|
61
66
|
readonly type: "string";
|
|
62
67
|
readonly value: "<n>";
|
|
63
68
|
readonly description: string;
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "on";
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
readonly value: "<instance>";
|
|
73
|
+
readonly description: "target a specific manager instance id (multi-manager space); default = class anycast";
|
|
64
74
|
}];
|
|
65
75
|
export declare function managedAgentComplete(argv: string[]): CompletionResult;
|
|
66
76
|
export declare function stop(args: ParsedArgs): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,gBAAgB,EAAkC,KAAK,UAAU,EAAqB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,gBAAgB,EAAkC,KAAK,UAAU,EAAqB,MAAM,gBAAgB,CAAC;AAuB1K,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;EAAgH,CAAC;AACvI,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;EAAkE,CAAC;AACvF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;EAAqH,CAAC;AAE9I,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAQrE;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB1D;AA6FD,wBAAsB,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFxD;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC5D"}
|
package/dist/commands/agents.js
CHANGED
|
@@ -2,7 +2,7 @@ import { mintCreds, newIdentity, standaloneConnectOpts } from "@cotal-ai/core";
|
|
|
2
2
|
import { authDir, findCotalRoot, loadMeshes, loadSpaceAuth, targetFlags } from "@cotal-ai/workspace";
|
|
3
3
|
import { connect } from "@nats-io/transport-node";
|
|
4
4
|
import { c } from "../ui.js";
|
|
5
|
-
import { askManager, scatterManager, failIfNotOk, resolveControlTarget } from "../lib/control.js";
|
|
5
|
+
import { askManager, scatterManager, failIfNotOk, resolveControlTarget, onInstanceOrExit } from "../lib/control.js";
|
|
6
6
|
import { attachClient, detachKey, meshSessionTransport } from "../lib/attach-client.js";
|
|
7
7
|
import { completingFlagValue } from "../lib/completion.js";
|
|
8
8
|
/**
|
|
@@ -12,9 +12,14 @@ import { completingFlagValue } from "../lib/completion.js";
|
|
|
12
12
|
* Detached LAUNCH is `cotal spawn --detach` (spawn.ts) — one launch grammar for both modes.
|
|
13
13
|
*/
|
|
14
14
|
const nameFlag = (what) => ({ name: "name", type: "string", value: "<n>", description: what });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/** `--on <instance>`: address ONE manager instance instead of the class queue. Shared by
|
|
16
|
+
* ps/stop/attach so the three cannot drift. For stop and attach it is the seat-locality escape
|
|
17
|
+
* hatch: the manager that can act on a seat is the one HOSTING it, which is not necessarily the
|
|
18
|
+
* one that wins the class queue. */
|
|
19
|
+
const onFlag = { name: "on", type: "string", value: "<instance>", description: "target a specific manager instance id (multi-manager space); default = class anycast" };
|
|
20
|
+
export const stopFlags = [...targetFlags, nameFlag("managed agent to stop (required)"), onFlag];
|
|
21
|
+
export const psFlags = [...targetFlags, onFlag];
|
|
22
|
+
export const attachFlags = [...targetFlags, nameFlag("managed agent to attach to (required)"), onFlag];
|
|
18
23
|
export function managedAgentComplete(argv) {
|
|
19
24
|
const flag = completingFlagValue(argv, attachFlags);
|
|
20
25
|
if (flag?.name === "space")
|
|
@@ -40,15 +45,55 @@ export async function stop(args) {
|
|
|
40
45
|
// "owner"` (its own-domain despawn row), and the MANAGER authorizes: agents under your own
|
|
41
46
|
// owner pass with scope "spawn", another owner's agent needs "admin" on your ledger row (the
|
|
42
47
|
// handler's fresh any-mode authorization). No client-side try-admin-then-owner fallback.
|
|
43
|
-
|
|
48
|
+
// Seat-locality: the manager that can stop a seat is the one HOSTING it, so resolve WHERE before
|
|
49
|
+
// choosing WHO. Must precede the mint — a credential cannot gain an instance rail after issuance.
|
|
50
|
+
const on = await pinForTarget(v, "cotal stop");
|
|
51
|
+
const t = await resolveControlTarget(v, "control-caller-admin", on);
|
|
44
52
|
const reach = t.auth.bearer ? "owner" : "any";
|
|
45
|
-
const reply = await askManager(t.space, t.server, "stop", { name: v.name }, t.auth, reach);
|
|
53
|
+
const reply = await askManager(t.space, t.server, "stop", { name: v.name }, t.auth, reach, undefined, { instanceId: on });
|
|
46
54
|
failIfNotOk(reply);
|
|
47
55
|
// User mesh: a stop IS a grant revoke (rows are runtime grants — a non-running agent holds no
|
|
48
56
|
// standing mint secret); a respawn re-grants automatically. Say so, so the operator's
|
|
49
57
|
// restart-vs-revoke model is visible at the command, not inferred from docs.
|
|
50
58
|
console.log(c.dim(`✓ stopped ${v.name}${t.auth.bearer ? " - its actor grant is revoked; a respawn re-grants automatically" : ""}`));
|
|
51
59
|
}
|
|
60
|
+
async function locateSeat(v, name) {
|
|
61
|
+
// USER mode cannot do this: a ledger-scoped bearer does not hold the freeze rows, so a scatter
|
|
62
|
+
// dies on a permissions violation that reads as "no manager". Left unpinned — `--on` stays the
|
|
63
|
+
// manual escape hatch there, and docs/cli.md says so rather than this failing mysteriously.
|
|
64
|
+
const probe = await resolveControlTarget(v, "control-caller-privileged");
|
|
65
|
+
if (probe.auth.bearer)
|
|
66
|
+
return { kind: "unpinned" };
|
|
67
|
+
const scatter = await scatterManager(probe.space, probe.server, "ps", probe.auth);
|
|
68
|
+
if (!scatter.ok)
|
|
69
|
+
return { kind: "unpinned" }; // cannot locate ⇒ behave exactly as before, never worse
|
|
70
|
+
const reachable = scatter.instances.filter((i) => i.reachable);
|
|
71
|
+
const unreachable = scatter.instances.filter((i) => !i.reachable).map((i) => i.instanceId);
|
|
72
|
+
if (reachable.length <= 1 && !unreachable.length)
|
|
73
|
+
return { kind: "unpinned" };
|
|
74
|
+
const host = reachable.find((i) => (i.data ?? []).some((r) => r.name === name));
|
|
75
|
+
if (host)
|
|
76
|
+
return { kind: "pin", instanceId: host.instanceId };
|
|
77
|
+
return { kind: "absent", checked: reachable.length, unreachable };
|
|
78
|
+
}
|
|
79
|
+
/** Resolve `--on` for a targeted verb: an explicit pin wins; otherwise locate the seat. Returns the
|
|
80
|
+
* instance to address, or exits with an error that says WHICH case the miss was. */
|
|
81
|
+
async function pinForTarget(v, verb) {
|
|
82
|
+
const on = onInstanceOrExit(v.on, verb);
|
|
83
|
+
if (on !== undefined)
|
|
84
|
+
return on;
|
|
85
|
+
const loc = await locateSeat(v, String(v.name));
|
|
86
|
+
if (loc.kind === "pin")
|
|
87
|
+
return loc.instanceId;
|
|
88
|
+
if (loc.kind === "unpinned")
|
|
89
|
+
return undefined;
|
|
90
|
+
// The honest error #383 asked for: name the search, not just the absence.
|
|
91
|
+
const missed = loc.unreachable.length
|
|
92
|
+
? ` ${loc.unreachable.length} manager instance(s) did not answer (${loc.unreachable.join(", ")}), so it may be hosted by one of those: retry, or \`${verb} --on <instance>\` (the whole id, as printed) if you know where it is.`
|
|
93
|
+
: "";
|
|
94
|
+
console.error(c.red(`✗ no managed agent "${v.name}" on any of the ${loc.checked} reachable manager instance(s) in this space.${missed}`));
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
52
97
|
/** Render one managed-agent row (status + optional auth-health line), indented for the per-manager
|
|
53
98
|
* grouping a class scatter prints. */
|
|
54
99
|
function printAgentRow(r, indent = "") {
|
|
@@ -72,11 +117,14 @@ function printAgentRow(r, indent = "") {
|
|
|
72
117
|
}
|
|
73
118
|
export async function ps(args) {
|
|
74
119
|
const v = args.values;
|
|
75
|
-
const
|
|
120
|
+
const on = onInstanceOrExit(v.on, "cotal ps");
|
|
121
|
+
// `--on` must reach the MINT, not just the invoke: the one-shot instrument is issued during
|
|
122
|
+
// this resolve, and a credential cannot gain an instance rail after it is minted.
|
|
123
|
+
const t = await resolveControlTarget(v, "control-caller-privileged", on);
|
|
76
124
|
// `--on <instance>`: pin ps to ONE manager instance's `inst` route (P2 item 3 multi-manager) — a
|
|
77
125
|
// single-manager view. Same path for both modes (no freeze; no scatter).
|
|
78
|
-
if (
|
|
79
|
-
const reply = await askManager(t.space, t.server, "ps", undefined, t.auth, "owner", undefined,
|
|
126
|
+
if (on !== undefined) {
|
|
127
|
+
const reply = await askManager(t.space, t.server, "ps", undefined, t.auth, "owner", undefined, { instanceId: on });
|
|
80
128
|
failIfNotOk(reply);
|
|
81
129
|
const rows = reply.data ?? [];
|
|
82
130
|
if (!rows.length) {
|
|
@@ -101,7 +149,9 @@ export async function ps(args) {
|
|
|
101
149
|
// the freeze rows; every registered instance is attributed, and a non-answering one is labeled
|
|
102
150
|
// unreachable (pin 3).
|
|
103
151
|
if (t.auth.bearer) {
|
|
104
|
-
|
|
152
|
+
// `ps` has `--on` and did not pass it on this branch (the pinned branch returned above), so a
|
|
153
|
+
// split may name it as the remedy: the pin is declared, empty.
|
|
154
|
+
const reply = await askManager(t.space, t.server, "ps", undefined, t.auth, "owner", undefined, {});
|
|
105
155
|
failIfNotOk(reply);
|
|
106
156
|
const rows = reply.data ?? [];
|
|
107
157
|
if (!rows.length) {
|
|
@@ -131,8 +181,15 @@ export async function ps(args) {
|
|
|
131
181
|
return;
|
|
132
182
|
}
|
|
133
183
|
// Multi-manager: group under a per-instance header; unreachable instances are shown, never dropped.
|
|
184
|
+
//
|
|
185
|
+
// The header prints the FULL instance id, not a prefix. This block runs only in a multi-manager
|
|
186
|
+
// space (precisely when the split makes `--on <instance>` the one way to address a manager) and
|
|
187
|
+
// `--on` takes nothing but the whole 26-32 char lifecycle token (`assertLifecycleToken`). An
|
|
188
|
+
// abbreviated header therefore showed the operator an id that the very next command refuses
|
|
189
|
+
// (`"4ik6rb0e" is not a valid lifecycle token`), with the full value printed nowhere: the remedy
|
|
190
|
+
// was named and then withheld. Width costs one line here; the prefix cost the flag entirely.
|
|
134
191
|
for (const inst of instances) {
|
|
135
|
-
const label = `manager ${inst.instanceId
|
|
192
|
+
const label = `manager ${inst.instanceId}`;
|
|
136
193
|
if (!inst.reachable) {
|
|
137
194
|
console.log(`${c.bold(label)} ${c.red("unreachable")}`);
|
|
138
195
|
continue;
|
|
@@ -156,9 +213,12 @@ export async function attach(args) {
|
|
|
156
213
|
// Same reach routing as stop: static mesh → any-mode on the `control-caller-admin` instrument;
|
|
157
214
|
// user mesh → the operator's own bearer with owner reach, the manager deciding (own owner-domain
|
|
158
215
|
// passes with "spawn", cross-owner needs ledger "admin").
|
|
159
|
-
|
|
216
|
+
// Same seat-locality rule as stop, and it matters more here: attaching to a seat means reaching
|
|
217
|
+
// the process, which only its host manager has.
|
|
218
|
+
const on = await pinForTarget(v, "cotal attach");
|
|
219
|
+
const t = await resolveControlTarget(v, "control-caller-admin", on);
|
|
160
220
|
const reach = t.auth.bearer ? "owner" : "any";
|
|
161
|
-
const reply = await askManager(t.space, t.server, "attach", { name: v.name }, t.auth, reach);
|
|
221
|
+
const reply = await askManager(t.space, t.server, "attach", { name: v.name }, t.auth, reach, undefined, { instanceId: on });
|
|
162
222
|
failIfNotOk(reply);
|
|
163
223
|
// P2 item 6: the reply is the holder-bound §13.6 session GRANT (no ws:// URL). Redeem it over the
|
|
164
224
|
// mesh — mint a per-session, rails-only caller cred from the local space seed, connect, and drive
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/commands/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,qBAAqB,EAA6F,MAAM,gBAAgB,CAAC;AAC1K,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;GAKG;AAEH,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAChC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAU,CAAC;AAE/E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,WAAW,EAAE,QAAQ,CAAC,kCAAkC,CAAC,CAAwC,CAAC;AAC/H,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAG,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,sFAA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qB,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,oBAAoB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3J,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,MAAM,SAAS,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC;IAC/E,IAAI,CAAC;QACH,MAAM,YAAY,CAAC,oBAAoB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;IACtD,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SpaceAuth } from "@cotal-ai/core";
|
|
2
|
+
import { type JoinTarget } from "../lib/join-target.js";
|
|
2
3
|
import { type MeshEntry, type MeshTarget, type PreflightFailure } from "@cotal-ai/workspace";
|
|
3
4
|
/**
|
|
4
5
|
* The rules behind `cotal meshes add`, as decisions rather than side effects.
|
|
@@ -31,6 +32,22 @@ export declare function isDir(path: string): boolean;
|
|
|
31
32
|
* here repeats the input — the commonest malformed broker URL is a half-typed credential one.
|
|
32
33
|
*/
|
|
33
34
|
export declare function checkServer(raw: string): Check<string>;
|
|
35
|
+
/**
|
|
36
|
+
* May this machine send its credentials to that address?
|
|
37
|
+
*
|
|
38
|
+
* Registering a mesh is how a machine joins a broker it does not run, and every later command then
|
|
39
|
+
* dials that address with an agent credential in the CONNECT line. NATS sends the initial INFO in
|
|
40
|
+
* plaintext and unauthenticated, so an on-path attacker forges one that does not set
|
|
41
|
+
* `tls_required` and reads the credential; the client side is the only fence, and this build has
|
|
42
|
+
* no client-TLS surface yet. So the address itself is the gate. See {@link classifyJoinTarget} for
|
|
43
|
+
* the ranges and for why hostnames are refused even when they resolve somewhere permitted.
|
|
44
|
+
*
|
|
45
|
+
* This is a SAFETY rule, not a liveness check, which is why it sits with {@link checkServer} above
|
|
46
|
+
* the `--force` branch rather than inside it. `--force` exists to register a mesh that is *down*
|
|
47
|
+
* right now; it must not double as permission to ship credentials across an untrusted network,
|
|
48
|
+
* where there is nothing to verify later and no error to come back and fix.
|
|
49
|
+
*/
|
|
50
|
+
export declare function checkDialPolicy(server: string, allowUnencryptedOverlay?: boolean): Check<JoinTarget>;
|
|
34
51
|
/** Where this mesh's local trust + personas live. An explicit path must be an existing directory
|
|
35
52
|
* (the record's whole job is to point at `.cotal/auth` and `.cotal/agents` under it). With no
|
|
36
53
|
* flag, the nearest genuine project up-tree — and `findCotalRoot` returns its STARTING directory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshes-add.d.ts","sourceRoot":"","sources":["../../src/commands/meshes-add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAYL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;GASG;AAEH,uGAAuG;AACvG,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"meshes-add.d.ts","sourceRoot":"","sources":["../../src/commands/meshes-add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D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BAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC,CAI/F;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAM7J;AAED;8FAC8F;AAC9F,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CA+B7I;AAED;;qGAEqG;AACrG,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAehH;AAED;kCACkC;AAClC,wBAAsB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAG3E;AAED;8FAC8F;AAC9F,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAS/F;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAM1D"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { statSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { probeConnect } from "@cotal-ai/core";
|
|
4
|
+
import { classifyJoinTarget } from "../lib/join-target.js";
|
|
4
5
|
import { authDir, findCotalRoot, findMesh, getCurrent, homeCotalDir, listSpaceAccounts, loadSpaceAuth, personaDir, preflightTarget, recordMesh, setCurrent, } from "@cotal-ai/workspace";
|
|
5
6
|
const bad = (message) => ({ ok: false, message });
|
|
7
|
+
/** The cost of the copy every "copy the mesh's auth here" recovery asks the operator to make.
|
|
8
|
+
*
|
|
9
|
+
* It is one shared constant because there are five such instructions and the review found four of
|
|
10
|
+
* them saying only "credentials". A directory that composes for an auth mesh carries the account
|
|
11
|
+
* SIGNING SEED, so the machine holding it can mint any identity in the space: the honest word is
|
|
12
|
+
* authority, not credentials, and the operator hears it at the moment they are told to copy
|
|
13
|
+
* rather than only in a guide they may never open. */
|
|
14
|
+
const CA_COST = "\n Note: that directory carries the space's account signing seed, so any machine holding it can mint" +
|
|
15
|
+
"\n any identity in the space until the signing key is rotated and every credential re-minted. Copy it" +
|
|
16
|
+
"\n only to machines you would trust with the whole mesh.";
|
|
6
17
|
const good = (value) => ({ ok: true, value });
|
|
7
18
|
/** Is this path a directory? `existsSync` is not the question: a regular FILE named `.cotal` would
|
|
8
19
|
* pass it and record a root whose `.cotal/auth` and `.cotal/agents` can never exist. `statSync`
|
|
@@ -43,6 +54,40 @@ export function checkServer(raw) {
|
|
|
43
54
|
return bad("✗ --server names no host - a broker URL needs one (e.g. nats://127.0.0.1:4222)");
|
|
44
55
|
return good(raw);
|
|
45
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* May this machine send its credentials to that address?
|
|
59
|
+
*
|
|
60
|
+
* Registering a mesh is how a machine joins a broker it does not run, and every later command then
|
|
61
|
+
* dials that address with an agent credential in the CONNECT line. NATS sends the initial INFO in
|
|
62
|
+
* plaintext and unauthenticated, so an on-path attacker forges one that does not set
|
|
63
|
+
* `tls_required` and reads the credential; the client side is the only fence, and this build has
|
|
64
|
+
* no client-TLS surface yet. So the address itself is the gate. See {@link classifyJoinTarget} for
|
|
65
|
+
* the ranges and for why hostnames are refused even when they resolve somewhere permitted.
|
|
66
|
+
*
|
|
67
|
+
* This is a SAFETY rule, not a liveness check, which is why it sits with {@link checkServer} above
|
|
68
|
+
* the `--force` branch rather than inside it. `--force` exists to register a mesh that is *down*
|
|
69
|
+
* right now; it must not double as permission to ship credentials across an untrusted network,
|
|
70
|
+
* where there is nothing to verify later and no error to come back and fix.
|
|
71
|
+
*/
|
|
72
|
+
export function checkDialPolicy(server, allowUnencryptedOverlay = false) {
|
|
73
|
+
try {
|
|
74
|
+
// WHEN THE RECORD CAN CARRY TLS INTENT, THIS LINE CHANGES AND THIS COMMENT GOES.
|
|
75
|
+
// `tlsRequired` is a property of the connection this registration will produce, and no field
|
|
76
|
+
// records it yet; it arrives with the work that teaches the broker to serve TLS. Passing a
|
|
77
|
+
// hardcoded `false` is honest rather than lazy: today no dial can require TLS.
|
|
78
|
+
//
|
|
79
|
+
// What that means CONCRETELY: public addresses, ordinary private ranges and hostnames are
|
|
80
|
+
// refused outright. An overlay literal is refused TOO unless the operator passed the explicit
|
|
81
|
+
// opt-in, because a printed warning is not a fence — stderr is not read by scripts, and the
|
|
82
|
+
// warning was never persisted, so nothing repeated it at the dials that followed. With the
|
|
83
|
+
// opt-in it is permitted and returns a residual, which the caller both prints AND records as
|
|
84
|
+
// consent. When the TLS field exists this passes the record's real intent and the opt-in goes.
|
|
85
|
+
return good(classifyJoinTarget(server, { tlsRequired: false, allowUnencryptedOverlay }));
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
return bad(`✗ ${e.message}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
46
91
|
/** Where this mesh's local trust + personas live. An explicit path must be an existing directory
|
|
47
92
|
* (the record's whole job is to point at `.cotal/auth` and `.cotal/agents` under it). With no
|
|
48
93
|
* flag, the nearest genuine project up-tree — and `findCotalRoot` returns its STARTING directory
|
|
@@ -71,7 +116,7 @@ export function checkMode(space, root, accounts, flag) {
|
|
|
71
116
|
return bad(`✗ --mode user cannot be registered by hand - a user-auth space carries pinned IdP trust (issuer, audience, login URL) that only \`cotal up --user-auth\` establishes, in the root where its broker runs`);
|
|
72
117
|
const mode = flag ?? (accounts.includes(space) ? "auth" : "open");
|
|
73
118
|
if (mode === "auth" && !accounts.includes(space))
|
|
74
|
-
return bad(`✗ --mode auth needs "${space}"'s trust material under ${authDir(root)}${accounts.length ? ` (it holds "${accounts.join('", "')}")` : " (it holds none)"} - copy the mesh's account + creds there, point --root at where they already are, or register it --mode open`);
|
|
119
|
+
return bad(`✗ --mode auth needs "${space}"'s trust material under ${authDir(root)}${accounts.length ? ` (it holds "${accounts.join('", "')}")` : " (it holds none)"} - copy the mesh's account + creds there, point --root at where they already are, or register it --mode open` + CA_COST);
|
|
75
120
|
return good(mode);
|
|
76
121
|
}
|
|
77
122
|
/** For an AUTH registration the root must yield trust that actually COMPOSES. An account record on
|
|
@@ -84,7 +129,7 @@ export function checkTrust(mode, root, space) {
|
|
|
84
129
|
const auth = loadSpaceAuth(authDir(root), space);
|
|
85
130
|
return auth
|
|
86
131
|
? good(auth)
|
|
87
|
-
: bad(`✗ "${space}" has an account record under ${authDir(root)} but its trust does not compose (the broker record or signing material is missing) - copy the mesh's full .cotal/auth from where it runs, or register it --mode open`);
|
|
132
|
+
: bad(`✗ "${space}" has an account record under ${authDir(root)} but its trust does not compose (the broker record or signing material is missing) - copy the mesh's full .cotal/auth from where it runs, or register it --mode open` + CA_COST);
|
|
88
133
|
}
|
|
89
134
|
/** Budget for the credless mode probe. Generous on purpose: a slow answer must not be read as "the
|
|
90
135
|
* broker is open" (it is only ever read as `ok` vs a reason), and this runs once, at registration,
|
|
@@ -107,7 +152,7 @@ export function checkEnforcement(mode, enforces, server, space, root) {
|
|
|
107
152
|
if (mode === "auth" && enforces === "open")
|
|
108
153
|
return bad(`✗ the broker at ${server} accepts unauthenticated connections, so it cannot be registered as an auth mesh - it enforces no credentials; register it \`--mode open\`, or point --server at the authenticated broker for "${space}"`);
|
|
109
154
|
if (mode === "open" && enforces === "auth")
|
|
110
|
-
return bad(`✗ the broker at ${server} requires auth, so it cannot be registered as an open mesh - copy that mesh's account + creds under ${authDir(root)} and re-run with --mode auth`);
|
|
155
|
+
return bad(`✗ the broker at ${server} requires auth, so it cannot be registered as an open mesh - copy that mesh's account + creds under ${authDir(root)} and re-run with --mode auth` + CA_COST);
|
|
111
156
|
return good(undefined);
|
|
112
157
|
}
|
|
113
158
|
/** The target this registration would resolve to. `flag-server` is the source that can never
|
|
@@ -156,7 +201,7 @@ export function verifyFailureMessage(kind, space, server, root) {
|
|
|
156
201
|
return `✗ the broker at ${server} rejected the credentials for "${space}" under ${authDir(root)} - re-mint them where the mesh runs, or check that --server points at that mesh`;
|
|
157
202
|
case "open-wants-auth":
|
|
158
203
|
case "registry-open-now-auth":
|
|
159
|
-
return `✗ the broker at ${server} requires auth, but nothing under ${authDir(root)} covers "${space}" - copy the mesh's account + creds there and re-run with --mode auth
|
|
204
|
+
return `✗ the broker at ${server} requires auth, but nothing under ${authDir(root)} covers "${space}" - copy the mesh's account + creds there and re-run with --mode auth` + CA_COST;
|
|
160
205
|
case "stale-auth":
|
|
161
206
|
return `✗ the credentials for "${space}" under ${authDir(root)} have EXPIRED - re-mint them where the mesh runs (the broker itself is up)`;
|
|
162
207
|
case "tls-trust":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshes-add.js","sourceRoot":"","sources":["../../src/commands/meshes-add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,eAAe,EACf,UAAU,EACV,UAAU,GAIX,MAAM,qBAAqB,CAAC;AAgB7B,MAAM,GAAG,GAAG,CAAC,OAAe,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cAAc,EAAE,KAAK,EAAE,GAAG,CAAC,aAAa,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7G,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,oBAAqB,CAAW,CAAC,OAAO,2FAA2F,CAAC,CAAC;IACpK,CAAC;AACH,CAAC"}
|
|
@@ -52,6 +52,7 @@ export interface WizardIO {
|
|
|
52
52
|
}): Promise<T>;
|
|
53
53
|
confirm(opts: {
|
|
54
54
|
message: string;
|
|
55
|
+
initialValue?: boolean;
|
|
55
56
|
}): Promise<boolean>;
|
|
56
57
|
}
|
|
57
58
|
/** The real terminal, via clack. Cancellation (Ctrl-C / Esc) exits here rather than returning a
|
|
@@ -69,6 +70,8 @@ export interface WizardSeed {
|
|
|
69
70
|
root?: string;
|
|
70
71
|
mode?: string;
|
|
71
72
|
force?: boolean;
|
|
73
|
+
/** Pre-accepted overlay tunnel dependency (the flag form's `--allow-unencrypted-overlay`). */
|
|
74
|
+
allowUnencryptedOverlay?: boolean;
|
|
72
75
|
}
|
|
73
76
|
/** Run the guided registration. Returns false if the operator backed out (the caller exits 0 —
|
|
74
77
|
* cancelling is not a failure). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshes-wizard.d.ts","sourceRoot":"","sources":["../../src/commands/meshes-wizard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meshes-wizard.d.ts","sourceRoot":"","sources":["../../src/commands/meshes-wizard.ts"],"names":[],"mappings":"AAmBA;;;;;;;;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OAAO,CAAC,CAAC;CAC9E;AAED;0EAC0E;AAC1E,wBAAgB,OAAO,IAAI,QAAQ,CAmBlC;AAED;;kCAEkC;AAClC,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;wCACwC;AACxC,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8FAA8F;IAC9F,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;oCACoC;AACpC,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,GAAE,QAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAkSzG"}
|
|
@@ -2,7 +2,7 @@ import * as p from "@clack/prompts";
|
|
|
2
2
|
import { findMesh } from "@cotal-ai/workspace";
|
|
3
3
|
import { bold, brand, brandBold, dim, ok } from "../lib/theme.js";
|
|
4
4
|
import { abortIfCancel } from "../lib/cancel.js";
|
|
5
|
-
import { candidateTarget, checkEnforcement, checkMode, checkRoot, checkServer, checkTrust, isDir, probeEnforcement, spacesAtRoot, verifyTarget, writeRecord, } from "./meshes-add.js";
|
|
5
|
+
import { candidateTarget, checkDialPolicy, checkEnforcement, checkMode, checkRoot, checkServer, checkTrust, isDir, probeEnforcement, spacesAtRoot, verifyTarget, writeRecord, } from "./meshes-add.js";
|
|
6
6
|
/** The real terminal, via clack. Cancellation (Ctrl-C / Esc) exits here rather than returning a
|
|
7
7
|
* sentinel the wizard body would have to thread through every branch. */
|
|
8
8
|
export function clackIO() {
|
|
@@ -18,7 +18,10 @@ export function clackIO() {
|
|
|
18
18
|
},
|
|
19
19
|
text: async (opts) => abortIfCancel(await p.text(opts)),
|
|
20
20
|
select: async (opts) => abortIfCancel(await p.select(opts)),
|
|
21
|
-
|
|
21
|
+
// `initialValue` is a per-call decision, not a house style: an ordinary "register this?"
|
|
22
|
+
// may default yes, but a consent to an unencrypted transport must not be given by pressing
|
|
23
|
+
// Enter. Callers that omit it keep the old default.
|
|
24
|
+
confirm: async (opts) => abortIfCancel(await p.confirm({ initialValue: true, ...opts })),
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
/** Whether a guided run is possible at all: both ends of the pipe must be a real terminal. Without
|
|
@@ -42,17 +45,35 @@ export async function addWizard(seed, cwd, io = clackIO()) {
|
|
|
42
45
|
let replace = Boolean(seed.force);
|
|
43
46
|
// ── 1. the one thing that cannot be derived ────────────────────────────────────────────────────
|
|
44
47
|
let server = seed.server;
|
|
48
|
+
// The address the operator accepted the tunnel dependency FOR, not merely that they once did.
|
|
49
|
+
// A bare boolean survives "use a different address", so accepting an overlay and then finishing
|
|
50
|
+
// on loopback wrote evidence of a consent that was never given for the recorded target. The
|
|
51
|
+
// flag form never had this because it persists from the FINAL classification; this now matches.
|
|
52
|
+
// `undefined` when nothing is accepted; a pre-seeded flag accepts only the seeded server.
|
|
53
|
+
let ackedFor = seed.allowUnencryptedOverlay && seed.server ? seed.server : undefined;
|
|
54
|
+
/** Whether the FINAL settled address carried a residual — the thing actually recorded. */
|
|
55
|
+
let overlayResidual = false;
|
|
45
56
|
let enforces = "unreachable";
|
|
46
57
|
for (;;) {
|
|
47
58
|
if (!server) {
|
|
48
59
|
server = await io.text({
|
|
49
60
|
message: "Broker URL of the mesh you want to reach",
|
|
50
|
-
placeholder: "nats://
|
|
61
|
+
placeholder: "nats://100.90.12.34:4222",
|
|
51
62
|
validate: (v) => {
|
|
52
63
|
if (!v)
|
|
53
64
|
return "Required - this is the address the mesh's broker listens on.";
|
|
54
65
|
const r = checkServer(v);
|
|
55
|
-
|
|
66
|
+
if (!r.ok)
|
|
67
|
+
return r.message.replace(/^✗ (--server )?/, "");
|
|
68
|
+
// The same safety gate the flag form applies, asked here so a refused address is
|
|
69
|
+
// caught at the prompt instead of after the operator has answered three more
|
|
70
|
+
// questions. Both front ends must agree; that is what this module exists for.
|
|
71
|
+
// Classified as a CANDIDATE here (acceptance granted for the check) so an overlay
|
|
72
|
+
// address survives the prompt and reaches the question below. Refusing it here made
|
|
73
|
+
// that question unreachable: the operator could never say yes to something the
|
|
74
|
+
// validator had already rejected.
|
|
75
|
+
const d = checkDialPolicy(v, true);
|
|
76
|
+
return d.ok ? undefined : d.message.replace(/^✗ /, "");
|
|
56
77
|
},
|
|
57
78
|
});
|
|
58
79
|
}
|
|
@@ -63,7 +84,44 @@ export async function addWizard(seed, cwd, io = clackIO()) {
|
|
|
63
84
|
server = undefined;
|
|
64
85
|
continue;
|
|
65
86
|
}
|
|
87
|
+
const dial = checkDialPolicy(server, true); // candidate; the ask below decides
|
|
88
|
+
if (!dial.ok) {
|
|
89
|
+
io.log.error(dial.message);
|
|
90
|
+
server = undefined;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// A permitted-but-not-guaranteed target is said out loud here too, not only in the flag form.
|
|
95
|
+
// Recomputed rather than threaded because the typed path validates inside its own callback:
|
|
96
|
+
// the check is pure, and one call site for the warning beats two ways of reaching it.
|
|
97
|
+
// The guided form ASKS instead of taking a flag, which is the same explicit acceptance by a
|
|
98
|
+
// different surface. Refusing here without offering the choice would make the wizard unable to
|
|
99
|
+
// register an overlay mesh at all, and silently accepting would be the warning-and-continue
|
|
100
|
+
// shape that was just removed.
|
|
101
|
+
if (ackedFor !== server) {
|
|
102
|
+
const probe = checkDialPolicy(server, true);
|
|
103
|
+
if (probe.ok && probe.value.residual) {
|
|
104
|
+
io.log.warn(probe.value.residual);
|
|
105
|
+
// DEFAULT DENY. This is the one confirmation in the wizard where pressing Enter must not
|
|
106
|
+
// agree: everything else here is a convenience default, this is consent to a transport we
|
|
107
|
+
// cannot verify.
|
|
108
|
+
const accepted = await io.confirm({ message: "Register it anyway, accepting that dependency?", initialValue: false });
|
|
109
|
+
if (!accepted) {
|
|
110
|
+
server = undefined;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
ackedFor = server; // bound to THIS address; a different one asks again
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Re-checked with the REAL answer, so the decision is enforced by the same rule the flag form
|
|
117
|
+
// uses rather than by the branch above happening to be right.
|
|
118
|
+
const settled = checkDialPolicy(server, ackedFor === server);
|
|
119
|
+
if (!settled.ok) {
|
|
120
|
+
io.log.error(settled.message);
|
|
121
|
+
server = undefined;
|
|
122
|
+
continue;
|
|
66
123
|
}
|
|
124
|
+
overlayResidual = Boolean(settled.value.residual);
|
|
67
125
|
const spin = io.spinner();
|
|
68
126
|
spin.start(`Asking ${server} what it is`);
|
|
69
127
|
enforces = await probeEnforcement(server);
|
|
@@ -120,7 +178,10 @@ export async function addWizard(seed, cwd, io = clackIO()) {
|
|
|
120
178
|
if (enforces !== "auth" || accounts.length > 0)
|
|
121
179
|
break;
|
|
122
180
|
io.log.warn(`That broker requires credentials, and ${bold(root)} holds none.\n` +
|
|
123
|
-
dim("Copy the mesh's .cotal/auth from the machine it runs on
|
|
181
|
+
dim("Copy the mesh's .cotal/auth from the machine it runs on, then point at that folder.\n") +
|
|
182
|
+
dim("That directory carries the space's account SIGNING SEED: a machine holding it can mint any\n") +
|
|
183
|
+
dim("identity in the space, so it is a certificate authority for the mesh rather than a client of it.\n") +
|
|
184
|
+
dim("`cotal mint` alone does NOT satisfy this - registration needs composable signing material."));
|
|
124
185
|
const next = await io.select({
|
|
125
186
|
message: "That folder holds no credentials for this broker. What next?",
|
|
126
187
|
options: [
|
|
@@ -234,7 +295,18 @@ export async function addWizard(seed, cwd, io = clackIO()) {
|
|
|
234
295
|
const go = await io.confirm({ message: "Register this mesh?" });
|
|
235
296
|
if (!go)
|
|
236
297
|
return cancelled(io, "Nothing was registered.");
|
|
237
|
-
|
|
298
|
+
// The guided consent is PERSISTED, exactly as the flag form persists it. Asking the operator and
|
|
299
|
+
// then writing a record that does not remember the answer is the printed-and-forgotten shape the
|
|
300
|
+
// opt-in replaced, one surface over.
|
|
301
|
+
const entry = {
|
|
302
|
+
space, server: server, root, mode, origin: "manual",
|
|
303
|
+
// From the FINAL classification, never from "the operator accepted something earlier". The
|
|
304
|
+
// flag form persists `dial.residual` for the same reason: the field is evidence about the
|
|
305
|
+
// recorded target, and evidence that can detach from its subject is worse than none, because
|
|
306
|
+
// the use-time fence this exists for would read it as authorization.
|
|
307
|
+
...(overlayResidual ? { unencryptedOverlay: true } : {}),
|
|
308
|
+
ts: new Date().toISOString(),
|
|
309
|
+
};
|
|
238
310
|
const result = writeRecord(entry);
|
|
239
311
|
// Padded from the rendered widths, not a guess: the commands carry the space name, so a
|
|
240
312
|
// hard-coded gutter misaligns for every name but the one it was written against.
|