@botbotgo/agent-harness 0.0.103 → 0.0.104

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.102";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.103";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.102";
1
+ export const AGENT_HARNESS_VERSION = "0.0.103";
@@ -1,22 +1,17 @@
1
1
  import type { RunResult, ThreadSummary } from "../../../contracts/types.js";
2
2
  import type { RuntimePersistence } from "../../../persistence/types.js";
3
3
  import type { ConcurrencyConfig, RecoveryConfig } from "../../../workspace/support/workspace-ref-utils.js";
4
- import { recoverQueuedStartupRun } from "./recovery.js";
5
4
  type Startable = {
6
5
  start(): Promise<void>;
7
6
  };
8
- type StartupRecoveryContext = Parameters<typeof recoverQueuedStartupRun>[0];
9
7
  export declare function initializeHarnessRuntime(input: {
10
8
  persistence: RuntimePersistence;
11
- checkpointMaintenance: Startable | null;
12
- runtimeRecordMaintenance: Startable | null;
13
9
  healthMonitor: Startable | null;
14
- recoverStartupRuns: () => Promise<void>;
15
10
  }): Promise<void>;
16
11
  export declare function recoverStartupRuns(input: {
17
12
  recoveryConfig: RecoveryConfig;
18
13
  persistence: RuntimePersistence;
19
- createStartupRecoveryContext: () => StartupRecoveryContext;
14
+ createStartupRecoveryContext: () => unknown;
20
15
  reclaimExpiredClaimedRuns: (nowIso?: string) => Promise<void>;
21
16
  }): Promise<void>;
22
17
  export declare function reclaimExpiredClaimedRuns(input: {
@@ -1,58 +1,13 @@
1
- import { recoverQueuedStartupRun, recoverResumingStartupRun, recoverRunningStartupRun, } from "./recovery.js";
2
1
  export async function initializeHarnessRuntime(input) {
3
2
  await input.persistence.initialize();
4
- await input.checkpointMaintenance?.start();
5
- await input.runtimeRecordMaintenance?.start();
6
3
  await input.healthMonitor?.start();
7
- await input.recoverStartupRuns();
8
4
  }
9
5
  export async function recoverStartupRuns(input) {
10
- if (!input.recoveryConfig.enabled) {
11
- return;
12
- }
13
- await input.reclaimExpiredClaimedRuns();
14
- const threads = await input.persistence.listSessions();
15
- const recoveryContext = input.createStartupRecoveryContext();
16
- for (const thread of threads) {
17
- const handled = await recoverQueuedStartupRun(recoveryContext, thread) ||
18
- await recoverRunningStartupRun(recoveryContext, thread) ||
19
- await recoverResumingStartupRun(recoveryContext, thread);
20
- if (handled) {
21
- continue;
22
- }
23
- }
6
+ void input;
24
7
  }
25
8
  export async function reclaimExpiredClaimedRuns(input, nowIso = new Date().toISOString()) {
26
- const expiredClaims = await input.persistence.listExpiredClaimedRuns(nowIso);
27
- for (const claim of expiredClaims) {
28
- const thread = await input.persistence.getSession(claim.threadId);
29
- if (!thread) {
30
- await input.persistence.releaseRunClaim(claim.runId);
31
- continue;
32
- }
33
- const lifecycle = await input.persistence.getRunLifecycle(claim.threadId, claim.runId);
34
- if (lifecycle.state === "claimed") {
35
- await input.persistence.enqueueRun({
36
- threadId: claim.threadId,
37
- runId: claim.runId,
38
- priority: claim.priority,
39
- queueKey: claim.queueKey,
40
- availableAt: nowIso,
41
- });
42
- await input.setRunStateAndEmit(claim.threadId, claim.runId, 99, "queued", {
43
- previousState: "claimed",
44
- });
45
- await input.emit(claim.threadId, claim.runId, 100, "run.queued", {
46
- queuePosition: 0,
47
- activeRunCount: input.getActiveRunSlots(),
48
- maxConcurrentRuns: input.concurrencyConfig.maxConcurrentRuns,
49
- recoveredOnStartup: true,
50
- reclaimReason: "expired-lease",
51
- });
52
- continue;
53
- }
54
- await input.persistence.releaseRunClaim(claim.runId);
55
- }
9
+ void input;
10
+ void nowIso;
56
11
  }
57
12
  export async function isStaleRunningRun(input, thread, nowMs = Date.now()) {
58
13
  const control = await input.persistence.getRunControl(thread.latestRunId);
@@ -22,8 +22,6 @@ export declare class AgentHarnessRuntime {
22
22
  private readonly threadMemorySync;
23
23
  private readonly unregisterThreadMemorySync;
24
24
  private readonly resolvedRuntimeAdapterOptions;
25
- private readonly checkpointMaintenance;
26
- private readonly runtimeRecordMaintenance;
27
25
  private readonly healthMonitor;
28
26
  private readonly recoveryConfig;
29
27
  private readonly concurrencyConfig;
@@ -9,10 +9,7 @@ import { getConcurrencyConfig, getRecoveryConfig, getRoutingDefaultAgentId, getR
9
9
  import { createHarnessEvent, inferRoutingBindings, renderRuntimeFailure, } from "./support/harness-support.js";
10
10
  import { ThreadMemorySync } from "./harness/system/thread-memory-sync.js";
11
11
  import { FileBackedStore } from "./harness/system/store.js";
12
- import { CheckpointMaintenanceLoop, discoverCheckpointMaintenanceTargets, readCheckpointMaintenanceConfig, } from "./maintenance/checkpoint-maintenance.js";
13
- import { RuntimeRecordMaintenanceLoop, discoverRuntimeRecordMaintenanceTargets, readRuntimeRecordMaintenanceConfig, } from "./maintenance/runtime-record-maintenance.js";
14
- import { HealthMonitor } from "./harness/system/health-monitor.js";
15
- import { readHealthMonitorConfig } from "./harness/system/health-monitor.js";
12
+ import { HealthMonitor, readHealthMonitorConfig, } from "./harness/system/health-monitor.js";
16
13
  import { extractMessageText, normalizeMessageContent } from "../utils/message-content.js";
17
14
  import { buildPersistedRunRequest, normalizeInvocationEnvelope, normalizeRunPriority, resolveRunListeners, } from "./harness/run/helpers.js";
18
15
  import { emitHarnessEvent, emitRunCreatedEvent, emitSyntheticFallbackEvent, requestApprovalAndEmitEvent, setRunStateAndEmitEvent, } from "./harness/events/events.js";
@@ -29,7 +26,7 @@ import { getBindingAdapterKind, getBindingPrimaryTools, getBindingStoreConfig }
29
26
  import { isRuntimeEntryBinding } from "./support/runtime-entry.js";
30
27
  import { describeWorkspaceInventory, listAgentSkills as listWorkspaceAgentSkills, } from "./harness/system/inventory.js";
31
28
  import { createDefaultHealthSnapshot, isInventoryEnabled, isThreadMemorySyncEnabled, } from "./harness/runtime-defaults.js";
32
- import { initializeHarnessRuntime, isStaleRunningRun as isHarnessStaleRunningRun, reclaimExpiredClaimedRuns as reclaimHarnessExpiredClaimedRuns, recoverStartupRuns as recoverHarnessStartupRuns, } from "./harness/run/startup-runtime.js";
29
+ import { initializeHarnessRuntime, isStaleRunningRun as isHarnessStaleRunningRun, } from "./harness/run/startup-runtime.js";
33
30
  import { streamHarnessRun } from "./harness/run/stream-run.js";
34
31
  import { deleteThreadRecord, getPublicApproval, getThreadRecord, listPublicApprovals, } from "./harness/run/thread-records.js";
35
32
  export class AgentHarnessRuntime {
@@ -58,8 +55,6 @@ export class AgentHarnessRuntime {
58
55
  threadMemorySync;
59
56
  unregisterThreadMemorySync;
60
57
  resolvedRuntimeAdapterOptions;
61
- checkpointMaintenance;
62
- runtimeRecordMaintenance;
63
58
  healthMonitor;
64
59
  recoveryConfig;
65
60
  concurrencyConfig;
@@ -127,14 +122,6 @@ export class AgentHarnessRuntime {
127
122
  this.threadMemorySync = null;
128
123
  this.unregisterThreadMemorySync = () => { };
129
124
  }
130
- const checkpointMaintenanceConfig = readCheckpointMaintenanceConfig(workspace);
131
- this.checkpointMaintenance = checkpointMaintenanceConfig
132
- ? new CheckpointMaintenanceLoop(discoverCheckpointMaintenanceTargets(workspace), checkpointMaintenanceConfig)
133
- : null;
134
- const runtimeRecordMaintenanceConfig = readRuntimeRecordMaintenanceConfig(workspace);
135
- this.runtimeRecordMaintenance = runtimeRecordMaintenanceConfig
136
- ? new RuntimeRecordMaintenanceLoop(discoverRuntimeRecordMaintenanceTargets(workspace), runtimeRecordMaintenanceConfig)
137
- : null;
138
125
  this.recoveryConfig = getRecoveryConfig(workspace.refs);
139
126
  this.concurrencyConfig = getConcurrencyConfig(workspace.refs);
140
127
  const healthConfig = readHealthMonitorConfig(workspace);
@@ -146,8 +133,8 @@ export class AgentHarnessRuntime {
146
133
  persistence: this.persistence,
147
134
  getActiveRunSlots: () => this.activeRunSlots,
148
135
  getPendingRunSlots: () => this.pendingRunSlots.length,
149
- getCheckpointMaintenanceStatus: () => this.checkpointMaintenance?.getStatus() ?? null,
150
- getRuntimeRecordMaintenanceStatus: () => this.runtimeRecordMaintenance?.getStatus() ?? null,
136
+ getCheckpointMaintenanceStatus: () => null,
137
+ getRuntimeRecordMaintenanceStatus: () => null,
151
138
  publishEvent: async (payload) => {
152
139
  this.eventBus.publish(createHarnessEvent("__runtime__", "__runtime__", ++this.runtimeEventSequence, "runtime.health.changed", payload));
153
140
  },
@@ -162,10 +149,7 @@ export class AgentHarnessRuntime {
162
149
  async initialize() {
163
150
  await initializeHarnessRuntime({
164
151
  persistence: this.persistence,
165
- checkpointMaintenance: this.checkpointMaintenance,
166
- runtimeRecordMaintenance: this.runtimeRecordMaintenance,
167
152
  healthMonitor: this.healthMonitor,
168
- recoverStartupRuns: () => this.recoverStartupRuns(),
169
153
  });
170
154
  }
171
155
  subscribe(listener) {
@@ -720,8 +704,6 @@ export class AgentHarnessRuntime {
720
704
  }
721
705
  async close() {
722
706
  await this.healthMonitor?.stop();
723
- await this.checkpointMaintenance?.stop();
724
- await this.runtimeRecordMaintenance?.stop();
725
707
  this.unregisterThreadMemorySync();
726
708
  await Promise.allSettled(Array.from(this.backgroundTasks));
727
709
  await this.threadMemorySync?.close();
@@ -739,21 +721,10 @@ export class AgentHarnessRuntime {
739
721
  }, options);
740
722
  }
741
723
  async recoverStartupRuns() {
742
- await recoverHarnessStartupRuns({
743
- recoveryConfig: this.recoveryConfig,
744
- persistence: this.persistence,
745
- createStartupRecoveryContext: () => this.createStartupRecoveryContext(),
746
- reclaimExpiredClaimedRuns: (nowIso) => this.reclaimExpiredClaimedRuns(nowIso),
747
- });
724
+ return;
748
725
  }
749
- async reclaimExpiredClaimedRuns(nowIso = new Date().toISOString()) {
750
- await reclaimHarnessExpiredClaimedRuns({
751
- persistence: this.persistence,
752
- setRunStateAndEmit: (threadId, runId, sequence, state, options) => this.setRunStateAndEmit(threadId, runId, sequence, state, options),
753
- emit: (threadId, runId, sequence, eventType, payload) => this.emit(threadId, runId, sequence, eventType, payload),
754
- concurrencyConfig: this.concurrencyConfig,
755
- getActiveRunSlots: () => this.activeRunSlots,
756
- }, nowIso);
726
+ async reclaimExpiredClaimedRuns(_nowIso = new Date().toISOString()) {
727
+ return;
757
728
  }
758
729
  async isStaleRunningRun(thread, nowMs = Date.now()) {
759
730
  return isHarnessStaleRunningRun({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.103",
3
+ "version": "0.0.104",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "type": "module",
6
6
  "packageManager": "npm@10.9.2",