@cotal-ai/manager 0.7.0 → 0.8.1
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/README.md +1 -1
- package/dist/attach-client.d.ts.map +1 -1
- package/dist/attach-client.js +21 -0
- package/dist/attach-client.js.map +1 -1
- package/dist/commands.d.ts +24 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +140 -39
- package/dist/commands.js.map +1 -1
- package/dist/launch.d.ts +26 -0
- package/dist/launch.d.ts.map +1 -0
- package/dist/launch.js +151 -0
- package/dist/launch.js.map +1 -0
- package/dist/manager.d.ts +28 -2
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +165 -26
- package/dist/manager.js.map +1 -1
- package/dist/roster.d.ts +3 -2
- package/dist/roster.d.ts.map +1 -1
- package/dist/roster.js +4 -3
- package/dist/roster.js.map +1 -1
- package/dist/runtime/index.d.ts +8 -6
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +7 -11
- package/dist/runtime/index.js.map +1 -1
- package/package.json +5 -3
- package/dist/runtime/tmux.d.ts +0 -15
- package/dist/runtime/tmux.d.ts.map +0 -1
- package/dist/runtime/tmux.js +0 -96
- package/dist/runtime/tmux.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @cotal-ai/manager
|
|
2
2
|
|
|
3
3
|
The agent supervisor: a mesh endpoint that spawns and manages nodes via a pluggable `Runtime`
|
|
4
|
-
(`pty`
|
|
4
|
+
(`pty` built-in; `tmux` via `@cotal-ai/tmux`; `cmux` via `@cotal-ai/cmux`), plus its own control-plane commands
|
|
5
5
|
(`start`/`stop`/`ps`/`attach`) and a WebSocket attach endpoint.
|
|
6
6
|
|
|
7
7
|
It owns process lifecycle and config, not the agents' work; agents still coordinate laterally
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach-client.d.ts","sourceRoot":"","sources":["../src/attach-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"attach-client.d.ts","sourceRoot":"","sources":["../src/attach-client.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+CvD"}
|
package/dist/attach-client.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import WebSocket from "ws";
|
|
2
2
|
/** Detach key — Ctrl-] (0x1d), as in telnet/ssh escape conventions. */
|
|
3
3
|
const DETACH = 0x1d;
|
|
4
|
+
/**
|
|
5
|
+
* Terminal modes a full-screen child (e.g. Claude's TUI) commonly turns on but that we must undo
|
|
6
|
+
* locally on detach/exit: the agent keeps running after Ctrl-], so it never restores OUR terminal.
|
|
7
|
+
* Without this, detaching from a mouse-tracking TUI leaves the terminal reporting every cursor move
|
|
8
|
+
* as input (a stream of `ESC[<…M` escape codes), or its focus in/out as `ESC[I`/`ESC[O`. Disables
|
|
9
|
+
* all mouse-report modes + focus reporting + bracketed paste, shows the cursor, and resets
|
|
10
|
+
* attributes. Deliberately does NOT toggle the alternate screen.
|
|
11
|
+
*/
|
|
12
|
+
const RESTORE = "\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1005l\x1b[?1006l\x1b[?1015l" + // mouse tracking off
|
|
13
|
+
"\x1b[?1004l" + // focus reporting off
|
|
14
|
+
"\x1b[?2004l" + // bracketed paste off
|
|
15
|
+
"\x1b[?25h" + // show cursor
|
|
16
|
+
"\x1b[0m"; // reset attributes
|
|
4
17
|
/**
|
|
5
18
|
* Drive a manager's attach endpoint from the terminal: raw-mode stdin streams to
|
|
6
19
|
* the PTY, PTY output streams to stdout, and SIGWINCH-style resizes are forwarded.
|
|
@@ -11,6 +24,11 @@ export function attachClient(url) {
|
|
|
11
24
|
const ws = new WebSocket(url);
|
|
12
25
|
const stdin = process.stdin;
|
|
13
26
|
const wasRaw = stdin.isRaw ?? false;
|
|
27
|
+
// A broken local pipe (terminal closed / SIGHUP) makes stdout writes async-error on a later
|
|
28
|
+
// tick; with no listener that EPIPE/EIO becomes an uncaughtException — crashing on the per-frame
|
|
29
|
+
// PTY write or the on-detach restore write. Register a no-op listener once here (not in cleanup,
|
|
30
|
+
// so it outlives the async error tick) to turn it into a handled no-op.
|
|
31
|
+
process.stdout.on("error", () => { });
|
|
14
32
|
const sendResize = () => ws.send(`r:${process.stdout.columns ?? 80},${process.stdout.rows ?? 24}`);
|
|
15
33
|
const onInput = (d) => {
|
|
16
34
|
if (d.length === 1 && d[0] === DETACH) {
|
|
@@ -22,6 +40,9 @@ export function attachClient(url) {
|
|
|
22
40
|
const cleanup = () => {
|
|
23
41
|
stdin.off("data", onInput);
|
|
24
42
|
process.stdout.off("resize", sendResize);
|
|
43
|
+
// Undo terminal modes the (still-running) agent's TUI enabled — it won't restore us on detach.
|
|
44
|
+
if (process.stdout.isTTY)
|
|
45
|
+
process.stdout.write(RESTORE);
|
|
25
46
|
if (stdin.isTTY)
|
|
26
47
|
stdin.setRawMode(wasRaw);
|
|
27
48
|
stdin.pause();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach-client.js","sourceRoot":"","sources":["../src/attach-client.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAE3B,uEAAuE;AACvE,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;QAEpC,MAAM,UAAU,GAAG,GAAG,EAAE,CACtB,EAAE,CAAC,IAAI,CAAC,KAAK,OAAO,C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AAE,CAAC;QACZ,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACnB,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,CAAC,CAAC,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/commands.d.ts
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
|
+
type Values = Record<string, string | undefined>;
|
|
2
|
+
/** Resolve which running mesh a control command (`ps`/`start`/`stop`/`attach`) targets, with the
|
|
3
|
+
* same precedence + preflight as the rest of the CLI ({@link resolveMeshTarget} / `connectOrExit`):
|
|
4
|
+
* 1. explicit `--creds` → a raw off-registry connection (plain reachability, no prune). Space
|
|
5
|
+
* defaults to this folder's auth-space via {@link spaceFor} (a deliberate manager-command
|
|
6
|
+
* choice — more correct than `DEFAULT_SPACE` for a non-default-space project, and what these
|
|
7
|
+
* commands did before — NOT `connectOrExit`'s `DEFAULT_SPACE`).
|
|
8
|
+
* 2. `--server` + an UNregistered `--space` → a raw OPEN off-registry connection, no creds (the
|
|
9
|
+
* same escape hatch `connectOrExit` has; plain reachability, no prune).
|
|
10
|
+
* 3. otherwise the registry/`current` resolver, with the same stale-prune + friendly preflight —
|
|
11
|
+
* so `cotal ps --space <name>` reaches that mesh's RECORDED broker instead of silently assuming
|
|
12
|
+
* `DEFAULT_SERVER` (:4222); `--server` overrides. The privileged "manager" cred is minted from
|
|
13
|
+
* the RESOLVED mesh's own recorded root (so `--space other` loads other's auth, guarded by
|
|
14
|
+
* `targetFromEntry`'s `auth.space === m.space` check), or none for an open mesh.
|
|
15
|
+
* Shares `@cotal-ai/workspace`'s `preflightTarget`/`pruneStaleMeshes` with the CLI, so a dead/mismatched entry gets
|
|
16
|
+
* the same one-sentence message + stale-prune the rest of the CLI gives — not a raw NATS trace. The
|
|
17
|
+
* pre-resolution sweep runs only for bare / `--server`-only resolution; an explicit `--space` is
|
|
18
|
+
* resolved + preflighted directly (so a `--server` override can recover a dead-recorded mesh).
|
|
19
|
+
* `ask()` can therefore trust the target is reachable + auth-valid. */
|
|
20
|
+
export declare function resolveManagerTarget(v: Values): Promise<{
|
|
21
|
+
space: string;
|
|
22
|
+
server: string;
|
|
23
|
+
creds?: string;
|
|
24
|
+
}>;
|
|
1
25
|
export {};
|
|
2
26
|
//# sourceMappingURL=commands.d.ts.map
|
package/dist/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAsCA,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AA+BjD;;;;;;;;;;;;;;;;;wEAiBwE;AACxE,wBAAsB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAkChH"}
|
package/dist/commands.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { CotalEndpoint, isReachable, DEFAULT_SERVER, DEFAULT_SPACE,
|
|
4
|
+
import { CotalEndpoint, isReachable, DEFAULT_SERVER, DEFAULT_SPACE, mintCreds, newIdentity, registry, probeConnect, CONTROL_PRIVILEGED, CONTROL_ADMIN, } from "@cotal-ai/core";
|
|
5
|
+
import { authDir, findCotalRoot, loadSpaceAuth, findMesh, isWorkspaceTargetError, resolveMeshTarget, preflightTarget, pruneStaleMeshes, removeMesh, renderWorkspaceError, } from "@cotal-ai/workspace";
|
|
5
6
|
import { Manager } from "./manager.js";
|
|
6
7
|
import { loadRoster } from "./roster.js";
|
|
8
|
+
import { loadLaunchSpec, materializePersona, launchAgentToStartOpts } from "./launch.js";
|
|
7
9
|
import {} from "./runtime/index.js";
|
|
8
10
|
import { attachClient } from "./attach-client.js";
|
|
9
11
|
import { c } from "./ui.js";
|
|
@@ -12,6 +14,85 @@ import { c } from "./ui.js";
|
|
|
12
14
|
function spaceFor(v) {
|
|
13
15
|
return v.space ?? loadSpaceAuth(authDir(findCotalRoot()))?.space ?? DEFAULT_SPACE;
|
|
14
16
|
}
|
|
17
|
+
/** Raw off-registry reachability — one plain sentence, never a registry/stale-entry message and
|
|
18
|
+
* never a prune. Used by the `--creds` and `--server`+unregistered-`--space` escape hatches, which
|
|
19
|
+
* connect to a broker the operator named, not the registry. The manager's copy of the CLI's
|
|
20
|
+
* `reachableOrExit` (an implementation can't import another); the wording lives in `@cotal-ai/workspace`. */
|
|
21
|
+
async function reachableOrExit(server, auth = {}) {
|
|
22
|
+
const probe = await probeConnect(server, auth);
|
|
23
|
+
if (probe.ok)
|
|
24
|
+
return;
|
|
25
|
+
console.error(c.red(renderWorkspaceError({ kind: "reachable", reason: probe.reason, server })));
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
/** Confirm a registry-resolved mesh is up + accepts these creds — replacing the raw NATS auth trace
|
|
29
|
+
* with one sentence and pruning a stale entry. The manager's copy of the CLI's `preflightOrExit`:
|
|
30
|
+
* the probe/classify/render/prune-decision live in `@cotal-ai/workspace` (`preflightTarget`); this owns
|
|
31
|
+
* the I/O — it acts on the prune decision, colours, and exits. */
|
|
32
|
+
async function preflightOrExit(target, probeCreds) {
|
|
33
|
+
const r = await preflightTarget(target, probeCreds);
|
|
34
|
+
if (r.ok)
|
|
35
|
+
return;
|
|
36
|
+
if (r.prune)
|
|
37
|
+
removeMesh(target.space);
|
|
38
|
+
console.error(c.red(renderWorkspaceError({ kind: "preflight", failure: r.kind, target, pruned: r.prune })));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
/** Resolve which running mesh a control command (`ps`/`start`/`stop`/`attach`) targets, with the
|
|
42
|
+
* same precedence + preflight as the rest of the CLI ({@link resolveMeshTarget} / `connectOrExit`):
|
|
43
|
+
* 1. explicit `--creds` → a raw off-registry connection (plain reachability, no prune). Space
|
|
44
|
+
* defaults to this folder's auth-space via {@link spaceFor} (a deliberate manager-command
|
|
45
|
+
* choice — more correct than `DEFAULT_SPACE` for a non-default-space project, and what these
|
|
46
|
+
* commands did before — NOT `connectOrExit`'s `DEFAULT_SPACE`).
|
|
47
|
+
* 2. `--server` + an UNregistered `--space` → a raw OPEN off-registry connection, no creds (the
|
|
48
|
+
* same escape hatch `connectOrExit` has; plain reachability, no prune).
|
|
49
|
+
* 3. otherwise the registry/`current` resolver, with the same stale-prune + friendly preflight —
|
|
50
|
+
* so `cotal ps --space <name>` reaches that mesh's RECORDED broker instead of silently assuming
|
|
51
|
+
* `DEFAULT_SERVER` (:4222); `--server` overrides. The privileged "manager" cred is minted from
|
|
52
|
+
* the RESOLVED mesh's own recorded root (so `--space other` loads other's auth, guarded by
|
|
53
|
+
* `targetFromEntry`'s `auth.space === m.space` check), or none for an open mesh.
|
|
54
|
+
* Shares `@cotal-ai/workspace`'s `preflightTarget`/`pruneStaleMeshes` with the CLI, so a dead/mismatched entry gets
|
|
55
|
+
* the same one-sentence message + stale-prune the rest of the CLI gives — not a raw NATS trace. The
|
|
56
|
+
* pre-resolution sweep runs only for bare / `--server`-only resolution; an explicit `--space` is
|
|
57
|
+
* resolved + preflighted directly (so a `--server` override can recover a dead-recorded mesh).
|
|
58
|
+
* `ask()` can therefore trust the target is reachable + auth-valid. */
|
|
59
|
+
export async function resolveManagerTarget(v) {
|
|
60
|
+
if (v.creds) {
|
|
61
|
+
const server = v.server ?? DEFAULT_SERVER;
|
|
62
|
+
const creds = readFileSync(v.creds, "utf8");
|
|
63
|
+
await reachableOrExit(server, { creds });
|
|
64
|
+
return { space: spaceFor(v), server, creds };
|
|
65
|
+
}
|
|
66
|
+
// A raw OPEN off-registry mesh: explicit `--server` + a `--space` that isn't registered. Naming
|
|
67
|
+
// both is as deliberate as `--creds`, but an open broker has no creds to pass — connect bare,
|
|
68
|
+
// off-registry (no registry lookup, no prune). Mirrors `connectOrExit`'s same-shaped escape hatch;
|
|
69
|
+
// a registered `--space` still goes through the resolver below (which honors `--server` as override).
|
|
70
|
+
if (v.server && v.space && !findMesh(v.space)) {
|
|
71
|
+
await reachableOrExit(v.server, {});
|
|
72
|
+
return { space: v.space, server: v.server, creds: undefined };
|
|
73
|
+
}
|
|
74
|
+
// Sweep dead entries before resolving ONLY when we must CHOOSE one (bare / `--server`-only). An
|
|
75
|
+
// explicit `--space` names its target, so pre-pruning would erase a dead-recorded mesh that the
|
|
76
|
+
// operator is recovering with a live `--server` override — resolve it and let preflight verify +
|
|
77
|
+
// prune-on-dead (with the friendly message), honoring the override. Without `--space`, a dead
|
|
78
|
+
// entry must not be offered, so the sweep stays.
|
|
79
|
+
if (!v.space)
|
|
80
|
+
await pruneStaleMeshes();
|
|
81
|
+
let target;
|
|
82
|
+
try {
|
|
83
|
+
target = resolveMeshTarget(process.cwd(), { server: v.server, space: v.space });
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
if (isWorkspaceTargetError(e)) {
|
|
87
|
+
console.error(c.red(renderWorkspaceError({ kind: "target", error: e })));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
throw e;
|
|
91
|
+
}
|
|
92
|
+
const creds = target.auth ? await mintCreds(target.auth, newIdentity(), "manager") : undefined;
|
|
93
|
+
await preflightOrExit(target, creds);
|
|
94
|
+
return { space: target.space, server: target.server, creds };
|
|
95
|
+
}
|
|
15
96
|
function parse(argv) {
|
|
16
97
|
const { values, positionals } = parseArgs({
|
|
17
98
|
args: argv,
|
|
@@ -26,12 +107,14 @@ function parse(argv) {
|
|
|
26
107
|
model: { type: "string" }, // start: model override, wins over the agent file's `model:`
|
|
27
108
|
roster: { type: "string" },
|
|
28
109
|
creds: { type: "string" },
|
|
29
|
-
runtime: { type: "string" }, // supervise: force pty | tmux | cmux (default
|
|
110
|
+
runtime: { type: "string" }, // supervise: force pty | tmux | cmux (default pty)
|
|
30
111
|
"console-port": { type: "string" },
|
|
31
112
|
drive: { type: "boolean" },
|
|
32
113
|
transcript: { type: "boolean" },
|
|
33
114
|
"no-transcript": { type: "boolean" },
|
|
34
115
|
spawn: { type: "string" }, // comma-separated agent names to pre-spawn at startup
|
|
116
|
+
launch: { type: "string" }, // supervise: a resolved mesh-manifest launch spec (cotal up -f / spawn -f)
|
|
117
|
+
cwd: { type: "string" }, // working directory to root the spawned agent at
|
|
35
118
|
},
|
|
36
119
|
});
|
|
37
120
|
// These commands are flags-only — reject stray positionals instead of silently ignoring them
|
|
@@ -44,30 +127,14 @@ function parse(argv) {
|
|
|
44
127
|
}
|
|
45
128
|
return values;
|
|
46
129
|
}
|
|
47
|
-
/** Connect a short-lived client, send one control request to the manager,
|
|
48
|
-
*
|
|
49
|
-
* (
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
// mesh. Mirrors `cotal send`/`spawn`/`history`.
|
|
56
|
-
let creds = credsPath ? readFileSync(credsPath, "utf8") : undefined;
|
|
57
|
-
if (!creds) {
|
|
58
|
-
const auth = loadSpaceAuth(authDir(findCotalRoot()));
|
|
59
|
-
if (auth) {
|
|
60
|
-
if (space && space !== auth.space) {
|
|
61
|
-
console.error(c.red(`Auth here is for space "${auth.space}", not "${space}". Use --space ${auth.space} (or pass --creds).`));
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
creds = await mintCreds(auth, newIdentity(), "manager");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (!(await isReachable(server, { creds }))) {
|
|
68
|
-
console.error(c.red(`Can't reach NATS at ${server}. Run: cotal up`));
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
130
|
+
/** Connect a short-lived client with the resolved creds, send one control request to the manager,
|
|
131
|
+
* disconnect. The target is already reachability- + auth-preflighted by {@link resolveManagerTarget}
|
|
132
|
+
* (which prints the friendly message + prunes on failure), so this connects straight through. `tier`
|
|
133
|
+
* picks the control subject: privileged for spawn/ps; admin for the operator's cross-agent ops
|
|
134
|
+
* (stop/attach/purge), which the manager refuses on the privileged subject for a non-owner. `creds`
|
|
135
|
+
* is the privileged "manager" cred resolved by {@link resolveManagerTarget} (allow-all, so it
|
|
136
|
+
* reaches either subject), or undefined on an open mesh. */
|
|
137
|
+
async function ask(space, server, op, args, creds, tier = CONTROL_PRIVILEGED) {
|
|
71
138
|
const ep = new CotalEndpoint({
|
|
72
139
|
space,
|
|
73
140
|
servers: server,
|
|
@@ -102,7 +169,8 @@ async function start(argv) {
|
|
|
102
169
|
console.error(c.red("--name is required"));
|
|
103
170
|
process.exit(1);
|
|
104
171
|
}
|
|
105
|
-
const
|
|
172
|
+
const t = await resolveManagerTarget(v);
|
|
173
|
+
const reply = await ask(t.space, t.server, "start", {
|
|
106
174
|
name: v.name,
|
|
107
175
|
role: v.role,
|
|
108
176
|
agent: v.agent,
|
|
@@ -110,7 +178,8 @@ async function start(argv) {
|
|
|
110
178
|
model: v.model,
|
|
111
179
|
// Opt-in: only sent when `--transcript` is given; absent => the daemon's default (mirror off).
|
|
112
180
|
transcript: v.transcript ? true : undefined,
|
|
113
|
-
|
|
181
|
+
cwd: v.cwd,
|
|
182
|
+
}, t.creds);
|
|
114
183
|
failIfNotOk(reply);
|
|
115
184
|
const d = reply.data;
|
|
116
185
|
console.log(c.green(`✓ started ${c.bold(d.name)}`) +
|
|
@@ -124,15 +193,17 @@ async function stop(argv) {
|
|
|
124
193
|
}
|
|
125
194
|
// Operator stop is a cross-agent (admin) op — the CLI operator isn't the agent's spawner, so the
|
|
126
195
|
// privileged subject would reject it; admin (its allow-all "manager" cred reaches it) is correct.
|
|
127
|
-
const
|
|
196
|
+
const t = await resolveManagerTarget(v);
|
|
197
|
+
const reply = await ask(t.space, t.server, "stop", {
|
|
128
198
|
name: v.name,
|
|
129
|
-
},
|
|
199
|
+
}, t.creds, CONTROL_ADMIN);
|
|
130
200
|
failIfNotOk(reply);
|
|
131
201
|
console.log(c.dim(`✓ stopped ${v.name}`));
|
|
132
202
|
}
|
|
133
203
|
async function ps(argv) {
|
|
134
204
|
const v = parse(argv);
|
|
135
|
-
const
|
|
205
|
+
const t = await resolveManagerTarget(v);
|
|
206
|
+
const reply = await ask(t.space, t.server, "ps", undefined, t.creds);
|
|
136
207
|
failIfNotOk(reply);
|
|
137
208
|
const rows = reply.data ?? [];
|
|
138
209
|
if (!rows.length) {
|
|
@@ -160,9 +231,10 @@ async function attach(argv) {
|
|
|
160
231
|
}
|
|
161
232
|
// Operator attach is a cross-agent (admin) op — same reasoning as stop (the operator isn't the
|
|
162
233
|
// spawner; admin reaches any agent).
|
|
163
|
-
const
|
|
234
|
+
const t = await resolveManagerTarget(v);
|
|
235
|
+
const reply = await ask(t.space, t.server, "attach", {
|
|
164
236
|
name: v.name,
|
|
165
|
-
},
|
|
237
|
+
}, t.creds, CONTROL_ADMIN);
|
|
166
238
|
failIfNotOk(reply);
|
|
167
239
|
const { ws } = reply.data;
|
|
168
240
|
console.error(c.dim(`attached to ${v.name} — Ctrl-] to detach`));
|
|
@@ -170,10 +242,10 @@ async function attach(argv) {
|
|
|
170
242
|
console.error(c.dim(`\ndetached from ${v.name}`));
|
|
171
243
|
}
|
|
172
244
|
/** Run a manager daemon in this process (the long-lived supervisor), then block.
|
|
173
|
-
* `pty
|
|
174
|
-
* composition root (the `cotal` binary does). Stays alive until SIGINT/SIGTERM. */
|
|
245
|
+
* `pty` ships with the manager; `tmux` and `cmux` need their integration imported by
|
|
246
|
+
* the composition root (the `cotal` binary does). Stays alive until SIGINT/SIGTERM. */
|
|
175
247
|
// `--runtime` forces the manager runtime; honored only on the `supervise` path (default
|
|
176
|
-
//
|
|
248
|
+
// pty). `cmux` gives each teammate its own cmux tab — `cotal supervise --runtime cmux` is
|
|
177
249
|
// the cmux-tab manager. The session machinery launches it with `--runtime cmux --space <space>`
|
|
178
250
|
// contiguous, which is what `cmuxManagerRunning` pgreps for.
|
|
179
251
|
const RUNTIME_OVERRIDES = ["pty", "tmux", "cmux"];
|
|
@@ -189,9 +261,10 @@ async function runManager(argv, defaultRuntime) {
|
|
|
189
261
|
}
|
|
190
262
|
const space = spaceFor(v);
|
|
191
263
|
const server = v.server ?? DEFAULT_SERVER;
|
|
192
|
-
// Parse the roster before touching the network — a malformed file should fail fast,
|
|
264
|
+
// Parse the roster + launch spec before touching the network — a malformed file should fail fast,
|
|
193
265
|
// before the manager comes up or any agent is spawned.
|
|
194
266
|
const roster = v.roster ? loadRoster(v.roster) : [];
|
|
267
|
+
const launchSpec = v.launch ? loadLaunchSpec(v.launch) : undefined;
|
|
195
268
|
if (!(await isReachable(server))) {
|
|
196
269
|
console.error(c.red(`Can't reach NATS at ${server}. Run: cotal up`));
|
|
197
270
|
process.exit(1);
|
|
@@ -243,6 +316,34 @@ async function runManager(argv, defaultRuntime) {
|
|
|
243
316
|
}
|
|
244
317
|
}
|
|
245
318
|
}
|
|
319
|
+
// Declarative manifest boot (`cotal up -f` / `spawn -f`): materialize each resolved agent's
|
|
320
|
+
// transient persona, then spawn it with its resolved ACLs/identity. Staggered like `--spawn` so
|
|
321
|
+
// heavy cold-starts don't pile up. A failed entry is logged, non-fatal — healthy agents stay up.
|
|
322
|
+
if (launchSpec) {
|
|
323
|
+
const root = findCotalRoot();
|
|
324
|
+
for (let i = 0; i < launchSpec.agents.length; i++) {
|
|
325
|
+
const la = launchSpec.agents[i];
|
|
326
|
+
let configPath;
|
|
327
|
+
try {
|
|
328
|
+
configPath = materializePersona(root, launchSpec.runId, la);
|
|
329
|
+
}
|
|
330
|
+
catch (e) {
|
|
331
|
+
console.error(c.red(`✗ ${la.name}: ${e.message}`));
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
const reply = await mgr.startAgent(launchAgentToStartOpts(la, configPath));
|
|
335
|
+
if (!reply.ok) {
|
|
336
|
+
console.error(c.red(`✗ ${la.name}: ${reply.error}`));
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
const spawned = reply.data?.name ?? la.name;
|
|
340
|
+
console.log(c.green(`✓ launched ${spawned}`) + c.dim(` (${la.agent})`));
|
|
341
|
+
if (i < launchSpec.agents.length - 1) {
|
|
342
|
+
const joined = await mgr.waitForPresence(spawned);
|
|
343
|
+
console.log(c.dim(joined ? ` ${spawned} joined; starting next` : ` ${spawned} still starting; continuing`));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
246
347
|
await new Promise(() => { });
|
|
247
348
|
}
|
|
248
349
|
/** The manager's control-plane commands — the `supervise` daemon runner plus thin NATS
|
|
@@ -253,14 +354,14 @@ const managerCommands = [
|
|
|
253
354
|
kind: "command",
|
|
254
355
|
name: "supervise",
|
|
255
356
|
group: "Manager",
|
|
256
|
-
summary: "run a manager — [--runtime <pty|tmux|cmux>] (default
|
|
357
|
+
summary: "run a manager — [--runtime <pty|tmux|cmux>] (default pty; tmux/cmux are explicit-only, each teammate in its own window/tab) [--space <s>] [--server <url>] [--console-port <n>] [--roster <file>] [--launch <spec>]",
|
|
257
358
|
run: (argv) => runManager(argv, "auto"),
|
|
258
359
|
},
|
|
259
360
|
{
|
|
260
361
|
kind: "command",
|
|
261
362
|
name: "start",
|
|
262
363
|
group: "Control plane",
|
|
263
|
-
summary: "ask the manager to spawn a persona — --name <persona> [--role <r>] [--agent <a>] [--config <file>] [--model <m>] (loads .cotal/agents/<persona>.md; the peer joins under its name:)",
|
|
364
|
+
summary: "ask the manager to spawn a persona — --name <persona> [--role <r>] [--agent <a>] [--config <file>] [--model <m>] [--cwd <dir>] (loads .cotal/agents/<persona>.md; the peer joins under its name:)",
|
|
264
365
|
run: start,
|
|
265
366
|
},
|
|
266
367
|
{
|
package/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AC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,wBAAwB,CAAC,CAAC,CAAC,KAAK,OAAO,6BAA6B,CAAC,CAAC,CAAC;YAChH,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,IAAI,OAAO,CAAO,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;8CAE8C;AAC9C,MAAM,eAAe,GAAc;IACjC;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,SAAS;QAChB,OAAO,EACL,qNAAqN;QACvN,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;KACxC;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,eAAe;QACtB,OAAO,EACL,mMAAmM;QACrM,GAAG,EAAE,KAAK;KACX;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,+CAA+C;QACxD,GAAG,EAAE,IAAI;KACV;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,yCAAyC;QAClD,GAAG,EAAE,EAAE;KACR;IACD;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,+DAA+D;QACxE,GAAG,EAAE,MAAM;KACZ;CACF,CAAC;AAEF,QAAQ,CAAC,QAAQ,CAAC,GAAG,eAAe,CAAC,CAAC"}
|
package/dist/launch.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type MeshLaunchAgent, type MeshLaunchSpec } from "@cotal-ai/core";
|
|
2
|
+
/** Parse + strictly validate a launch spec file. Throws on any deviation (it's untrusted, local
|
|
3
|
+
* though it is) — including an agent name that isn't a safe mesh/file token (no path traversal). */
|
|
4
|
+
export declare function loadLaunchSpec(path: string): MeshLaunchSpec;
|
|
5
|
+
/** Resolve + load the launch spec for a run id, deriving the path from a known root rather than
|
|
6
|
+
* accepting one. The `launch` control op (`spawn -f` onto a running manager) passes a `runId`, NOT a
|
|
7
|
+
* path — so a (admin-only) caller can never make the manager read an arbitrary host-local JSON: the
|
|
8
|
+
* id must be a safe token, `.cotal/run` must be a real (non-symlink) dir chain, and the spec file
|
|
9
|
+
* itself must not be a symlink. Then the usual untrusted-input validation ({@link loadLaunchSpec})
|
|
10
|
+
* applies, and the spec's self-declared `runId` must match the requested one. */
|
|
11
|
+
export declare function launchSpecForRun(root: string, runId: string): MeshLaunchSpec;
|
|
12
|
+
/** Materialize one resolved agent's persona to a transient file the connector reads, and return its
|
|
13
|
+
* path. Carries only what a connector needs (identity/role/model/description + body) plus a loud
|
|
14
|
+
* generated-artifact header — never ACL/capability frontmatter (creds come from the spec's policy). */
|
|
15
|
+
export declare function materializePersona(root: string, runId: string, a: MeshLaunchAgent): string;
|
|
16
|
+
/** Build the manager spawn opts for a launch agent: identity/role/model + the resolved object
|
|
17
|
+
* (which carries the ACL authority) + the materialized configPath. */
|
|
18
|
+
export declare function launchAgentToStartOpts(a: MeshLaunchAgent, configPath: string): {
|
|
19
|
+
name: string;
|
|
20
|
+
agent: string;
|
|
21
|
+
role?: string;
|
|
22
|
+
model?: string;
|
|
23
|
+
config: string;
|
|
24
|
+
resolved: MeshLaunchAgent;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=launch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgG,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAwCzK;qGACqG;AACrG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAe3D;AAED;;;;;kFAKkF;AAClF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAe5E;AA2BD;;wGAEwG;AACxG,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,CAiB1F;AAED;uEACuE;AACvE,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,GAAG;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAEA"}
|
package/dist/launch.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, lstatSync } from "node:fs";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { assertValidChannel, assertValidName, ensureDirNoSymlink, isConcreteChannel, realDirNoSymlink } from "@cotal-ai/core";
|
|
5
|
+
/**
|
|
6
|
+
* Load + materialize a resolved launch spec for `supervise --launch`.
|
|
7
|
+
*
|
|
8
|
+
* The CLI's manifest resolver produces the spec (`cotal-launch/v1`); the manager treats it as
|
|
9
|
+
* **untrusted input** — strict schema, path-safe run id + agent names — then materializes each
|
|
10
|
+
* agent's persona to a **transient, non-authoritative** file under `.cotal/run/<runId>/agents/`
|
|
11
|
+
* (never `.cotal/agents/`, never persona-discoverable). Creds are minted from the spec's `policy`,
|
|
12
|
+
* not from this file, so the file carries no ACL/capability frontmatter.
|
|
13
|
+
*/
|
|
14
|
+
// A NATS-/path-safe token: connector type, role (a route token), capability, run id. Keeps a
|
|
15
|
+
// hand-edited/malicious launch spec from feeding rewritten route/capability strings into the manager
|
|
16
|
+
// path (channel policies are re-validated at provision time; these complete the untrusted contract).
|
|
17
|
+
const TOKEN = /^[A-Za-z0-9_-]+$/;
|
|
18
|
+
const RunId = z.string().regex(TOKEN, "runId must be a path-safe token ([A-Za-z0-9_-])");
|
|
19
|
+
const LaunchAgentSchema = z.strictObject({
|
|
20
|
+
name: z.string().min(1),
|
|
21
|
+
agent: z.string().regex(TOKEN, "agent must be a connector token ([A-Za-z0-9_-])"),
|
|
22
|
+
role: z.string().regex(TOKEN, "role must be a route-safe token ([A-Za-z0-9_-])").optional(),
|
|
23
|
+
model: z.string().optional(),
|
|
24
|
+
description: z.string().optional(),
|
|
25
|
+
body: z.string().optional(),
|
|
26
|
+
capabilities: z.array(z.string().regex(TOKEN, "capability must be a safe token ([A-Za-z0-9_-])")).optional(),
|
|
27
|
+
subscribe: z.array(z.string()),
|
|
28
|
+
allowSubscribe: z.array(z.string()),
|
|
29
|
+
allowPublish: z.array(z.string()),
|
|
30
|
+
personaPath: z.string().optional(),
|
|
31
|
+
hash: z.string().regex(/^[A-Za-z0-9]+$/, "hash must be alphanumeric"),
|
|
32
|
+
});
|
|
33
|
+
const LaunchSpecSchema = z.strictObject({
|
|
34
|
+
apiVersion: z.literal("cotal-launch/v1"),
|
|
35
|
+
space: z.string().min(1),
|
|
36
|
+
runId: RunId,
|
|
37
|
+
agents: z.array(LaunchAgentSchema),
|
|
38
|
+
});
|
|
39
|
+
/** Parse + strictly validate a launch spec file. Throws on any deviation (it's untrusted, local
|
|
40
|
+
* though it is) — including an agent name that isn't a safe mesh/file token (no path traversal). */
|
|
41
|
+
export function loadLaunchSpec(path) {
|
|
42
|
+
let json;
|
|
43
|
+
try {
|
|
44
|
+
json = JSON.parse(readFileSync(path, "utf8"));
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
throw new Error(`launch spec ${path}: ${e.message}`);
|
|
48
|
+
}
|
|
49
|
+
const r = LaunchSpecSchema.safeParse(json);
|
|
50
|
+
if (!r.success)
|
|
51
|
+
throw new Error(`launch spec ${path}: ${r.error.issues.map((i) => `${i.path.join(".") || "<root>"}: ${i.message}`).join("; ")}`);
|
|
52
|
+
for (const a of r.data.agents) {
|
|
53
|
+
assertValidName(a.name); // names the transient file → must be safe
|
|
54
|
+
validateLaunchPolicy(a); // don't let --launch be a looser second manifest format
|
|
55
|
+
}
|
|
56
|
+
return r.data;
|
|
57
|
+
}
|
|
58
|
+
/** Resolve + load the launch spec for a run id, deriving the path from a known root rather than
|
|
59
|
+
* accepting one. The `launch` control op (`spawn -f` onto a running manager) passes a `runId`, NOT a
|
|
60
|
+
* path — so a (admin-only) caller can never make the manager read an arbitrary host-local JSON: the
|
|
61
|
+
* id must be a safe token, `.cotal/run` must be a real (non-symlink) dir chain, and the spec file
|
|
62
|
+
* itself must not be a symlink. Then the usual untrusted-input validation ({@link loadLaunchSpec})
|
|
63
|
+
* applies, and the spec's self-declared `runId` must match the requested one. */
|
|
64
|
+
export function launchSpecForRun(root, runId) {
|
|
65
|
+
if (!TOKEN.test(runId))
|
|
66
|
+
throw new Error(`unsafe runId ${JSON.stringify(runId)} (allowed: letters, digits, _ -)`);
|
|
67
|
+
const runDir = realDirNoSymlink(root, ".cotal", "run"); // refuse a symlinked .cotal / run parent
|
|
68
|
+
if (!runDir)
|
|
69
|
+
throw new Error(`no launch spec for run ${runId} (.cotal/run is absent)`);
|
|
70
|
+
const path = join(runDir, `${runId}.json`);
|
|
71
|
+
let st;
|
|
72
|
+
try {
|
|
73
|
+
st = lstatSync(path);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
throw new Error(`no launch spec for run ${runId} at ${path}`);
|
|
77
|
+
}
|
|
78
|
+
if (st.isSymbolicLink())
|
|
79
|
+
throw new Error(`refusing to read launch spec "${path}": it is a symlink`);
|
|
80
|
+
const spec = loadLaunchSpec(path);
|
|
81
|
+
if (spec.runId !== runId)
|
|
82
|
+
throw new Error(`launch spec runId "${spec.runId}" does not match requested "${runId}"`);
|
|
83
|
+
return spec;
|
|
84
|
+
}
|
|
85
|
+
// Capabilities that actually grant anything in v1 (provisionAgent only acts on `spawn`); an unknown
|
|
86
|
+
// capability is inert downstream, so reject it at the boundary rather than carry a no-op grant.
|
|
87
|
+
const KNOWN_CAPABILITIES = new Set(["spawn"]);
|
|
88
|
+
/** Re-enforce the v1 manifest's policy constraints at the manager boundary so a hand-edited/malicious
|
|
89
|
+
* launch spec can't smuggle in what the CLI schema would reject: concrete channels only (no wildcard
|
|
90
|
+
* scopes — the v1 wildcard deferral), `subscribe ⊆ allowSubscribe`, and known capabilities. Channel
|
|
91
|
+
* policies are re-checked again at provision time, but this fails BEFORE any provisioning side effect. */
|
|
92
|
+
function validateLaunchPolicy(a) {
|
|
93
|
+
const where = `launch agent "${a.name}"`;
|
|
94
|
+
for (const [field, list] of [["subscribe", a.subscribe], ["allowSubscribe", a.allowSubscribe], ["allowPublish", a.allowPublish]])
|
|
95
|
+
for (const ch of list) {
|
|
96
|
+
try {
|
|
97
|
+
assertValidChannel(ch);
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
throw new Error(`${where}: ${field}: ${e.message}`);
|
|
101
|
+
}
|
|
102
|
+
if (!isConcreteChannel(ch))
|
|
103
|
+
throw new Error(`${where}: ${field} "${ch}" is a wildcard — not allowed in a v1 launch spec`);
|
|
104
|
+
}
|
|
105
|
+
const missing = a.subscribe.filter((c) => !a.allowSubscribe.includes(c));
|
|
106
|
+
if (missing.length)
|
|
107
|
+
throw new Error(`${where}: subscribe [${missing.join(", ")}] not within allowSubscribe`);
|
|
108
|
+
for (const cap of a.capabilities ?? [])
|
|
109
|
+
if (!KNOWN_CAPABILITIES.has(cap))
|
|
110
|
+
throw new Error(`${where}: unknown capability "${cap}" (known: ${[...KNOWN_CAPABILITIES].join(", ")})`);
|
|
111
|
+
}
|
|
112
|
+
/** Materialize one resolved agent's persona to a transient file the connector reads, and return its
|
|
113
|
+
* path. Carries only what a connector needs (identity/role/model/description + body) plus a loud
|
|
114
|
+
* generated-artifact header — never ACL/capability frontmatter (creds come from the spec's policy). */
|
|
115
|
+
export function materializePersona(root, runId, a) {
|
|
116
|
+
// 0700 dirs created component-by-component, refusing a symlinked parent (writes can't escape the
|
|
117
|
+
// run tree); plus a lexical direct-child check on the final path as belt-and-suspenders.
|
|
118
|
+
const dir = ensureDirNoSymlink(root, ".cotal", "run", runId, "agents");
|
|
119
|
+
const path = resolve(dir, `${a.name}.md`);
|
|
120
|
+
if (dirname(path) !== dir)
|
|
121
|
+
throw new Error(`unsafe agent name "${a.name}" — persona path escapes ${dir}`);
|
|
122
|
+
const fm = ["---", `name: ${a.name}`];
|
|
123
|
+
if (a.role)
|
|
124
|
+
fm.push(`role: ${scalar(a.role)}`);
|
|
125
|
+
if (a.model)
|
|
126
|
+
fm.push(`model: ${scalar(a.model)}`);
|
|
127
|
+
if (a.description)
|
|
128
|
+
fm.push(`description: ${scalar(a.description)}`);
|
|
129
|
+
fm.push("---", "");
|
|
130
|
+
const src = a.personaPath ?? "the manifest";
|
|
131
|
+
const header = `<!-- Generated runtime artifact from a cotal mesh manifest (run ${runId}). Do NOT edit — regenerated on each launch and deleted by \`cotal down\`. Edit ${src} instead. This file is not a reusable persona and carries no access authority. -->`;
|
|
132
|
+
const body = a.body ? `${a.body.trim()}\n` : "";
|
|
133
|
+
// `wx`: exclusive create — fails rather than following a symlink pre-planted at the path.
|
|
134
|
+
writeFileSync(path, `${fm.join("\n")}${header}\n\n${body}`, { mode: 0o600, flag: "wx" });
|
|
135
|
+
return path;
|
|
136
|
+
}
|
|
137
|
+
/** Build the manager spawn opts for a launch agent: identity/role/model + the resolved object
|
|
138
|
+
* (which carries the ACL authority) + the materialized configPath. */
|
|
139
|
+
export function launchAgentToStartOpts(a, configPath) {
|
|
140
|
+
return { name: a.name, agent: a.agent, role: a.role, model: a.model, config: configPath, resolved: a };
|
|
141
|
+
}
|
|
142
|
+
/** Quote a frontmatter scalar so the agent-file parser reads it back unchanged (it strips a matching
|
|
143
|
+
* outer quote pair). Plain tokens pass through; anything with structural chars is double-quoted. */
|
|
144
|
+
function scalar(v) {
|
|
145
|
+
if (v === v.trim() && !/^\[/.test(v) && !/[:#"'\r\n]/.test(v))
|
|
146
|
+
return v;
|
|
147
|
+
if (!v.includes('"') && !/[\r\n]/.test(v))
|
|
148
|
+
return `"${v}"`;
|
|
149
|
+
return JSON.stringify(v.replace(/[\r\n]+/g, " "));
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=launch.js.map
|