@botbotgo/agent-harness 0.0.117 → 0.0.119

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.
@@ -180,13 +180,34 @@ export type DeepAgentParams = {
180
180
  memory: string[];
181
181
  skills: string[];
182
182
  };
183
+ export type CompiledExecutionBinding = {
184
+ kind: "langchain-v1";
185
+ params: LangChainAgentParams;
186
+ } | {
187
+ kind: "deepagent";
188
+ params: DeepAgentParams;
189
+ };
183
190
  export type CompiledAgentBinding = {
184
191
  agent: ParsedAgentObject;
185
192
  adapter?: {
186
193
  kind: string;
187
194
  config?: Record<string, unknown>;
188
195
  };
196
+ /**
197
+ * Canonical execution binding compiled from workspace YAML.
198
+ * Runtime code should prefer this field and treat backend-specific aliases
199
+ * below as compatibility shims.
200
+ */
201
+ execution?: CompiledExecutionBinding;
202
+ /**
203
+ * Compatibility alias for older tests and callers.
204
+ * Prefer `execution.kind === "langchain-v1"` and `execution.params`.
205
+ */
189
206
  langchainAgentParams?: LangChainAgentParams;
207
+ /**
208
+ * Compatibility alias for older tests and callers.
209
+ * Prefer `execution.kind === "deepagent"` and `execution.params`.
210
+ */
190
211
  deepAgentParams?: DeepAgentParams;
191
212
  harnessRuntime: {
192
213
  runRoot: string;
@@ -1 +1 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.116";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.118";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.116";
1
+ export const AGENT_HARNESS_VERSION = "0.0.118";
@@ -5,6 +5,7 @@ import { stat } from "node:fs/promises";
5
5
  import { readFile } from "node:fs/promises";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import { CompositeBackend, LocalShellBackend, StateBackend, StoreBackend } from "deepagents";
8
+ import { getBindingBackendConfig } from "../runtime/support/compiled-binding.js";
8
9
  import { createRuntimeEnv } from "../runtime/support/runtime-env.js";
9
10
  import { isSupportedToolModulePath, loadToolModuleDefinition } from "../tool-modules.js";
10
11
  import { createMcpToolResolver, } from "./mcp-tool-support.js";
@@ -175,7 +176,7 @@ function createInlineBackendInstance(workspaceRoot, kind, config, runtimeLike) {
175
176
  }
176
177
  function createInlineBackendResolver(workspace) {
177
178
  return (binding) => {
178
- const backendConfig = binding.deepAgentParams?.backend;
179
+ const backendConfig = getBindingBackendConfig(binding);
179
180
  if (!backendConfig || typeof backendConfig !== "object") {
180
181
  return undefined;
181
182
  }
@@ -1,5 +1,5 @@
1
1
  import { buildExecutableToolMap } from "../tool-resolution.js";
2
- import { getBindingLangChainParams, getBindingPrimaryModel, getBindingPrimaryTools, isLangChainBinding } from "../../support/compiled-binding.js";
2
+ import { getBindingPrimaryModel, getBindingPrimaryTools, isLangChainBinding } from "../../support/compiled-binding.js";
3
3
  export function buildBindingToolCatalog(input) {
4
4
  const primaryTools = getBindingPrimaryTools(input.binding);
5
5
  const toolNameMapping = input.getToolNameMapping(input.binding);
@@ -31,11 +31,10 @@ export async function resolveLangChainStreamContext(input) {
31
31
  const forceInvokeFallback = isLangChainBinding(input.binding) &&
32
32
  primaryTools.length > 0 &&
33
33
  primaryModel?.provider === "openai-compatible";
34
- const langchainParams = isLangChainBinding(input.binding) ? getBindingLangChainParams(input.binding) : undefined;
35
- const resolvedLangChainModel = langchainParams
36
- ? (await input.resolveModel(langchainParams.model))
34
+ const resolvedLangChainModel = primaryModel
35
+ ? (await input.resolveModel(primaryModel))
37
36
  : undefined;
38
- const resolvedLangChainTools = langchainParams ? input.resolveTools(langchainParams.tools, input.binding) : [];
37
+ const resolvedLangChainTools = primaryTools.length > 0 ? input.resolveTools(primaryTools, input.binding) : [];
39
38
  const canUseDirectModelStream = !!resolvedLangChainModel &&
40
39
  (resolvedLangChainTools.length === 0 || typeof resolvedLangChainModel.bindTools !== "function");
41
40
  const langChainStreamModel = resolvedLangChainModel && canUseDirectModelStream
@@ -6,7 +6,7 @@ import { compileInterruptOn } from "./tool/interrupt-policy.js";
6
6
  import { extractToolFallbackContext, extractVisibleOutput } from "../parsing/output-parsing.js";
7
7
  import { isRecord } from "../../utils/object.js";
8
8
  import { resolveDeclaredMiddleware } from "./tool/declared-middleware.js";
9
- import { bindingHasLangChainSubagentSupport, bindingHasMiddlewareKind, getBindingDeepAgentParams, getBindingInterruptCompatibilityRules, getBindingLangChainParams, getBindingMiddlewareConfigs, getBindingPrimaryModel, isDeepAgentBinding, isLangChainBinding, } from "../support/compiled-binding.js";
9
+ import { bindingHasLangChainSubagentSupport, bindingHasMiddlewareKind, getBindingExecutionKind, getBindingGeneralPurposeAgent, getBindingInterruptCompatibilityRules, getBindingMiddlewareConfigs, getBindingMemorySources, getBindingPrimaryModel, getBindingPrimaryTools, getBindingSkills, getBindingSubagents, getBindingTaskDescription, isDeepAgentBinding, isLangChainBinding, } from "../support/compiled-binding.js";
10
10
  import { applyDeepAgentDelegationPromptCompatibility, materializeDeepAgentSkillSourcePaths } from "./compat/deepagent-compat.js";
11
11
  export function buildBuiltinTaskSubagentMiddleware(input) {
12
12
  const { selectedSubagent, builtinBackend, summarizationModel } = input;
@@ -105,24 +105,26 @@ export async function resolveSubagents(input) {
105
105
  }));
106
106
  }
107
107
  export async function invokeBuiltinTaskTool(input) {
108
- if (!isDeepAgentBinding(input.binding)) {
108
+ if (!isDeepAgentBinding(input.binding) || getBindingExecutionKind(input.binding) !== "deepagent") {
109
109
  throw new Error("The built-in task tool is only available for deepagent bindings.");
110
110
  }
111
- const params = getBindingDeepAgentParams(input.binding);
112
- if (!params) {
111
+ const primaryModel = getBindingPrimaryModel(input.binding);
112
+ const primaryTools = getBindingPrimaryTools(input.binding);
113
+ const compiledSubagents = getBindingSubagents(input.binding);
114
+ if (!primaryModel) {
113
115
  throw new Error(`Agent ${input.binding.agent.id} has no deepagent params`);
114
116
  }
115
117
  const typedInput = isRecord(input.toolInput) ? input.toolInput : {};
116
118
  const description = typeof typedInput.description === "string" ? typedInput.description : "";
117
119
  const subagentType = typeof typedInput.subagent_type === "string" ? typedInput.subagent_type : "";
118
120
  const builtinBackend = input.resolveBuiltinMiddlewareBackend(input.binding, input.options);
119
- const resolvedSubagents = await input.resolveSubagents(params.subagents, input.binding);
121
+ const resolvedSubagents = await input.resolveSubagents(compiledSubagents, input.binding);
120
122
  const selectedSubagent = resolvedSubagents.find((subagent) => subagent.name === subagentType);
121
123
  if (!selectedSubagent) {
122
124
  const allowed = resolvedSubagents.map((subagent) => subagent.name);
123
125
  throw new Error(`Error: invoked agent of type ${subagentType}, the only allowed types are ${allowed.map((name) => `\`${name}\``).join(", ")}`);
124
126
  }
125
- const resolvedHostModel = selectedSubagent.model ? undefined : await input.resolveModel(params.model);
127
+ const resolvedHostModel = selectedSubagent.model ? undefined : await input.resolveModel(primaryModel);
126
128
  const summarizationModel = selectedSubagent.model ?? resolvedHostModel;
127
129
  const middleware = buildBuiltinTaskSubagentMiddleware({
128
130
  selectedSubagent,
@@ -131,7 +133,7 @@ export async function invokeBuiltinTaskTool(input) {
131
133
  });
132
134
  const runnable = createAgent({
133
135
  model: (selectedSubagent.model ?? resolvedHostModel),
134
- tools: (selectedSubagent.tools ?? input.resolveTools(params.tools, input.binding)),
136
+ tools: (selectedSubagent.tools ?? input.resolveTools(primaryTools, input.binding)),
135
137
  systemPrompt: selectedSubagent.systemPrompt ?? DEFAULT_SUBAGENT_PROMPT,
136
138
  middleware: middleware,
137
139
  responseFormat: selectedSubagent.responseFormat,
@@ -163,29 +165,30 @@ export async function resolveAutomaticSummarizationMiddleware(input) {
163
165
  return resolveDeclaredMiddleware([{ kind: "summarization", model: primaryModel }], input.createDeclaredMiddlewareResolverOptions(input.binding));
164
166
  }
165
167
  export async function resolveLangChainAutomaticMiddleware(input) {
166
- const params = getBindingLangChainParams(input.binding);
167
- if (!params) {
168
+ const primaryModel = getBindingPrimaryModel(input.binding);
169
+ const primaryTools = getBindingPrimaryTools(input.binding);
170
+ if (!isLangChainBinding(input.binding) || !primaryModel) {
168
171
  return [];
169
172
  }
170
173
  const delegationCompatibility = resolveLangChainDelegationCompatibility({
171
- model: params.model,
172
- subagents: params.subagents,
173
- generalPurposeAgent: params.generalPurposeAgent,
174
- taskDescription: params.taskDescription,
174
+ model: primaryModel,
175
+ subagents: getBindingSubagents(input.binding),
176
+ generalPurposeAgent: getBindingGeneralPurposeAgent(input.binding),
177
+ taskDescription: getBindingTaskDescription(input.binding),
175
178
  });
176
179
  const automaticMiddleware = [];
177
180
  automaticMiddleware.push(createPatchToolCallsMiddleware());
178
181
  automaticMiddleware.push(...(await input.resolveAutomaticSummarizationMiddleware(input.binding)));
179
182
  automaticMiddleware.push(...buildLangChainContextMiddleware({
180
183
  binding: input.binding,
181
- skills: params.skills,
182
- memory: params.memory,
184
+ skills: getBindingSkills(input.binding),
185
+ memory: getBindingMemorySources(input.binding),
183
186
  resolveFilesystemBackend: input.resolveFilesystemBackend,
184
187
  }));
185
188
  if (bindingHasLangChainSubagentSupport(input.binding)) {
186
189
  automaticMiddleware.push(createSubAgentMiddleware({
187
- defaultModel: (await input.resolveModel(params.model)),
188
- defaultTools: input.resolveTools(params.tools, input.binding),
190
+ defaultModel: (await input.resolveModel(primaryModel)),
191
+ defaultTools: input.resolveTools(primaryTools, input.binding),
189
192
  defaultInterruptOn: getBindingInterruptCompatibilityRules(input.binding),
190
193
  subagents: (await input.resolveSubagents(delegationCompatibility.subagents ?? [], input.binding)),
191
194
  generalPurposeAgent: delegationCompatibility.generalPurposeAgent,
@@ -1,3 +1,4 @@
1
+ import { getBindingSkills } from "../../support/compiled-binding.js";
1
2
  import { extractMessageText, normalizeMessageContent } from "../../../utils/message-content.js";
2
3
  import { readSkillMetadata } from "../../support/skill-metadata.js";
3
4
  export function buildAgentMessages(history, input) {
@@ -14,7 +15,7 @@ export function buildSlashCommandSkillInstruction(binding, input) {
14
15
  }
15
16
  const invokedName = match[1].toLowerCase();
16
17
  const argumentText = match[2]?.trim() ?? "";
17
- const skillPaths = binding.deepAgentParams?.skills ?? binding.langchainAgentParams?.skills ?? [];
18
+ const skillPaths = getBindingSkills(binding);
18
19
  const matchedSkillPath = skillPaths.find((skillPath) => readSkillMetadata(skillPath).name.toLowerCase() === invokedName);
19
20
  if (!matchedSkillPath) {
20
21
  return undefined;
@@ -2,7 +2,7 @@ import { setTimeout as sleep } from "node:timers/promises";
2
2
  import { extractVisibleOutput, isToolCallParseFailure, STRICT_TOOL_JSON_INSTRUCTION } from "../parsing/output-parsing.js";
3
3
  import { readStreamDelta } from "../parsing/stream-event-parsing.js";
4
4
  import { computeRemainingTimeoutMs, isRetryableProviderError, resolveProviderRetryPolicy } from "./resilience.js";
5
- import { getBindingDeepAgentParams, getBindingLangChainParams, isDeepAgentBinding, isLangChainBinding, } from "../support/compiled-binding.js";
5
+ import { isDeepAgentBinding, isLangChainBinding, withUpdatedBindingExecutionParams, } from "../support/compiled-binding.js";
6
6
  export class RuntimeOperationTimeoutError extends Error {
7
7
  operation;
8
8
  timeoutMs;
@@ -134,24 +134,16 @@ export function createModelFallbackRunnable(model) {
134
134
  }
135
135
  export function applyStrictToolJsonInstruction(binding) {
136
136
  if (isLangChainBinding(binding)) {
137
- const params = getBindingLangChainParams(binding);
138
- return {
139
- ...binding,
140
- langchainAgentParams: {
141
- ...params,
142
- systemPrompt: [params.systemPrompt, STRICT_TOOL_JSON_INSTRUCTION].filter(Boolean).join("\n\n"),
143
- },
144
- };
137
+ return withUpdatedBindingExecutionParams(binding, (params) => ({
138
+ ...params,
139
+ systemPrompt: [params.systemPrompt, STRICT_TOOL_JSON_INSTRUCTION].filter(Boolean).join("\n\n"),
140
+ }));
145
141
  }
146
142
  if (isDeepAgentBinding(binding)) {
147
- const params = getBindingDeepAgentParams(binding);
148
- return {
149
- ...binding,
150
- deepAgentParams: {
151
- ...params,
152
- systemPrompt: [params.systemPrompt, STRICT_TOOL_JSON_INSTRUCTION].filter(Boolean).join("\n\n"),
153
- },
154
- };
143
+ return withUpdatedBindingExecutionParams(binding, (params) => ({
144
+ ...params,
145
+ systemPrompt: [params.systemPrompt, STRICT_TOOL_JSON_INSTRUCTION].filter(Boolean).join("\n\n"),
146
+ }));
155
147
  }
156
148
  return binding;
157
149
  }
@@ -18,7 +18,7 @@ export { applyDeepAgentDelegationPromptCompatibility, materializeDeepAgentSkillS
18
18
  export { buildAuthOmittingFetch, normalizeOpenAICompatibleInit } from "./adapter/compat/openai-compatible.js";
19
19
  export { buildToolNameMapping, createModelFacingToolNameCandidates, createModelFacingToolNameLookupCandidates, resolveModelFacingToolName, sanitizeToolNameForModel, } from "./adapter/tool/tool-name-mapping.js";
20
20
  export { computeRemainingTimeoutMs, isRetryableProviderError, resolveBindingTimeout, resolveProviderRetryPolicy, resolveStreamIdleTimeout, resolveTimeoutMs, } from "./adapter/resilience.js";
21
- import { getBindingAdapterKind, getBindingDeepAgentParams, getBindingInterruptCompatibilityRules, getBindingLangChainParams, getBindingToolCount, getBindingPrimaryTools, getBindingSystemPrompt, isDeepAgentBinding, isLangChainBinding, } from "./support/compiled-binding.js";
21
+ import { getBindingAdapterKind, getBindingExecutionKind, getBindingExecutionParams, getBindingFilesystemConfig, getBindingInterruptCompatibilityRules, getBindingPrimaryModel, getBindingSkills, getBindingSubagents, getBindingToolCount, getBindingPrimaryTools, getBindingSystemPrompt, isDeepAgentBinding, isLangChainBinding, } from "./support/compiled-binding.js";
22
22
  const AGENT_INTERRUPT_SENTINEL_PREFIX = "__agent_harness_interrupt__:";
23
23
  const UPSTREAM_BUILTIN_MIDDLEWARE_TOOL_NAMES = Object.freeze([
24
24
  "write_todos",
@@ -37,17 +37,43 @@ export function resolveRunnableCheckpointer(options, binding) {
37
37
  export function resolveRunnableInterruptOn(binding) {
38
38
  return compileInterruptOn(getBindingPrimaryTools(binding), getBindingInterruptCompatibilityRules(binding));
39
39
  }
40
+ function buildUpstreamCreateBaseParams(binding, compileOnlyFields) {
41
+ const executionParams = getBindingExecutionParams(binding);
42
+ if (!executionParams) {
43
+ throw new Error(`Agent ${binding.agent.id} has no compiled execution params`);
44
+ }
45
+ const source = executionParams;
46
+ const passthrough = typeof source.passthrough === "object" && source.passthrough
47
+ ? source.passthrough
48
+ : undefined;
49
+ const stripped = Object.fromEntries(Object.entries(source).filter(([key]) => key !== "passthrough" && !compileOnlyFields.includes(key)));
50
+ return {
51
+ ...(passthrough ?? {}),
52
+ ...stripped,
53
+ };
54
+ }
40
55
  export function buildLangChainCreateParams(input) {
41
- const langchainParams = getBindingLangChainParams(input.binding);
42
- if (!langchainParams) {
56
+ const executionKind = getBindingExecutionKind(input.binding);
57
+ const executionParams = getBindingExecutionParams(input.binding);
58
+ if (executionKind !== "langchain-v1" || !executionParams) {
43
59
  throw new Error(`Agent ${input.binding.agent.id} has no langchain params`);
44
60
  }
45
- const { model: _compiledModel, tools: _compiledTools, middleware: _compiledMiddleware, interruptOn: _compiledInterruptOn, filesystem: _filesystem, subagents: _subagents, memory: _memory, skills: _skills, generalPurposeAgent: _generalPurposeAgent, taskDescription: _taskDescription, passthrough, systemPrompt, ...upstreamParams } = langchainParams;
61
+ const upstreamParams = buildUpstreamCreateBaseParams(input.binding, [
62
+ "model",
63
+ "tools",
64
+ "middleware",
65
+ "interruptOn",
66
+ "filesystem",
67
+ "subagents",
68
+ "memory",
69
+ "skills",
70
+ "generalPurposeAgent",
71
+ "taskDescription",
72
+ ]);
46
73
  return {
47
- ...(passthrough ?? {}),
48
- ...(input.passthroughOverride ?? {}),
49
74
  ...upstreamParams,
50
- systemPrompt: input.systemPromptOverride ?? systemPrompt,
75
+ ...(input.passthroughOverride ?? {}),
76
+ systemPrompt: input.systemPromptOverride ?? executionParams.systemPrompt,
51
77
  model: input.resolvedModel,
52
78
  tools: input.resolvedTools,
53
79
  middleware: input.resolvedMiddleware,
@@ -56,14 +82,25 @@ export function buildLangChainCreateParams(input) {
56
82
  };
57
83
  }
58
84
  export function buildDeepAgentCreateParams(input) {
59
- const deepAgentParams = getBindingDeepAgentParams(input.binding);
60
- if (!deepAgentParams) {
85
+ const executionKind = getBindingExecutionKind(input.binding);
86
+ if (executionKind !== "deepagent" || !getBindingExecutionParams(input.binding)) {
61
87
  throw new Error(`Agent ${input.binding.agent.id} has no runnable params`);
62
88
  }
63
- const deepAgentParamsWithCompatFields = deepAgentParams;
64
- const { model: _compiledModel, tools: _compiledTools, middleware: _compiledMiddleware, subagents: _compiledSubagents, interruptOn: _compiledInterruptOn, skills: _compiledSkills, backend: _compiledBackend, store: _compiledStore, generalPurposeAgent: _generalPurposeAgent, taskDescription: _taskDescription, passthrough, ...upstreamParams } = deepAgentParamsWithCompatFields;
89
+ const upstreamParams = buildUpstreamCreateBaseParams(input.binding, [
90
+ "model",
91
+ "tools",
92
+ "middleware",
93
+ "subagents",
94
+ "interruptOn",
95
+ "skills",
96
+ "backend",
97
+ "store",
98
+ // These do not belong to DeepAgents top-level create params even if
99
+ // compatibility fixtures stuff them into compiled deepagent params.
100
+ "generalPurposeAgent",
101
+ "taskDescription",
102
+ ]);
65
103
  return {
66
- ...(passthrough ?? {}),
67
104
  ...upstreamParams,
68
105
  skills: input.resolvedSkills,
69
106
  model: input.resolvedModel,
@@ -145,7 +182,7 @@ export class AgentRuntimeAdapter {
145
182
  return resolved;
146
183
  }
147
184
  resolveFilesystemBackend(binding) {
148
- const filesystemConfig = getBindingLangChainParams(binding)?.filesystem;
185
+ const filesystemConfig = getBindingFilesystemConfig(binding);
149
186
  const configuredRootDir = typeof filesystemConfig?.rootDir === "string" && filesystemConfig.rootDir.trim().length > 0
150
187
  ? filesystemConfig.rootDir
151
188
  : undefined;
@@ -257,19 +294,21 @@ export class AgentRuntimeAdapter {
257
294
  });
258
295
  }
259
296
  async createLangChainRunnable(binding, options = {}) {
260
- const langchainParams = getBindingLangChainParams(binding);
261
- if (!langchainParams) {
297
+ const executionKind = getBindingExecutionKind(binding);
298
+ const primaryModel = getBindingPrimaryModel(binding);
299
+ const primaryTools = getBindingPrimaryTools(binding);
300
+ if (executionKind !== "langchain-v1" || !primaryModel) {
262
301
  throw new Error(`Agent ${binding.agent.id} has no langchain params`);
263
302
  }
264
303
  const interruptOn = resolveRunnableInterruptOn(binding);
265
- const resolvedModel = await this.resolveModel(langchainParams.model);
266
- const resolvedTools = this.resolveTools(langchainParams.tools, binding);
304
+ const resolvedModel = await this.resolveModel(primaryModel);
305
+ const resolvedTools = this.resolveTools(primaryTools, binding);
267
306
  const resolvedMiddleware = await this.resolveMiddleware(binding, interruptOn);
268
307
  const resolvedCheckpointer = resolveRunnableCheckpointer(this.options, binding);
269
308
  const resolvedStore = this.options.storeResolver?.(binding);
270
309
  const model = resolvedModel;
271
310
  if (resolvedTools.length > 0 && typeof model.bindTools !== "function") {
272
- throw new Error(`Agent ${binding.agent.id} configures ${resolvedTools.length} tool(s), but resolved model ${langchainParams.model.id} does not support tool binding.`);
311
+ throw new Error(`Agent ${binding.agent.id} configures ${resolvedTools.length} tool(s), but resolved model ${primaryModel.id} does not support tool binding.`);
273
312
  }
274
313
  return createAgent(buildLangChainCreateParams({
275
314
  binding,
@@ -292,14 +331,16 @@ export class AgentRuntimeAdapter {
292
331
  return this.createDeepAgentRunnable(binding);
293
332
  }
294
333
  async createDeepAgentRunnable(binding) {
295
- const deepAgentParams = getBindingDeepAgentParams(binding);
296
- if (!deepAgentParams) {
334
+ const executionKind = getBindingExecutionKind(binding);
335
+ const primaryModel = getBindingPrimaryModel(binding);
336
+ const primaryTools = getBindingPrimaryTools(binding);
337
+ if (executionKind !== "deepagent" || !primaryModel) {
297
338
  throw new Error(`Agent ${binding.agent.id} has no runnable params`);
298
339
  }
299
- const resolvedModel = await this.resolveModel(deepAgentParams.model);
300
- const resolvedTools = this.resolveTools(deepAgentParams.tools, binding);
340
+ const resolvedModel = await this.resolveModel(primaryModel);
341
+ const resolvedTools = this.resolveTools(primaryTools, binding);
301
342
  const resolvedMiddleware = await this.resolveMiddleware(binding);
302
- const resolvedSubagents = await this.resolveSubagents(deepAgentParams.subagents, binding);
343
+ const resolvedSubagents = await this.resolveSubagents(getBindingSubagents(binding), binding);
303
344
  const resolvedCheckpointer = resolveRunnableCheckpointer(this.options, binding);
304
345
  const resolvedStore = this.options.storeResolver?.(binding);
305
346
  const resolvedBackend = this.options.backendResolver?.(binding);
@@ -308,7 +349,7 @@ export class AgentRuntimeAdapter {
308
349
  workspaceRoot: binding.harnessRuntime.workspaceRoot,
309
350
  runRoot: binding.harnessRuntime.runRoot,
310
351
  ownerId: binding.agent.id,
311
- skillPaths: deepAgentParams.skills,
352
+ skillPaths: getBindingSkills(binding),
312
353
  }) ?? [];
313
354
  const deepAgentConfig = buildDeepAgentCreateParams({
314
355
  binding,
@@ -1,12 +1,14 @@
1
1
  import { type MessageContent, type ThreadSummary, type WorkspaceBundle } from "../../../contracts/types.js";
2
2
  import type { RoutingRule } from "../../../workspace/support/workspace-ref-utils.js";
3
3
  export declare function getDefaultHostAgentId(workspace: WorkspaceBundle, preferredHostAgentId?: string): string;
4
+ export declare function getDefaultRuntimeEntryAgentId(workspace: WorkspaceBundle, preferredRuntimeEntryAgentId?: string): string;
4
5
  export declare function resolveSelectedAgentId(options: {
5
6
  workspace: WorkspaceBundle;
6
7
  input: MessageContent;
7
8
  requestedAgentId?: string;
8
9
  threadId?: string;
9
10
  preferredHostAgentId?: string;
11
+ preferredRuntimeEntryAgentId?: string;
10
12
  getThreadSummary: (threadId: string) => Promise<ThreadSummary | null>;
11
13
  }): Promise<string>;
12
14
  export declare function routeAgentId(options: {
@@ -10,8 +10,12 @@ export function getDefaultHostAgentId(workspace, preferredHostAgentId) {
10
10
  }
11
11
  return inferRoutingBindings(workspace).primaryBinding?.agent.id ?? "agent";
12
12
  }
13
+ export function getDefaultRuntimeEntryAgentId(workspace, preferredRuntimeEntryAgentId) {
14
+ return getDefaultHostAgentId(workspace, preferredRuntimeEntryAgentId);
15
+ }
13
16
  export async function resolveSelectedAgentId(options) {
14
- const { workspace, input, requestedAgentId, threadId, preferredHostAgentId, getThreadSummary } = options;
17
+ const { workspace, input, requestedAgentId, threadId, preferredHostAgentId, preferredRuntimeEntryAgentId, getThreadSummary, } = options;
18
+ const preferredEntryAgentId = preferredRuntimeEntryAgentId ?? preferredHostAgentId;
15
19
  if (!requestedAgentId || requestedAgentId === AUTO_AGENT_ID) {
16
20
  if (threadId) {
17
21
  const thread = await getThreadSummary(threadId);
@@ -20,7 +24,7 @@ export async function resolveSelectedAgentId(options) {
20
24
  return thread.agentId;
21
25
  }
22
26
  }
23
- return getDefaultHostAgentId(workspace, preferredHostAgentId);
27
+ return getDefaultRuntimeEntryAgentId(workspace, preferredEntryAgentId);
24
28
  }
25
29
  return requestedAgentId;
26
30
  }
@@ -40,5 +44,5 @@ export function routeAgentId(options) {
40
44
  if (defaultBinding) {
41
45
  return defaultBinding.agent.id;
42
46
  }
43
- return getDefaultHostAgentId(workspace, routingDefaultAgentId);
47
+ return getDefaultRuntimeEntryAgentId(workspace, routingDefaultAgentId);
44
48
  }
@@ -3,7 +3,7 @@ import { createPersistentId } from "../../../utils/id.js";
3
3
  import { normalizeMessageContent } from "../../../utils/message-content.js";
4
4
  import { buildPersistedRunRequest, normalizeRunPriority } from "./helpers.js";
5
5
  import { getRequiredWorkspaceBinding } from "../bindings.js";
6
- import { getBindingAdapterKind } from "../../support/compiled-binding.js";
6
+ import { getBindingAdapterKind, getBindingRuntimeExecutionMode } from "../../support/compiled-binding.js";
7
7
  export async function ensureThreadStarted(runtime, input) {
8
8
  const { selectedAgentId, binding, message, runRequest, existingThreadId } = input;
9
9
  const threadId = existingThreadId ?? createPersistentId();
@@ -23,7 +23,7 @@ export async function ensureThreadStarted(runtime, input) {
23
23
  runId,
24
24
  status: "running",
25
25
  createdAt,
26
- executionMode: getBindingAdapterKind(binding),
26
+ executionMode: getBindingRuntimeExecutionMode(binding),
27
27
  adapterKind: getBindingAdapterKind(binding),
28
28
  userMessage,
29
29
  runRequest,
@@ -46,7 +46,7 @@ export async function ensureThreadStarted(runtime, input) {
46
46
  threadId,
47
47
  runId,
48
48
  agentId: binding.agent.id,
49
- executionMode: getBindingAdapterKind(binding),
49
+ executionMode: getBindingRuntimeExecutionMode(binding),
50
50
  adapterKind: getBindingAdapterKind(binding),
51
51
  createdAt,
52
52
  }),
@@ -1,5 +1,5 @@
1
1
  import { readSkillMetadata } from "../../support/skill-metadata.js";
2
- import { getBindingPrimaryTools } from "../../support/compiled-binding.js";
2
+ import { getBindingBackendConfig, getBindingPrimaryTools, getBindingSkills, getBindingSubagents } from "../../support/compiled-binding.js";
3
3
  import { assessSkillRequirements, } from "./skill-requirements.js";
4
4
  import { createRuntimeEnv } from "../../support/runtime-env.js";
5
5
  function listHostBindings(workspace) {
@@ -16,9 +16,7 @@ function dedupeTools(tools) {
16
16
  return Array.from(deduped.values());
17
17
  }
18
18
  function readBackendRequirementOptions(binding) {
19
- const backend = binding.deepAgentParams?.backend && typeof binding.deepAgentParams.backend === "object"
20
- ? binding.deepAgentParams.backend
21
- : undefined;
19
+ const backend = getBindingBackendConfig(binding);
22
20
  if (!backend) {
23
21
  return {};
24
22
  }
@@ -75,7 +73,7 @@ export function listAgentSkills(workspace, agentId, options = {}) {
75
73
  return [];
76
74
  }
77
75
  const resolvedOptions = mergeRequirementOptions(binding, options);
78
- return toSkillRecords(binding.deepAgentParams?.skills ?? binding.langchainAgentParams?.skills ?? [], resolvedOptions);
76
+ return toSkillRecords(getBindingSkills(binding), resolvedOptions);
79
77
  }
80
78
  function describeSubagent(subagent, parentAgentId, options = {}) {
81
79
  return {
@@ -89,7 +87,7 @@ function describeSubagent(subagent, parentAgentId, options = {}) {
89
87
  export function listSubagents(workspace, options = {}) {
90
88
  return listHostBindings(workspace).flatMap((binding) => {
91
89
  const resolvedOptions = mergeRequirementOptions(binding, options);
92
- return (binding.deepAgentParams?.subagents ?? []).map((subagent) => describeSubagent(subagent, binding.agent.id, resolvedOptions));
90
+ return getBindingSubagents(binding).map((subagent) => describeSubagent(subagent, binding.agent.id, resolvedOptions));
93
91
  });
94
92
  }
95
93
  export function listAvailableAgents(workspace, options = {}) {
@@ -14,8 +14,8 @@ export declare class AgentHarnessRuntime {
14
14
  private readonly stores;
15
15
  private readonly embeddingModels;
16
16
  private readonly vectorStores;
17
- private readonly hostBindings;
18
- private readonly defaultHostBinding?;
17
+ private readonly runtimeEntryBindings;
18
+ private readonly defaultRuntimeEntryBinding?;
19
19
  private readonly defaultRunRootValue;
20
20
  private readonly defaultStore;
21
21
  private readonly runtimeMemoryStore;
@@ -38,7 +38,7 @@ export declare class AgentHarnessRuntime {
38
38
  private readonly backgroundEventRuntime;
39
39
  private readonly runtimeEventOperations;
40
40
  private defaultRunRoot;
41
- private getDefaultHostAgentId;
41
+ private getDefaultRuntimeEntryAgentId;
42
42
  private resolveSelectedAgentId;
43
43
  private createPrepareRunStartRuntime;
44
44
  constructor(workspace: WorkspaceBundle, runtimeAdapterOptions?: RuntimeAdapterOptions);
@@ -18,10 +18,10 @@ import { buildResumePayload as buildHarnessResumePayload, resolveApprovalRecord
18
18
  import { cancelRunOperation, executeQueuedRunOperation, resumeRun } from "./harness/run/run-operations.js";
19
19
  import { acquireRunSlot as acquireHarnessRunSlot } from "./harness/run/run-slot-acquisition.js";
20
20
  import { dropPendingRunSlot, enqueuePendingRunSlot } from "./harness/run/run-queue.js";
21
- import { getDefaultHostAgentId, resolveSelectedAgentId, routeAgentId } from "./harness/run/routing.js";
21
+ import { getDefaultRuntimeEntryAgentId, resolveSelectedAgentId, routeAgentId } from "./harness/run/routing.js";
22
22
  import { resolveStoreFromConfig, } from "./harness/run/resources.js";
23
23
  import { createToolMcpServerFromTools, serveToolsOverStdioFromHarness } from "../mcp.js";
24
- import { getBindingAdapterKind } from "./support/compiled-binding.js";
24
+ import { getBindingRuntimeExecutionMode, } from "./support/compiled-binding.js";
25
25
  import { bindingSupportsRunningReplay, getWorkspaceBinding, resolveWorkspaceAgentTools, } from "./harness/bindings.js";
26
26
  import { describeWorkspaceInventory, listAgentSkills as listWorkspaceAgentSkills, } from "./harness/system/inventory.js";
27
27
  import { createDefaultHealthSnapshot, isInventoryEnabled, isThreadMemorySyncEnabled, } from "./harness/runtime-defaults.js";
@@ -48,8 +48,8 @@ export class AgentHarnessRuntime {
48
48
  stores = new Map();
49
49
  embeddingModels = new Map();
50
50
  vectorStores = new Map();
51
- hostBindings;
52
- defaultHostBinding;
51
+ runtimeEntryBindings;
52
+ defaultRuntimeEntryBinding;
53
53
  defaultRunRootValue;
54
54
  defaultStore;
55
55
  runtimeMemoryStore;
@@ -74,8 +74,8 @@ export class AgentHarnessRuntime {
74
74
  defaultRunRoot() {
75
75
  return this.defaultRunRootValue;
76
76
  }
77
- getDefaultHostAgentId() {
78
- return getDefaultHostAgentId(this.workspace, this.routingDefaultAgentId);
77
+ getDefaultRuntimeEntryAgentId() {
78
+ return getDefaultRuntimeEntryAgentId(this.workspace, this.routingDefaultAgentId);
79
79
  }
80
80
  async resolveSelectedAgentId(input, requestedAgentId, threadId) {
81
81
  return resolveSelectedAgentId({
@@ -83,7 +83,7 @@ export class AgentHarnessRuntime {
83
83
  input,
84
84
  requestedAgentId,
85
85
  threadId,
86
- preferredHostAgentId: this.routingDefaultAgentId,
86
+ preferredRuntimeEntryAgentId: this.routingDefaultAgentId,
87
87
  getThreadSummary: (currentThreadId) => this.getSession(currentThreadId),
88
88
  });
89
89
  }
@@ -100,16 +100,16 @@ export class AgentHarnessRuntime {
100
100
  constructor(workspace, runtimeAdapterOptions = {}) {
101
101
  this.workspace = workspace;
102
102
  this.runtimeAdapterOptions = runtimeAdapterOptions;
103
- this.hostBindings = inferRoutingBindings(this.workspace).hostBindings;
104
- this.defaultHostBinding = this.hostBindings[0];
105
- this.defaultRunRootValue = this.defaultHostBinding?.harnessRuntime.runRoot ?? `${this.workspace.workspaceRoot}/run-data`;
103
+ this.runtimeEntryBindings = inferRoutingBindings(this.workspace).runtimeEntryBindings;
104
+ this.defaultRuntimeEntryBinding = this.runtimeEntryBindings[0];
105
+ this.defaultRunRootValue = this.defaultRuntimeEntryBinding?.harnessRuntime.runRoot ?? `${this.workspace.workspaceRoot}/run-data`;
106
106
  const runRoot = this.defaultRunRoot();
107
107
  this.persistence = new SqlitePersistence(runRoot);
108
- const defaultStoreConfig = this.defaultHostBinding?.harnessRuntime.store;
108
+ const defaultStoreConfig = this.defaultRuntimeEntryBinding?.harnessRuntime.store;
109
109
  this.defaultStore = resolveStoreFromConfig(this.stores, defaultStoreConfig, runRoot) ?? new FileBackedStore(`${runRoot}/store.json`);
110
- const runtimeMemoryStoreConfig = typeof this.defaultHostBinding?.harnessRuntime.runtimeMemory?.store === "object" &&
111
- this.defaultHostBinding?.harnessRuntime.runtimeMemory?.store
112
- ? this.defaultHostBinding.harnessRuntime.runtimeMemory.store
110
+ const runtimeMemoryStoreConfig = typeof this.defaultRuntimeEntryBinding?.harnessRuntime.runtimeMemory?.store === "object" &&
111
+ this.defaultRuntimeEntryBinding?.harnessRuntime.runtimeMemory?.store
112
+ ? this.defaultRuntimeEntryBinding.harnessRuntime.runtimeMemory.store
113
113
  : undefined;
114
114
  this.runtimeMemoryStore = resolveStoreFromConfig(this.stores, runtimeMemoryStoreConfig, runRoot) ?? this.defaultStore;
115
115
  this.resolvedRuntimeAdapterOptions = resolveRuntimeAdapterOptions({
@@ -438,7 +438,7 @@ export class AgentHarnessRuntime {
438
438
  agentId: activeBinding.agent.id,
439
439
  requestedAgentId: defaultRequestedAgentId(options.agentId),
440
440
  selectedAgentId: activeSelectedAgentId,
441
- executionMode: getBindingAdapterKind(activeBinding),
441
+ executionMode: getBindingRuntimeExecutionMode(activeBinding),
442
442
  }),
443
443
  });
444
444
  await runCreatedEventPromise;
@@ -1,4 +1,4 @@
1
- import type { CompiledAgentBinding, CompiledModel, CompiledTool, DeepAgentParams, LangChainAgentParams } from "../../contracts/types.js";
1
+ import type { CompiledAgentBinding, CompiledExecutionBinding, CompiledModel, CompiledSubAgent, CompiledTool, DeepAgentParams, LangChainAgentParams } from "../../contracts/types.js";
2
2
  export type BindingExecutionView = {
3
3
  adapterKind: string;
4
4
  langchainParams?: LangChainAgentParams;
@@ -17,8 +17,20 @@ export type BindingExecutionView = {
17
17
  };
18
18
  export declare function getBindingExecutionView(binding: CompiledAgentBinding): BindingExecutionView;
19
19
  export declare function getBindingAdapterKind(binding: CompiledAgentBinding): string;
20
+ export declare function getBindingCanonicalExecution(binding: CompiledAgentBinding): CompiledExecutionBinding | undefined;
21
+ export declare function getBindingRuntimeExecutionMode(binding: CompiledAgentBinding): string;
20
22
  export declare function getBindingLangChainParams(binding: CompiledAgentBinding): LangChainAgentParams | undefined;
21
23
  export declare function getBindingDeepAgentParams(binding: CompiledAgentBinding): DeepAgentParams | undefined;
24
+ export declare function getBindingExecutionParams(binding: CompiledAgentBinding): LangChainAgentParams | DeepAgentParams | undefined;
25
+ export declare function getBindingExecutionKind(binding: CompiledAgentBinding): "langchain-v1" | "deepagent" | undefined;
26
+ export declare function withUpdatedBindingExecutionParams(binding: CompiledAgentBinding, updater: (params: LangChainAgentParams | DeepAgentParams) => LangChainAgentParams | DeepAgentParams): CompiledAgentBinding;
27
+ export declare function getBindingSkills(binding: CompiledAgentBinding): string[];
28
+ export declare function getBindingMemorySources(binding: CompiledAgentBinding): string[];
29
+ export declare function getBindingSubagents(binding: CompiledAgentBinding): CompiledSubAgent[];
30
+ export declare function getBindingGeneralPurposeAgent(binding: CompiledAgentBinding): boolean | undefined;
31
+ export declare function getBindingTaskDescription(binding: CompiledAgentBinding): string | undefined;
32
+ export declare function getBindingBackendConfig(binding: CompiledAgentBinding): Record<string, unknown> | undefined;
33
+ export declare function getBindingFilesystemConfig(binding: CompiledAgentBinding): Record<string, unknown> | undefined;
22
34
  export declare function isLangChainBinding(binding: CompiledAgentBinding): boolean;
23
35
  export declare function isDeepAgentBinding(binding: CompiledAgentBinding): boolean;
24
36
  export declare function getBindingPrimaryTools(binding: CompiledAgentBinding): CompiledTool[];
@@ -3,21 +3,80 @@ const bindingExecutionViewCache = new WeakMap();
3
3
  function getLegacyAdapterParams(binding) {
4
4
  return asRecord(binding.adapter?.config?.params);
5
5
  }
6
+ function inferBindingAdapterKind(binding) {
7
+ if (binding.adapter?.kind) {
8
+ return binding.adapter.kind;
9
+ }
10
+ if (binding.execution?.kind === "langchain-v1" || binding.execution?.kind === "deepagent") {
11
+ return binding.execution.kind;
12
+ }
13
+ if (binding.langchainAgentParams) {
14
+ return "langchain-v1";
15
+ }
16
+ if (binding.deepAgentParams) {
17
+ return "deepagent";
18
+ }
19
+ return binding.agent.executionMode;
20
+ }
21
+ function normalizeBindingExecution(binding) {
22
+ const adapterKind = inferBindingAdapterKind(binding);
23
+ if (binding.execution?.kind === "langchain-v1") {
24
+ binding.langchainAgentParams ??= binding.execution.params;
25
+ return { adapterKind, execution: binding.execution };
26
+ }
27
+ if (binding.execution?.kind === "deepagent") {
28
+ binding.deepAgentParams ??= binding.execution.params;
29
+ return { adapterKind, execution: binding.execution };
30
+ }
31
+ if (adapterKind !== "langchain-v1" && adapterKind !== "deepagent") {
32
+ return { adapterKind };
33
+ }
34
+ if (binding.langchainAgentParams) {
35
+ const execution = {
36
+ kind: "langchain-v1",
37
+ params: binding.langchainAgentParams,
38
+ };
39
+ binding.execution = execution;
40
+ return { adapterKind, execution };
41
+ }
42
+ if (binding.deepAgentParams) {
43
+ const execution = {
44
+ kind: "deepagent",
45
+ params: binding.deepAgentParams,
46
+ };
47
+ binding.execution = execution;
48
+ return { adapterKind, execution };
49
+ }
50
+ const legacyAdapterParams = getLegacyAdapterParams(binding);
51
+ if (adapterKind === "langchain-v1" && legacyAdapterParams) {
52
+ const params = legacyAdapterParams;
53
+ binding.langchainAgentParams = params;
54
+ binding.execution = {
55
+ kind: "langchain-v1",
56
+ params,
57
+ };
58
+ return { adapterKind, execution: binding.execution };
59
+ }
60
+ if (adapterKind === "deepagent" && legacyAdapterParams) {
61
+ const params = legacyAdapterParams;
62
+ binding.deepAgentParams = params;
63
+ binding.execution = {
64
+ kind: "deepagent",
65
+ params,
66
+ };
67
+ return { adapterKind, execution: binding.execution };
68
+ }
69
+ return { adapterKind };
70
+ }
6
71
  function deriveBindingExecutionView(binding) {
7
72
  const cached = bindingExecutionViewCache.get(binding);
8
73
  if (cached) {
9
74
  return cached;
10
75
  }
11
- const adapterKind = binding.adapter?.kind ?? binding.agent.executionMode;
12
- const legacyAdapterParams = getLegacyAdapterParams(binding);
13
- const langchainParams = binding.langchainAgentParams ??
14
- (adapterKind === "langchain-v1" && legacyAdapterParams
15
- ? legacyAdapterParams
16
- : undefined);
17
- const deepAgentParams = binding.deepAgentParams ??
18
- (adapterKind === "deepagent" && legacyAdapterParams
19
- ? legacyAdapterParams
20
- : undefined);
76
+ const normalized = normalizeBindingExecution(binding);
77
+ const adapterKind = normalized.adapterKind;
78
+ const langchainParams = normalized.execution?.kind === "langchain-v1" ? normalized.execution.params : undefined;
79
+ const deepAgentParams = normalized.execution?.kind === "deepagent" ? normalized.execution.params : undefined;
21
80
  const primaryTools = langchainParams?.tools ?? deepAgentParams?.tools ?? [];
22
81
  const middlewareConfigs = langchainParams?.middleware ?? deepAgentParams?.middleware;
23
82
  const middlewareKinds = new Set((middlewareConfigs ?? [])
@@ -51,17 +110,92 @@ export function getBindingExecutionView(binding) {
51
110
  export function getBindingAdapterKind(binding) {
52
111
  return getBindingExecutionView(binding).adapterKind;
53
112
  }
113
+ export function getBindingCanonicalExecution(binding) {
114
+ return normalizeBindingExecution(binding).execution;
115
+ }
116
+ export function getBindingRuntimeExecutionMode(binding) {
117
+ return getBindingExecutionKind(binding) ?? getBindingAdapterKind(binding);
118
+ }
54
119
  export function getBindingLangChainParams(binding) {
55
120
  return getBindingExecutionView(binding).langchainParams;
56
121
  }
57
122
  export function getBindingDeepAgentParams(binding) {
58
123
  return getBindingExecutionView(binding).deepAgentParams;
59
124
  }
125
+ export function getBindingExecutionParams(binding) {
126
+ return getBindingExecutionView(binding).executionParams;
127
+ }
128
+ export function getBindingExecutionKind(binding) {
129
+ const execution = getBindingCanonicalExecution(binding);
130
+ return execution?.kind;
131
+ }
132
+ export function withUpdatedBindingExecutionParams(binding, updater) {
133
+ const kind = getBindingExecutionKind(binding);
134
+ const params = getBindingExecutionParams(binding);
135
+ if (!kind || !params) {
136
+ return binding;
137
+ }
138
+ const updatedParams = updater(params);
139
+ if (kind === "langchain-v1") {
140
+ return {
141
+ ...binding,
142
+ execution: {
143
+ kind,
144
+ params: updatedParams,
145
+ },
146
+ langchainAgentParams: updatedParams,
147
+ };
148
+ }
149
+ return {
150
+ ...binding,
151
+ execution: {
152
+ kind,
153
+ params: updatedParams,
154
+ },
155
+ deepAgentParams: updatedParams,
156
+ };
157
+ }
158
+ export function getBindingSkills(binding) {
159
+ const execution = getBindingExecutionParams(binding);
160
+ return Array.isArray(execution?.skills) ? execution.skills : [];
161
+ }
162
+ export function getBindingMemorySources(binding) {
163
+ const execution = getBindingExecutionParams(binding);
164
+ return Array.isArray(execution?.memory)
165
+ ? (execution.memory)
166
+ : [];
167
+ }
168
+ export function getBindingSubagents(binding) {
169
+ const execution = getBindingExecutionParams(binding);
170
+ return Array.isArray(execution?.subagents)
171
+ ? (execution.subagents)
172
+ : [];
173
+ }
174
+ export function getBindingGeneralPurposeAgent(binding) {
175
+ const execution = getBindingExecutionParams(binding);
176
+ const value = execution?.generalPurposeAgent;
177
+ return typeof value === "boolean" ? value : undefined;
178
+ }
179
+ export function getBindingTaskDescription(binding) {
180
+ const execution = getBindingExecutionParams(binding);
181
+ const value = execution?.taskDescription;
182
+ return typeof value === "string" && value.trim().length > 0 ? value : undefined;
183
+ }
184
+ export function getBindingBackendConfig(binding) {
185
+ const execution = getBindingExecutionParams(binding);
186
+ const backend = execution?.backend;
187
+ return typeof backend === "object" && backend ? backend : undefined;
188
+ }
189
+ export function getBindingFilesystemConfig(binding) {
190
+ const execution = getBindingExecutionParams(binding);
191
+ const filesystem = execution?.filesystem;
192
+ return typeof filesystem === "object" && filesystem ? filesystem : undefined;
193
+ }
60
194
  export function isLangChainBinding(binding) {
61
- return getBindingAdapterKind(binding) === "langchain-v1" || Boolean(binding.langchainAgentParams);
195
+ return getBindingExecutionKind(binding) === "langchain-v1";
62
196
  }
63
197
  export function isDeepAgentBinding(binding) {
64
- return getBindingAdapterKind(binding) === "deepagent" || Boolean(binding.deepAgentParams);
198
+ return getBindingExecutionKind(binding) === "deepagent";
65
199
  }
66
200
  export function getBindingPrimaryTools(binding) {
67
201
  return getBindingExecutionView(binding).primaryTools;
@@ -11,5 +11,5 @@ export declare function createHarnessEvent(threadId: string, runId: string, sequ
11
11
  export declare function createPendingApproval(threadId: string, runId: string, checkpointRef: string, input: string, interruptContent?: string): InternalApprovalRecord;
12
12
  export declare function inferRoutingBindings(workspace: WorkspaceBundle): {
13
13
  primaryBinding: import("../../contracts/workspace.js").CompiledAgentBinding;
14
- hostBindings: import("../../contracts/workspace.js").CompiledAgentBinding[];
14
+ runtimeEntryBindings: import("../../contracts/workspace.js").CompiledAgentBinding[];
15
15
  };
@@ -1,5 +1,6 @@
1
1
  import { createPersistentId } from "../../utils/id.js";
2
2
  import { isDelegationCapableBinding } from "../../workspace/support/agent-capabilities.js";
3
+ import { isDeepAgentBinding } from "./compiled-binding.js";
3
4
  export function renderRuntimeFailure(error) {
4
5
  const message = error instanceof Error ? error.message : String(error);
5
6
  return `runtime_error=${message}`.trim();
@@ -86,9 +87,9 @@ export function createPendingApproval(threadId, runId, checkpointRef, input, int
86
87
  };
87
88
  }
88
89
  export function inferRoutingBindings(workspace) {
89
- const hostBindings = Array.from(workspace.bindings.values());
90
- const orchestrationHosts = hostBindings.filter((binding) => binding.agent.executionMode === "deepagent" || Boolean(binding.deepAgentParams));
91
- const routingHosts = orchestrationHosts.length > 0 ? orchestrationHosts : hostBindings;
92
- const primaryBinding = routingHosts.find((binding) => isDelegationCapableBinding(binding)) ?? routingHosts[0] ?? hostBindings[0];
93
- return { primaryBinding, hostBindings };
90
+ const runtimeEntryBindings = Array.from(workspace.bindings.values());
91
+ const orchestrationRuntimeEntries = runtimeEntryBindings.filter((binding) => isDeepAgentBinding(binding));
92
+ const routingEntries = orchestrationRuntimeEntries.length > 0 ? orchestrationRuntimeEntries : runtimeEntryBindings;
93
+ const primaryBinding = routingEntries.find((binding) => isDelegationCapableBinding(binding)) ?? routingEntries[0] ?? runtimeEntryBindings[0];
94
+ return { primaryBinding, runtimeEntryBindings };
94
95
  }
@@ -247,11 +247,11 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
247
247
  const resilience = getResilienceConfig(refs);
248
248
  const compiledAgentSkills = compileAgentSkills(workspaceRoot, agent);
249
249
  const compiledAgentMemory = compileAgentMemories(workspaceRoot, agent.memorySources);
250
- const execution = compileExecutionCore({
250
+ const executionCore = compileExecutionCore({
251
251
  ...agent,
252
252
  modelRef: agent.modelRef || (internalSubagent ? "model/default" : ""),
253
253
  }, models, tools);
254
- const compiledAgentModel = execution.model;
254
+ const compiledAgentModel = executionCore.model;
255
255
  const backend = resolveBackendConfig(agent, refs);
256
256
  const store = resolveStoreConfig(agent, refs);
257
257
  const checkpointer = resolveCheckpointerConfig(agent, refs);
@@ -275,53 +275,61 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
275
275
  };
276
276
  if (agent.executionMode !== "deepagent") {
277
277
  const langchainVersion = getAgentExecutionConfigValue(agent, "version", { executionMode: "langchain-v1" });
278
- const langchainAgentParams = {
279
- model: execution.model,
280
- tools: execution.tools,
281
- systemPrompt: execution.systemPrompt,
282
- interruptOn: resolveInterruptOn(agent),
283
- stateSchema: getAgentExecutionConfigValue(agent, "stateSchema", { executionMode: "langchain-v1" }),
284
- responseFormat: execution.responseFormat,
285
- contextSchema: execution.contextSchema,
286
- filesystem: getAgentExecutionObject(agent, "filesystem", { executionMode: "langchain-v1" }),
287
- middleware: execution.middleware,
288
- passthrough: execution.passthrough,
289
- subagents: compileSubagents(agent, agents, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel),
290
- memory: compiledAgentMemory,
291
- skills: compiledAgentSkills,
292
- generalPurposeAgent: getAgentExecutionConfigValue(agent, "generalPurposeAgent", { executionMode: "langchain-v1" }),
293
- taskDescription: getAgentExecutionString(agent, "taskDescription", { executionMode: "langchain-v1" }),
294
- includeAgentName: getAgentExecutionConfigValue(agent, "includeAgentName", { executionMode: "langchain-v1" }) === "inline" ? "inline" : undefined,
295
- version: langchainVersion === "v1" || langchainVersion === "v2"
296
- ? langchainVersion
297
- : undefined,
298
- name: resolveAgentRuntimeName(agent),
299
- description: agent.description,
278
+ const executionBinding = {
279
+ kind: "langchain-v1",
280
+ params: {
281
+ model: executionCore.model,
282
+ tools: executionCore.tools,
283
+ systemPrompt: executionCore.systemPrompt,
284
+ interruptOn: resolveInterruptOn(agent),
285
+ stateSchema: getAgentExecutionConfigValue(agent, "stateSchema", { executionMode: "langchain-v1" }),
286
+ responseFormat: executionCore.responseFormat,
287
+ contextSchema: executionCore.contextSchema,
288
+ filesystem: getAgentExecutionObject(agent, "filesystem", { executionMode: "langchain-v1" }),
289
+ middleware: executionCore.middleware,
290
+ passthrough: executionCore.passthrough,
291
+ subagents: compileSubagents(agent, agents, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel),
292
+ memory: compiledAgentMemory,
293
+ skills: compiledAgentSkills,
294
+ generalPurposeAgent: getAgentExecutionConfigValue(agent, "generalPurposeAgent", { executionMode: "langchain-v1" }),
295
+ taskDescription: getAgentExecutionString(agent, "taskDescription", { executionMode: "langchain-v1" }),
296
+ includeAgentName: getAgentExecutionConfigValue(agent, "includeAgentName", { executionMode: "langchain-v1" }) === "inline" ? "inline" : undefined,
297
+ version: langchainVersion === "v1" || langchainVersion === "v2"
298
+ ? langchainVersion
299
+ : undefined,
300
+ name: resolveAgentRuntimeName(agent),
301
+ description: agent.description,
302
+ },
300
303
  };
301
304
  return {
302
305
  ...base,
303
- langchainAgentParams,
306
+ execution: executionBinding,
307
+ langchainAgentParams: executionBinding.params,
304
308
  };
305
309
  }
306
- const deepAgentParams = {
307
- model: execution.model,
308
- tools: execution.tools,
309
- systemPrompt: execution.systemPrompt,
310
- responseFormat: execution.responseFormat,
311
- contextSchema: execution.contextSchema,
312
- middleware: execution.middleware,
313
- passthrough: execution.passthrough,
314
- description: agent.description,
315
- subagents: compileSubagents(agent, agents, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel),
316
- interruptOn: resolveInterruptOn(agent),
317
- ...(backend ? { backend: backend.config } : {}),
318
- ...(store ? { store: store.config } : {}),
319
- name: resolveAgentRuntimeName(agent),
320
- memory: compiledAgentMemory,
321
- skills: compiledAgentSkills,
310
+ const executionBinding = {
311
+ kind: "deepagent",
312
+ params: {
313
+ model: executionCore.model,
314
+ tools: executionCore.tools,
315
+ systemPrompt: executionCore.systemPrompt,
316
+ responseFormat: executionCore.responseFormat,
317
+ contextSchema: executionCore.contextSchema,
318
+ middleware: executionCore.middleware,
319
+ passthrough: executionCore.passthrough,
320
+ description: agent.description,
321
+ subagents: compileSubagents(agent, agents, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel),
322
+ interruptOn: resolveInterruptOn(agent),
323
+ ...(backend ? { backend: backend.config } : {}),
324
+ ...(store ? { store: store.config } : {}),
325
+ name: resolveAgentRuntimeName(agent),
326
+ memory: compiledAgentMemory,
327
+ skills: compiledAgentSkills,
328
+ },
322
329
  };
323
330
  return {
324
331
  ...base,
325
- deepAgentParams,
332
+ execution: executionBinding,
333
+ deepAgentParams: executionBinding.params,
326
334
  };
327
335
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.117",
3
+ "version": "0.0.119",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "type": "module",
6
6
  "packageManager": "npm@10.9.2",