@botbotgo/agent-harness 0.0.91 → 0.0.93

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 (39) hide show
  1. package/README.md +138 -31
  2. package/README.zh.md +93 -28
  3. package/dist/benchmark/upstream-runtime-ab-benchmark.d.ts +1 -1
  4. package/dist/benchmark/upstream-runtime-ab-benchmark.js +2 -1
  5. package/dist/config/workflows/langgraph-workflows.yaml +292 -0
  6. package/dist/contracts/types.d.ts +8 -3
  7. package/dist/init-project.js +7 -7
  8. package/dist/package-version.d.ts +1 -1
  9. package/dist/package-version.js +1 -1
  10. package/dist/runtime/agent-runtime-adapter.d.ts +48 -1
  11. package/dist/runtime/agent-runtime-adapter.js +1001 -50
  12. package/dist/runtime/harness.d.ts +2 -0
  13. package/dist/runtime/harness.js +55 -11
  14. package/dist/runtime/inventory.d.ts +1 -1
  15. package/dist/runtime/inventory.js +1 -1
  16. package/dist/runtime/langgraph-presets.d.ts +23 -0
  17. package/dist/runtime/langgraph-presets.js +165 -0
  18. package/dist/runtime/policy-engine.js +0 -5
  19. package/dist/runtime/support/compiled-binding.d.ts +4 -1
  20. package/dist/runtime/support/compiled-binding.js +24 -2
  21. package/dist/runtime/support/harness-support.js +3 -3
  22. package/dist/runtime/support/runtime-entry.js +1 -1
  23. package/dist/workspace/agent-binding-compiler.js +82 -8
  24. package/dist/workspace/compile.js +1 -3
  25. package/dist/workspace/object-loader.js +47 -6
  26. package/dist/workspace/support/agent-capabilities.js +2 -2
  27. package/dist/workspace/support/workspace-ref-utils.d.ts +2 -1
  28. package/dist/workspace/support/workspace-ref-utils.js +21 -0
  29. package/dist/workspace/validate.js +1 -1
  30. package/package.json +2 -2
  31. /package/dist/config/{backends.yaml → catalogs/backends.yaml} +0 -0
  32. /package/dist/config/{embedding-models.yaml → catalogs/embedding-models.yaml} +0 -0
  33. /package/dist/config/{mcp.yaml → catalogs/mcp.yaml} +0 -0
  34. /package/dist/config/{models.yaml → catalogs/models.yaml} +0 -0
  35. /package/dist/config/{stores.yaml → catalogs/stores.yaml} +0 -0
  36. /package/dist/config/{tools.yaml → catalogs/tools.yaml} +0 -0
  37. /package/dist/config/{vector-stores.yaml → catalogs/vector-stores.yaml} +0 -0
  38. /package/dist/config/{runtime-memory.yaml → runtime/runtime-memory.yaml} +0 -0
  39. /package/dist/config/{workspace.yaml → runtime/workspace.yaml} +0 -0
@@ -0,0 +1,292 @@
1
+ # agent-harness feature: schema version for this declarative config object.
2
+ apiVersion: agent-harness/v1alpha1
3
+ # agent-harness feature: catalog of reusable LangGraph-shaped workflow resources.
4
+ kind: LangGraphWorkflows
5
+ spec:
6
+ - id: default
7
+ entryNode: planner
8
+ nodes:
9
+ - id: planner
10
+ kind: planner
11
+ prompt: >-
12
+ You are the workflow planner. Produce a concise plan for the user request
13
+ before execution starts.
14
+ - id: executor
15
+ kind: executor
16
+ - id: reviewer
17
+ kind: reviewer
18
+ prompt: >-
19
+ Review the current result, call out missing verification or obvious gaps,
20
+ and state whether the work looks sufficient.
21
+ - id: replanner
22
+ kind: replanner
23
+ prompt: >-
24
+ Refine the plan based on the reviewer feedback and current result.
25
+ Return only the updated plan.
26
+ - id: finalizer
27
+ kind: finalizer
28
+ prompt: >-
29
+ Rewrite the current result into a concise user-facing final answer.
30
+ Preserve facts and caveats.
31
+ edges:
32
+ - from: planner
33
+ to: executor
34
+ - from: executor
35
+ to: reviewer
36
+ when: has_result
37
+ - from: reviewer
38
+ to: finalizer
39
+ when: review_ok
40
+ - from: reviewer
41
+ to: replanner
42
+ when: review_incomplete
43
+ - from: replanner
44
+ to: executor
45
+ when: has_plan
46
+ - id: react
47
+ entryNode: executor
48
+ nodes:
49
+ - id: executor
50
+ kind: executor
51
+ edges: []
52
+ - id: prompt-chaining
53
+ entryNode: planner
54
+ nodes:
55
+ - id: planner
56
+ kind: planner
57
+ prompt: >-
58
+ You are the workflow planner. Produce a concise execution plan for the user request
59
+ before execution starts.
60
+ - id: executor
61
+ kind: executor
62
+ - id: finalizer
63
+ kind: finalizer
64
+ prompt: >-
65
+ Rewrite the current result into a concise user-facing final answer.
66
+ Preserve facts and caveats.
67
+ edges:
68
+ - from: planner
69
+ to: executor
70
+ - from: executor
71
+ to: finalizer
72
+ when: has_result
73
+ - id: routing
74
+ entryNode: planner
75
+ nodes:
76
+ - id: planner
77
+ kind: planner
78
+ prompt: >-
79
+ You are the workflow planner. Produce a concise execution plan for the user request
80
+ before execution starts.
81
+ - id: specialist
82
+ kind: specialist
83
+ specialist: specialist
84
+ - id: finalizer
85
+ kind: finalizer
86
+ prompt: >-
87
+ Rewrite the current result into a concise user-facing final answer.
88
+ Preserve facts and caveats.
89
+ edges:
90
+ - from: planner
91
+ to: specialist
92
+ - from: specialist
93
+ to: finalizer
94
+ when: has_result
95
+ - id: parallelization
96
+ entryNode: planner
97
+ nodes:
98
+ - id: planner
99
+ kind: planner
100
+ prompt: >-
101
+ You are the workflow planner. Produce a concise execution plan for the user request
102
+ before execution starts.
103
+ - id: specialist
104
+ kind: specialist
105
+ specialist: specialist
106
+ - id: reviewer
107
+ kind: reviewer
108
+ prompt: >-
109
+ Review the current result, call out missing verification or obvious gaps,
110
+ and state whether the work looks sufficient.
111
+ - id: finalizer
112
+ kind: finalizer
113
+ prompt: >-
114
+ Rewrite the current result into a concise user-facing final answer.
115
+ Preserve facts and caveats.
116
+ edges:
117
+ - from: planner
118
+ to: specialist
119
+ - from: specialist
120
+ to: reviewer
121
+ when: has_result
122
+ - from: reviewer
123
+ to: finalizer
124
+ when: review_ok
125
+ - id: plan-execute
126
+ entryNode: planner
127
+ nodes:
128
+ - id: planner
129
+ kind: planner
130
+ prompt: >-
131
+ You are the workflow planner. Produce a concise execution plan for the user request
132
+ before execution starts.
133
+ - id: executor
134
+ kind: executor
135
+ - id: finalizer
136
+ kind: finalizer
137
+ prompt: >-
138
+ Rewrite the current result into a concise user-facing final answer.
139
+ Preserve facts and caveats.
140
+ edges:
141
+ - from: planner
142
+ to: executor
143
+ - from: executor
144
+ to: finalizer
145
+ when: has_result
146
+ - id: review-loop
147
+ entryNode: planner
148
+ nodes:
149
+ - id: planner
150
+ kind: planner
151
+ prompt: >-
152
+ You are the workflow planner. Produce a concise plan for the user request
153
+ before execution starts.
154
+ - id: executor
155
+ kind: executor
156
+ - id: reviewer
157
+ kind: reviewer
158
+ prompt: >-
159
+ Review the current result, call out missing verification or obvious gaps,
160
+ and state whether the work looks sufficient.
161
+ - id: replanner
162
+ kind: replanner
163
+ prompt: >-
164
+ Refine the plan based on the reviewer feedback and current result.
165
+ Return only the updated plan.
166
+ - id: finalizer
167
+ kind: finalizer
168
+ prompt: >-
169
+ Rewrite the current result into a concise user-facing final answer.
170
+ Preserve facts and caveats.
171
+ edges:
172
+ - from: planner
173
+ to: executor
174
+ - from: executor
175
+ to: reviewer
176
+ when: has_result
177
+ - from: reviewer
178
+ to: finalizer
179
+ when: review_ok
180
+ - from: reviewer
181
+ to: replanner
182
+ when: review_incomplete
183
+ - from: replanner
184
+ to: executor
185
+ when: has_plan
186
+ - id: evaluator-optimizer
187
+ entryNode: executor
188
+ nodes:
189
+ - id: executor
190
+ kind: executor
191
+ - id: reviewer
192
+ kind: reviewer
193
+ prompt: >-
194
+ Review the current result, call out missing verification or obvious gaps,
195
+ and state whether the work looks sufficient.
196
+ - id: replanner
197
+ kind: replanner
198
+ prompt: >-
199
+ Refine the plan based on the reviewer feedback and current result.
200
+ Return only the updated plan.
201
+ - id: finalizer
202
+ kind: finalizer
203
+ prompt: >-
204
+ Rewrite the current result into a concise user-facing final answer.
205
+ Preserve facts and caveats.
206
+ edges:
207
+ - from: executor
208
+ to: reviewer
209
+ when: has_result
210
+ - from: reviewer
211
+ to: finalizer
212
+ when: review_ok
213
+ - from: reviewer
214
+ to: replanner
215
+ when: review_incomplete
216
+ - from: replanner
217
+ to: executor
218
+ when: has_plan
219
+ - id: approval-gate
220
+ entryNode: planner
221
+ nodes:
222
+ - id: planner
223
+ kind: planner
224
+ prompt: >-
225
+ You are the workflow planner. Produce a concise execution plan for the user request
226
+ before execution starts.
227
+ - id: approval
228
+ kind: approval
229
+ - id: executor
230
+ kind: executor
231
+ - id: finalizer
232
+ kind: finalizer
233
+ prompt: >-
234
+ Rewrite the current result into a concise user-facing final answer.
235
+ Preserve facts and caveats.
236
+ edges:
237
+ - from: planner
238
+ to: approval
239
+ - from: approval
240
+ to: executor
241
+ when: approval_approved
242
+ - from: approval
243
+ to: executor
244
+ when: approval_edited
245
+ - from: executor
246
+ to: finalizer
247
+ when: has_result
248
+ - id: handoff
249
+ entryNode: specialist
250
+ nodes:
251
+ - id: specialist
252
+ kind: specialist
253
+ specialist: specialist
254
+ - id: finalizer
255
+ kind: finalizer
256
+ prompt: >-
257
+ Rewrite the current result into a concise user-facing final answer.
258
+ Preserve facts and caveats.
259
+ edges:
260
+ - from: specialist
261
+ to: finalizer
262
+ when: has_result
263
+ - id: orchestrator-workers
264
+ entryNode: planner
265
+ nodes:
266
+ - id: planner
267
+ kind: planner
268
+ prompt: >-
269
+ You are the workflow planner. Produce a concise plan for the user request
270
+ before execution starts.
271
+ - id: specialist
272
+ kind: specialist
273
+ specialist: specialist
274
+ - id: reviewer
275
+ kind: reviewer
276
+ prompt: >-
277
+ Review the current result, call out missing verification or obvious gaps,
278
+ and state whether the work looks sufficient.
279
+ - id: finalizer
280
+ kind: finalizer
281
+ prompt: >-
282
+ Rewrite the current result into a concise user-facing final answer.
283
+ Preserve facts and caveats.
284
+ edges:
285
+ - from: planner
286
+ to: specialist
287
+ - from: specialist
288
+ to: reviewer
289
+ when: has_result
290
+ - from: reviewer
291
+ to: finalizer
292
+ when: review_ok
@@ -1,5 +1,8 @@
1
- export type ExecutionMode = "deepagent" | "langchain-v1";
1
+ export type ExecutionMode = "deepagent" | "langchain-v1" | "langgraph";
2
2
  export declare const AUTO_AGENT_ID = "auto";
3
+ export type RuntimeModelSlot = "routing" | "planning" | "execution" | "review" | "final";
4
+ export type RuntimeModelRefMap = Partial<Record<RuntimeModelSlot, string>>;
5
+ export type RuntimeModelMap = Partial<Record<RuntimeModelSlot, CompiledModel>>;
3
6
  export type RuntimeCapabilities = {
4
7
  delegation?: boolean;
5
8
  memory?: boolean;
@@ -8,6 +11,7 @@ export type RunState = "queued" | "claimed" | "running" | "waiting_for_approval"
8
11
  export type ParsedAgentObject = {
9
12
  id: string;
10
13
  executionMode: ExecutionMode;
14
+ runtimeModelRefs?: RuntimeModelRefMap;
11
15
  capabilities?: RuntimeCapabilities;
12
16
  description: string;
13
17
  modelRef: string;
@@ -200,7 +204,8 @@ export type CompiledAgentBinding = {
200
204
  harnessRuntime: {
201
205
  runRoot: string;
202
206
  workspaceRoot?: string;
203
- runtimeEntry: boolean;
207
+ modelRefs?: RuntimeModelRefMap;
208
+ models?: RuntimeModelMap;
204
209
  capabilities?: RuntimeCapabilities;
205
210
  resilience?: Record<string, unknown>;
206
211
  checkpointer?: Record<string, unknown> | boolean;
@@ -239,7 +244,7 @@ export type ThreadSummary = {
239
244
  status: RunState;
240
245
  };
241
246
  export type SessionRecord = ThreadSummary;
242
- export type KnownHarnessEventType = "run.created" | "run.queued" | "run.dequeued" | "run.state.changed" | "run.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "reasoning.delta" | "runtime.health.changed" | "runtime.synthetic_fallback";
247
+ export type KnownHarnessEventType = "run.created" | "run.queued" | "run.dequeued" | "run.state.changed" | "run.reviewed" | "run.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "reasoning.delta" | "runtime.health.changed" | "runtime.synthetic_fallback";
243
248
  export type HarnessEventType = KnownHarnessEventType | (string & {});
244
249
  export type HarnessEvent = {
245
250
  eventId: string;
@@ -43,7 +43,7 @@ function renderPackageJson(projectSlug, template) {
43
43
  }
44
44
  function renderReadme(displayName, projectSlug, options) {
45
45
  const webSearchLine = options.withWebSearch
46
- ? `- ${options.provider} native web search enabled through \`config/tools.yaml\``
46
+ ? `- ${options.provider} native web search enabled through \`config/catalogs/tools.yaml\``
47
47
  : "- no provider-native web search by default";
48
48
  const providerEnvLine = options.provider === "openai" ? "export OPENAI_API_KEY=your_key_here\n" : "";
49
49
  const templateLine = options.template === "deep-research"
@@ -73,7 +73,7 @@ ${providerEnvLine}npm run start -- "Research the latest model serving stack for
73
73
 
74
74
  ## Customize
75
75
 
76
- - change \`config/models.yaml\` to switch models or providers
76
+ - change \`config/catalogs/models.yaml\` to switch models or providers
77
77
  - add local \`tool({...})\` tools under \`resources/tools/\`
78
78
  - add product-specific skills under \`resources/skills/\`
79
79
  - edit the prompts in \`config/agents/\` to turn this into your own product
@@ -316,12 +316,12 @@ export async function initProject(projectRoot, projectName, options = {}) {
316
316
  [".gitignore", renderGitignore()],
317
317
  ["README.md", renderReadme(displayName, projectSlug, resolved)],
318
318
  ["src/run.mjs", renderRunScript(resolved)],
319
- ["config/workspace.yaml", renderWorkspaceYaml()],
319
+ ["config/runtime/workspace.yaml", renderWorkspaceYaml()],
320
320
  ["config/agent-context.md", renderAgentContext(resolved)],
321
- ["config/models.yaml", renderModelsYaml(resolved)],
322
- ["config/runtime-memory.yaml", renderRuntimeMemoryYaml()],
323
- ["config/backends.yaml", renderBackendsYaml()],
324
- ["config/tools.yaml", renderToolsYaml(resolved)],
321
+ ["config/catalogs/models.yaml", renderModelsYaml(resolved)],
322
+ ["config/runtime/runtime-memory.yaml", renderRuntimeMemoryYaml()],
323
+ ["config/catalogs/backends.yaml", renderBackendsYaml()],
324
+ ["config/catalogs/tools.yaml", renderToolsYaml(resolved)],
325
325
  ["config/agents/research.yaml", renderResearchAgentYaml(resolved)],
326
326
  ["resources/package.json", renderResourcePackageJson(projectSlug)],
327
327
  ["resources/skills/deep-research/SKILL.md", renderSkill(resolved)],
@@ -1 +1 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.90";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.92";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.90";
1
+ export const AGENT_HARNESS_VERSION = "0.0.92";
@@ -1,4 +1,4 @@
1
- import type { CompiledAgentBinding, MessageContent, RunResult, RuntimeAdapterOptions, TranscriptMessage } from "../contracts/types.js";
1
+ import type { CompiledAgentBinding, CompiledModel, CompiledSubAgent, MessageContent, RunResult, RuntimeAdapterOptions, TranscriptMessage } from "../contracts/types.js";
2
2
  import { type RuntimeStreamChunk } from "./parsing/stream-event-parsing.js";
3
3
  type RunnableLike = {
4
4
  invoke: (input: unknown, config?: Record<string, unknown>) => Promise<unknown>;
@@ -19,10 +19,16 @@ export declare function materializeDeepAgentSkillSourcePaths(options: {
19
19
  ownerId: string;
20
20
  skillPaths?: string[];
21
21
  }): Promise<string[] | undefined>;
22
+ export declare function shouldRelaxDeepAgentDelegationPrompt(model: CompiledModel | undefined, params: {
23
+ subagents?: CompiledSubAgent[];
24
+ generalPurposeAgent?: boolean;
25
+ taskDescription?: string;
26
+ }): boolean;
22
27
  export declare class AgentRuntimeAdapter {
23
28
  private readonly options;
24
29
  private readonly modelCache;
25
30
  private readonly runnableCache;
31
+ private readonly langGraphSessions;
26
32
  constructor(options?: RuntimeAdapterOptions);
27
33
  private getModelCacheKey;
28
34
  private resolveBindingTimeout;
@@ -56,13 +62,53 @@ export declare class AgentRuntimeAdapter {
56
62
  private resolveDeepAgentAutomaticMiddleware;
57
63
  private resolveMiddleware;
58
64
  private resolveCheckpointer;
65
+ private resolveLangGraphWorkflowCheckpointer;
59
66
  private buildRouteSystemPrompt;
60
67
  private resolveSubagents;
68
+ private createLangChainRunnable;
69
+ private normalizeLangGraphWorkflowNode;
70
+ private listLangGraphWorkflowNodes;
71
+ private normalizeLangGraphWorkflowEdge;
72
+ private listLangGraphWorkflowEdges;
73
+ private shouldFollowLangGraphEdge;
74
+ private listLangGraphWorkflowNextNodes;
75
+ private extractInvocationRequestText;
76
+ private prependSystemMessage;
77
+ private replaceLastUserMessage;
78
+ private resolveLangGraphSessionKey;
79
+ private resolveLangGraphSessionIdentity;
80
+ private langGraphCheckpointNamespace;
81
+ private langGraphCheckpointConfig;
82
+ private buildLangGraphWorkflowCheckpoint;
83
+ private saveLangGraphSessionToCheckpointer;
84
+ private loadLangGraphSessionFromCheckpointer;
85
+ private clearLangGraphSessionInCheckpointer;
86
+ private langGraphSessionFilePath;
87
+ private artifactLangGraphSessionFilePath;
88
+ private legacyLangGraphSessionFilePath;
89
+ private saveLangGraphSession;
90
+ private loadLangGraphSession;
91
+ private clearLangGraphSession;
92
+ private invokeWorkflowNodeModel;
93
+ private invokeLangGraphSpecialist;
94
+ private createLangGraphRunnable;
95
+ private extractExecutedToolResults;
96
+ private extractLangGraphResultOutput;
97
+ private streamLangGraphWorkflow;
61
98
  private createRunnable;
62
99
  create(binding: CompiledAgentBinding): Promise<RunnableLike>;
63
100
  route(input: MessageContent, primaryBinding: CompiledAgentBinding, secondaryBinding: CompiledAgentBinding, options?: {
64
101
  systemPrompt?: string;
65
102
  }): Promise<string>;
103
+ reviewRunResult(binding: CompiledAgentBinding, input: MessageContent, result: Pick<RunResult, "output" | "state" | "finalMessageText">): Promise<{
104
+ assessment: string;
105
+ modelId: string;
106
+ } | null>;
107
+ synthesizeFinalResult(binding: CompiledAgentBinding, input: MessageContent, result: Pick<RunResult, "output" | "state" | "finalMessageText">): Promise<{
108
+ output: string;
109
+ finalMessageText: string;
110
+ modelId: string;
111
+ } | null>;
66
112
  invoke(binding: CompiledAgentBinding, input: MessageContent, threadId: string, runId: string, resumePayload?: unknown, history?: TranscriptMessage[], options?: {
67
113
  context?: Record<string, unknown>;
68
114
  state?: Record<string, unknown>;
@@ -72,6 +118,7 @@ export declare class AgentRuntimeAdapter {
72
118
  context?: Record<string, unknown>;
73
119
  state?: Record<string, unknown>;
74
120
  files?: Record<string, unknown>;
121
+ runId?: string;
75
122
  }): AsyncGenerator<RuntimeStreamChunk | string>;
76
123
  }
77
124
  export { AgentRuntimeAdapter as RuntimeAdapter, AGENT_INTERRUPT_SENTINEL_PREFIX, AGENT_INTERRUPT_SENTINEL_PREFIX as INTERRUPT_SENTINEL_PREFIX, RuntimeOperationTimeoutError, };