@cotal-ai/cli 0.14.11 → 0.16.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/dist/commands/clean.d.ts +18 -2
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +35 -6
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +83 -0
- package/dist/commands/meshes-add.d.ts.map +1 -0
- package/dist/commands/meshes-add.js +179 -0
- package/dist/commands/meshes-add.js.map +1 -0
- package/dist/commands/meshes-wizard.d.ts +76 -0
- package/dist/commands/meshes-wizard.d.ts.map +1 -0
- package/dist/commands/meshes-wizard.js +277 -0
- package/dist/commands/meshes-wizard.js.map +1 -0
- package/dist/commands/meshes.d.ts +22 -4
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +205 -9
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +3 -1
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/status.js +6 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/up.d.ts +29 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +28 -13
- package/dist/commands/up.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +7 -0
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/status.d.ts.map +1 -1
- package/dist/lib/status.js +25 -20
- package/dist/lib/status.js.map +1 -1
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +27 -3
- package/dist/seed/reconcile.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import { findMesh } from "@cotal-ai/workspace";
|
|
3
|
+
import { bold, brand, brandBold, dim, ok } from "../lib/theme.js";
|
|
4
|
+
import { abortIfCancel } from "../lib/cancel.js";
|
|
5
|
+
import { candidateTarget, checkEnforcement, checkMode, checkRoot, checkServer, checkTrust, isDir, probeEnforcement, spacesAtRoot, verifyTarget, writeRecord, } from "./meshes-add.js";
|
|
6
|
+
/** The real terminal, via clack. Cancellation (Ctrl-C / Esc) exits here rather than returning a
|
|
7
|
+
* sentinel the wizard body would have to thread through every branch. */
|
|
8
|
+
export function clackIO() {
|
|
9
|
+
return {
|
|
10
|
+
intro: (m) => p.intro(m),
|
|
11
|
+
outro: (m) => p.outro(m),
|
|
12
|
+
note: (body, title) => p.note(body, title),
|
|
13
|
+
cancel: (m) => p.cancel(m),
|
|
14
|
+
log: { info: (m) => p.log.info(m), warn: (m) => p.log.warn(m), error: (m) => p.log.error(m) },
|
|
15
|
+
spinner: () => {
|
|
16
|
+
const s = p.spinner();
|
|
17
|
+
return { start: (m) => s.start(m), stop: (m) => s.stop(m) };
|
|
18
|
+
},
|
|
19
|
+
text: async (opts) => abortIfCancel(await p.text(opts)),
|
|
20
|
+
select: async (opts) => abortIfCancel(await p.select(opts)),
|
|
21
|
+
confirm: async (opts) => abortIfCancel(await p.confirm({ ...opts, initialValue: true })),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Whether a guided run is possible at all: both ends of the pipe must be a real terminal. Without
|
|
25
|
+
* this a missing flag would hang a script waiting on input nobody is there to give; the flag form
|
|
26
|
+
* keeps failing loud instead. */
|
|
27
|
+
export function canPrompt() {
|
|
28
|
+
return Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY) && process.env.COTAL_NO_PROMPT !== "1";
|
|
29
|
+
}
|
|
30
|
+
/** Run the guided registration. Returns false if the operator backed out (the caller exits 0 —
|
|
31
|
+
* cancelling is not a failure). */
|
|
32
|
+
export async function addWizard(seed, cwd, io = clackIO()) {
|
|
33
|
+
io.intro(brandBold("Register a mesh"));
|
|
34
|
+
io.note("A mesh running somewhere else - another machine, a shared broker, a hosted space - so that\n`cotal spawn` and `--space` can reach it from any folder on this machine.\n\nNothing is written until you confirm.", brand("What this does"));
|
|
35
|
+
// TWO different decisions, deliberately not one flag. `--force` conflates them for the scripted
|
|
36
|
+
// form (documented there), but here they are reached separately and must stay separate:
|
|
37
|
+
// `unverified` means the operator accepted a record nothing confirmed; `replace` means an
|
|
38
|
+
// existing record for that name is being overwritten. Folding replace into unverified would
|
|
39
|
+
// silently skip the broker checks for anyone who picked "replace that record" — a record
|
|
40
|
+
// presented as checked that never was, which is the failure this command exists to refuse.
|
|
41
|
+
let unverified = Boolean(seed.force);
|
|
42
|
+
let replace = Boolean(seed.force);
|
|
43
|
+
// ── 1. the one thing that cannot be derived ────────────────────────────────────────────────────
|
|
44
|
+
let server = seed.server;
|
|
45
|
+
let enforces = "unreachable";
|
|
46
|
+
for (;;) {
|
|
47
|
+
if (!server) {
|
|
48
|
+
server = await io.text({
|
|
49
|
+
message: "Broker URL of the mesh you want to reach",
|
|
50
|
+
placeholder: "nats://10.0.0.5:4222",
|
|
51
|
+
validate: (v) => {
|
|
52
|
+
if (!v)
|
|
53
|
+
return "Required - this is the address the mesh's broker listens on.";
|
|
54
|
+
const r = checkServer(v);
|
|
55
|
+
return r.ok ? undefined : r.message.replace(/^✗ (--server )?/, "");
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const pre = checkServer(server);
|
|
61
|
+
if (!pre.ok) {
|
|
62
|
+
io.log.error(pre.message);
|
|
63
|
+
server = undefined;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const spin = io.spinner();
|
|
68
|
+
spin.start(`Asking ${server} what it is`);
|
|
69
|
+
enforces = await probeEnforcement(server);
|
|
70
|
+
spin.stop(enforces === "auth"
|
|
71
|
+
? `${ok("✓")} ${server} answered - it ${bold("requires credentials")}`
|
|
72
|
+
: enforces === "open"
|
|
73
|
+
? `${ok("✓")} ${server} answered - it is ${bold("open")} (accepts anyone)`
|
|
74
|
+
: `${server} did not answer`);
|
|
75
|
+
if (enforces !== "unreachable")
|
|
76
|
+
break;
|
|
77
|
+
const next = await io.select({
|
|
78
|
+
message: "No broker answered there.",
|
|
79
|
+
options: [
|
|
80
|
+
{ value: "retype", label: "Use a different address", hint: "typo, wrong port, VPN not up" },
|
|
81
|
+
{ value: "anyway", label: "Register it anyway", hint: "the mesh is down right now; nothing is verified" },
|
|
82
|
+
{ value: "cancel", label: "Cancel" },
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
if (next === "cancel")
|
|
86
|
+
return cancelled(io);
|
|
87
|
+
if (next === "anyway") {
|
|
88
|
+
unverified = true;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
server = undefined;
|
|
92
|
+
}
|
|
93
|
+
// ── 2. where this mesh's local trust + personas live ───────────────────────────────────────────
|
|
94
|
+
// A LOOP, not a recursive re-entry: "point at a different folder" has to actually ask for one.
|
|
95
|
+
// Clearing the answer and inferring again would land on the same project root inside a project,
|
|
96
|
+
// re-hit the same dead end, and offer the same useless choice forever.
|
|
97
|
+
const inferred = checkRoot(seed.root, cwd);
|
|
98
|
+
let root = inferred.ok ? inferred.value : undefined;
|
|
99
|
+
if (root && !seed.root)
|
|
100
|
+
io.log.info(`Using this project as its local folder: ${bold(root)}`);
|
|
101
|
+
// The cwd is only a sensible default the FIRST time. After the operator has been told this
|
|
102
|
+
// folder holds no credentials, offering it back pre-filled makes them clear the field to answer
|
|
103
|
+
// the question at all — so the recovery ask starts empty and insists on a real path.
|
|
104
|
+
let defaultRoot = cwd;
|
|
105
|
+
let accounts = [];
|
|
106
|
+
for (;;) {
|
|
107
|
+
while (!root)
|
|
108
|
+
root = await askRoot(io, cwd, defaultRoot);
|
|
109
|
+
const inventory = spacesAtRoot(root);
|
|
110
|
+
if (!inventory.ok) {
|
|
111
|
+
// Unreadable trust is not "no trust": say so and let them point somewhere else.
|
|
112
|
+
io.log.error(inventory.message);
|
|
113
|
+
root = undefined;
|
|
114
|
+
defaultRoot = undefined;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
accounts = inventory.value;
|
|
118
|
+
// An auth broker with no trust here cannot be registered at all — say what is missing and where
|
|
119
|
+
// it comes from, rather than failing after more questions.
|
|
120
|
+
if (enforces !== "auth" || accounts.length > 0)
|
|
121
|
+
break;
|
|
122
|
+
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 (or `cotal mint` there), then point at that folder."));
|
|
124
|
+
const next = await io.select({
|
|
125
|
+
message: "That folder holds no credentials for this broker. What next?",
|
|
126
|
+
options: [
|
|
127
|
+
{ value: "root", label: "Point at a different folder", hint: "one that already holds its credentials" },
|
|
128
|
+
{ value: "cancel", label: "Cancel" },
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
if (next === "cancel")
|
|
132
|
+
return cancelled(io);
|
|
133
|
+
root = undefined; // ask for a path; never re-infer, or this offers the same dead end again
|
|
134
|
+
defaultRoot = undefined; // …and never offer the folder we just rejected as the default
|
|
135
|
+
}
|
|
136
|
+
// ── 3. which space ────────────────────────────────────────────────────────────────────────────
|
|
137
|
+
// The clash gate runs for EVERY resolved name, including one that came in on the command line.
|
|
138
|
+
// Gating it on "did we just ask?" let `cotal meshes add <already-registered>` overwrite silently —
|
|
139
|
+
// something the flag form refuses outright.
|
|
140
|
+
let space = seed.space;
|
|
141
|
+
for (;;) {
|
|
142
|
+
while (!space) {
|
|
143
|
+
if (accounts.length > 0) {
|
|
144
|
+
const picked = await io.select({
|
|
145
|
+
message: "Which space on that broker?",
|
|
146
|
+
options: [
|
|
147
|
+
...accounts.map((s) => ({ value: s, label: s, hint: "credentials for this space are already here" })),
|
|
148
|
+
{ value: null, label: "Another name…" }, // null, not a sentinel string: no space name can collide with it
|
|
149
|
+
],
|
|
150
|
+
});
|
|
151
|
+
if (picked !== null)
|
|
152
|
+
space = picked;
|
|
153
|
+
}
|
|
154
|
+
if (!space) {
|
|
155
|
+
space = await io.text({
|
|
156
|
+
message: "Space name on that broker",
|
|
157
|
+
placeholder: "the name the mesh was started with",
|
|
158
|
+
validate: (v) => (v ? undefined : "Required - it must match the space name where the mesh runs."),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const clash = findMesh(space);
|
|
163
|
+
if (!clash || replace)
|
|
164
|
+
break;
|
|
165
|
+
const next = await io.select({
|
|
166
|
+
message: `"${space}" is already registered here (${clash.server}).`,
|
|
167
|
+
options: [
|
|
168
|
+
{ value: "replace", label: "Replace that record", hint: clash.root },
|
|
169
|
+
{ value: "rename", label: "Use a different name" },
|
|
170
|
+
{ value: "cancel", label: "Cancel" },
|
|
171
|
+
],
|
|
172
|
+
});
|
|
173
|
+
if (next === "cancel")
|
|
174
|
+
return cancelled(io);
|
|
175
|
+
if (next === "rename")
|
|
176
|
+
space = undefined;
|
|
177
|
+
else {
|
|
178
|
+
replace = true;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// ── 4. mode + trust, decided rather than asked ─────────────────────────────────────────────────
|
|
183
|
+
// The probe's answer is the best evidence of the mode — but only when the broker actually
|
|
184
|
+
// answered. An UNREACHABLE broker knows nothing, and reading "not auth" out of silence would
|
|
185
|
+
// record an auth mesh as open (the exact wrong-mode failure this command is built to refuse); so
|
|
186
|
+
// fall back to the same on-disk inference the flag form uses.
|
|
187
|
+
const modeHint = seed.mode ?? (enforces === "unreachable" ? undefined : enforces);
|
|
188
|
+
const modeCheck = checkMode(space, root, accounts, modeHint);
|
|
189
|
+
if (!modeCheck.ok) {
|
|
190
|
+
io.log.error(modeCheck.message);
|
|
191
|
+
return cancelled(io, "Nothing was registered.");
|
|
192
|
+
}
|
|
193
|
+
const mode = modeCheck.value;
|
|
194
|
+
const trust = checkTrust(mode, root, space);
|
|
195
|
+
if (!trust.ok) {
|
|
196
|
+
io.log.error(trust.message);
|
|
197
|
+
return cancelled(io, "Nothing was registered.");
|
|
198
|
+
}
|
|
199
|
+
if (!unverified) {
|
|
200
|
+
const match = checkEnforcement(mode, enforces, server, space, root);
|
|
201
|
+
if (!match.ok) {
|
|
202
|
+
io.log.error(match.message);
|
|
203
|
+
return cancelled(io, "Nothing was registered.");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// ── 5. verify for real, then confirm ──────────────────────────────────────────────────────────
|
|
207
|
+
if (!unverified) {
|
|
208
|
+
const target = candidateTarget(space, server, root, mode, trust.value);
|
|
209
|
+
const spin = io.spinner();
|
|
210
|
+
spin.start(mode === "auth" ? `Checking this folder's credentials for "${space}"` : `Checking the connection to "${space}"`);
|
|
211
|
+
const verified = await verifyTarget(target);
|
|
212
|
+
spin.stop(verified.ok ? `${ok("✓")} ${mode === "auth" ? "Credentials accepted" : "Connected"}` : "Could not connect");
|
|
213
|
+
if (!verified.ok) {
|
|
214
|
+
io.log.error(verified.message);
|
|
215
|
+
const next = await io.select({
|
|
216
|
+
message: "The check did not pass. What next?",
|
|
217
|
+
options: [
|
|
218
|
+
{ value: "anyway", label: "Register it anyway", hint: "the record will say it was not verified" },
|
|
219
|
+
{ value: "cancel", label: "Cancel" },
|
|
220
|
+
],
|
|
221
|
+
});
|
|
222
|
+
if (next === "cancel")
|
|
223
|
+
return cancelled(io, "Nothing was registered.");
|
|
224
|
+
unverified = true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
io.note([
|
|
228
|
+
`${dim("space ")} ${bold(space)}`,
|
|
229
|
+
`${dim("broker")} ${server}`,
|
|
230
|
+
`${dim("mode ")} ${mode}${unverified ? dim(" (not verified - the broker was not reachable/checked)") : dim(mode === "auth" ? " (broker enforces credentials)" : " (broker is open)")}`,
|
|
231
|
+
...(replace ? [`${dim("note ")} ${bold("replaces")} the existing record for "${space}"`] : []),
|
|
232
|
+
`${dim("folder")} ${root}`,
|
|
233
|
+
].join("\n"), brand("About to record"));
|
|
234
|
+
const go = await io.confirm({ message: "Register this mesh?" });
|
|
235
|
+
if (!go)
|
|
236
|
+
return cancelled(io, "Nothing was registered.");
|
|
237
|
+
const entry = { space, server: server, root, mode, origin: "manual", ts: new Date().toISOString() };
|
|
238
|
+
const result = writeRecord(entry);
|
|
239
|
+
// Padded from the rendered widths, not a guess: the commands carry the space name, so a
|
|
240
|
+
// hard-coded gutter misaligns for every name but the one it was written against.
|
|
241
|
+
const rows = [
|
|
242
|
+
result.adoptedCurrent
|
|
243
|
+
? ["cotal spawn", "launch an agent into it (it is now the default)"]
|
|
244
|
+
: [`cotal use ${space}`, "make it the default a bare spawn joins"],
|
|
245
|
+
[`cotal status --space ${space}`, "check it"],
|
|
246
|
+
[`cotal meshes rm ${space}`, "forget it again (never stops the mesh)"],
|
|
247
|
+
];
|
|
248
|
+
const width = Math.max(...rows.map(([cmd]) => cmd.length));
|
|
249
|
+
io.note(rows.map(([cmd, why]) => `${bold(cmd.padEnd(width))} ${dim(why)}`).join("\n"), brand("What you can do now"));
|
|
250
|
+
io.outro(ok(`Registered "${space}"${result.keptCurrent ? ` - "${result.keptCurrent}" is still the default` : ""}`));
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
/** Ask for the folder, re-asking until it resolves. `defaultTo` is accepted on an empty answer;
|
|
254
|
+
* without one, an empty answer is a non-answer rather than a silent fallback. */
|
|
255
|
+
async function askRoot(io, cwd, defaultTo) {
|
|
256
|
+
for (;;) {
|
|
257
|
+
const typed = await io.text({
|
|
258
|
+
message: "Local folder for this mesh's credentials and personas",
|
|
259
|
+
placeholder: defaultTo ?? "the folder holding its .cotal/auth",
|
|
260
|
+
validate: (v) => {
|
|
261
|
+
const candidate = v || defaultTo;
|
|
262
|
+
if (!candidate)
|
|
263
|
+
return "Required - the folder that holds this mesh's .cotal/auth and .cotal/agents.";
|
|
264
|
+
return isDir(candidate) ? undefined : "Not a directory - it must already exist.";
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
const r = checkRoot(typed || defaultTo, cwd);
|
|
268
|
+
if (r.ok)
|
|
269
|
+
return r.value;
|
|
270
|
+
io.log.error(r.message);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function cancelled(io, message = "Cancelled.") {
|
|
274
|
+
io.cancel(message);
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=meshes-wizard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meshes-wizard.js","sourceRoot":"","sources":["../../src/commands/meshes-wizard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,WAAW,EACX,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,MAAM,iBAAiB,CAAC;AAwCzB;0EAC0E;AAC1E,MAAM,UAAU,OAAO;IACrB,OAAO;QACL,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACxB,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;QAC1C,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1B,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EA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declare const meshesFlags: readonly [{
|
|
3
|
+
readonly name: "server";
|
|
4
|
+
readonly type: "string";
|
|
5
|
+
readonly value: "<url>";
|
|
6
|
+
readonly description: "add: the mesh's broker URL (required)";
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "root";
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly value: "<dir>";
|
|
11
|
+
readonly description: "add: folder holding this mesh's .cotal/auth + .cotal/agents (default: this project)";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "mode";
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
readonly value: "<auth|open>";
|
|
16
|
+
readonly description: "add: how the broker authenticates (default: inferred from --root)";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "force";
|
|
19
|
+
readonly type: "boolean";
|
|
20
|
+
readonly description: "add: record without verifying, replacing any existing record · rm: drop a running mesh's record";
|
|
21
|
+
}];
|
|
5
22
|
export declare function meshes(args: ParsedArgs): Promise<void>;
|
|
23
|
+
export declare function meshesComplete(argv: string[]): CompletionResult;
|
|
6
24
|
//# sourceMappingURL=meshes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshes.d.ts","sourceRoot":"","sources":["../../src/commands/meshes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"meshes.d.ts","sourceRoot":"","sources":["../../src/commands/meshes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAkC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6CxG,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;EAKgB,CAAC;AAIzC,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAU5D;AAmLD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAW/D"}
|
package/dist/commands/meshes.js
CHANGED
|
@@ -1,25 +1,221 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {} from "@cotal-ai/core";
|
|
2
|
+
import { authDir, clearCurrent, findMesh, getCurrent, loadMeshes, removeMesh, } from "@cotal-ai/workspace";
|
|
2
3
|
import { c } from "../ui.js";
|
|
3
4
|
import { pruneStaleMeshes } from "../lib/meshes.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { completingFlagValue } from "../lib/completion.js";
|
|
6
|
+
import { liveMeshOwner } from "./clean.js";
|
|
7
|
+
import { candidateTarget, checkEnforcement, checkMode, checkRoot, checkServer, checkTrust, probeEnforcement, spacesAtRoot, verifyTarget, writeRecord, } from "./meshes-add.js";
|
|
8
|
+
import { addWizard, canPrompt } from "./meshes-wizard.js";
|
|
9
|
+
/**
|
|
10
|
+
* `cotal meshes` — the registry of meshes this machine can reach, and the two verbs that maintain
|
|
11
|
+
* it by hand.
|
|
12
|
+
*
|
|
13
|
+
* cotal meshes list (the kubectl `get-contexts` analogue)
|
|
14
|
+
* cotal meshes add <space> --server register a mesh this machine did NOT start
|
|
15
|
+
* cotal meshes rm <space> … drop records (never stops anything)
|
|
16
|
+
*
|
|
17
|
+
* `up` and `down` still write and clear their own records; `add`/`rm` exist for the meshes they
|
|
18
|
+
* cannot speak for — one running on another machine, a shared broker, a hosted space. Those records
|
|
19
|
+
* are marked `manual` and are never auto-pruned (see `pruneMesh`), because this machine has no way
|
|
20
|
+
* to write them back: a dead broker under one is reported `offline`, not deleted.
|
|
21
|
+
*/
|
|
22
|
+
const SUBCOMMANDS = ["list", "add", "rm", "remove"];
|
|
23
|
+
export const meshesFlags = [
|
|
24
|
+
{ name: "server", type: "string", value: "<url>", description: "add: the mesh's broker URL (required)" },
|
|
25
|
+
{ name: "root", type: "string", value: "<dir>", description: "add: folder holding this mesh's .cotal/auth + .cotal/agents (default: this project)" },
|
|
26
|
+
{ name: "mode", type: "string", value: "<auth|open>", description: "add: how the broker authenticates (default: inferred from --root)" },
|
|
27
|
+
{ name: "force", type: "boolean", description: "add: record without verifying, replacing any existing record · rm: drop a running mesh's record" },
|
|
28
|
+
];
|
|
7
29
|
export async function meshes(args) {
|
|
8
|
-
|
|
30
|
+
const sub = args.positionals[0];
|
|
31
|
+
const v = args.values;
|
|
32
|
+
if (sub === "add")
|
|
33
|
+
return addMesh(args.positionals.slice(1), v);
|
|
34
|
+
if (sub === "rm" || sub === "remove")
|
|
35
|
+
return removeMeshes(args.positionals.slice(1), v);
|
|
36
|
+
if (sub !== undefined && sub !== "list") {
|
|
37
|
+
console.error(c.red(`✗ unknown subcommand "${sub}" - usage: cotal meshes [list | add <space> --server <url> | rm <space> …]`));
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
return listMeshes();
|
|
41
|
+
}
|
|
42
|
+
// ---- list -----------------------------------------------------------------------------------
|
|
43
|
+
/** The registered meshes, one per line, with a `*` on the `current` default. This is how you see
|
|
44
|
+
* what a bare `cotal spawn` would join and which `--space` names exist. The sweep runs first, so
|
|
45
|
+
* a mesh this machine started and lost is gone from the list; an operator-registered one whose
|
|
46
|
+
* broker is down stays, tagged `offline` — it is still the mesh you meant, just not up. */
|
|
47
|
+
async function listMeshes() {
|
|
48
|
+
const sweep = await pruneStaleMeshes();
|
|
9
49
|
const all = loadMeshes();
|
|
10
50
|
if (all.length === 0) {
|
|
11
|
-
console.log(c.dim("no meshes
|
|
51
|
+
console.log(c.dim("no meshes registered - `cotal up` starts one here, `cotal meshes add <space> --server <url>` registers one running elsewhere"));
|
|
12
52
|
return;
|
|
13
53
|
}
|
|
14
54
|
const current = getCurrent();
|
|
15
|
-
const
|
|
55
|
+
const offline = new Set(sweep.offline);
|
|
56
|
+
const width = (pick, header) => Math.max(header.length, ...all.map((m) => pick(m).length));
|
|
57
|
+
const wSpace = width((m) => m.space, "SPACE");
|
|
58
|
+
const wServer = width((m) => m.server, "SERVER");
|
|
59
|
+
const wMode = width((m) => m.mode, "MODE");
|
|
60
|
+
console.log(c.dim(` ${"SPACE".padEnd(wSpace)} ${"SERVER".padEnd(wServer)} ${"MODE".padEnd(wMode)} ROOT`));
|
|
16
61
|
for (const m of all) {
|
|
17
62
|
const marker = m.space === current ? c.green("*") : " ";
|
|
18
|
-
|
|
63
|
+
const tags = [
|
|
64
|
+
...(m.origin === "manual" ? [c.dim("registered")] : []),
|
|
65
|
+
...(offline.has(m.space) ? [c.yellow("offline")] : []),
|
|
66
|
+
];
|
|
67
|
+
console.log(`${marker} ${m.space.padEnd(wSpace)} ${c.dim(`${m.server.padEnd(wServer)} ${m.mode.padEnd(wMode)} ${m.root}`)}` +
|
|
68
|
+
(tags.length ? ` ${tags.join(c.dim(" · "))}` : ""));
|
|
19
69
|
}
|
|
20
|
-
// A `current` that no longer matches any
|
|
70
|
+
// A `current` that no longer matches any recorded mesh (its broker went down) shows no `*` — say
|
|
21
71
|
// why, so a bare `cotal spawn` still reporting "multiple meshes" isn't a mystery.
|
|
22
72
|
if (current && !all.some((m) => m.space === current))
|
|
23
73
|
console.log(c.dim(`\nnote: default "${current}" is not running - \`cotal use <name>\` to set a live one`));
|
|
24
74
|
}
|
|
75
|
+
// ---- add ------------------------------------------------------------------------------------
|
|
76
|
+
/** `cotal meshes add <space> --server <url>` — register a mesh this machine did not start, so
|
|
77
|
+
* `--space`, `cotal use` and a bare `cotal spawn` can reach it from any directory. The record
|
|
78
|
+
* holds a broker URL, a local root and a mode; trust material itself stays in that root's
|
|
79
|
+
* `.cotal/auth`, exactly as it does for a mesh started here. */
|
|
80
|
+
async function addMesh(positionals, v) {
|
|
81
|
+
const space = positionals[0];
|
|
82
|
+
if (positionals.length > 1) {
|
|
83
|
+
console.error(c.red("usage: cotal meshes add <space> --server <url> [--root <dir>] [--mode auth|open]"));
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
// GUIDED FORM. A registration needs four facts, three of which the machine can find out — so a
|
|
87
|
+
// command missing either irreducible one, on a real terminal, is an operator who would rather be
|
|
88
|
+
// asked than read a usage line. Scripts and agents are unaffected: without a TTY (or with
|
|
89
|
+
// COTAL_NO_PROMPT=1) the flag form's fail-loud sentences stand, which is what every smoke asserts.
|
|
90
|
+
if ((!space || !v.server) && canPrompt()) {
|
|
91
|
+
const done = await addWizard({ ...(space ? { space } : {}), ...(v.server ? { server: v.server } : {}), ...(v.root ? { root: v.root } : {}),
|
|
92
|
+
...(v.mode ? { mode: v.mode } : {}), ...(v.force ? { force: true } : {}) }, process.cwd());
|
|
93
|
+
if (!done)
|
|
94
|
+
process.exitCode = 0; // backing out of a wizard is not a failure
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (!space) {
|
|
98
|
+
console.error(c.red("usage: cotal meshes add <space> --server <url> [--root <dir>] [--mode auth|open]"));
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
if (!v.server) {
|
|
102
|
+
console.error(c.red("✗ --server <url> is required - a mesh you did not start here has no address to infer (e.g. --server nats://10.0.0.5:4222)"));
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
const server = take(checkServer(v.server));
|
|
106
|
+
const root = take(checkRoot(v.root, process.cwd()));
|
|
107
|
+
const accounts = take(spacesAtRoot(root));
|
|
108
|
+
const mode = take(checkMode(space, root, accounts, v.mode));
|
|
109
|
+
if (mode === "open" && accounts.includes(space))
|
|
110
|
+
console.log(c.dim(`note: ${authDir(root)} holds trust for "${space}", but --mode open records a credless connect`));
|
|
111
|
+
const auth = take(checkTrust(mode, root, space));
|
|
112
|
+
const existing = findMesh(space);
|
|
113
|
+
if (existing && !v.force) {
|
|
114
|
+
console.error(c.red(`✗ "${space}" is already registered at ${existing.server} (${existing.root}) - \`cotal meshes rm ${space}\` first, or --force to replace it`));
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
// VERIFY BEFORE RECORDING. A wrong address, a broker that wants auth, creds that don't open this
|
|
118
|
+
// space, an expired cred — all one probe away here, and every one of them would otherwise surface
|
|
119
|
+
// as a confusing failure at the first `cotal spawn` against a record that looks fine. `--force`
|
|
120
|
+
// is the explicit escape (registering a mesh that is currently down), and it says so on the
|
|
121
|
+
// success line rather than pretending the mesh was checked.
|
|
122
|
+
if (!v.force) {
|
|
123
|
+
take(checkEnforcement(mode, await probeEnforcement(server), server, space, root));
|
|
124
|
+
const verified = await verifyTarget(candidateTarget(space, server, root, mode, auth));
|
|
125
|
+
if (!verified.ok) {
|
|
126
|
+
console.error(c.red(verified.message));
|
|
127
|
+
console.error(c.dim("nothing was registered - fix the above, or `--force` to record it without verifying (e.g. the mesh is down right now)"));
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const result = writeRecord({ space, server, root, mode, origin: "manual", ts: new Date().toISOString() });
|
|
132
|
+
console.log(c.green(`✓ registered "${space}"`),
|
|
133
|
+
// "recorded without verifying" describes THIS registration, not a durable property of the
|
|
134
|
+
// record: verification is point-in-time — a verified record loses it the moment a port is
|
|
135
|
+
// reused — so it is reported as what just happened rather than persisted as a stored claim
|
|
136
|
+
// that would quietly decay into a false one.
|
|
137
|
+
c.dim(`${server} ${mode} ${root}${v.force ? " (recorded without verifying)" : ""}`));
|
|
138
|
+
if (result.adoptedCurrent) {
|
|
139
|
+
console.log(c.dim(`it is now the default mesh - \`cotal spawn\` from any directory joins it`));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (result.keptCurrent)
|
|
143
|
+
console.log(c.dim(`current is still "${result.keptCurrent}" - \`cotal use ${space}\` to switch`));
|
|
144
|
+
}
|
|
145
|
+
/** Take a rule's value, or print its sentence and exit — the flag form's whole error posture. */
|
|
146
|
+
function take(r) {
|
|
147
|
+
if (r.ok)
|
|
148
|
+
return r.value;
|
|
149
|
+
console.error(c.red(r.message));
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
// ---- rm -------------------------------------------------------------------------------------
|
|
153
|
+
/** `cotal meshes rm <space> …` — drop records. This never stops a mesh: it removes what THIS
|
|
154
|
+
* machine remembers about one. For a mesh running here that distinction is a footgun (the broker
|
|
155
|
+
* keeps running with nothing pointing at it), so those are refused in favour of `cotal down`. */
|
|
156
|
+
async function removeMeshes(names, v) {
|
|
157
|
+
if (names.length === 0) {
|
|
158
|
+
console.error(c.red("usage: cotal meshes rm <space> [<space> …]"));
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
let failed = false;
|
|
162
|
+
let clearedCurrent = false;
|
|
163
|
+
for (const space of names) {
|
|
164
|
+
const m = findMesh(space);
|
|
165
|
+
if (!m) {
|
|
166
|
+
console.error(c.red(`✗ no mesh named "${space}" is registered - see \`cotal meshes\``));
|
|
167
|
+
failed = true;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
// Refuse only when THIS MACHINE demonstrably runs the mesh — a live recorded pid under its
|
|
171
|
+
// root. Reachability was the wrong test: any broker on that address answers, including a
|
|
172
|
+
// reused port or a foreign NATS, which produced a refusal plus a `cotal down` instruction that
|
|
173
|
+
// would stop nothing. Local process ownership is the fact the refusal actually claims.
|
|
174
|
+
//
|
|
175
|
+
// It is asked only of records this machine started. Pidfiles are ROOT-scoped, and a root is
|
|
176
|
+
// shared on purpose here: `add` defaults `--root` to the project you run it in, so a local mesh
|
|
177
|
+
// and a registration for a remote one routinely live under one root. A pid there belongs to
|
|
178
|
+
// whichever mesh owns the root — never to the remote broker — so asking this of a hand-registered
|
|
179
|
+
// record can only produce a false "it is running here". That is safe to skip precisely because
|
|
180
|
+
// provenance is now decided at the call site that started the broker: anything this machine
|
|
181
|
+
// actually runs is stamped `up` and does reach the check.
|
|
182
|
+
//
|
|
183
|
+
// Skipped entirely under `--force`: the probe itself throws on a multi-tenant or unreadable
|
|
184
|
+
// root, which must not defeat the documented override. Keyed on the entry's OWN space rather
|
|
185
|
+
// than one re-resolved from the root, which on a multi-tenant root can name another tenant.
|
|
186
|
+
const running = m.origin === "manual" || v.force ? undefined : liveMeshOwner(m.root, m.space);
|
|
187
|
+
if (running) {
|
|
188
|
+
console.error(c.red(`✗ "${space}" is running from ${m.root} (${running}) - \`cotal down\` there stops it and drops the record; --force drops the record only, leaving the mesh running`));
|
|
189
|
+
failed = true;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
removeMesh(space);
|
|
193
|
+
if (getCurrent() === space) {
|
|
194
|
+
clearCurrent();
|
|
195
|
+
clearedCurrent = true;
|
|
196
|
+
}
|
|
197
|
+
console.log(c.green(`✓ unregistered "${space}"`), c.dim(m.server));
|
|
198
|
+
}
|
|
199
|
+
if (clearedCurrent)
|
|
200
|
+
console.log(c.dim("there is no default mesh now - `cotal use <name>` to set one"));
|
|
201
|
+
if (failed)
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
// ---- completion -----------------------------------------------------------------------------
|
|
205
|
+
export function meshesComplete(argv) {
|
|
206
|
+
const flag = completingFlagValue(argv, meshesFlags);
|
|
207
|
+
if (flag?.name === "mode")
|
|
208
|
+
return { items: [{ value: "auth" }, { value: "open" }], directive: "nofiles" };
|
|
209
|
+
if (flag?.name === "root")
|
|
210
|
+
return { items: [], directive: "default" }; // a directory
|
|
211
|
+
if (flag?.name === "server")
|
|
212
|
+
return { items: [], directive: "nofiles" };
|
|
213
|
+
const sub = argv[0];
|
|
214
|
+
if (argv.length <= 1)
|
|
215
|
+
return { items: SUBCOMMANDS.map((value) => ({ value })), directive: "nofiles" };
|
|
216
|
+
// `rm` completes on what's registered; `add` names a mesh that by definition isn't.
|
|
217
|
+
if (sub === "rm" || sub === "remove")
|
|
218
|
+
return { items: loadMeshes().map((m) => ({ value: m.space })), directive: "nofiles" };
|
|
219
|
+
return { items: [], directive: "nofiles" };
|
|
220
|
+
}
|
|
25
221
|
//# sourceMappingURL=meshes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meshes.js","sourceRoot":"","sources":["../../src/commands/meshes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meshes.js","sourceRoot":"","sources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gB,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,YAAY,EAAE,CAIjF;AAwDD,wBAAsB,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/commands/spawn.ts"],"names":[],"mappings":"AAGA,OAAO,EAmBL,KAAK,gBAAgB,EAErB,KAAK,YAAY,EAKjB,KAAK,UAAU,EAGhB,MAAM,gBAAgB,CAAC;AAmCxB;;;+BAG+B;AAC/B,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAmC9D;AAUD,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAE5I;AAqED;;;6EAG6E;AAC7E,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWiB,CAAC;AAEzC;;;;iDAIiD;AACjD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,YAAY,EAAE,CAIjF;AAwDD,wBAAsB,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAkU3D"}
|
package/dist/commands/spawn.js
CHANGED
|
@@ -453,7 +453,9 @@ export async function spawn(args) {
|
|
|
453
453
|
transcript,
|
|
454
454
|
mcpServers,
|
|
455
455
|
});
|
|
456
|
-
|
|
456
|
+
// What happens next belongs to the CONNECTOR: naming one harness's first-run gate for all of
|
|
457
|
+
// them sends the operator looking for a prompt that never appears, and reads as a hang.
|
|
458
|
+
console.error(`spawning ${name}${role ? ` (${role})` : ""} on the mesh${connector.launchHint ? ` - ${connector.launchHint}` : ""}`);
|
|
457
459
|
if (userAuth)
|
|
458
460
|
console.error(c.dim(` running as you: ${userAuth.owner}.${name} (actor granted; revoked automatically when this process exits)`));
|
|
459
461
|
child = spawnProcess(spec.command, spec.args, {
|