@botbotgo/agent-harness 0.0.297 → 0.0.299

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.
Files changed (166) hide show
  1. package/README.md +77 -37
  2. package/README.zh.md +79 -30
  3. package/dist/acp.d.ts +3 -0
  4. package/dist/acp.js +10 -2
  5. package/dist/api.d.ts +14 -2
  6. package/dist/api.js +19 -3
  7. package/dist/cli.d.ts +18 -1
  8. package/dist/cli.js +1408 -319
  9. package/dist/client/acp.d.ts +9 -3
  10. package/dist/client/acp.js +55 -1
  11. package/dist/client/in-process.d.ts +5 -2
  12. package/dist/client/in-process.js +4 -6
  13. package/dist/client/index.d.ts +1 -1
  14. package/dist/client/types.d.ts +6 -5
  15. package/dist/config/agents/direct.yaml +7 -17
  16. package/dist/config/agents/orchestra.yaml +9 -65
  17. package/dist/config/catalogs/embedding-models.yaml +1 -1
  18. package/dist/config/catalogs/stores.yaml +1 -1
  19. package/dist/config/knowledge/knowledge-runtime.yaml +36 -2
  20. package/dist/config/knowledge/procedural-memory-runtime.yaml +78 -0
  21. package/dist/config/{catalogs/models.yaml → models.yaml} +2 -2
  22. package/dist/config/prompts/direct-system.md +16 -0
  23. package/dist/config/prompts/orchestra-system.md +62 -0
  24. package/dist/config/prompts/routing-system.md +14 -0
  25. package/dist/config/runtime/runtime-memory.yaml +39 -5
  26. package/dist/config/runtime/workspace.yaml +7 -16
  27. package/dist/contracts/runtime.d.ts +242 -1
  28. package/dist/contracts/workspace.d.ts +2 -0
  29. package/dist/index.d.ts +5 -3
  30. package/dist/index.js +2 -1
  31. package/dist/init-project.js +178 -33
  32. package/dist/knowledge/contracts.d.ts +5 -0
  33. package/dist/knowledge/module.d.ts +5 -0
  34. package/dist/knowledge/module.js +340 -18
  35. package/dist/package-version.d.ts +1 -1
  36. package/dist/package-version.js +1 -1
  37. package/dist/persistence/file-store.d.ts +5 -1
  38. package/dist/persistence/file-store.js +16 -0
  39. package/dist/persistence/sqlite-store.d.ts +4 -1
  40. package/dist/persistence/sqlite-store.js +88 -14
  41. package/dist/persistence/types.d.ts +4 -1
  42. package/dist/procedural/config.d.ts +63 -0
  43. package/dist/procedural/config.js +125 -0
  44. package/dist/procedural/index.d.ts +2 -0
  45. package/dist/procedural/index.js +1 -0
  46. package/dist/protocol/ag-ui/http.d.ts +3 -0
  47. package/dist/protocol/ag-ui/http.js +10 -0
  48. package/dist/request-events.d.ts +63 -0
  49. package/dist/request-events.js +400 -0
  50. package/dist/resource/isolation.js +11 -0
  51. package/dist/resource/resource-impl.d.ts +1 -0
  52. package/dist/resource/resource-impl.js +103 -12
  53. package/dist/resources/init-templates/agent-context/deep-research.md +5 -0
  54. package/dist/resources/init-templates/prompts/research-analyst-basic.md +1 -0
  55. package/dist/resources/init-templates/prompts/research-analyst-web-search.md +1 -0
  56. package/dist/resources/init-templates/prompts/research-host-deep-research-basic.md +1 -0
  57. package/dist/resources/init-templates/prompts/research-host-deep-research-web-search.md +1 -0
  58. package/dist/resources/init-templates/prompts/research-host-single-agent-basic.md +1 -0
  59. package/dist/resources/init-templates/prompts/research-host-single-agent-web-search.md +1 -0
  60. package/dist/resources/prompts/runtime/browser-capability-disclaimer-recovery.md +1 -0
  61. package/dist/resources/prompts/runtime/default-subagent.md +2 -0
  62. package/dist/resources/prompts/runtime/durable-memory-context.md +7 -0
  63. package/dist/resources/prompts/runtime/execution-with-tool-evidence-retry.md +1 -0
  64. package/dist/resources/prompts/runtime/execution-with-tool-evidence.md +1 -0
  65. package/dist/resources/prompts/runtime/invalid-tool-selection-recovery.md +1 -0
  66. package/dist/resources/prompts/runtime/memory-manager.md +31 -0
  67. package/dist/resources/prompts/runtime/memory-mutation-reconciliation.md +22 -0
  68. package/dist/resources/prompts/runtime/slash-command-skill.md +6 -0
  69. package/dist/resources/prompts/runtime/strict-tool-json.md +1 -0
  70. package/dist/resources/prompts/runtime/workspace-boundary-guidance.md +3 -0
  71. package/dist/resources/prompts/runtime/workspace-relative-path.md +1 -0
  72. package/dist/resources/prompts/runtime/write-todos-descriptive-content.md +1 -0
  73. package/dist/resources/prompts/runtime/write-todos-full-entry.md +1 -0
  74. package/dist/resources/prompts/runtime/write-todos-non-empty-initial-list.md +1 -0
  75. package/dist/resources/tools/_runtime_tool_helpers.mjs +152 -0
  76. package/dist/resources/tools/cancel_request.mjs +21 -0
  77. package/dist/resources/tools/fetch_url.mjs +23 -0
  78. package/dist/resources/tools/http_request.mjs +30 -0
  79. package/dist/resources/tools/inspect_approvals.mjs +27 -0
  80. package/dist/resources/tools/inspect_artifacts.mjs +21 -0
  81. package/dist/resources/tools/inspect_events.mjs +21 -0
  82. package/dist/resources/tools/inspect_requests.mjs +27 -0
  83. package/dist/resources/tools/inspect_sessions.mjs +21 -0
  84. package/dist/resources/tools/list_files.mjs +27 -0
  85. package/dist/resources/tools/read_artifact.mjs +22 -0
  86. package/dist/resources/tools/request_approval.mjs +27 -0
  87. package/dist/resources/tools/run_command.mjs +21 -0
  88. package/dist/resources/tools/schedule_task.mjs +76 -0
  89. package/dist/resources/tools/search_files.mjs +47 -0
  90. package/dist/resources/tools/send_message.mjs +23 -0
  91. package/dist/runtime/adapter/direct-builtin-utility.d.ts +1 -0
  92. package/dist/runtime/adapter/direct-builtin-utility.js +90 -0
  93. package/dist/runtime/adapter/flow/execution-context.d.ts +1 -1
  94. package/dist/runtime/adapter/flow/execution-context.js +1 -1
  95. package/dist/runtime/adapter/flow/invocation-flow.d.ts +1 -0
  96. package/dist/runtime/adapter/flow/invocation-flow.js +9 -1
  97. package/dist/runtime/adapter/flow/invoke-runtime.d.ts +1 -1
  98. package/dist/runtime/adapter/flow/stream-runtime.d.ts +5 -1
  99. package/dist/runtime/adapter/flow/stream-runtime.js +556 -35
  100. package/dist/runtime/adapter/invocation-result.js +3 -2
  101. package/dist/runtime/adapter/local-tool-invocation.d.ts +1 -1
  102. package/dist/runtime/adapter/local-tool-invocation.js +28 -4
  103. package/dist/runtime/adapter/middleware-assembly.js +3 -1
  104. package/dist/runtime/adapter/model/invocation-request.d.ts +4 -1
  105. package/dist/runtime/adapter/model/invocation-request.js +138 -16
  106. package/dist/runtime/adapter/model/message-assembly.js +2 -6
  107. package/dist/runtime/adapter/model/model-providers.js +103 -5
  108. package/dist/runtime/adapter/resilience.js +17 -2
  109. package/dist/runtime/adapter/runtime-adapter-support.d.ts +11 -7
  110. package/dist/runtime/adapter/runtime-adapter-support.js +39 -5
  111. package/dist/runtime/adapter/tool/builtin-middleware-tools.d.ts +63 -1
  112. package/dist/runtime/adapter/tool/builtin-middleware-tools.js +193 -21
  113. package/dist/runtime/adapter/tool/tool-arguments.d.ts +3 -1
  114. package/dist/runtime/adapter/tool/tool-arguments.js +52 -17
  115. package/dist/runtime/adapter/tool-resolution.d.ts +1 -0
  116. package/dist/runtime/adapter/tool-resolution.js +4 -2
  117. package/dist/runtime/agent-runtime-adapter.d.ts +27 -0
  118. package/dist/runtime/agent-runtime-adapter.js +163 -11
  119. package/dist/runtime/harness/events/event-bus.d.ts +1 -0
  120. package/dist/runtime/harness/events/event-bus.js +3 -0
  121. package/dist/runtime/harness/events/event-sink.d.ts +3 -0
  122. package/dist/runtime/harness/events/event-sink.js +16 -7
  123. package/dist/runtime/harness/events/streaming.d.ts +18 -1
  124. package/dist/runtime/harness/events/streaming.js +23 -10
  125. package/dist/runtime/harness/run/inspection.js +26 -5
  126. package/dist/runtime/harness/run/stream-run.d.ts +13 -4
  127. package/dist/runtime/harness/run/stream-run.js +448 -4
  128. package/dist/runtime/harness/run/surface-semantics.js +7 -34
  129. package/dist/runtime/harness/system/runtime-memory-manager.d.ts +3 -0
  130. package/dist/runtime/harness/system/runtime-memory-manager.js +384 -69
  131. package/dist/runtime/harness/system/runtime-memory-policy.d.ts +20 -1
  132. package/dist/runtime/harness/system/runtime-memory-policy.js +65 -17
  133. package/dist/runtime/harness/system/runtime-memory-records.js +100 -0
  134. package/dist/runtime/harness/system/runtime-memory-sync.js +2 -2
  135. package/dist/runtime/harness/system/store.d.ts +4 -0
  136. package/dist/runtime/harness/system/store.js +153 -0
  137. package/dist/runtime/harness.d.ts +9 -1
  138. package/dist/runtime/harness.js +141 -7
  139. package/dist/runtime/maintenance/sqlite-checkpoint-saver.d.ts +8 -3
  140. package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +152 -53
  141. package/dist/runtime/parsing/output-parsing.d.ts +10 -2
  142. package/dist/runtime/parsing/output-parsing.js +223 -16
  143. package/dist/runtime/parsing/stream-event-parsing.d.ts +7 -0
  144. package/dist/runtime/parsing/stream-event-parsing.js +51 -1
  145. package/dist/runtime/scheduling/system-schedule-manager.d.ts +41 -0
  146. package/dist/runtime/scheduling/system-schedule-manager.js +532 -0
  147. package/dist/runtime/support/embedding-models.d.ts +1 -1
  148. package/dist/runtime/support/embedding-models.js +5 -2
  149. package/dist/runtime/support/runtime-factories.js +1 -1
  150. package/dist/runtime/support/runtime-layout.d.ts +3 -0
  151. package/dist/runtime/support/runtime-layout.js +10 -1
  152. package/dist/runtime/support/runtime-prompts.d.ts +30 -0
  153. package/dist/runtime/support/runtime-prompts.js +55 -0
  154. package/dist/runtime/support/vector-stores.d.ts +1 -1
  155. package/dist/runtime/support/vector-stores.js +5 -2
  156. package/dist/upstream-events.js +8 -7
  157. package/dist/utils/bundled-text.d.ts +3 -0
  158. package/dist/utils/bundled-text.js +25 -0
  159. package/dist/utils/id.js +3 -2
  160. package/dist/workspace/agent-binding-compiler.js +53 -13
  161. package/dist/workspace/object-loader.js +64 -2
  162. package/dist/workspace/support/workspace-ref-utils.d.ts +2 -1
  163. package/dist/workspace/support/workspace-ref-utils.js +24 -5
  164. package/dist/workspace/yaml-object-reader.d.ts +1 -0
  165. package/dist/workspace/yaml-object-reader.js +95 -17
  166. package/package.json +13 -6
@@ -63,8 +63,8 @@ spec:
63
63
  # agent-harness feature: lifecycle events that can trigger runtime memory digestion.
64
64
  ingestion:
65
65
  backgroundConsolidation: true
66
- writeOnApprovalResolution: true
67
- writeOnRequestCompletion: true
66
+ writeOnApprovalResolution: false
67
+ writeOnRequestCompletion: false
68
68
 
69
69
  # agent-harness feature: LangMem-style memory formation defaults for hot-path and background reflection.
70
70
  formation:
@@ -72,12 +72,46 @@ spec:
72
72
  enabled: true
73
73
  manager:
74
74
  enabled: true
75
- strategy: rules
75
+ strategy: model
76
+ prompt: |-
77
+ You are the runtime memory manager.
78
+ Decide whether a candidate should be stored as durable memory and refine it if appropriate.
79
+ Return JSON only.
80
+
81
+ Rules:
82
+ - Store only durable reusable knowledge. Reject transient chatter, scratchpad, or duplication without added value.
83
+ - Reject raw request/session summaries, source-specific page/news recaps, and generic "we learned how to use the tools/workflow" reflections unless they clearly contain reusable preferences, facts, decisions, or procedures.
84
+ - If transcript evidence shows the user explicitly asked the system to remember or follow a future instruction and the assistant confirmed that intent, store the durable instruction instead of rejecting it as a generic summary.
85
+ - Treat durable knowledge as generic mutable records with database-like operations over the same underlying knowledge item.
86
+ - One candidate may yield zero, one, or multiple durable knowledge items. Split it only when the input clearly contains multiple independently mutable knowledge points.
87
+ - When storing a knowledge item, always return a `knowledgeMutation` object with a stable `identity` and an `operation` of `create`, `update`, or `delete`.
88
+ - Keep `knowledgeMutation.identity` stable across revisions of the same knowledge point, even when the wording changes.
89
+ - Use `create` for a newly introduced knowledge item, `update` for a revised active state of an existing knowledge item, and `delete` when the candidate says an existing knowledge item should no longer remain active.
90
+ - If an existing relevant record already represents the same underlying knowledge item, reuse that record's `knowledge_identity` instead of inventing a new one.
91
+ - Do not invent a second identity just because the new statement negates, revokes, deletes, or replaces the old wording. That is usually the same knowledge item with a different mutation operation.
92
+ - The stored `content` must be canonical knowledge text, not an assistant acknowledgement such as "已记住" or "I will remember".
93
+ - You may optionally include `operationalRule` when the knowledge is naturally a rule, instruction, or recurring procedure. Treat it as structured metadata, not as the primary identity mechanism.
94
+ - Prefer semantic/episodic/procedural kinds only.
95
+ - Prefer scopes session/agent/workspace/user/project only.
96
+ - If the candidate should not be stored, return {"store": false, "reason": "..."}
97
+ - If the candidate maps to one durable item, you may return {"store": true, "content": "...", "summary": "...", "kind": "...", "scope": "...", "tags": ["..."], "confidence": 0.0, "knowledgeMutation": {"identity": "...", "operation": "create|update|delete"}, "operationalRule": {"trigger": "...", "action": "...", "target": "...", "effect": "apply|invalidate"}}
98
+ - If the candidate maps to multiple durable items, return {"store": true, "mutations": [{"content": "...", "summary": "...", "kind": "...", "scope": "...", "tags": ["..."], "confidence": 0.0, "knowledgeMutation": {"identity": "...", "operation": "create|update|delete"}, "operationalRule": {"trigger": "...", "action": "...", "target": "...", "effect": "apply|invalidate"}}]}
99
+
100
+ sessionId={{sessionId}}
101
+ requestId={{requestId}}
102
+
103
+ Candidate:
104
+ {{candidateJson}}
105
+
106
+ Existing relevant records:
107
+ {{existingRecords}}
76
108
  maxContextRecords: 12
77
109
  background:
78
110
  enabled: true
79
111
  scopes:
80
- - session
112
+ - user
113
+ - project
114
+ - workspace
81
115
  stateStorePath: knowledge/formation-state.json
82
116
  maxMessagesPerRequest: 40
83
117
  writeOnApprovalResolution: true
@@ -85,7 +119,7 @@ spec:
85
119
 
86
120
  # agent-harness feature: optional session snapshot projection for operational state and pending approvals.
87
121
  sessionMemorySync:
88
- enabled: true
122
+ enabled: false
89
123
 
90
124
  # agent-harness feature: optional Mem0 OSS ingestion engine for automatic long-term knowledge extraction.
91
125
  mem0:
@@ -24,7 +24,7 @@ spec:
24
24
  # - runtime/ for requests, approvals, checkpoints, and artifacts
25
25
  # - knowledge/ for durable knowledge and vector indexes
26
26
  # Different runtime profiles can use different data folders while sharing the same application folder.
27
- dataRoot: ./.agent
27
+ dataRoot: ./.botbotgo
28
28
 
29
29
  # agent-harness feature: stable runtime profile identifier for this data folder.
30
30
  profile: default
@@ -77,21 +77,8 @@ spec:
77
77
  regex:
78
78
  - "\\b(create|build|implement|fix|debug|refactor|review|test|ship|release|deploy|code|bug|repo|repository|file|files|download|clone|inspect|analy[sz]e|explore)\\b"
79
79
  - "(写代码|实现|修复|排查|调试|重构|评审|测试|发布|部署|仓库|代码|文件|下载|克隆|分析|检查|探索)"
80
- systemPrompt: |-
81
- You are a routing classifier for an agent harness. Reply with exactly one agent id:
82
- {{primaryAgentId}} or {{secondaryAgentId}}.
83
-
84
- Choose {{primaryAgentId}} only for lightweight conversational turns that can be answered directly in one step
85
- without tool use, repository inspection, file lookup, external checkout, or orchestration.
86
-
87
- Choose {{secondaryAgentId}} for requests that need tools, multi-step execution, external research, repository or
88
- file analysis, downloading or cloning content, codebase exploration, verification, or any task where the agent
89
- should inspect the workspace or another repository before answering.
90
-
91
- If the request asks to download, clone, fetch, inspect, analyze, trace, or locate implementation in a repo or
92
- codebase, choose {{secondaryAgentId}}.
93
-
94
- When uncertain, prefer {{secondaryAgentId}}.
80
+ systemPrompt:
81
+ path: ../prompts/routing-system.md
95
82
 
96
83
  # agent-harness feature: optional workspace-level background maintenance policies.
97
84
  # This is the runtime-owned place to configure periodic housekeeping that should run without
@@ -156,6 +143,10 @@ spec:
156
143
  - socket hang up
157
144
  - econnreset
158
145
  - timed out
146
+ - internal server error
147
+ - service unavailable
148
+ - bad gateway
149
+ - too many requests
159
150
 
160
151
  # agent-harness feature: runtime-owned governance defaults for remote MCP access and approval escalation.
161
152
  # Keep transport-specific and trust-specific policy here rather than scattering it across app code.
@@ -219,12 +219,23 @@ export type MemoryCandidate = {
219
219
  observedAt?: string;
220
220
  sensitivity?: string;
221
221
  noStore?: boolean;
222
+ knowledgeMutation?: {
223
+ identity: string;
224
+ operation?: "create" | "update" | "delete";
225
+ };
226
+ operationalRule?: {
227
+ trigger: string;
228
+ action: string;
229
+ target: string;
230
+ effect?: "apply" | "invalidate";
231
+ };
222
232
  provenance?: Record<string, unknown>;
223
233
  };
224
234
  export type MemoryKind = "semantic" | "episodic" | "procedural";
225
235
  export type MemoryScope = "session" | "agent" | "workspace" | "user" | "project";
226
236
  export type MemoryRecordStatus = "active" | "stale" | "conflicted" | "archived" | "pending_review";
227
237
  export type MemoryDecisionAction = "reject" | "store" | "merge" | "refresh" | "supersede" | "archive" | "review";
238
+ export type KnowledgeMutationOperation = "create" | "update" | "delete";
228
239
  export type MemoryRecord = {
229
240
  id: string;
230
241
  canonicalKey: string;
@@ -241,6 +252,14 @@ export type MemoryRecord = {
241
252
  sourceType: string;
242
253
  sourceRefs: string[];
243
254
  tags: string[];
255
+ knowledgeIdentity?: string;
256
+ knowledgeOperation?: KnowledgeMutationOperation;
257
+ operationalRule?: {
258
+ trigger: string;
259
+ action: string;
260
+ target: string;
261
+ effect?: "apply" | "invalidate";
262
+ };
244
263
  provenance: Record<string, unknown>;
245
264
  revision: number;
246
265
  supersedes: string[];
@@ -267,6 +286,16 @@ export type MemorizeInputRecord = {
267
286
  sourceRef?: string;
268
287
  observedAt?: string;
269
288
  sensitivity?: string;
289
+ knowledgeMutation?: {
290
+ identity: string;
291
+ operation?: KnowledgeMutationOperation;
292
+ };
293
+ operationalRule?: {
294
+ trigger: string;
295
+ action: string;
296
+ target: string;
297
+ effect?: "apply" | "invalidate";
298
+ };
270
299
  provenance?: Record<string, unknown>;
271
300
  noStore?: boolean;
272
301
  };
@@ -333,6 +362,8 @@ export type UpdateMemoryInput = {
333
362
  tags?: string[];
334
363
  observedAt?: string;
335
364
  lastConfirmedAt?: string;
365
+ knowledgeIdentity?: string;
366
+ knowledgeOperation?: KnowledgeMutationOperation;
336
367
  provenance?: Record<string, unknown>;
337
368
  };
338
369
  export type RemoveMemoryInput = {
@@ -436,8 +467,101 @@ export type RuntimeListeners = {
436
467
  onEvent?: (event: HarnessEvent) => void | Promise<void>;
437
468
  onUpstreamEvent?: (event: UpstreamRuntimeEvent) => void | Promise<void>;
438
469
  onTraceItem?: (item: UpstreamRuntimeEventItem) => void | Promise<void>;
470
+ onPlanState?: (planState: RequestPlanState) => void | Promise<void>;
471
+ };
472
+ export type RequestExecutionStepKind = RuntimeSurfaceKind | "approval";
473
+ export type RequestExecutionStep = {
474
+ id: string;
475
+ kind: RequestExecutionStepKind;
476
+ name: string;
477
+ action: string;
478
+ status: "started" | "completed" | "failed";
479
+ occurredAt?: string;
480
+ startedAt?: string;
481
+ endedAt?: string;
482
+ agentId?: string;
483
+ agentName?: string;
484
+ ownerAgentId?: string;
485
+ ownerAgentName?: string;
486
+ sourceEventId?: string;
487
+ detail?: Record<string, unknown>;
488
+ output?: unknown;
489
+ isError?: boolean;
490
+ };
491
+ export type RequestTodoSnapshot = RequestPlanItem & {
492
+ key: string;
493
+ events: RequestExecutionStep[];
494
+ };
495
+ export type RequestApprovalSnapshot = {
496
+ approvalId?: string;
497
+ pendingActionId?: string;
498
+ toolName?: string;
499
+ status?: ApprovalRecord["status"];
500
+ allowedDecisions?: Array<"approve" | "edit" | "reject">;
501
+ };
502
+ export type RequestEventSnapshot = {
503
+ sessionId: string;
504
+ requestId: string;
505
+ updatedAt: string;
506
+ state: RequestResult["state"];
507
+ agentId?: string;
508
+ plan: {
509
+ version: number;
510
+ updatedAt: string;
511
+ summary: RequestPlanSummary;
512
+ items: RequestTodoSnapshot[];
513
+ };
514
+ activeTodoKey?: string;
515
+ activeEventId?: string;
516
+ approval?: RequestApprovalSnapshot;
517
+ output: string;
518
+ contentBlocks?: unknown[];
519
+ structuredResponse?: unknown;
520
+ interruptContent?: string;
521
+ events: RequestExecutionStep[];
522
+ };
523
+ export type RequestDataEvent = {
524
+ type: "output.text.delta";
525
+ sessionId: string;
526
+ requestId: string;
527
+ agentId: string;
528
+ text: string;
529
+ } | {
530
+ type: "progress.commentary";
531
+ sessionId: string;
532
+ requestId: string;
533
+ agentId: string;
534
+ text: string;
535
+ } | {
536
+ type: "output.content-blocks";
537
+ sessionId: string;
538
+ requestId: string;
539
+ agentId: string;
540
+ contentBlocks: unknown[];
541
+ } | {
542
+ type: "tool.result";
543
+ sessionId: string;
544
+ requestId: string;
545
+ agentId: string;
546
+ toolName: string;
547
+ output: unknown;
548
+ isError?: boolean;
549
+ } | {
550
+ type: "debug.upstream";
551
+ sessionId: string;
552
+ requestId: string;
553
+ surfaceItem?: RuntimeSurfaceItem;
554
+ event: UpstreamRuntimeEvent;
555
+ } | {
556
+ type: "debug.profile";
557
+ sessionId: string;
558
+ requestId: string;
559
+ step: RequestExecutionStep;
560
+ };
561
+ export type RequestListeners = RuntimeListeners & {
562
+ eventListener?: (snapshot: RequestEventSnapshot) => void | Promise<void>;
563
+ dataListener?: (event: RequestDataEvent) => void | Promise<void>;
439
564
  };
440
- export type RequestListeners = RuntimeListeners;
441
565
  export type MessageContentPart = {
442
566
  type: "text";
443
567
  text: string;
@@ -472,6 +596,12 @@ export type RequestOptions = RequestStartOptions | RequestDecisionOptions;
472
596
  export type HarnessStreamItem = {
473
597
  type: "event";
474
598
  event: HarnessEvent;
599
+ } | {
600
+ type: "commentary";
601
+ sessionId: string;
602
+ requestId: string;
603
+ agentId: string;
604
+ content: string;
475
605
  } | {
476
606
  type: "content";
477
607
  sessionId: string;
@@ -492,12 +622,23 @@ export type HarnessStreamItem = {
492
622
  toolName: string;
493
623
  output: unknown;
494
624
  isError?: boolean;
625
+ } | {
626
+ type: "plan-state";
627
+ sessionId: string;
628
+ requestId: string;
629
+ agentId: string;
630
+ planState: RequestPlanState;
495
631
  } | {
496
632
  type: "upstream-event";
497
633
  sessionId: string;
498
634
  requestId: string;
499
635
  surfaceItem?: RuntimeSurfaceItem;
500
636
  event: UpstreamRuntimeEvent;
637
+ } | {
638
+ type: "profile-step";
639
+ sessionId: string;
640
+ requestId: string;
641
+ step: RequestExecutionStep;
501
642
  } | {
502
643
  type: "result";
503
644
  result: RequestResult;
@@ -536,6 +677,34 @@ export type RequestRecord = RequestSummary & {
536
677
  traceItems?: unknown[];
537
678
  runtimeTimeline?: RuntimeTimelineItem[];
538
679
  };
680
+ export type RequestPlanItemStatus = "pending" | "in_progress" | "completed" | "failed" | "cancelled" | "blocked" | (string & {});
681
+ export type RequestPlanItem = {
682
+ id?: string;
683
+ content: string;
684
+ status: RequestPlanItemStatus;
685
+ ownerAgentId?: string;
686
+ startedAt?: string;
687
+ endedAt?: string;
688
+ result?: unknown;
689
+ metadata?: Record<string, unknown>;
690
+ };
691
+ export type RequestPlanSummary = {
692
+ total: number;
693
+ pending: number;
694
+ inProgress: number;
695
+ completed: number;
696
+ failed: number;
697
+ cancelled: number;
698
+ blocked: number;
699
+ };
700
+ export type RequestPlanState = {
701
+ sessionId: string;
702
+ requestId: string;
703
+ version: number;
704
+ updatedAt: string;
705
+ items: RequestPlanItem[];
706
+ summary: RequestPlanSummary;
707
+ };
539
708
  /**
540
709
  * Persisted session inspection record assembled from runtime records.
541
710
  * This is an inspectable projection, not a second session semantic model.
@@ -622,6 +791,72 @@ export type RuntimeDeclaredMiddlewareResolver = (input: {
622
791
  export type RuntimeCheckpointerResolver = (binding: CompiledAgentBinding) => unknown;
623
792
  export type RuntimeStoreResolver = (binding: CompiledAgentBinding) => unknown;
624
793
  export type RuntimeBackendResolver = (binding: CompiledAgentBinding) => unknown;
794
+ export type RuntimeScheduleDefinition = {
795
+ type: "cron";
796
+ expression: string;
797
+ } | {
798
+ type: "interval";
799
+ everyMinutes: number;
800
+ } | {
801
+ type: "daily";
802
+ time: string;
803
+ } | {
804
+ type: "weekly";
805
+ time: string;
806
+ days: string[];
807
+ };
808
+ export type RuntimeScheduleStatus = "active" | "missing";
809
+ export type RuntimeScheduleSource = "crontab" | "schtasks";
810
+ export type RuntimeScheduleRecord = {
811
+ scheduleId: string;
812
+ name: string;
813
+ instruction: string;
814
+ agentId?: string;
815
+ schedule: RuntimeScheduleDefinition;
816
+ source: RuntimeScheduleSource;
817
+ platform: NodeJS.Platform;
818
+ status: RuntimeScheduleStatus;
819
+ systemId: string;
820
+ createdAt: string;
821
+ updatedAt: string;
822
+ metadata?: Record<string, unknown>;
823
+ };
824
+ export type RuntimeScheduleListFilter = {
825
+ scheduleId?: string;
826
+ name?: string;
827
+ agentId?: string;
828
+ source?: RuntimeScheduleSource;
829
+ status?: RuntimeScheduleStatus;
830
+ query?: string;
831
+ };
832
+ export type RuntimeScheduleManageInput = {
833
+ operation?: "create" | "list" | "get" | "update" | "delete";
834
+ scheduleId?: string;
835
+ name?: string;
836
+ instruction?: string;
837
+ agentId?: string;
838
+ schedule?: RuntimeScheduleDefinition;
839
+ metadata?: Record<string, unknown>;
840
+ filters?: RuntimeScheduleListFilter;
841
+ };
842
+ export type RuntimeScheduleManageResult = {
843
+ ok: true;
844
+ operation: "create" | "get" | "update";
845
+ schedule: RuntimeScheduleRecord;
846
+ } | {
847
+ ok: true;
848
+ operation: "list";
849
+ items: RuntimeScheduleRecord[];
850
+ total: number;
851
+ } | {
852
+ ok: true;
853
+ operation: "delete";
854
+ scheduleId: string;
855
+ };
856
+ export type RuntimeScheduleManager = {
857
+ manageSchedule(input: RuntimeScheduleManageInput): Promise<RuntimeScheduleManageResult>;
858
+ getSchedule(scheduleId: string): Promise<RuntimeScheduleRecord | null>;
859
+ };
625
860
  export type RuntimeAdapterOptions = {
626
861
  toolResolver?: RuntimeToolResolver;
627
862
  modelResolver?: RuntimeModelResolver;
@@ -632,6 +867,12 @@ export type RuntimeAdapterOptions = {
632
867
  checkpointerResolver?: RuntimeCheckpointerResolver;
633
868
  storeResolver?: RuntimeStoreResolver;
634
869
  backendResolver?: RuntimeBackendResolver;
870
+ scheduleManager?: RuntimeScheduleManager;
871
+ functionToolContextResolver?: (input: {
872
+ binding?: CompiledAgentBinding;
873
+ sessionId?: string;
874
+ requestId?: string;
875
+ }) => Record<string, unknown> | undefined;
635
876
  /**
636
877
  * DeepAgent execution semantics stay upstream-owned.
637
878
  * `minimal` keeps harness runtime persistence/ops active while only attaching
@@ -3,6 +3,7 @@ export type ParsedAgentObject = {
3
3
  id: string;
4
4
  executionMode: ExecutionMode;
5
5
  runtimeMemory?: Record<string, unknown>;
6
+ proceduralMemory?: Record<string, unknown>;
6
7
  capabilities?: RuntimeCapabilities;
7
8
  description: string;
8
9
  modelRef: string;
@@ -289,6 +290,7 @@ export type CompiledAgentBinding = {
289
290
  checkpointer?: Record<string, unknown> | boolean;
290
291
  store?: Record<string, unknown>;
291
292
  runtimeMemory?: Record<string, unknown>;
293
+ proceduralMemory?: Record<string, unknown>;
292
294
  };
293
295
  };
294
296
  export type WorkspaceBundle = {
package/dist/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
- export { AgentHarnessAcpServer, AgentHarnessRuntime, cancelRequest, createAgentHarness, createAcpServer, createAcpStdioClient, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportFlow, exportSequence, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getOperatorOverview, getRequest, getHealth, listMemories, listRequestTraceItems, getSession, listAgentSkills, listRequestArtifacts, listApprovals, listRequests, listRequestEvents, listSessionSummaries, listSessions, memorize, normalizeUserChatInput, recordArtifact, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, } from "./api.js";
1
+ export { AgentHarnessAcpServer, AgentHarnessRuntime, cancelRequest, createAgentHarness, createAcpServer, createAcpStdioClient, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportFlow, exportSequence, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getOperatorOverview, getRequestPlanState, getRequest, getHealth, listMemories, listRequestTraceItems, getSession, listAgentSkills, listRequestArtifacts, listApprovals, listRequests, listRequestEvents, listSessionSummaries, listSessions, memorize, normalizeUserChatInput, recordArtifact, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, } from "./api.js";
2
2
  export { AcpHarnessClient, InProcessHarnessClient, createAcpHarnessClient, createAcpHttpHarnessClient, createAcpStdioHarnessClient, createAgentHarnessClient, createInProcessHarnessClient, } from "./client.js";
3
3
  export { createKnowledgeModule, readKnowledgeRuntimeConfig } from "./knowledge/index.js";
4
+ export { readProceduralMemoryRuntimeConfig } from "./procedural/index.js";
4
5
  export type { AcpApproval, AcpHttpClient, AcpHttpClientOptions, AcpArtifact, AcpEventNotification, AcpNotification, AcpJsonRpcError, AcpJsonRpcRequest, AcpJsonRpcResponse, AcpJsonRpcSuccess, AcpRequestRecord, AcpRequestParams, AcpServerCapabilities, AcpSessionRecord, AcpStreamNotification, AcpStdioClient, AcpStdioClientOptions, } from "./acp.js";
5
- export type { Approval, CreateAgentHarnessOptions, ListMemoriesInput, ListMemoriesResult, MemoryDecision, MemoryKind, MemoryRecord, MemoryScope, MemorizeInput, MemorizeResult, NormalizeUserChatInputOptions, OperatorOverview, RecordArtifactInput, PublicRequestListeners, RequestArtifactListing, RequestEvent, RequestEventType, RequestPackage, RequestPackageInput, RequestFlowGraphInput, RequestResult, RequestTraceItem, RecallInput, RecallResult, RemoveMemoryInput, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult, SessionListSummary, RuntimeSessionPackage, RuntimeSessionPackageInput, UpdateMemoryInput, UserChatInput, UserChatMessage, } from "./api.js";
6
- export type { AcpHarnessTransport, HarnessClient, HarnessClientApprovalFilter, HarnessClientRequestFilter, HarnessClientRequestOptions, HarnessClientRequestResult, HarnessClientRequestStartOptions, HarnessClientStreamItem, } from "./client.js";
6
+ export type { Approval, CreateAgentHarnessOptions, ListMemoriesInput, ListMemoriesResult, MemoryDecision, MemoryKind, MemoryRecord, MemoryScope, MemorizeInput, MemorizeResult, NormalizeUserChatInputOptions, OperatorOverview, RecordArtifactInput, PublicRequestListeners, RequestData, RequestArtifactListing, RequestEvent, RequestEventType, RequestSnapshot, RequestPlanState, RequestPackage, RequestPackageInput, RequestFlowGraphInput, RequestResult, RequestTraceItem, RecallInput, RecallResult, RemoveMemoryInput, RuntimeEvaluationExport, RuntimeEvaluationExportInput, RuntimeEvaluationReplayInput, RuntimeEvaluationReplayResult, SessionListSummary, RuntimeSessionPackage, RuntimeSessionPackageInput, UpdateMemoryInput, UserChatInput, UserChatMessage, } from "./api.js";
7
+ export type { AcpHarnessTransport, HarnessClient, HarnessClientApprovalFilter, HarnessClientRequestFilter, HarnessClientRequestOptions, HarnessClientRequestResult, HarnessClientRequestStartOptions, } from "./client.js";
7
8
  export type { KnowledgeListInput, KnowledgeMemorizeInput, KnowledgeModule, KnowledgeModuleDependencies, KnowledgeRecallInput, KnowledgeRuntimeConfig, KnowledgeRuntimeContext, } from "./knowledge/index.js";
9
+ export type { ProceduralMemoryBackgroundConfig, ProceduralMemoryFormationConfig, ProceduralMemoryMaintenanceConfig, ProceduralMemoryMaintenanceIdleConfig, ProceduralMemoryMaintenanceScheduleConfig, ProceduralMemoryProviderConfig, ProceduralMemoryRetrievalConfig, ProceduralMemoryRuntimeConfig, } from "./procedural/index.js";
8
10
  export type { A2aAgentCard, A2aHttpServer, A2aHttpServerOptions, A2aTask, A2aTaskState, AcpHttpServer, AcpHttpServerOptions, AcpStdioServer, AcpStdioServerOptions, AgUiEvent, AgUiHttpServer, AgUiHttpServerOptions, AgUiRequestAgentInput, } from "./api.js";
9
11
  export type { RuntimeMcpServerOptions, ToolMcpServerOptions } from "./mcp.js";
10
12
  export { tool } from "./tools.js";
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export { AgentHarnessAcpServer, AgentHarnessRuntime, cancelRequest, createAgentHarness, createAcpServer, createAcpStdioClient, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportFlow, exportSequence, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getOperatorOverview, getRequest, getHealth, listMemories, listRequestTraceItems, getSession, listAgentSkills, listRequestArtifacts, listApprovals, listRequests, listRequestEvents, listSessionSummaries, listSessions, memorize, normalizeUserChatInput, recordArtifact, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, } from "./api.js";
1
+ export { AgentHarnessAcpServer, AgentHarnessRuntime, cancelRequest, createAgentHarness, createAcpServer, createAcpStdioClient, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, deleteSession, describeInventory, exportEvaluationBundle, exportFlow, exportSequence, exportRequestPackage, exportSessionPackage, replayEvaluationBundle, getArtifact, getAgent, getApproval, getOperatorOverview, getRequestPlanState, getRequest, getHealth, listMemories, listRequestTraceItems, getSession, listAgentSkills, listRequestArtifacts, listApprovals, listRequests, listRequestEvents, listSessionSummaries, listSessions, memorize, normalizeUserChatInput, recordArtifact, request, recall, removeMemory, resolveApproval, serveA2aHttp, serveAcpHttp, serveAcpStdio, serveAgUiHttp, serveRuntimeMcpOverStdio, serveToolsOverStdio, subscribe, stop, updateMemory, } from "./api.js";
2
2
  export { AcpHarnessClient, InProcessHarnessClient, createAcpHarnessClient, createAcpHttpHarnessClient, createAcpStdioHarnessClient, createAgentHarnessClient, createInProcessHarnessClient, } from "./client.js";
3
3
  export { createKnowledgeModule, readKnowledgeRuntimeConfig } from "./knowledge/index.js";
4
+ export { readProceduralMemoryRuntimeConfig } from "./procedural/index.js";
4
5
  export { tool } from "./tools.js";