@standardagents/code 0.13.6 → 0.13.7

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/README.md CHANGED
@@ -181,9 +181,13 @@ remembered per endpoint, but this override does not change the saved default end
181
181
  ## Tests
182
182
 
183
183
  ```bash
184
- pnpm test # typecheck + MCP client/protocol + install actuator (no backend needed)
184
+ pnpm test # version lockstep + typecheck + every declared no-backend test
185
185
  ```
186
186
 
187
+ `scripts/run-tests.mjs` owns the explicit no-backend test manifest, prints each
188
+ file as it runs, and fails when a new `scripts/*-test.ts` file is not classified.
189
+ Run an individual file with `pnpm exec tsx scripts/<name>-test.ts`.
190
+
187
191
  ---
188
192
 
189
193
  ## Architecture & contributing
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import readline3 from 'readline/promises';
5
5
  import { stdout, stdin } from 'process';
6
6
  import * as api_star from '@standardagents/code-network/api';
7
7
  import * as stream_star from '@standardagents/code-network/stream';
8
+ import * as snapshot_epoch_star from '@standardagents/code-network/snapshot-epoch';
8
9
  import * as hub_star from '@standardagents/code-network/hub';
9
10
  import * as subagent_streams_star from '@standardagents/code-network/subagent-streams';
10
11
  import * as session_state_star from '@standardagents/code-network/session-state';
@@ -71,6 +72,10 @@ var themeGray = isLightTheme ? "\x1B[38;5;244m" : "\x1B[90m";
71
72
  var stream_exports = {};
72
73
  __reExport(stream_exports, stream_star);
73
74
 
75
+ // src/snapshot-epoch.ts
76
+ var snapshot_epoch_exports = {};
77
+ __reExport(snapshot_epoch_exports, snapshot_epoch_star);
78
+
74
79
  // src/hub.ts
75
80
  var hub_exports = {};
76
81
  __reExport(hub_exports, hub_star);
@@ -3948,7 +3953,7 @@ function readVersion() {
3948
3953
  if (typeof pkg.version === "string" && pkg.version) return pkg.version;
3949
3954
  } catch {
3950
3955
  }
3951
- return "0.13.6" ;
3956
+ return "0.13.7" ;
3952
3957
  }
3953
3958
  function isLocalHost(host) {
3954
3959
  return host === "localhost" || host === "127.0.0.1" || host === "::1" || host.endsWith(".local") || host.endsWith(".localhost") || /^10\./.test(host) || /^192\.168\./.test(host) || /^172\.(1[6-9]|2\d|3[01])\./.test(host);
@@ -8446,10 +8451,14 @@ async function runInteractive(tui, api, accountStream, threadId, projectDir, mac
8446
8451
  let reconcileSharedMessaging = async () => {
8447
8452
  };
8448
8453
  let applySharedMessagingEvent = () => false;
8449
- let refreshSessionProjection = async () => {
8450
- };
8451
8454
  let scheduleProjectionRefresh = () => {
8452
8455
  };
8456
+ let connectionEpoch = 0;
8457
+ let projectionSnapshot = null;
8458
+ const sharedMessagingSnapshot = new snapshot_epoch_exports.EpochSnapshot(
8459
+ () => reconcileSharedMessaging(true),
8460
+ () => connectionEpoch
8461
+ );
8453
8462
  const shownIds = /* @__PURE__ */ new Set();
8454
8463
  const toolActivity = new ToolActivityFeed();
8455
8464
  const pendingSent = /* @__PURE__ */ new Map();
@@ -8467,9 +8476,10 @@ async function runInteractive(tui, api, accountStream, threadId, projectDir, mac
8467
8476
  tui.setStep(label, liveOut);
8468
8477
  };
8469
8478
  const stream = new stream_exports.MessageStream(api, threadId, {
8470
- onOpen: () => {
8471
- void reconcileSharedMessaging(true);
8472
- void refreshSessionProjection();
8479
+ onOpen: (epoch) => {
8480
+ connectionEpoch = epoch;
8481
+ void sharedMessagingSnapshot.reconcile(epoch);
8482
+ void projectionSnapshot?.reconcile(epoch);
8473
8483
  },
8474
8484
  // Live streaming preview: answer text and (opt-in) internal reasoning feed
8475
8485
  // the TUI's ephemeral preview; the committed message still renders from
@@ -8502,7 +8512,7 @@ async function runInteractive(tui, api, accountStream, threadId, projectDir, mac
8502
8512
  void relayApprovals().catch(() => {
8503
8513
  });
8504
8514
  } else if (eventType === shared_messaging_exports.SHARED_MESSAGING_EVENT) {
8505
- if (!applySharedMessagingEvent(data)) void reconcileSharedMessaging(true);
8515
+ if (!applySharedMessagingEvent(data)) void sharedMessagingSnapshot.refresh();
8506
8516
  }
8507
8517
  },
8508
8518
  // A failed turn whose message is the lease service's at-limit denial → offer
@@ -8676,7 +8686,7 @@ async function runInteractive(tui, api, accountStream, threadId, projectDir, mac
8676
8686
  applySharedMessaging({ version: 1, pending: sharedMessaging.pending, draft: event.draft }, true);
8677
8687
  return true;
8678
8688
  };
8679
- const onTerminalResume = () => void reconcileSharedMessaging(true);
8689
+ const onTerminalResume = () => void sharedMessagingSnapshot.refresh();
8680
8690
  process.on("SIGCONT", onTerminalResume);
8681
8691
  const applySharedMutation = (promise) => promise.then((snapshot) => {
8682
8692
  applySharedMessaging(snapshot, false);
@@ -8995,7 +9005,7 @@ ${c5.gray}Close another session (its slot frees within ~90s), then resend your m
8995
9005
  ]);
8996
9006
  const history = await (0, history_exports.loadHistory)(api, threadId, historySeedThreadId);
8997
9007
  tui.setHistory(history);
8998
- await reconcileSharedMessaging(true);
9008
+ await sharedMessagingSnapshot.refresh();
8999
9009
  let latestDraftPayload = null;
9000
9010
  let draftDirty = false;
9001
9011
  let draftInFlight = false;
@@ -9235,11 +9245,7 @@ ${c5.dim}runs on ${request.machine || runnerName}${c5.reset}`,
9235
9245
  stalledNoticeShown = false;
9236
9246
  }
9237
9247
  } catch {
9238
- try {
9239
- msgs = await api.getMessages(threadId, 60);
9240
- } catch {
9241
- return;
9242
- }
9248
+ msgs = await api.getMessages(threadId, 60);
9243
9249
  }
9244
9250
  const sorted = [...msgs].sort((a, b) => (a.created_at ?? 0) - (b.created_at ?? 0));
9245
9251
  for (const m of sorted) toolActivity.index(m);
@@ -9335,17 +9341,19 @@ ${c5.dim}runs on ${request.machine || runnerName}${c5.reset}`,
9335
9341
  } catch {
9336
9342
  }
9337
9343
  };
9338
- refreshSessionProjection = () => reconcileProjection().catch(() => {
9339
- });
9344
+ projectionSnapshot = new snapshot_epoch_exports.EpochSnapshot(
9345
+ reconcileProjection,
9346
+ () => connectionEpoch
9347
+ );
9340
9348
  let projectionDebounce = null;
9341
9349
  scheduleProjectionRefresh = () => {
9342
9350
  if (projectionDebounce) return;
9343
9351
  projectionDebounce = setTimeout(() => {
9344
9352
  projectionDebounce = null;
9345
- void refreshSessionProjection();
9353
+ void projectionSnapshot?.refresh();
9346
9354
  }, 250);
9347
9355
  };
9348
- await refreshSessionProjection();
9356
+ await projectionSnapshot.reconcile(connectionEpoch);
9349
9357
  await sessionEnded;
9350
9358
  if (projectionDebounce) clearTimeout(projectionDebounce);
9351
9359
  process.off("SIGCONT", onTerminalResume);