@cotal-ai/core 0.24.0 → 0.25.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/index.d.ts CHANGED
@@ -50,6 +50,7 @@ export * from "./agent-file.js";
50
50
  export * from "./launch.js";
51
51
  export * from "./fs-safe.js";
52
52
  export * from "./secret-fs.js";
53
+ export * from "./launch-material.js";
53
54
  export * from "./connector-config.js";
54
55
  export * from "./kv-scan.js";
55
56
  export * from "./endpoint.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sB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cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -50,6 +50,7 @@ export * from "./agent-file.js";
50
50
  export * from "./launch.js";
51
51
  export * from "./fs-safe.js";
52
52
  export * from "./secret-fs.js";
53
+ export * from "./launch-material.js";
53
54
  export * from "./connector-config.js";
54
55
  export * from "./kv-scan.js";
55
56
  export * from "./endpoint.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CA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oBAAoB,CAAC"}
@@ -0,0 +1,86 @@
1
+ /** The env var naming the launch-material file. It carries a PATH, never a secret. */
2
+ export declare const LAUNCH_MATERIAL_ENV = "COTAL_LAUNCH_MATERIAL";
3
+ /** What a launcher hands one spawned session. Every field is optional because the modes differ
4
+ * (open mesh has no creds; a static-auth launch has no user-mode identity; a launch with no
5
+ * control endpoint has no token), but an empty material file is refused at write time - an empty
6
+ * file would be a launcher bug that reads downstream as "open mode". */
7
+ export type LaunchMaterial = {
8
+ /** Broker URL(s) the session dials. */
9
+ servers?: string;
10
+ /** Path to the session's NATS creds file (static auth). */
11
+ creds?: string;
12
+ /** Auth token (token / open modes). */
13
+ token?: string;
14
+ /** Shared secret authenticating the first frame on the session's local control socket. */
15
+ controlToken?: string;
16
+ /** User-mode launch identity: principal, sentinel creds path, and the exec-able bearer command. */
17
+ userAuth?: {
18
+ owner: string;
19
+ actor: string;
20
+ sentinelCredsPath: string;
21
+ bearerCmd: string[];
22
+ };
23
+ };
24
+ /**
25
+ * Write one launch's material to a fresh 0600 file in a fresh 0700 directory and return its path.
26
+ *
27
+ * `mkdtemp` rather than a predictable name: a pre-created or symlinked path in the world-writable
28
+ * tmpdir cannot be raced, and a fresh file guarantees the private mode applies at CREATE (a mode
29
+ * argument is ignored on an overwrite). {@link hardenPrivate} covers win32, where the Unix mode is
30
+ * a no-op.
31
+ *
32
+ * REFUSES AN EMPTY MATERIAL rather than writing a file that says nothing. A launcher that computed
33
+ * no material has a bug, and the downstream reader cannot tell that apart from a deliberate open
34
+ * launch - which is precisely the silent-degradation this contract is not allowed to have.
35
+ */
36
+ export declare function writeLaunchMaterial(material: LaunchMaterial): string;
37
+ /**
38
+ * Read a launch-material file, or throw a sentence naming the path.
39
+ *
40
+ * FAIL-CLOSED ON A PERMISSIVE MODE. A material file readable by group or other is not a material
41
+ * file: it is the same disclosure this carrier exists to prevent, wearing a different hat. Refusing
42
+ * is the only honest answer, because the alternative (read it anyway, warn) leaves the operator with
43
+ * a session that works and a disclosure they will never look at again. Checked on POSIX only, where
44
+ * the mode bits mean what they say; win32 privacy is the ACL {@link hardenPrivate} set at write.
45
+ */
46
+ export declare function readLaunchMaterial(path: string): LaunchMaterial;
47
+ /**
48
+ * Discard one launch's material: unlink the file, and remove the private directory ONLY when this
49
+ * module can tell it wrote that directory itself.
50
+ *
51
+ * THIS FUNCTION EXISTS BECAUSE ITS FIRST VERSION WAS DANGEROUS, and the shape of that mistake is
52
+ * worth keeping in front of whoever edits it next. The first version removed the parent RECURSIVELY
53
+ * whenever its basename began with the writer's prefix, under a comment claiming that proved the
54
+ * directory came from here. It proved that a string starts with another string. A pointer set by
55
+ * hand at any path whose parent happened to be named `cotal-launch-anything` took that parent and
56
+ * every sibling file with it, and the gap between the unlink and the removal turned a concurrent
57
+ * create into collateral deletion. A cleanup added to a security change must not be the most
58
+ * destructive thing in it.
59
+ *
60
+ * So the directory removal is structural rather than a name test, and all four conditions hold or
61
+ * the directory simply stays:
62
+ *
63
+ * - the file is named exactly what {@link writeLaunchMaterial} names it;
64
+ * - its parent carries the writer's prefix;
65
+ * - that parent sits DIRECTLY in the OS temp root, resolved through symlinks on both sides so
66
+ * `/tmp` and a `/private/tmp` style real path compare equal;
67
+ * - and the removal is `rmdir`, which cannot recurse at all, so a directory holding anything else
68
+ * fails to go and is left exactly as it was found. That is the load-bearing one: the other three
69
+ * are defence in depth, while this one makes "anything else in here means this is not ours" true
70
+ * by construction rather than by intention. It is also what closes the race, because a file
71
+ * created between the file's removal and the directory's makes the directory's FAIL rather than
72
+ * making it destroy more.
73
+ *
74
+ * THE FILE, BY CONTRAST, IS UNLINKED UNCONDITIONALLY, and the asymmetry is deliberate rather than an
75
+ * oversight. {@link LAUNCH_MATERIAL_ENV} names material for ONE launch, and by the time a discard
76
+ * runs the session has already read it, so a pointer is a statement about a file that has served its
77
+ * purpose, wherever it happens to live. A hand-set pointer at a file somebody wanted to keep is a
78
+ * misuse of that variable rather than a case to defend. Deleting the named file is the operation the
79
+ * caller asked for; deleting a directory is an inference about something the caller never named, and
80
+ * an inference needs proof.
81
+ *
82
+ * Both halves are best effort: a discard that throws would turn tidy-up into a failed session, and
83
+ * the state it would fail into is the state every launch had before this function existed.
84
+ */
85
+ export declare function discardLaunchMaterial(path: string): void;
86
+ //# sourceMappingURL=launch-material.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch-material.d.ts","sourceRoot":"","sources":["../src/launch-material.ts"],"names":[],"mappings":"AAkDA,sFAAsF;AACtF,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D;;;yEAGyE;AACzE,MAAM,MAAM,cAAc,GAAG;IAC3B,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mGAAmG;IACnG,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC7F,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAWpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAuB/D;AAwDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAgBxD"}
@@ -0,0 +1,217 @@
1
+ /**
2
+ * The launch-material file - how a launcher hands a spawned session its connection material and
3
+ * control token WITHOUT putting either into an environment every descendant process inherits.
4
+ *
5
+ * THE FAILURE THIS EXISTS TO CLOSE. A process environment is inherited transitively and invisibly.
6
+ * A seat launched with `COTAL_CREDS` / `COTAL_SERVERS` / `COTAL_CONTROL_TOKEN` in its environment
7
+ * hands all three to every build script, linter, test suite and third-party CLI it ever shells out
8
+ * to. Measured on a sandbox mesh: an ordinary `node` process run by a seat's shell tool inherited
9
+ * the whole set, read the creds file, and opened an authenticated broker connection AS THE SEAT,
10
+ * having done no credential handling of any kind. `COTAL_SERVERS` pointing at a live broker is the
11
+ * same defect wearing a test-isolation costume: a suite that defaults its server from the
12
+ * environment silently targets production instead of its own fixture, and passes.
13
+ *
14
+ * THE SHAPE, and it is the repo's own precedent rather than a new invention: the secret rides a
15
+ * FILE, never argv (ps-visible) and never the ambient environment (inherited). `cotal agent-bearer`
16
+ * already reads its spawn-time secret from a 0600 token file for exactly this reason. Here the
17
+ * launcher writes ONE 0600 JSON file inside a 0700 private directory and puts only its PATH in the
18
+ * child environment ({@link LAUNCH_MATERIAL_ENV}); the session reads it once at startup.
19
+ *
20
+ * WHAT THAT DOES AND DOES NOT BUY, stated plainly so nobody reads more into it. It removes the
21
+ * values from every descendant's environment: an `env` dump, a CI log capture, a suite that reads
22
+ * `COTAL_SERVERS`, a tool handed the credential it never asked for. It does NOT hide the material
23
+ * from a process running as the same user that deliberately opens the referenced file, and no
24
+ * environment-level control can - that is the filesystem boundary the spawned-agent env allow-list
25
+ * already documents as out of its scope. What changes is that reaching the material becomes a
26
+ * deliberate act instead of an inheritance nobody chose. Connectors whose session runs IN the seat
27
+ * process close the remaining hop by dropping the reference once it has been read (see
28
+ * `scrubLaunchMaterial` in the connector runtime).
29
+ *
30
+ * HOW LONG THE FILE LIVES, split by connector, because there is no single answer and writing one
31
+ * would be the overclaim this file is otherwise careful to avoid. Where the session runs in the
32
+ * process that executes the tool calls (pi, codex, and OpenCode inside the server its shim starts)
33
+ * there is no later reader, so that session calls {@link discardLaunchMaterial} at startup and the
34
+ * file and its private directory cease to exist. Where readers start LATER (the Claude connector's
35
+ * MCP server and its one-process-per-hook relays, the Hermes launcher's gateway child) the file has
36
+ * to outlive startup, so it lives as long as the seat and the OS temp reaper is what removes it. A
37
+ * launch that dies before its session starts leaves its file to that same reaper.
38
+ */
39
+ import { mkdtempSync, readFileSync, realpathSync, rmSync, rmdirSync, statSync } from "node:fs";
40
+ import { tmpdir } from "node:os";
41
+ import { basename, dirname, join, resolve } from "node:path";
42
+ import { hardenPrivate, writeSecretFile } from "./secret-fs.js";
43
+ /** The prefix {@link writeLaunchMaterial} gives its private directory, and the single filename it
44
+ * puts inside. Named constants because {@link discardLaunchMaterial} has to recognise this module's
45
+ * own work, and a cleanup that recognises it by a string typed out twice is a cleanup that will one
46
+ * day delete something else. */
47
+ const DIR_PREFIX = "cotal-launch-";
48
+ const MATERIAL_FILE = "material.json";
49
+ /** The env var naming the launch-material file. It carries a PATH, never a secret. */
50
+ export const LAUNCH_MATERIAL_ENV = "COTAL_LAUNCH_MATERIAL";
51
+ /**
52
+ * Write one launch's material to a fresh 0600 file in a fresh 0700 directory and return its path.
53
+ *
54
+ * `mkdtemp` rather than a predictable name: a pre-created or symlinked path in the world-writable
55
+ * tmpdir cannot be raced, and a fresh file guarantees the private mode applies at CREATE (a mode
56
+ * argument is ignored on an overwrite). {@link hardenPrivate} covers win32, where the Unix mode is
57
+ * a no-op.
58
+ *
59
+ * REFUSES AN EMPTY MATERIAL rather than writing a file that says nothing. A launcher that computed
60
+ * no material has a bug, and the downstream reader cannot tell that apart from a deliberate open
61
+ * launch - which is precisely the silent-degradation this contract is not allowed to have.
62
+ */
63
+ export function writeLaunchMaterial(material) {
64
+ const present = Object.values(material).some((v) => v !== undefined);
65
+ if (!present)
66
+ throw new Error("launch material: refusing to write an empty material file - a launch with nothing to hand the session must not reference one at all");
67
+ const dir = mkdtempSync(join(tmpdir(), DIR_PREFIX));
68
+ hardenPrivate(dir, "dir"); // win32: mkdtemp's 0700 is a no-op, harden the ACL before the file lands
69
+ const path = join(dir, MATERIAL_FILE);
70
+ writeSecretFile(path, JSON.stringify(material));
71
+ return path;
72
+ }
73
+ /**
74
+ * Read a launch-material file, or throw a sentence naming the path.
75
+ *
76
+ * FAIL-CLOSED ON A PERMISSIVE MODE. A material file readable by group or other is not a material
77
+ * file: it is the same disclosure this carrier exists to prevent, wearing a different hat. Refusing
78
+ * is the only honest answer, because the alternative (read it anyway, warn) leaves the operator with
79
+ * a session that works and a disclosure they will never look at again. Checked on POSIX only, where
80
+ * the mode bits mean what they say; win32 privacy is the ACL {@link hardenPrivate} set at write.
81
+ */
82
+ export function readLaunchMaterial(path) {
83
+ let raw;
84
+ try {
85
+ if (process.platform !== "win32") {
86
+ const mode = statSync(path).mode & 0o777;
87
+ if (mode & 0o077)
88
+ throw new Error(`is readable beyond its owner (mode ${mode.toString(8)}) - refusing to read connection material out of a file other local users can open`);
89
+ }
90
+ raw = readFileSync(path, "utf8");
91
+ }
92
+ catch (e) {
93
+ throw new Error(`launch material: cannot read ${path} (${e instanceof Error ? e.message : String(e)})`);
94
+ }
95
+ let parsed;
96
+ try {
97
+ parsed = JSON.parse(raw);
98
+ }
99
+ catch {
100
+ throw new Error(`launch material: ${path} is not valid JSON`);
101
+ }
102
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
103
+ throw new Error(`launch material: ${path} must contain a JSON object`);
104
+ return validate(parsed, path);
105
+ }
106
+ /**
107
+ * Grade what came off disk, because the WRITE-side refusal is not a read-side guarantee.
108
+ *
109
+ * {@link writeLaunchMaterial} refuses to write an empty material, and for a while that was the only
110
+ * check. It is the wrong place for it to be alone: the reader is handed a path by an environment
111
+ * variable, and a file that is empty, truncated, half-written or shaped wrong reaches it without
112
+ * ever passing through the writer. `{}` parsed cleanly, produced a material with every field
113
+ * undefined, and `configFromEnv` then filled in its defaults - so a launch that REFERENCED material
114
+ * and got nothing usable resolved to the default broker with no credential. Open mode, silently,
115
+ * on a launch that asked for the opposite. That is the exact silent degradation this carrier is
116
+ * supposed to make impossible, arriving through the one door the write-side rule does not cover.
117
+ *
118
+ * So every field is graded here and a bad one throws. Unknown keys are ignored on purpose (a newer
119
+ * launcher may carry a field this reader does not know), but a material with nothing this reader
120
+ * RECOGNISES is refused: there is no launch it could correctly describe.
121
+ */
122
+ function validate(raw, path) {
123
+ const material = {};
124
+ const str = (key) => {
125
+ const v = raw[key];
126
+ if (v === undefined)
127
+ return;
128
+ if (typeof v !== "string" || !v.trim())
129
+ throw new Error(`launch material: ${path} has a ${key} that is not a non-empty string`);
130
+ material[key] = v;
131
+ };
132
+ str("servers");
133
+ str("creds");
134
+ str("token");
135
+ str("controlToken");
136
+ if (raw.userAuth !== undefined) {
137
+ const u = raw.userAuth;
138
+ if (typeof u !== "object" || u === null || Array.isArray(u))
139
+ throw new Error(`launch material: ${path} has a userAuth that is not an object`);
140
+ const { owner, actor, sentinelCredsPath, bearerCmd } = u;
141
+ const named = { owner, actor, sentinelCredsPath };
142
+ for (const [k, v] of Object.entries(named))
143
+ if (typeof v !== "string" || !v.trim())
144
+ throw new Error(`launch material: ${path} has a userAuth.${k} that is not a non-empty string`);
145
+ if (!Array.isArray(bearerCmd) || bearerCmd.length === 0 || !bearerCmd.every((a) => typeof a === "string" && a))
146
+ throw new Error(`launch material: ${path} has a userAuth.bearerCmd that is not a non-empty array of strings`);
147
+ material.userAuth = {
148
+ owner: owner,
149
+ actor: actor,
150
+ sentinelCredsPath: sentinelCredsPath,
151
+ bearerCmd: bearerCmd,
152
+ };
153
+ }
154
+ if (Object.keys(material).length === 0)
155
+ throw new Error(`launch material: ${path} carries nothing this reader recognises. A launch that references material and supplies none is a broken launcher, not an open-mode launch, so it is refused rather than defaulted.`);
156
+ return material;
157
+ }
158
+ /**
159
+ * Discard one launch's material: unlink the file, and remove the private directory ONLY when this
160
+ * module can tell it wrote that directory itself.
161
+ *
162
+ * THIS FUNCTION EXISTS BECAUSE ITS FIRST VERSION WAS DANGEROUS, and the shape of that mistake is
163
+ * worth keeping in front of whoever edits it next. The first version removed the parent RECURSIVELY
164
+ * whenever its basename began with the writer's prefix, under a comment claiming that proved the
165
+ * directory came from here. It proved that a string starts with another string. A pointer set by
166
+ * hand at any path whose parent happened to be named `cotal-launch-anything` took that parent and
167
+ * every sibling file with it, and the gap between the unlink and the removal turned a concurrent
168
+ * create into collateral deletion. A cleanup added to a security change must not be the most
169
+ * destructive thing in it.
170
+ *
171
+ * So the directory removal is structural rather than a name test, and all four conditions hold or
172
+ * the directory simply stays:
173
+ *
174
+ * - the file is named exactly what {@link writeLaunchMaterial} names it;
175
+ * - its parent carries the writer's prefix;
176
+ * - that parent sits DIRECTLY in the OS temp root, resolved through symlinks on both sides so
177
+ * `/tmp` and a `/private/tmp` style real path compare equal;
178
+ * - and the removal is `rmdir`, which cannot recurse at all, so a directory holding anything else
179
+ * fails to go and is left exactly as it was found. That is the load-bearing one: the other three
180
+ * are defence in depth, while this one makes "anything else in here means this is not ours" true
181
+ * by construction rather than by intention. It is also what closes the race, because a file
182
+ * created between the file's removal and the directory's makes the directory's FAIL rather than
183
+ * making it destroy more.
184
+ *
185
+ * THE FILE, BY CONTRAST, IS UNLINKED UNCONDITIONALLY, and the asymmetry is deliberate rather than an
186
+ * oversight. {@link LAUNCH_MATERIAL_ENV} names material for ONE launch, and by the time a discard
187
+ * runs the session has already read it, so a pointer is a statement about a file that has served its
188
+ * purpose, wherever it happens to live. A hand-set pointer at a file somebody wanted to keep is a
189
+ * misuse of that variable rather than a case to defend. Deleting the named file is the operation the
190
+ * caller asked for; deleting a directory is an inference about something the caller never named, and
191
+ * an inference needs proof.
192
+ *
193
+ * Both halves are best effort: a discard that throws would turn tidy-up into a failed session, and
194
+ * the state it would fail into is the state every launch had before this function existed.
195
+ */
196
+ export function discardLaunchMaterial(path) {
197
+ const file = resolve(path);
198
+ try {
199
+ rmSync(file, { force: true });
200
+ }
201
+ catch {
202
+ /* not ours to remove; the directory check below still refuses to guess */
203
+ }
204
+ const dir = dirname(file);
205
+ if (basename(file) !== MATERIAL_FILE || !basename(dir).startsWith(DIR_PREFIX))
206
+ return;
207
+ try {
208
+ if (realpathSync(dirname(dir)) !== realpathSync(tmpdir()))
209
+ return;
210
+ // rmdir cannot recurse: anything else inside means this is not ours to delete.
211
+ rmdirSync(dir);
212
+ }
213
+ catch {
214
+ /* not empty, not there, or not resolvable: leaving it is always the safe answer */
215
+ }
216
+ }
217
+ //# sourceMappingURL=launch-material.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launch-material.js","sourceRoot":"","sources":["../src/launch-material.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;iCAGiC;AACjC,MAAM,UAAU,GAAG,eAAe,CAAC;AACnC,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC,sFAAsF;AACtF,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAmB3D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAwB;IAC1D,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACrE,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,KAAK,CACb,qIAAqI,CACtI,CAAC;IACJ,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IACpD,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAA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,IAAI,GAAE,QAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB3H;AAoBD;;gFAEgF;AAChF,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,GAAE,QAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB1H;AAED;;;;;;;;;;oFAUoF;AACpF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;CAC5B,GAAG,MAAM,CAST;AAkBD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,gBAAgB,EAAE,EACnC,IAAI,EAAE;IACJ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB;4FACwF;IACxF,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD;;;;mEAI+D;IAC/D,SAAS,EAAE,eAAe,CAAC;IAC3B;;;;kEAI8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;8DAC0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,MAAM,CAwCR"}
package/dist/provision.js CHANGED
@@ -592,6 +592,23 @@ export function permissionsFor(profile, space, pr, opts) {
592
592
  `$JS.ACK.${CHAT}.>`,
593
593
  `$JS.API.CONSUMER.CREATE.${KV}.>`, // kv.watch ordered consumer (roster is public)
594
594
  `$JS.API.CONSUMER.INFO.${KV}.>`,
595
+ // ...and DELETE, which this bucket was the only watched one missing. An ordered consumer
596
+ // REBUILDS ITSELF whenever it stops hearing from the server (idle_heartbeat 30s, two missed),
597
+ // and the rebuild DELETES its predecessor before creating the successor. Without this grant
598
+ // that delete is refused, so the predecessor lives on until its 5-minute inactivity threshold
599
+ // and the broker logs a Publish Violation for every rebuild. Reproduced against a stalled link
600
+ // (connection up, bytes not moving, which is what a saturated WAN link looks like): two stalls
601
+ // left NINE consumers on this one bucket and 21 violations in the broker log, on the cred
602
+ // `cotal web` mints. The three sibling buckets below and above already carry it; this was the
603
+ // gap, not a narrowing.
604
+ //
605
+ // WHY `.>` AND NOT A NAME. An ordered consumer's name is `oc_<nuid>_<serial>`, generated by the
606
+ // CLIENT at watch time and incremented on every rebuild, so there is no name to pin at mint
607
+ // time and NATS has no partial-token wildcard to pin a prefix with. Stream-scoped is the
608
+ // narrowest form this verb has. The capability it adds over the existing CREATE is the ability
609
+ // to delete a consumer on the world-readable presence bucket; this elevated profile already
610
+ // holds exactly that on CHAT, the channel registry, and the membership feed.
611
+ `$JS.API.CONSUMER.DELETE.${KV}.>`,
595
612
  // Channel registry read (watch + direct kv.get + enriched listChannels) — config is
596
613
  // world-readable. STREAM.MSG.GET is the verb kv.get() rides (the bucket has no allow_direct).
597
614
  `$JS.API.STREAM.INFO.${CHKV}`,
@@ -724,15 +741,36 @@ export function permissionsFor(profile, space, pr, opts) {
724
741
  const baseline = epBaselineGrantRows(space, epCaller);
725
742
  pubAllow.push(...baseline.pub);
726
743
  const epSub = [...baseline.sub];
727
- if (opts.capabilities?.includes("spawn"))
728
- pubAllow.push(...epCallerGrantRows(space, spawnCallerCapabilities(pr.owner), epCaller).pub);
729
- if (opts.capabilities?.includes("admin"))
730
- // The admin capability's ep mirror (the 1c grant-migration table): the v0.3 `ctl.<admin>`
731
- // subject above grants the FULL admin-tier op reach, so its holder gets the admin instrument
732
- // set on the ep rails any-mode despawn/attach + the `manager.admin` family + the reads. In
733
- // user mode this is the ledger `admin` scope arriving via the callout, the broker-enforced
734
- // half of the tier; the manager's ledger-derived per-op admin flag stays on top of it.
735
- pubAllow.push(...epCallerGrantRows(space, operatorInstrumentCapabilities("admin", pr.owner), epCaller).pub);
744
+ // BOTH HALVES OF THE ROLLUP, NOT JUST `pub`. `epCallerGrantRows` returns `{pub, sub}` and its
745
+ // `sub` is the per-goal progress row its own docblock promises: "a goal-bearing capability
746
+ // (spawn/launch) adds ONE per-endpoint epGoalProgressGrantRow - the caller may follow its OWN
747
+ // goal to terminal". Taking `.pub` alone minted a credential that may SUBMIT a goal and may not
748
+ // HEAR it, so the broker refused the follow and the caller reported a timeout about a goal whose
749
+ // terminal had already been committed (#610). `spawn` is goal-bearing, so this `sub` is never
750
+ // empty here - the row was computed correctly and discarded one property access short of the
751
+ // credential.
752
+ if (opts.capabilities?.includes("spawn")) {
753
+ const rows = epCallerGrantRows(space, spawnCallerCapabilities(pr.owner), epCaller);
754
+ pubAllow.push(...rows.pub);
755
+ for (const s of rows.sub)
756
+ if (!epSub.includes(s))
757
+ epSub.push(s);
758
+ }
759
+ if (opts.capabilities?.includes("admin"))
760
+ // The admin capability's ep mirror (the 1c grant-migration table): the v0.3 `ctl.<admin>`
761
+ // subject above grants the FULL admin-tier op reach, so its holder gets the admin instrument
762
+ // set on the ep rails — any-mode despawn/attach + the `manager.admin` family + the reads. In
763
+ // user mode this is the ledger `admin` scope arriving via the callout, the broker-enforced
764
+ // half of the tier; the manager's ledger-derived per-op admin flag stays on top of it.
765
+ {
766
+ // Same `{pub, sub}` contract as the spawn branch above: an admin instrument's set carries the
767
+ // goal-bearing lifecycle commands, so it earns the same follow row.
768
+ const rows = epCallerGrantRows(space, operatorInstrumentCapabilities("admin", pr.owner), epCaller);
769
+ pubAllow.push(...rows.pub);
770
+ for (const s of rows.sub)
771
+ if (!epSub.includes(s))
772
+ epSub.push(s);
773
+ }
736
774
  if (opts.endpointCapabilities?.length) {
737
775
  if (opts.lifecycleUid !== undefined && assertLifecycleToken(opts.lifecycleUid) !== uid)
738
776
  throw new Error(`permissionsFor: opts.lifecycleUid "${opts.lifecycleUid}" disagrees with the principal's lifecycleUid "${uid}" - one credential names ONE incarnation on the caller rail (SPEC 13.1/13.2)`);