@botbotgo/agent-harness 0.0.118 → 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.
- package/dist/contracts/workspace.d.ts +13 -0
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/runtime/harness/run/routing.d.ts +2 -0
- package/dist/runtime/harness/run/routing.js +7 -3
- package/dist/runtime/harness/run/start-run.js +3 -3
- package/dist/runtime/harness.d.ts +3 -3
- package/dist/runtime/harness.js +15 -15
- package/dist/runtime/support/compiled-binding.d.ts +3 -1
- package/dist/runtime/support/compiled-binding.js +79 -26
- package/dist/runtime/support/harness-support.d.ts +1 -1
- package/dist/runtime/support/harness-support.js +5 -5
- package/dist/workspace/agent-binding-compiler.js +50 -50
- package/package.json +1 -1
|
@@ -193,8 +193,21 @@ export type CompiledAgentBinding = {
|
|
|
193
193
|
kind: string;
|
|
194
194
|
config?: Record<string, unknown>;
|
|
195
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
|
+
*/
|
|
196
201
|
execution?: CompiledExecutionBinding;
|
|
202
|
+
/**
|
|
203
|
+
* Compatibility alias for older tests and callers.
|
|
204
|
+
* Prefer `execution.kind === "langchain-v1"` and `execution.params`.
|
|
205
|
+
*/
|
|
197
206
|
langchainAgentParams?: LangChainAgentParams;
|
|
207
|
+
/**
|
|
208
|
+
* Compatibility alias for older tests and callers.
|
|
209
|
+
* Prefer `execution.kind === "deepagent"` and `execution.params`.
|
|
210
|
+
*/
|
|
198
211
|
deepAgentParams?: DeepAgentParams;
|
|
199
212
|
harnessRuntime: {
|
|
200
213
|
runRoot: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.118";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.118";
|
|
@@ -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
|
|
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
|
|
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:
|
|
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:
|
|
49
|
+
executionMode: getBindingRuntimeExecutionMode(binding),
|
|
50
50
|
adapterKind: getBindingAdapterKind(binding),
|
|
51
51
|
createdAt,
|
|
52
52
|
}),
|
|
@@ -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
|
|
18
|
-
private readonly
|
|
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
|
|
41
|
+
private getDefaultRuntimeEntryAgentId;
|
|
42
42
|
private resolveSelectedAgentId;
|
|
43
43
|
private createPrepareRunStartRuntime;
|
|
44
44
|
constructor(workspace: WorkspaceBundle, runtimeAdapterOptions?: RuntimeAdapterOptions);
|
package/dist/runtime/harness.js
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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
|
-
|
|
52
|
-
|
|
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
|
-
|
|
78
|
-
return
|
|
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
|
-
|
|
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.
|
|
104
|
-
this.
|
|
105
|
-
this.defaultRunRootValue = this.
|
|
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.
|
|
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.
|
|
111
|
-
this.
|
|
112
|
-
? this.
|
|
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:
|
|
441
|
+
executionMode: getBindingRuntimeExecutionMode(activeBinding),
|
|
442
442
|
}),
|
|
443
443
|
});
|
|
444
444
|
await runCreatedEventPromise;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompiledAgentBinding, CompiledModel, CompiledSubAgent, 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,6 +17,8 @@ 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;
|
|
22
24
|
export declare function getBindingExecutionParams(binding: CompiledAgentBinding): LangChainAgentParams | DeepAgentParams | undefined;
|
|
@@ -3,24 +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
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
binding.langchainAgentParams ??
|
|
16
|
-
(adapterKind === "langchain-v1" && legacyAdapterParams
|
|
17
|
-
? legacyAdapterParams
|
|
18
|
-
: undefined);
|
|
19
|
-
const deepAgentParams = (compiledExecution?.kind === "deepagent" ? compiledExecution.params : undefined) ??
|
|
20
|
-
binding.deepAgentParams ??
|
|
21
|
-
(adapterKind === "deepagent" && legacyAdapterParams
|
|
22
|
-
? legacyAdapterParams
|
|
23
|
-
: 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;
|
|
24
80
|
const primaryTools = langchainParams?.tools ?? deepAgentParams?.tools ?? [];
|
|
25
81
|
const middlewareConfigs = langchainParams?.middleware ?? deepAgentParams?.middleware;
|
|
26
82
|
const middlewareKinds = new Set((middlewareConfigs ?? [])
|
|
@@ -54,6 +110,12 @@ export function getBindingExecutionView(binding) {
|
|
|
54
110
|
export function getBindingAdapterKind(binding) {
|
|
55
111
|
return getBindingExecutionView(binding).adapterKind;
|
|
56
112
|
}
|
|
113
|
+
export function getBindingCanonicalExecution(binding) {
|
|
114
|
+
return normalizeBindingExecution(binding).execution;
|
|
115
|
+
}
|
|
116
|
+
export function getBindingRuntimeExecutionMode(binding) {
|
|
117
|
+
return getBindingExecutionKind(binding) ?? getBindingAdapterKind(binding);
|
|
118
|
+
}
|
|
57
119
|
export function getBindingLangChainParams(binding) {
|
|
58
120
|
return getBindingExecutionView(binding).langchainParams;
|
|
59
121
|
}
|
|
@@ -64,17 +126,8 @@ export function getBindingExecutionParams(binding) {
|
|
|
64
126
|
return getBindingExecutionView(binding).executionParams;
|
|
65
127
|
}
|
|
66
128
|
export function getBindingExecutionKind(binding) {
|
|
67
|
-
const execution = binding
|
|
68
|
-
|
|
69
|
-
return execution.kind;
|
|
70
|
-
}
|
|
71
|
-
if (getBindingAdapterKind(binding) === "langchain-v1" || binding.langchainAgentParams) {
|
|
72
|
-
return "langchain-v1";
|
|
73
|
-
}
|
|
74
|
-
if (getBindingAdapterKind(binding) === "deepagent" || binding.deepAgentParams) {
|
|
75
|
-
return "deepagent";
|
|
76
|
-
}
|
|
77
|
-
return undefined;
|
|
129
|
+
const execution = getBindingCanonicalExecution(binding);
|
|
130
|
+
return execution?.kind;
|
|
78
131
|
}
|
|
79
132
|
export function withUpdatedBindingExecutionParams(binding, updater) {
|
|
80
133
|
const kind = getBindingExecutionKind(binding);
|
|
@@ -139,10 +192,10 @@ export function getBindingFilesystemConfig(binding) {
|
|
|
139
192
|
return typeof filesystem === "object" && filesystem ? filesystem : undefined;
|
|
140
193
|
}
|
|
141
194
|
export function isLangChainBinding(binding) {
|
|
142
|
-
return
|
|
195
|
+
return getBindingExecutionKind(binding) === "langchain-v1";
|
|
143
196
|
}
|
|
144
197
|
export function isDeepAgentBinding(binding) {
|
|
145
|
-
return
|
|
198
|
+
return getBindingExecutionKind(binding) === "deepagent";
|
|
146
199
|
}
|
|
147
200
|
export function getBindingPrimaryTools(binding) {
|
|
148
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
|
-
|
|
14
|
+
runtimeEntryBindings: import("../../contracts/workspace.js").CompiledAgentBinding[];
|
|
15
15
|
};
|
|
@@ -87,9 +87,9 @@ export function createPendingApproval(threadId, runId, checkpointRef, input, int
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
export function inferRoutingBindings(workspace) {
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const primaryBinding =
|
|
94
|
-
return { primaryBinding,
|
|
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 };
|
|
95
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
|
|
250
|
+
const executionCore = compileExecutionCore({
|
|
251
251
|
...agent,
|
|
252
252
|
modelRef: agent.modelRef || (internalSubagent ? "model/default" : ""),
|
|
253
253
|
}, models, tools);
|
|
254
|
-
const compiledAgentModel =
|
|
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,61 +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
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
?
|
|
297
|
-
:
|
|
298
|
-
|
|
299
|
-
|
|
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
|
-
execution:
|
|
304
|
-
|
|
305
|
-
params: langchainAgentParams,
|
|
306
|
-
},
|
|
307
|
-
langchainAgentParams,
|
|
306
|
+
execution: executionBinding,
|
|
307
|
+
langchainAgentParams: executionBinding.params,
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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
|
+
},
|
|
326
329
|
};
|
|
327
330
|
return {
|
|
328
331
|
...base,
|
|
329
|
-
execution:
|
|
330
|
-
|
|
331
|
-
params: deepAgentParams,
|
|
332
|
-
},
|
|
333
|
-
deepAgentParams,
|
|
332
|
+
execution: executionBinding,
|
|
333
|
+
deepAgentParams: executionBinding.params,
|
|
334
334
|
};
|
|
335
335
|
}
|