@eir-labs/coltrane 0.24.30 → 0.24.32
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/change-verifier.json +4 -2
- package/agents/deploy-scout.json +2 -2
- package/agents/red-law-reviewer.json +54 -0
- package/agents/red-spec-attester.json +53 -0
- package/agents/red-spec-builder.json +56 -0
- package/agents/red-spec-drafter.json +1 -1
- package/agents/spec-reviewer.json +1 -1
- package/dist/src/chart.js +4 -0
- package/dist/src/chart.js.map +1 -1
- package/dist/src/chat_completions_port.d.ts +41 -0
- package/dist/src/chat_completions_port.js +221 -0
- package/dist/src/chat_completions_port.js.map +1 -0
- package/dist/src/claude_invoker.d.ts +18 -0
- package/dist/src/claude_invoker.js +771 -22
- package/dist/src/claude_invoker.js.map +1 -1
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +49 -8
- package/dist/src/cli.js.map +1 -1
- package/dist/src/completions_invoker.d.ts +79 -0
- package/dist/src/completions_invoker.js +220 -0
- package/dist/src/completions_invoker.js.map +1 -0
- package/dist/src/composition.d.ts +13 -0
- package/dist/src/composition.js +16 -0
- package/dist/src/composition.js.map +1 -1
- package/dist/src/genome_schema.d.ts +200 -0
- package/dist/src/genome_schema.js +37 -0
- package/dist/src/genome_schema.js.map +1 -1
- package/dist/src/genome_store.d.ts +30 -2
- package/dist/src/genome_store.js +51 -8
- package/dist/src/genome_store.js.map +1 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/invoker_selection.d.ts +58 -0
- package/dist/src/invoker_selection.js +110 -0
- package/dist/src/invoker_selection.js.map +1 -0
- package/dist/src/ledger.d.ts +45 -2
- package/dist/src/ledger.js +23 -3
- package/dist/src/ledger.js.map +1 -1
- package/dist/src/mcp.js +2 -2
- package/dist/src/mcp.js.map +1 -1
- package/dist/src/outputs.d.ts +24 -0
- package/dist/src/outputs.js +1 -0
- package/dist/src/outputs.js.map +1 -1
- package/dist/src/registry.js +16 -0
- package/dist/src/registry.js.map +1 -1
- package/dist/src/repo_index.d.ts +13 -0
- package/dist/src/repo_index.js +90 -10
- package/dist/src/repo_index.js.map +1 -1
- package/dist/src/reside_backing.d.ts +3 -2
- package/dist/src/reside_backing.js +8 -2
- package/dist/src/reside_backing.js.map +1 -1
- package/dist/src/reuse.d.ts +8 -0
- package/dist/src/reuse.js.map +1 -1
- package/dist/src/run_deps.d.ts +10 -10
- package/dist/src/run_deps.js +25 -15
- package/dist/src/run_deps.js.map +1 -1
- package/dist/src/runtime.d.ts +205 -109
- package/dist/src/runtime.js +908 -145
- package/dist/src/runtime.js.map +1 -1
- package/dist/src/server.js +148 -45
- package/dist/src/server.js.map +1 -1
- package/dist/src/server_relay.js +28 -0
- package/dist/src/server_relay.js.map +1 -1
- package/dist/src/skill_runner.mjs +9 -2
- package/dist/src/skill_subprocess.d.ts +20 -1
- package/dist/src/skill_subprocess.js +11 -4
- package/dist/src/skill_subprocess.js.map +1 -1
- package/dist/src/transcript_store.d.ts +14 -0
- package/dist/src/transcript_store.js +39 -0
- package/dist/src/transcript_store.js.map +1 -0
- package/dist/src/turn_loop.d.ts +173 -0
- package/dist/src/turn_loop.js +283 -0
- package/dist/src/turn_loop.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/worker.js +6 -0
- package/dist/src/worker.js.map +1 -1
- package/dist/src/worker_env.d.ts +4 -2
- package/dist/src/worker_env.js +42 -0
- package/dist/src/worker_env.js.map +1 -1
- package/domain_types/change-set.json +33 -22
- package/domain_types/red-spec.json +32 -23
- package/domain_types/seat-primer.json +65 -0
- package/package.json +1 -1
- package/standards/build-from-red-spec-v0.json +93 -0
- package/standards/draft-red-laws-v0.json +68 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// ── MCP ↔ function-calling, losslessly ───────────────────────────────────────────────────────────
|
|
2
|
+
//
|
|
3
|
+
// A readable name survives unchanged (the model reasons better about `mcp__coltrane__output_query`
|
|
4
|
+
// than about a hex blob), and anything else is escaped reversibly. A name too long for either form
|
|
5
|
+
// is truncated with a digest — legal and collision-resistant, but no longer invertible on its own,
|
|
6
|
+
// which is why the reply is resolved through the offered list rather than by inverting the name.
|
|
7
|
+
const SAFE_NAME = /^[A-Za-z0-9_-]{1,64}$/;
|
|
8
|
+
const ESCAPE = "x0_";
|
|
9
|
+
/** The wire's own bound on a function name. Legality is a SEPARATE property from losslessness — a
|
|
10
|
+
* round-trip law proves the second and says nothing about the first, which is how a 68-character
|
|
11
|
+
* name came to encode to 139 and pass every test. */
|
|
12
|
+
const NAME_LIMIT = 64;
|
|
13
|
+
const TRUNC = "x1_";
|
|
14
|
+
/** A short deterministic digest, so two distinct long names cannot collapse onto one wire name. */
|
|
15
|
+
function shortDigest(s) {
|
|
16
|
+
let h1 = 0x811c9dc5;
|
|
17
|
+
let h2 = 0x01000193;
|
|
18
|
+
for (let i = 0; i < s.length; i++) {
|
|
19
|
+
h1 = Math.imul(h1 ^ s.charCodeAt(i), 0x01000193) >>> 0;
|
|
20
|
+
h2 = Math.imul(h2 + s.charCodeAt(i) + i, 0x85ebca6b) >>> 0;
|
|
21
|
+
}
|
|
22
|
+
return h1.toString(36).padStart(7, "0") + h2.toString(36).padStart(7, "0");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An MCP name → a name the wire will actually accept: `[A-Za-z0-9_-]{1,64}`.
|
|
26
|
+
*
|
|
27
|
+
* Three tiers, and the third is the one this needed. A safe short name passes through unchanged,
|
|
28
|
+
* because a model reasons better about `mcp__coltrane__output_query` than about a hex blob. Anything
|
|
29
|
+
* else is hex-escaped, which is reversible. And a name too long for EITHER form is truncated with a
|
|
30
|
+
* digest — legal and collision-resistant, but no longer invertible on its own.
|
|
31
|
+
*
|
|
32
|
+
* That last tier is why the caller resolves replies through the tool list it holds rather than by
|
|
33
|
+
* inverting the name: a long-named tool stays callable instead of being refused for the shape of its
|
|
34
|
+
* name.
|
|
35
|
+
*/
|
|
36
|
+
export function encodeToolName(name) {
|
|
37
|
+
if (SAFE_NAME.test(name) && !name.startsWith(ESCAPE) && !name.startsWith(TRUNC))
|
|
38
|
+
return name;
|
|
39
|
+
let hex = "";
|
|
40
|
+
for (const byte of new TextEncoder().encode(name))
|
|
41
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
42
|
+
const escaped = ESCAPE + hex;
|
|
43
|
+
if (escaped.length <= NAME_LIMIT)
|
|
44
|
+
return escaped;
|
|
45
|
+
const digest = shortDigest(name);
|
|
46
|
+
const room = NAME_LIMIT - TRUNC.length - digest.length - 1;
|
|
47
|
+
return `${TRUNC}${hex.slice(0, Math.max(0, room))}_${digest}`;
|
|
48
|
+
}
|
|
49
|
+
export function fromFunctionName(name) {
|
|
50
|
+
if (!name.startsWith(ESCAPE))
|
|
51
|
+
return name;
|
|
52
|
+
const hex = name.slice(ESCAPE.length);
|
|
53
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
54
|
+
for (let i = 0; i < bytes.length; i++)
|
|
55
|
+
bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
56
|
+
return new TextDecoder().decode(bytes);
|
|
57
|
+
}
|
|
58
|
+
export function toFunctionDef(tool) {
|
|
59
|
+
return {
|
|
60
|
+
type: "function",
|
|
61
|
+
function: {
|
|
62
|
+
name: encodeToolName(tool.name),
|
|
63
|
+
...(tool.description !== undefined ? { description: tool.description } : {}),
|
|
64
|
+
parameters: tool.inputSchema,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** A neutral transcript message → its wire shape. Assistant tool calls are encoded to wire names
|
|
69
|
+
* and their args serialized; a tool result carries its id and content. */
|
|
70
|
+
function toWireMessage(m) {
|
|
71
|
+
if (m.role === "assistant") {
|
|
72
|
+
const out = { role: "assistant", content: m.content };
|
|
73
|
+
if (m.tool_calls && m.tool_calls.length > 0) {
|
|
74
|
+
out["tool_calls"] = m.tool_calls.map((tc) => ({
|
|
75
|
+
id: tc.id,
|
|
76
|
+
type: "function",
|
|
77
|
+
function: { name: encodeToolName(tc.name), arguments: JSON.stringify(tc.args) },
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
if (m.role === "tool") {
|
|
83
|
+
return { role: "tool", tool_call_id: m.tool_call_id, content: m.content };
|
|
84
|
+
}
|
|
85
|
+
return { role: m.role, content: m.content };
|
|
86
|
+
}
|
|
87
|
+
/** Split the wire's `prompt_tokens` into uncached input and cache reads (law 16). A cached prompt is
|
|
88
|
+
* still the full prompt; the split is what makes the cache visible without inventing a class the
|
|
89
|
+
* wire did not report. Absent usage stays absent — an unreported round is not a zero-token one.
|
|
90
|
+
*
|
|
91
|
+
* Two wire shapes report the same split. The OpenAI shape folds hits into
|
|
92
|
+
* `prompt_tokens_details.cached_tokens` and leaves `prompt_tokens` whole. A provider that reports
|
|
93
|
+
* hits and misses SEPARATELY names them `prompt_cache_hit_tokens` / `prompt_cache_miss_tokens`;
|
|
94
|
+
* there the cache hits are the hit count and the uncached input is the reported miss count directly.
|
|
95
|
+
* Either way the prompt stays whole and only the reported split differs — pricing cache hits as
|
|
96
|
+
* uncached input (the pre-cache-hit bug) would overcharge a run priced in cents. */
|
|
97
|
+
function mapUsage(u) {
|
|
98
|
+
if (!u)
|
|
99
|
+
return undefined;
|
|
100
|
+
const cached = typeof u.prompt_cache_hit_tokens === "number"
|
|
101
|
+
? u.prompt_cache_hit_tokens
|
|
102
|
+
: typeof u.prompt_tokens_details?.cached_tokens === "number"
|
|
103
|
+
? u.prompt_tokens_details.cached_tokens
|
|
104
|
+
: 0;
|
|
105
|
+
const usage = {};
|
|
106
|
+
if (typeof u.prompt_cache_miss_tokens === "number")
|
|
107
|
+
usage.input_tokens = u.prompt_cache_miss_tokens;
|
|
108
|
+
else if (typeof u.prompt_tokens === "number")
|
|
109
|
+
usage.input_tokens = u.prompt_tokens - cached;
|
|
110
|
+
if (cached > 0)
|
|
111
|
+
usage.cache_read_tokens = cached;
|
|
112
|
+
if (typeof u.completion_tokens === "number")
|
|
113
|
+
usage.output_tokens = u.completion_tokens;
|
|
114
|
+
return usage;
|
|
115
|
+
}
|
|
116
|
+
function mapStop(finish) {
|
|
117
|
+
switch (finish) {
|
|
118
|
+
case "stop":
|
|
119
|
+
return "end";
|
|
120
|
+
case "tool_calls":
|
|
121
|
+
return "tool_use";
|
|
122
|
+
case "length":
|
|
123
|
+
return "max_tokens";
|
|
124
|
+
case "content_filter":
|
|
125
|
+
return "refusal";
|
|
126
|
+
default:
|
|
127
|
+
return finish ? "other" : undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Build a `ModelPort` bound to one chat-completions endpoint. Each call POSTs the request and turns
|
|
132
|
+
* the reply into a neutral `ModelReply`; a non-2xx response THROWS with its status, so the loop can
|
|
133
|
+
* type it as `transport_failed` rather than the port swallowing it into a shrug.
|
|
134
|
+
*/
|
|
135
|
+
export function makeChatCompletionsPort(opts) {
|
|
136
|
+
const doFetch = opts.fetchFn ?? fetch;
|
|
137
|
+
// Strip trailing '/' in LINEAR time (CodeQL js/polynomial-redos, PR #534). The old `/\/+$/` regex
|
|
138
|
+
// retries its slash run from every start position, so a long run of INTERIOR slashes backtracks
|
|
139
|
+
// quadratically (measured 2,707 ms at 40,000 slashes). A backward char-code scan (47 === '/') is
|
|
140
|
+
// linear by construction and touches only the trailing run — interior slashes and the rest of the
|
|
141
|
+
// URL are left exactly as given.
|
|
142
|
+
let end = opts.baseUrl.length;
|
|
143
|
+
while (end > 0 && opts.baseUrl.charCodeAt(end - 1) === 47)
|
|
144
|
+
end--;
|
|
145
|
+
const url = `${opts.baseUrl.slice(0, end)}/chat/completions`;
|
|
146
|
+
return async (req) => {
|
|
147
|
+
// contract-tool-wire-name-collision-v1 (O3) — before building the reverse map or fetching, check
|
|
148
|
+
// that the request's tools INVERT: two tools that encode to one wire name would be sent as two
|
|
149
|
+
// identical function definitions, and `new Map(entries)` silently keeps only the last, so a reply
|
|
150
|
+
// naming that wire name resolves to whichever tool won. Fail closed HERE, the reachable layer the
|
|
151
|
+
// K6 witness named — throw (as this port's other unrecoverable argument faults do), naming both
|
|
152
|
+
// tools and the wire name they collapsed onto; never build the map from a set it cannot invert.
|
|
153
|
+
const wireNames = req.tools.map((t) => encodeToolName(t.name));
|
|
154
|
+
if (new Set(wireNames).size !== wireNames.length) {
|
|
155
|
+
const byWire = new Map();
|
|
156
|
+
req.tools.forEach((t, i) => {
|
|
157
|
+
const w = wireNames[i];
|
|
158
|
+
const names = byWire.get(w);
|
|
159
|
+
if (names)
|
|
160
|
+
names.push(t.name);
|
|
161
|
+
else
|
|
162
|
+
byWire.set(w, [t.name]);
|
|
163
|
+
});
|
|
164
|
+
const detail = [...byWire.entries()]
|
|
165
|
+
.filter(([, names]) => names.length > 1)
|
|
166
|
+
.map(([w, names]) => `${names.join(", ")} → ${w}`)
|
|
167
|
+
.join("; ");
|
|
168
|
+
throw new Error(`chat-completions tools collide on the wire (indistinguishable to the model): ${detail}. ` +
|
|
169
|
+
`Refusing rather than resolving a reply to whichever tool won the reverse map.`);
|
|
170
|
+
}
|
|
171
|
+
// The offered list is the authority on what a wire name means: build the reverse map from it so
|
|
172
|
+
// a reply resolves to the MCP name even when that name was too long to invert.
|
|
173
|
+
const byWireName = new Map(req.tools.map((t) => [encodeToolName(t.name), t.name]));
|
|
174
|
+
const body = {
|
|
175
|
+
model: req.model,
|
|
176
|
+
messages: req.messages.map(toWireMessage),
|
|
177
|
+
...(req.tools.length > 0 ? { tools: req.tools.map(toFunctionDef) } : {}),
|
|
178
|
+
...(req.max_tokens !== undefined ? { max_tokens: req.max_tokens } : {}),
|
|
179
|
+
};
|
|
180
|
+
const res = await doFetch(url, {
|
|
181
|
+
method: "POST",
|
|
182
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${opts.apiKey}` },
|
|
183
|
+
body: JSON.stringify(body),
|
|
184
|
+
signal: req.signal,
|
|
185
|
+
});
|
|
186
|
+
if (!res.ok) {
|
|
187
|
+
const text = await res.text().catch(() => "");
|
|
188
|
+
throw new Error(`chat completions ${res.status}: ${text.slice(0, 300)}`);
|
|
189
|
+
}
|
|
190
|
+
const wire = (await res.json());
|
|
191
|
+
const choice = wire.choices?.[0];
|
|
192
|
+
const message = choice?.message ?? {};
|
|
193
|
+
const toolCalls = (message.tool_calls ?? []).map((tc) => {
|
|
194
|
+
const wireName = tc.function?.name ?? "";
|
|
195
|
+
let args = {};
|
|
196
|
+
try {
|
|
197
|
+
args = JSON.parse(tc.function?.arguments || "{}");
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
args = {};
|
|
201
|
+
}
|
|
202
|
+
return { id: tc.id ?? "", name: byWireName.get(wireName) ?? fromFunctionName(wireName), args };
|
|
203
|
+
});
|
|
204
|
+
const reply = {
|
|
205
|
+
message: {
|
|
206
|
+
content: message.content ?? null,
|
|
207
|
+
...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}),
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
if (typeof wire.model === "string")
|
|
211
|
+
reply.model = wire.model;
|
|
212
|
+
const usage = mapUsage(wire.usage);
|
|
213
|
+
if (usage !== undefined)
|
|
214
|
+
reply.usage = usage;
|
|
215
|
+
const stop = mapStop(choice?.finish_reason);
|
|
216
|
+
if (stop !== undefined)
|
|
217
|
+
reply.stop = stop;
|
|
218
|
+
return reply;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=chat_completions_port.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat_completions_port.js","sourceRoot":"","sources":["../../src/chat_completions_port.ts"],"names":[],"mappings":"AAsBA,oGAAoG;AACpG,EAAE;AACF,mGAAmG;AACnG,mGAAmG;AACnG,mGAAmG;AACnG,iGAAiG;AAEjG,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAC1C,MAAM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EAAE;gBACP,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;gBAChC,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3D;SACF,CAAC;QACF,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;YAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAC5C,IAAI,IAAI,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type AgentInvocationContext, type AgentInvoker } from "./runtime.js";
|
|
2
2
|
import type { Registry } from "./registry.js";
|
|
3
3
|
import type { Depth, ModelTier } from "./pricing.js";
|
|
4
|
+
import type { Effort } from "./genome_schema.js";
|
|
4
5
|
import { type ToolProviderRegistry } from "./tool_providers.js";
|
|
5
6
|
export declare const MODEL_TIER_MAP: Record<ModelTier, string>;
|
|
6
7
|
/**
|
|
@@ -249,11 +250,28 @@ export declare const PROMPT_ARG_LIMIT_DEFAULT = 16000;
|
|
|
249
250
|
* to the size test rather than failing a dispatch.
|
|
250
251
|
*/
|
|
251
252
|
export declare function promptViaStdin(prompt: string): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* The `claude` session id a chair's conversation is NAMED by, derived deterministically from
|
|
255
|
+
* `(gig_id, role)`. The same seat used twice in one gig derives the SAME uuid, so its second reach
|
|
256
|
+
* can `--resume` the conversation the first opened instead of re-reading cold; two roles in one gig,
|
|
257
|
+
* or one role across two gigs, never collide (a v5-shaped uuid over a `gig_id\x1frole` string).
|
|
258
|
+
*
|
|
259
|
+
* A gig-less invocation (no `gig_id`) returns undefined: with nothing to key the session on there is
|
|
260
|
+
* nothing to name and nothing to resume, so the spawn carries neither `--session-id` nor `--resume`.
|
|
261
|
+
* The uuid is a valid RFC 4122 string (version nibble 5, variant 8–b) so the CLI accepts it as a
|
|
262
|
+
* session id and the spec's UUID shape holds.
|
|
263
|
+
*/
|
|
264
|
+
export declare function sessionUuidFor(gig_id: string | undefined, role: string | undefined): string | undefined;
|
|
252
265
|
export declare function buildInvokerArgs(prompt: string, mcpConfigPath: string, opts: {
|
|
253
266
|
model?: string | undefined;
|
|
254
267
|
allowed_tools?: readonly string[] | undefined;
|
|
255
268
|
disallowed_tools?: readonly string[] | undefined;
|
|
256
269
|
max_tool_calls?: number | undefined;
|
|
270
|
+
effort?: Effort | undefined;
|
|
271
|
+
session_id?: string | undefined;
|
|
272
|
+
resume?: boolean | undefined;
|
|
273
|
+
fork_from_session?: string | undefined;
|
|
274
|
+
resume_session_at?: string | undefined;
|
|
257
275
|
}): string[];
|
|
258
276
|
/** Everything except the box's own credentials. Returns a plain object, so the spawn is given an
|
|
259
277
|
* explicit environment rather than inheriting one — the difference matters when a new secret is
|