@ponythewhite/base-context 1.0.13 → 1.0.15

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 (83) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/base-context-runtime/pyproject.toml +1 -1
  3. package/dist/base-context-runtime/uv.lock +1 -1
  4. package/dist/build-info.json +1 -1
  5. package/dist/bundle/amazon-bedrock.js +3 -3
  6. package/dist/bundle/{anthropic-BJVPUMPB.js → anthropic-AXUXEET7.js} +1 -1
  7. package/dist/bundle/{azure-openai-responses-ERRMAXK6.js → azure-openai-responses-J3NTJKEO.js} +2 -2
  8. package/dist/bundle/{bundled-modules-URKVA3UB.js → bundled-modules-O67MEO74.js} +5 -5
  9. package/dist/bundle/{chunk-FOGKLC7V.js → chunk-72LSQYUV.js} +1 -1
  10. package/dist/bundle/{chunk-TXVF6Q5H.js → chunk-DGO66I3L.js} +87 -51
  11. package/dist/bundle/{chunk-MUFZODP5.js → chunk-EGFIZABJ.js} +1 -1
  12. package/dist/bundle/{chunk-AEMRBMI2.js → chunk-IEM74GZ5.js} +9 -9
  13. package/dist/bundle/{chunk-25VYRAC6.js → chunk-JKKXN6JE.js} +72 -0
  14. package/dist/bundle/{chunk-TKOBEJ5E.js → chunk-RQFC34FM.js} +151 -51
  15. package/dist/bundle/{chunk-Q6UAHLII.js → chunk-V6LOBH6X.js} +2 -2
  16. package/dist/bundle/{cli-main-ZTJM5EEH.js → cli-main-2RER6PBE.js} +4 -4
  17. package/dist/bundle/cli.js +1 -1
  18. package/dist/bundle/{google-4GA4YMUX.js → google-QLKV2ZLC.js} +2 -2
  19. package/dist/bundle/{google-vertex-7AMALD7D.js → google-vertex-UGLUZV6B.js} +2 -2
  20. package/dist/bundle/{main-53I74INO.js → main-YERLD3T4.js} +5 -5
  21. package/dist/bundle/{mistral-74BXMNRM.js → mistral-2ITSLHYF.js} +1 -1
  22. package/dist/bundle/{openai-codex-responses-COXNC4IH.js → openai-codex-responses-FRREQXS3.js} +5 -4
  23. package/dist/bundle/{openai-completions-BCSA5Q6S.js → openai-completions-HF6UPPLW.js} +1 -1
  24. package/dist/bundle/{openai-responses-ONCIZSJS.js → openai-responses-LRTMBDFW.js} +2 -2
  25. package/dist/core/agent-session.d.ts.map +1 -1
  26. package/dist/core/agent-session.js +42 -25
  27. package/dist/core/agent-session.js.map +1 -1
  28. package/dist/core/autonomous.d.ts +2 -0
  29. package/dist/core/autonomous.d.ts.map +1 -1
  30. package/dist/core/autonomous.js +4 -0
  31. package/dist/core/autonomous.js.map +1 -1
  32. package/dist/core/canonical-context.d.ts.map +1 -1
  33. package/dist/core/canonical-context.js +7 -0
  34. package/dist/core/canonical-context.js.map +1 -1
  35. package/dist/core/compaction/compaction.d.ts +1 -1
  36. package/dist/core/compaction/compaction.d.ts.map +1 -1
  37. package/dist/core/compaction/compaction.js +11 -9
  38. package/dist/core/compaction/compaction.js.map +1 -1
  39. package/dist/core/inference-coordinator.d.ts.map +1 -1
  40. package/dist/core/inference-coordinator.js +13 -2
  41. package/dist/core/inference-coordinator.js.map +1 -1
  42. package/dist/core/kernel/repl-manager.d.ts.map +1 -1
  43. package/dist/core/kernel/repl-manager.js +5 -0
  44. package/dist/core/kernel/repl-manager.js.map +1 -1
  45. package/dist/core/public-context.d.ts.map +1 -1
  46. package/dist/core/public-context.js +2 -0
  47. package/dist/core/public-context.js.map +1 -1
  48. package/dist/core/session-manager.d.ts +8 -0
  49. package/dist/core/session-manager.d.ts.map +1 -1
  50. package/dist/core/session-manager.js +57 -0
  51. package/dist/core/session-manager.js.map +1 -1
  52. package/dist/core/view-units.d.ts.map +1 -1
  53. package/dist/core/view-units.js +3 -0
  54. package/dist/core/view-units.js.map +1 -1
  55. package/dist/main.d.ts.map +1 -1
  56. package/dist/main.js +1 -1
  57. package/dist/main.js.map +1 -1
  58. package/dist/modes/daemon/daemon-mode.d.ts.map +1 -1
  59. package/dist/modes/daemon/daemon-mode.js +21 -20
  60. package/dist/modes/daemon/daemon-mode.js.map +1 -1
  61. package/dist/modes/daemon/daemon-supervisor.d.ts.map +1 -1
  62. package/dist/modes/daemon/daemon-supervisor.js +11 -5
  63. package/dist/modes/daemon/daemon-supervisor.js.map +1 -1
  64. package/dist/modes/daemon/daemon-worker-client.d.ts +1 -0
  65. package/dist/modes/daemon/daemon-worker-client.d.ts.map +1 -1
  66. package/dist/modes/daemon/daemon-worker-client.js +8 -0
  67. package/dist/modes/daemon/daemon-worker-client.js.map +1 -1
  68. package/dist/modes/daemon/daemon-worker-protocol.d.ts +3 -0
  69. package/dist/modes/daemon/daemon-worker-protocol.d.ts.map +1 -1
  70. package/dist/modes/daemon/daemon-worker-protocol.js +2 -0
  71. package/dist/modes/daemon/daemon-worker-protocol.js.map +1 -1
  72. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  73. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  74. package/dist/modes/interactive/interactive-mode.js +29 -4
  75. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  76. package/dist/modes/print-mode.d.ts.map +1 -1
  77. package/dist/modes/print-mode.js +24 -21
  78. package/dist/modes/print-mode.js.map +1 -1
  79. package/docs/json.md +14 -1
  80. package/docs/long-running-agents.md +23 -2
  81. package/docs/providers.md +17 -0
  82. package/docs/upstream-1.0.15.md +83 -0
  83. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.15] - 2026-09-28
4
+
5
+ - Fixed compaction of long-lived sessions by selecting the active canonical context before source hydration. This covers manual, agent-requested, threshold, and overflow-recovery compaction without increasing source limits.
6
+ - Fixed Codex HTTP retries losing native context acknowledgement after retryable failures. Only an unchanged prepared request can reuse its acknowledged epoch.
7
+ - Changed `/goal stop` and `/goal clear` to acknowledge the goal that was cleared instead of reporting only the resulting idle state.
8
+ - Fixed daemon worker connection retries retaining failed socket and channel references.
9
+ - Handled Python kernel stderr stream errors through the existing kernel error path.
10
+ - Fixed the goal status display being overwritten by delayed state reads and streamed catch-up snapshots.
11
+
12
+ ## [1.0.14] - 2026-09-23
13
+
14
+ - Fixed compaction recovery after failed or interrupted partial tool calls, including resuming affected saved sessions without exposing failed replies to the provider.
15
+ - Fixed autonomous turn, token, and time limits being bypassed by native tool loops. Limits now stop at a completed tool-turn boundary before another request.
16
+ - Fixed JSON print mode returning success for terminal assistant, session-command, or compaction failures. Capped autonomous runs no longer treat unrun quality gates as passed.
17
+ - Documented headless error handling, client-owned versus resident lifetimes, stable session IDs, and goal/autonomous token-budget semantics.
18
+ - Fixed unknown explicit CLI models falling back to a saved model during startup.
19
+ - Fixed daemon sessions using `--session-dir` so custom transcript storage no longer fails RLM family ownership checks.
20
+
3
21
  ## [1.0.13] - 2026-09-21
4
22
 
5
23
  - Changed the default automatic compaction target to 90% of the model context window, retaining required-context headroom, the output reserve, and earlier agent-requested compaction.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "base-context-runtime"
3
- version = "1.0.13"
3
+ version = "1.0.15"
4
4
  description = "Kernel-side runtime shim for Base Context recursion"
5
5
  license = "MIT"
6
6
  license-files = ["LICENSE", "NOTICE"]
@@ -367,7 +367,7 @@ wheels = [
367
367
 
368
368
  [[package]]
369
369
  name = "base-context-runtime"
370
- version = "1.0.13"
370
+ version = "1.0.15"
371
371
  source = { editable = "." }
372
372
  dependencies = [
373
373
  { name = "mcp" },
@@ -1,5 +1,5 @@
1
1
  {
2
- "sourceCommit": "c29f87f196ab576d986a95a2f3dd3feb3fc02a4a",
2
+ "sourceCommit": "7486ffe2bc679a8c54023b1b90962e3e6f111eba",
3
3
  "sourceDirty": false,
4
4
  "buildHost": {
5
5
  "platform": "linux",
@@ -1,14 +1,14 @@
1
1
  import { createRequire as __piBundleCreateRequire } from 'node:module'; const require = __piBundleCreateRequire(import.meta.url);
2
2
  import {
3
3
  writeFileLogEntry
4
- } from "./chunk-Q6UAHLII.js";
5
- import "./chunk-AEMRBMI2.js";
4
+ } from "./chunk-V6LOBH6X.js";
5
+ import "./chunk-IEM74GZ5.js";
6
6
  import "./chunk-5QCJ5DQU.js";
7
7
  import "./chunk-CRBVRZBV.js";
8
8
  import "./chunk-GRJFXLBM.js";
9
9
  import "./chunk-2T7M7VJ4.js";
10
10
  import "./chunk-DGNX7HQ3.js";
11
- import "./chunk-25VYRAC6.js";
11
+ import "./chunk-JKKXN6JE.js";
12
12
  import "./chunk-BAWSWWEU.js";
13
13
 
14
14
  // dist/node/amazon-bedrock.js
@@ -36,7 +36,7 @@ import {
36
36
  streamFailureFromStopReason,
37
37
  streamFailureMessage,
38
38
  truncateRawPayload
39
- } from "./chunk-25VYRAC6.js";
39
+ } from "./chunk-JKKXN6JE.js";
40
40
  import "./chunk-BAWSWWEU.js";
41
41
 
42
42
  // ../../node_modules/@anthropic-ai/sdk/internal/tslib.mjs
@@ -3,7 +3,7 @@ import {
3
3
  convertResponsesMessages,
4
4
  convertResponsesTools,
5
5
  processResponsesStream
6
- } from "./chunk-MUFZODP5.js";
6
+ } from "./chunk-EGFIZABJ.js";
7
7
  import "./chunk-NQB5DCFC.js";
8
8
  import {
9
9
  AzureOpenAI
@@ -25,7 +25,7 @@ import {
25
25
  formatStreamFailureMessage,
26
26
  recordStreamFailure,
27
27
  streamFailureFromStopReason
28
- } from "./chunk-25VYRAC6.js";
28
+ } from "./chunk-JKKXN6JE.js";
29
29
  import "./chunk-BAWSWWEU.js";
30
30
 
31
31
  // ../ai/src/providers/azure-openai-responses.ts
@@ -51,7 +51,7 @@ import {
51
51
  oauth_exports,
52
52
  runPrintMode,
53
53
  runRpcMode
54
- } from "./chunk-TXVF6Q5H.js";
54
+ } from "./chunk-DGO66I3L.js";
55
55
  import {
56
56
  AgentSession,
57
57
  CURRENT_SESSION_VERSION,
@@ -143,15 +143,15 @@ import {
143
143
  withFileMutationQueue,
144
144
  wrapRegisteredTool,
145
145
  wrapRegisteredTools
146
- } from "./chunk-TKOBEJ5E.js";
146
+ } from "./chunk-RQFC34FM.js";
147
147
  import "./chunk-CFNASUYO.js";
148
- import "./chunk-Q6UAHLII.js";
148
+ import "./chunk-V6LOBH6X.js";
149
149
  import {
150
150
  VERSION,
151
151
  build_exports,
152
152
  getAgentDir,
153
153
  src_exports
154
- } from "./chunk-AEMRBMI2.js";
154
+ } from "./chunk-IEM74GZ5.js";
155
155
  import "./chunk-5QCJ5DQU.js";
156
156
  import {
157
157
  compile_exports,
@@ -162,7 +162,7 @@ import "./chunk-2T7M7VJ4.js";
162
162
  import "./chunk-UIRUOAIQ.js";
163
163
  import "./chunk-HXOBFFJX.js";
164
164
  import "./chunk-DGNX7HQ3.js";
165
- import "./chunk-25VYRAC6.js";
165
+ import "./chunk-JKKXN6JE.js";
166
166
  import {
167
167
  __export
168
168
  } from "./chunk-BAWSWWEU.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-4GXPNXOJ.js";
6
6
  import {
7
7
  require_base64_js
8
- } from "./chunk-25VYRAC6.js";
8
+ } from "./chunk-JKKXN6JE.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __require,
@@ -41,6 +41,7 @@ import {
41
41
  DAEMON_WORKER_INSTANCE_ID_ENV,
42
42
  DAEMON_WORKER_PEER_TRANSPORT_CAPABILITY,
43
43
  DAEMON_WORKER_RECOVERY_JOURNAL_ENV,
44
+ DAEMON_WORKER_RLM_LEDGER_SESSION_DIR_ENV,
44
45
  DAEMON_WORKER_ROLE_ENV,
45
46
  DAEMON_WORKER_ROSTER_CAPABILITY,
46
47
  DAEMON_WORKER_STARTUP_GATE_COMMIT,
@@ -351,7 +352,7 @@ import {
351
352
  watchWithErrorHandler,
352
353
  workerRosterEntryFromSummary,
353
354
  wrapTextWithAnsi
354
- } from "./chunk-TKOBEJ5E.js";
355
+ } from "./chunk-RQFC34FM.js";
355
356
  import {
356
357
  array,
357
358
  boolean,
@@ -370,7 +371,7 @@ import {
370
371
  import {
371
372
  installFileLogSink,
372
373
  setLogContext
373
- } from "./chunk-Q6UAHLII.js";
374
+ } from "./chunk-V6LOBH6X.js";
374
375
  import {
375
376
  APP_NAME,
376
377
  APP_TITLE,
@@ -416,7 +417,7 @@ import {
416
417
  shouldUseWindowsShell,
417
418
  signalProcessGroupOrProcess,
418
419
  typebox_exports
419
- } from "./chunk-AEMRBMI2.js";
420
+ } from "./chunk-IEM74GZ5.js";
420
421
  import {
421
422
  PRODUCT,
422
423
  PRODUCT_ENV
@@ -438,7 +439,7 @@ import {
438
439
  getProviders,
439
440
  modelsAreEqual,
440
441
  supportsFastMode
441
- } from "./chunk-25VYRAC6.js";
442
+ } from "./chunk-JKKXN6JE.js";
442
443
  import {
443
444
  __commonJS,
444
445
  __export,
@@ -17248,6 +17249,7 @@ var DaemonWorkerClient = class {
17248
17249
  await new Promise((resolve26, reject) => {
17249
17250
  const timeout = setTimeout(() => {
17250
17251
  cleanup();
17252
+ this.clearSocketReference(socket);
17251
17253
  socket.destroy();
17252
17254
  reject(new Error(`Timed out connecting to daemon worker socket: ${this.socketPath}`));
17253
17255
  }, timeoutMs);
@@ -17262,6 +17264,7 @@ var DaemonWorkerClient = class {
17262
17264
  };
17263
17265
  const onError = (error) => {
17264
17266
  cleanup();
17267
+ this.clearSocketReference(socket);
17265
17268
  reject(error);
17266
17269
  };
17267
17270
  socket.once("connect", onConnect);
@@ -17475,6 +17478,12 @@ var DaemonWorkerClient = class {
17475
17478
  waiter.reject(error);
17476
17479
  }
17477
17480
  }
17481
+ clearSocketReference(socket) {
17482
+ if (this.socket !== socket)
17483
+ return;
17484
+ this.socket = void 0;
17485
+ this.channel = void 0;
17486
+ }
17478
17487
  notifyClosed(socket, error) {
17479
17488
  if (this.socket !== socket) {
17480
17489
  return;
@@ -50505,13 +50514,16 @@ ${warningLines}`, 0, 0));
50505
50514
  }
50506
50515
  async refreshConnectionCatalog() {
50507
50516
  this.invalidateConnectionModelRefresh();
50517
+ const read = this.captureConnectionStateRead();
50508
50518
  const [state, commands, modelCatalog, resources] = await Promise.all([
50509
50519
  this.agentConnection.getState(),
50510
50520
  this.agentConnection.getCommands().catch(() => []),
50511
50521
  this.agentConnection.getModelCatalog(),
50512
50522
  this.agentConnection.getResourceSnapshot()
50513
50523
  ]);
50514
- this.applyConnectionStateSnapshot(state);
50524
+ if (!this.isConnectionStateReadCurrent(read))
50525
+ return;
50526
+ this.applyConnectionStateSnapshot(state, read);
50515
50527
  this.connectionCommands = commands;
50516
50528
  this.applyConnectionModelCatalog(modelCatalog);
50517
50529
  this.connectionModelsFetchedAt = Date.now();
@@ -50548,7 +50560,21 @@ ${warningLines}`, 0, 0));
50548
50560
  getScopedHeartbeats() {
50549
50561
  return scopeHeartbeatsToSession(this.heartbeatCatalog, this.connectionState, this.subagentSnapshots.values());
50550
50562
  }
50551
- applyConnectionStateSnapshot(state) {
50563
+ captureConnectionStateRead() {
50564
+ return {
50565
+ connection: this.agentConnection,
50566
+ generation: this.sessionEventGeneration,
50567
+ goal: this.connectionState?.goal
50568
+ };
50569
+ }
50570
+ isConnectionStateReadCurrent(read) {
50571
+ return read.connection === this.agentConnection && read.generation === this.sessionEventGeneration;
50572
+ }
50573
+ applyConnectionStateSnapshot(state, read) {
50574
+ const current = this.connectionState;
50575
+ if (read && current?.sessionId === state.sessionId && current.goal !== read.goal) {
50576
+ state = { ...state, goal: current.goal };
50577
+ }
50552
50578
  this.bindPromptStashSession(state.sessionId);
50553
50579
  this.connectionState = state;
50554
50580
  this.scheduleHeartbeatManagerRefresh();
@@ -53799,13 +53825,16 @@ ${message}`, ["Yes", "No"], opts);
53799
53825
  this.ui.requestRender();
53800
53826
  }
53801
53827
  async renderInitialMessages() {
53828
+ const read = this.captureConnectionStateRead();
53802
53829
  const snapshot = await this.agentConnection.getInitialSnapshot();
53830
+ if (!this.isConnectionStateReadCurrent(read))
53831
+ return;
53803
53832
  const context = this.getSessionContextFromConnectionSnapshot(snapshot);
53804
53833
  const state = snapshot.state;
53805
53834
  const streamingMessage = snapshot.streamingMessage;
53806
53835
  this.rlmNodeId = snapshot.parent?.childId;
53807
53836
  this.seedSubagentSummary(snapshot.children);
53808
- this.applyConnectionStateSnapshot(state);
53837
+ this.applyConnectionStateSnapshot(state, read);
53809
53838
  this.restoreTurnStartFromMessages(context.messages);
53810
53839
  await this.renderSessionContext(context, {
53811
53840
  updateFooter: true,
@@ -54562,10 +54591,13 @@ ${message}`, ["Yes", "No"], opts);
54562
54591
  return showFullPaneOverlay(this.ui, component, options);
54563
54592
  }
54564
54593
  async showSettingsSelector() {
54594
+ const read = this.captureConnectionStateRead();
54565
54595
  let state;
54566
54596
  try {
54567
54597
  state = await this.agentConnection.getState();
54568
- this.applyConnectionStateSnapshot(state);
54598
+ if (!this.isConnectionStateReadCurrent(read))
54599
+ return;
54600
+ this.applyConnectionStateSnapshot(state, read);
54569
54601
  } catch (error) {
54570
54602
  this.showError(error instanceof Error ? error.message : String(error));
54571
54603
  return;
@@ -61120,7 +61152,8 @@ var AgentDaemon = class {
61120
61152
  }
61121
61153
  /** Root sessions dir that keys this daemon's spawn ledger. */
61122
61154
  rlmLedgerSessionsDir() {
61123
- return this.options.defaultSessionConfig.sessionDir ?? getSessionsDir(this.agentDir);
61155
+ const assigned = this.options.worker ? process.env[DAEMON_WORKER_RLM_LEDGER_SESSION_DIR_ENV] : void 0;
61156
+ return assigned ?? this.options.defaultSessionConfig.sessionDir ?? getSessionsDir(this.agentDir);
61124
61157
  }
61125
61158
  async openRlmJournalOwner() {
61126
61159
  if (this.options.worker)
@@ -63563,7 +63596,7 @@ var AgentDaemon = class {
63563
63596
  cwd,
63564
63597
  sessionDir,
63565
63598
  agentDir: this.agentDir,
63566
- ledgerSessionDir: sessionDir ?? this.rlmLedgerSessionsDir(),
63599
+ ledgerSessionDir: this.rlmLedgerSessionsDir(),
63567
63600
  scope: command.scope
63568
63601
  }, pageQuery);
63569
63602
  return success(command.id, "list_saved_sessions", page);
@@ -66271,6 +66304,9 @@ Use prime_context read/search with selected lines or a query.`;
66271
66304
  if (!state || !state.clients.has(client)) {
66272
66305
  continue;
66273
66306
  }
66307
+ const streamsSnapshot = client.transport === "private-framed" && daemonClientCapabilitiesForSession(client, activeSessionId).has("chunked_snapshot");
66308
+ const snapshotSignal = streamsSnapshot ? markClientSnapshotStreaming(client, activeSessionId) : void 0;
66309
+ let ownsSnapshot = streamsSnapshot;
66274
66310
  try {
66275
66311
  const result = await this.createAttachResult(client, state, {
66276
66312
  type: "attach",
@@ -66279,7 +66315,7 @@ Use prime_context read/search with selected lines or a query.`;
66279
66315
  if (this.sessions.get(activeSessionId) !== state || !state.clients.has(client)) {
66280
66316
  continue;
66281
66317
  }
66282
- if (client.transport === "private-framed" && daemonClientCapabilitiesForSession(client, activeSessionId).has("chunked_snapshot")) {
66318
+ if (snapshotSignal) {
66283
66319
  if (purpose === "replacement") {
66284
66320
  this.write(client, {
66285
66321
  type: "session_replaced",
@@ -66291,20 +66327,14 @@ Use prime_context read/search with selected lines or a query.`;
66291
66327
  });
66292
66328
  }
66293
66329
  const snapshotId = `${result.activeSessionId}-${result.lastEventCursor?.generation}-${result.lastEventSequence}`;
66294
- const snapshotSignal = markClientSnapshotStreaming(client, activeSessionId);
66295
- let transcript;
66296
- try {
66297
- transcript = createSnapshotTranscriptChunks({
66298
- activeSessionId,
66299
- snapshotId,
66300
- messages: result.snapshot.messages,
66301
- targetChunkBytes: SNAPSHOT_TARGET_CHUNK_BYTES,
66302
- signal: snapshotSignal
66303
- });
66304
- } catch (error) {
66305
- finishClientSnapshotStreaming(client, activeSessionId);
66306
- throw error;
66307
- }
66330
+ const transcript = createSnapshotTranscriptChunks({
66331
+ activeSessionId,
66332
+ snapshotId,
66333
+ messages: result.snapshot.messages,
66334
+ targetChunkBytes: SNAPSHOT_TARGET_CHUNK_BYTES,
66335
+ signal: snapshotSignal
66336
+ });
66337
+ ownsSnapshot = false;
66308
66338
  await this.streamWorkerSnapshot(client, {
66309
66339
  ...result,
66310
66340
  messages: result.messages ? [] : void 0,
@@ -66338,6 +66368,9 @@ Use prime_context read/search with selected lines or a query.`;
66338
66368
  this.log(`could not catch up client ${client.id} for ${activeSessionId}: ${String(error)}`);
66339
66369
  this.scheduleClientCatchupRetry(client);
66340
66370
  return "retry-later";
66371
+ } finally {
66372
+ if (ownsSnapshot)
66373
+ finishClientSnapshotStreaming(client, activeSessionId);
66341
66374
  }
66342
66375
  }
66343
66376
  return "drained";
@@ -67103,7 +67136,7 @@ function isDaemonWorkerDescriptor(value, socketPath) {
67103
67136
  return false;
67104
67137
  }
67105
67138
  const descriptor = value;
67106
- return (descriptor.version === 1 || descriptor.version === 2) && typeof descriptor.supervisorSocketPath === "string" && normalizeSocketPath(descriptor.supervisorSocketPath) === socketPath && typeof descriptor.workerId === "string" && Number.isInteger(descriptor.pid) && (descriptor.pid ?? 0) > 0 && (descriptor.processStartId === void 0 || typeof descriptor.processStartId === "string") && (descriptor.ownerClientId === void 0 || typeof descriptor.ownerClientId === "string") && typeof descriptor.socketPath === "string" && typeof descriptor.authenticationToken === "string" && (descriptor.workerInstanceId === void 0 || typeof descriptor.workerInstanceId === "string") && typeof descriptor.rootActiveSessionId === "string" && typeof descriptor.createdAt === "string" && typeof descriptor.updatedAt === "string" && Number.isInteger(descriptor.consecutiveFailures) && descriptor.createCommand !== void 0 && typeof descriptor.createCommand === "object" && descriptor.createCommand.type === "create";
67139
+ return (descriptor.version === 1 || descriptor.version === 2) && typeof descriptor.supervisorSocketPath === "string" && normalizeSocketPath(descriptor.supervisorSocketPath) === socketPath && typeof descriptor.workerId === "string" && Number.isInteger(descriptor.pid) && (descriptor.pid ?? 0) > 0 && (descriptor.processStartId === void 0 || typeof descriptor.processStartId === "string") && (descriptor.ownerClientId === void 0 || typeof descriptor.ownerClientId === "string") && (descriptor.rlmLedgerSessionDir === void 0 || typeof descriptor.rlmLedgerSessionDir === "string") && typeof descriptor.socketPath === "string" && typeof descriptor.authenticationToken === "string" && (descriptor.workerInstanceId === void 0 || typeof descriptor.workerInstanceId === "string") && typeof descriptor.rootActiveSessionId === "string" && typeof descriptor.createdAt === "string" && typeof descriptor.updatedAt === "string" && Number.isInteger(descriptor.consecutiveFailures) && descriptor.createCommand !== void 0 && typeof descriptor.createCommand === "object" && descriptor.createCommand.type === "create";
67107
67140
  }
67108
67141
  var PreRosterWorkerError = class extends Error {
67109
67142
  };
@@ -68353,7 +68386,7 @@ var DaemonSupervisor = class {
68353
68386
  }
68354
68387
  const owner = this.rlmCapacityOwner(worker);
68355
68388
  const journal = this.assertRlmJournalAdmission();
68356
- const scope = this.rlmJournalScope(worker.descriptor.sessionDir ?? this.defaultSessionConfig.sessionDir);
68389
+ const scope = this.rlmJournalScope(worker.descriptor.rlmLedgerSessionDir ?? worker.descriptor.sessionDir ?? this.defaultSessionConfig.sessionDir);
68357
68390
  if (canonicalSessionPath(scope.journalPath) !== journal.ledgerPath) {
68358
68391
  throw new Error("Worker RLM family is not owned by this supervisor");
68359
68392
  }
@@ -68465,7 +68498,7 @@ var DaemonSupervisor = class {
68465
68498
  throw new Error("Worker authentication failed for RLM ledger mutation");
68466
68499
  }
68467
68500
  const owner = this.assertRlmJournalAdmission();
68468
- const scope = this.rlmJournalScope(worker.descriptor.sessionDir ?? this.defaultSessionConfig.sessionDir);
68501
+ const scope = this.rlmJournalScope(worker.descriptor.rlmLedgerSessionDir ?? worker.descriptor.sessionDir ?? this.defaultSessionConfig.sessionDir);
68469
68502
  if (canonicalSessionPath(scope.journalPath) !== owner.ledgerPath) {
68470
68503
  throw new Error("Worker RLM ledger family is not owned by this supervisor");
68471
68504
  }
@@ -69209,12 +69242,12 @@ var DaemonSupervisor = class {
69209
69242
  if ("activeSessionId" in command) {
69210
69243
  const match2 = await this.findWorkerForClient(client, command.activeSessionId);
69211
69244
  cwd = match2.summary.cwd;
69212
- sessionDir = this.defaultSessionConfig.sessionDir;
69245
+ sessionDir = match2.worker.descriptor.sessionDir ?? this.defaultSessionConfig.sessionDir;
69213
69246
  } else {
69214
69247
  cwd = resolve24(command.cwd);
69215
69248
  sessionDir = command.sessionDir;
69216
69249
  }
69217
- const { agentDir, sessionsDir: ledgerSessionDir } = this.rlmJournalScope(sessionDir);
69250
+ const { agentDir, sessionsDir: ledgerSessionDir } = this.rlmJournalScope();
69218
69251
  const page = await this.catalog.list(cwd, sessionDir, { page: pageQuery, scope, agentDir, ledgerSessionDir });
69219
69252
  return success(command.id, "list_saved_sessions", page);
69220
69253
  }
@@ -69429,6 +69462,7 @@ var DaemonSupervisor = class {
69429
69462
  const recoveryJournalPath = existing?.descriptor.recoveryJournalPath ?? join31(this.descriptorDir, `${workerId}.recovery.jsonl`);
69430
69463
  const orphanProcessJournalPath = existing?.descriptor.orphanProcessJournalPath ?? join31(this.descriptorDir, `${workerId}.orphans.jsonl`);
69431
69464
  const launch = createCliSubprocessLaunchSpec(["--mode", "daemon", "--daemon-socket", socketPath]);
69465
+ const rlmLedgerSessionDir = this.rlmJournalScope().sessionsDir;
69432
69466
  const workerEnvironment = createCliSubprocessEnv({
69433
69467
  ...process.env,
69434
69468
  ...launchEnv,
@@ -69437,6 +69471,7 @@ var DaemonSupervisor = class {
69437
69471
  [DAEMON_WORKER_INSTANCE_ID_ENV]: workerInstanceId,
69438
69472
  [DAEMON_WORKER_ACTIVE_SESSION_ID_ENV]: rootActiveSessionId,
69439
69473
  [DAEMON_WORKER_SUPERVISOR_SOCKET_ENV]: this.socketPath,
69474
+ [DAEMON_WORKER_RLM_LEDGER_SESSION_DIR_ENV]: rlmLedgerSessionDir,
69440
69475
  [DAEMON_WORKER_RECOVERY_JOURNAL_ENV]: recoveryJournalPath,
69441
69476
  [DAEMON_WORKER_STARTUP_GATE_FD_ENV]: String(WORKER_STARTUP_GATE_FD),
69442
69477
  [ORPHAN_PROCESS_JOURNAL_ENV]: orphanProcessJournalPath,
@@ -69504,6 +69539,7 @@ var DaemonSupervisor = class {
69504
69539
  rootActiveSessionId,
69505
69540
  ownerClientId: existing?.descriptor.ownerClientId ?? ownerClientId,
69506
69541
  sessionDir: createCommand.config?.sessionDir,
69542
+ rlmLedgerSessionDir,
69507
69543
  createdAt: existing?.descriptor.createdAt ?? now,
69508
69544
  updatedAt: now,
69509
69545
  lifecycle: "starting",
@@ -72770,38 +72806,38 @@ async function runPrintModeWithConnectionInternal(connection, options, bindHeadl
72770
72806
  await connection.promptAndWait(message);
72771
72807
  }
72772
72808
  const autonomousStatus = await connection.waitForHeadlessCompletion();
72773
- if (mode === "text") {
72774
- const { primary, compactionOutcomes } = selectHeadlessTerminalResult(await connection.getMessages());
72775
- if (primary?.role === "assistant") {
72776
- if (primary.stopReason === "error" || primary.stopReason === "aborted") {
72777
- console.error(primary.errorMessage || `Request ${primary.stopReason}`);
72778
- exitCode = 1;
72779
- } else {
72780
- for (const content of primary.content) {
72781
- if (content.type === "text") {
72782
- writeRawStdout(`${content.text}
72809
+ const { primary, compactionOutcomes } = selectHeadlessTerminalResult(await connection.getMessages());
72810
+ if (primary?.role === "assistant") {
72811
+ if (primary.stopReason === "error" || primary.stopReason === "aborted") {
72812
+ console.error(primary.errorMessage || `Request ${primary.stopReason}`);
72813
+ exitCode = 1;
72814
+ } else if (mode === "text") {
72815
+ for (const content of primary.content) {
72816
+ if (content.type === "text") {
72817
+ writeRawStdout(`${content.text}
72783
72818
  `);
72784
- }
72785
72819
  }
72786
72820
  }
72787
- } else if (primary) {
72821
+ }
72822
+ } else if (primary) {
72823
+ if (mode === "text")
72788
72824
  writeRawStdout(`${primary.content}
72789
72825
  `);
72790
- if (!primary.details.success || primary.details.severity === "error")
72791
- exitCode = 1;
72792
- }
72793
- for (const outcome of compactionOutcomes) {
72826
+ if (!primary.details.success || primary.details.severity === "error")
72827
+ exitCode = 1;
72828
+ }
72829
+ for (const outcome of compactionOutcomes) {
72830
+ if (mode === "text" || outcome.details.outcome === "failed")
72794
72831
  console.error(outcome.content);
72795
- if (outcome.details.outcome === "failed")
72796
- exitCode = 1;
72797
- }
72832
+ if (outcome.details.outcome === "failed")
72833
+ exitCode = 1;
72798
72834
  }
72799
72835
  const autonomousLimit = autonomousLimitReason(autonomousStatus);
72800
72836
  if (autonomousStatus.enabled && autonomousStatus.gates.commands.length > 0 && autonomousStatus.lastGateFailure) {
72801
72837
  const limitText = autonomousLimit ? `; autonomous limit reached: ${describeAutonomousLimit(autonomousStatus, autonomousLimit)}` : "";
72802
72838
  console.error(`Autonomous quality gate still failing after attempt ${latestAutonomousGateAttempt(autonomousStatus)}/${autonomousStatus.gates.maxRetries}: ${autonomousStatus.lastGateFailure.exitText}${limitText}`);
72803
72839
  exitCode = 1;
72804
- } else if (autonomousStatus.enabled && autonomousStatus.gates.commands.length === 0 && autonomousLimit) {
72840
+ } else if (autonomousStatus.enabled && autonomousLimit && (autonomousStatus.gates.commands.length === 0 || autonomousStatus.gates.commands.some((command) => autonomousStatus.gateAttempts[command] !== 0))) {
72805
72841
  console.error(`Autonomous run stopped before terminal evidence; ${describeAutonomousLimit(autonomousStatus, autonomousLimit)}`);
72806
72842
  exitCode = 1;
72807
72843
  }
@@ -74208,7 +74244,7 @@ function buildSessionOptions(config, scopedModels, hasExistingSession, modelRegi
74208
74244
  diagnostics.push({ type: "warning", message: resolved.warning });
74209
74245
  }
74210
74246
  if (resolved.error) {
74211
- diagnostics.push({ type: "error", message: resolved.error });
74247
+ throw new Error(resolved.error);
74212
74248
  }
74213
74249
  if (resolved.model) {
74214
74250
  options.model = resolved.model;
@@ -14,7 +14,7 @@ import {
14
14
  calculateCost,
15
15
  classifyStreamFailure,
16
16
  withRequestBody
17
- } from "./chunk-25VYRAC6.js";
17
+ } from "./chunk-JKKXN6JE.js";
18
18
 
19
19
  // ../ai/src/providers/openai-responses-shared.ts
20
20
  function encodeTextSignatureV1(id, phase) {
@@ -337,7 +337,7 @@ import {
337
337
  supportsFastMode,
338
338
  truncateRawPayload,
339
339
  withRequestBody
340
- } from "./chunk-25VYRAC6.js";
340
+ } from "./chunk-JKKXN6JE.js";
341
341
  import {
342
342
  __export
343
343
  } from "./chunk-BAWSWWEU.js";
@@ -1948,7 +1948,7 @@ function createLazySimpleStream(loadModule) {
1948
1948
  };
1949
1949
  }
1950
1950
  function loadAnthropicProviderModule() {
1951
- anthropicProviderModulePromise ||= import("./anthropic-BJVPUMPB.js").then((module) => {
1951
+ anthropicProviderModulePromise ||= import("./anthropic-AXUXEET7.js").then((module) => {
1952
1952
  const provider = module;
1953
1953
  return {
1954
1954
  stream: provider.streamAnthropic,
@@ -1958,7 +1958,7 @@ function loadAnthropicProviderModule() {
1958
1958
  return anthropicProviderModulePromise;
1959
1959
  }
1960
1960
  function loadAzureOpenAIResponsesProviderModule() {
1961
- azureOpenAIResponsesProviderModulePromise ||= import("./azure-openai-responses-ERRMAXK6.js").then((module) => {
1961
+ azureOpenAIResponsesProviderModulePromise ||= import("./azure-openai-responses-J3NTJKEO.js").then((module) => {
1962
1962
  const provider = module;
1963
1963
  return {
1964
1964
  stream: provider.streamAzureOpenAIResponses,
@@ -1968,7 +1968,7 @@ function loadAzureOpenAIResponsesProviderModule() {
1968
1968
  return azureOpenAIResponsesProviderModulePromise;
1969
1969
  }
1970
1970
  function loadGoogleProviderModule() {
1971
- googleProviderModulePromise ||= import("./google-4GA4YMUX.js").then((module) => {
1971
+ googleProviderModulePromise ||= import("./google-QLKV2ZLC.js").then((module) => {
1972
1972
  const provider = module;
1973
1973
  return {
1974
1974
  stream: provider.streamGoogle,
@@ -1978,7 +1978,7 @@ function loadGoogleProviderModule() {
1978
1978
  return googleProviderModulePromise;
1979
1979
  }
1980
1980
  function loadGoogleVertexProviderModule() {
1981
- googleVertexProviderModulePromise ||= import("./google-vertex-7AMALD7D.js").then((module) => {
1981
+ googleVertexProviderModulePromise ||= import("./google-vertex-UGLUZV6B.js").then((module) => {
1982
1982
  const provider = module;
1983
1983
  return {
1984
1984
  stream: provider.streamGoogleVertex,
@@ -1988,7 +1988,7 @@ function loadGoogleVertexProviderModule() {
1988
1988
  return googleVertexProviderModulePromise;
1989
1989
  }
1990
1990
  function loadMistralProviderModule() {
1991
- mistralProviderModulePromise ||= import("./mistral-74BXMNRM.js").then((module) => {
1991
+ mistralProviderModulePromise ||= import("./mistral-2ITSLHYF.js").then((module) => {
1992
1992
  const provider = module;
1993
1993
  return {
1994
1994
  stream: provider.streamMistral,
@@ -1998,7 +1998,7 @@ function loadMistralProviderModule() {
1998
1998
  return mistralProviderModulePromise;
1999
1999
  }
2000
2000
  function loadOpenAICodexResponsesProviderModule() {
2001
- openAICodexResponsesProviderModulePromise ||= import("./openai-codex-responses-COXNC4IH.js").then((module) => {
2001
+ openAICodexResponsesProviderModulePromise ||= import("./openai-codex-responses-FRREQXS3.js").then((module) => {
2002
2002
  const provider = module;
2003
2003
  return {
2004
2004
  stream: provider.streamOpenAICodexResponses,
@@ -2008,7 +2008,7 @@ function loadOpenAICodexResponsesProviderModule() {
2008
2008
  return openAICodexResponsesProviderModulePromise;
2009
2009
  }
2010
2010
  function loadOpenAICompletionsProviderModule() {
2011
- openAICompletionsProviderModulePromise ||= import("./openai-completions-BCSA5Q6S.js").then((module) => {
2011
+ openAICompletionsProviderModulePromise ||= import("./openai-completions-HF6UPPLW.js").then((module) => {
2012
2012
  const provider = module;
2013
2013
  return {
2014
2014
  stream: provider.streamOpenAICompletions,
@@ -2018,7 +2018,7 @@ function loadOpenAICompletionsProviderModule() {
2018
2018
  return openAICompletionsProviderModulePromise;
2019
2019
  }
2020
2020
  function loadOpenAIResponsesProviderModule() {
2021
- openAIResponsesProviderModulePromise ||= import("./openai-responses-ONCIZSJS.js").then((module) => {
2021
+ openAIResponsesProviderModulePromise ||= import("./openai-responses-LRTMBDFW.js").then((module) => {
2022
2022
  const provider = module;
2023
2023
  return {
2024
2024
  stream: provider.streamOpenAIResponses,