@botbotgo/agent-harness 0.0.475 → 0.0.476

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 (227) hide show
  1. package/README.md +3 -1234
  2. package/README.zh.md +3 -1191
  3. package/dist/acp.js +1 -1
  4. package/dist/api.js +1 -404
  5. package/dist/benchmark/checkpoint-resume-cost-benchmark.js +1 -55
  6. package/dist/benchmark/deepagent-local-model-benchmark.js +2 -35
  7. package/dist/benchmark/upstream-runtime-ab-benchmark.js +1 -179
  8. package/dist/cli/chat-interactive.js +25 -244
  9. package/dist/cli/chat-rendering.js +6 -100
  10. package/dist/cli/chat-stream.js +23 -512
  11. package/dist/cli/chat-ui.js +21 -199
  12. package/dist/cli/chat-workspace.js +2 -210
  13. package/dist/cli/main.js +21 -428
  14. package/dist/cli/managed-service-commands.js +9 -63
  15. package/dist/cli/managed-service.js +2 -137
  16. package/dist/cli/options-init-chat.js +1 -108
  17. package/dist/cli/options-runtime.js +1 -158
  18. package/dist/cli/options-serve.js +1 -282
  19. package/dist/cli/options.js +2 -19
  20. package/dist/cli/process-guards.js +1 -139
  21. package/dist/cli/request-tree.js +7 -296
  22. package/dist/cli/runtime-commands.js +12 -258
  23. package/dist/cli/runtime-output.js +16 -155
  24. package/dist/cli/server-commands.js +16 -270
  25. package/dist/cli/workspace.js +1 -67
  26. package/dist/cli.js +1 -7
  27. package/dist/client/acp.js +1 -1
  28. package/dist/client/in-process.js +1 -67
  29. package/dist/client/index.js +1 -2
  30. package/dist/client/types.js +0 -1
  31. package/dist/client.js +1 -1
  32. package/dist/contracts/core.js +1 -1
  33. package/dist/contracts/runtime-evaluation.js +0 -1
  34. package/dist/contracts/runtime-memory.js +0 -1
  35. package/dist/contracts/runtime-observability.js +0 -1
  36. package/dist/contracts/runtime-requests.js +0 -1
  37. package/dist/contracts/runtime-scheduling.js +0 -1
  38. package/dist/contracts/runtime.js +1 -27
  39. package/dist/contracts/types.js +1 -3
  40. package/dist/contracts/workspace.js +0 -1
  41. package/dist/flow/build-flow-graph.js +1 -50
  42. package/dist/flow/export-mermaid.js +2 -464
  43. package/dist/flow/export-sequence-mermaid.js +2 -325
  44. package/dist/flow/flow-graph-normalization.js +1 -214
  45. package/dist/flow/flow-graph-runtime.js +1 -107
  46. package/dist/flow/flow-graph-upstream.js +1 -494
  47. package/dist/flow/index.js +1 -3
  48. package/dist/flow/types.js +0 -1
  49. package/dist/index.js +1 -5
  50. package/dist/init-project.js +1 -1
  51. package/dist/knowledge/config.js +1 -32
  52. package/dist/knowledge/contracts.js +0 -1
  53. package/dist/knowledge/index.js +1 -2
  54. package/dist/knowledge/module.js +12 -909
  55. package/dist/knowledge/procedural/config.js +1 -125
  56. package/dist/knowledge/procedural/index.js +1 -2
  57. package/dist/knowledge/procedural/manager.js +9 -345
  58. package/dist/mcp.js +1 -2
  59. package/dist/package-version.d.ts +1 -1
  60. package/dist/package-version.js +1 -2
  61. package/dist/persistence/file-store.js +3 -758
  62. package/dist/persistence/sqlite-request-context-store.js +5 -54
  63. package/dist/persistence/sqlite-request-queue-store.js +10 -108
  64. package/dist/persistence/sqlite-runtime.js +1 -86
  65. package/dist/persistence/sqlite-store.js +62 -810
  66. package/dist/persistence/types.js +0 -1
  67. package/dist/projections/presentation.js +37 -206
  68. package/dist/projections/request-events.js +2 -502
  69. package/dist/projections/upstream-events.js +1 -201
  70. package/dist/protocol/a2a/http-discovery.js +1 -178
  71. package/dist/protocol/a2a/http-rpc.js +6 -622
  72. package/dist/protocol/a2a/http.js +1 -138
  73. package/dist/protocol/a2a/task-state.js +3 -317
  74. package/dist/protocol/acp/client.js +8 -294
  75. package/dist/protocol/acp/harness-client.js +1 -218
  76. package/dist/protocol/acp/http.js +5 -130
  77. package/dist/protocol/acp/server.js +1 -310
  78. package/dist/protocol/acp/stdio.js +2 -69
  79. package/dist/protocol/ag-ui/http.js +3 -378
  80. package/dist/protocol/mcp/server.js +1 -428
  81. package/dist/resource/backend/workspace-scoped-backend.js +1 -319
  82. package/dist/resource/isolation.js +1 -237
  83. package/dist/resource/mcp/tool-support.js +3 -296
  84. package/dist/resource/mcp-tool-support.js +1 -2
  85. package/dist/resource/providers/resource-provider.js +1 -215
  86. package/dist/resource/resource-impl.js +1 -3
  87. package/dist/resource/resource-types.js +0 -1
  88. package/dist/resource/resource.js +1 -1
  89. package/dist/resource/sources.js +1 -247
  90. package/dist/resource/tools/function-tool-resolver.js +2 -272
  91. package/dist/runtime/adapter/compat/deepagent-compat.js +1 -29
  92. package/dist/runtime/adapter/compat/openai-compatible.js +1 -55
  93. package/dist/runtime/adapter/direct-builtin-utility.js +2 -90
  94. package/dist/runtime/adapter/flow/execution-context.js +1 -71
  95. package/dist/runtime/adapter/flow/invocation-flow.js +8 -425
  96. package/dist/runtime/adapter/flow/invoke-runtime.js +1 -20
  97. package/dist/runtime/adapter/flow/stream-runtime.js +11 -1395
  98. package/dist/runtime/adapter/invocation-result.js +2 -473
  99. package/dist/runtime/adapter/local-tool-invocation.js +6 -638
  100. package/dist/runtime/adapter/middleware/context-hygiene.js +1 -83
  101. package/dist/runtime/adapter/middleware-assembly.js +5 -477
  102. package/dist/runtime/adapter/model/invocation-request.js +3 -183
  103. package/dist/runtime/adapter/model/message-assembly.js +1 -28
  104. package/dist/runtime/adapter/model/model-providers.js +23 -1115
  105. package/dist/runtime/adapter/model/prompted-json-tool-call-capture.js +1 -40
  106. package/dist/runtime/adapter/model/prompted-json-tool-policy.js +1 -22
  107. package/dist/runtime/adapter/resilience.js +1 -104
  108. package/dist/runtime/adapter/runtime-adapter-support.js +3 -141
  109. package/dist/runtime/adapter/runtime-shell.js +5 -166
  110. package/dist/runtime/adapter/stream-event-projection.js +2 -622
  111. package/dist/runtime/adapter/stream-text-consumption.js +1 -18
  112. package/dist/runtime/adapter/terminal-status.js +2 -67
  113. package/dist/runtime/adapter/tool/builtin-middleware-tools.js +6 -627
  114. package/dist/runtime/adapter/tool/declared-middleware.js +1 -154
  115. package/dist/runtime/adapter/tool/interrupt-policy.js +1 -34
  116. package/dist/runtime/adapter/tool/provider-tool.js +1 -25
  117. package/dist/runtime/adapter/tool/resolved-tool.js +1 -225
  118. package/dist/runtime/adapter/tool/tool-arguments.js +3 -486
  119. package/dist/runtime/adapter/tool/tool-hitl.js +1 -346
  120. package/dist/runtime/adapter/tool/tool-name-mapping.js +1 -128
  121. package/dist/runtime/adapter/tool/tool-output-artifacts.js +2 -88
  122. package/dist/runtime/adapter/tool/tool-replay.js +1 -37
  123. package/dist/runtime/adapter/tool-resolution.js +1 -86
  124. package/dist/runtime/adapter/upstream-configurable-keys.js +1 -2
  125. package/dist/runtime/agent-runtime-adapter.js +60 -2338
  126. package/dist/runtime/agent-runtime-assembly.js +7 -249
  127. package/dist/runtime/env/runtime-env.js +1 -62
  128. package/dist/runtime/harness/background-runtime.js +1 -8
  129. package/dist/runtime/harness/bindings.js +1 -58
  130. package/dist/runtime/harness/events/event-bus.js +1 -16
  131. package/dist/runtime/harness/events/event-sink.js +1 -61
  132. package/dist/runtime/harness/events/events.js +1 -80
  133. package/dist/runtime/harness/events/listener-runtime.js +1 -13
  134. package/dist/runtime/harness/events/runtime-event-operations.js +1 -9
  135. package/dist/runtime/harness/events/streaming.js +1 -100
  136. package/dist/runtime/harness/events/timeline.js +1 -52
  137. package/dist/runtime/harness/public-shapes.js +1 -186
  138. package/dist/runtime/harness/run/artifact-paths.js +1 -15
  139. package/dist/runtime/harness/run/governance.js +1 -295
  140. package/dist/runtime/harness/run/helpers.js +1 -71
  141. package/dist/runtime/harness/run/inspection.js +1 -409
  142. package/dist/runtime/harness/run/operator-overview.js +1 -80
  143. package/dist/runtime/harness/run/queue-diagnostics.js +1 -15
  144. package/dist/runtime/harness/run/recovery.js +1 -162
  145. package/dist/runtime/harness/run/resources.js +1 -60
  146. package/dist/runtime/harness/run/resume.js +1 -56
  147. package/dist/runtime/harness/run/routing.js +1 -48
  148. package/dist/runtime/harness/run/run-lifecycle.js +1 -66
  149. package/dist/runtime/harness/run/run-operations.js +1 -217
  150. package/dist/runtime/harness/run/run-queue.js +1 -43
  151. package/dist/runtime/harness/run/run-slot-acquisition.js +1 -157
  152. package/dist/runtime/harness/run/session-records.js +1 -97
  153. package/dist/runtime/harness/run/start-run.js +1 -120
  154. package/dist/runtime/harness/run/startup-runtime.js +1 -69
  155. package/dist/runtime/harness/run/stream-run.js +8 -1418
  156. package/dist/runtime/harness/run/surface-semantics.js +1 -79
  157. package/dist/runtime/harness/runtime-defaults.js +1 -39
  158. package/dist/runtime/harness/system/boundary-analysis.js +1 -234
  159. package/dist/runtime/harness/system/health-monitor.js +1 -258
  160. package/dist/runtime/harness/system/inventory.js +1 -129
  161. package/dist/runtime/harness/system/mem0-ingestion-sync.js +5 -345
  162. package/dist/runtime/harness/system/policy-engine.js +1 -175
  163. package/dist/runtime/harness/system/runtime-memory-candidates.js +4 -110
  164. package/dist/runtime/harness/system/runtime-memory-consolidation.js +1 -51
  165. package/dist/runtime/harness/system/runtime-memory-manager.js +10 -693
  166. package/dist/runtime/harness/system/runtime-memory-policy.js +1 -155
  167. package/dist/runtime/harness/system/runtime-memory-records.js +11 -577
  168. package/dist/runtime/harness/system/runtime-memory-sync.js +5 -206
  169. package/dist/runtime/harness/system/session-memory-sync.js +3 -113
  170. package/dist/runtime/harness/system/skill-requirements.js +1 -112
  171. package/dist/runtime/harness/system/store.js +9 -365
  172. package/dist/runtime/harness/tool-gateway/index.js +1 -2
  173. package/dist/runtime/harness/tool-gateway/policy.js +1 -45
  174. package/dist/runtime/harness/tool-gateway/validation.js +1 -176
  175. package/dist/runtime/harness/tool-schema.js +1 -3
  176. package/dist/runtime/harness.js +3 -1490
  177. package/dist/runtime/index.js +1 -3
  178. package/dist/runtime/layout/runtime-layout.js +1 -31
  179. package/dist/runtime/maintenance/checkpoint-maintenance.js +2 -178
  180. package/dist/runtime/maintenance/file-checkpoint-saver.js +1 -106
  181. package/dist/runtime/maintenance/runtime-record-maintenance.js +2 -169
  182. package/dist/runtime/maintenance/sqlite-checkpoint-saver.js +4 -289
  183. package/dist/runtime/parsing/output-content.js +10 -550
  184. package/dist/runtime/parsing/output-parsing.js +1 -4
  185. package/dist/runtime/parsing/output-recovery.js +3 -213
  186. package/dist/runtime/parsing/output-tool-args.js +7 -663
  187. package/dist/runtime/parsing/stream-event-parsing.js +3 -362
  188. package/dist/runtime/prompts/runtime-prompts.js +4 -73
  189. package/dist/runtime/scheduling/system-schedule-manager.js +11 -532
  190. package/dist/runtime/skills/skill-metadata.js +1 -197
  191. package/dist/runtime/startup-tracing.js +2 -37
  192. package/dist/runtime/support/compiled-binding.js +1 -290
  193. package/dist/runtime/support/embedding-models.js +1 -118
  194. package/dist/runtime/support/harness-support.js +5 -137
  195. package/dist/runtime/support/llamaindex.js +1 -108
  196. package/dist/runtime/support/runtime-adapter-options.js +1 -29
  197. package/dist/runtime/support/runtime-factories.js +1 -51
  198. package/dist/runtime/support/vector-stores.js +9 -270
  199. package/dist/scaffold/init-project.js +54 -233
  200. package/dist/tooling/extensions.js +1 -311
  201. package/dist/tooling/module-loader.js +1 -55
  202. package/dist/tools.js +1 -176
  203. package/dist/utils/agent-display.js +1 -18
  204. package/dist/utils/bundled-text.js +4 -39
  205. package/dist/utils/compiled-binding.js +1 -33
  206. package/dist/utils/fs.js +2 -45
  207. package/dist/utils/id.js +1 -9
  208. package/dist/utils/message-content.js +1 -30
  209. package/dist/utils/object.js +1 -6
  210. package/dist/workspace/agent-binding-compiler.js +3 -613
  211. package/dist/workspace/compile.js +1 -472
  212. package/dist/workspace/framework-contract-validation.js +2 -322
  213. package/dist/workspace/index.js +1 -1
  214. package/dist/workspace/object-loader-paths.js +1 -71
  215. package/dist/workspace/object-loader-readers.js +1 -187
  216. package/dist/workspace/object-loader.js +1 -754
  217. package/dist/workspace/resource-compilers.js +1 -374
  218. package/dist/workspace/support/agent-capabilities.js +1 -37
  219. package/dist/workspace/support/agent-execution-config.js +1 -44
  220. package/dist/workspace/support/discovery.js +1 -147
  221. package/dist/workspace/support/source-collectors.js +1 -30
  222. package/dist/workspace/support/source-protocols.js +2 -192
  223. package/dist/workspace/support/workspace-ref-utils.js +1 -362
  224. package/dist/workspace/tool-hydration.js +1 -280
  225. package/dist/workspace/validate.js +1 -99
  226. package/dist/workspace/yaml-object-reader.js +1 -285
  227. package/package.json +7 -3
@@ -1,494 +1 @@
1
- import { createUpstreamTimelineReducer } from "../projections/upstream-events.js";
2
- import { asObject, buildAttemptKey, deriveAgentName, deriveNodeKindFromProjection, deriveStatusFromProjection, extractUpstreamEventEnvelope, normalizeAttemptLabel, normalizeToolIdentity, readRequestId, readSessionId, slugify, titleCase, } from "./flow-graph-normalization.js";
3
- import { buildSurfaceId, resolveSurfaceAction, stripStepPrefix, } from "../runtime/harness/run/surface-semantics.js";
4
- function buildSurfaceStepLabel(surfaceItem) {
5
- const kind = surfaceItem.kind;
6
- const name = typeof surfaceItem.name === "string" && surfaceItem.name.trim().length > 0
7
- ? surfaceItem.name.trim()
8
- : typeof surfaceItem.id === "string"
9
- ? surfaceItem.id
10
- : "";
11
- const status = surfaceItem.status;
12
- if (!kind || !name || !status || (status !== "started" && status !== "completed" && status !== "failed")) {
13
- return null;
14
- }
15
- if (kind === "llm") {
16
- return status === "started" ? `Calling LLM ${name}` : `Completed LLM ${name}`;
17
- }
18
- if (kind === "tool") {
19
- if (status === "failed") {
20
- return `Tool ${name} failed`;
21
- }
22
- return status === "started" ? `Calling tool ${name}` : `Completed tool ${name}`;
23
- }
24
- if (kind === "skill") {
25
- return status === "started" ? `Calling skill ${name}` : `Completed skill ${name}`;
26
- }
27
- if (kind === "memory") {
28
- return status === "started" ? `Accessing memory ${name}` : `Completed memory ${name}`;
29
- }
30
- return null;
31
- }
32
- function createDelegationNodeFromSurfaceItem(surfaceItem, fallbackAgentId, fallbackAgentName, sourceEventId, ordinal) {
33
- if (surfaceItem.kind !== "agent") {
34
- return null;
35
- }
36
- const toAgentId = typeof surfaceItem.agentId === "string" && surfaceItem.agentId.trim().length > 0
37
- ? surfaceItem.agentId.trim()
38
- : fallbackAgentId;
39
- const toAgentName = deriveAgentName(toAgentId, typeof surfaceItem.agentName === "string" ? surfaceItem.agentName : undefined);
40
- const fromAgentId = typeof surfaceItem.ownerAgentId === "string" && surfaceItem.ownerAgentId.trim().length > 0
41
- ? surfaceItem.ownerAgentId.trim()
42
- : fallbackAgentId;
43
- const fromAgentName = deriveAgentName(fromAgentId, typeof surfaceItem.ownerAgentName === "string" ? surfaceItem.ownerAgentName : fallbackAgentName);
44
- return {
45
- id: `delegate:${slugify(fromAgentId)}:${slugify(toAgentId)}:${ordinal}`,
46
- layer: "execution",
47
- kind: "agent",
48
- label: `Delegate to ${titleCase(typeof surfaceItem.name === "string" ? surfaceItem.name : toAgentId)}`,
49
- status: surfaceItem.status === "failed" ? "failed" : surfaceItem.status === "started" ? "started" : "completed",
50
- sessionId: "",
51
- requestId: "",
52
- agentId: toAgentId,
53
- agentName: toAgentName,
54
- sourceEventIds: [sourceEventId],
55
- detail: {
56
- fromAgentId,
57
- fromAgentName,
58
- toAgentId,
59
- toAgentName,
60
- ...(typeof surfaceItem.action === "string" ? { action: surfaceItem.action } : {}),
61
- },
62
- };
63
- }
64
- function extractDelegatedAgentId(event) {
65
- const typed = asObject(event);
66
- if (!typed) {
67
- return null;
68
- }
69
- const eventName = typeof typed.event === "string" ? typed.event : "";
70
- const toolName = typeof typed.name === "string" ? typed.name : "";
71
- if (toolName !== "task" || (eventName !== "on_tool_start" && !(eventName === "on_chain_start" && typed.run_type === "tool"))) {
72
- return null;
73
- }
74
- const data = asObject(typed.data);
75
- const input = asObject(data?.input);
76
- const nestedInput = typeof input?.input === "string"
77
- ? asObject(JSON.parse(input.input))
78
- : asObject(input?.input);
79
- const subagentType = typeof input?.subagent_type === "string"
80
- ? input.subagent_type
81
- : typeof nestedInput?.subagent_type === "string"
82
- ? nestedInput.subagent_type
83
- : null;
84
- return subagentType && subagentType.trim().length > 0 ? subagentType.trim() : null;
85
- }
86
- export function convertUpstreamEventsWithAgents(upstreamEvents, initialAgentId) {
87
- const reducer = createUpstreamTimelineReducer();
88
- const projections = [];
89
- const delegationNodes = [];
90
- let currentAgentId = initialAgentId;
91
- let currentAgentName = deriveAgentName(initialAgentId);
92
- let ordinal = 0;
93
- upstreamEvents.forEach((event, index) => {
94
- const sourceEventId = `upstream:${index + 1}`;
95
- const envelope = extractUpstreamEventEnvelope(event);
96
- if (envelope.agentId && envelope.agentId !== currentAgentId) {
97
- currentAgentId = envelope.agentId;
98
- currentAgentName = deriveAgentName(currentAgentId, envelope.agentName);
99
- }
100
- else if (envelope.agentName) {
101
- currentAgentName = deriveAgentName(currentAgentId, envelope.agentName);
102
- }
103
- const emitted = reducer.consume(envelope.event);
104
- for (const projection of emitted) {
105
- if (envelope.surfaceItem && projection.type === "step") {
106
- continue;
107
- }
108
- projections.push({
109
- projection,
110
- agentId: currentAgentId,
111
- agentName: currentAgentName,
112
- sourceEventId,
113
- });
114
- }
115
- if (envelope.surfaceItem) {
116
- const delegationNode = createDelegationNodeFromSurfaceItem(envelope.surfaceItem, currentAgentId, currentAgentName, sourceEventId, ordinal + 1);
117
- if (delegationNode) {
118
- ordinal += 1;
119
- delegationNodes.push(delegationNode);
120
- }
121
- else {
122
- const step = buildSurfaceStepLabel(envelope.surfaceItem);
123
- if (step) {
124
- projections.push({
125
- projection: {
126
- type: "step",
127
- key: `surface:${index + 1}:${envelope.surfaceItem.id ?? step}`,
128
- category: envelope.surfaceItem.kind,
129
- status: envelope.surfaceItem.status,
130
- step,
131
- },
132
- agentId: currentAgentId,
133
- agentName: currentAgentName,
134
- sourceEventId,
135
- });
136
- }
137
- }
138
- }
139
- if (envelope.surfaceItem) {
140
- return;
141
- }
142
- const delegatedAgentId = extractDelegatedAgentId(envelope.event);
143
- if (!delegatedAgentId || delegatedAgentId === currentAgentId) {
144
- return;
145
- }
146
- const delegatedAgentName = deriveAgentName(delegatedAgentId);
147
- ordinal += 1;
148
- delegationNodes.push({
149
- id: `delegate:${slugify(initialAgentId)}:${slugify(delegatedAgentId)}:${ordinal}`,
150
- layer: "execution",
151
- kind: "agent",
152
- label: `Delegate to ${titleCase(delegatedAgentId)}`,
153
- status: "completed",
154
- sessionId: "",
155
- requestId: "",
156
- agentId: delegatedAgentId,
157
- agentName: delegatedAgentName,
158
- sourceEventIds: [sourceEventId],
159
- detail: {
160
- fromAgentId: currentAgentId,
161
- fromAgentName: currentAgentName,
162
- toAgentId: delegatedAgentId,
163
- toAgentName: delegatedAgentName,
164
- },
165
- });
166
- currentAgentId = delegatedAgentId;
167
- currentAgentName = delegatedAgentName;
168
- });
169
- return { projections, delegationNodes };
170
- }
171
- function selectInitialGroup(groups) {
172
- return groups.find((group) => group.kind === "segment") ?? groups[0] ?? null;
173
- }
174
- export function buildAttempts(projectionRecords, delegationNodes, runtimeGroups, sessionId, requestId) {
175
- const nodes = [];
176
- const edges = [];
177
- const groups = [];
178
- const attempts = [];
179
- const activeAttemptsByKey = new Map();
180
- const toolAttemptsByName = new Map();
181
- const attemptSetGroups = new Map();
182
- let currentGroup = selectInitialGroup(runtimeGroups);
183
- let awaitingResumeAfterApproval = false;
184
- let previousAttempt = null;
185
- let ordinal = 0;
186
- let pendingDelegationNode = null;
187
- let delegationIndex = 0;
188
- const segmentGroups = runtimeGroups.filter((group) => group.kind === "segment");
189
- let nextSegmentIndex = currentGroup && currentGroup.kind === "segment"
190
- ? Math.max(segmentGroups.findIndex((group) => group.id === currentGroup?.id), 0)
191
- : 0;
192
- function promoteToNextSegment() {
193
- if (nextSegmentIndex + 1 < segmentGroups.length) {
194
- nextSegmentIndex += 1;
195
- currentGroup = segmentGroups[nextSegmentIndex] ?? currentGroup;
196
- }
197
- }
198
- function createAttempt(kind, label, projection, agentId, agentName) {
199
- ordinal += 1;
200
- const attempt = {
201
- id: `attempt:${requestId}:${slugify(kind)}:${slugify(label)}:${ordinal}`,
202
- kind,
203
- label,
204
- status: deriveStatusFromProjection(projection),
205
- agentId,
206
- agentName,
207
- groupId: currentGroup?.id,
208
- sourceEventIds: [],
209
- attemptKey: buildAttemptKey(kind, label, currentGroup?.id),
210
- detail: {},
211
- projectionKeys: [],
212
- ...(projection.type === "tool-result" ? { toolName: projection.toolName } : {}),
213
- };
214
- attempts.push(attempt);
215
- if (kind === "tool" || (projection.type === "tool-result" && projection.toolName)) {
216
- const toolName = projection.type === "tool-result"
217
- ? normalizeToolIdentity(projection.toolName)
218
- : normalizeToolIdentity(label.replace(/^Calling tool\s+/i, ""));
219
- const existing = toolAttemptsByName.get(toolName) ?? [];
220
- if (existing.length > 0) {
221
- const prior = existing[existing.length - 1];
222
- const edgeKind = prior.status === "failed" ? "retry" : "fallback";
223
- edges.push({
224
- id: `edge:${prior.id}->${attempt.id}`,
225
- from: prior.id,
226
- to: attempt.id,
227
- kind: edgeKind,
228
- sourceEventIds: [],
229
- confidence: 0.55,
230
- });
231
- }
232
- existing.push(attempt);
233
- toolAttemptsByName.set(toolName, existing);
234
- }
235
- return attempt;
236
- }
237
- for (const record of projectionRecords) {
238
- const projection = record.projection;
239
- if (!pendingDelegationNode
240
- && delegationIndex < delegationNodes.length
241
- && delegationNodes[delegationIndex]?.agentId === record.agentId
242
- && (!previousAttempt || previousAttempt.agentId !== record.agentId)) {
243
- const sourceNode = delegationNodes[delegationIndex];
244
- delegationIndex += 1;
245
- pendingDelegationNode = {
246
- ...sourceNode,
247
- sessionId,
248
- requestId,
249
- groupId: currentGroup?.id,
250
- };
251
- nodes.push(pendingDelegationNode);
252
- if (previousAttempt) {
253
- edges.push({
254
- id: `edge:${previousAttempt.id}->${pendingDelegationNode.id}`,
255
- from: previousAttempt.id,
256
- to: pendingDelegationNode.id,
257
- kind: "spawn",
258
- label: "delegate",
259
- sourceEventIds: [...pendingDelegationNode.sourceEventIds],
260
- confidence: 0.9,
261
- });
262
- }
263
- else if (currentGroup?.anchorNodeId) {
264
- edges.push({
265
- id: `edge:${currentGroup.anchorNodeId}->${pendingDelegationNode.id}`,
266
- from: currentGroup.anchorNodeId,
267
- to: pendingDelegationNode.id,
268
- kind: "spawn",
269
- label: "delegate",
270
- sourceEventIds: [...pendingDelegationNode.sourceEventIds],
271
- confidence: 0.9,
272
- });
273
- }
274
- }
275
- if (previousAttempt
276
- && previousAttempt.agentId
277
- && record.agentId !== previousAttempt.agentId
278
- && delegationIndex < delegationNodes.length) {
279
- const sourceNode = delegationNodes[delegationIndex];
280
- delegationIndex += 1;
281
- pendingDelegationNode = {
282
- ...sourceNode,
283
- sessionId,
284
- requestId,
285
- groupId: currentGroup?.id,
286
- };
287
- nodes.push(pendingDelegationNode);
288
- edges.push({
289
- id: `edge:${previousAttempt.id}->${pendingDelegationNode.id}`,
290
- from: previousAttempt.id,
291
- to: pendingDelegationNode.id,
292
- kind: "spawn",
293
- label: "delegate",
294
- sourceEventIds: [...pendingDelegationNode.sourceEventIds],
295
- confidence: 0.9,
296
- });
297
- }
298
- if (projection.type === "thinking") {
299
- ordinal += 1;
300
- const detailNode = {
301
- id: `detail:${requestId}:thinking:${ordinal}`,
302
- layer: "detail",
303
- kind: "thinking",
304
- label: "Model reasoning",
305
- status: "completed",
306
- sessionId,
307
- requestId,
308
- groupId: currentGroup?.id,
309
- sourceEventIds: [],
310
- detail: { text: projection.text },
311
- };
312
- nodes.push(detailNode);
313
- if (previousAttempt) {
314
- edges.push({
315
- id: `edge:${previousAttempt.id}->${detailNode.id}`,
316
- from: previousAttempt.id,
317
- to: detailNode.id,
318
- kind: "result",
319
- sourceEventIds: [],
320
- confidence: 0.6,
321
- });
322
- }
323
- continue;
324
- }
325
- const kind = deriveNodeKindFromProjection(projection);
326
- const label = normalizeAttemptLabel(kind, projection);
327
- if (kind === "approval") {
328
- const activeApproval = runtimeGroups.find((group) => group.kind === "approval-window");
329
- if (activeApproval) {
330
- currentGroup = activeApproval;
331
- }
332
- awaitingResumeAfterApproval = true;
333
- }
334
- else if (awaitingResumeAfterApproval && currentGroup?.kind === "approval-window") {
335
- promoteToNextSegment();
336
- awaitingResumeAfterApproval = false;
337
- }
338
- const attemptKey = buildAttemptKey(kind, label, currentGroup?.id);
339
- let attempt;
340
- if (projection.type === "step" && projection.status === "started") {
341
- attempt = createAttempt(kind, label, projection, record.agentId, record.agentName);
342
- activeAttemptsByKey.set(attemptKey, attempt);
343
- }
344
- else if (projection.type === "tool-result") {
345
- const toolName = normalizeToolIdentity(projection.toolName);
346
- const existing = toolAttemptsByName.get(toolName) ?? [];
347
- attempt = [...existing].reverse().find((candidate) => candidate.groupId === currentGroup?.id) ?? existing[existing.length - 1];
348
- if (!attempt) {
349
- attempt = createAttempt("tool", `Calling tool ${titleCase(toolName)}`, projection, record.agentId, record.agentName);
350
- }
351
- }
352
- else {
353
- attempt = activeAttemptsByKey.get(attemptKey);
354
- if (!attempt) {
355
- attempt = createAttempt(kind, label, projection, record.agentId, record.agentName);
356
- }
357
- }
358
- attempt.agentId = attempt.agentId ?? record.agentId;
359
- attempt.agentName = attempt.agentName ?? record.agentName;
360
- attempt.projectionKeys.push(projection.key);
361
- attempt.sourceEventIds.push(record.sourceEventId);
362
- if (projection.type === "step") {
363
- attempt.status = deriveStatusFromProjection(projection);
364
- attempt.detail.category = projection.category;
365
- attempt.detail.step = projection.step;
366
- }
367
- else if (projection.type === "tool-result") {
368
- attempt.status = projection.isError ? "failed" : "completed";
369
- attempt.toolName = projection.toolName;
370
- attempt.detail.toolName = projection.toolName;
371
- attempt.detail.result = projection.output;
372
- attempt.detail.resultIsError = projection.isError === true;
373
- if (projection.isError) {
374
- activeAttemptsByKey.delete(buildAttemptKey("tool", attempt.label, attempt.groupId));
375
- }
376
- }
377
- if (!attemptSetGroups.has(`${kind}:${currentGroup?.id ?? "ungrouped"}`)) {
378
- attemptSetGroups.set(`${kind}:${currentGroup?.id ?? "ungrouped"}`, {
379
- id: `group:${requestId}:attempt-set:${slugify(kind)}:${attemptSetGroups.size + 1}`,
380
- kind: "attempt-set",
381
- label: `${titleCase(kind)} attempts`,
382
- nodeIds: [],
383
- });
384
- }
385
- const attemptGroup = attemptSetGroups.get(`${kind}:${currentGroup?.id ?? "ungrouped"}`);
386
- if (!attemptGroup.nodeIds.includes(attempt.id)) {
387
- attemptGroup.nodeIds.push(attempt.id);
388
- }
389
- if (pendingDelegationNode && pendingDelegationNode.id !== attempt.id) {
390
- edges.push({
391
- id: `edge:${pendingDelegationNode.id}->${attempt.id}`,
392
- from: pendingDelegationNode.id,
393
- to: attempt.id,
394
- kind: "spawn",
395
- sourceEventIds: [...pendingDelegationNode.sourceEventIds, ...attempt.sourceEventIds],
396
- confidence: 0.9,
397
- });
398
- pendingDelegationNode = null;
399
- }
400
- else if (previousAttempt && previousAttempt.id !== attempt.id) {
401
- edges.push({
402
- id: `edge:${previousAttempt.id}->${attempt.id}`,
403
- from: previousAttempt.id,
404
- to: attempt.id,
405
- kind: kind === "approval" ? "approval" : "sequence",
406
- sourceEventIds: [],
407
- confidence: 0.7,
408
- });
409
- }
410
- else if (!previousAttempt && currentGroup?.anchorNodeId) {
411
- edges.push({
412
- id: `edge:${currentGroup.anchorNodeId}->${attempt.id}`,
413
- from: currentGroup.anchorNodeId,
414
- to: attempt.id,
415
- kind: "contains",
416
- sourceEventIds: [],
417
- confidence: 0.8,
418
- });
419
- }
420
- previousAttempt = attempt;
421
- if (projection.type === "step" && projection.status !== "started") {
422
- activeAttemptsByKey.delete(attemptKey);
423
- }
424
- }
425
- for (const attempt of attempts) {
426
- nodes.push({
427
- id: attempt.id,
428
- layer: "attempt",
429
- kind: attempt.kind,
430
- label: attempt.label,
431
- status: attempt.status,
432
- sessionId,
433
- requestId,
434
- agentId: attempt.agentId,
435
- agentName: attempt.agentName,
436
- groupId: attempt.groupId,
437
- sequenceStart: attempt.sequenceStart,
438
- sequenceEnd: attempt.sequenceEnd,
439
- startedAt: attempt.startedAt,
440
- endedAt: attempt.endedAt,
441
- sourceEventIds: [...new Set(attempt.sourceEventIds)],
442
- detail: { ...attempt.detail, projectionKeys: attempt.projectionKeys },
443
- });
444
- }
445
- groups.push(...attemptSetGroups.values());
446
- return { nodes, edges, groups };
447
- }
448
- export function resolveContext(input, runtimeTimeline, projections) {
449
- const timelineHead = runtimeTimeline[0];
450
- const inputSessionId = readSessionId(input);
451
- const inputRequestId = readRequestId(input);
452
- if (inputSessionId && inputRequestId) {
453
- return { sessionId: inputSessionId, requestId: inputRequestId };
454
- }
455
- if (timelineHead) {
456
- return {
457
- sessionId: inputSessionId ?? timelineHead.sessionId,
458
- requestId: inputRequestId ?? timelineHead.requestId,
459
- };
460
- }
461
- const firstProjection = projections[0];
462
- if (!inputSessionId || !inputRequestId) {
463
- throw new Error(`buildFlowGraph requires sessionId and requestId when runtime timeline data is absent${firstProjection ? "" : " or empty"}.`);
464
- }
465
- return { sessionId: inputSessionId, requestId: inputRequestId };
466
- }
467
- export function buildRuntimeSurface(nodes) {
468
- return nodes
469
- .filter((node) => node.layer !== "detail"
470
- && (node.kind === "agent" || node.kind === "llm" || node.kind === "memory" || node.kind === "skill" || node.kind === "tool"))
471
- .map((node) => ({
472
- kind: node.kind,
473
- id: buildSurfaceId(node.kind, node.kind === "agent" ? (node.agentId ?? node.agentName ?? "agent") : node.label),
474
- name: node.kind === "agent"
475
- ? (node.agentName ?? node.agentId ?? "Agent")
476
- : stripStepPrefix(node.label),
477
- action: resolveSurfaceAction({
478
- kind: node.kind,
479
- step: node.label,
480
- event: node.detail,
481
- }),
482
- status: node.status === "resolved" ? "completed" : node.status,
483
- agentId: node.agentId,
484
- agentName: node.agentName,
485
- ownerAgentId: node.kind === "agent"
486
- ? (typeof node.detail.fromAgentId === "string" ? node.detail.fromAgentId : node.agentId)
487
- : node.agentId,
488
- ownerAgentName: node.kind === "agent"
489
- ? (typeof node.detail.fromAgentName === "string" ? node.detail.fromAgentName : node.agentName)
490
- : node.agentName,
491
- sourceEventId: node.sourceEventIds[0],
492
- detail: { ...node.detail },
493
- }));
494
- }
1
+ import{createUpstreamTimelineReducer as F}from"../projections/upstream-events.js";import{asObject as C,buildAttemptKey as L,deriveAgentName as b,deriveNodeKindFromProjection as G,deriveStatusFromProjection as R,extractUpstreamEventEnvelope as P,normalizeAttemptLabel as z,normalizeToolIdentity as D,readRequestId as U,readSessionId as B,slugify as A,titleCase as K}from"./flow-graph-normalization.js";import{buildSurfaceId as O,resolveSurfaceAction as H,stripStepPrefix as J}from"../runtime/harness/run/surface-semantics.js";function W(n){const e=n.kind,u=typeof n.name=="string"&&n.name.trim().length>0?n.name.trim():typeof n.id=="string"?n.id:"",s=n.status;return!e||!u||!s||s!=="started"&&s!=="completed"&&s!=="failed"?null:e==="llm"?s==="started"?`Calling LLM ${u}`:`Completed LLM ${u}`:e==="tool"?s==="failed"?`Tool ${u} failed`:s==="started"?`Calling tool ${u}`:`Completed tool ${u}`:e==="skill"?s==="started"?`Calling skill ${u}`:`Completed skill ${u}`:e==="memory"?s==="started"?`Accessing memory ${u}`:`Completed memory ${u}`:null}function Q(n,e,u,s,c){if(n.kind!=="agent")return null;const i=typeof n.agentId=="string"&&n.agentId.trim().length>0?n.agentId.trim():e,d=b(i,typeof n.agentName=="string"?n.agentName:void 0),I=typeof n.ownerAgentId=="string"&&n.ownerAgentId.trim().length>0?n.ownerAgentId.trim():e,E=b(I,typeof n.ownerAgentName=="string"?n.ownerAgentName:u);return{id:`delegate:${A(I)}:${A(i)}:${c}`,layer:"execution",kind:"agent",label:`Delegate to ${K(typeof n.name=="string"?n.name:i)}`,status:n.status==="failed"?"failed":n.status==="started"?"started":"completed",sessionId:"",requestId:"",agentId:i,agentName:d,sourceEventIds:[s],detail:{fromAgentId:I,fromAgentName:E,toAgentId:i,toAgentName:d,...typeof n.action=="string"?{action:n.action}:{}}}}function V(n){const e=C(n);if(!e)return null;const u=typeof e.event=="string"?e.event:"";if((typeof e.name=="string"?e.name:"")!=="task"||u!=="on_tool_start"&&!(u==="on_chain_start"&&e.run_type==="tool"))return null;const c=C(e.data),i=C(c?.input),d=typeof i?.input=="string"?C(JSON.parse(i.input)):C(i?.input),I=typeof i?.subagent_type=="string"?i.subagent_type:typeof d?.subagent_type=="string"?d.subagent_type:null;return I&&I.trim().length>0?I.trim():null}function te(n,e){const u=F(),s=[],c=[];let i=e,d=b(e),I=0;return n.forEach((E,h)=>{const v=`upstream:${h+1}`,p=P(E);p.agentId&&p.agentId!==i?(i=p.agentId,d=b(i,p.agentName)):p.agentName&&(d=b(i,p.agentName));const r=u.consume(p.event);for(const y of r)p.surfaceItem&&y.type==="step"||s.push({projection:y,agentId:i,agentName:d,sourceEventId:v});if(p.surfaceItem){const y=Q(p.surfaceItem,i,d,v,I+1);if(y)I+=1,c.push(y);else{const l=W(p.surfaceItem);l&&s.push({projection:{type:"step",key:`surface:${h+1}:${p.surfaceItem.id??l}`,category:p.surfaceItem.kind,status:p.surfaceItem.status,step:l},agentId:i,agentName:d,sourceEventId:v})}}if(p.surfaceItem)return;const N=V(p.event);if(!N||N===i)return;const g=b(N);I+=1,c.push({id:`delegate:${A(e)}:${A(N)}:${I}`,layer:"execution",kind:"agent",label:`Delegate to ${K(N)}`,status:"completed",sessionId:"",requestId:"",agentId:N,agentName:g,sourceEventIds:[v],detail:{fromAgentId:i,fromAgentName:d,toAgentId:N,toAgentName:g}}),i=N,d=g}),{projections:s,delegationNodes:c}}function X(n){return n.find(e=>e.kind==="segment")??n[0]??null}function ne(n,e,u,s,c){const i=[],d=[],I=[],E=[],h=new Map,v=new Map,p=new Map;let r=X(u),N=!1,g=null,y=0,l=null,k=0;const q=u.filter(o=>o.kind==="segment");let _=r&&r.kind==="segment"?Math.max(q.findIndex(o=>o.id===r?.id),0):0;function T(){_+1<q.length&&(_+=1,r=q[_]??r)}function j(o,a,m,w,x){y+=1;const t={id:`attempt:${c}:${A(o)}:${A(a)}:${y}`,kind:o,label:a,status:R(m),agentId:w,agentName:x,groupId:r?.id,sourceEventIds:[],attemptKey:L(o,a,r?.id),detail:{},projectionKeys:[],...m.type==="tool-result"?{toolName:m.toolName}:{}};if(E.push(t),o==="tool"||m.type==="tool-result"&&m.toolName){const S=m.type==="tool-result"?D(m.toolName):D(a.replace(/^Calling tool\s+/i,"")),f=v.get(S)??[];if(f.length>0){const $=f[f.length-1],M=$.status==="failed"?"retry":"fallback";d.push({id:`edge:${$.id}->${t.id}`,from:$.id,to:t.id,kind:M,sourceEventIds:[],confidence:.55})}f.push(t),v.set(S,f)}return t}for(const o of n){const a=o.projection;if(!l&&k<e.length&&e[k]?.agentId===o.agentId&&(!g||g.agentId!==o.agentId)){const f=e[k];k+=1,l={...f,sessionId:s,requestId:c,groupId:r?.id},i.push(l),g?d.push({id:`edge:${g.id}->${l.id}`,from:g.id,to:l.id,kind:"spawn",label:"delegate",sourceEventIds:[...l.sourceEventIds],confidence:.9}):r?.anchorNodeId&&d.push({id:`edge:${r.anchorNodeId}->${l.id}`,from:r.anchorNodeId,to:l.id,kind:"spawn",label:"delegate",sourceEventIds:[...l.sourceEventIds],confidence:.9})}if(g&&g.agentId&&o.agentId!==g.agentId&&k<e.length){const f=e[k];k+=1,l={...f,sessionId:s,requestId:c,groupId:r?.id},i.push(l),d.push({id:`edge:${g.id}->${l.id}`,from:g.id,to:l.id,kind:"spawn",label:"delegate",sourceEventIds:[...l.sourceEventIds],confidence:.9})}if(a.type==="thinking"){y+=1;const f={id:`detail:${c}:thinking:${y}`,layer:"detail",kind:"thinking",label:"Model reasoning",status:"completed",sessionId:s,requestId:c,groupId:r?.id,sourceEventIds:[],detail:{text:a.text}};i.push(f),g&&d.push({id:`edge:${g.id}->${f.id}`,from:g.id,to:f.id,kind:"result",sourceEventIds:[],confidence:.6});continue}const m=G(a),w=z(m,a);if(m==="approval"){const f=u.find($=>$.kind==="approval-window");f&&(r=f),N=!0}else N&&r?.kind==="approval-window"&&(T(),N=!1);const x=L(m,w,r?.id);let t;if(a.type==="step"&&a.status==="started")t=j(m,w,a,o.agentId,o.agentName),h.set(x,t);else if(a.type==="tool-result"){const f=D(a.toolName),$=v.get(f)??[];t=[...$].reverse().find(M=>M.groupId===r?.id)??$[$.length-1],t||(t=j("tool",`Calling tool ${K(f)}`,a,o.agentId,o.agentName))}else t=h.get(x),t||(t=j(m,w,a,o.agentId,o.agentName));t.agentId=t.agentId??o.agentId,t.agentName=t.agentName??o.agentName,t.projectionKeys.push(a.key),t.sourceEventIds.push(o.sourceEventId),a.type==="step"?(t.status=R(a),t.detail.category=a.category,t.detail.step=a.step):a.type==="tool-result"&&(t.status=a.isError?"failed":"completed",t.toolName=a.toolName,t.detail.toolName=a.toolName,t.detail.result=a.output,t.detail.resultIsError=a.isError===!0,a.isError&&h.delete(L("tool",t.label,t.groupId))),p.has(`${m}:${r?.id??"ungrouped"}`)||p.set(`${m}:${r?.id??"ungrouped"}`,{id:`group:${c}:attempt-set:${A(m)}:${p.size+1}`,kind:"attempt-set",label:`${K(m)} attempts`,nodeIds:[]});const S=p.get(`${m}:${r?.id??"ungrouped"}`);S.nodeIds.includes(t.id)||S.nodeIds.push(t.id),l&&l.id!==t.id?(d.push({id:`edge:${l.id}->${t.id}`,from:l.id,to:t.id,kind:"spawn",sourceEventIds:[...l.sourceEventIds,...t.sourceEventIds],confidence:.9}),l=null):g&&g.id!==t.id?d.push({id:`edge:${g.id}->${t.id}`,from:g.id,to:t.id,kind:m==="approval"?"approval":"sequence",sourceEventIds:[],confidence:.7}):!g&&r?.anchorNodeId&&d.push({id:`edge:${r.anchorNodeId}->${t.id}`,from:r.anchorNodeId,to:t.id,kind:"contains",sourceEventIds:[],confidence:.8}),g=t,a.type==="step"&&a.status!=="started"&&h.delete(x)}for(const o of E)i.push({id:o.id,layer:"attempt",kind:o.kind,label:o.label,status:o.status,sessionId:s,requestId:c,agentId:o.agentId,agentName:o.agentName,groupId:o.groupId,sequenceStart:o.sequenceStart,sequenceEnd:o.sequenceEnd,startedAt:o.startedAt,endedAt:o.endedAt,sourceEventIds:[...new Set(o.sourceEventIds)],detail:{...o.detail,projectionKeys:o.projectionKeys}});return I.push(...p.values()),{nodes:i,edges:d,groups:I}}function oe(n,e,u){const s=e[0],c=B(n),i=U(n);if(c&&i)return{sessionId:c,requestId:i};if(s)return{sessionId:c??s.sessionId,requestId:i??s.requestId};const d=u[0];if(!c||!i)throw new Error(`buildFlowGraph requires sessionId and requestId when runtime timeline data is absent${d?"":" or empty"}.`);return{sessionId:c,requestId:i}}function ie(n){return n.filter(e=>e.layer!=="detail"&&(e.kind==="agent"||e.kind==="llm"||e.kind==="memory"||e.kind==="skill"||e.kind==="tool")).map(e=>({kind:e.kind,id:O(e.kind,e.kind==="agent"?e.agentId??e.agentName??"agent":e.label),name:e.kind==="agent"?e.agentName??e.agentId??"Agent":J(e.label),action:H({kind:e.kind,step:e.label,event:e.detail}),status:e.status==="resolved"?"completed":e.status,agentId:e.agentId,agentName:e.agentName,ownerAgentId:e.kind==="agent"&&typeof e.detail.fromAgentId=="string"?e.detail.fromAgentId:e.agentId,ownerAgentName:e.kind==="agent"&&typeof e.detail.fromAgentName=="string"?e.detail.fromAgentName:e.agentName,sourceEventId:e.sourceEventIds[0],detail:{...e.detail}}))}export{ne as buildAttempts,ie as buildRuntimeSurface,te as convertUpstreamEventsWithAgents,oe as resolveContext};
@@ -1,3 +1 @@
1
- export { buildFlowGraph } from "./build-flow-graph.js";
2
- export { exportFlowGraphToMermaid } from "./export-mermaid.js";
3
- export { exportFlowGraphToSequenceMermaid } from "./export-sequence-mermaid.js";
1
+ import{buildFlowGraph as e}from"./build-flow-graph.js";import{exportFlowGraphToMermaid as a}from"./export-mermaid.js";import{exportFlowGraphToSequenceMermaid as t}from"./export-sequence-mermaid.js";export{e as buildFlowGraph,a as exportFlowGraphToMermaid,t as exportFlowGraphToSequenceMermaid};
@@ -1 +0,0 @@
1
- export {};
package/dist/index.js CHANGED
@@ -1,5 +1 @@
1
- export { AgentHarnessAcpServer, AgentHarnessRuntime, cancelRequest, createAgentHarness, createAcpServer, createAcpStdioClient, createRuntimeMcpServer, createUpstreamTimelineReducer, createToolMcpServer, analyzeBoundaries, 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, serveRuntimeMcpOverStreamableHttp, serveToolsOverStdio, subscribe, stop, updateMemory, } from "./api.js";
2
- export { AcpHarnessClient, InProcessHarnessClient, createAcpHarnessClient, createAcpHttpHarnessClient, createAcpStdioHarnessClient, createAgentHarnessClient, createInProcessHarnessClient, } from "./client.js";
3
- export { createKnowledgeModule, readKnowledgeRuntimeConfig } from "./knowledge/index.js";
4
- export { readProceduralMemoryRuntimeConfig } from "./knowledge/procedural/index.js";
5
- export { tool } from "./tools.js";
1
+ import{AgentHarnessAcpServer as r,AgentHarnessRuntime as s,cancelRequest as a,createAgentHarness as o,createAcpServer as n,createAcpStdioClient as i,createRuntimeMcpServer as l,createUpstreamTimelineReducer as c,createToolMcpServer as p,analyzeBoundaries as u,deleteSession as m,describeInventory as v,exportEvaluationBundle as A,exportFlow as g,exportSequence as d,exportRequestPackage as S,exportSessionPackage as H,replayEvaluationBundle as R,getArtifact as C,getAgent as f,getApproval as q,getOperatorOverview as x,getRequestPlanState as M,getRequest as y,getHealth as P,listMemories as I,listRequestTraceItems as O,getSession as b,listAgentSkills as w,listRequestArtifacts as T,listApprovals as k,listRequests as z,listRequestEvents as B,listSessionSummaries as E,listSessions as U,memorize as h,normalizeUserChatInput as K,recordArtifact as F,request as j,recall as D,removeMemory as G,resolveApproval as J,serveA2aHttp as L,serveAcpHttp as N,serveAcpStdio as Q,serveAgUiHttp as V,serveRuntimeMcpOverStdio as W,serveRuntimeMcpOverStreamableHttp as X,serveToolsOverStdio as Y,subscribe as Z,stop as _,updateMemory as $}from"./api.js";import{AcpHarnessClient as te,InProcessHarnessClient as re,createAcpHarnessClient as se,createAcpHttpHarnessClient as ae,createAcpStdioHarnessClient as oe,createAgentHarnessClient as ne,createInProcessHarnessClient as ie}from"./client.js";import{createKnowledgeModule as ce,readKnowledgeRuntimeConfig as pe}from"./knowledge/index.js";import{readProceduralMemoryRuntimeConfig as me}from"./knowledge/procedural/index.js";import{tool as Ae}from"./tools.js";export{te as AcpHarnessClient,r as AgentHarnessAcpServer,s as AgentHarnessRuntime,re as InProcessHarnessClient,u as analyzeBoundaries,a as cancelRequest,se as createAcpHarnessClient,ae as createAcpHttpHarnessClient,n as createAcpServer,i as createAcpStdioClient,oe as createAcpStdioHarnessClient,o as createAgentHarness,ne as createAgentHarnessClient,ie as createInProcessHarnessClient,ce as createKnowledgeModule,l as createRuntimeMcpServer,p as createToolMcpServer,c as createUpstreamTimelineReducer,m as deleteSession,v as describeInventory,A as exportEvaluationBundle,g as exportFlow,S as exportRequestPackage,d as exportSequence,H as exportSessionPackage,f as getAgent,q as getApproval,C as getArtifact,P as getHealth,x as getOperatorOverview,y as getRequest,M as getRequestPlanState,b as getSession,w as listAgentSkills,k as listApprovals,I as listMemories,T as listRequestArtifacts,B as listRequestEvents,O as listRequestTraceItems,z as listRequests,E as listSessionSummaries,U as listSessions,h as memorize,K as normalizeUserChatInput,pe as readKnowledgeRuntimeConfig,me as readProceduralMemoryRuntimeConfig,D as recall,F as recordArtifact,G as removeMemory,R as replayEvaluationBundle,j as request,J as resolveApproval,L as serveA2aHttp,N as serveAcpHttp,Q as serveAcpStdio,V as serveAgUiHttp,W as serveRuntimeMcpOverStdio,X as serveRuntimeMcpOverStreamableHttp,Y as serveToolsOverStdio,_ as stop,Z as subscribe,Ae as tool,$ as updateMemory};
@@ -1 +1 @@
1
- export * from "./scaffold/init-project.js";
1
+ export*from"./scaffold/init-project.js";
@@ -1,32 +1 @@
1
- import { readRuntimeMemoryFormationConfig, } from "../runtime/harness/system/runtime-memory-manager.js";
2
- import { readRuntimeMemoryMaintenanceConfig, readRuntimeMemoryPolicyConfig, } from "../runtime/harness/system/runtime-memory-policy.js";
3
- import { readMem0RuntimeConfig } from "../runtime/harness/system/mem0-ingestion-sync.js";
4
- function asObject(value) {
5
- return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
6
- }
7
- function readKnowledgeRuntimeSpec(source) {
8
- const typed = asObject(source);
9
- if (!typed) {
10
- return undefined;
11
- }
12
- const kind = typeof typed.kind === "string" ? typed.kind : undefined;
13
- const hasTypedEnvelope = typeof typed.apiVersion === "string" || !!asObject(typed.metadata);
14
- if (kind === "KnowledgeRuntime" || kind === "RuntimeMemory") {
15
- return asObject(typed.spec);
16
- }
17
- if (hasTypedEnvelope && asObject(typed.spec)) {
18
- return asObject(typed.spec);
19
- }
20
- return typed;
21
- }
22
- export function readKnowledgeRuntimeConfig(runtimeMemory, workspaceRoot) {
23
- const runtimeMemorySpec = readKnowledgeRuntimeSpec(runtimeMemory);
24
- const enabled = runtimeMemorySpec?.enabled === true;
25
- return {
26
- enabled,
27
- policy: readRuntimeMemoryPolicyConfig(runtimeMemorySpec, workspaceRoot) ?? null,
28
- maintenance: readRuntimeMemoryMaintenanceConfig(runtimeMemorySpec) ?? null,
29
- formation: readRuntimeMemoryFormationConfig(runtimeMemorySpec, workspaceRoot) ?? null,
30
- mem0: readMem0RuntimeConfig(runtimeMemorySpec, workspaceRoot) ?? null,
31
- };
32
- }
1
+ import{readRuntimeMemoryFormationConfig as o}from"../runtime/harness/system/runtime-memory-manager.js";import{readRuntimeMemoryMaintenanceConfig as m,readRuntimeMemoryPolicyConfig as d}from"../runtime/harness/system/runtime-memory-policy.js";import{readMem0RuntimeConfig as u}from"../runtime/harness/system/mem0-ingestion-sync.js";function t(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:void 0}function f(n){const e=t(n);if(!e)return;const i=typeof e.kind=="string"?e.kind:void 0,r=typeof e.apiVersion=="string"||!!t(e.metadata);return i==="KnowledgeRuntime"||i==="RuntimeMemory"||r&&t(e.spec)?t(e.spec):e}function p(n,e){const i=f(n);return{enabled:i?.enabled===!0,policy:d(i,e)??null,maintenance:m(i)??null,formation:o(i,e)??null,mem0:u(i,e)??null}}export{p as readKnowledgeRuntimeConfig};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +1 @@
1
- export { readKnowledgeRuntimeConfig } from "./config.js";
2
- export { createKnowledgeModule, DefaultKnowledgeModule } from "./module.js";
1
+ import{readKnowledgeRuntimeConfig as d}from"./config.js";import{createKnowledgeModule as r,DefaultKnowledgeModule as n}from"./module.js";export{n as DefaultKnowledgeModule,r as createKnowledgeModule,d as readKnowledgeRuntimeConfig};