@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
package/dist/cli.js
CHANGED
|
@@ -18,8 +18,8 @@ function renderUsage() {
|
|
|
18
18
|
agent-harness runtime health [--workspace <path>] [--json]
|
|
19
19
|
agent-harness runtime approvals list [--workspace <path>] [--status <pending|approved|edited|rejected|expired>] [--json]
|
|
20
20
|
agent-harness runtime approvals watch [--workspace <path>] [--status <pending|approved|edited|rejected|expired>] [--poll-ms <ms>] [--once] [--json]
|
|
21
|
-
agent-harness runtime
|
|
22
|
-
agent-harness runtime
|
|
21
|
+
agent-harness runtime requests list [--workspace <path>] [--agent <agentId>] [--session <sessionId>] [--state <state>] [--json]
|
|
22
|
+
agent-harness runtime requests tail [--workspace <path>] [--agent <agentId>] [--session <sessionId>] [--state <state>] [--poll-ms <ms>] [--once] [--json]
|
|
23
23
|
agent-harness runtime export request --workspace <path> --session <sessionId> --request <requestId> [--artifacts] [--artifact-contents] [--health] [--json]
|
|
24
24
|
agent-harness runtime export session --workspace <path> --session <sessionId> [--artifacts] [--artifact-contents] [--health] [--json]
|
|
25
25
|
agent-harness runtime-mcp serve [--workspace <path>]
|
|
@@ -168,13 +168,13 @@ function parseRuntimeInspectOptions(args) {
|
|
|
168
168
|
let status;
|
|
169
169
|
let state;
|
|
170
170
|
let agentId;
|
|
171
|
-
let
|
|
171
|
+
let sessionId;
|
|
172
172
|
for (let index = 0; index < args.length; index += 1) {
|
|
173
173
|
const arg = args[index];
|
|
174
|
-
if (arg === "--workspace" || arg === "--status" || arg === "--state" || arg === "--agent" || arg === "--
|
|
174
|
+
if (arg === "--workspace" || arg === "--status" || arg === "--state" || arg === "--agent" || arg === "--session" || arg === "--poll-ms" || arg === "--limit") {
|
|
175
175
|
const value = args[index + 1];
|
|
176
176
|
if (!value) {
|
|
177
|
-
return { json, once, pollMs, limit, status, state, agentId,
|
|
177
|
+
return { json, once, pollMs, limit, status, state, agentId, sessionId, error: `Missing value for ${arg}` };
|
|
178
178
|
}
|
|
179
179
|
if (arg === "--workspace") {
|
|
180
180
|
workspaceRoot = value;
|
|
@@ -188,20 +188,20 @@ function parseRuntimeInspectOptions(args) {
|
|
|
188
188
|
else if (arg === "--agent") {
|
|
189
189
|
agentId = value;
|
|
190
190
|
}
|
|
191
|
-
else if (arg === "--
|
|
192
|
-
|
|
191
|
+
else if (arg === "--session") {
|
|
192
|
+
sessionId = value;
|
|
193
193
|
}
|
|
194
194
|
else if (arg === "--limit") {
|
|
195
195
|
const parsedLimit = Number.parseInt(value, 10);
|
|
196
196
|
if (!Number.isFinite(parsedLimit) || parsedLimit <= 0) {
|
|
197
|
-
return { json, once, pollMs, limit, status, state, agentId,
|
|
197
|
+
return { json, once, pollMs, limit, status, state, agentId, sessionId, error: `Invalid limit: ${value}` };
|
|
198
198
|
}
|
|
199
199
|
limit = parsedLimit;
|
|
200
200
|
}
|
|
201
201
|
else {
|
|
202
202
|
const parsedPoll = Number.parseInt(value, 10);
|
|
203
203
|
if (!Number.isFinite(parsedPoll) || parsedPoll <= 0) {
|
|
204
|
-
return { json, once, pollMs, limit, status, state, agentId,
|
|
204
|
+
return { json, once, pollMs, limit, status, state, agentId, sessionId, error: `Invalid poll interval: ${value}` };
|
|
205
205
|
}
|
|
206
206
|
pollMs = parsedPoll;
|
|
207
207
|
}
|
|
@@ -216,9 +216,9 @@ function parseRuntimeInspectOptions(args) {
|
|
|
216
216
|
once = true;
|
|
217
217
|
continue;
|
|
218
218
|
}
|
|
219
|
-
return { workspaceRoot, json, once, pollMs, limit, status, state, agentId,
|
|
219
|
+
return { workspaceRoot, json, once, pollMs, limit, status, state, agentId, sessionId, error: `Unknown option: ${arg}` };
|
|
220
220
|
}
|
|
221
|
-
return { workspaceRoot, json, once, pollMs, limit, status, state, agentId,
|
|
221
|
+
return { workspaceRoot, json, once, pollMs, limit, status, state, agentId, sessionId };
|
|
222
222
|
}
|
|
223
223
|
function parseRuntimeExportOptions(args) {
|
|
224
224
|
let workspaceRoot;
|
|
@@ -321,10 +321,10 @@ function renderHealthSnapshot(snapshot, workspacePath) {
|
|
|
321
321
|
}
|
|
322
322
|
const stats = isObject(snapshot.stats) ? snapshot.stats : {};
|
|
323
323
|
const statEntries = [
|
|
324
|
-
["
|
|
325
|
-
["
|
|
324
|
+
["activeRequestSlots", stats.activeRequestSlots],
|
|
325
|
+
["pendingRequestSlots", stats.pendingRequestSlots],
|
|
326
326
|
["pendingApprovals", stats.pendingApprovals],
|
|
327
|
-
["
|
|
327
|
+
["stuckRequests", stats.stuckRequests],
|
|
328
328
|
["llmSuccessRate1m", stats.llmSuccessRate1m],
|
|
329
329
|
["llmP95LatencyMs1m", stats.llmP95LatencyMs1m],
|
|
330
330
|
]
|
|
@@ -359,32 +359,32 @@ function renderApprovalList(approvals) {
|
|
|
359
359
|
const status = typeof approval.status === "string" ? approval.status : "unknown";
|
|
360
360
|
const toolName = typeof approval.toolName === "string" ? approval.toolName : "unknown_tool";
|
|
361
361
|
const approvalId = typeof approval.approvalId === "string" ? approval.approvalId : "unknown";
|
|
362
|
-
const
|
|
363
|
-
const
|
|
362
|
+
const sessionId = typeof approval.sessionId === "string" ? ` session=${approval.sessionId}` : "";
|
|
363
|
+
const requestId = typeof approval.requestId === "string" ? ` request=${approval.requestId}` : "";
|
|
364
364
|
const reason = typeof approval.approvalReason === "string" ? ` reason=${approval.approvalReason}` : "";
|
|
365
365
|
const requestedAt = formatTimestamp(approval.requestedAt);
|
|
366
366
|
const resolvedAt = formatTimestamp(approval.resolvedAt);
|
|
367
367
|
const requested = requestedAt ? ` requested=${requestedAt}` : "";
|
|
368
368
|
const resolved = resolvedAt ? ` resolved=${resolvedAt}` : "";
|
|
369
|
-
return `${approvalId} status=${status} tool=${toolName}${
|
|
369
|
+
return `${approvalId} status=${status} tool=${toolName}${sessionId}${requestId}${reason}${requested}${resolved}`;
|
|
370
370
|
}).join("\n") + "\n";
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
if (
|
|
374
|
-
return "No
|
|
372
|
+
function renderRequestList(requests) {
|
|
373
|
+
if (requests.length === 0) {
|
|
374
|
+
return "No requests matched.\n";
|
|
375
375
|
}
|
|
376
|
-
return
|
|
377
|
-
const
|
|
378
|
-
const
|
|
379
|
-
const agentId = typeof
|
|
380
|
-
const state = typeof
|
|
381
|
-
const currentAgent = typeof
|
|
382
|
-
const resumable = typeof
|
|
383
|
-
const updatedAt = formatTimestamp(
|
|
384
|
-
const lastActivityAt = formatTimestamp(
|
|
376
|
+
return requests.map((request) => {
|
|
377
|
+
const requestId = typeof request.requestId === "string" ? request.requestId : "unknown";
|
|
378
|
+
const sessionId = typeof request.sessionId === "string" ? request.sessionId : "unknown";
|
|
379
|
+
const agentId = typeof request.agentId === "string" ? request.agentId : "unknown";
|
|
380
|
+
const state = typeof request.state === "string" ? request.state : "unknown";
|
|
381
|
+
const currentAgent = typeof request.currentAgentId === "string" ? ` current=${request.currentAgentId}` : "";
|
|
382
|
+
const resumable = typeof request.resumable === "boolean" ? ` resumable=${request.resumable}` : "";
|
|
383
|
+
const updatedAt = formatTimestamp(request.updatedAt);
|
|
384
|
+
const lastActivityAt = formatTimestamp(request.lastActivityAt);
|
|
385
385
|
const updated = updatedAt ? ` updated=${updatedAt}` : "";
|
|
386
386
|
const lastActivity = lastActivityAt ? ` activity=${lastActivityAt}` : "";
|
|
387
|
-
return `${
|
|
387
|
+
return `${requestId} session=${sessionId} agent=${agentId}${currentAgent} state=${state}${resumable}${updated}${lastActivity}`;
|
|
388
388
|
}).join("\n") + "\n";
|
|
389
389
|
}
|
|
390
390
|
function renderOperatorOverview(overview, workspacePath) {
|
|
@@ -415,11 +415,11 @@ function renderOperatorOverview(overview, workspacePath) {
|
|
|
415
415
|
if (approvalItems.length > 0) {
|
|
416
416
|
lines.push(renderApprovalList(approvalItems).trimEnd());
|
|
417
417
|
}
|
|
418
|
-
const
|
|
419
|
-
const
|
|
420
|
-
lines.push(`Active
|
|
421
|
-
if (
|
|
422
|
-
lines.push(
|
|
418
|
+
const requests = isObject(overview.requests) ? overview.requests : {};
|
|
419
|
+
const requestItems = Array.isArray(requests.items) ? requests.items.filter(isObject) : [];
|
|
420
|
+
lines.push(`Active requests: ${typeof requests.total === "number" ? requests.total : requestItems.length}`);
|
|
421
|
+
if (requestItems.length > 0) {
|
|
422
|
+
lines.push(renderRequestList(requestItems).trimEnd());
|
|
423
423
|
}
|
|
424
424
|
return `${lines.join("\n")}\n`;
|
|
425
425
|
}
|
|
@@ -654,7 +654,7 @@ export async function runCli(argv, io = {}, deps = {}) {
|
|
|
654
654
|
return 1;
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
|
-
const nestedCommand = (subcommand === "approvals" || subcommand === "
|
|
657
|
+
const nestedCommand = (subcommand === "approvals" || subcommand === "requests") && possibleNestedCommand
|
|
658
658
|
? possibleNestedCommand
|
|
659
659
|
: undefined;
|
|
660
660
|
const subcommandArgs = nestedCommand
|
|
@@ -696,20 +696,24 @@ export async function runCli(argv, io = {}, deps = {}) {
|
|
|
696
696
|
await runtime.stop();
|
|
697
697
|
return 0;
|
|
698
698
|
}
|
|
699
|
-
if (subcommand === "
|
|
700
|
-
const
|
|
701
|
-
const
|
|
699
|
+
if (subcommand === "requests" && (nestedCommand === "list" || nestedCommand === "tail")) {
|
|
700
|
+
const renderRequests = async () => {
|
|
701
|
+
const listRequests = runtime.listRequests?.bind(runtime);
|
|
702
|
+
if (!listRequests) {
|
|
703
|
+
throw new Error("Runtime does not support request listing");
|
|
704
|
+
}
|
|
705
|
+
const requests = await listRequests({
|
|
702
706
|
...(parsed.agentId ? { agentId: parsed.agentId } : {}),
|
|
703
|
-
...(parsed.
|
|
707
|
+
...(parsed.sessionId ? { sessionId: parsed.sessionId } : {}),
|
|
704
708
|
...(parsed.state ? { state: parsed.state } : {}),
|
|
705
709
|
});
|
|
706
|
-
stdout(parsed.json ? renderJson(
|
|
710
|
+
stdout(parsed.json ? renderJson(requests) : renderRequestList(requests));
|
|
707
711
|
};
|
|
708
|
-
await
|
|
712
|
+
await renderRequests();
|
|
709
713
|
if (nestedCommand === "tail" && !parsed.once) {
|
|
710
714
|
for (;;) {
|
|
711
715
|
await sleep(parsed.pollMs);
|
|
712
|
-
await
|
|
716
|
+
await renderRequests();
|
|
713
717
|
}
|
|
714
718
|
}
|
|
715
719
|
await runtime.stop();
|
|
@@ -25,8 +25,8 @@ spec:
|
|
|
25
25
|
# Treat this as agent-owned startup context, not as a dynamic long-term memory sink:
|
|
26
26
|
# - keep `systemPrompt` for stable role, boundaries, and hard behavioral rules
|
|
27
27
|
# - use `memory:` for stable project knowledge, operating conventions, and shared or agent-specific context files
|
|
28
|
-
# - use `/memories/*` via the backend/store below for durable knowledge learned from prior
|
|
29
|
-
# - use the harness checkpointer for resumable graph state for an in-flight
|
|
28
|
+
# - use `/memories/*` via the backend/store below for durable knowledge learned from prior requests
|
|
29
|
+
# - use the harness checkpointer for resumable graph state for an in-flight request
|
|
30
30
|
# Updating these files changes future agent constructions, but they are still bootstrap inputs rather than
|
|
31
31
|
# self-updating runtime memory.
|
|
32
32
|
- path: config/agent-context.md
|
|
@@ -102,7 +102,7 @@ spec:
|
|
|
102
102
|
When the user asks about available tools, skills, or agents, use the attached inventory tools instead of
|
|
103
103
|
inferring from memory.
|
|
104
104
|
|
|
105
|
-
Write to `/memories/*` only when the information is durable, reusable across future
|
|
105
|
+
Write to `/memories/*` only when the information is durable, reusable across future requests or sessions, and likely
|
|
106
106
|
to matter again: user preferences, project conventions, confirmed decisions, reusable summaries, and stable
|
|
107
107
|
ownership facts are good candidates.
|
|
108
108
|
Do not store transient reasoning, temporary plans, scratch work, one-off search results, or intermediate
|
|
@@ -46,15 +46,15 @@ spec:
|
|
|
46
46
|
background:
|
|
47
47
|
enabled: true
|
|
48
48
|
scopes:
|
|
49
|
-
-
|
|
49
|
+
- session
|
|
50
50
|
stateStorePath: knowledge/formation-state.json
|
|
51
|
-
|
|
51
|
+
maxMessagesPerRequest: 40
|
|
52
52
|
writeOnApprovalResolution: true
|
|
53
|
-
|
|
53
|
+
writeOnRequestCompletion: true
|
|
54
54
|
mem0:
|
|
55
55
|
## agent-harness feature: optional Mem0 OSS ingestion defaults for standalone knowledge extraction.
|
|
56
56
|
enabled: false
|
|
57
57
|
apiKeyEnv: MEM0_API_KEY
|
|
58
58
|
appId: agent-harness
|
|
59
59
|
stateStorePath: knowledge/mem0-sync-state.json
|
|
60
|
-
|
|
60
|
+
maxMessagesPerRequest: 200
|
|
@@ -64,7 +64,7 @@ spec:
|
|
|
64
64
|
ingestion:
|
|
65
65
|
backgroundConsolidation: true
|
|
66
66
|
writeOnApprovalResolution: true
|
|
67
|
-
|
|
67
|
+
writeOnRequestCompletion: true
|
|
68
68
|
|
|
69
69
|
# agent-harness feature: LangMem-style memory formation defaults for hot-path and background reflection.
|
|
70
70
|
formation:
|
|
@@ -77,14 +77,14 @@ spec:
|
|
|
77
77
|
background:
|
|
78
78
|
enabled: true
|
|
79
79
|
scopes:
|
|
80
|
-
-
|
|
80
|
+
- session
|
|
81
81
|
stateStorePath: knowledge/formation-state.json
|
|
82
|
-
|
|
82
|
+
maxMessagesPerRequest: 40
|
|
83
83
|
writeOnApprovalResolution: true
|
|
84
|
-
|
|
84
|
+
writeOnRequestCompletion: true
|
|
85
85
|
|
|
86
|
-
# agent-harness feature: optional
|
|
87
|
-
|
|
86
|
+
# agent-harness feature: optional session snapshot projection for operational state and pending approvals.
|
|
87
|
+
sessionMemorySync:
|
|
88
88
|
enabled: true
|
|
89
89
|
|
|
90
90
|
# agent-harness feature: optional Mem0 OSS ingestion engine for automatic long-term knowledge extraction.
|
|
@@ -93,4 +93,4 @@ spec:
|
|
|
93
93
|
apiKeyEnv: MEM0_API_KEY
|
|
94
94
|
appId: agent-harness
|
|
95
95
|
stateStorePath: knowledge/mem0-sync-state.json
|
|
96
|
-
|
|
96
|
+
maxMessagesPerRequest: 200
|
|
@@ -29,8 +29,8 @@ spec:
|
|
|
29
29
|
# agent-harness feature: stable runtime profile identifier for this data folder.
|
|
30
30
|
profile: default
|
|
31
31
|
|
|
32
|
-
# agent-harness feature: runtime-level task queue and maximum number of concurrent
|
|
33
|
-
# Additional
|
|
32
|
+
# agent-harness feature: runtime-level task queue and maximum number of concurrent requests.
|
|
33
|
+
# Additional requests wait in the harness queue until a slot becomes available.
|
|
34
34
|
concurrency:
|
|
35
35
|
maxConcurrentRuns: 3
|
|
36
36
|
|
|
@@ -60,7 +60,7 @@ spec:
|
|
|
60
60
|
# - `regex`: regular-expression match (string or list)
|
|
61
61
|
# - `minLength` / `maxLength`: request text length bounds
|
|
62
62
|
# - `minLines` / `maxLines`: request line-count bounds
|
|
63
|
-
# - `
|
|
63
|
+
# - `hasSessionId`: require a new turn (`false`) or existing session follow-up (`true`)
|
|
64
64
|
# - `caseSensitive`: default `false`
|
|
65
65
|
#
|
|
66
66
|
# Example:
|
|
@@ -98,7 +98,7 @@ spec:
|
|
|
98
98
|
# coupling cleanup to user-triggered checkpoint reads or writes.
|
|
99
99
|
#
|
|
100
100
|
# Current support:
|
|
101
|
-
# - terminal runtime-record cleanup for structured
|
|
101
|
+
# - terminal runtime-record cleanup for structured session/request metadata in `runtime.sqlite`
|
|
102
102
|
# - oldest-first deletion by time policy and/or size policy
|
|
103
103
|
# - background scheduling inside the harness lifecycle
|
|
104
104
|
#
|
|
@@ -124,17 +124,17 @@ spec:
|
|
|
124
124
|
sweepBatchSize: 100
|
|
125
125
|
vacuum: false
|
|
126
126
|
|
|
127
|
-
# agent-harness feature: runtime-managed recovery policy for interrupted
|
|
127
|
+
# agent-harness feature: runtime-managed recovery policy for interrupted requests.
|
|
128
128
|
# This keeps checkpoint resume as an internal lifecycle concern instead of a primary user-facing API concept.
|
|
129
129
|
#
|
|
130
130
|
# Current support:
|
|
131
|
-
# - startup recovery of
|
|
131
|
+
# - startup recovery of requests already in `resuming` state
|
|
132
132
|
# - persisted approval-decision intent for cross-restart resume continuation
|
|
133
133
|
# - bounded retry attempts to avoid infinite restart loops
|
|
134
134
|
#
|
|
135
135
|
recovery:
|
|
136
136
|
enabled: true
|
|
137
|
-
|
|
137
|
+
resumeResumingRequestsOnStartup: true
|
|
138
138
|
maxRecoveryAttempts: 3
|
|
139
139
|
|
|
140
140
|
# agent-harness feature: runtime-managed resilience policy for transient provider failures.
|
package/dist/contracts/core.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export type RuntimeCapabilities = {
|
|
|
4
4
|
delegation?: boolean;
|
|
5
5
|
memory?: boolean;
|
|
6
6
|
};
|
|
7
|
-
export type
|
|
7
|
+
export type RequestState = "queued" | "claimed" | "running" | "waiting_for_approval" | "resuming" | "cancelling" | "cancelled" | "completed" | "failed";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RequestState } from "./core.js";
|
|
2
2
|
import type { CompiledAgentBinding, CompiledModel, CompiledTool, ParsedAgentObject, ParsedToolObject, WorkspaceBundle } from "./workspace.js";
|
|
3
3
|
/**
|
|
4
4
|
* Persisted runtime summary for an inspectable conversation session.
|
|
@@ -10,7 +10,7 @@ export type SessionSummary = {
|
|
|
10
10
|
latestRequestId: string;
|
|
11
11
|
createdAt: string;
|
|
12
12
|
updatedAt: string;
|
|
13
|
-
status:
|
|
13
|
+
status: RequestState;
|
|
14
14
|
currentAgentId?: string;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
@@ -25,9 +25,7 @@ export type SessionListSummary = SessionSummary & {
|
|
|
25
25
|
title?: string;
|
|
26
26
|
snippet?: string;
|
|
27
27
|
};
|
|
28
|
-
export type
|
|
29
|
-
export type ThreadListSummary = SessionListSummary;
|
|
30
|
-
export type KnownHarnessEventType = "run.created" | "run.queued" | "run.dequeued" | "run.state.changed" | "run.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "runtime.health.changed" | "runtime.synthetic_fallback";
|
|
28
|
+
export type KnownHarnessEventType = "request.created" | "request.queued" | "request.dequeued" | "request.state.changed" | "request.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "runtime.health.changed" | "runtime.synthetic_fallback";
|
|
31
29
|
export type HarnessEventType = KnownHarnessEventType | (string & {});
|
|
32
30
|
/**
|
|
33
31
|
* Persisted runtime event recorded by the harness runtime.
|
|
@@ -62,7 +60,7 @@ export type RuntimeTimelineItem = {
|
|
|
62
60
|
timestamp: string;
|
|
63
61
|
sequence: number;
|
|
64
62
|
source: HarnessEvent["source"];
|
|
65
|
-
kind: "
|
|
63
|
+
kind: "request" | "queue" | "approval" | "recovery" | "artifact" | "other";
|
|
66
64
|
payload: Record<string, unknown>;
|
|
67
65
|
};
|
|
68
66
|
export type RuntimeTimelineProjectionOptions = {
|
|
@@ -109,9 +107,9 @@ export type AgentReference = {
|
|
|
109
107
|
};
|
|
110
108
|
export type RuntimeQueueDiagnostics = {
|
|
111
109
|
status: HealthStatus;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
activeRequestSlots: number;
|
|
111
|
+
pendingRequestSlots: number;
|
|
112
|
+
stuckRequests: number;
|
|
115
113
|
queueEvents: RuntimeTimelineItem[];
|
|
116
114
|
summary: string;
|
|
117
115
|
};
|
|
@@ -135,10 +133,10 @@ export type RuntimeOperatorOverview = {
|
|
|
135
133
|
total: number;
|
|
136
134
|
items: ApprovalRecord[];
|
|
137
135
|
};
|
|
138
|
-
|
|
136
|
+
requests: {
|
|
139
137
|
total: number;
|
|
140
|
-
states: Partial<Record<
|
|
141
|
-
items:
|
|
138
|
+
states: Partial<Record<RequestState, number>>;
|
|
139
|
+
items: RequestSummary[];
|
|
142
140
|
};
|
|
143
141
|
governance: RuntimeGovernanceDiagnostics;
|
|
144
142
|
};
|
|
@@ -224,7 +222,7 @@ export type MemoryCandidate = {
|
|
|
224
222
|
provenance?: Record<string, unknown>;
|
|
225
223
|
};
|
|
226
224
|
export type MemoryKind = "semantic" | "episodic" | "procedural";
|
|
227
|
-
export type MemoryScope = "
|
|
225
|
+
export type MemoryScope = "session" | "agent" | "workspace" | "user" | "project";
|
|
228
226
|
export type MemoryRecordStatus = "active" | "stale" | "conflicted" | "archived" | "pending_review";
|
|
229
227
|
export type MemoryDecisionAction = "reject" | "store" | "merge" | "refresh" | "supersede" | "archive" | "review";
|
|
230
228
|
export type MemoryRecord = {
|
|
@@ -399,10 +397,10 @@ export type RuntimeHealthSnapshot = {
|
|
|
399
397
|
};
|
|
400
398
|
symptoms: RuntimeHealthSymptom[];
|
|
401
399
|
stats: {
|
|
402
|
-
|
|
403
|
-
|
|
400
|
+
activeRequestSlots: number;
|
|
401
|
+
pendingRequestSlots: number;
|
|
404
402
|
pendingApprovals: number;
|
|
405
|
-
|
|
403
|
+
stuckRequests: number;
|
|
406
404
|
checkpointBytes?: number;
|
|
407
405
|
runtimeDbBytes?: number;
|
|
408
406
|
artifactBytes?: number;
|
|
@@ -410,10 +408,10 @@ export type RuntimeHealthSnapshot = {
|
|
|
410
408
|
llmP95LatencyMs1m?: number;
|
|
411
409
|
};
|
|
412
410
|
};
|
|
413
|
-
export type
|
|
411
|
+
export type RequestResult = {
|
|
414
412
|
sessionId: string;
|
|
415
413
|
requestId: string;
|
|
416
|
-
state:
|
|
414
|
+
state: RequestState;
|
|
417
415
|
output: string;
|
|
418
416
|
finalMessageText?: string;
|
|
419
417
|
outputContent?: unknown;
|
|
@@ -439,7 +437,7 @@ export type RuntimeListeners = {
|
|
|
439
437
|
onUpstreamEvent?: (event: UpstreamRuntimeEvent) => void | Promise<void>;
|
|
440
438
|
onTraceItem?: (item: UpstreamRuntimeEventItem) => void | Promise<void>;
|
|
441
439
|
};
|
|
442
|
-
export type
|
|
440
|
+
export type RequestListeners = RuntimeListeners;
|
|
443
441
|
export type MessageContentPart = {
|
|
444
442
|
type: "text";
|
|
445
443
|
text: string;
|
|
@@ -454,23 +452,23 @@ export type InvocationEnvelope = {
|
|
|
454
452
|
attachments?: Record<string, unknown>;
|
|
455
453
|
capabilities?: Record<string, unknown>;
|
|
456
454
|
};
|
|
457
|
-
export type
|
|
455
|
+
export type RequestStartOptions = {
|
|
458
456
|
agentId?: string;
|
|
459
457
|
input: MessageContent;
|
|
460
458
|
sessionId?: string;
|
|
461
459
|
priority?: number;
|
|
462
460
|
invocation?: InvocationEnvelope;
|
|
463
|
-
listeners?:
|
|
461
|
+
listeners?: RequestListeners;
|
|
464
462
|
};
|
|
465
|
-
export type
|
|
463
|
+
export type RequestDecisionOptions = {
|
|
466
464
|
sessionId: string;
|
|
467
465
|
requestId?: string;
|
|
468
466
|
approvalId?: string;
|
|
469
467
|
decision: "approve" | "edit" | "reject";
|
|
470
468
|
editedInput?: Record<string, unknown>;
|
|
471
|
-
listeners?:
|
|
469
|
+
listeners?: RequestListeners;
|
|
472
470
|
};
|
|
473
|
-
export type
|
|
471
|
+
export type RequestOptions = RequestStartOptions | RequestDecisionOptions;
|
|
474
472
|
export type HarnessStreamItem = {
|
|
475
473
|
type: "event";
|
|
476
474
|
event: HarnessEvent;
|
|
@@ -502,7 +500,7 @@ export type HarnessStreamItem = {
|
|
|
502
500
|
event: UpstreamRuntimeEvent;
|
|
503
501
|
} | {
|
|
504
502
|
type: "result";
|
|
505
|
-
result:
|
|
503
|
+
result: RequestResult;
|
|
506
504
|
};
|
|
507
505
|
export type TranscriptMessage = {
|
|
508
506
|
role: "user" | "assistant";
|
|
@@ -510,16 +508,16 @@ export type TranscriptMessage = {
|
|
|
510
508
|
requestId: string;
|
|
511
509
|
createdAt: string;
|
|
512
510
|
};
|
|
513
|
-
export type
|
|
511
|
+
export type SessionRequestRecord = {
|
|
514
512
|
requestId: string;
|
|
515
513
|
sessionId: string;
|
|
516
514
|
agentId: string;
|
|
517
|
-
|
|
515
|
+
parentRequestId?: string;
|
|
518
516
|
executionMode: string;
|
|
519
517
|
adapterKind?: string;
|
|
520
518
|
createdAt: string;
|
|
521
519
|
updatedAt: string;
|
|
522
|
-
state:
|
|
520
|
+
state: RequestState;
|
|
523
521
|
checkpointRef: string | null;
|
|
524
522
|
resumable: boolean;
|
|
525
523
|
startedAt: string;
|
|
@@ -533,13 +531,11 @@ export type ThreadRunRecord = {
|
|
|
533
531
|
* Persisted request summary projected from upstream execution state plus runtime lifecycle metadata.
|
|
534
532
|
* This is the canonical runtime-facing execution record.
|
|
535
533
|
*/
|
|
536
|
-
export type RequestSummary =
|
|
534
|
+
export type RequestSummary = SessionRequestRecord;
|
|
537
535
|
export type RequestRecord = RequestSummary & {
|
|
538
536
|
traceItems?: unknown[];
|
|
539
537
|
runtimeTimeline?: RuntimeTimelineItem[];
|
|
540
538
|
};
|
|
541
|
-
export type RunSummary = RequestSummary;
|
|
542
|
-
export type RunRecord = RequestRecord;
|
|
543
539
|
/**
|
|
544
540
|
* Persisted session inspection record assembled from runtime records.
|
|
545
541
|
* This is an inspectable projection, not a second session semantic model.
|
|
@@ -548,7 +544,7 @@ export type SessionRecord = {
|
|
|
548
544
|
sessionId: string;
|
|
549
545
|
entryAgentId: string;
|
|
550
546
|
currentAgentId?: string;
|
|
551
|
-
currentState:
|
|
547
|
+
currentState: RequestState;
|
|
552
548
|
latestRequestId: string;
|
|
553
549
|
createdAt: string;
|
|
554
550
|
updatedAt: string;
|
|
@@ -562,7 +558,6 @@ export type SessionRecord = {
|
|
|
562
558
|
requestedAt: string;
|
|
563
559
|
};
|
|
564
560
|
};
|
|
565
|
-
export type ThreadRecord = SessionRecord;
|
|
566
561
|
export type ResumeOptions = {
|
|
567
562
|
sessionId?: string;
|
|
568
563
|
requestId?: string;
|
|
@@ -576,7 +571,7 @@ export type CancelOptions = {
|
|
|
576
571
|
};
|
|
577
572
|
export type RestartConversationOptions = {
|
|
578
573
|
sessionId: string;
|
|
579
|
-
mode: "restart-in-
|
|
574
|
+
mode: "restart-in-session" | "restart-new-session";
|
|
580
575
|
input: string;
|
|
581
576
|
};
|
|
582
577
|
/**
|
|
@@ -714,7 +709,7 @@ export type RuntimeEvaluationArtifact = ArtifactRecord & {
|
|
|
714
709
|
export type RuntimeEvaluationExport = {
|
|
715
710
|
session: SessionRecord | null;
|
|
716
711
|
request: RequestRecord | null;
|
|
717
|
-
|
|
712
|
+
requestInput: {
|
|
718
713
|
input: MessageContent;
|
|
719
714
|
invocation?: InvocationEnvelope;
|
|
720
715
|
priority?: number;
|
|
@@ -742,12 +737,12 @@ export type RuntimeEvaluationReplayResult = {
|
|
|
742
737
|
invocation?: InvocationEnvelope;
|
|
743
738
|
sessionId?: string;
|
|
744
739
|
};
|
|
745
|
-
result:
|
|
740
|
+
result: RequestResult;
|
|
746
741
|
assertions: {
|
|
747
742
|
expectedOutputMatched?: boolean;
|
|
748
743
|
};
|
|
749
744
|
};
|
|
750
|
-
export type
|
|
745
|
+
export type RuntimeRequestPackageInput = {
|
|
751
746
|
sessionId: string;
|
|
752
747
|
requestId: string;
|
|
753
748
|
includeArtifacts?: boolean;
|
|
@@ -769,7 +764,7 @@ export type RuntimeGovernanceEvidence = {
|
|
|
769
764
|
approvalSummary: RuntimeApprovalSummary;
|
|
770
765
|
summary: string;
|
|
771
766
|
};
|
|
772
|
-
export type
|
|
767
|
+
export type RuntimeRequestPackage = {
|
|
773
768
|
session: SessionRecord | null;
|
|
774
769
|
request: RequestRecord | null;
|
|
775
770
|
approvals: ApprovalRecord[];
|
|
@@ -790,9 +785,9 @@ export type RuntimeSessionPackage = {
|
|
|
790
785
|
requests: RequestRecord[];
|
|
791
786
|
approvals: ApprovalRecord[];
|
|
792
787
|
transcript: TranscriptMessage[];
|
|
793
|
-
|
|
788
|
+
requestsPackages: RuntimeRequestPackage[];
|
|
794
789
|
governance: {
|
|
795
|
-
|
|
790
|
+
requests: Array<{
|
|
796
791
|
requestId: string;
|
|
797
792
|
evidence: RuntimeGovernanceEvidence;
|
|
798
793
|
}>;
|
|
@@ -6,7 +6,7 @@ export type ParsedAgentObject = {
|
|
|
6
6
|
capabilities?: RuntimeCapabilities;
|
|
7
7
|
description: string;
|
|
8
8
|
modelRef: string;
|
|
9
|
-
|
|
9
|
+
runtimeRoot?: string;
|
|
10
10
|
applicationRoot?: string;
|
|
11
11
|
dataRoot?: string;
|
|
12
12
|
runtimeProfile?: string;
|
|
@@ -266,7 +266,7 @@ export type CompiledAgentBinding = {
|
|
|
266
266
|
applicationRoot?: string;
|
|
267
267
|
dataRoot?: string;
|
|
268
268
|
runtimeProfile?: string;
|
|
269
|
-
|
|
269
|
+
runtimeRoot: string;
|
|
270
270
|
workspaceRoot?: string;
|
|
271
271
|
capabilities?: RuntimeCapabilities;
|
|
272
272
|
resilience?: Record<string, unknown>;
|