@ponythewhite/base-context 1.0.14 → 1.0.16

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 (90) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/base-context-runtime/pyproject.toml +1 -1
  3. package/dist/base-context-runtime/src/rlm/bash.py +19 -0
  4. package/dist/base-context-runtime/src/rlm/job_watch.py +156 -0
  5. package/dist/base-context-runtime/src/rlm/repl.md +28 -6
  6. package/dist/base-context-runtime/src/rlm/repl.py +6 -1
  7. package/dist/base-context-runtime/test/test_bash.py +4 -4
  8. package/dist/base-context-runtime/test/test_job_watch.py +67 -0
  9. package/dist/base-context-runtime/uv.lock +1 -1
  10. package/dist/build-info.json +1 -1
  11. package/dist/bundle/{bundled-modules-UODO7ZR7.js → bundled-modules-2DMTK7VK.js} +2 -2
  12. package/dist/bundle/{chunk-SX7CAXWU.js → chunk-MSH6QRP5.js} +1730 -867
  13. package/dist/bundle/{chunk-NLRWERWA.js → chunk-T2OK7SRV.js} +53 -21
  14. package/dist/bundle/{cli-main-6GXXIMQQ.js → cli-main-WL2L5IEQ.js} +2 -2
  15. package/dist/bundle/cli.js +1 -1
  16. package/dist/bundle/{main-HF64B4HM.js → main-XPIEIEQJ.js} +2 -2
  17. package/dist/core/agent-session.d.ts +2 -0
  18. package/dist/core/agent-session.d.ts.map +1 -1
  19. package/dist/core/agent-session.js +191 -33
  20. package/dist/core/agent-session.js.map +1 -1
  21. package/dist/core/compaction/compaction.d.ts +1 -1
  22. package/dist/core/compaction/compaction.d.ts.map +1 -1
  23. package/dist/core/compaction/compaction.js +11 -9
  24. package/dist/core/compaction/compaction.js.map +1 -1
  25. package/dist/core/history-index-worker.d.ts.map +1 -1
  26. package/dist/core/history-index-worker.js +22 -1
  27. package/dist/core/history-index-worker.js.map +1 -1
  28. package/dist/core/history-index.d.ts +2 -0
  29. package/dist/core/history-index.d.ts.map +1 -1
  30. package/dist/core/history-index.js.map +1 -1
  31. package/dist/core/inference-coordinator.d.ts.map +1 -1
  32. package/dist/core/inference-coordinator.js +13 -2
  33. package/dist/core/inference-coordinator.js.map +1 -1
  34. package/dist/core/job-watch.d.ts +120 -0
  35. package/dist/core/job-watch.d.ts.map +1 -0
  36. package/dist/core/job-watch.js +648 -0
  37. package/dist/core/job-watch.js.map +1 -0
  38. package/dist/core/kernel/repl-manager.d.ts +5 -1
  39. package/dist/core/kernel/repl-manager.d.ts.map +1 -1
  40. package/dist/core/kernel/repl-manager.js +57 -0
  41. package/dist/core/kernel/repl-manager.js.map +1 -1
  42. package/dist/core/kernel/shared.d.ts +12 -0
  43. package/dist/core/kernel/shared.d.ts.map +1 -1
  44. package/dist/core/kernel/shared.js.map +1 -1
  45. package/dist/core/prompts/rlm.d.ts.map +1 -1
  46. package/dist/core/prompts/rlm.js +49 -39
  47. package/dist/core/prompts/rlm.js.map +1 -1
  48. package/dist/core/session-manager.d.ts +10 -0
  49. package/dist/core/session-manager.d.ts.map +1 -1
  50. package/dist/core/session-manager.js +66 -1
  51. package/dist/core/session-manager.js.map +1 -1
  52. package/dist/core/tools/prime-context.d.ts.map +1 -1
  53. package/dist/core/tools/prime-context.js +1 -1
  54. package/dist/core/tools/prime-context.js.map +1 -1
  55. package/dist/modes/daemon/daemon-mode.d.ts.map +1 -1
  56. package/dist/modes/daemon/daemon-mode.js +17 -17
  57. package/dist/modes/daemon/daemon-mode.js.map +1 -1
  58. package/dist/modes/daemon/daemon-worker-client.d.ts +1 -0
  59. package/dist/modes/daemon/daemon-worker-client.d.ts.map +1 -1
  60. package/dist/modes/daemon/daemon-worker-client.js +8 -0
  61. package/dist/modes/daemon/daemon-worker-client.js.map +1 -1
  62. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  63. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  64. package/dist/modes/interactive/interactive-mode.js +31 -5
  65. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  66. package/dist/skills/agent-message/SKILL.md +8 -2
  67. package/dist/skills/bounded-inspect/SKILL.md +78 -0
  68. package/dist/skills/bounded-inspect/pyproject.toml +16 -0
  69. package/dist/skills/bounded-inspect/src/bounded_inspect/__init__.py +313 -0
  70. package/dist/skills/bounded-inspect/src/bounded_inspect/__main__.py +3 -0
  71. package/dist/skills/job-watch/SKILL.md +43 -0
  72. package/dist/skills/job-watch/pyproject.toml +13 -0
  73. package/dist/skills/job-watch/src/job_watch/__init__.py +61 -0
  74. package/dist/skills/rlm-heartbeat/SKILL.md +10 -6
  75. package/dist/utils/file-lines.d.ts.map +1 -1
  76. package/dist/utils/file-lines.js +6 -2
  77. package/dist/utils/file-lines.js.map +1 -1
  78. package/docs/rlm-runtime.md +4 -1
  79. package/docs/skills.md +18 -26
  80. package/docs/upstream-1.0.15.md +83 -0
  81. package/package.json +4 -4
  82. package/skills/agent-message/SKILL.md +8 -2
  83. package/skills/bounded-inspect/SKILL.md +78 -0
  84. package/skills/bounded-inspect/pyproject.toml +16 -0
  85. package/skills/bounded-inspect/src/bounded_inspect/__init__.py +313 -0
  86. package/skills/bounded-inspect/src/bounded_inspect/__main__.py +3 -0
  87. package/skills/job-watch/SKILL.md +43 -0
  88. package/skills/job-watch/pyproject.toml +13 -0
  89. package/skills/job-watch/src/job_watch/__init__.py +61 -0
  90. package/skills/rlm-heartbeat/SKILL.md +10 -6
@@ -352,7 +352,7 @@ import {
352
352
  watchWithErrorHandler,
353
353
  workerRosterEntryFromSummary,
354
354
  wrapTextWithAnsi
355
- } from "./chunk-SX7CAXWU.js";
355
+ } from "./chunk-MSH6QRP5.js";
356
356
  import {
357
357
  array,
358
358
  boolean,
@@ -17249,6 +17249,7 @@ var DaemonWorkerClient = class {
17249
17249
  await new Promise((resolve26, reject) => {
17250
17250
  const timeout = setTimeout(() => {
17251
17251
  cleanup();
17252
+ this.clearSocketReference(socket);
17252
17253
  socket.destroy();
17253
17254
  reject(new Error(`Timed out connecting to daemon worker socket: ${this.socketPath}`));
17254
17255
  }, timeoutMs);
@@ -17263,6 +17264,7 @@ var DaemonWorkerClient = class {
17263
17264
  };
17264
17265
  const onError = (error) => {
17265
17266
  cleanup();
17267
+ this.clearSocketReference(socket);
17266
17268
  reject(error);
17267
17269
  };
17268
17270
  socket.once("connect", onConnect);
@@ -17476,6 +17478,12 @@ var DaemonWorkerClient = class {
17476
17478
  waiter.reject(error);
17477
17479
  }
17478
17480
  }
17481
+ clearSocketReference(socket) {
17482
+ if (this.socket !== socket)
17483
+ return;
17484
+ this.socket = void 0;
17485
+ this.channel = void 0;
17486
+ }
17479
17487
  notifyClosed(socket, error) {
17480
17488
  if (this.socket !== socket) {
17481
17489
  return;
@@ -50506,13 +50514,16 @@ ${warningLines}`, 0, 0));
50506
50514
  }
50507
50515
  async refreshConnectionCatalog() {
50508
50516
  this.invalidateConnectionModelRefresh();
50517
+ const read = this.captureConnectionStateRead();
50509
50518
  const [state, commands, modelCatalog, resources] = await Promise.all([
50510
50519
  this.agentConnection.getState(),
50511
50520
  this.agentConnection.getCommands().catch(() => []),
50512
50521
  this.agentConnection.getModelCatalog(),
50513
50522
  this.agentConnection.getResourceSnapshot()
50514
50523
  ]);
50515
- this.applyConnectionStateSnapshot(state);
50524
+ if (!this.isConnectionStateReadCurrent(read))
50525
+ return;
50526
+ this.applyConnectionStateSnapshot(state, read);
50516
50527
  this.connectionCommands = commands;
50517
50528
  this.applyConnectionModelCatalog(modelCatalog);
50518
50529
  this.connectionModelsFetchedAt = Date.now();
@@ -50549,7 +50560,21 @@ ${warningLines}`, 0, 0));
50549
50560
  getScopedHeartbeats() {
50550
50561
  return scopeHeartbeatsToSession(this.heartbeatCatalog, this.connectionState, this.subagentSnapshots.values());
50551
50562
  }
50552
- 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
+ }
50553
50578
  this.bindPromptStashSession(state.sessionId);
50554
50579
  this.connectionState = state;
50555
50580
  this.scheduleHeartbeatManagerRefresh();
@@ -53457,9 +53482,10 @@ ${message}`, ["Yes", "No"], opts);
53457
53482
  return `Goal paused (${this.formatGoalElapsed(goal.timeUsedSeconds)})`;
53458
53483
  case "budget_limited":
53459
53484
  return `Goal budget limited (${this.formatGoalElapsed(goal.timeUsedSeconds)})`;
53485
+ case "error":
53486
+ return theme.fg("error", "Goal error") + theme.getFgAnsi("muted");
53460
53487
  case "idle":
53461
53488
  case "complete":
53462
- case "error":
53463
53489
  return void 0;
53464
53490
  default: {
53465
53491
  const _exhaustive = goal.status;
@@ -53800,13 +53826,16 @@ ${message}`, ["Yes", "No"], opts);
53800
53826
  this.ui.requestRender();
53801
53827
  }
53802
53828
  async renderInitialMessages() {
53829
+ const read = this.captureConnectionStateRead();
53803
53830
  const snapshot = await this.agentConnection.getInitialSnapshot();
53831
+ if (!this.isConnectionStateReadCurrent(read))
53832
+ return;
53804
53833
  const context = this.getSessionContextFromConnectionSnapshot(snapshot);
53805
53834
  const state = snapshot.state;
53806
53835
  const streamingMessage = snapshot.streamingMessage;
53807
53836
  this.rlmNodeId = snapshot.parent?.childId;
53808
53837
  this.seedSubagentSummary(snapshot.children);
53809
- this.applyConnectionStateSnapshot(state);
53838
+ this.applyConnectionStateSnapshot(state, read);
53810
53839
  this.restoreTurnStartFromMessages(context.messages);
53811
53840
  await this.renderSessionContext(context, {
53812
53841
  updateFooter: true,
@@ -54563,10 +54592,13 @@ ${message}`, ["Yes", "No"], opts);
54563
54592
  return showFullPaneOverlay(this.ui, component, options);
54564
54593
  }
54565
54594
  async showSettingsSelector() {
54595
+ const read = this.captureConnectionStateRead();
54566
54596
  let state;
54567
54597
  try {
54568
54598
  state = await this.agentConnection.getState();
54569
- this.applyConnectionStateSnapshot(state);
54599
+ if (!this.isConnectionStateReadCurrent(read))
54600
+ return;
54601
+ this.applyConnectionStateSnapshot(state, read);
54570
54602
  } catch (error) {
54571
54603
  this.showError(error instanceof Error ? error.message : String(error));
54572
54604
  return;
@@ -66273,6 +66305,9 @@ Use prime_context read/search with selected lines or a query.`;
66273
66305
  if (!state || !state.clients.has(client)) {
66274
66306
  continue;
66275
66307
  }
66308
+ const streamsSnapshot = client.transport === "private-framed" && daemonClientCapabilitiesForSession(client, activeSessionId).has("chunked_snapshot");
66309
+ const snapshotSignal = streamsSnapshot ? markClientSnapshotStreaming(client, activeSessionId) : void 0;
66310
+ let ownsSnapshot = streamsSnapshot;
66276
66311
  try {
66277
66312
  const result = await this.createAttachResult(client, state, {
66278
66313
  type: "attach",
@@ -66281,7 +66316,7 @@ Use prime_context read/search with selected lines or a query.`;
66281
66316
  if (this.sessions.get(activeSessionId) !== state || !state.clients.has(client)) {
66282
66317
  continue;
66283
66318
  }
66284
- if (client.transport === "private-framed" && daemonClientCapabilitiesForSession(client, activeSessionId).has("chunked_snapshot")) {
66319
+ if (snapshotSignal) {
66285
66320
  if (purpose === "replacement") {
66286
66321
  this.write(client, {
66287
66322
  type: "session_replaced",
@@ -66293,20 +66328,14 @@ Use prime_context read/search with selected lines or a query.`;
66293
66328
  });
66294
66329
  }
66295
66330
  const snapshotId = `${result.activeSessionId}-${result.lastEventCursor?.generation}-${result.lastEventSequence}`;
66296
- const snapshotSignal = markClientSnapshotStreaming(client, activeSessionId);
66297
- let transcript;
66298
- try {
66299
- transcript = createSnapshotTranscriptChunks({
66300
- activeSessionId,
66301
- snapshotId,
66302
- messages: result.snapshot.messages,
66303
- targetChunkBytes: SNAPSHOT_TARGET_CHUNK_BYTES,
66304
- signal: snapshotSignal
66305
- });
66306
- } catch (error) {
66307
- finishClientSnapshotStreaming(client, activeSessionId);
66308
- throw error;
66309
- }
66331
+ const transcript = createSnapshotTranscriptChunks({
66332
+ activeSessionId,
66333
+ snapshotId,
66334
+ messages: result.snapshot.messages,
66335
+ targetChunkBytes: SNAPSHOT_TARGET_CHUNK_BYTES,
66336
+ signal: snapshotSignal
66337
+ });
66338
+ ownsSnapshot = false;
66310
66339
  await this.streamWorkerSnapshot(client, {
66311
66340
  ...result,
66312
66341
  messages: result.messages ? [] : void 0,
@@ -66340,6 +66369,9 @@ Use prime_context read/search with selected lines or a query.`;
66340
66369
  this.log(`could not catch up client ${client.id} for ${activeSessionId}: ${String(error)}`);
66341
66370
  this.scheduleClientCatchupRetry(client);
66342
66371
  return "retry-later";
66372
+ } finally {
66373
+ if (ownsSnapshot)
66374
+ finishClientSnapshotStreaming(client, activeSessionId);
66343
66375
  }
66344
66376
  }
66345
66377
  return "drained";
@@ -5,7 +5,7 @@ import {
5
5
  isOwnedSessionWorkerProcess,
6
6
  maybeRunOwnedSessionWorkerFrontend,
7
7
  maybeStartDaemonEarly
8
- } from "./chunk-SX7CAXWU.js";
8
+ } from "./chunk-MSH6QRP5.js";
9
9
  import {
10
10
  APP_NAME
11
11
  } from "./chunk-IEM74GZ5.js";
@@ -39,7 +39,7 @@ async function runCli() {
39
39
  }
40
40
  const [{ EnvHttpProxyAgent, setGlobalDispatcher }, { main }] = await Promise.all([
41
41
  import("undici"),
42
- import("./main-HF64B4HM.js")
42
+ import("./main-XPIEIEQJ.js")
43
43
  ]);
44
44
  setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 }));
45
45
  try {
@@ -52,6 +52,6 @@ var supported = assertNodeVersion({
52
52
  exit: (code) => process.exit(code)
53
53
  });
54
54
  if (supported) {
55
- const { runCli } = await import("./cli-main-6GXXIMQQ.js");
55
+ const { runCli } = await import("./cli-main-WL2L5IEQ.js");
56
56
  await runCli();
57
57
  }
@@ -17,8 +17,8 @@ import {
17
17
  shouldUseDaemonClientRuntime,
18
18
  shouldUseDaemonInteractive,
19
19
  shouldUseEphemeralSessionManagerForDaemonInteractive
20
- } from "./chunk-NLRWERWA.js";
21
- import "./chunk-SX7CAXWU.js";
20
+ } from "./chunk-T2OK7SRV.js";
21
+ import "./chunk-MSH6QRP5.js";
22
22
  import "./chunk-CFNASUYO.js";
23
23
  import "./chunk-V6LOBH6X.js";
24
24
  import "./chunk-IEM74GZ5.js";
@@ -417,6 +417,7 @@ export declare class AgentSession {
417
417
  private _goalStateRevision;
418
418
  private _goalAccountingStartedAt;
419
419
  private _goalContinuationAwaitsRlmWork;
420
+ private _jobWatchController?;
420
421
  private _goalAccountedAssistantMessages;
421
422
  private _goalAbortInProgress;
422
423
  private _autonomousState;
@@ -1165,6 +1166,7 @@ export declare class AgentSession {
1165
1166
  private _selectNativeSkill;
1166
1167
  /** Read only the server-owned branch captured for this operation (including a batch). */
1167
1168
  recoverNativeHistory(input: NativeRecoveryInput, signal?: AbortSignal, maxBytes?: number): Promise<NativeRecoveryResponse>;
1169
+ private _getJobWatchController;
1168
1170
  private _createKernelHostHandlers;
1169
1171
  reload(): Promise<void>;
1170
1172
  private _rlmKernelEnv;