@botbotgo/agent-harness 0.0.95 → 0.0.97

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 (114) hide show
  1. package/README.md +1 -114
  2. package/README.zh.md +1 -70
  3. package/dist/api.d.ts +5 -5
  4. package/dist/config/workflows/langgraph-workflows.yaml +363 -111
  5. package/dist/config/workflows/runtime-profiles.yaml +94 -0
  6. package/dist/contracts/core.d.ts +9 -0
  7. package/dist/contracts/core.js +1 -0
  8. package/dist/contracts/runtime.d.ts +421 -0
  9. package/dist/contracts/runtime.js +1 -0
  10. package/dist/contracts/types.d.ts +3 -571
  11. package/dist/contracts/types.js +3 -1
  12. package/dist/contracts/workspace.d.ts +229 -0
  13. package/dist/contracts/workspace.js +1 -0
  14. package/dist/package-version.d.ts +1 -1
  15. package/dist/package-version.js +1 -1
  16. package/dist/runtime/adapter/compat/deepagent-compat.d.ts +16 -0
  17. package/dist/runtime/adapter/compat/deepagent-compat.js +45 -0
  18. package/dist/runtime/adapter/compat/openai-compatible.d.ts +2 -0
  19. package/dist/runtime/adapter/compat/openai-compatible.js +43 -0
  20. package/dist/runtime/adapter/index.d.ts +15 -0
  21. package/dist/runtime/adapter/index.js +15 -0
  22. package/dist/runtime/adapter/langgraph/presets.js +165 -0
  23. package/dist/runtime/{langgraph-profiles.d.ts → adapter/langgraph/profiles.d.ts} +1 -1
  24. package/dist/runtime/adapter/langgraph/profiles.js +206 -0
  25. package/dist/runtime/adapter/model/invocation-request.d.ts +10 -0
  26. package/dist/runtime/adapter/model/invocation-request.js +46 -0
  27. package/dist/runtime/adapter/model/message-assembly.d.ts +6 -0
  28. package/dist/runtime/adapter/model/message-assembly.js +21 -0
  29. package/dist/runtime/adapter/model/model-providers.d.ts +2 -0
  30. package/dist/runtime/adapter/model/model-providers.js +27 -0
  31. package/dist/runtime/adapter/resilience.d.ts +12 -0
  32. package/dist/runtime/adapter/resilience.js +60 -0
  33. package/dist/runtime/{declared-middleware.d.ts → adapter/tool/declared-middleware.d.ts} +1 -1
  34. package/dist/runtime/adapter/tool/interrupt-policy.d.ts +8 -0
  35. package/dist/runtime/adapter/tool/interrupt-policy.js +34 -0
  36. package/dist/runtime/adapter/tool/provider-tool.d.ts +2 -0
  37. package/dist/runtime/adapter/tool/provider-tool.js +25 -0
  38. package/dist/runtime/adapter/tool/resolved-tool.d.ts +18 -0
  39. package/dist/runtime/adapter/tool/resolved-tool.js +62 -0
  40. package/dist/runtime/adapter/tool/tool-arguments.d.ts +7 -0
  41. package/dist/runtime/adapter/tool/tool-arguments.js +87 -0
  42. package/dist/runtime/{tool-hitl.d.ts → adapter/tool/tool-hitl.d.ts} +2 -2
  43. package/dist/runtime/adapter/tool/tool-name-mapping.d.ts +13 -0
  44. package/dist/runtime/adapter/tool/tool-name-mapping.js +101 -0
  45. package/dist/runtime/agent-runtime-adapter.d.ts +5 -20
  46. package/dist/runtime/agent-runtime-adapter.js +42 -544
  47. package/dist/runtime/checkpoint-maintenance.d.ts +1 -45
  48. package/dist/runtime/checkpoint-maintenance.js +1 -259
  49. package/dist/runtime/file-checkpoint-saver.d.ts +1 -20
  50. package/dist/runtime/file-checkpoint-saver.js +1 -106
  51. package/dist/runtime/{event-bus.d.ts → harness/events/event-bus.d.ts} +1 -1
  52. package/dist/runtime/{event-sink.d.ts → harness/events/event-sink.d.ts} +1 -1
  53. package/dist/runtime/{event-sink.js → harness/events/event-sink.js} +1 -1
  54. package/dist/runtime/harness/events/events.d.ts +23 -0
  55. package/dist/runtime/harness/events/events.js +61 -0
  56. package/dist/runtime/harness/events/streaming.d.ts +19 -0
  57. package/dist/runtime/harness/events/streaming.js +96 -0
  58. package/dist/runtime/harness/index.d.ts +16 -0
  59. package/dist/runtime/harness/index.js +16 -0
  60. package/dist/runtime/harness/run/helpers.d.ts +33 -0
  61. package/dist/runtime/harness/run/helpers.js +74 -0
  62. package/dist/runtime/harness/run/resources.d.ts +7 -0
  63. package/dist/runtime/harness/run/resources.js +58 -0
  64. package/dist/runtime/harness/run/resume.d.ts +6 -0
  65. package/dist/runtime/harness/run/resume.js +56 -0
  66. package/dist/runtime/harness/run/routing.d.ts +12 -0
  67. package/dist/runtime/harness/run/routing.js +47 -0
  68. package/dist/runtime/harness/run/run-lifecycle.d.ts +37 -0
  69. package/dist/runtime/harness/run/run-lifecycle.js +109 -0
  70. package/dist/runtime/harness/run/run-queue.d.ts +17 -0
  71. package/dist/runtime/harness/run/run-queue.js +43 -0
  72. package/dist/runtime/{health-monitor.d.ts → harness/system/health-monitor.d.ts} +3 -3
  73. package/dist/runtime/{health-monitor.js → harness/system/health-monitor.js} +2 -2
  74. package/dist/runtime/{inventory.d.ts → harness/system/inventory.d.ts} +2 -2
  75. package/dist/runtime/{inventory.js → harness/system/inventory.js} +4 -4
  76. package/dist/runtime/{policy-engine.d.ts → harness/system/policy-engine.d.ts} +1 -1
  77. package/dist/runtime/{policy-engine.js → harness/system/policy-engine.js} +1 -1
  78. package/dist/runtime/{skill-requirements.d.ts → harness/system/skill-requirements.d.ts} +1 -1
  79. package/dist/runtime/{skill-requirements.js → harness/system/skill-requirements.js} +1 -1
  80. package/dist/runtime/{thread-memory-sync.d.ts → harness/system/thread-memory-sync.d.ts} +2 -2
  81. package/dist/runtime/{thread-memory-sync.js → harness/system/thread-memory-sync.js} +1 -1
  82. package/dist/runtime/harness.d.ts +2 -7
  83. package/dist/runtime/harness.js +158 -477
  84. package/dist/runtime/index.d.ts +7 -7
  85. package/dist/runtime/index.js +7 -7
  86. package/dist/runtime/maintenance/checkpoint-maintenance.d.ts +45 -0
  87. package/dist/runtime/maintenance/checkpoint-maintenance.js +259 -0
  88. package/dist/runtime/maintenance/file-checkpoint-saver.d.ts +20 -0
  89. package/dist/runtime/maintenance/file-checkpoint-saver.js +106 -0
  90. package/dist/runtime/maintenance/index.d.ts +4 -0
  91. package/dist/runtime/maintenance/index.js +4 -0
  92. package/dist/runtime/{runtime-record-maintenance.d.ts → maintenance/runtime-record-maintenance.d.ts} +1 -1
  93. package/dist/runtime/{runtime-record-maintenance.js → maintenance/runtime-record-maintenance.js} +2 -2
  94. package/dist/runtime/maintenance/sqlite-maintained-checkpoint-saver.d.ts +9 -0
  95. package/dist/runtime/maintenance/sqlite-maintained-checkpoint-saver.js +39 -0
  96. package/dist/runtime/parsing/stream-event-parsing.d.ts +6 -0
  97. package/dist/runtime/parsing/stream-event-parsing.js +231 -0
  98. package/dist/runtime/sqlite-maintained-checkpoint-saver.d.ts +1 -9
  99. package/dist/runtime/sqlite-maintained-checkpoint-saver.js +1 -39
  100. package/dist/runtime/support/harness-support.d.ts +4 -4
  101. package/dist/runtime/support/harness-support.js +14 -3
  102. package/dist/runtime/support/runtime-factories.d.ts +1 -1
  103. package/dist/runtime/support/runtime-factories.js +1 -1
  104. package/dist/workspace/agent-binding-compiler.js +39 -3
  105. package/dist/workspace/object-loader.js +5 -1
  106. package/package.json +4 -4
  107. package/dist/runtime/langgraph-presets.js +0 -165
  108. package/dist/runtime/langgraph-profiles.js +0 -206
  109. /package/dist/runtime/{langgraph-presets.d.ts → adapter/langgraph/presets.d.ts} +0 -0
  110. /package/dist/runtime/{declared-middleware.js → adapter/tool/declared-middleware.js} +0 -0
  111. /package/dist/runtime/{tool-hitl.js → adapter/tool/tool-hitl.js} +0 -0
  112. /package/dist/runtime/{event-bus.js → harness/events/event-bus.js} +0 -0
  113. /package/dist/runtime/{store.d.ts → harness/system/store.d.ts} +0 -0
  114. /package/dist/runtime/{store.js → harness/system/store.js} +0 -0
@@ -1,206 +0,0 @@
1
- const DEFAULT_PLANNER_PROMPT = "You are the workflow planner. Produce a concise execution plan for the user request before execution starts.";
2
- const DEFAULT_REVIEWER_PROMPT = "Review the current result, call out missing verification or obvious gaps, and state whether the work looks sufficient.";
3
- const DEFAULT_FINALIZER_PROMPT = "Rewrite the current result into a concise user-facing final answer. Preserve facts and caveats.";
4
- const DEFAULT_REPLANNER_PROMPT = "Refine the plan based on the reviewer feedback and current result. Return only the updated plan.";
5
- export const SUPPORTED_LANGGRAPH_PROFILES = [
6
- "coding-runtime",
7
- "personal-assistant",
8
- "research-runtime",
9
- "approval-review-runtime",
10
- "claw-style-assistant",
11
- "chat-operator",
12
- "copilot-sidecar",
13
- "task-delegation-hub",
14
- ];
15
- function readStringOption(options, key) {
16
- const value = options[key];
17
- return typeof value === "string" && value.trim() ? value.trim() : undefined;
18
- }
19
- function requireAgentOption(profile, options, key) {
20
- const value = readStringOption(options, key);
21
- if (value) {
22
- return value;
23
- }
24
- throw new Error(`LangGraph profile ${profile} requires with.${key}`);
25
- }
26
- function buildCodingRuntimeWorkflow(options) {
27
- const coderAgent = requireAgentOption("coding-runtime", options, "coderAgent");
28
- const verifierAgent = readStringOption(options, "verifierAgent");
29
- const needsVerification = Boolean(verifierAgent) || options.runIntegrationVerification === true;
30
- return {
31
- entryNode: "planner",
32
- nodes: [
33
- { id: "planner", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
34
- { id: "coder", kind: "agent", agent: coderAgent },
35
- { id: "reviewer", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
36
- { id: "replanner", kind: "llm", role: "replanner", prompt: DEFAULT_REPLANNER_PROMPT },
37
- ...(needsVerification
38
- ? [{ id: "approval", kind: "approval" }, { id: "verifier", kind: "agent", agent: verifierAgent ?? coderAgent }]
39
- : []),
40
- { id: "finalizer", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
41
- ],
42
- edges: [
43
- { from: "planner", to: "coder" },
44
- { from: "coder", to: "reviewer", when: "has_result" },
45
- { from: "reviewer", to: needsVerification ? "approval" : "finalizer", when: "review_ok" },
46
- { from: "reviewer", to: "replanner", when: "review_incomplete" },
47
- { from: "replanner", to: "coder", when: "has_plan" },
48
- ...(needsVerification
49
- ? [
50
- { from: "approval", to: "verifier", when: "approval_approved" },
51
- { from: "approval", to: "verifier", when: "approval_edited" },
52
- { from: "verifier", to: "finalizer", when: "has_result" },
53
- ]
54
- : []),
55
- ],
56
- };
57
- }
58
- function buildAssistantWorkflow(options) {
59
- const worker = readStringOption(options, "defaultWorkerAgent") ??
60
- readStringOption(options, "defaultResearchAgent") ??
61
- readStringOption(options, "defaultWritingAgent") ??
62
- readStringOption(options, "defaultSchedulingAgent");
63
- return {
64
- entryNode: "intake",
65
- nodes: [
66
- { id: "intake", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
67
- ...(worker ? [{ id: "worker", kind: "agent", agent: worker }] : [{ id: "lookup", kind: "tool", tool: "repo_inventory" }]),
68
- { id: "reviewer", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
69
- { id: "approval", kind: "approval" },
70
- { id: "finalizer", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
71
- ],
72
- edges: [
73
- { from: "intake", to: worker ? "worker" : "lookup" },
74
- { from: worker ? "worker" : "lookup", to: "reviewer", when: "has_result" },
75
- { from: "reviewer", to: "approval", when: "review_incomplete" },
76
- { from: "reviewer", to: "finalizer", when: "review_ok" },
77
- { from: "approval", to: "finalizer", when: "approval_approved" },
78
- { from: "approval", to: "finalizer", when: "approval_edited" },
79
- ],
80
- };
81
- }
82
- function buildResearchWorkflow(options) {
83
- const gathererAgent = requireAgentOption("research-runtime", options, "gathererAgent");
84
- const analystAgent = requireAgentOption("research-runtime", options, "analystAgent");
85
- const synthesizerAgent = readStringOption(options, "synthesizerAgent");
86
- return {
87
- entryNode: "planner",
88
- nodes: [
89
- { id: "planner", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
90
- { id: "gatherer", kind: "agent", agent: gathererAgent },
91
- { id: "coverage-review", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
92
- { id: "analyst", kind: "agent", agent: analystAgent },
93
- ...(synthesizerAgent ? [{ id: "synthesizer", kind: "agent", agent: synthesizerAgent }] : []),
94
- { id: "finalizer", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
95
- ],
96
- edges: [
97
- { from: "planner", to: "gatherer" },
98
- { from: "gatherer", to: "coverage-review", when: "has_result" },
99
- { from: "coverage-review", to: "analyst", when: "review_ok" },
100
- { from: "coverage-review", to: "gatherer", when: "review_incomplete" },
101
- { from: "analyst", to: synthesizerAgent ? "synthesizer" : "finalizer", when: "has_result" },
102
- ...(synthesizerAgent ? [{ from: "synthesizer", to: "finalizer", when: "has_result" }] : []),
103
- ],
104
- };
105
- }
106
- function buildApprovalReviewWorkflow(options) {
107
- const preparerAgent = requireAgentOption("approval-review-runtime", options, "preparerAgent");
108
- const reviewerAgent = readStringOption(options, "reviewerAgent");
109
- return {
110
- entryNode: "scope",
111
- nodes: [
112
- { id: "scope", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
113
- { id: "preparer", kind: "agent", agent: preparerAgent },
114
- ...(reviewerAgent ? [{ id: "reviewer-agent", kind: "agent", agent: reviewerAgent }] : [{ id: "risk-review", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT }]),
115
- { id: "approval", kind: "approval" },
116
- { id: "finalizer", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
117
- ],
118
- edges: [
119
- { from: "scope", to: "preparer" },
120
- { from: "preparer", to: reviewerAgent ? "reviewer-agent" : "risk-review", when: "has_result" },
121
- { from: reviewerAgent ? "reviewer-agent" : "risk-review", to: "approval", when: "has_result" },
122
- { from: "approval", to: "finalizer", when: "approval_approved" },
123
- { from: "approval", to: "finalizer", when: "approval_edited" },
124
- ],
125
- };
126
- }
127
- function buildChatOperatorWorkflow(options) {
128
- const routedAgent = readStringOption(options, "assistantAgent") ??
129
- readStringOption(options, "researchAgent") ??
130
- readStringOption(options, "codingAgent") ??
131
- readStringOption(options, "approvalAgent");
132
- if (!routedAgent) {
133
- throw new Error("LangGraph profile chat-operator requires at least one target agent in with.assistantAgent, with.researchAgent, with.codingAgent, or with.approvalAgent");
134
- }
135
- return {
136
- entryNode: "router",
137
- nodes: [
138
- { id: "router", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
139
- { id: "worker", kind: "agent", agent: routedAgent },
140
- { id: "finalizer", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
141
- ],
142
- edges: [
143
- { from: "router", to: "worker" },
144
- { from: "worker", to: "finalizer", when: "has_result" },
145
- ],
146
- };
147
- }
148
- function buildCopilotSidecarWorkflow(options) {
149
- const coderAgent = requireAgentOption("copilot-sidecar", options, "coderAgent");
150
- return {
151
- entryNode: "intake",
152
- nodes: [
153
- { id: "intake", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
154
- { id: "coder", kind: "agent", agent: coderAgent },
155
- { id: "finalizer", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
156
- ],
157
- edges: [
158
- { from: "intake", to: "coder" },
159
- { from: "coder", to: "finalizer", when: "has_result" },
160
- ],
161
- };
162
- }
163
- function buildDelegationHubWorkflow(options) {
164
- const workerAgent = readStringOption(options, "defaultWorkerFallback");
165
- if (!workerAgent) {
166
- throw new Error("LangGraph profile task-delegation-hub requires with.defaultWorkerFallback");
167
- }
168
- return {
169
- entryNode: "router",
170
- nodes: [
171
- { id: "router", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
172
- { id: "worker", kind: "agent", agent: workerAgent },
173
- { id: "reviewer", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
174
- { id: "finalizer", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
175
- ],
176
- edges: [
177
- { from: "router", to: "worker" },
178
- { from: "worker", to: "reviewer", when: "has_result" },
179
- { from: "reviewer", to: "finalizer", when: "review_ok" },
180
- ],
181
- };
182
- }
183
- export function resolveLangGraphProfileWorkflow(profileName, options = {}) {
184
- switch (profileName) {
185
- case undefined:
186
- case "":
187
- return undefined;
188
- case "coding-runtime":
189
- return buildCodingRuntimeWorkflow(options);
190
- case "personal-assistant":
191
- case "claw-style-assistant":
192
- return buildAssistantWorkflow(options);
193
- case "research-runtime":
194
- return buildResearchWorkflow(options);
195
- case "approval-review-runtime":
196
- return buildApprovalReviewWorkflow(options);
197
- case "chat-operator":
198
- return buildChatOperatorWorkflow(options);
199
- case "copilot-sidecar":
200
- return buildCopilotSidecarWorkflow(options);
201
- case "task-delegation-hub":
202
- return buildDelegationHubWorkflow(options);
203
- default:
204
- throw new Error(`Unsupported LangGraph profile ${String(profileName)}. Supported profiles: ${SUPPORTED_LANGGRAPH_PROFILES.join(", ")}`);
205
- }
206
- }