@botbotgo/agent-harness 0.0.99 → 0.0.101
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/README.md +3 -6
- package/README.zh.md +2 -2
- package/dist/benchmark/upstream-runtime-ab-benchmark.d.ts +1 -1
- package/dist/benchmark/upstream-runtime-ab-benchmark.js +1 -2
- package/dist/contracts/core.d.ts +2 -2
- package/dist/contracts/runtime.d.ts +1 -5
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/resource/resource-impl.js +78 -76
- package/dist/runtime/adapter/deepagent-runnable-config.d.ts +30 -0
- package/dist/runtime/adapter/deepagent-runnable-config.js +22 -0
- package/dist/runtime/adapter/index.d.ts +0 -2
- package/dist/runtime/adapter/index.js +0 -2
- package/dist/runtime/adapter/invocation-result.d.ts +13 -0
- package/dist/runtime/adapter/invocation-result.js +40 -0
- package/dist/runtime/adapter/langchain-runnable-config.d.ts +25 -0
- package/dist/runtime/adapter/langchain-runnable-config.js +19 -0
- package/dist/runtime/adapter/local-tool-invocation.d.ts +23 -0
- package/dist/runtime/adapter/local-tool-invocation.js +64 -0
- package/dist/runtime/adapter/runtime-adapter-support.d.ts +18 -0
- package/dist/runtime/adapter/runtime-adapter-support.js +54 -0
- package/dist/runtime/adapter/stream-event-projection.d.ts +19 -0
- package/dist/runtime/adapter/stream-event-projection.js +79 -0
- package/dist/runtime/adapter/stream-text-consumption.d.ts +4 -0
- package/dist/runtime/adapter/stream-text-consumption.js +18 -0
- package/dist/runtime/adapter/tool/builtin-middleware-tools.d.ts +64 -0
- package/dist/runtime/adapter/tool/builtin-middleware-tools.js +144 -0
- package/dist/runtime/adapter/tool/tool-replay.d.ts +18 -0
- package/dist/runtime/adapter/tool/tool-replay.js +26 -0
- package/dist/runtime/agent-runtime-adapter.d.ts +2 -54
- package/dist/runtime/agent-runtime-adapter.js +122 -1568
- package/dist/runtime/harness/run/helpers.js +2 -8
- package/dist/runtime/harness/run/recovery.d.ts +42 -0
- package/dist/runtime/harness/run/recovery.js +139 -0
- package/dist/runtime/harness/run/routing.d.ts +1 -3
- package/dist/runtime/harness/run/routing.js +2 -25
- package/dist/runtime/harness/run/run-lifecycle.d.ts +0 -11
- package/dist/runtime/harness/run/run-lifecycle.js +7 -50
- package/dist/runtime/harness/runtime-defaults.d.ts +4 -0
- package/dist/runtime/harness/runtime-defaults.js +39 -0
- package/dist/runtime/harness/system/inventory.js +2 -1
- package/dist/runtime/harness/system/skill-requirements.d.ts +1 -0
- package/dist/runtime/harness.d.ts +5 -24
- package/dist/runtime/harness.js +356 -536
- package/dist/runtime/index.d.ts +1 -12
- package/dist/runtime/index.js +1 -12
- package/dist/runtime/support/compiled-binding.d.ts +0 -2
- package/dist/runtime/support/compiled-binding.js +3 -22
- package/dist/runtime/support/harness-support.d.ts +0 -11
- package/dist/runtime/support/harness-support.js +1 -44
- package/dist/runtime/support/index.d.ts +1 -1
- package/dist/runtime/support/index.js +1 -1
- package/dist/runtime/support/runtime-factories.js +2 -2
- package/dist/workspace/agent-binding-compiler.js +9 -93
- package/dist/workspace/index.d.ts +0 -5
- package/dist/workspace/index.js +0 -5
- package/dist/workspace/object-loader.js +44 -99
- package/dist/workspace/support/agent-capabilities.js +2 -2
- package/dist/workspace/support/workspace-ref-utils.d.ts +0 -2
- package/dist/workspace/support/workspace-ref-utils.js +0 -17
- package/dist/workspace/validate.js +1 -1
- package/package.json +1 -1
- package/dist/config/workflows/langgraph-workflows.yaml +0 -570
- package/dist/config/workflows/runtime-profiles.yaml +0 -94
- package/dist/runtime/adapter/langgraph/presets.d.ts +0 -25
- package/dist/runtime/adapter/langgraph/presets.js +0 -165
- package/dist/runtime/adapter/langgraph/profiles.d.ts +0 -6
- package/dist/runtime/adapter/langgraph/profiles.js +0 -206
- package/dist/runtime/checkpoint-maintenance.d.ts +0 -1
- package/dist/runtime/checkpoint-maintenance.js +0 -1
- package/dist/runtime/file-checkpoint-saver.d.ts +0 -1
- package/dist/runtime/file-checkpoint-saver.js +0 -1
- package/dist/runtime/sqlite-maintained-checkpoint-saver.d.ts +0 -1
- package/dist/runtime/sqlite-maintained-checkpoint-saver.js +0 -1
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
export { AgentRuntimeAdapter, AGENT_INTERRUPT_SENTINEL_PREFIX } from "./agent-runtime-adapter.js";
|
|
2
1
|
export { EventBus } from "./harness/events/event-bus.js";
|
|
3
2
|
export { createRuntimeEventSink, RuntimeEventSinkImpl } from "./harness/events/event-sink.js";
|
|
4
|
-
export {
|
|
5
|
-
export { CheckpointMaintenanceLoop, discoverCheckpointMaintenanceTargets, maintainSqliteCheckpoints, readCheckpointMaintenanceConfig, } from "./checkpoint-maintenance.js";
|
|
6
|
-
export { ManagedSqliteSaver } from "./sqlite-maintained-checkpoint-saver.js";
|
|
7
|
-
export { AgentHarnessRuntime, AgentHarness } from "./harness.js";
|
|
8
|
-
export { describeWorkspaceInventory, findAgentBinding, listAgentSkills, listAgentTools, listAvailableAgents, listSpecialists, } from "./harness/system/inventory.js";
|
|
9
|
-
export { assessOpenClawRequirements, assessSkillRequirements, } from "./harness/system/skill-requirements.js";
|
|
10
|
-
export * from "./parsing/index.js";
|
|
11
|
-
export { PolicyEngine } from "./harness/system/policy-engine.js";
|
|
12
|
-
export { createInMemoryStore, FileBackedStore } from "./harness/system/store.js";
|
|
13
|
-
export * from "./support/index.js";
|
|
14
|
-
export { ThreadMemorySync } from "./harness/system/thread-memory-sync.js";
|
|
3
|
+
export { AgentHarnessRuntime } from "./harness.js";
|
|
15
4
|
export type { HarnessEventListener, HarnessEventProjection, RuntimeEventSink } from "../contracts/types.js";
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
export { AgentRuntimeAdapter, AGENT_INTERRUPT_SENTINEL_PREFIX } from "./agent-runtime-adapter.js";
|
|
2
1
|
export { EventBus } from "./harness/events/event-bus.js";
|
|
3
2
|
export { createRuntimeEventSink, RuntimeEventSinkImpl } from "./harness/events/event-sink.js";
|
|
4
|
-
export {
|
|
5
|
-
export { CheckpointMaintenanceLoop, discoverCheckpointMaintenanceTargets, maintainSqliteCheckpoints, readCheckpointMaintenanceConfig, } from "./checkpoint-maintenance.js";
|
|
6
|
-
export { ManagedSqliteSaver } from "./sqlite-maintained-checkpoint-saver.js";
|
|
7
|
-
export { AgentHarnessRuntime, AgentHarness } from "./harness.js";
|
|
8
|
-
export { describeWorkspaceInventory, findAgentBinding, listAgentSkills, listAgentTools, listAvailableAgents, listSpecialists, } from "./harness/system/inventory.js";
|
|
9
|
-
export { assessOpenClawRequirements, assessSkillRequirements, } from "./harness/system/skill-requirements.js";
|
|
10
|
-
export * from "./parsing/index.js";
|
|
11
|
-
export { PolicyEngine } from "./harness/system/policy-engine.js";
|
|
12
|
-
export { createInMemoryStore, FileBackedStore } from "./harness/system/store.js";
|
|
13
|
-
export * from "./support/index.js";
|
|
14
|
-
export { ThreadMemorySync } from "./harness/system/thread-memory-sync.js";
|
|
3
|
+
export { AgentHarnessRuntime } from "./harness.js";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { CompiledAgentBinding, CompiledModel, CompiledTool, DeepAgentParams, LangChainAgentParams, RuntimeModelSlot } from "../../contracts/types.js";
|
|
2
2
|
export declare function getBindingAdapterKind(binding: CompiledAgentBinding): string;
|
|
3
3
|
export declare function getBindingAdapterConfig(binding: CompiledAgentBinding): Record<string, unknown>;
|
|
4
|
-
export declare function getBindingLangGraphWorkflow(binding: CompiledAgentBinding): Record<string, unknown> | undefined;
|
|
5
|
-
export declare function getBindingLangGraphPreset(binding: CompiledAgentBinding): string | undefined;
|
|
6
4
|
export declare function getBindingLangChainParams(binding: CompiledAgentBinding): LangChainAgentParams | undefined;
|
|
7
5
|
export declare function getBindingDeepAgentParams(binding: CompiledAgentBinding): DeepAgentParams | undefined;
|
|
8
6
|
export declare function isLangChainBinding(binding: CompiledAgentBinding): boolean;
|
|
@@ -9,26 +9,9 @@ export function getBindingAdapterKind(binding) {
|
|
|
9
9
|
export function getBindingAdapterConfig(binding) {
|
|
10
10
|
return binding.adapter?.config ?? {};
|
|
11
11
|
}
|
|
12
|
-
export function getBindingLangGraphWorkflow(binding) {
|
|
13
|
-
const workflow = asRecord(getBindingAdapterConfig(binding).workflow);
|
|
14
|
-
if (workflow) {
|
|
15
|
-
return workflow;
|
|
16
|
-
}
|
|
17
|
-
return asRecord(asRecord(getBindingLangChainParams(binding)?.passthrough)?.workflow);
|
|
18
|
-
}
|
|
19
|
-
export function getBindingLangGraphPreset(binding) {
|
|
20
|
-
const adapterPreset = getBindingAdapterConfig(binding).preset;
|
|
21
|
-
if (typeof adapterPreset === "string" && adapterPreset.trim()) {
|
|
22
|
-
return adapterPreset.trim();
|
|
23
|
-
}
|
|
24
|
-
const passthroughPreset = asRecord(getBindingLangChainParams(binding)?.passthrough)?.preset;
|
|
25
|
-
return typeof passthroughPreset === "string" && passthroughPreset.trim()
|
|
26
|
-
? passthroughPreset.trim()
|
|
27
|
-
: undefined;
|
|
28
|
-
}
|
|
29
12
|
export function getBindingLangChainParams(binding) {
|
|
30
|
-
const adapterParams =
|
|
31
|
-
if (
|
|
13
|
+
const adapterParams = getBindingAdapterConfig(binding).params;
|
|
14
|
+
if (getBindingAdapterKind(binding) === "langchain-v1" && typeof adapterParams === "object" && adapterParams && !Array.isArray(adapterParams)) {
|
|
32
15
|
return adapterParams;
|
|
33
16
|
}
|
|
34
17
|
return binding.langchainAgentParams;
|
|
@@ -41,9 +24,7 @@ export function getBindingDeepAgentParams(binding) {
|
|
|
41
24
|
return binding.deepAgentParams;
|
|
42
25
|
}
|
|
43
26
|
export function isLangChainBinding(binding) {
|
|
44
|
-
return getBindingAdapterKind(binding) === "langchain-v1" ||
|
|
45
|
-
getBindingAdapterKind(binding) === "langgraph" ||
|
|
46
|
-
Boolean(binding.langchainAgentParams);
|
|
27
|
+
return getBindingAdapterKind(binding) === "langchain-v1" || Boolean(binding.langchainAgentParams);
|
|
47
28
|
}
|
|
48
29
|
export function isDeepAgentBinding(binding) {
|
|
49
30
|
return getBindingAdapterKind(binding) === "deepagent" || Boolean(binding.deepAgentParams);
|
|
@@ -7,17 +7,6 @@ export declare function parseInterruptContent(content: string): {
|
|
|
7
7
|
allowedDecisions?: Array<"approve" | "edit" | "reject">;
|
|
8
8
|
inputPreview?: Record<string, unknown>;
|
|
9
9
|
};
|
|
10
|
-
export declare function requiresResearchRoute(normalizedInput: string): boolean;
|
|
11
|
-
export declare function resolveDeterministicRouteIntent(normalizedInput: string): "primary" | "secondary" | "research" | undefined;
|
|
12
|
-
export declare function heuristicRoute(input: string, primaryBinding?: {
|
|
13
|
-
agent: {
|
|
14
|
-
id: string;
|
|
15
|
-
};
|
|
16
|
-
}, secondaryBinding?: {
|
|
17
|
-
agent: {
|
|
18
|
-
id: string;
|
|
19
|
-
};
|
|
20
|
-
}): string;
|
|
21
10
|
export declare function createHarnessEvent(threadId: string, runId: string, sequence: number, eventType: string, payload: Record<string, unknown>, source?: HarnessEvent["source"]): HarnessEvent;
|
|
22
11
|
export declare function createPendingApproval(threadId: string, runId: string, checkpointRef: string, input: string, interruptContent?: string): InternalApprovalRecord;
|
|
23
12
|
export declare function inferRoutingBindings(workspace: WorkspaceBundle): {
|
|
@@ -54,49 +54,6 @@ export function parseInterruptContent(content) {
|
|
|
54
54
|
return {};
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
export function requiresResearchRoute(normalizedInput) {
|
|
58
|
-
return (/\b(latest|recent|today|current|news|headlines|research|compare|comparison|best options?)\b/i.test(normalizedInput) ||
|
|
59
|
-
/(最新|最近|今天|当前|新闻|头条|研究|调研|比较|对比)/.test(normalizedInput));
|
|
60
|
-
}
|
|
61
|
-
export function resolveDeterministicRouteIntent(normalizedInput) {
|
|
62
|
-
if (!normalizedInput) {
|
|
63
|
-
return "primary";
|
|
64
|
-
}
|
|
65
|
-
if (requiresResearchRoute(normalizedInput)) {
|
|
66
|
-
return "research";
|
|
67
|
-
}
|
|
68
|
-
if (/^(hi|hello|hey|thanks|thank you|你好|您好|谢谢)\b/.test(normalizedInput)) {
|
|
69
|
-
return "primary";
|
|
70
|
-
}
|
|
71
|
-
if (normalizedInput.length > 240 ||
|
|
72
|
-
normalizedInput.split(/\n+/).length > 3 ||
|
|
73
|
-
/\b(create|build|implement|fix|debug|refactor|review|test|ship|release|deploy|code|bug|repo|repository|file|files|download|clone|inspect|analy[sz]e|explore)\b/i.test(normalizedInput) ||
|
|
74
|
-
/(写代码|实现|修复|排查|调试|重构|评审|测试|发布|部署|仓库|代码|文件|下载|克隆|分析|检查|探索)/.test(normalizedInput)) {
|
|
75
|
-
return "secondary";
|
|
76
|
-
}
|
|
77
|
-
if (/^(what|why|how|when|who|which|explain|summarize|总结|解释|说明|是什么|为什么|怎么|如何)\b/i.test(normalizedInput) &&
|
|
78
|
-
normalizedInput.length < 160) {
|
|
79
|
-
return "primary";
|
|
80
|
-
}
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
export function heuristicRoute(input, primaryBinding, secondaryBinding) {
|
|
84
|
-
const normalized = input.trim().toLowerCase();
|
|
85
|
-
const intent = resolveDeterministicRouteIntent(normalized);
|
|
86
|
-
if (intent === "research") {
|
|
87
|
-
return secondaryBinding?.agent.id ?? primaryBinding?.agent.id ?? "agent";
|
|
88
|
-
}
|
|
89
|
-
if (intent === "primary") {
|
|
90
|
-
return primaryBinding?.agent.id ?? "agent";
|
|
91
|
-
}
|
|
92
|
-
if (intent === "secondary") {
|
|
93
|
-
return secondaryBinding?.agent.id ?? primaryBinding?.agent.id ?? "agent";
|
|
94
|
-
}
|
|
95
|
-
if (!normalized) {
|
|
96
|
-
return primaryBinding?.agent.id ?? "agent";
|
|
97
|
-
}
|
|
98
|
-
return secondaryBinding?.agent.id ?? primaryBinding?.agent.id ?? "agent";
|
|
99
|
-
}
|
|
100
57
|
export function createHarnessEvent(threadId, runId, sequence, eventType, payload, source = "runtime") {
|
|
101
58
|
return {
|
|
102
59
|
eventId: `evt-${String(sequence).padStart(6, "0")}`,
|
|
@@ -131,7 +88,7 @@ export function createPendingApproval(threadId, runId, checkpointRef, input, int
|
|
|
131
88
|
}
|
|
132
89
|
export function inferRoutingBindings(workspace) {
|
|
133
90
|
const runtimeEntryBindings = Array.from(workspace.bindings.values()).filter((binding) => isRuntimeEntryBinding(binding));
|
|
134
|
-
const orchestrationHosts = runtimeEntryBindings.filter((binding) => binding.agent.executionMode === "deepagent" ||
|
|
91
|
+
const orchestrationHosts = runtimeEntryBindings.filter((binding) => binding.agent.executionMode === "deepagent" || Boolean(binding.deepAgentParams));
|
|
135
92
|
const routingHosts = orchestrationHosts.length > 0 ? orchestrationHosts : runtimeEntryBindings;
|
|
136
93
|
const deepAgentHosts = routingHosts.filter((binding) => binding.agent.executionMode === "deepagent" || Boolean(binding.deepAgentParams));
|
|
137
94
|
const nonDeepAgentHosts = routingHosts.filter((binding) => !deepAgentHosts.includes(binding));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createHarnessEvent, createPendingApproval,
|
|
1
|
+
export { createHarnessEvent, createPendingApproval, inferRoutingBindings, parseInterruptContent, renderRuntimeFailure, } from "./harness-support.js";
|
|
2
2
|
export { resolveCompiledEmbeddingModel, resolveCompiledEmbeddingModelRef } from "./embedding-models.js";
|
|
3
3
|
export { createCheckpointerForConfig, createStoreForConfig } from "./runtime-factories.js";
|
|
4
4
|
export { resolveCompiledVectorStore, resolveCompiledVectorStoreRef } from "./vector-stores.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createHarnessEvent, createPendingApproval,
|
|
1
|
+
export { createHarnessEvent, createPendingApproval, inferRoutingBindings, parseInterruptContent, renderRuntimeFailure, } from "./harness-support.js";
|
|
2
2
|
export { resolveCompiledEmbeddingModel, resolveCompiledEmbeddingModelRef } from "./embedding-models.js";
|
|
3
3
|
export { createCheckpointerForConfig, createStoreForConfig } from "./runtime-factories.js";
|
|
4
4
|
export { resolveCompiledVectorStore, resolveCompiledVectorStoreRef } from "./vector-stores.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { MemorySaver } from "@langchain/langgraph";
|
|
3
3
|
import { SqliteSaver } from "@langchain/langgraph-checkpoint-sqlite";
|
|
4
|
-
import { FileCheckpointSaver } from "../file-checkpoint-saver.js";
|
|
5
|
-
import { ManagedSqliteSaver } from "../sqlite-maintained-checkpoint-saver.js";
|
|
4
|
+
import { FileCheckpointSaver } from "../maintenance/file-checkpoint-saver.js";
|
|
5
|
+
import { ManagedSqliteSaver } from "../maintenance/sqlite-maintained-checkpoint-saver.js";
|
|
6
6
|
import { createInMemoryStore, FileBackedStore } from "../harness/system/store.js";
|
|
7
7
|
export function createStoreForConfig(storeConfig, runRoot) {
|
|
8
8
|
const kind = typeof storeConfig.kind === "string" ? storeConfig.kind : "FileStore";
|
|
@@ -242,49 +242,6 @@ function resolveRuntimeMemoryConfig(agent, refs) {
|
|
|
242
242
|
return runtimeMemoryDefaults ? { config: runtimeMemoryDefaults } : undefined;
|
|
243
243
|
}
|
|
244
244
|
function resolveLangGraphWorkflowConfig(agent, refs) {
|
|
245
|
-
if (agent.executionMode !== "langgraph") {
|
|
246
|
-
return undefined;
|
|
247
|
-
}
|
|
248
|
-
const profile = typeof agent.langchainAgentConfig?.profile === "string" && agent.langchainAgentConfig.profile.trim()
|
|
249
|
-
? agent.langchainAgentConfig.profile.trim()
|
|
250
|
-
: typeof agent.langchainAgentConfig?.passthrough === "object" &&
|
|
251
|
-
agent.langchainAgentConfig.passthrough &&
|
|
252
|
-
typeof agent.langchainAgentConfig.passthrough.profile === "string" &&
|
|
253
|
-
agent.langchainAgentConfig.passthrough.profile.trim()
|
|
254
|
-
? agent.langchainAgentConfig.passthrough.profile.trim()
|
|
255
|
-
: undefined;
|
|
256
|
-
const profileWith = typeof agent.langchainAgentConfig?.with === "object" && agent.langchainAgentConfig.with
|
|
257
|
-
? { ...agent.langchainAgentConfig.with }
|
|
258
|
-
: typeof agent.langchainAgentConfig?.passthrough === "object" &&
|
|
259
|
-
agent.langchainAgentConfig.passthrough &&
|
|
260
|
-
typeof agent.langchainAgentConfig.passthrough.with === "object" &&
|
|
261
|
-
agent.langchainAgentConfig.passthrough.with
|
|
262
|
-
? { ...agent.langchainAgentConfig.passthrough.with }
|
|
263
|
-
: undefined;
|
|
264
|
-
const workspaceProfile = profile ? getWorkspaceObject(refs, `runtime-profile/${profile}`) : undefined;
|
|
265
|
-
if (workspaceProfile && workspaceProfile.kind !== "runtime-profile") {
|
|
266
|
-
throw new Error(`Agent ${agent.id} profile ${profile} does not resolve to a RuntimeProfile object`);
|
|
267
|
-
}
|
|
268
|
-
const workspaceProfileValue = workspaceProfile?.value && typeof workspaceProfile.value === "object"
|
|
269
|
-
? workspaceProfile.value
|
|
270
|
-
: undefined;
|
|
271
|
-
const workspaceProfileDefaults = typeof workspaceProfileValue?.defaults === "object" && workspaceProfileValue.defaults
|
|
272
|
-
? workspaceProfileValue.defaults
|
|
273
|
-
: undefined;
|
|
274
|
-
const mergedProfileWith = workspaceProfileDefaults || profileWith
|
|
275
|
-
? {
|
|
276
|
-
...(workspaceProfileDefaults ?? {}),
|
|
277
|
-
...(profileWith ?? {}),
|
|
278
|
-
}
|
|
279
|
-
: undefined;
|
|
280
|
-
const preset = typeof agent.langchainAgentConfig?.preset === "string" && agent.langchainAgentConfig.preset.trim()
|
|
281
|
-
? agent.langchainAgentConfig.preset.trim()
|
|
282
|
-
: typeof agent.langchainAgentConfig?.passthrough === "object" &&
|
|
283
|
-
agent.langchainAgentConfig.passthrough &&
|
|
284
|
-
typeof agent.langchainAgentConfig.passthrough.preset === "string" &&
|
|
285
|
-
agent.langchainAgentConfig.passthrough.preset.trim()
|
|
286
|
-
? agent.langchainAgentConfig.passthrough.preset.trim()
|
|
287
|
-
: undefined;
|
|
288
245
|
const workflowConfig = typeof agent.langchainAgentConfig?.workflow === "object" && agent.langchainAgentConfig.workflow
|
|
289
246
|
? agent.langchainAgentConfig.workflow
|
|
290
247
|
: typeof agent.langchainAgentConfig?.langgraph === "object" && agent.langchainAgentConfig.langgraph
|
|
@@ -300,42 +257,16 @@ function resolveLangGraphWorkflowConfig(agent, refs) {
|
|
|
300
257
|
agent.langchainAgentConfig.passthrough.langgraph
|
|
301
258
|
? agent.langchainAgentConfig.passthrough.langgraph
|
|
302
259
|
: undefined;
|
|
303
|
-
const profileWorkflowRef = typeof workspaceProfileValue?.workflowRef === "string" && workspaceProfileValue.workflowRef.trim()
|
|
304
|
-
? workspaceProfileValue.workflowRef.trim()
|
|
305
|
-
: typeof workspaceProfileValue?.workflow === "string" && workspaceProfileValue.workflow.trim()
|
|
306
|
-
? workspaceProfileValue.workflow.trim()
|
|
307
|
-
: typeof workspaceProfileValue?.workflow === "object" &&
|
|
308
|
-
workspaceProfileValue.workflow &&
|
|
309
|
-
typeof workspaceProfileValue.workflow.ref === "string" &&
|
|
310
|
-
workspaceProfileValue.workflow.ref.trim()
|
|
311
|
-
? workspaceProfileValue.workflow.ref.trim()
|
|
312
|
-
: undefined;
|
|
313
|
-
const resolvedProfileWorkflowConfig = !workflowConfig && profileWorkflowRef
|
|
314
|
-
? materializeWorkspaceObjectConfig(refs, profileWorkflowRef, ["langgraph-workflow"], `Agent ${agent.id} profile ${profile} workflow`)
|
|
315
|
-
: undefined;
|
|
316
260
|
if (!workflowConfig) {
|
|
317
|
-
return
|
|
318
|
-
? {
|
|
319
|
-
...(profile ? { profile } : {}),
|
|
320
|
-
...(mergedProfileWith ? { with: mergedProfileWith } : {}),
|
|
321
|
-
...(preset ? { preset } : {}),
|
|
322
|
-
...(resolvedProfileWorkflowConfig ? { config: resolvedProfileWorkflowConfig } : {}),
|
|
323
|
-
}
|
|
324
|
-
: undefined;
|
|
261
|
+
return undefined;
|
|
325
262
|
}
|
|
326
263
|
if (isRefConfig(workflowConfig)) {
|
|
327
264
|
return {
|
|
328
|
-
config: materializeWorkspaceObjectConfig(refs, workflowConfig.ref, [
|
|
329
|
-
...(profile ? { profile } : {}),
|
|
330
|
-
...(mergedProfileWith ? { with: mergedProfileWith } : {}),
|
|
331
|
-
...(preset ? { preset } : {}),
|
|
265
|
+
config: materializeWorkspaceObjectConfig(refs, workflowConfig.ref, [], `Agent ${agent.id} workflow`),
|
|
332
266
|
};
|
|
333
267
|
}
|
|
334
268
|
return {
|
|
335
269
|
config: workflowConfig,
|
|
336
|
-
...(profile ? { profile } : {}),
|
|
337
|
-
...(mergedProfileWith ? { with: mergedProfileWith } : {}),
|
|
338
|
-
...(preset ? { preset } : {}),
|
|
339
270
|
};
|
|
340
271
|
}
|
|
341
272
|
function resolveRuntimeModelRefs(agent, refs) {
|
|
@@ -363,7 +294,6 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
363
294
|
const store = resolveStoreConfig(agent, refs);
|
|
364
295
|
const checkpointer = resolveCheckpointerConfig(agent, refs);
|
|
365
296
|
const runtimeMemory = resolveRuntimeMemoryConfig(agent, refs);
|
|
366
|
-
const langGraphWorkflow = resolveLangGraphWorkflowConfig(agent, refs);
|
|
367
297
|
const runtimeModelRefs = resolveRuntimeModelRefs(agent, refs);
|
|
368
298
|
const runtimeModels = compileRuntimeModels(runtimeModelRefs, models, agent.id);
|
|
369
299
|
const runRoot = typeof agent.runRoot === "string" && agent.runRoot.trim().length > 0
|
|
@@ -379,13 +309,9 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
379
309
|
? {
|
|
380
310
|
deepAgent: true,
|
|
381
311
|
}
|
|
382
|
-
:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
386
|
-
: {
|
|
387
|
-
langchainV1: true,
|
|
388
|
-
},
|
|
312
|
+
: {
|
|
313
|
+
langchainV1: true,
|
|
314
|
+
},
|
|
389
315
|
},
|
|
390
316
|
harnessRuntime: {
|
|
391
317
|
runRoot,
|
|
@@ -400,12 +326,8 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
400
326
|
},
|
|
401
327
|
};
|
|
402
328
|
if (agent.executionMode !== "deepagent") {
|
|
403
|
-
const
|
|
404
|
-
? {
|
|
405
|
-
...(langGraphWorkflow?.profile ? { profile: langGraphWorkflow.profile } : {}),
|
|
406
|
-
...(langGraphWorkflow?.with ? { with: langGraphWorkflow.with } : {}),
|
|
407
|
-
...(langGraphWorkflow?.config ? { workflow: langGraphWorkflow.config } : {}),
|
|
408
|
-
}
|
|
329
|
+
const basePassthrough = typeof agent.langchainAgentConfig?.passthrough === "object" && agent.langchainAgentConfig.passthrough
|
|
330
|
+
? { ...agent.langchainAgentConfig.passthrough }
|
|
409
331
|
: undefined;
|
|
410
332
|
const langchainAgentParams = {
|
|
411
333
|
model: compiledAgentModel,
|
|
@@ -418,9 +340,7 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
418
340
|
? { ...agent.langchainAgentConfig.filesystem }
|
|
419
341
|
: undefined,
|
|
420
342
|
middleware: compileMiddlewareConfigs(agent.langchainAgentConfig?.middleware, models, agent.id),
|
|
421
|
-
passthrough:
|
|
422
|
-
? { ...agent.langchainAgentConfig.passthrough }
|
|
423
|
-
: undefined, langGraphPassthrough),
|
|
343
|
+
passthrough: basePassthrough,
|
|
424
344
|
subagents: agent.subagentRefs.map((ref) => {
|
|
425
345
|
const subagent = agents.get(resolveRefId(ref));
|
|
426
346
|
if (!subagent) {
|
|
@@ -444,12 +364,8 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
444
364
|
return {
|
|
445
365
|
...base,
|
|
446
366
|
adapter: {
|
|
447
|
-
kind:
|
|
367
|
+
kind: "langchain-v1",
|
|
448
368
|
config: {
|
|
449
|
-
...(agent.executionMode === "langgraph" && langGraphWorkflow?.profile ? { profile: langGraphWorkflow.profile } : {}),
|
|
450
|
-
...(agent.executionMode === "langgraph" && langGraphWorkflow?.with ? { with: langGraphWorkflow.with } : {}),
|
|
451
|
-
...(agent.executionMode === "langgraph" && langGraphWorkflow?.preset ? { preset: langGraphWorkflow.preset } : {}),
|
|
452
|
-
...(agent.executionMode === "langgraph" && langGraphWorkflow?.config ? { workflow: langGraphWorkflow.config } : {}),
|
|
453
369
|
params: langchainAgentParams,
|
|
454
370
|
},
|
|
455
371
|
},
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export { compileBinding, compileAgentSkills, requireTools } from "./agent-binding-compiler.js";
|
|
2
1
|
export { loadWorkspace } from "./compile.js";
|
|
3
|
-
export { loadWorkspaceObjects } from "./object-loader.js";
|
|
4
|
-
export { compileEmbeddingModel, compileModel, compileTool, compileVectorStore, parseEmbeddingModelObject, parseModelObject, parseToolObject, parseVectorStoreObject, validateEmbeddingModelObject, validateModelObject, validateToolObject, validateVectorStoreObject, } from "./resource-compilers.js";
|
|
5
|
-
export * from "./support/index.js";
|
|
6
|
-
export { validateAgent, validateTopology } from "./validate.js";
|
package/dist/workspace/index.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export { compileBinding, compileAgentSkills, requireTools } from "./agent-binding-compiler.js";
|
|
2
1
|
export { loadWorkspace } from "./compile.js";
|
|
3
|
-
export { loadWorkspaceObjects } from "./object-loader.js";
|
|
4
|
-
export { compileEmbeddingModel, compileModel, compileTool, compileVectorStore, parseEmbeddingModelObject, parseModelObject, parseToolObject, parseVectorStoreObject, validateEmbeddingModelObject, validateModelObject, validateToolObject, validateVectorStoreObject, } from "./resource-compilers.js";
|
|
5
|
-
export * from "./support/index.js";
|
|
6
|
-
export { validateAgent, validateTopology } from "./validate.js";
|
|
@@ -150,10 +150,6 @@ function normalizeKind(kind) {
|
|
|
150
150
|
return "runtime";
|
|
151
151
|
case "RuntimeMemory":
|
|
152
152
|
return "runtime-memory";
|
|
153
|
-
case "LangGraphWorkflow":
|
|
154
|
-
return "langgraph-workflow";
|
|
155
|
-
case "RuntimeProfile":
|
|
156
|
-
return "runtime-profile";
|
|
157
153
|
case "Prompt":
|
|
158
154
|
return "prompt";
|
|
159
155
|
case "McpServer":
|
|
@@ -239,12 +235,29 @@ function readCapabilities(value) {
|
|
|
239
235
|
};
|
|
240
236
|
return Object.keys(capabilities).length > 0 ? capabilities : undefined;
|
|
241
237
|
}
|
|
238
|
+
const CONSUMED_AGENT_CONFIG_KEYS = [
|
|
239
|
+
"systemPrompt",
|
|
240
|
+
"checkpointer",
|
|
241
|
+
"interruptOn",
|
|
242
|
+
"stateSchema",
|
|
243
|
+
"responseFormat",
|
|
244
|
+
"contextSchema",
|
|
245
|
+
"includeAgentName",
|
|
246
|
+
"version",
|
|
247
|
+
"middleware",
|
|
248
|
+
"backend",
|
|
249
|
+
"store",
|
|
250
|
+
"runtimeMemory",
|
|
251
|
+
"taskDescription",
|
|
252
|
+
"generalPurposeAgent",
|
|
253
|
+
"filesystem",
|
|
254
|
+
];
|
|
242
255
|
function readExecutionConfig(value) {
|
|
243
256
|
return asMutableObject(value);
|
|
244
257
|
}
|
|
245
|
-
function
|
|
258
|
+
function readExecutionValue(item, key, reader) {
|
|
246
259
|
const execution = readExecutionConfig(item.execution);
|
|
247
|
-
return
|
|
260
|
+
return reader(execution?.[key]);
|
|
248
261
|
}
|
|
249
262
|
function readRuntimeConfig(item) {
|
|
250
263
|
return asMutableObject(item.runtime);
|
|
@@ -254,21 +267,12 @@ function readRuntimeModelRefs(runtime) {
|
|
|
254
267
|
return undefined;
|
|
255
268
|
}
|
|
256
269
|
const modelRefs = {
|
|
257
|
-
...(typeof runtime.routingModelRef === "string" && runtime.routingModelRef.trim()
|
|
258
|
-
? { routing: runtime.routingModelRef.trim() }
|
|
259
|
-
: {}),
|
|
260
270
|
...(typeof runtime.planningModelRef === "string" && runtime.planningModelRef.trim()
|
|
261
271
|
? { planning: runtime.planningModelRef.trim() }
|
|
262
272
|
: {}),
|
|
263
273
|
...(typeof runtime.executionModelRef === "string" && runtime.executionModelRef.trim()
|
|
264
274
|
? { execution: runtime.executionModelRef.trim() }
|
|
265
275
|
: {}),
|
|
266
|
-
...(typeof runtime.reviewModelRef === "string" && runtime.reviewModelRef.trim()
|
|
267
|
-
? { review: runtime.reviewModelRef.trim() }
|
|
268
|
-
: {}),
|
|
269
|
-
...(typeof runtime.finalModelRef === "string" && runtime.finalModelRef.trim()
|
|
270
|
-
? { final: runtime.finalModelRef.trim() }
|
|
271
|
-
: {}),
|
|
272
276
|
};
|
|
273
277
|
return Object.keys(modelRefs).length > 0 ? modelRefs : undefined;
|
|
274
278
|
}
|
|
@@ -328,29 +332,21 @@ function resolveExecutionBackend(item, current) {
|
|
|
328
332
|
if (backend === "langchain-v1") {
|
|
329
333
|
return "langchain-v1";
|
|
330
334
|
}
|
|
331
|
-
if (backend === "langgraph") {
|
|
332
|
-
return "langgraph";
|
|
333
|
-
}
|
|
334
335
|
if (backend === "deepagent") {
|
|
335
336
|
return "deepagent";
|
|
336
337
|
}
|
|
338
|
+
if (backend === "langgraph") {
|
|
339
|
+
throw new Error("Agent execution.backend=langgraph is no longer supported; use execution.backend=langchain-v1 or execution.backend=deepagent");
|
|
340
|
+
}
|
|
337
341
|
return undefined;
|
|
338
342
|
}
|
|
339
|
-
function
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
function readExecutionPathArray(item, key) {
|
|
348
|
-
const execution = readExecutionConfig(item.execution);
|
|
349
|
-
return readPathArray(execution?.[key]);
|
|
350
|
-
}
|
|
351
|
-
function readExecutionObjectArray(item, key) {
|
|
352
|
-
const execution = readExecutionConfig(item.execution);
|
|
353
|
-
return readObjectArray(execution?.[key]);
|
|
343
|
+
function readSharedAgentConfigFields(config) {
|
|
344
|
+
return {
|
|
345
|
+
...(typeof config.store === "object" && config.store ? { store: config.store } : {}),
|
|
346
|
+
...(typeof config.runtimeMemory === "object" && config.runtimeMemory ? { runtimeMemory: config.runtimeMemory } : {}),
|
|
347
|
+
...(typeof config.taskDescription === "string" && config.taskDescription.trim() ? { taskDescription: config.taskDescription } : {}),
|
|
348
|
+
...(typeof config.generalPurposeAgent === "boolean" ? { generalPurposeAgent: config.generalPurposeAgent } : {}),
|
|
349
|
+
};
|
|
354
350
|
}
|
|
355
351
|
function readSharedAgentConfig(config) {
|
|
356
352
|
const middleware = readMiddlewareArray(config.middleware);
|
|
@@ -372,67 +368,20 @@ function readSharedAgentConfig(config) {
|
|
|
372
368
|
...(middleware ? { middleware } : {}),
|
|
373
369
|
};
|
|
374
370
|
}
|
|
375
|
-
function
|
|
376
|
-
const config =
|
|
377
|
-
const passthrough = readPassthroughConfig(config, [
|
|
378
|
-
"systemPrompt",
|
|
379
|
-
"checkpointer",
|
|
380
|
-
"interruptOn",
|
|
381
|
-
"stateSchema",
|
|
382
|
-
"responseFormat",
|
|
383
|
-
"contextSchema",
|
|
384
|
-
"includeAgentName",
|
|
385
|
-
"version",
|
|
386
|
-
"middleware",
|
|
387
|
-
"backend",
|
|
388
|
-
"store",
|
|
389
|
-
"runtimeMemory",
|
|
390
|
-
"taskDescription",
|
|
391
|
-
"generalPurposeAgent",
|
|
392
|
-
"filesystem",
|
|
393
|
-
]);
|
|
394
|
-
return {
|
|
395
|
-
...readSharedAgentConfig(config),
|
|
396
|
-
...(typeof config.store === "object" && config.store ? { store: config.store } : {}),
|
|
397
|
-
...(typeof config.runtimeMemory === "object" && config.runtimeMemory ? { runtimeMemory: config.runtimeMemory } : {}),
|
|
398
|
-
...(typeof config.taskDescription === "string" && config.taskDescription.trim() ? { taskDescription: config.taskDescription } : {}),
|
|
399
|
-
...(typeof config.generalPurposeAgent === "boolean" ? { generalPurposeAgent: config.generalPurposeAgent } : {}),
|
|
400
|
-
...(passthrough ? { passthrough } : {}),
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
function readDeepAgentConfig(item) {
|
|
404
|
-
const config = readExecutionAgentConfig(item);
|
|
405
|
-
const passthrough = readPassthroughConfig(config, [
|
|
406
|
-
"systemPrompt",
|
|
407
|
-
"checkpointer",
|
|
408
|
-
"interruptOn",
|
|
409
|
-
"stateSchema",
|
|
410
|
-
"responseFormat",
|
|
411
|
-
"contextSchema",
|
|
412
|
-
"includeAgentName",
|
|
413
|
-
"version",
|
|
414
|
-
"middleware",
|
|
415
|
-
"backend",
|
|
416
|
-
"store",
|
|
417
|
-
"runtimeMemory",
|
|
418
|
-
"taskDescription",
|
|
419
|
-
"generalPurposeAgent",
|
|
420
|
-
"filesystem",
|
|
421
|
-
]);
|
|
371
|
+
function readAgentConfig(item, options = {}) {
|
|
372
|
+
const config = readExecutionValue(item, "config", asMutableObject) ?? {};
|
|
373
|
+
const passthrough = readPassthroughConfig(config, [...CONSUMED_AGENT_CONFIG_KEYS]);
|
|
422
374
|
return {
|
|
423
375
|
...readSharedAgentConfig(config),
|
|
424
|
-
...(
|
|
425
|
-
...(typeof config.
|
|
426
|
-
...(typeof config.runtimeMemory === "object" && config.runtimeMemory ? { runtimeMemory: config.runtimeMemory } : {}),
|
|
427
|
-
...(typeof config.taskDescription === "string" && config.taskDescription.trim() ? { taskDescription: config.taskDescription } : {}),
|
|
428
|
-
...(typeof config.generalPurposeAgent === "boolean" ? { generalPurposeAgent: config.generalPurposeAgent } : {}),
|
|
376
|
+
...readSharedAgentConfigFields(config),
|
|
377
|
+
...(options.includeObjectBackend && typeof config.backend === "object" && config.backend ? { backend: config.backend } : {}),
|
|
429
378
|
...(passthrough ? { passthrough } : {}),
|
|
430
379
|
};
|
|
431
380
|
}
|
|
432
381
|
export function parseAgentItem(item, sourcePath) {
|
|
433
382
|
const moduleRoot = moduleRootForSourcePath(sourcePath, "agents");
|
|
434
|
-
const subagentRefs =
|
|
435
|
-
const subagentPathRefs =
|
|
383
|
+
const subagentRefs = readExecutionValue(item, "subagents", readRefArray);
|
|
384
|
+
const subagentPathRefs = readExecutionValue(item, "subagents", readPathArray).map((entry) => resolveModuleRelativePath(entry, moduleRoot));
|
|
436
385
|
const executionMode = String(resolveExecutionBackend(item) ?? "deepagent");
|
|
437
386
|
const runtime = readRuntimeConfig(item);
|
|
438
387
|
return {
|
|
@@ -443,16 +392,16 @@ export function parseAgentItem(item, sourcePath) {
|
|
|
443
392
|
? { delegation: true, memory: true }
|
|
444
393
|
: { delegation: true, memory: true }),
|
|
445
394
|
description: String(item.description ?? ""),
|
|
446
|
-
modelRef:
|
|
395
|
+
modelRef: readExecutionValue(item, "modelRef", readSingleRef) ?? "",
|
|
447
396
|
runRoot: typeof runtime?.runRoot === "string" ? runtime.runRoot : undefined,
|
|
448
|
-
toolRefs:
|
|
449
|
-
mcpServers:
|
|
450
|
-
skillPathRefs:
|
|
451
|
-
memorySources:
|
|
397
|
+
toolRefs: readExecutionValue(item, "tools", readRefArray),
|
|
398
|
+
mcpServers: readExecutionValue(item, "mcpServers", readObjectArray),
|
|
399
|
+
skillPathRefs: readExecutionValue(item, "skills", readPathArray).map((entry) => resolveModuleRelativePath(entry, moduleRoot)),
|
|
400
|
+
memorySources: readExecutionValue(item, "memory", readPathArray).map((entry) => resolveModuleRelativePath(entry, moduleRoot)),
|
|
452
401
|
subagentRefs,
|
|
453
402
|
subagentPathRefs,
|
|
454
|
-
langchainAgentConfig: normalizeModuleAgentConfig(
|
|
455
|
-
deepAgentConfig: normalizeModuleAgentConfig(
|
|
403
|
+
langchainAgentConfig: normalizeModuleAgentConfig(readAgentConfig(item), moduleRoot),
|
|
404
|
+
deepAgentConfig: normalizeModuleAgentConfig(readAgentConfig(item, { includeObjectBackend: true }), moduleRoot),
|
|
456
405
|
sourcePath,
|
|
457
406
|
};
|
|
458
407
|
}
|
|
@@ -473,11 +422,7 @@ async function objectItemsFromDocument(document, sourcePath) {
|
|
|
473
422
|
? normalizeCatalogSpec(document, { defaultKind: "Tool" })
|
|
474
423
|
: catalogKind === "McpServers"
|
|
475
424
|
? normalizeCatalogSpec(document, { defaultKind: "McpServer" })
|
|
476
|
-
:
|
|
477
|
-
? normalizeCatalogSpec(document, { defaultKind: "LangGraphWorkflow" })
|
|
478
|
-
: catalogKind === "RuntimeProfiles"
|
|
479
|
-
? normalizeCatalogSpec(document, { defaultKind: "RuntimeProfile" })
|
|
480
|
-
: [];
|
|
425
|
+
: [];
|
|
481
426
|
if (catalogItems.length > 0) {
|
|
482
427
|
return catalogItems;
|
|
483
428
|
}
|
|
@@ -9,8 +9,8 @@ export function inferAgentCapabilities(agent) {
|
|
|
9
9
|
return normalizeCapabilities(agent.capabilities);
|
|
10
10
|
}
|
|
11
11
|
return {
|
|
12
|
-
delegation: agent.executionMode === "deepagent" || agent.executionMode === "langchain-v1"
|
|
13
|
-
memory: agent.executionMode === "deepagent" || agent.executionMode === "langchain-v1"
|
|
12
|
+
delegation: agent.executionMode === "deepagent" || agent.executionMode === "langchain-v1",
|
|
13
|
+
memory: agent.executionMode === "deepagent" || agent.executionMode === "langchain-v1",
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export function inferBindingCapabilities(binding) {
|
|
@@ -38,9 +38,7 @@ export declare function getRuntimeModelDefaults(refs: Map<string, WorkspaceObjec
|
|
|
38
38
|
export declare function getRecoveryConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): RecoveryConfig;
|
|
39
39
|
export declare function getConcurrencyConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): ConcurrencyConfig;
|
|
40
40
|
export declare function getResilienceConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): ResilienceConfig;
|
|
41
|
-
export declare function getRoutingSystemPrompt(refs: Map<string, WorkspaceObject | ParsedAgentObject>): string | undefined;
|
|
42
41
|
export declare function getRoutingDefaultAgentId(refs: Map<string, WorkspaceObject | ParsedAgentObject>): string | undefined;
|
|
43
|
-
export declare function isModelRoutingEnabled(refs: Map<string, WorkspaceObject | ParsedAgentObject>): boolean;
|
|
44
42
|
export declare function getRoutingRules(refs: Map<string, WorkspaceObject | ParsedAgentObject>): RoutingRule[];
|
|
45
43
|
export declare function matchRoutingRule(input: string, rule: RoutingRule, options?: {
|
|
46
44
|
threadId?: string;
|