@botbotgo/agent-harness 0.0.98 → 0.0.100
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 +5 -4
- package/README.zh.md +4 -0
- 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/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 +1 -42
- package/dist/runtime/agent-runtime-adapter.js +94 -1425
- package/dist/runtime/harness/run/helpers.js +2 -8
- 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 +3 -7
- package/dist/runtime/harness.js +56 -69
- 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/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 +4 -21
- 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
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
const DEFAULT_PLANNER_PROMPT = "You are the workflow planner. Produce a concise execution plan for the user request before execution starts.";
|
|
2
|
-
const DEFAULT_REVIEWER_PROMPT = "Review the current result, call out missing verification or obvious gaps, and state whether the work looks sufficient.";
|
|
3
|
-
const DEFAULT_REPLANNER_PROMPT = "Refine the plan based on the reviewer feedback and current result. Return only the updated plan.";
|
|
4
|
-
const DEFAULT_FINALIZER_PROMPT = "Rewrite the current result into a concise user-facing final answer. Preserve facts and caveats.";
|
|
5
|
-
export const SUPPORTED_LANGGRAPH_PRESETS = [
|
|
6
|
-
"react",
|
|
7
|
-
"prompt-chaining",
|
|
8
|
-
"routing",
|
|
9
|
-
"parallelization",
|
|
10
|
-
"plan-execute",
|
|
11
|
-
"review-loop",
|
|
12
|
-
"evaluator-optimizer",
|
|
13
|
-
"approval-gate",
|
|
14
|
-
"handoff",
|
|
15
|
-
"orchestrator-workers",
|
|
16
|
-
];
|
|
17
|
-
function requireAgent(preset, options) {
|
|
18
|
-
if (typeof options.agent === "string" && options.agent.trim()) {
|
|
19
|
-
return options.agent.trim();
|
|
20
|
-
}
|
|
21
|
-
throw new Error(`LangGraph preset ${preset} requires config.agent`);
|
|
22
|
-
}
|
|
23
|
-
export function resolveLangGraphPresetWorkflow(presetName, options = {}) {
|
|
24
|
-
switch (presetName) {
|
|
25
|
-
case undefined:
|
|
26
|
-
case "":
|
|
27
|
-
return undefined;
|
|
28
|
-
case "react":
|
|
29
|
-
return {
|
|
30
|
-
entryNode: "step1",
|
|
31
|
-
nodes: [
|
|
32
|
-
{ id: "step1", kind: "agent" },
|
|
33
|
-
],
|
|
34
|
-
edges: [],
|
|
35
|
-
};
|
|
36
|
-
case "prompt-chaining":
|
|
37
|
-
case "plan-execute":
|
|
38
|
-
return {
|
|
39
|
-
entryNode: "step1",
|
|
40
|
-
nodes: [
|
|
41
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
42
|
-
{ id: "step2", kind: "agent" },
|
|
43
|
-
{ id: "step3", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
44
|
-
],
|
|
45
|
-
edges: [
|
|
46
|
-
{ from: "step1", to: "step2" },
|
|
47
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
case "routing": {
|
|
51
|
-
const agent = requireAgent("routing", options);
|
|
52
|
-
return {
|
|
53
|
-
entryNode: "step1",
|
|
54
|
-
nodes: [
|
|
55
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
56
|
-
{ id: "step2", kind: "agent", agent },
|
|
57
|
-
{ id: "step3", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
58
|
-
],
|
|
59
|
-
edges: [
|
|
60
|
-
{ from: "step1", to: "step2" },
|
|
61
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
62
|
-
],
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
case "parallelization": {
|
|
66
|
-
const agent = requireAgent("parallelization", options);
|
|
67
|
-
return {
|
|
68
|
-
entryNode: "step1",
|
|
69
|
-
nodes: [
|
|
70
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
71
|
-
{ id: "step2", kind: "agent", agent },
|
|
72
|
-
{ id: "step3", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
|
|
73
|
-
{ id: "step4", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
74
|
-
],
|
|
75
|
-
edges: [
|
|
76
|
-
{ from: "step1", to: "step2" },
|
|
77
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
78
|
-
{ from: "step3", to: "step4", when: "review_ok" },
|
|
79
|
-
],
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
case "review-loop":
|
|
83
|
-
return {
|
|
84
|
-
entryNode: "step1",
|
|
85
|
-
nodes: [
|
|
86
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
87
|
-
{ id: "step2", kind: "agent" },
|
|
88
|
-
{ id: "step3", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
|
|
89
|
-
{ id: "step4", kind: "llm", role: "replanner", prompt: DEFAULT_REPLANNER_PROMPT },
|
|
90
|
-
{ id: "step5", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
91
|
-
],
|
|
92
|
-
edges: [
|
|
93
|
-
{ from: "step1", to: "step2" },
|
|
94
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
95
|
-
{ from: "step3", to: "step5", when: "review_ok" },
|
|
96
|
-
{ from: "step3", to: "step4", when: "review_incomplete" },
|
|
97
|
-
{ from: "step4", to: "step2", when: "has_plan" },
|
|
98
|
-
],
|
|
99
|
-
};
|
|
100
|
-
case "evaluator-optimizer":
|
|
101
|
-
return {
|
|
102
|
-
entryNode: "step1",
|
|
103
|
-
nodes: [
|
|
104
|
-
{ id: "step1", kind: "agent" },
|
|
105
|
-
{ id: "step2", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
|
|
106
|
-
{ id: "step3", kind: "llm", role: "replanner", prompt: DEFAULT_REPLANNER_PROMPT },
|
|
107
|
-
{ id: "step4", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
108
|
-
],
|
|
109
|
-
edges: [
|
|
110
|
-
{ from: "step1", to: "step2", when: "has_result" },
|
|
111
|
-
{ from: "step2", to: "step4", when: "review_ok" },
|
|
112
|
-
{ from: "step2", to: "step3", when: "review_incomplete" },
|
|
113
|
-
{ from: "step3", to: "step1", when: "has_plan" },
|
|
114
|
-
],
|
|
115
|
-
};
|
|
116
|
-
case "approval-gate":
|
|
117
|
-
return {
|
|
118
|
-
entryNode: "step1",
|
|
119
|
-
nodes: [
|
|
120
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
121
|
-
{ id: "step2", kind: "approval" },
|
|
122
|
-
{ id: "step3", kind: "agent" },
|
|
123
|
-
{ id: "step4", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
124
|
-
],
|
|
125
|
-
edges: [
|
|
126
|
-
{ from: "step1", to: "step2" },
|
|
127
|
-
{ from: "step2", to: "step3", when: "approval_approved" },
|
|
128
|
-
{ from: "step2", to: "step3", when: "approval_edited" },
|
|
129
|
-
{ from: "step3", to: "step4", when: "has_result" },
|
|
130
|
-
],
|
|
131
|
-
};
|
|
132
|
-
case "handoff": {
|
|
133
|
-
const agent = requireAgent("handoff", options);
|
|
134
|
-
return {
|
|
135
|
-
entryNode: "step1",
|
|
136
|
-
nodes: [
|
|
137
|
-
{ id: "step1", kind: "agent", agent },
|
|
138
|
-
{ id: "step2", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
139
|
-
],
|
|
140
|
-
edges: [
|
|
141
|
-
{ from: "step1", to: "step2", when: "has_result" },
|
|
142
|
-
],
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
case "orchestrator-workers": {
|
|
146
|
-
const agent = requireAgent("orchestrator-workers", options);
|
|
147
|
-
return {
|
|
148
|
-
entryNode: "step1",
|
|
149
|
-
nodes: [
|
|
150
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
151
|
-
{ id: "step2", kind: "agent", agent },
|
|
152
|
-
{ id: "step3", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
|
|
153
|
-
{ id: "step4", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
154
|
-
],
|
|
155
|
-
edges: [
|
|
156
|
-
{ from: "step1", to: "step2" },
|
|
157
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
158
|
-
{ from: "step3", to: "step4", when: "review_ok" },
|
|
159
|
-
],
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
default:
|
|
163
|
-
throw new Error(`Unsupported LangGraph preset ${String(presetName)}. Supported presets: ${SUPPORTED_LANGGRAPH_PRESETS.join(", ")}`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { LangGraphPresetWorkflow } from "./presets.js";
|
|
2
|
-
export type LangGraphProfileName = "coding-runtime" | "personal-assistant" | "research-runtime" | "approval-review-runtime" | "claw-style-assistant" | "chat-operator" | "copilot-sidecar" | "task-delegation-hub";
|
|
3
|
-
type LangGraphProfileOptions = Record<string, unknown>;
|
|
4
|
-
export declare const SUPPORTED_LANGGRAPH_PROFILES: LangGraphProfileName[];
|
|
5
|
-
export declare function resolveLangGraphProfileWorkflow(profileName: string | undefined, options?: LangGraphProfileOptions): LangGraphPresetWorkflow | undefined;
|
|
6
|
-
export {};
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
const DEFAULT_PLANNER_PROMPT = "You are the workflow planner. Produce a concise execution plan for the user request before execution starts.";
|
|
2
|
-
const DEFAULT_REVIEWER_PROMPT = "Review the current result, call out missing verification or obvious gaps, and state whether the work looks sufficient.";
|
|
3
|
-
const DEFAULT_FINALIZER_PROMPT = "Rewrite the current result into a concise user-facing final answer. Preserve facts and caveats.";
|
|
4
|
-
const DEFAULT_REPLANNER_PROMPT = "Refine the plan based on the reviewer feedback and current result. Return only the updated plan.";
|
|
5
|
-
export const SUPPORTED_LANGGRAPH_PROFILES = [
|
|
6
|
-
"coding-runtime",
|
|
7
|
-
"personal-assistant",
|
|
8
|
-
"research-runtime",
|
|
9
|
-
"approval-review-runtime",
|
|
10
|
-
"claw-style-assistant",
|
|
11
|
-
"chat-operator",
|
|
12
|
-
"copilot-sidecar",
|
|
13
|
-
"task-delegation-hub",
|
|
14
|
-
];
|
|
15
|
-
function readStringOption(options, key) {
|
|
16
|
-
const value = options[key];
|
|
17
|
-
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
18
|
-
}
|
|
19
|
-
function requireAgentOption(profile, options, key) {
|
|
20
|
-
const value = readStringOption(options, key);
|
|
21
|
-
if (value) {
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
throw new Error(`LangGraph profile ${profile} requires with.${key}`);
|
|
25
|
-
}
|
|
26
|
-
function buildCodingRuntimeWorkflow(options) {
|
|
27
|
-
const coderAgent = requireAgentOption("coding-runtime", options, "coderAgent");
|
|
28
|
-
const verifierAgent = readStringOption(options, "verifierAgent");
|
|
29
|
-
const needsVerification = Boolean(verifierAgent) || options.runIntegrationVerification === true;
|
|
30
|
-
return {
|
|
31
|
-
entryNode: "step1",
|
|
32
|
-
nodes: [
|
|
33
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
34
|
-
{ id: "step2", kind: "agent", agent: coderAgent },
|
|
35
|
-
{ id: "step3", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
|
|
36
|
-
{ id: "step4", kind: "llm", role: "replanner", prompt: DEFAULT_REPLANNER_PROMPT },
|
|
37
|
-
...(needsVerification
|
|
38
|
-
? [{ id: "step5", kind: "approval" }, { id: "step6", kind: "agent", agent: verifierAgent ?? coderAgent }]
|
|
39
|
-
: []),
|
|
40
|
-
{ id: "step7", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
41
|
-
],
|
|
42
|
-
edges: [
|
|
43
|
-
{ from: "step1", to: "step2" },
|
|
44
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
45
|
-
{ from: "step3", to: needsVerification ? "step5" : "step7", when: "review_ok" },
|
|
46
|
-
{ from: "step3", to: "step4", when: "review_incomplete" },
|
|
47
|
-
{ from: "step4", to: "step2", when: "has_plan" },
|
|
48
|
-
...(needsVerification
|
|
49
|
-
? [
|
|
50
|
-
{ from: "step5", to: "step6", when: "approval_approved" },
|
|
51
|
-
{ from: "step5", to: "step6", when: "approval_edited" },
|
|
52
|
-
{ from: "step6", to: "step7", when: "has_result" },
|
|
53
|
-
]
|
|
54
|
-
: []),
|
|
55
|
-
],
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function buildAssistantWorkflow(options) {
|
|
59
|
-
const worker = readStringOption(options, "defaultWorkerAgent") ??
|
|
60
|
-
readStringOption(options, "defaultResearchAgent") ??
|
|
61
|
-
readStringOption(options, "defaultWritingAgent") ??
|
|
62
|
-
readStringOption(options, "defaultSchedulingAgent");
|
|
63
|
-
return {
|
|
64
|
-
entryNode: "step1",
|
|
65
|
-
nodes: [
|
|
66
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
67
|
-
...(worker ? [{ id: "step2", kind: "agent", agent: worker }] : [{ id: "step2", kind: "tool", tool: "repo_inventory" }]),
|
|
68
|
-
{ id: "step3", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
|
|
69
|
-
{ id: "step4", kind: "approval" },
|
|
70
|
-
{ id: "step5", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
71
|
-
],
|
|
72
|
-
edges: [
|
|
73
|
-
{ from: "step1", to: "step2" },
|
|
74
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
75
|
-
{ from: "step3", to: "step4", when: "review_incomplete" },
|
|
76
|
-
{ from: "step3", to: "step5", when: "review_ok" },
|
|
77
|
-
{ from: "step4", to: "step5", when: "approval_approved" },
|
|
78
|
-
{ from: "step4", to: "step5", when: "approval_edited" },
|
|
79
|
-
],
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function buildResearchWorkflow(options) {
|
|
83
|
-
const gathererAgent = requireAgentOption("research-runtime", options, "gathererAgent");
|
|
84
|
-
const analystAgent = requireAgentOption("research-runtime", options, "analystAgent");
|
|
85
|
-
const synthesizerAgent = readStringOption(options, "synthesizerAgent");
|
|
86
|
-
return {
|
|
87
|
-
entryNode: "step1",
|
|
88
|
-
nodes: [
|
|
89
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
90
|
-
{ id: "step2", kind: "agent", agent: gathererAgent },
|
|
91
|
-
{ id: "step3", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
|
|
92
|
-
{ id: "step4", kind: "agent", agent: analystAgent },
|
|
93
|
-
...(synthesizerAgent ? [{ id: "step5", kind: "agent", agent: synthesizerAgent }] : []),
|
|
94
|
-
{ id: "step6", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
95
|
-
],
|
|
96
|
-
edges: [
|
|
97
|
-
{ from: "step1", to: "step2" },
|
|
98
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
99
|
-
{ from: "step3", to: "step4", when: "review_ok" },
|
|
100
|
-
{ from: "step3", to: "step2", when: "review_incomplete" },
|
|
101
|
-
{ from: "step4", to: synthesizerAgent ? "step5" : "step6", when: "has_result" },
|
|
102
|
-
...(synthesizerAgent ? [{ from: "step5", to: "step6", when: "has_result" }] : []),
|
|
103
|
-
],
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function buildApprovalReviewWorkflow(options) {
|
|
107
|
-
const preparerAgent = requireAgentOption("approval-review-runtime", options, "preparerAgent");
|
|
108
|
-
const reviewerAgent = readStringOption(options, "reviewerAgent");
|
|
109
|
-
return {
|
|
110
|
-
entryNode: "step1",
|
|
111
|
-
nodes: [
|
|
112
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
113
|
-
{ id: "step2", kind: "agent", agent: preparerAgent },
|
|
114
|
-
...(reviewerAgent ? [{ id: "step3", kind: "agent", agent: reviewerAgent }] : [{ id: "step3", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT }]),
|
|
115
|
-
{ id: "step4", kind: "approval" },
|
|
116
|
-
{ id: "step5", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
117
|
-
],
|
|
118
|
-
edges: [
|
|
119
|
-
{ from: "step1", to: "step2" },
|
|
120
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
121
|
-
{ from: "step3", to: "step4", when: "has_result" },
|
|
122
|
-
{ from: "step4", to: "step5", when: "approval_approved" },
|
|
123
|
-
{ from: "step4", to: "step5", when: "approval_edited" },
|
|
124
|
-
],
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function buildChatOperatorWorkflow(options) {
|
|
128
|
-
const routedAgent = readStringOption(options, "assistantAgent") ??
|
|
129
|
-
readStringOption(options, "researchAgent") ??
|
|
130
|
-
readStringOption(options, "codingAgent") ??
|
|
131
|
-
readStringOption(options, "approvalAgent");
|
|
132
|
-
if (!routedAgent) {
|
|
133
|
-
throw new Error("LangGraph profile chat-operator requires at least one target agent in with.assistantAgent, with.researchAgent, with.codingAgent, or with.approvalAgent");
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
entryNode: "step1",
|
|
137
|
-
nodes: [
|
|
138
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
139
|
-
{ id: "step2", kind: "agent", agent: routedAgent },
|
|
140
|
-
{ id: "step3", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
141
|
-
],
|
|
142
|
-
edges: [
|
|
143
|
-
{ from: "step1", to: "step2" },
|
|
144
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
145
|
-
],
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
function buildCopilotSidecarWorkflow(options) {
|
|
149
|
-
const coderAgent = requireAgentOption("copilot-sidecar", options, "coderAgent");
|
|
150
|
-
return {
|
|
151
|
-
entryNode: "step1",
|
|
152
|
-
nodes: [
|
|
153
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
154
|
-
{ id: "step2", kind: "agent", agent: coderAgent },
|
|
155
|
-
{ id: "step3", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
156
|
-
],
|
|
157
|
-
edges: [
|
|
158
|
-
{ from: "step1", to: "step2" },
|
|
159
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
160
|
-
],
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function buildDelegationHubWorkflow(options) {
|
|
164
|
-
const workerAgent = readStringOption(options, "defaultWorkerFallback");
|
|
165
|
-
if (!workerAgent) {
|
|
166
|
-
throw new Error("LangGraph profile task-delegation-hub requires with.defaultWorkerFallback");
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
entryNode: "step1",
|
|
170
|
-
nodes: [
|
|
171
|
-
{ id: "step1", kind: "llm", role: "planner", prompt: DEFAULT_PLANNER_PROMPT },
|
|
172
|
-
{ id: "step2", kind: "agent", agent: workerAgent },
|
|
173
|
-
{ id: "step3", kind: "llm", role: "reviewer", prompt: DEFAULT_REVIEWER_PROMPT },
|
|
174
|
-
{ id: "step4", kind: "llm", role: "finalizer", prompt: DEFAULT_FINALIZER_PROMPT },
|
|
175
|
-
],
|
|
176
|
-
edges: [
|
|
177
|
-
{ from: "step1", to: "step2" },
|
|
178
|
-
{ from: "step2", to: "step3", when: "has_result" },
|
|
179
|
-
{ from: "step3", to: "step4", when: "review_ok" },
|
|
180
|
-
],
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
export function resolveLangGraphProfileWorkflow(profileName, options = {}) {
|
|
184
|
-
switch (profileName) {
|
|
185
|
-
case undefined:
|
|
186
|
-
case "":
|
|
187
|
-
return undefined;
|
|
188
|
-
case "coding-runtime":
|
|
189
|
-
return buildCodingRuntimeWorkflow(options);
|
|
190
|
-
case "personal-assistant":
|
|
191
|
-
case "claw-style-assistant":
|
|
192
|
-
return buildAssistantWorkflow(options);
|
|
193
|
-
case "research-runtime":
|
|
194
|
-
return buildResearchWorkflow(options);
|
|
195
|
-
case "approval-review-runtime":
|
|
196
|
-
return buildApprovalReviewWorkflow(options);
|
|
197
|
-
case "chat-operator":
|
|
198
|
-
return buildChatOperatorWorkflow(options);
|
|
199
|
-
case "copilot-sidecar":
|
|
200
|
-
return buildCopilotSidecarWorkflow(options);
|
|
201
|
-
case "task-delegation-hub":
|
|
202
|
-
return buildDelegationHubWorkflow(options);
|
|
203
|
-
default:
|
|
204
|
-
throw new Error(`Unsupported LangGraph profile ${String(profileName)}. Supported profiles: ${SUPPORTED_LANGGRAPH_PROFILES.join(", ")}`);
|
|
205
|
-
}
|
|
206
|
-
}
|