@eir-labs/coltrane 0.9.4 → 0.11.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/agents/bandleader.json +54 -0
- package/agents/bill.json +4 -2
- package/agents/change-verifier.json +2 -1
- package/agents/code-implementer.json +7 -4
- package/agents/john.json +5 -3
- package/agents/lineage-scout-external.json +19 -6
- package/agents/lineage-scribe.json +20 -9
- package/agents/lineage-weaver.json +26 -11
- package/agents/miles.json +2 -1
- package/agents/players/bandleader.md +70 -0
- package/agents/pr-publisher.json +4 -2
- package/agents/red-spec-drafter.json +12 -6
- package/agents/room-prober.json +29 -0
- package/agents/source-walker.json +1 -1
- package/charts/room-probe-chart-v1.json +14 -0
- package/charts/worker-contract-docker-v2.json +135 -0
- package/charts/worker-contract-v3.json +206 -0
- package/dist/src/boundary_check.d.ts +18 -0
- package/dist/src/boundary_check.js +70 -0
- package/dist/src/boundary_check.js.map +1 -0
- package/dist/src/boundary_scan.d.ts +62 -0
- package/dist/src/boundary_scan.js +93 -0
- package/dist/src/boundary_scan.js.map +1 -0
- package/dist/src/chart.js +34 -1
- package/dist/src/chart.js.map +1 -1
- package/dist/src/claude_invoker.d.ts +2 -1
- package/dist/src/claude_invoker.js +150 -17
- package/dist/src/claude_invoker.js.map +1 -1
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +61 -26
- package/dist/src/cli.js.map +1 -1
- package/dist/src/drain_preflight.d.ts +33 -0
- package/dist/src/drain_preflight.js +97 -0
- package/dist/src/drain_preflight.js.map +1 -0
- package/dist/src/genome_schema.d.ts +390 -9
- package/dist/src/genome_schema.js +163 -8
- package/dist/src/genome_schema.js.map +1 -1
- package/dist/src/genome_store.js +9 -0
- package/dist/src/genome_store.js.map +1 -1
- package/dist/src/genome_writer.d.ts +1 -1
- package/dist/src/genome_writer.js +10 -2
- package/dist/src/genome_writer.js.map +1 -1
- package/dist/src/gig_conformance.d.ts +66 -0
- package/dist/src/gig_conformance.js +153 -0
- package/dist/src/gig_conformance.js.map +1 -0
- package/dist/src/gig_tracker.js +8 -0
- package/dist/src/gig_tracker.js.map +1 -1
- package/dist/src/grounding.d.ts +44 -0
- package/dist/src/grounding.js +127 -0
- package/dist/src/grounding.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/institution_loader.d.ts +29 -5
- package/dist/src/institution_loader.js +67 -6
- package/dist/src/institution_loader.js.map +1 -1
- package/dist/src/lineage_adoption.d.ts +82 -0
- package/dist/src/lineage_adoption.js +82 -0
- package/dist/src/lineage_adoption.js.map +1 -0
- package/dist/src/lineage_persist.d.ts +34 -0
- package/dist/src/lineage_persist.js +60 -0
- package/dist/src/lineage_persist.js.map +1 -0
- package/dist/src/loader.d.ts +13 -0
- package/dist/src/loader.js +43 -2
- package/dist/src/loader.js.map +1 -1
- package/dist/src/mcp.js +37 -4
- package/dist/src/mcp.js.map +1 -1
- package/dist/src/org_hire.d.ts +23 -0
- package/dist/src/org_hire.js +42 -0
- package/dist/src/org_hire.js.map +1 -0
- package/dist/src/output_mirror.js +98 -59
- package/dist/src/output_mirror.js.map +1 -1
- package/dist/src/outputs.d.ts +17 -0
- package/dist/src/outputs.js +86 -1
- package/dist/src/outputs.js.map +1 -1
- package/dist/src/player_to_claude_code.js +26 -2
- package/dist/src/player_to_claude_code.js.map +1 -1
- package/dist/src/registry.d.ts +3 -1
- package/dist/src/registry.js +43 -3
- package/dist/src/registry.js.map +1 -1
- package/dist/src/repo_index.d.ts +58 -0
- package/dist/src/repo_index.js +232 -0
- package/dist/src/repo_index.js.map +1 -0
- package/dist/src/reuse.d.ts +44 -4
- package/dist/src/reuse.js +0 -0
- package/dist/src/reuse.js.map +1 -1
- package/dist/src/runtime.d.ts +82 -0
- package/dist/src/runtime.js +254 -25
- package/dist/src/runtime.js.map +1 -1
- package/dist/src/server.d.ts +37 -0
- package/dist/src/server.js +422 -11
- package/dist/src/server.js.map +1 -1
- package/dist/src/server_relay.d.ts +40 -2
- package/dist/src/server_relay.js +186 -19
- package/dist/src/server_relay.js.map +1 -1
- package/dist/src/tool_providers.d.ts +27 -0
- package/dist/src/tool_providers.js +48 -0
- package/dist/src/tool_providers.js.map +1 -1
- package/dist/src/venue_credential.d.ts +41 -0
- package/dist/src/venue_credential.js +57 -0
- package/dist/src/venue_credential.js.map +1 -0
- package/dist/src/venue_realize.d.ts +23 -0
- package/dist/src/venue_realize.js +43 -3
- package/dist/src/venue_realize.js.map +1 -1
- package/dist/src/venue_realizer.d.ts +224 -0
- package/dist/src/venue_realizer.js +889 -0
- package/dist/src/venue_realizer.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/src/worker.d.ts +37 -0
- package/dist/src/worker.js +127 -24
- package/dist/src/worker.js.map +1 -1
- package/dist/src/worker_env.d.ts +79 -0
- package/dist/src/worker_env.js +322 -0
- package/dist/src/worker_env.js.map +1 -0
- package/dist/src/workspace.d.ts +12 -1
- package/dist/src/workspace.js +10 -3
- package/dist/src/workspace.js.map +1 -1
- package/domain_types/change-context.json +59 -13
- package/domain_types/lineage-adoption-target.json +22 -0
- package/domain_types/lineage-map.json +7 -2
- package/domain_types/lineage-record.json +55 -5
- package/domain_types/prior-art-hit.json +16 -1
- package/domain_types/red-spec.json +5 -3
- package/domain_types/woodshed-record.json +149 -0
- package/evals/gist-present.json +7 -0
- package/institutions/coltrane.json +178 -6
- package/package.json +6 -3
- package/skills/non-vacuity-probe/fixtures/fixture-001.json +17 -0
- package/skills/non-vacuity-probe/meta.json +12 -0
- package/skills/non-vacuity-probe/skill.md +27 -0
- package/skills/non-vacuity-probe/skill.mjs +81 -0
- package/standards/lineage-adopt-v0.json +37 -0
- package/standards/room-probe-v1.json +28 -0
- package/standards/software-change-pr-v1.json +15 -15
- package/standards/software-change-red-first-v0.json +183 -0
- package/standards/spec-review-and-sequence-v0.json +112 -0
- package/standards/studio-session-v0.json +101 -0
- package/tours/coltrane.json +72 -0
- package/venues/engine-room-v1.json +32 -0
|
@@ -22,8 +22,16 @@ export declare function matchServerRestart(msg: JsonRpcMessage): string | number
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function isToolsListResponse(msg: JsonRpcMessage): boolean;
|
|
24
24
|
/**
|
|
25
|
-
* In-place augment a `tools/list` response so it carries
|
|
26
|
-
*
|
|
25
|
+
* In-place augment a `tools/list` response so it carries the relay's `server_restart` entry.
|
|
26
|
+
* Returns the mutated message for convenience.
|
|
27
|
+
*
|
|
28
|
+
* The relay is the TRUE owner of this tool — it intercepts `tools/call server_restart` and never
|
|
29
|
+
* lets it reach the child. So the schema the client discovers must be the relay's, which advertises
|
|
30
|
+
* the `force` restart-guard override (venue/8) the relay itself reads. The child's registry entry
|
|
31
|
+
* (src/mcp.ts) is an argument-free introspection stub that exists only so tool_inspect/system_audit
|
|
32
|
+
* see the tool; if it slipped into the client's list it would hide `force`. So we REPLACE any child
|
|
33
|
+
* entry with the relay's authoritative one, rather than defer to a stub that advertises less than
|
|
34
|
+
* the relay honours. The result carries exactly one `server_restart`, and it is the relay's.
|
|
27
35
|
*/
|
|
28
36
|
export declare function augmentToolsList(msg: JsonRpcMessage): JsonRpcMessage;
|
|
29
37
|
/**
|
|
@@ -48,6 +56,36 @@ export declare function buildRestartError(id: string | number | null, reason: st
|
|
|
48
56
|
* discarded and the caller waits forever.
|
|
49
57
|
*/
|
|
50
58
|
export declare function buildNoChildError(id: string | number | null, method: string): JsonRpcMessage;
|
|
59
|
+
/** Reserved relay→child method: "which gigs are running right now?" → { running: string[] }. */
|
|
60
|
+
export declare const RUNNING_GIGS_METHOD = "coltrane/relay/running_gigs";
|
|
61
|
+
/** Reserved relay→child method (force path only): abort each running gig and LEDGER the abort,
|
|
62
|
+
* BEFORE the child is killed, so a killed gig is a recorded fact rather than an absence. */
|
|
63
|
+
export declare const ABORT_FOR_RESTART_METHOD = "coltrane/relay/abort_for_restart";
|
|
64
|
+
/** How long the child gets to answer the pre-restart gig check before the relay refuses. A child
|
|
65
|
+
* that does not answer is treated as UNHEALTHY — never assumed idle — because an unresponsive
|
|
66
|
+
* child is exactly when a silent kill would destroy the most work and when a restart is most
|
|
67
|
+
* likely to be issued (acceptance criterion 4). */
|
|
68
|
+
export declare const PREFLIGHT_TIMEOUT_MS = 3000;
|
|
69
|
+
/** Read the operator's explicit override off a server_restart tools/call. Deny-by-default: absent,
|
|
70
|
+
* non-boolean, or false all mean "no override" — only a literal `force: true` unlocks the kill. */
|
|
71
|
+
export declare function parseForceFlag(msg: JsonRpcMessage): boolean;
|
|
72
|
+
/** Pull the running-gig ids out of the child's preflight answer, defensively. A child that answers
|
|
73
|
+
* a wrong-shaped result is read as "reported nothing running" and is NEVER trusted into a kill. */
|
|
74
|
+
export declare function extractRunningGigs(msg: JsonRpcMessage | null): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Build the JSON-RPC ERROR the relay returns when a restart is issued while gigs are in flight and
|
|
77
|
+
* no override was given. It NAMES each running gig — the whole point of the guard is that a killed
|
|
78
|
+
* gig stops being an absence, so the refusal that PREVENTS the kill must itself name what it saved.
|
|
79
|
+
*/
|
|
80
|
+
export declare function buildRestartRefusalError(id: string | number | null, gigIds: string[]): JsonRpcMessage;
|
|
81
|
+
/**
|
|
82
|
+
* Build the JSON-RPC ERROR the relay returns when the child did not answer the pre-restart gig
|
|
83
|
+
* check in time. The relay holds no gig state, so a silent child means it cannot tell whether a
|
|
84
|
+
* restart would kill work — and it REFUSES rather than assume-healthy-and-kill, because an
|
|
85
|
+
* unresponsive child (hung, crashed mid-request, mid-swap) is precisely when a silent kill destroys
|
|
86
|
+
* the most and when a restart is most likely to be reached for (acceptance criterion 4). No SIGTERM.
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildUnresponsiveChildError(id: string | number | null): JsonRpcMessage;
|
|
51
89
|
/** How long a fresh child gets to answer the replayed `initialize` before the restart FAILS. */
|
|
52
90
|
export declare const HANDSHAKE_REPLAY_TIMEOUT_MS = 10000;
|
|
53
91
|
/** How long the OUTGOING child gets to honour SIGTERM before the relay escalates to SIGKILL. */
|
package/dist/src/server_relay.js
CHANGED
|
@@ -28,10 +28,15 @@ import { spawn } from "node:child_process";
|
|
|
28
28
|
import { createInterface } from "node:readline";
|
|
29
29
|
const SERVER_RESTART_TOOL = {
|
|
30
30
|
name: "server_restart",
|
|
31
|
-
description: "Restart the Coltrane MCP server child process in place. Picks up new bytes after npm run build without ending the Claude Code conversation. Returns when the new child is up.",
|
|
31
|
+
description: "Restart the Coltrane MCP server child process in place. Picks up new bytes after npm run build without ending the Claude Code conversation. Refuses if a gig is still in flight (naming it) unless force=true, in which case each running gig is aborted and recorded in the ledger before the swap. Returns when the new child is up.",
|
|
32
32
|
inputSchema: {
|
|
33
33
|
type: "object",
|
|
34
|
-
properties: {
|
|
34
|
+
properties: {
|
|
35
|
+
// The explicit override. Absent/false = deny-by-default: a restart with gigs in flight is
|
|
36
|
+
// REFUSED, naming them, so nothing is killed silently. `force: true` aborts + ledgers each
|
|
37
|
+
// running gig, then swaps — a killed gig is a recorded fact, never an absence.
|
|
38
|
+
force: { type: "boolean" },
|
|
39
|
+
},
|
|
35
40
|
additionalProperties: false,
|
|
36
41
|
},
|
|
37
42
|
};
|
|
@@ -70,15 +75,21 @@ export function isToolsListResponse(msg) {
|
|
|
70
75
|
return Array.isArray(result?.tools);
|
|
71
76
|
}
|
|
72
77
|
/**
|
|
73
|
-
* In-place augment a `tools/list` response so it carries
|
|
74
|
-
*
|
|
78
|
+
* In-place augment a `tools/list` response so it carries the relay's `server_restart` entry.
|
|
79
|
+
* Returns the mutated message for convenience.
|
|
80
|
+
*
|
|
81
|
+
* The relay is the TRUE owner of this tool — it intercepts `tools/call server_restart` and never
|
|
82
|
+
* lets it reach the child. So the schema the client discovers must be the relay's, which advertises
|
|
83
|
+
* the `force` restart-guard override (venue/8) the relay itself reads. The child's registry entry
|
|
84
|
+
* (src/mcp.ts) is an argument-free introspection stub that exists only so tool_inspect/system_audit
|
|
85
|
+
* see the tool; if it slipped into the client's list it would hide `force`. So we REPLACE any child
|
|
86
|
+
* entry with the relay's authoritative one, rather than defer to a stub that advertises less than
|
|
87
|
+
* the relay honours. The result carries exactly one `server_restart`, and it is the relay's.
|
|
75
88
|
*/
|
|
76
89
|
export function augmentToolsList(msg) {
|
|
77
90
|
const result = msg.result;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (!existing)
|
|
81
|
-
result.tools.push(SERVER_RESTART_TOOL);
|
|
91
|
+
result.tools = result.tools.filter((t) => t.name !== SERVER_RESTART_TOOL.name);
|
|
92
|
+
result.tools.push(SERVER_RESTART_TOOL);
|
|
82
93
|
return msg;
|
|
83
94
|
}
|
|
84
95
|
/**
|
|
@@ -140,6 +151,86 @@ export function buildNoChildError(id, method) {
|
|
|
140
151
|
},
|
|
141
152
|
};
|
|
142
153
|
}
|
|
154
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
155
|
+
// Restart guard (venue/8) — a restart must never SILENTLY kill a running gig.
|
|
156
|
+
//
|
|
157
|
+
// THE DEFECT: `server_restart` used to SIGTERM its child with no preflight. Gigs run inside
|
|
158
|
+
// that child and chairs are spawned as its children, so the kill was total — every in-flight
|
|
159
|
+
// gig and seated chair died mid-phase, sealed outputs banked, and NO record saying they were
|
|
160
|
+
// killed. Two publish seats died exactly this way (gigs 8146142e and 18726459): a passing
|
|
161
|
+
// verdict, and no `result` event, because a killed gig leaves no trace. It was fail-OPEN on a
|
|
162
|
+
// destructive path — the same class as `void venue;`: the destructive action was the quiet one.
|
|
163
|
+
//
|
|
164
|
+
// THE WRINKLE: the relay holds NO gig state (grep this file — zero references to gigs, outputs
|
|
165
|
+
// or the runtime). It cannot know what a restart would destroy without ASKING the child. These
|
|
166
|
+
// two reserved JSON-RPC methods carry that conversation; the child answers them (src/server.ts).
|
|
167
|
+
// They are deliberately NOT MCP tools — they never appear in tools/list, so Claude Code cannot
|
|
168
|
+
// call them and the relay's blindness stays structural: it asks, then acts on the answer.
|
|
169
|
+
/** Reserved relay→child method: "which gigs are running right now?" → { running: string[] }. */
|
|
170
|
+
export const RUNNING_GIGS_METHOD = "coltrane/relay/running_gigs";
|
|
171
|
+
/** Reserved relay→child method (force path only): abort each running gig and LEDGER the abort,
|
|
172
|
+
* BEFORE the child is killed, so a killed gig is a recorded fact rather than an absence. */
|
|
173
|
+
export const ABORT_FOR_RESTART_METHOD = "coltrane/relay/abort_for_restart";
|
|
174
|
+
/** How long the child gets to answer the pre-restart gig check before the relay refuses. A child
|
|
175
|
+
* that does not answer is treated as UNHEALTHY — never assumed idle — because an unresponsive
|
|
176
|
+
* child is exactly when a silent kill would destroy the most work and when a restart is most
|
|
177
|
+
* likely to be issued (acceptance criterion 4). */
|
|
178
|
+
export const PREFLIGHT_TIMEOUT_MS = 3_000;
|
|
179
|
+
/** Read the operator's explicit override off a server_restart tools/call. Deny-by-default: absent,
|
|
180
|
+
* non-boolean, or false all mean "no override" — only a literal `force: true` unlocks the kill. */
|
|
181
|
+
export function parseForceFlag(msg) {
|
|
182
|
+
const args = msg.params?.["arguments"];
|
|
183
|
+
return args?.force === true;
|
|
184
|
+
}
|
|
185
|
+
/** Pull the running-gig ids out of the child's preflight answer, defensively. A child that answers
|
|
186
|
+
* a wrong-shaped result is read as "reported nothing running" and is NEVER trusted into a kill. */
|
|
187
|
+
export function extractRunningGigs(msg) {
|
|
188
|
+
const running = msg?.result?.running;
|
|
189
|
+
if (!Array.isArray(running))
|
|
190
|
+
return [];
|
|
191
|
+
return running.filter((g) => typeof g === "string" && g.length > 0);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Build the JSON-RPC ERROR the relay returns when a restart is issued while gigs are in flight and
|
|
195
|
+
* no override was given. It NAMES each running gig — the whole point of the guard is that a killed
|
|
196
|
+
* gig stops being an absence, so the refusal that PREVENTS the kill must itself name what it saved.
|
|
197
|
+
*/
|
|
198
|
+
export function buildRestartRefusalError(id, gigIds) {
|
|
199
|
+
return {
|
|
200
|
+
jsonrpc: "2.0",
|
|
201
|
+
id,
|
|
202
|
+
error: {
|
|
203
|
+
code: RELAY_ERROR_CODE,
|
|
204
|
+
message: `Coltrane MCP server restart REFUSED — ${gigIds.length} gig(s) still in flight: ` +
|
|
205
|
+
`${gigIds.join(", ")}. Restarting now kills the server child, and every running gig and ` +
|
|
206
|
+
"seated chair is a child of it, so they would die mid-phase with their sealed outputs " +
|
|
207
|
+
"banked and NO record that they were killed. Re-issue with `force: true` to abort the " +
|
|
208
|
+
"running gig(s) first — each abort is written to the ledger — then restart.",
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Build the JSON-RPC ERROR the relay returns when the child did not answer the pre-restart gig
|
|
214
|
+
* check in time. The relay holds no gig state, so a silent child means it cannot tell whether a
|
|
215
|
+
* restart would kill work — and it REFUSES rather than assume-healthy-and-kill, because an
|
|
216
|
+
* unresponsive child (hung, crashed mid-request, mid-swap) is precisely when a silent kill destroys
|
|
217
|
+
* the most and when a restart is most likely to be reached for (acceptance criterion 4). No SIGTERM.
|
|
218
|
+
*/
|
|
219
|
+
export function buildUnresponsiveChildError(id) {
|
|
220
|
+
return {
|
|
221
|
+
jsonrpc: "2.0",
|
|
222
|
+
id,
|
|
223
|
+
error: {
|
|
224
|
+
code: RELAY_ERROR_CODE,
|
|
225
|
+
message: "Coltrane MCP server restart REFUSED — the server child did not answer the pre-restart " +
|
|
226
|
+
`gig check within ${PREFLIGHT_TIMEOUT_MS}ms (it may be hung, crashed mid-request, or ` +
|
|
227
|
+
"mid-swap). The relay holds no gig state, so it cannot know whether a restart would kill " +
|
|
228
|
+
"work in flight; assuming the child is idle and killing it anyway is the silent kill this " +
|
|
229
|
+
"guard exists to prevent. No SIGTERM was sent — check the relay's stderr and the child's " +
|
|
230
|
+
"health, or restart the MCP client.",
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
143
234
|
/** How long a fresh child gets to answer the replayed `initialize` before the restart FAILS. */
|
|
144
235
|
export const HANDSHAKE_REPLAY_TIMEOUT_MS = 10_000;
|
|
145
236
|
/** How long the OUTGOING child gets to honour SIGTERM before the relay escalates to SIGKILL. */
|
|
@@ -181,6 +272,13 @@ export async function runRelay(opts) {
|
|
|
181
272
|
// the client already got one from the prior child, so the forwarder must swallow this dup.
|
|
182
273
|
let replayInitId = undefined;
|
|
183
274
|
let onInitReplayed = null;
|
|
275
|
+
// Reserved relay↔child requests (the pre-restart gig check + the force-path abort). Each is sent
|
|
276
|
+
// under a reserved STRING id the client never issues, so the forwarder can recognise the child's
|
|
277
|
+
// reply, resolve the waiting relay call, and NEVER forward it — these introspection messages stay
|
|
278
|
+
// invisible to Claude Code. Mirrors the `replayInitId` convention (one reserved id withheld from
|
|
279
|
+
// the forward loop), generalised to many concurrent reserved ids.
|
|
280
|
+
const pendingRelayRequests = new Map();
|
|
281
|
+
let relayReqSeq = 0;
|
|
184
282
|
const forwardChildToParent = (c) => {
|
|
185
283
|
// A write into a child that has already exited raises EPIPE as an 'error' event; unhandled,
|
|
186
284
|
// that takes the whole relay down and severs the client pipe the relay exists to protect.
|
|
@@ -197,6 +295,16 @@ export async function runRelay(opts) {
|
|
|
197
295
|
process.stdout.write(line + "\n");
|
|
198
296
|
return;
|
|
199
297
|
}
|
|
298
|
+
// A reply to a reserved relay↔child request (pre-restart gig check / abort-for-restart). A
|
|
299
|
+
// response has no method, and its id is one the relay minted and the client never issued.
|
|
300
|
+
// Resolve the waiting relay call and NEVER forward it — the relay holds no gig state; it only
|
|
301
|
+
// asks and acts on the answer, and these messages must stay invisible to Claude Code.
|
|
302
|
+
if (msg && msg.method === undefined && msg.id != null && pendingRelayRequests.has(msg.id)) {
|
|
303
|
+
const resolveRelay = pendingRelayRequests.get(msg.id);
|
|
304
|
+
pendingRelayRequests.delete(msg.id);
|
|
305
|
+
resolveRelay(msg);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
200
308
|
// Swallow the replayed-handshake `initialize` response (a response = no method, and its
|
|
201
309
|
// id matches the captured initialize). Then send `notifications/initialized` so the new
|
|
202
310
|
// child reaches serving state, and signal the restart to complete.
|
|
@@ -322,6 +430,74 @@ export async function runRelay(opts) {
|
|
|
322
430
|
}
|
|
323
431
|
process.stderr.write("[coltrane-relay] dropped a message: no live server child\n");
|
|
324
432
|
};
|
|
433
|
+
/**
|
|
434
|
+
* Send one reserved relay→child request and await its reply, or `null` if the child does not
|
|
435
|
+
* answer within `timeoutMs` (or there is no live child to ask). The reserved string id is
|
|
436
|
+
* withheld from the forward loop by the `pendingRelayRequests` branch above, so the client never
|
|
437
|
+
* sees this traffic. `null` is the load-bearing return: it is how "the child is unhealthy" reaches
|
|
438
|
+
* the caller, which is exactly the case a restart guard must not mistake for "nothing running".
|
|
439
|
+
*/
|
|
440
|
+
const relayRequest = (method, timeoutMs) => {
|
|
441
|
+
if (!childAlive())
|
|
442
|
+
return Promise.resolve(null);
|
|
443
|
+
const target = child;
|
|
444
|
+
const id = `__coltrane_relay:${++relayReqSeq}`;
|
|
445
|
+
return new Promise((resolve) => {
|
|
446
|
+
let done = false;
|
|
447
|
+
const finish = (m) => {
|
|
448
|
+
if (done)
|
|
449
|
+
return;
|
|
450
|
+
done = true;
|
|
451
|
+
clearTimeout(timer);
|
|
452
|
+
pendingRelayRequests.delete(id);
|
|
453
|
+
resolve(m);
|
|
454
|
+
};
|
|
455
|
+
const timer = setTimeout(() => finish(null), timeoutMs);
|
|
456
|
+
pendingRelayRequests.set(id, (m) => finish(m));
|
|
457
|
+
target.stdin.write(JSON.stringify({ jsonrpc: "2.0", id, method }) + "\n");
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
/**
|
|
461
|
+
* The restart guard. The relay holds no gig state, so it asks the child what a restart would
|
|
462
|
+
* destroy BEFORE any SIGTERM, and branches on the answer:
|
|
463
|
+
* • child does not answer → REFUSE (unresponsive), no SIGTERM — never assume an idle child.
|
|
464
|
+
* • nothing running → restart as today; the client's connection survives the swap.
|
|
465
|
+
* • running, no force → REFUSE, naming the running gig(s); the child is left untouched.
|
|
466
|
+
* • running, force=true → instruct the child to abort + LEDGER each running gig, THEN swap,
|
|
467
|
+
* so a killed gig is a recorded fact rather than an absence.
|
|
468
|
+
*/
|
|
469
|
+
const handleRestart = async (restartId, force) => {
|
|
470
|
+
const answer = (reply) => { process.stdout.write(JSON.stringify(reply) + "\n"); };
|
|
471
|
+
const pre = await relayRequest(RUNNING_GIGS_METHOD, PREFLIGHT_TIMEOUT_MS);
|
|
472
|
+
if (pre === null) {
|
|
473
|
+
process.stderr.write("[coltrane-relay] restart refused: child did not answer the pre-restart gig check\n");
|
|
474
|
+
answer(buildUnresponsiveChildError(restartId));
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const running = extractRunningGigs(pre);
|
|
478
|
+
if (running.length > 0) {
|
|
479
|
+
if (!force) {
|
|
480
|
+
process.stderr.write(`[coltrane-relay] restart refused: ${running.length} gig(s) in flight: ${running.join(", ")}\n`);
|
|
481
|
+
answer(buildRestartRefusalError(restartId, running));
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
// Force: the child records the abort of every running gig BEFORE it dies. Await the child's
|
|
485
|
+
// confirmation; if it does not answer, treat it as unresponsive and send NO SIGTERM.
|
|
486
|
+
const ack = await relayRequest(ABORT_FOR_RESTART_METHOD, PREFLIGHT_TIMEOUT_MS);
|
|
487
|
+
if (ack === null) {
|
|
488
|
+
process.stderr.write("[coltrane-relay] restart refused: child did not confirm the abort-for-restart\n");
|
|
489
|
+
answer(buildUnresponsiveChildError(restartId));
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
process.stderr.write(`[coltrane-relay] force restart: aborted + ledgered ${running.length} gig(s): ${running.join(", ")}\n`);
|
|
493
|
+
}
|
|
494
|
+
// Reply only after the new child is up AND re-initialized, so the client's next tool call lands
|
|
495
|
+
// on a serving child rather than hanging — and reply with an ERROR when it did not (#260).
|
|
496
|
+
const outcome = await restartChild();
|
|
497
|
+
if (!outcome.ok)
|
|
498
|
+
process.stderr.write(`[coltrane-relay] restart failed: ${outcome.reason}\n`);
|
|
499
|
+
answer(outcome.ok ? buildRestartResponse(restartId) : buildRestartError(restartId, outcome.reason));
|
|
500
|
+
};
|
|
325
501
|
const parentIn = createInterface({ input: process.stdin });
|
|
326
502
|
parentIn.on("line", (line) => {
|
|
327
503
|
let msg = null;
|
|
@@ -340,17 +516,8 @@ export async function runRelay(opts) {
|
|
|
340
516
|
storedInitialized = line;
|
|
341
517
|
const restartId = matchServerRestart(msg);
|
|
342
518
|
if (restartId !== undefined) {
|
|
343
|
-
// Handle locally
|
|
344
|
-
|
|
345
|
-
// with an ERROR when it did not, so a failed swap is diagnosable instead of silent.
|
|
346
|
-
void restartChild().then((outcome) => {
|
|
347
|
-
const reply = outcome.ok
|
|
348
|
-
? buildRestartResponse(restartId)
|
|
349
|
-
: buildRestartError(restartId, outcome.reason);
|
|
350
|
-
if (!outcome.ok)
|
|
351
|
-
process.stderr.write(`[coltrane-relay] restart failed: ${outcome.reason}\n`);
|
|
352
|
-
process.stdout.write(JSON.stringify(reply) + "\n");
|
|
353
|
-
});
|
|
519
|
+
// Handle locally, through the guard — a silent kill must no longer be possible.
|
|
520
|
+
void handleRestart(restartId, parseForceFlag(msg));
|
|
354
521
|
return;
|
|
355
522
|
}
|
|
356
523
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server_relay.js","sourceRoot":"","sources":["../../src/server_relay.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,gBAAgB;AAChB,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,+CAA+C;AAC/C,EAAE;AACF,cAAc;AACd,qEAAqE;AACrE,qCAAqC;AACrC,2EAA2E;AAC3E,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Ac,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC3B,OAAO;QACT,CAAC;QACD,IAAI,GAAG,EAAE,CAAC;YACR,mFAAmF;YACnF,IAAI,GAAG,CAAC,MAAM,KAAK,YAAY;gBAAE,UAAU,GAAG,IAAI,CAAC;iBAC9C,IAAI,GAAG,CAAC,MAAM,KAAK,2BAA2B;gBAAE,iBAAiB,GAAG,IAAI,CAAC;YAE9E,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC5B,gFAAgF;gBAChF,KAAK,aAAa,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;gBACnD,OAAO;YACT,CAAC;QACH,CAAC;QACD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,gDAAgD;IAChD,MAAM,IAAI,OAAO,CAAO,GAAG,EAAE;QAC3B,4CAA4C;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -17,6 +17,33 @@ export type ToolProviderRegistry = ReadonlyMap<string, ToolProvider>;
|
|
|
17
17
|
export declare const ENGINE_MCP_SERVER = "coltrane";
|
|
18
18
|
/** A scoped grant like `Bash(npx vitest run:*)` resolves on its base tool name (`Bash`). */
|
|
19
19
|
export declare function toolBaseName(grant: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* The host builtins to DENY for a seat whose effective allow set is `effectiveAllowed`: every
|
|
22
|
+
* HOST_BUILTINS member whose base name is absent from that set.
|
|
23
|
+
*
|
|
24
|
+
* This is the complement that makes the tool ceiling BIND by enforcement. `--allowedTools` is
|
|
25
|
+
* advisory for host builtins — a seat granted only `type_browse` still called `Bash` and `Read`,
|
|
26
|
+
* unrefused and unrecorded (gig 782e89d8, room-prober, twice) — and only `--disallowedTools`
|
|
27
|
+
* removes a builtin. So the ungranted host builtins must be enumerated into the deny list.
|
|
28
|
+
*
|
|
29
|
+
* HOST_BUILTINS stays UNEXPORTED: the 14-tool universe lives in one home, reachable only through
|
|
30
|
+
* this function, so no call site re-inlines it (the change request forbids re-inlining the oracles).
|
|
31
|
+
* Deterministic order (HOST_BUILTINS insertion order) so the emitted flag is stable.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Is `name` one of the host builtins the runtime provides?
|
|
35
|
+
*
|
|
36
|
+
* A SECOND ACCESSOR over the same single home, deliberately — not a second copy. HOST_BUILTINS
|
|
37
|
+
* stays unexported for the reason stated above (one universe, no re-inlined oracles), and callers
|
|
38
|
+
* that need to ASK about a name rather than compute a complement now have a way to do it without
|
|
39
|
+
* copying the set. The player compiler is the first such caller: it prefixed every declared tool
|
|
40
|
+
* with `mcp__coltrane__` unconditionally, so a player could not name `Read` without compiling it
|
|
41
|
+
* into `mcp__coltrane__Read` — a dead name that binds to nothing and fails silently.
|
|
42
|
+
*
|
|
43
|
+
* Takes a BASE name; pass `toolBaseName(grant)` for a scoped grant like `Bash(git add:*)`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isHostBuiltin(name: string): boolean;
|
|
46
|
+
export declare function hostBuiltinDenials(effectiveAllowed: Iterable<string>): string[];
|
|
20
47
|
export interface ResolvedGrants {
|
|
21
48
|
/** MCP server slug → its --mcp-config entry, deduped across all grants that share a server. */
|
|
22
49
|
mcpServers: Record<string, unknown>;
|
|
@@ -7,6 +7,20 @@ const HOST_BUILTINS = new Set([
|
|
|
7
7
|
"Glob", "Grep", "LS",
|
|
8
8
|
"WebFetch", "WebSearch",
|
|
9
9
|
"Task", "TodoWrite",
|
|
10
|
+
// Added 2026-08-20, after they were OBSERVED escaping. Gig 34ff466b's review chair is
|
|
11
|
+
// `spec-reviewer`, whose record declares allowed_tools: [] and code_tool_access: "none" — a seat
|
|
12
|
+
// entitled to nothing. It called Monitor x13, LSP x6, ScheduleWakeup x2, ListAgents x1 and with
|
|
13
|
+
// them read the working tree, producing a verdict citing exact assertion counts and file sizes.
|
|
14
|
+
// It did not fabricate; it reached capabilities its grant never mentioned, because a tool absent
|
|
15
|
+
// from THIS SET is never in the complement below, so it is never denied. Monitor executes shell
|
|
16
|
+
// (`until <check>; do sleep 2; done`); LSP reads code; ListAgents discloses peer sessions;
|
|
17
|
+
// ScheduleWakeup schedules future work.
|
|
18
|
+
"Monitor", "LSP", "ListAgents", "ScheduleWakeup",
|
|
19
|
+
// DELIBERATELY ABSENT: ToolSearch. It is not a capability over the world — it is the loader a
|
|
20
|
+
// chair uses to reach the tools it WAS granted, including the engine's own output_write. Across
|
|
21
|
+
// the gig logs, 226 of 289 ToolSearch calls were loading output_write; denying it would sever the
|
|
22
|
+
// seal path for every model chair, which is the failure LAW 2 exists to prevent. It is governed
|
|
23
|
+
// by what it can load, not by whether it can run.
|
|
10
24
|
]);
|
|
11
25
|
/** The engine's own MCP server slug — the key the repo's .mcp.json ships it under, and the prefix
|
|
12
26
|
* its tools are advertised behind (mcp__coltrane__<tool>). In-house engine tools are bridged through
|
|
@@ -17,6 +31,40 @@ export function toolBaseName(grant) {
|
|
|
17
31
|
const paren = grant.indexOf("(");
|
|
18
32
|
return (paren >= 0 ? grant.slice(0, paren) : grant).trim();
|
|
19
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The host builtins to DENY for a seat whose effective allow set is `effectiveAllowed`: every
|
|
36
|
+
* HOST_BUILTINS member whose base name is absent from that set.
|
|
37
|
+
*
|
|
38
|
+
* This is the complement that makes the tool ceiling BIND by enforcement. `--allowedTools` is
|
|
39
|
+
* advisory for host builtins — a seat granted only `type_browse` still called `Bash` and `Read`,
|
|
40
|
+
* unrefused and unrecorded (gig 782e89d8, room-prober, twice) — and only `--disallowedTools`
|
|
41
|
+
* removes a builtin. So the ungranted host builtins must be enumerated into the deny list.
|
|
42
|
+
*
|
|
43
|
+
* HOST_BUILTINS stays UNEXPORTED: the 14-tool universe lives in one home, reachable only through
|
|
44
|
+
* this function, so no call site re-inlines it (the change request forbids re-inlining the oracles).
|
|
45
|
+
* Deterministic order (HOST_BUILTINS insertion order) so the emitted flag is stable.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Is `name` one of the host builtins the runtime provides?
|
|
49
|
+
*
|
|
50
|
+
* A SECOND ACCESSOR over the same single home, deliberately — not a second copy. HOST_BUILTINS
|
|
51
|
+
* stays unexported for the reason stated above (one universe, no re-inlined oracles), and callers
|
|
52
|
+
* that need to ASK about a name rather than compute a complement now have a way to do it without
|
|
53
|
+
* copying the set. The player compiler is the first such caller: it prefixed every declared tool
|
|
54
|
+
* with `mcp__coltrane__` unconditionally, so a player could not name `Read` without compiling it
|
|
55
|
+
* into `mcp__coltrane__Read` — a dead name that binds to nothing and fails silently.
|
|
56
|
+
*
|
|
57
|
+
* Takes a BASE name; pass `toolBaseName(grant)` for a scoped grant like `Bash(git add:*)`.
|
|
58
|
+
*/
|
|
59
|
+
export function isHostBuiltin(name) {
|
|
60
|
+
return HOST_BUILTINS.has(name);
|
|
61
|
+
}
|
|
62
|
+
export function hostBuiltinDenials(effectiveAllowed) {
|
|
63
|
+
const granted = new Set();
|
|
64
|
+
for (const g of effectiveAllowed)
|
|
65
|
+
granted.add(toolBaseName(g));
|
|
66
|
+
return [...HOST_BUILTINS].filter((b) => !granted.has(b));
|
|
67
|
+
}
|
|
20
68
|
/** Claude Code MCP tools follow the `mcp__<server>__<tool>` naming convention. Extract the server
|
|
21
69
|
* slug so an MCP grant resolves to its server by convention — no per-tool registration needed. */
|
|
22
70
|
export function mcpServerOf(grant) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool_providers.js","sourceRoot":"","sources":["../../src/tool_providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AA6B3D,mGAAmG;AACnG,kGAAkG;AAClG,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC;IACjD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE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@
|
|
|
1
|
+
/** The worker environment a venue needs, canonical names only. Every one of these must arrive with a
|
|
2
|
+
* truthy value from a single mint — a grant missing any of them is refused, not forwarded, because a
|
|
3
|
+
* half-set moves the assembly problem to the caller while looking like success. This is the "always"
|
|
4
|
+
* + "venue"-scoped core of the worker environment contract (SPEC-worker-contract.md), not the full
|
|
5
|
+
* table: the conditional and tuning variables (COLTRANE_GIT_CREDENTIALS_URL, the bounded overrides)
|
|
6
|
+
* are not required for a box to stand up, so their absence is not an incomplete grant. */
|
|
7
|
+
export declare const REQUIRED_WORKER_ENV: readonly ["COLTRANE_STORE_URL", "COLTRANE_STORE_ANON", "COLTRANE_SERVICE_URL", "COLTRANE_DRAIN_KEY", "COLTRANE_INSTANCE"];
|
|
8
|
+
/** The three reasons a mint cannot proceed, as an EXACT list — a refusal code is a contract with
|
|
9
|
+
* clients, so a fourth appearing silently is a client branch nobody wrote. Sorted, this is
|
|
10
|
+
* ['gig_scoped_token','incomplete_env','no_backend'] (spec_venue_credential_mint.test.ts). */
|
|
11
|
+
export declare const VENUE_CREDENTIAL_REFUSALS: readonly ["gig_scoped_token", "no_backend", "incomplete_env"];
|
|
12
|
+
export type VenueCredentialRefusal = (typeof VENUE_CREDENTIAL_REFUSALS)[number];
|
|
13
|
+
/** Who is asking to mint. `kind` is the credential class the caller presented; `gig_id` is carried
|
|
14
|
+
* only for a gig-scoped caller, and only so a refusal can be specific. This is NOT an authorization
|
|
15
|
+
* principal — the engine reads exactly one thing off it (is this a gig token?), which is a
|
|
16
|
+
* credential-scope fact, and forwards every other who-may-mint question to the store. */
|
|
17
|
+
export interface CallerIdentity {
|
|
18
|
+
kind: "member" | "player" | "venue" | "gig";
|
|
19
|
+
gig_id?: string;
|
|
20
|
+
}
|
|
21
|
+
/** What a deployment's minting backend answers with. `credential_classes` is in
|
|
22
|
+
* `VenueSchema.credential_surface` vocabulary — the room's own word for what may legitimately be
|
|
23
|
+
* present — because that is the contract the provisioned box is then judged against by `realize`.
|
|
24
|
+
* CLASSES, never material: a class name is what a `credential_surface` declares, never a field a
|
|
25
|
+
* secret could occupy. */
|
|
26
|
+
export interface VenueCredentialGrant {
|
|
27
|
+
instance: string;
|
|
28
|
+
env: Record<string, string>;
|
|
29
|
+
credential_classes: string[];
|
|
30
|
+
expires_at?: string | null;
|
|
31
|
+
}
|
|
32
|
+
/** The structural escalation check, decided from caller identity ALONE, before any backend is
|
|
33
|
+
* reached. Returns the refusal code when the caller is gig-scoped, else null. This is credential
|
|
34
|
+
* SCOPE, not policy: a gig token outliving its lease as a venue key is an escalation no store-side
|
|
35
|
+
* gate catches, because the store sees a valid org-scoped request from a credential it issued. */
|
|
36
|
+
export declare function gigScopeRefusal(caller: CallerIdentity | undefined): VenueCredentialRefusal | null;
|
|
37
|
+
/** Which required worker-env variables the grant failed to supply a truthy value for. An empty array
|
|
38
|
+
* means the environment is complete; a non-empty one is exactly what an `incomplete_env` refusal
|
|
39
|
+
* names, so the caller learns what is missing instead of discovering it from a status code at first
|
|
40
|
+
* write. */
|
|
41
|
+
export declare function missingWorkerEnv(env: Record<string, string> | undefined): string[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// THE VENUE CREDENTIAL SEAM — the engine ships the verb, its shape validation, and its refusals;
|
|
2
|
+
// a deployment wires the minting backend. See SPEC-worker-contract.md §"Gap 1".
|
|
3
|
+
//
|
|
4
|
+
// A venue is any host that runs `coltrane work`. To stand one up you need an org-scoped,
|
|
5
|
+
// instance-bound drain key plus the complete set of worker-environment variables. This file is the
|
|
6
|
+
// engine half of `venue_credential_mint`: the required-env contract, the three typed refusals, and
|
|
7
|
+
// the pure shape checks the surface handler (src/server.ts callSurfaceTool) applies around whatever
|
|
8
|
+
// backend a deployment injects on ToolSurfaceDeps.mintVenueCredential.
|
|
9
|
+
//
|
|
10
|
+
// TWO THINGS DELIBERATELY ABSENT, each a design decision a later reader will be tempted to "fix":
|
|
11
|
+
// * NO read-back verb. The credential is answered exactly once and is never retrievable; there is
|
|
12
|
+
// no venue_credential_read and the engine does not persist the grant. Adding one would make
|
|
13
|
+
// every credential readable by anything holding the surface — the same widening the gig-scope
|
|
14
|
+
// refusal exists to prevent.
|
|
15
|
+
// * NO authorization policy. The engine has no opinion about WHO may run a venue and no way to
|
|
16
|
+
// check one — that rule lives in the store. The one caller check here (the gig-scope refusal) is
|
|
17
|
+
// a structural fact about credential SCOPE, not a who-may-mint decision: a gig credential expires
|
|
18
|
+
// with one gig's lease and a venue credential outlives every gig, so letting the first mint the
|
|
19
|
+
// second turns the narrowest credential in the system into the broadest. Every other question
|
|
20
|
+
// about who may mint belongs to a deployment this engine cannot see. No policy hook, allowlist,
|
|
21
|
+
// or role check lives here, and their absence is the design.
|
|
22
|
+
/** The worker environment a venue needs, canonical names only. Every one of these must arrive with a
|
|
23
|
+
* truthy value from a single mint — a grant missing any of them is refused, not forwarded, because a
|
|
24
|
+
* half-set moves the assembly problem to the caller while looking like success. This is the "always"
|
|
25
|
+
* + "venue"-scoped core of the worker environment contract (SPEC-worker-contract.md), not the full
|
|
26
|
+
* table: the conditional and tuning variables (COLTRANE_GIT_CREDENTIALS_URL, the bounded overrides)
|
|
27
|
+
* are not required for a box to stand up, so their absence is not an incomplete grant. */
|
|
28
|
+
export const REQUIRED_WORKER_ENV = [
|
|
29
|
+
"COLTRANE_STORE_URL",
|
|
30
|
+
"COLTRANE_STORE_ANON",
|
|
31
|
+
"COLTRANE_SERVICE_URL",
|
|
32
|
+
"COLTRANE_DRAIN_KEY",
|
|
33
|
+
"COLTRANE_INSTANCE",
|
|
34
|
+
];
|
|
35
|
+
/** The three reasons a mint cannot proceed, as an EXACT list — a refusal code is a contract with
|
|
36
|
+
* clients, so a fourth appearing silently is a client branch nobody wrote. Sorted, this is
|
|
37
|
+
* ['gig_scoped_token','incomplete_env','no_backend'] (spec_venue_credential_mint.test.ts). */
|
|
38
|
+
export const VENUE_CREDENTIAL_REFUSALS = [
|
|
39
|
+
"gig_scoped_token",
|
|
40
|
+
"no_backend",
|
|
41
|
+
"incomplete_env",
|
|
42
|
+
];
|
|
43
|
+
/** The structural escalation check, decided from caller identity ALONE, before any backend is
|
|
44
|
+
* reached. Returns the refusal code when the caller is gig-scoped, else null. This is credential
|
|
45
|
+
* SCOPE, not policy: a gig token outliving its lease as a venue key is an escalation no store-side
|
|
46
|
+
* gate catches, because the store sees a valid org-scoped request from a credential it issued. */
|
|
47
|
+
export function gigScopeRefusal(caller) {
|
|
48
|
+
return caller?.kind === "gig" ? "gig_scoped_token" : null;
|
|
49
|
+
}
|
|
50
|
+
/** Which required worker-env variables the grant failed to supply a truthy value for. An empty array
|
|
51
|
+
* means the environment is complete; a non-empty one is exactly what an `incomplete_env` refusal
|
|
52
|
+
* names, so the caller learns what is missing instead of discovering it from a status code at first
|
|
53
|
+
* write. */
|
|
54
|
+
export function missingWorkerEnv(env) {
|
|
55
|
+
return REQUIRED_WORKER_ENV.filter((key) => !env?.[key]);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=venue_credential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"venue_credential.js","sourceRoot":"","sources":["../../src/venue_credential.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,gFAAgF;AAChF,EAAE;AACF,yFAAyF;AACzF,mGAAmG;AACnG,mGAAmG;AACnG,oGAAoG;AACpG,uEAAuE;AACvE,EAAE;AACF,kGAAkG;AAClG,oGAAoG;AACpG,gGAAgG;AAChG,kGAAkG;AAClG,iCAAiC;AACjC,iGAAiG;AACjG,qGAAqG;AACrG,sGAAsG;AACtG,oGAAoG;AACpG,kGAAkG;AAClG,oGAAoG;AACpG,iEAAiE;AAEjE;;;;;2FAK2F;AAC3F,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,oBAAoB;IACpB,qBAAqB;IACrB,sBAAsB;IACtB,oBAAoB;IACpB,mBAAmB;CACX,CAAC;AAEX;;+FAE+F;AAC/F,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,kBAAkB;IAClB,YAAY;IACZ,gBAAgB;CACR,CAAC;AAyBX;;;mGAGmG;AACnG,MAAM,UAAU,eAAe,CAAC,MAAkC;IAChE,OAAO,MAAM,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED;;;aAGa;AACb,MAAM,UAAU,gBAAgB,CAAC,GAAuC;IACtE,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -71,6 +71,29 @@ export interface RealizationRefusal extends RealizationSurface {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
export type Realization = RealizationOk | RealizationRefusal;
|
|
74
|
+
/**
|
|
75
|
+
* The env keys a seat may carry from the ambient environment — the minimum a process needs to
|
|
76
|
+
* EXECUTE: PATH so the OS can locate its binary, HOME so the binary can resolve its own config. An
|
|
77
|
+
* explicit ALLOWLIST, not a deny-list: a key absent from this list never reaches the seat, so a
|
|
78
|
+
* credential added to the container later is excluded by default rather than by anyone remembering
|
|
79
|
+
* to strip it. This is the deny-by-default posture held unconditionally — it does not depend on the
|
|
80
|
+
* completeness of any strip-list (`withoutBoxCredentials`'s `BOX_CREDENTIAL_ENV` is a floor for the
|
|
81
|
+
* paths that never reach here, not the control).
|
|
82
|
+
*
|
|
83
|
+
* Why it is not `[]`: the seat env was `{}` (deny EVERYTHING), which is airtight but unspawnable —
|
|
84
|
+
* a `claude -p` child with no PATH cannot find its binary and dies with `spawn claude ENOENT`
|
|
85
|
+
* (measured, gig 87cffa2c), so no venue-confined seat ever ran. `['PATH','HOME']` is the
|
|
86
|
+
* minimum-viable widening: enough to start, no credential material.
|
|
87
|
+
*
|
|
88
|
+
* Why USER is admitted: on a macOS host with no `~/.claude/.credentials.json`, Claude auth is
|
|
89
|
+
* keychain-backed (a `Claude Code-credentials` keychain entry), and the keychain lookup needs USER
|
|
90
|
+
* to resolve the account. Measured: `claude -p` under {PATH,HOME} exits 1 with 'Not logged in ·
|
|
91
|
+
* Please run /login'; under {PATH,HOME,USER} it exits 0 and reaches the MCP server (gig 4506b567).
|
|
92
|
+
* On a Linux drain, credentials are file-based under HOME, so PATH+HOME already suffices and this
|
|
93
|
+
* key is inert. USER is a USERNAME, not a credential — admitting it carries no secret material, so
|
|
94
|
+
* the deny-by-default posture is unweakened; the allowlist grows by exactly one non-secret key.
|
|
95
|
+
*/
|
|
96
|
+
export declare const SEAT_ENV_ALLOWLIST: readonly ["PATH", "HOME", "USER"];
|
|
74
97
|
/**
|
|
75
98
|
* Realize a Venue contract into an enforced, observable performance space.
|
|
76
99
|
*
|