@tangle-network/cli-agent-registry 0.14.0 → 0.15.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.
Files changed (35) hide show
  1. package/README.md +30 -0
  2. package/dist/{backend-types-CREj4iOY.mjs → backend-types-CNo_Zj_K.mjs} +3 -12
  3. package/dist/{backend-types-CJH-wHS3.d.mts → backend-types-DRmLR1e0.d.mts} +4 -13
  4. package/dist/backend-types.d.mts +1 -1
  5. package/dist/backend-types.mjs +1 -1
  6. package/dist/cli-auth-bundle-C6DtK7GX.mjs +95 -0
  7. package/dist/cli-auth-bundle-CwAaH0Ap.d.mts +51 -0
  8. package/dist/cli-auth-bundle.d.mts +2 -49
  9. package/dist/cli-auth-bundle.mjs +1 -91
  10. package/dist/cli-auth-placeholder.d.mts +1 -1
  11. package/dist/cli-auth-placeholder.mjs +2 -2
  12. package/dist/cli-backend-auth-env.mjs +3 -3
  13. package/dist/default-backend.d.mts +1 -1
  14. package/dist/default-backend.mjs +2 -2
  15. package/dist/{harness-DIdVNSwl.mjs → harness-D1fTxnDD.mjs} +66 -34
  16. package/dist/{native-session-contracts-DWFzgoye.mjs → harness-contracts-BZoECCMc.mjs} +87 -173
  17. package/dist/host-contracts.d.mts +30 -0
  18. package/dist/host-contracts.json +422 -0
  19. package/dist/host-contracts.mjs +63 -0
  20. package/dist/index.d.mts +117 -120
  21. package/dist/index.mjs +17 -12
  22. package/dist/local-cli-auth.d.mts +1 -1
  23. package/dist/local-cli-auth.mjs +1 -1
  24. package/dist/native-session-contracts.d.mts +57 -62
  25. package/dist/native-session-contracts.mjs +40 -2
  26. package/dist/servable-models.d.mts +5 -6
  27. package/dist/servable-models.mjs +6 -22
  28. package/dist/{session-contract-BC75JdnA.d.mts → session-contract-BhzcbPRW.d.mts} +10 -44
  29. package/dist/session-contract.d.mts +1 -1
  30. package/dist/session-contract.mjs +14 -62
  31. package/dist/{specs-BSELpX1h.d.mts → spec-CcvTM7-j.d.mts} +22 -91
  32. package/dist/{specs-Bbiay_8K.mjs → specs-BBF55TnM.mjs} +125 -94
  33. package/dist/specs.d.mts +72 -3
  34. package/dist/specs.mjs +2 -2
  35. package/package.json +15 -9
@@ -1,16 +1,7 @@
1
- import { o as NativeSessionStore } from "./session-contract-BC75JdnA.mjs";
1
+ import { o as NativeSessionStore } from "./session-contract-BhzcbPRW.mjs";
2
2
 
3
3
  //#region src/native-session-contracts.d.ts
4
- /**
5
- * The native session projection of the per-harness declarations in harness-contracts/. Each entry is
6
- * proven by a conformance receipt (tests/harness/receipts) for
7
- * its pinned CLI version, or is listed in HARNESS_CONFORMANCE_PENDING.
8
- *
9
- * CLI versions are the pins in infra/nix (agent-clis.json and flake.nix),
10
- * generated into harness-cli-versions.ts by the bump. The registry test
11
- * tests/harness-session-contract.test.ts fails when a pin, a contract or an
12
- * adapter's source moves without a new receipt.
13
- */
4
+ /** Native session contracts. A receipt proves each pin. There is no pending list. */
14
5
  declare const NATIVE_SESSION_CONTRACTS: {
15
6
  readonly "claude-code": {
16
7
  version: 1;
@@ -130,9 +121,9 @@ declare const NATIVE_SESSION_CONTRACTS: {
130
121
  forbiddenArgs: never[];
131
122
  storeEnv: {};
132
123
  evidence: {
133
- servedModel: "session-record";
124
+ servedModel: "none";
134
125
  usage: "per-response";
135
- endingError: "none";
126
+ endingError: "session-record";
136
127
  };
137
128
  cliVersion: "1.49.0";
138
129
  };
@@ -167,7 +158,7 @@ declare const NATIVE_SESSION_CONTRACTS: {
167
158
  usage: "session-total";
168
159
  endingError: "none";
169
160
  };
170
- cliVersion: "0.249.0";
161
+ cliVersion: "0.250.0";
171
162
  };
172
163
  readonly amp: {
173
164
  version: 1;
@@ -196,7 +187,7 @@ declare const NATIVE_SESSION_CONTRACTS: {
196
187
  usage: "per-response";
197
188
  endingError: "none";
198
189
  };
199
- cliVersion: "0.0.1793044831-ga1b1a0";
190
+ cliVersion: "0.0.1793104576-gc52692";
200
191
  };
201
192
  readonly prime: {
202
193
  version: 1;
@@ -204,7 +195,7 @@ declare const NATIVE_SESSION_CONTRACTS: {
204
195
  root: string;
205
196
  files: string[];
206
197
  write: "jsonl-append";
207
- shared: false;
198
+ shared: true;
208
199
  format: "prime.session-jsonl";
209
200
  }];
210
201
  identity: {
@@ -246,19 +237,18 @@ declare const NATIVE_SESSION_CONTRACTS: {
246
237
  };
247
238
  cliVersion: "0.22.4";
248
239
  };
249
- readonly forge: {
240
+ readonly openclaw: {
250
241
  version: 1;
251
242
  stores: [{
252
243
  root: string;
253
244
  files: string[];
254
245
  write: "sqlite-wal";
255
246
  shared: true;
256
- format: "forge.sqlite";
247
+ format: "openclaw.session-jsonl";
257
248
  }];
258
249
  identity: {
259
- kind: "first-event";
260
- event: string;
261
- deadlineMs: number;
250
+ kind: "pre-minted";
251
+ args: string[];
262
252
  };
263
253
  resume: {
264
254
  kind: "args";
@@ -271,16 +261,35 @@ declare const NATIVE_SESSION_CONTRACTS: {
271
261
  usage: "per-response";
272
262
  endingError: "none";
273
263
  };
274
- cliVersion: "2.14.0";
264
+ cliVersion: "2026.10.8";
275
265
  };
276
- readonly openclaw: {
266
+ readonly acp: {
267
+ version: 1;
268
+ stores: [NativeSessionStore, NativeSessionStore, NativeSessionStore, NativeSessionStore, NativeSessionStore];
269
+ identity: {
270
+ kind: "api-created";
271
+ call: "acp session/new";
272
+ };
273
+ resume: {
274
+ kind: "api";
275
+ };
276
+ forbiddenArgs: never[];
277
+ storeEnv: {};
278
+ evidence: {
279
+ servedModel: "session-record";
280
+ usage: "session-total";
281
+ endingError: "none";
282
+ };
283
+ cliVersion: "claude-agent-acp 0.97.0; codex-acp 0.16.0; gemini-cli 0.65.0";
284
+ };
285
+ readonly grok: {
277
286
  version: 1;
278
287
  stores: [{
279
288
  root: string;
280
289
  files: string[];
281
290
  write: "jsonl-append";
282
291
  shared: false;
283
- format: "openclaw.session-jsonl";
292
+ format: "grok.acp-session-dir";
284
293
  }];
285
294
  identity: {
286
295
  kind: "first-event";
@@ -292,63 +301,49 @@ declare const NATIVE_SESSION_CONTRACTS: {
292
301
  args: string[];
293
302
  };
294
303
  forbiddenArgs: never[];
295
- storeEnv: {};
304
+ storeEnv: {
305
+ GROK_HOME: string;
306
+ };
296
307
  evidence: {
297
308
  servedModel: "session-record";
298
- usage: "per-response";
309
+ usage: "none";
299
310
  endingError: "none";
300
311
  };
301
- cliVersion: "2026.10.7";
312
+ cliVersion: "0.1.220";
302
313
  };
303
- readonly acp: {
314
+ readonly nanoclaw: {
304
315
  version: 1;
305
- stores: [NativeSessionStore, NativeSessionStore, NativeSessionStore, NativeSessionStore, NativeSessionStore];
316
+ stores: [{
317
+ root: string;
318
+ files: string[];
319
+ write: "sqlite-wal";
320
+ shared: false;
321
+ format: "nanoclaw.session-sqlite";
322
+ }];
306
323
  identity: {
307
- kind: "api-created";
308
- call: "acp session/new";
324
+ kind: "first-event";
325
+ event: string;
326
+ deadlineMs: number;
309
327
  };
310
328
  resume: {
311
329
  kind: "api";
312
330
  };
313
331
  forbiddenArgs: never[];
314
- storeEnv: {};
332
+ storeEnv: {
333
+ NANOCLAW_RUNTIME_ROOT: string;
334
+ };
315
335
  evidence: {
316
- servedModel: "session-record";
336
+ servedModel: "none";
317
337
  usage: "per-response";
318
338
  endingError: "none";
319
339
  };
320
- cliVersion: "claude-agent-acp 0.97.0; codex-acp 0.16.0; gemini-cli 0.65.0";
340
+ cliVersion: "2.1.54";
321
341
  };
322
342
  };
323
- /**
324
- * The child environment of a harness whose contract can move every native
325
- * store off HOME, or undefined when it cannot.
326
- *
327
- * HOME becomes the shared agent home, so toolchains and repos the agent puts
328
- * under ~ persist across sessions and restarts. Each declared store env and
329
- * the XDG roots stay in the private runtime home, so credentials, config and
330
- * session records do not collide between sessions. A harness whose contract
331
- * declares no store env (kimi-code, factory-droids, forge, openclaw, acp,
332
- * prime) writes credentials straight under HOME and keeps the private HOME.
333
- * So does OpenCode: its warm-server pool, spare adoption, plugin dependencies
334
- * and correlation file all use HOME as the session's runtime identity, and a
335
- * shared HOME would merge those identities across sessions.
336
- */
343
+ /** Store env and XDG roots under the private runtime home. Undefined when HOME itself is the store. */
337
344
  declare function configDirHomeEnv(harness: string, runtimeHome: string, agentHome: string): Record<string, string> | undefined;
338
- /**
339
- * Harnesses whose declared contract has no conformance receipt yet, with
340
- * the reason. They keep running with persistence-disabling flags refused,
341
- * but the store-location and identity-deadline checks wait for their
342
- * receipt. This list may only shrink: tests/harness-session-contract.test.ts
343
- * fails on a new entry, and on an entry whose receipt now passes.
344
- */
345
- declare const HARNESS_CONFORMANCE_PENDING: Readonly<Record<string, string>>;
346
- /**
347
- * Harnesses that cannot meet the contract at all. They stay listed until
348
- * their product surfaces (sandbox web launch list, CLI connect, SDK
349
- * placement) drop them, and no capture claims their sessions.
350
- */
345
+ /** No capture claims these sessions. They stay until their product surfaces drop them. */
351
346
  declare const HARNESS_SESSION_UNSUPPORTED: Readonly<Record<string, string>>;
352
347
  //#endregion
353
- export { HARNESS_CONFORMANCE_PENDING, HARNESS_SESSION_UNSUPPORTED, NATIVE_SESSION_CONTRACTS, configDirHomeEnv };
348
+ export { HARNESS_SESSION_UNSUPPORTED, NATIVE_SESSION_CONTRACTS, configDirHomeEnv };
354
349
  //# sourceMappingURL=native-session-contracts.d.mts.map
@@ -1,2 +1,40 @@
1
- import { i as configDirHomeEnv, n as HARNESS_SESSION_UNSUPPORTED, r as NATIVE_SESSION_CONTRACTS, t as HARNESS_CONFORMANCE_PENDING } from "./native-session-contracts-DWFzgoye.mjs";
2
- export { HARNESS_CONFORMANCE_PENDING, HARNESS_SESSION_UNSUPPORTED, NATIVE_SESSION_CONTRACTS, configDirHomeEnv };
1
+ import { t as HARNESSES } from "./harness-contracts-BZoECCMc.mjs";
2
+ //#region src/native-session-contracts.ts
3
+ /** Native session contracts. A receipt proves each pin. There is no pending list. */
4
+ const NATIVE_SESSION_CONTRACTS = {
5
+ "claude-code": HARNESSES["claude-code"].session.contract,
6
+ codex: HARNESSES["codex"].session.contract,
7
+ opencode: HARNESSES["opencode"].session.contract,
8
+ pi: HARNESSES["pi"].session.contract,
9
+ "kimi-code": HARNESSES["kimi-code"].session.contract,
10
+ "factory-droids": HARNESSES["factory-droids"].session.contract,
11
+ amp: HARNESSES["amp"].session.contract,
12
+ prime: HARNESSES["prime"].session.contract,
13
+ hermes: HARNESSES["hermes"].session.contract,
14
+ openclaw: HARNESSES["openclaw"].session.contract,
15
+ acp: HARNESSES["acp"].session.contract,
16
+ grok: HARNESSES["grok"].session.contract,
17
+ nanoclaw: HARNESSES["nanoclaw"].session.contract
18
+ };
19
+ const HOME_KEYED_RUNTIMES = new Set(["opencode"]);
20
+ /** Store env and XDG roots under the private runtime home. Undefined when HOME itself is the store. */
21
+ function configDirHomeEnv(harness, runtimeHome, agentHome) {
22
+ const contract = NATIVE_SESSION_CONTRACTS[harness];
23
+ const stores = Object.entries(contract?.storeEnv ?? {}).filter(([name]) => !name.startsWith("--"));
24
+ if (stores.length === 0 || HOME_KEYED_RUNTIMES.has(harness)) return void 0;
25
+ const home = runtimeHome.replace(/\/+$/u, "");
26
+ return {
27
+ HOME: agentHome,
28
+ XDG_CONFIG_HOME: `${home}/.config`,
29
+ XDG_CACHE_HOME: `${home}/.cache`,
30
+ XDG_DATA_HOME: `${home}/.local/share`,
31
+ XDG_STATE_HOME: `${home}/.local/state`,
32
+ ...Object.fromEntries(stores.map(([name, relative]) => [name, `${home}/${relative}`]))
33
+ };
34
+ }
35
+ /** No capture claims these sessions. They stay until their product surfaces drop them. */
36
+ const HARNESS_SESSION_UNSUPPORTED = { cursor: HARNESSES["cursor"].session.defect.reason };
37
+ //#endregion
38
+ export { HARNESS_SESSION_UNSUPPORTED, NATIVE_SESSION_CONTRACTS, configDirHomeEnv };
39
+
40
+ //# sourceMappingURL=native-session-contracts.mjs.map
@@ -33,12 +33,11 @@ interface ManagedModelRung {
33
33
  * fail, it hangs.
34
34
  *
35
35
  * Which models a harness can run is not decided here: the capability table
36
- * ({@link harnessModelSupportFor}) drops the rungs a harness refuses (a vendor
37
- * lock, measured exclusions). claude-code and codex run the whole ladder: the
38
- * router translates every non-vendor model on their Messages and Responses
39
- * wires to chat completions, so they lead with the same cheapest rung as every
40
- * other Router-backed harness. A rung exists for a vendor-locked harness when
41
- * it is the only model that harness can run (kimi-code runs Moonshot).
36
+ * ({@link harnessModelSupportFor}) drops the rungs a harness refuses (measured
37
+ * exclusions). claude-code and codex run the whole ladder: the router
38
+ * translates every non-vendor model on their Messages and Responses wires to
39
+ * chat completions, so they lead with the same cheapest rung as every other
40
+ * Router-backed harness.
42
41
  */
43
42
  declare const MANAGED_MODEL_LADDER: readonly ManagedModelRung[];
44
43
  /** The bare id a provider-prefixed model id carries. */
@@ -1,4 +1,4 @@
1
- import { l as getSpec, m as harnessModelSupportFor } from "./specs-Bbiay_8K.mjs";
1
+ import { l as getSpec, m as harnessModelSupportFor } from "./specs-BBF55TnM.mjs";
2
2
  //#region src/servable-models.ts
3
3
  /**
4
4
  * The models a managed (Tangle-funded) run may default to, most preferred
@@ -23,12 +23,11 @@ import { l as getSpec, m as harnessModelSupportFor } from "./specs-Bbiay_8K.mjs"
23
23
  * fail, it hangs.
24
24
  *
25
25
  * Which models a harness can run is not decided here: the capability table
26
- * ({@link harnessModelSupportFor}) drops the rungs a harness refuses (a vendor
27
- * lock, measured exclusions). claude-code and codex run the whole ladder: the
28
- * router translates every non-vendor model on their Messages and Responses
29
- * wires to chat completions, so they lead with the same cheapest rung as every
30
- * other Router-backed harness. A rung exists for a vendor-locked harness when
31
- * it is the only model that harness can run (kimi-code runs Moonshot).
26
+ * ({@link harnessModelSupportFor}) drops the rungs a harness refuses (measured
27
+ * exclusions). claude-code and codex run the whole ladder: the router
28
+ * translates every non-vendor model on their Messages and Responses wires to
29
+ * chat completions, so they lead with the same cheapest rung as every other
30
+ * Router-backed harness.
32
31
  */
33
32
  const MANAGED_MODEL_LADDER = [
34
33
  {
@@ -51,21 +50,6 @@ const MANAGED_MODEL_LADDER = [
51
50
  reason: "routeable and priced; no recent dispatch",
52
51
  reviewedAt: "2026-10-14"
53
52
  },
54
- {
55
- id: "moonshot/kimi-k3",
56
- reason: "kimi-code's first rung (Moonshot-locked); Moonshot and Together quota-exhausted when reviewed",
57
- reviewedAt: "2026-10-14"
58
- },
59
- {
60
- id: "moonshot/kimi-k2.7-code",
61
- reason: "Moonshot direct coding model; quota-exhausted when reviewed",
62
- reviewedAt: "2026-10-14"
63
- },
64
- {
65
- id: "moonshotai/kimi-k2-0905",
66
- reason: "served through OpenRouter; no recent dispatch",
67
- reviewedAt: "2026-10-14"
68
- },
69
53
  {
70
54
  id: "openai/gpt-6-luna",
71
55
  reason: "the router's tangle/cheap role; no recent dispatch",
@@ -1,22 +1,6 @@
1
1
  //#region src/session-contract.d.ts
2
- /**
3
- * The harness session contract: what every registered harness promises about
4
- * its native session, so one capture path and one reader cover all of them.
5
- *
6
- * A harness always persists a native session. Its store sits at a declared
7
- * place under the execution's private runtime HOME, the sidecar knows the
8
- * session id for each execution before the turn's evidence is needed, and the
9
- * served model, usage and ending error can be read back from what it wrote.
10
- * A harness that cannot promise this cannot be registered.
11
- *
12
- * Data and pure functions only: this module is imported by the Worker-safe
13
- * `/specs` entry, so it must not import Node built-ins.
14
- *
15
- * The format ids and store shape mirror `@tangle-network/harness-sessions`,
16
- * which owns the readers. Where that package is installed, the registry test
17
- * fails when the two lists of format ids drift.
18
- */
19
- declare const SESSION_FORMAT_IDS: readonly ["claude-code.projects-jsonl", "codex.rollout-jsonl", "opencode.sqlite", "pi.session-jsonl", "kimi.session-dir", "factory.session-jsonl", "gemini.chat-json", "amp.thread-json", "forge.sqlite", "hermes.state-sqlite", "prime.session-jsonl", "openclaw.session-jsonl", "sidecar.message-json", "sidecar.session-json"];
2
+ /** One session contract. Stores sit under the private runtime HOME. No Node built-ins. */
3
+ declare const SESSION_FORMAT_IDS: readonly ["claude-code.projects-jsonl", "codex.rollout-jsonl", "opencode.sqlite", "pi.session-jsonl", "kimi.session-dir", "factory.session-jsonl", "gemini.chat-json", "amp.thread-json", "hermes.state-sqlite", "prime.session-jsonl", "openclaw.session-jsonl", "grok.acp-session-dir", "nanoclaw.session-sqlite", "sidecar.message-json", "sidecar.session-json"];
20
4
  type SessionFormatId = (typeof SESSION_FORMAT_IDS)[number];
21
5
  interface NativeSessionStore {
22
6
  /**
@@ -49,8 +33,8 @@ type NativeSessionIdentity = /** The sidecar mints the id and records it before
49
33
  deadlineMs: number;
50
34
  };
51
35
  interface HarnessSessionEvidence {
52
- servedModel: "provider-response" | "session-record" | "turn-context";
53
- usage: "per-response" | "cumulative" | "session-total";
36
+ servedModel: "provider-response" | "session-record" | "turn-context" | "none";
37
+ usage: "per-response" | "cumulative" | "session-total" | "none";
54
38
  endingError: "session-record" | "none";
55
39
  }
56
40
  interface HarnessSessionContract {
@@ -87,45 +71,27 @@ declare class HarnessSessionContractError extends Error {
87
71
  declare function substituteNativeSessionId(tokens: readonly string[], nativeSessionId: string): string[];
88
72
  /** The forbidden tokens present in `argv`, in argv order. */
89
73
  declare function forbiddenArgViolations(contract: Pick<HarnessSessionContract, "forbiddenArgs">, argv: readonly string[]): string[];
90
- /**
91
- * Refuse flags that disable persistence. Called on configured flags before a
92
- * turn can start, and on the built argv before spawn.
93
- */
74
+ /** Refuse flags that disable persistence, on configured flags and on the built argv. */
94
75
  declare function assertFlagsHonourSessionContract(harness: string, contract: Pick<HarnessSessionContract, "forbiddenArgs">, flags: readonly string[], source: string): void;
95
- /**
96
- * Check the argv the adapter built: no forbidden token, and, for a
97
- * pre-minted identity on a new session, the identity args carrying the
98
- * minted id.
99
- */
76
+ /** No forbidden argv token, and a pre-minted new session carries its minted id. */
100
77
  declare function assertArgvHonoursSessionContract(harness: string, contract: HarnessSessionContract, argv: readonly string[], session: {
101
78
  mintedId?: string;
102
79
  }): void;
103
80
  /** Normalize a POSIX path; `..` that escapes the start is kept as a leading `..`. */
104
81
  declare function normalizePosixPath(path: string): string;
105
- /**
106
- * Refuse a store location the contract does not declare. Each env value (or
107
- * flag value, for keys that start with `--`) must resolve to exactly
108
- * HOME/<declared path>; relative flag values resolve against `cwd`.
109
- */
82
+ /** Each store env or `--flag` value must resolve to exactly HOME/<declared path>. */
110
83
  declare function assertStoreLocationHonoursSessionContract(harness: string, contract: Pick<HarnessSessionContract, "storeEnv">, input: {
111
84
  runtimeHome: string;
112
85
  cwd: string;
113
86
  env?: Readonly<Record<string, string | undefined>>;
114
87
  argv?: readonly string[];
115
88
  }): void;
116
- /**
117
- * A matcher for one store glob. `**` matches any number of path segments
118
- * (including none), `*` matches within one segment, and `{id}` is the native
119
- * session id (any id when omitted).
120
- */
89
+ /** `**` is any number of segments, `*` is one segment, `{id}` is the session id. */
121
90
  declare function compileSessionStoreGlob(glob: string, nativeSessionId?: string): RegExp;
122
- /**
123
- * The declared store that holds `pathFromHome` for this session, or
124
- * undefined. A shared store's files belong to every session.
125
- */
91
+ /** The store that holds `pathFromHome`, or undefined. A shared store matches every session. */
126
92
  declare function sessionStoreForPath(contract: Pick<HarnessSessionContract, "stores">, pathFromHome: string, nativeSessionId: string): NativeSessionStore | undefined;
127
93
  /** Structural checks every declared contract must pass. */
128
94
  declare function sessionContractProblems(contract: HarnessSessionContract): string[];
129
95
  //#endregion
130
96
  export { substituteNativeSessionId as _, NativeSessionIdentity as a, SessionFormatId as c, assertStoreLocationHonoursSessionContract as d, compileSessionStoreGlob as f, sessionStoreForPath as g, sessionContractProblems as h, HarnessSessionEvidence as i, assertArgvHonoursSessionContract as l, normalizePosixPath as m, HarnessSessionContractError as n, NativeSessionStore as o, forbiddenArgViolations as p, HarnessSessionContractErrorCode as r, SESSION_FORMAT_IDS as s, HarnessSessionContract as t, assertFlagsHonourSessionContract as u };
131
- //# sourceMappingURL=session-contract-BC75JdnA.d.mts.map
97
+ //# sourceMappingURL=session-contract-BhzcbPRW.d.mts.map
@@ -1,2 +1,2 @@
1
- import { _ as substituteNativeSessionId, a as NativeSessionIdentity, c as SessionFormatId, d as assertStoreLocationHonoursSessionContract, f as compileSessionStoreGlob, g as sessionStoreForPath, h as sessionContractProblems, i as HarnessSessionEvidence, l as assertArgvHonoursSessionContract, m as normalizePosixPath, n as HarnessSessionContractError, o as NativeSessionStore, p as forbiddenArgViolations, r as HarnessSessionContractErrorCode, s as SESSION_FORMAT_IDS, t as HarnessSessionContract, u as assertFlagsHonourSessionContract } from "./session-contract-BC75JdnA.mjs";
1
+ import { _ as substituteNativeSessionId, a as NativeSessionIdentity, c as SessionFormatId, d as assertStoreLocationHonoursSessionContract, f as compileSessionStoreGlob, g as sessionStoreForPath, h as sessionContractProblems, i as HarnessSessionEvidence, l as assertArgvHonoursSessionContract, m as normalizePosixPath, n as HarnessSessionContractError, o as NativeSessionStore, p as forbiddenArgViolations, r as HarnessSessionContractErrorCode, s as SESSION_FORMAT_IDS, t as HarnessSessionContract, u as assertFlagsHonourSessionContract } from "./session-contract-BhzcbPRW.mjs";
2
2
  export { HarnessSessionContract, HarnessSessionContractError, HarnessSessionContractErrorCode, HarnessSessionEvidence, NativeSessionIdentity, NativeSessionStore, SESSION_FORMAT_IDS, SessionFormatId, assertArgvHonoursSessionContract, assertFlagsHonourSessionContract, assertStoreLocationHonoursSessionContract, compileSessionStoreGlob, forbiddenArgViolations, normalizePosixPath, sessionContractProblems, sessionStoreForPath, substituteNativeSessionId };
@@ -1,21 +1,5 @@
1
1
  //#region src/session-contract.ts
2
- /**
3
- * The harness session contract: what every registered harness promises about
4
- * its native session, so one capture path and one reader cover all of them.
5
- *
6
- * A harness always persists a native session. Its store sits at a declared
7
- * place under the execution's private runtime HOME, the sidecar knows the
8
- * session id for each execution before the turn's evidence is needed, and the
9
- * served model, usage and ending error can be read back from what it wrote.
10
- * A harness that cannot promise this cannot be registered.
11
- *
12
- * Data and pure functions only: this module is imported by the Worker-safe
13
- * `/specs` entry, so it must not import Node built-ins.
14
- *
15
- * The format ids and store shape mirror `@tangle-network/harness-sessions`,
16
- * which owns the readers. Where that package is installed, the registry test
17
- * fails when the two lists of format ids drift.
18
- */
2
+ /** One session contract. Stores sit under the private runtime HOME. No Node built-ins. */
19
3
  const SESSION_FORMAT_IDS = [
20
4
  "claude-code.projects-jsonl",
21
5
  "codex.rollout-jsonl",
@@ -25,10 +9,11 @@ const SESSION_FORMAT_IDS = [
25
9
  "factory.session-jsonl",
26
10
  "gemini.chat-json",
27
11
  "amp.thread-json",
28
- "forge.sqlite",
29
12
  "hermes.state-sqlite",
30
13
  "prime.session-jsonl",
31
14
  "openclaw.session-jsonl",
15
+ "grok.acp-session-dir",
16
+ "nanoclaw.session-sqlite",
32
17
  "sidecar.message-json",
33
18
  "sidecar.session-json"
34
19
  ];
@@ -44,31 +29,21 @@ var HarnessSessionContractError = class extends Error {
44
29
  function substituteNativeSessionId(tokens, nativeSessionId) {
45
30
  return tokens.map((token) => token.split("{id}").join(nativeSessionId));
46
31
  }
47
- function matchesForbidden(token, forbidden) {
48
- return token === forbidden || token.startsWith(`${forbidden}=`);
49
- }
50
32
  /** The forbidden tokens present in `argv`, in argv order. */
51
33
  function forbiddenArgViolations(contract, argv) {
52
- return argv.filter((token) => contract.forbiddenArgs.some((forbidden) => matchesForbidden(token, forbidden)));
34
+ return argv.filter((token) => contract.forbiddenArgs.some((forbidden) => token === forbidden || token.startsWith(`${forbidden}=`)));
53
35
  }
54
36
  function indexOfSequence(haystack, needle) {
55
37
  if (needle.length === 0) return 0;
56
38
  for (let index = 0; index + needle.length <= haystack.length; index++) if (needle.every((token, offset) => haystack[index + offset] === token)) return index;
57
39
  return -1;
58
40
  }
59
- /**
60
- * Refuse flags that disable persistence. Called on configured flags before a
61
- * turn can start, and on the built argv before spawn.
62
- */
41
+ /** Refuse flags that disable persistence, on configured flags and on the built argv. */
63
42
  function assertFlagsHonourSessionContract(harness, contract, flags, source) {
64
43
  const violations = forbiddenArgViolations(contract, flags);
65
44
  if (violations.length > 0) throw new HarnessSessionContractError("harness_session_persistence_disabled", `${harness} ${source} carries ${violations.join(", ")}, which disables or redirects its native session`);
66
45
  }
67
- /**
68
- * Check the argv the adapter built: no forbidden token, and, for a
69
- * pre-minted identity on a new session, the identity args carrying the
70
- * minted id.
71
- */
46
+ /** No forbidden argv token, and a pre-minted new session carries its minted id. */
72
47
  function assertArgvHonoursSessionContract(harness, contract, argv, session) {
73
48
  assertFlagsHonourSessionContract(harness, contract, argv, "argv");
74
49
  if (session.mintedId === void 0) return;
@@ -94,11 +69,7 @@ function normalizePosixPath(path) {
94
69
  function resolvePosix(base, value) {
95
70
  return normalizePosixPath(value.startsWith("/") ? value : `${base.replace(/\/+$/u, "")}/${value}`);
96
71
  }
97
- /**
98
- * Refuse a store location the contract does not declare. Each env value (or
99
- * flag value, for keys that start with `--`) must resolve to exactly
100
- * HOME/<declared path>; relative flag values resolve against `cwd`.
101
- */
72
+ /** Each store env or `--flag` value must resolve to exactly HOME/<declared path>. */
102
73
  function assertStoreLocationHonoursSessionContract(harness, contract, input) {
103
74
  const home = normalizePosixPath(input.runtimeHome);
104
75
  const violations = [];
@@ -123,35 +94,16 @@ function assertStoreLocationHonoursSessionContract(harness, contract, input) {
123
94
  function escapeRegExp(text) {
124
95
  return text.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
125
96
  }
126
- /**
127
- * A matcher for one store glob. `**` matches any number of path segments
128
- * (including none), `*` matches within one segment, and `{id}` is the native
129
- * session id (any id when omitted).
130
- */
97
+ /** `**` is any number of segments, `*` is one segment, `{id}` is the session id. */
131
98
  function compileSessionStoreGlob(glob, nativeSessionId) {
132
- let pattern = "";
133
- for (let index = 0; index < glob.length;) if (glob.startsWith("**/", index)) {
134
- pattern += "(?:[^/]+/)*";
135
- index += 3;
136
- } else if (glob.startsWith("**", index)) {
137
- pattern += ".*";
138
- index += 2;
139
- } else if (glob.startsWith("{id}", index)) {
140
- pattern += nativeSessionId === void 0 ? "[^/]+" : escapeRegExp(nativeSessionId);
141
- index += 4;
142
- } else if (glob[index] === "*") {
143
- pattern += "[^/]*";
144
- index += 1;
145
- } else {
146
- pattern += escapeRegExp(glob[index]);
147
- index += 1;
148
- }
99
+ const pattern = glob.replace(/\*\*\/|\*\*|\{id\}|\*|[\s\S]/gu, (token) => {
100
+ if (token === "{id}") return nativeSessionId === void 0 ? "[^/]+" : escapeRegExp(nativeSessionId);
101
+ if (token.startsWith("**")) return token === "**/" ? "(?:[^/]+/)*" : ".*";
102
+ return token === "*" ? "[^/]*" : escapeRegExp(token);
103
+ });
149
104
  return new RegExp(`^${pattern}$`, "u");
150
105
  }
151
- /**
152
- * The declared store that holds `pathFromHome` for this session, or
153
- * undefined. A shared store's files belong to every session.
154
- */
106
+ /** The store that holds `pathFromHome`, or undefined. A shared store matches every session. */
155
107
  function sessionStoreForPath(contract, pathFromHome, nativeSessionId) {
156
108
  const path = normalizePosixPath(pathFromHome);
157
109
  for (const store of contract.stores) {