@botbotgo/agent-harness 0.0.256 → 0.0.258

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.
@@ -1 +1 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.255";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.257";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.255";
1
+ export const AGENT_HARNESS_VERSION = "0.0.257";
@@ -22,6 +22,7 @@ export declare class SqlitePersistence implements RuntimePersistence {
22
22
  private selectAll;
23
23
  private mapThreadSummary;
24
24
  private mapRunSummary;
25
+ private listRunSnapshots;
25
26
  private mapApproval;
26
27
  initialize(): Promise<void>;
27
28
  private ensureSchemaMetadata;
@@ -6,6 +6,14 @@ import { SqliteRunContextStore } from "./sqlite-run-context-store.js";
6
6
  import { SqliteRunQueueStore } from "./sqlite-run-queue-store.js";
7
7
  const RUNTIME_SQLITE_SCHEMA_VERSION = 6;
8
8
  const RUNTIME_SQLITE_SCHEMA_FAMILY = "agent-harness-runtime";
9
+ const ACTIVE_RUN_STATES = new Set([
10
+ "queued",
11
+ "claimed",
12
+ "running",
13
+ "waiting_for_approval",
14
+ "resuming",
15
+ "cancelling",
16
+ ]);
9
17
  function asRow(value) {
10
18
  return value;
11
19
  }
@@ -211,6 +219,7 @@ export class SqlitePersistence {
211
219
  `);
212
220
  await this.rawExecute("CREATE INDEX IF NOT EXISTS runs_thread_updated_idx ON runs(thread_id, updated_at DESC)");
213
221
  await this.rawExecute("CREATE INDEX IF NOT EXISTS runs_thread_created_idx ON runs(thread_id, created_at DESC)");
222
+ await this.rawExecute("CREATE INDEX IF NOT EXISTS runs_updated_idx ON runs(updated_at DESC)");
214
223
  await this.rawExecute("CREATE INDEX IF NOT EXISTS runs_state_updated_idx ON runs(state, updated_at DESC)");
215
224
  await this.rawExecute("CREATE INDEX IF NOT EXISTS runs_agent_updated_idx ON runs(agent_id, updated_at DESC)");
216
225
  await this.rawExecute("CREATE INDEX IF NOT EXISTS run_inspection_thread_activity_idx ON run_inspection(thread_id, last_activity_at DESC)");
@@ -434,6 +443,17 @@ export class SqlitePersistence {
434
443
  ...(runtimeSnapshot ? { runtimeSnapshot } : {}),
435
444
  };
436
445
  }
446
+ async listRunSnapshots(runIds) {
447
+ if (runIds.length === 0) {
448
+ return new Map();
449
+ }
450
+ const placeholders = runIds.map(() => "?").join(", ");
451
+ const rows = await this.selectAll(`SELECT run_id, runtime_snapshot_json
452
+ FROM run_inspection
453
+ WHERE run_id IN (${placeholders})
454
+ AND runtime_snapshot_json IS NOT NULL`, runIds);
455
+ return new Map(rows.map((row) => [asString(row.run_id), parseJson(row.runtime_snapshot_json)]));
456
+ }
437
457
  mapApproval(row) {
438
458
  return {
439
459
  approvalId: asString(row.approval_id),
@@ -751,12 +771,23 @@ export class SqlitePersistence {
751
771
  ["runs.state = ?", filter.state],
752
772
  ]);
753
773
  const rows = await this.selectAll(`SELECT runs.run_id, runs.thread_id, runs.agent_id, runs.parent_run_id, runs.execution_mode, runs.adapter_kind, runs.created_at, runs.updated_at, runs.state, runs.checkpoint_ref, runs.resumable,
754
- run_inspection.started_at, run_inspection.ended_at, run_inspection.last_activity_at, run_inspection.current_agent_id, run_inspection.delegation_chain_json, run_inspection.runtime_snapshot_json
774
+ run_inspection.started_at, run_inspection.ended_at, run_inspection.last_activity_at, run_inspection.current_agent_id, run_inspection.delegation_chain_json
755
775
  FROM runs
756
776
  LEFT JOIN run_inspection ON run_inspection.run_id = runs.run_id
757
777
  ${clause}
758
- ORDER BY updated_at DESC`, args);
759
- return rows.map((row) => this.mapRunSummary(row));
778
+ ORDER BY runs.updated_at DESC`, args);
779
+ const activeRunIds = rows
780
+ .filter((row) => ACTIVE_RUN_STATES.has(asString(row.state)))
781
+ .map((row) => asString(row.run_id));
782
+ const snapshotsByRunId = await this.listRunSnapshots(activeRunIds);
783
+ return rows.map((row) => {
784
+ const runId = asString(row.run_id);
785
+ const runtimeSnapshot = snapshotsByRunId.get(runId);
786
+ return {
787
+ ...this.mapRunSummary(row),
788
+ ...(runtimeSnapshot ? { runtimeSnapshot } : {}),
789
+ };
790
+ });
760
791
  }
761
792
  async getRun(runId) {
762
793
  const row = await this.selectOne(`SELECT runs.run_id, runs.thread_id, runs.agent_id, runs.parent_run_id, runs.execution_mode, runs.adapter_kind, runs.created_at, runs.updated_at, runs.state, runs.checkpoint_ref, runs.resumable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.256",
3
+ "version": "0.0.258",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -71,7 +71,7 @@
71
71
  "docs:sync-dev-nav": "node ./scripts/sync-developer-docs-nav.mjs",
72
72
  "docs:sync-release-notes": "node ./scripts/sync-release-notes-html.mjs",
73
73
  "docs:sync-docs-html": "node ./scripts/sync-release-notes-html.mjs && node ./scripts/sync-developer-docs-nav.mjs",
74
- "release:prepare": "npm version patch --no-git-tag-version && node ./scripts/sync-example-version.mjs",
74
+ "release:prepare": "npm version patch --no-git-tag-version && node ./scripts/sync-example-version.mjs && node ./scripts/archive-release-notes.mjs && node ./scripts/sync-release-notes-html.mjs",
75
75
  "release:pack": "npm pack --dry-run",
76
76
  "release:publish": "npm publish --access public --registry https://registry.npmjs.org/"
77
77
  },