@botbotgo/agent-harness 0.0.110 → 0.0.112

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 (51) hide show
  1. package/README.md +0 -2
  2. package/README.zh.md +0 -2
  3. package/dist/config/agents/direct.yaml +58 -59
  4. package/dist/config/agents/orchestra.yaml +68 -70
  5. package/dist/contracts/core.d.ts +0 -2
  6. package/dist/contracts/runtime.d.ts +0 -17
  7. package/dist/contracts/workspace.d.ts +2 -7
  8. package/dist/init-project.js +10 -8
  9. package/dist/package-version.d.ts +1 -1
  10. package/dist/package-version.js +1 -1
  11. package/dist/persistence/file-store.d.ts +1 -5
  12. package/dist/persistence/file-store.js +1 -34
  13. package/dist/runtime/adapter/compat/deepagent-compat.d.ts +6 -0
  14. package/dist/runtime/adapter/compat/deepagent-compat.js +3 -0
  15. package/dist/runtime/adapter/{execution-context.d.ts → flow/execution-context.d.ts} +17 -3
  16. package/dist/runtime/adapter/{execution-context.js → flow/execution-context.js} +20 -2
  17. package/dist/runtime/adapter/flow/invocation-flow.d.ts +24 -0
  18. package/dist/runtime/adapter/flow/invocation-flow.js +42 -0
  19. package/dist/runtime/adapter/{invoke-runtime.d.ts → flow/invoke-runtime.d.ts} +3 -3
  20. package/dist/runtime/adapter/{invoke-runtime.js → flow/invoke-runtime.js} +1 -1
  21. package/dist/runtime/adapter/flow/runnable-assembly.d.ts +51 -0
  22. package/dist/runtime/adapter/flow/runnable-assembly.js +52 -0
  23. package/dist/runtime/adapter/{stream-runtime.d.ts → flow/stream-runtime.d.ts} +3 -3
  24. package/dist/runtime/adapter/{stream-runtime.js → flow/stream-runtime.js} +6 -6
  25. package/dist/runtime/adapter/invocation-result.js +4 -2
  26. package/dist/runtime/adapter/middleware-assembly.d.ts +1 -1
  27. package/dist/runtime/adapter/middleware-assembly.js +5 -8
  28. package/dist/runtime/adapter/runnable-config.d.ts +0 -2
  29. package/dist/runtime/adapter/runnable-config.js +0 -2
  30. package/dist/runtime/adapter/runtime-adapter-support.d.ts +0 -7
  31. package/dist/runtime/adapter/runtime-adapter-support.js +1 -23
  32. package/dist/runtime/adapter/runtime-shell.js +1 -1
  33. package/dist/runtime/adapter/tool/builtin-middleware-tools.js +10 -9
  34. package/dist/runtime/adapter/tool/tool-arguments.js +1 -3
  35. package/dist/runtime/adapter/tool-resolution.d.ts +1 -1
  36. package/dist/runtime/agent-runtime-adapter.d.ts +1 -1
  37. package/dist/runtime/agent-runtime-adapter.js +52 -81
  38. package/dist/runtime/harness/system/inventory.d.ts +2 -2
  39. package/dist/runtime/harness/system/inventory.js +5 -6
  40. package/dist/runtime/parsing/stream-event-parsing.js +2 -2
  41. package/dist/runtime/support/compiled-binding.d.ts +8 -2
  42. package/dist/runtime/support/compiled-binding.js +22 -10
  43. package/dist/runtime/support/skill-metadata.js +1 -3
  44. package/dist/utils/object.d.ts +3 -0
  45. package/dist/utils/object.js +6 -0
  46. package/dist/workspace/agent-binding-compiler.js +2 -22
  47. package/dist/workspace/object-loader.js +94 -23
  48. package/dist/workspace/support/agent-execution-config.js +16 -7
  49. package/dist/workspace/support/workspace-ref-utils.d.ts +1 -2
  50. package/dist/workspace/support/workspace-ref-utils.js +0 -12
  51. package/package.json +1 -1
@@ -151,9 +151,75 @@ const CONSUMED_AGENT_CONFIG_KEYS = [
151
151
  "generalPurposeAgent",
152
152
  "filesystem",
153
153
  ];
154
+ const RESERVED_EXECUTION_KEYS = [
155
+ "backend",
156
+ "modelRef",
157
+ "tools",
158
+ "skills",
159
+ "memory",
160
+ "subagents",
161
+ "mcpServers",
162
+ "config",
163
+ ];
164
+ const MIGRATED_EXECUTION_CONFIG_KEYS = [
165
+ "systemPrompt",
166
+ "checkpointer",
167
+ "interruptOn",
168
+ "stateSchema",
169
+ "responseFormat",
170
+ "contextSchema",
171
+ "includeAgentName",
172
+ "version",
173
+ "middleware",
174
+ "store",
175
+ "taskDescription",
176
+ "generalPurposeAgent",
177
+ "filesystem",
178
+ ];
154
179
  function readExecutionConfig(value) {
155
180
  return asMutableObject(value);
156
181
  }
182
+ function normalizeAgentItemForMerge(item) {
183
+ const normalized = { ...item };
184
+ const execution = readExecutionConfig(normalized.execution);
185
+ if (!execution) {
186
+ return normalized;
187
+ }
188
+ const config = asMutableObject(execution.config);
189
+ const runtime = readRuntimeConfig(normalized);
190
+ if (config) {
191
+ for (const key of MIGRATED_EXECUTION_CONFIG_KEYS) {
192
+ if (!(key in config) || execution[key] !== undefined) {
193
+ continue;
194
+ }
195
+ execution[key] = cloneConfigValue(config[key]);
196
+ delete config[key];
197
+ }
198
+ if (config.runtimeMemory !== undefined && runtime?.runtimeMemory === undefined) {
199
+ const nextRuntime = runtime ?? {};
200
+ nextRuntime.runtimeMemory = cloneConfigValue(config.runtimeMemory);
201
+ normalized.runtime = nextRuntime;
202
+ delete config.runtimeMemory;
203
+ }
204
+ }
205
+ if (config && Object.keys(config).length > 0) {
206
+ execution.config = config;
207
+ }
208
+ else {
209
+ delete execution.config;
210
+ }
211
+ normalized.execution = execution;
212
+ return normalized;
213
+ }
214
+ function readExecutionAgentConfig(item) {
215
+ const execution = readExecutionConfig(item.execution) ?? {};
216
+ const config = asMutableObject(execution.config) ?? {};
217
+ const directExecutionConfig = Object.fromEntries(Object.entries(execution).filter(([key]) => !RESERVED_EXECUTION_KEYS.includes(key)));
218
+ return {
219
+ ...config,
220
+ ...directExecutionConfig,
221
+ };
222
+ }
157
223
  function readExecutionValue(item, key, reader) {
158
224
  const execution = readExecutionConfig(item.execution);
159
225
  return reader(execution?.[key]);
@@ -161,19 +227,17 @@ function readExecutionValue(item, key, reader) {
161
227
  function readRuntimeConfig(item) {
162
228
  return asMutableObject(item.runtime);
163
229
  }
164
- function readRuntimeModelRefs(runtime) {
165
- if (!runtime) {
166
- return undefined;
230
+ function readRuntimeMemoryConfig(item, runtime) {
231
+ if (typeof runtime?.runtimeMemory === "object" && runtime.runtimeMemory && !Array.isArray(runtime.runtimeMemory)) {
232
+ return cloneConfigValue(runtime.runtimeMemory);
167
233
  }
168
- const modelRefs = {
169
- ...(typeof runtime.planningModelRef === "string" && runtime.planningModelRef.trim()
170
- ? { planning: runtime.planningModelRef.trim() }
171
- : {}),
172
- ...(typeof runtime.executionModelRef === "string" && runtime.executionModelRef.trim()
173
- ? { execution: runtime.executionModelRef.trim() }
174
- : {}),
175
- };
176
- return Object.keys(modelRefs).length > 0 ? modelRefs : undefined;
234
+ const legacyExecutionConfig = readExecutionAgentConfig(item);
235
+ if (typeof legacyExecutionConfig.runtimeMemory === "object" &&
236
+ legacyExecutionConfig.runtimeMemory &&
237
+ !Array.isArray(legacyExecutionConfig.runtimeMemory)) {
238
+ return cloneConfigValue(legacyExecutionConfig.runtimeMemory);
239
+ }
240
+ return undefined;
177
241
  }
178
242
  function cloneConfigValue(value) {
179
243
  if (Array.isArray(value)) {
@@ -239,12 +303,15 @@ function resolveExecutionBackend(item, current) {
239
303
  }
240
304
  return undefined;
241
305
  }
242
- function readSharedAgentConfigFields(config) {
306
+ function readSharedAgentConfigFields(config, options = {}) {
243
307
  return {
244
308
  ...(typeof config.store === "object" && config.store ? { store: config.store } : {}),
245
- ...(typeof config.runtimeMemory === "object" && config.runtimeMemory ? { runtimeMemory: config.runtimeMemory } : {}),
246
- ...(typeof config.taskDescription === "string" && config.taskDescription.trim() ? { taskDescription: config.taskDescription } : {}),
247
- ...(typeof config.generalPurposeAgent === "boolean" ? { generalPurposeAgent: config.generalPurposeAgent } : {}),
309
+ ...(options.includeDelegationControls && typeof config.taskDescription === "string" && config.taskDescription.trim()
310
+ ? { taskDescription: config.taskDescription }
311
+ : {}),
312
+ ...(options.includeDelegationControls && typeof config.generalPurposeAgent === "boolean"
313
+ ? { generalPurposeAgent: config.generalPurposeAgent }
314
+ : {}),
248
315
  };
249
316
  }
250
317
  function readSharedAgentConfig(config) {
@@ -268,11 +335,11 @@ function readSharedAgentConfig(config) {
268
335
  };
269
336
  }
270
337
  function readAgentConfig(item, options = {}) {
271
- const config = readExecutionValue(item, "config", asMutableObject) ?? {};
338
+ const config = readExecutionAgentConfig(item);
272
339
  const passthrough = readPassthroughConfig(config, [...CONSUMED_AGENT_CONFIG_KEYS]);
273
340
  return {
274
341
  ...readSharedAgentConfig(config),
275
- ...readSharedAgentConfigFields(config),
342
+ ...readSharedAgentConfigFields(config, { includeDelegationControls: options.includeDelegationControls }),
276
343
  ...(options.includeObjectBackend && typeof config.backend === "object" && config.backend ? { backend: config.backend } : {}),
277
344
  ...(passthrough ? { passthrough } : {}),
278
345
  };
@@ -286,7 +353,7 @@ export function parseAgentItem(item, sourcePath) {
286
353
  return {
287
354
  id: String(item.id),
288
355
  executionMode: executionMode,
289
- runtimeModelRefs: readRuntimeModelRefs(runtime),
356
+ runtimeMemory: readRuntimeMemoryConfig(item, runtime),
290
357
  capabilities: readCapabilities(item.capabilities) ?? (executionMode === "deepagent"
291
358
  ? { delegation: true, memory: true }
292
359
  : { delegation: true, memory: true }),
@@ -299,8 +366,11 @@ export function parseAgentItem(item, sourcePath) {
299
366
  memorySources: readExecutionValue(item, "memory", readPathArray).map((entry) => resolveModuleRelativePath(entry, moduleRoot)),
300
367
  subagentRefs,
301
368
  subagentPathRefs,
302
- langchainAgentConfig: normalizeModuleAgentConfig(readAgentConfig(item), moduleRoot),
303
- deepAgentConfig: normalizeModuleAgentConfig(readAgentConfig(item, { includeObjectBackend: true }), moduleRoot),
369
+ langchainAgentConfig: normalizeModuleAgentConfig(readAgentConfig(item, { includeDelegationControls: true }), moduleRoot),
370
+ deepAgentConfig: normalizeModuleAgentConfig(readAgentConfig(item, {
371
+ includeObjectBackend: true,
372
+ includeDelegationControls: false,
373
+ }), moduleRoot),
304
374
  sourcePath,
305
375
  };
306
376
  }
@@ -347,11 +417,12 @@ function mergeRawItemRecord(records, key, item, sourcePath) {
347
417
  return mergedRecord;
348
418
  }
349
419
  function mergeAgentRecord(records, item, sourcePath) {
350
- const id = typeof item.id === "string" ? item.id : undefined;
420
+ const normalizedItem = normalizeAgentItemForMerge(item);
421
+ const id = typeof normalizedItem.id === "string" ? normalizedItem.id : undefined;
351
422
  if (!id) {
352
423
  return null;
353
424
  }
354
- return mergeRawItemRecord(records, id, item, sourcePath);
425
+ return mergeRawItemRecord(records, id, normalizedItem, sourcePath);
355
426
  }
356
427
  function mergeWorkspaceObjectRecord(records, workspaceObject, item, sourcePath) {
357
428
  mergeRawItemRecord(records, `${workspaceObject.kind}/${workspaceObject.id}`, item, sourcePath);
@@ -1,12 +1,21 @@
1
- function asRecord(value) {
2
- return typeof value === "object" && value !== null && !Array.isArray(value)
3
- ? value
4
- : undefined;
1
+ import { asRecord } from "../../utils/object.js";
2
+ const agentExecutionViewsCache = new WeakMap();
3
+ function deriveAgentExecutionViews(agent) {
4
+ const cached = agentExecutionViewsCache.get(agent);
5
+ if (cached) {
6
+ return cached;
7
+ }
8
+ const langchainConfig = asRecord(agent.langchainAgentConfig);
9
+ const deepAgentConfig = asRecord(agent.deepAgentConfig);
10
+ const views = {
11
+ "langchain-v1": [langchainConfig, deepAgentConfig].filter((config) => config !== undefined),
12
+ deepagent: [deepAgentConfig, langchainConfig].filter((config) => config !== undefined),
13
+ };
14
+ agentExecutionViewsCache.set(agent, views);
15
+ return views;
5
16
  }
6
17
  function getConfigsForMode(agent, executionMode = agent.executionMode) {
7
- const primary = executionMode === "deepagent" ? asRecord(agent.deepAgentConfig) : asRecord(agent.langchainAgentConfig);
8
- const fallback = executionMode === "deepagent" ? asRecord(agent.langchainAgentConfig) : asRecord(agent.deepAgentConfig);
9
- return [primary, fallback].filter((config) => config !== undefined);
18
+ return deriveAgentExecutionViews(agent)[executionMode];
10
19
  }
11
20
  export function getAgentExecutionConfigs(agent, executionMode = agent.executionMode) {
12
21
  return getConfigsForMode(agent, executionMode);
@@ -1,4 +1,4 @@
1
- import type { ParsedAgentObject, RuntimeModelRefMap, WorkspaceObject } from "../../contracts/types.js";
1
+ import type { ParsedAgentObject, WorkspaceObject } from "../../contracts/types.js";
2
2
  export type RoutingRule = {
3
3
  agentId: string;
4
4
  equals?: string[];
@@ -34,7 +34,6 @@ export type ResilienceConfig = {
34
34
  export declare function getWorkspaceObject(refs: Map<string, WorkspaceObject | ParsedAgentObject>, ref: string | undefined): WorkspaceObject | undefined;
35
35
  export declare function getRuntimeDefaults(refs: Map<string, WorkspaceObject | ParsedAgentObject>): Record<string, unknown> | undefined;
36
36
  export declare function getRuntimeMemoryDefaults(refs: Map<string, WorkspaceObject | ParsedAgentObject>): Record<string, unknown> | undefined;
37
- export declare function getRuntimeModelDefaults(refs: Map<string, WorkspaceObject | ParsedAgentObject>): RuntimeModelRefMap | undefined;
38
37
  export declare function getRecoveryConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): RecoveryConfig;
39
38
  export declare function getConcurrencyConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): ConcurrencyConfig;
40
39
  export declare function getResilienceConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): ResilienceConfig;
@@ -36,18 +36,6 @@ export function getRuntimeMemoryDefaults(refs) {
36
36
  }
37
37
  return runtimeMemories[0].value;
38
38
  }
39
- export function getRuntimeModelDefaults(refs) {
40
- const runtimeDefaults = getRuntimeDefaults(refs);
41
- const modelRefs = {
42
- ...(typeof runtimeDefaults?.planningModelRef === "string" && runtimeDefaults.planningModelRef.trim()
43
- ? { planning: runtimeDefaults.planningModelRef.trim() }
44
- : {}),
45
- ...(typeof runtimeDefaults?.executionModelRef === "string" && runtimeDefaults.executionModelRef.trim()
46
- ? { execution: runtimeDefaults.executionModelRef.trim() }
47
- : {}),
48
- };
49
- return Object.keys(modelRefs).length > 0 ? modelRefs : undefined;
50
- }
51
39
  export function getRecoveryConfig(refs) {
52
40
  const runtimeDefaults = getRuntimeDefaults(refs);
53
41
  const recovery = typeof runtimeDefaults?.recovery === "object" && runtimeDefaults.recovery
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.110",
3
+ "version": "0.0.112",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "type": "module",
6
6
  "packageManager": "npm@10.9.2",