@botbotgo/agent-harness 0.0.290 → 0.0.291
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 +20 -20
- package/README.zh.md +14 -14
- package/dist/acp.d.ts +5 -5
- package/dist/acp.js +3 -3
- package/dist/api.d.ts +20 -21
- package/dist/api.js +38 -50
- package/dist/cli.js +47 -43
- package/dist/config/agents/orchestra.yaml +3 -3
- package/dist/config/knowledge/knowledge-runtime.yaml +4 -4
- package/dist/config/runtime/runtime-memory.yaml +7 -7
- package/dist/config/runtime/workspace.yaml +7 -7
- package/dist/contracts/core.d.ts +1 -1
- package/dist/contracts/runtime.d.ts +35 -40
- package/dist/contracts/workspace.d.ts +2 -2
- package/dist/flow/build-flow-graph.js +20 -33
- package/dist/flow/export-sequence-mermaid.js +4 -4
- package/dist/flow/types.d.ts +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/init-project.js +10 -10
- package/dist/knowledge/module.js +37 -45
- package/dist/mcp.d.ts +9 -9
- package/dist/mcp.js +6 -6
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.d.ts +69 -69
- package/dist/persistence/file-store.js +224 -221
- package/dist/persistence/sqlite-request-context-store.d.ts +22 -0
- package/dist/persistence/sqlite-request-context-store.js +64 -0
- package/dist/persistence/sqlite-request-queue-store.d.ts +41 -0
- package/dist/persistence/sqlite-request-queue-store.js +120 -0
- package/dist/persistence/sqlite-store.d.ts +72 -72
- package/dist/persistence/sqlite-store.js +361 -361
- package/dist/persistence/types.d.ts +84 -84
- package/dist/protocol/a2a/http.js +79 -74
- package/dist/protocol/ag-ui/http.d.ts +7 -7
- package/dist/protocol/ag-ui/http.js +20 -20
- package/dist/resource/resource-impl.js +1 -1
- package/dist/runtime/adapter/compat/deepagent-compat.d.ts +2 -2
- package/dist/runtime/adapter/flow/invocation-flow.d.ts +6 -5
- package/dist/runtime/adapter/flow/invocation-flow.js +6 -5
- package/dist/runtime/adapter/flow/stream-runtime.d.ts +3 -3
- package/dist/runtime/adapter/flow/stream-runtime.js +5 -4
- package/dist/runtime/adapter/invocation-result.d.ts +6 -5
- package/dist/runtime/adapter/invocation-result.js +5 -4
- package/dist/runtime/adapter/middleware-assembly.js +3 -2
- package/dist/runtime/adapter/tool/tool-hitl.js +1 -1
- package/dist/runtime/adapter/upstream-configurable-keys.d.ts +2 -0
- package/dist/runtime/adapter/upstream-configurable-keys.js +2 -0
- package/dist/runtime/agent-runtime-adapter.d.ts +11 -8
- package/dist/runtime/agent-runtime-adapter.js +36 -32
- package/dist/runtime/harness/events/events.d.ts +8 -8
- package/dist/runtime/harness/events/events.js +25 -19
- package/dist/runtime/harness/events/listener-runtime.d.ts +5 -4
- package/dist/runtime/harness/events/listener-runtime.js +7 -3
- package/dist/runtime/harness/events/runtime-event-operations.d.ts +7 -7
- package/dist/runtime/harness/events/runtime-event-operations.js +5 -5
- package/dist/runtime/harness/events/streaming.d.ts +8 -7
- package/dist/runtime/harness/events/streaming.js +20 -19
- package/dist/runtime/harness/events/timeline.js +6 -6
- package/dist/runtime/harness/index.d.ts +1 -1
- package/dist/runtime/harness/index.js +1 -1
- package/dist/runtime/harness/run/helpers.d.ts +14 -11
- package/dist/runtime/harness/run/helpers.js +10 -7
- package/dist/runtime/harness/run/inspection.d.ts +3 -2
- package/dist/runtime/harness/run/inspection.js +7 -7
- package/dist/runtime/harness/run/operator-overview.d.ts +2 -2
- package/dist/runtime/harness/run/operator-overview.js +18 -17
- package/dist/runtime/harness/run/queue-diagnostics.js +6 -6
- package/dist/runtime/harness/run/recovery.d.ts +15 -15
- package/dist/runtime/harness/run/recovery.js +53 -50
- package/dist/runtime/harness/run/resources.d.ts +2 -2
- package/dist/runtime/harness/run/resources.js +8 -8
- package/dist/runtime/harness/run/resume.d.ts +3 -3
- package/dist/runtime/harness/run/resume.js +4 -4
- package/dist/runtime/harness/run/routing.d.ts +4 -4
- package/dist/runtime/harness/run/routing.js +8 -8
- package/dist/runtime/harness/run/run-lifecycle.d.ts +12 -12
- package/dist/runtime/harness/run/run-lifecycle.js +26 -26
- package/dist/runtime/harness/run/run-operations.d.ts +45 -45
- package/dist/runtime/harness/run/run-operations.js +79 -78
- package/dist/runtime/harness/run/run-queue.d.ts +8 -8
- package/dist/runtime/harness/run/run-queue.js +16 -16
- package/dist/runtime/harness/run/run-slot-acquisition.d.ts +32 -32
- package/dist/runtime/harness/run/run-slot-acquisition.js +41 -41
- package/dist/runtime/harness/run/{thread-records.d.ts → session-records.d.ts} +6 -13
- package/dist/runtime/harness/run/{thread-records.js → session-records.js} +14 -60
- package/dist/runtime/harness/run/start-run.d.ts +36 -36
- package/dist/runtime/harness/run/start-run.js +55 -36
- package/dist/runtime/harness/run/startup-runtime.d.ts +9 -9
- package/dist/runtime/harness/run/startup-runtime.js +22 -20
- package/dist/runtime/harness/run/stream-run.d.ts +18 -18
- package/dist/runtime/harness/run/stream-run.js +52 -52
- package/dist/runtime/harness/runtime-defaults.d.ts +2 -2
- package/dist/runtime/harness/runtime-defaults.js +7 -7
- package/dist/runtime/harness/system/health-monitor.d.ts +3 -3
- package/dist/runtime/harness/system/health-monitor.js +18 -18
- package/dist/runtime/harness/system/mem0-ingestion-sync.d.ts +6 -6
- package/dist/runtime/harness/system/mem0-ingestion-sync.js +36 -27
- package/dist/runtime/harness/system/runtime-memory-candidates.js +2 -2
- package/dist/runtime/harness/system/runtime-memory-manager.d.ts +13 -13
- package/dist/runtime/harness/system/runtime-memory-manager.js +41 -38
- package/dist/runtime/harness/system/runtime-memory-policy.d.ts +1 -1
- package/dist/runtime/harness/system/runtime-memory-policy.js +1 -1
- package/dist/runtime/harness/system/runtime-memory-records.d.ts +4 -2
- package/dist/runtime/harness/system/runtime-memory-records.js +21 -8
- package/dist/runtime/harness/system/runtime-memory-sync.d.ts +6 -6
- package/dist/runtime/harness/system/runtime-memory-sync.js +47 -44
- package/dist/runtime/harness/system/{thread-memory-sync.d.ts → session-memory-sync.d.ts} +7 -7
- package/dist/runtime/harness/system/{thread-memory-sync.js → session-memory-sync.js} +28 -28
- package/dist/runtime/harness.d.ts +33 -45
- package/dist/runtime/harness.js +273 -291
- package/dist/runtime/maintenance/checkpoint-maintenance.js +2 -2
- package/dist/runtime/maintenance/file-checkpoint-saver.d.ts +1 -1
- package/dist/runtime/maintenance/file-checkpoint-saver.js +6 -6
- package/dist/runtime/maintenance/runtime-record-maintenance.d.ts +1 -1
- package/dist/runtime/maintenance/runtime-record-maintenance.js +33 -33
- package/dist/runtime/maintenance/sqlite-checkpoint-saver.d.ts +1 -1
- package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +30 -10
- package/dist/runtime/support/harness-support.d.ts +2 -2
- package/dist/runtime/support/harness-support.js +7 -7
- package/dist/runtime/support/runtime-adapter-options.d.ts +2 -2
- package/dist/runtime/support/runtime-adapter-options.js +3 -3
- package/dist/runtime/support/runtime-factories.d.ts +2 -2
- package/dist/runtime/support/runtime-factories.js +10 -10
- package/dist/workspace/agent-binding-compiler.js +3 -3
- package/dist/workspace/object-loader.js +1 -1
- package/dist/workspace/support/workspace-ref-utils.d.ts +4 -3
- package/dist/workspace/support/workspace-ref-utils.js +5 -4
- package/package.json +1 -1
- package/dist/persistence/sqlite-run-context-store.d.ts +0 -22
- package/dist/persistence/sqlite-run-context-store.js +0 -64
- package/dist/persistence/sqlite-run-queue-store.d.ts +0 -41
- package/dist/persistence/sqlite-run-queue-store.js +0 -120
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
function asString(value) {
|
|
2
|
-
return typeof value === "string" ? value : String(value ?? "");
|
|
3
|
-
}
|
|
4
|
-
function asNullableString(value) {
|
|
5
|
-
return value == null ? null : asString(value);
|
|
6
|
-
}
|
|
7
|
-
function asBoolean(value) {
|
|
8
|
-
return value === true || value === 1 || value === "1";
|
|
9
|
-
}
|
|
10
|
-
function nowIso() {
|
|
11
|
-
return new Date(Date.now()).toISOString();
|
|
12
|
-
}
|
|
13
|
-
export class SqliteRunQueueStore {
|
|
14
|
-
db;
|
|
15
|
-
constructor(db) {
|
|
16
|
-
this.db = db;
|
|
17
|
-
}
|
|
18
|
-
mapQueuedRun(row) {
|
|
19
|
-
return {
|
|
20
|
-
runId: asString(row.run_id),
|
|
21
|
-
threadId: asString(row.thread_id),
|
|
22
|
-
priority: Number(row.priority ?? 0),
|
|
23
|
-
queueKey: asNullableString(row.queue_key),
|
|
24
|
-
enqueuedAt: asString(row.enqueued_at),
|
|
25
|
-
availableAt: asString(row.available_at),
|
|
26
|
-
claimedBy: asNullableString(row.claimed_by),
|
|
27
|
-
claimedAt: asNullableString(row.claimed_at),
|
|
28
|
-
leaseExpiresAt: asNullableString(row.lease_expires_at),
|
|
29
|
-
attemptCount: Number(row.attempt_count ?? 0),
|
|
30
|
-
lastError: asNullableString(row.last_error),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
mapRunControl(row) {
|
|
34
|
-
return {
|
|
35
|
-
runId: asString(row.run_id),
|
|
36
|
-
cancelRequested: asBoolean(row.cancel_requested),
|
|
37
|
-
cancelReason: asNullableString(row.cancel_reason),
|
|
38
|
-
cancelRequestedAt: asNullableString(row.cancel_requested_at),
|
|
39
|
-
heartbeatAt: asNullableString(row.heartbeat_at),
|
|
40
|
-
workerId: asNullableString(row.worker_id),
|
|
41
|
-
workerStartedAt: asNullableString(row.worker_started_at),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
async enqueueRun(input) {
|
|
45
|
-
const enqueuedAt = nowIso();
|
|
46
|
-
await this.db.execute(`INSERT OR REPLACE INTO run_queue
|
|
47
|
-
(run_id, thread_id, priority, queue_key, enqueued_at, available_at, claimed_by, claimed_at, lease_expires_at, attempt_count, last_error)
|
|
48
|
-
VALUES (?, ?, ?, ?, ?, ?, NULL, NULL, NULL, COALESCE((SELECT attempt_count FROM run_queue WHERE run_id = ?), 0), NULL)`, [
|
|
49
|
-
input.runId,
|
|
50
|
-
input.threadId,
|
|
51
|
-
input.priority ?? 0,
|
|
52
|
-
input.queueKey ?? null,
|
|
53
|
-
enqueuedAt,
|
|
54
|
-
input.availableAt ?? enqueuedAt,
|
|
55
|
-
input.runId,
|
|
56
|
-
]);
|
|
57
|
-
}
|
|
58
|
-
async getQueuedRun(runId) {
|
|
59
|
-
const row = await this.db.selectOne("SELECT * FROM run_queue WHERE run_id = ?", [runId]);
|
|
60
|
-
return row ? this.mapQueuedRun(row) : null;
|
|
61
|
-
}
|
|
62
|
-
async claimQueuedRun(input) {
|
|
63
|
-
const claimedAt = input.claimedAt ?? nowIso();
|
|
64
|
-
await this.db.execute(`UPDATE run_queue
|
|
65
|
-
SET claimed_by = ?, claimed_at = ?, lease_expires_at = ?, attempt_count = attempt_count + 1
|
|
66
|
-
WHERE run_id = ? AND thread_id = ?`, [input.workerId, claimedAt, input.leaseExpiresAt, input.runId, input.threadId]);
|
|
67
|
-
await this.db.execute(`UPDATE run_control
|
|
68
|
-
SET heartbeat_at = ?, worker_id = ?, worker_started_at = COALESCE(worker_started_at, ?)
|
|
69
|
-
WHERE run_id = ?`, [claimedAt, input.workerId, claimedAt, input.runId]);
|
|
70
|
-
const claimed = await this.getQueuedRun(input.runId);
|
|
71
|
-
if (!claimed) {
|
|
72
|
-
throw new Error(`Missing queued run ${input.runId}`);
|
|
73
|
-
}
|
|
74
|
-
return claimed;
|
|
75
|
-
}
|
|
76
|
-
async renewRunLease(input) {
|
|
77
|
-
const heartbeatAt = input.heartbeatAt ?? nowIso();
|
|
78
|
-
await this.db.execute(`UPDATE run_queue
|
|
79
|
-
SET lease_expires_at = ?, claimed_by = COALESCE(claimed_by, ?), claimed_at = COALESCE(claimed_at, ?)
|
|
80
|
-
WHERE run_id = ?`, [input.leaseExpiresAt, input.workerId, heartbeatAt, input.runId]);
|
|
81
|
-
await this.db.execute(`UPDATE run_control
|
|
82
|
-
SET heartbeat_at = ?, worker_id = ?, worker_started_at = COALESCE(worker_started_at, ?)
|
|
83
|
-
WHERE run_id = ?`, [heartbeatAt, input.workerId, heartbeatAt, input.runId]);
|
|
84
|
-
}
|
|
85
|
-
async releaseRunClaim(runId) {
|
|
86
|
-
await this.db.execute("DELETE FROM run_queue WHERE run_id = ?", [runId]);
|
|
87
|
-
await this.db.execute(`UPDATE run_control
|
|
88
|
-
SET heartbeat_at = NULL, worker_id = NULL, worker_started_at = NULL
|
|
89
|
-
WHERE run_id = ?`, [runId]);
|
|
90
|
-
}
|
|
91
|
-
async listExpiredClaimedRuns(cutoffIso) {
|
|
92
|
-
const rows = await this.db.selectAll(`SELECT *
|
|
93
|
-
FROM run_queue
|
|
94
|
-
WHERE claimed_by IS NOT NULL
|
|
95
|
-
AND lease_expires_at IS NOT NULL
|
|
96
|
-
AND lease_expires_at <= ?
|
|
97
|
-
ORDER BY lease_expires_at ASC, run_id ASC`, [cutoffIso]);
|
|
98
|
-
return rows.map((row) => this.mapQueuedRun(row));
|
|
99
|
-
}
|
|
100
|
-
async getRunControl(runId) {
|
|
101
|
-
const row = await this.db.selectOne("SELECT * FROM run_control WHERE run_id = ?", [runId]);
|
|
102
|
-
return row ? this.mapRunControl(row) : null;
|
|
103
|
-
}
|
|
104
|
-
async requestRunCancel(runId, reason) {
|
|
105
|
-
const requestedAt = nowIso();
|
|
106
|
-
await this.db.execute(`UPDATE run_control
|
|
107
|
-
SET cancel_requested = 1, cancel_reason = ?, cancel_requested_at = ?
|
|
108
|
-
WHERE run_id = ?`, [reason ?? null, requestedAt, runId]);
|
|
109
|
-
const updated = await this.getRunControl(runId);
|
|
110
|
-
if (!updated) {
|
|
111
|
-
throw new Error(`Missing run control for ${runId}`);
|
|
112
|
-
}
|
|
113
|
-
return updated;
|
|
114
|
-
}
|
|
115
|
-
async clearRunCancel(runId) {
|
|
116
|
-
await this.db.execute(`UPDATE run_control
|
|
117
|
-
SET cancel_requested = 0, cancel_reason = NULL, cancel_requested_at = NULL
|
|
118
|
-
WHERE run_id = ?`, [runId]);
|
|
119
|
-
}
|
|
120
|
-
}
|