@botbotgo/agent-harness 0.0.95 → 0.0.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +1 -114
  2. package/README.zh.md +1 -70
  3. package/dist/api.d.ts +5 -5
  4. package/dist/config/workflows/langgraph-workflows.yaml +363 -111
  5. package/dist/config/workflows/runtime-profiles.yaml +94 -0
  6. package/dist/contracts/core.d.ts +9 -0
  7. package/dist/contracts/core.js +1 -0
  8. package/dist/contracts/runtime.d.ts +421 -0
  9. package/dist/contracts/runtime.js +1 -0
  10. package/dist/contracts/types.d.ts +3 -571
  11. package/dist/contracts/types.js +3 -1
  12. package/dist/contracts/workspace.d.ts +229 -0
  13. package/dist/contracts/workspace.js +1 -0
  14. package/dist/package-version.d.ts +1 -1
  15. package/dist/package-version.js +1 -1
  16. package/dist/runtime/adapter/compat/deepagent-compat.d.ts +16 -0
  17. package/dist/runtime/adapter/compat/deepagent-compat.js +45 -0
  18. package/dist/runtime/adapter/compat/openai-compatible.d.ts +2 -0
  19. package/dist/runtime/adapter/compat/openai-compatible.js +43 -0
  20. package/dist/runtime/adapter/index.d.ts +15 -0
  21. package/dist/runtime/adapter/index.js +15 -0
  22. package/dist/runtime/adapter/langgraph/presets.js +165 -0
  23. package/dist/runtime/{langgraph-profiles.d.ts → adapter/langgraph/profiles.d.ts} +1 -1
  24. package/dist/runtime/adapter/langgraph/profiles.js +206 -0
  25. package/dist/runtime/adapter/model/invocation-request.d.ts +10 -0
  26. package/dist/runtime/adapter/model/invocation-request.js +46 -0
  27. package/dist/runtime/adapter/model/message-assembly.d.ts +6 -0
  28. package/dist/runtime/adapter/model/message-assembly.js +21 -0
  29. package/dist/runtime/adapter/model/model-providers.d.ts +2 -0
  30. package/dist/runtime/adapter/model/model-providers.js +27 -0
  31. package/dist/runtime/adapter/resilience.d.ts +12 -0
  32. package/dist/runtime/adapter/resilience.js +60 -0
  33. package/dist/runtime/{declared-middleware.d.ts → adapter/tool/declared-middleware.d.ts} +1 -1
  34. package/dist/runtime/adapter/tool/interrupt-policy.d.ts +8 -0
  35. package/dist/runtime/adapter/tool/interrupt-policy.js +34 -0
  36. package/dist/runtime/adapter/tool/provider-tool.d.ts +2 -0
  37. package/dist/runtime/adapter/tool/provider-tool.js +25 -0
  38. package/dist/runtime/adapter/tool/resolved-tool.d.ts +18 -0
  39. package/dist/runtime/adapter/tool/resolved-tool.js +62 -0
  40. package/dist/runtime/adapter/tool/tool-arguments.d.ts +7 -0
  41. package/dist/runtime/adapter/tool/tool-arguments.js +87 -0
  42. package/dist/runtime/{tool-hitl.d.ts → adapter/tool/tool-hitl.d.ts} +2 -2
  43. package/dist/runtime/adapter/tool/tool-name-mapping.d.ts +13 -0
  44. package/dist/runtime/adapter/tool/tool-name-mapping.js +101 -0
  45. package/dist/runtime/agent-runtime-adapter.d.ts +5 -20
  46. package/dist/runtime/agent-runtime-adapter.js +42 -544
  47. package/dist/runtime/checkpoint-maintenance.d.ts +1 -45
  48. package/dist/runtime/checkpoint-maintenance.js +1 -259
  49. package/dist/runtime/file-checkpoint-saver.d.ts +1 -20
  50. package/dist/runtime/file-checkpoint-saver.js +1 -106
  51. package/dist/runtime/{event-bus.d.ts → harness/events/event-bus.d.ts} +1 -1
  52. package/dist/runtime/{event-sink.d.ts → harness/events/event-sink.d.ts} +1 -1
  53. package/dist/runtime/{event-sink.js → harness/events/event-sink.js} +1 -1
  54. package/dist/runtime/harness/events/events.d.ts +23 -0
  55. package/dist/runtime/harness/events/events.js +61 -0
  56. package/dist/runtime/harness/events/streaming.d.ts +19 -0
  57. package/dist/runtime/harness/events/streaming.js +96 -0
  58. package/dist/runtime/harness/index.d.ts +16 -0
  59. package/dist/runtime/harness/index.js +16 -0
  60. package/dist/runtime/harness/run/helpers.d.ts +33 -0
  61. package/dist/runtime/harness/run/helpers.js +74 -0
  62. package/dist/runtime/harness/run/resources.d.ts +7 -0
  63. package/dist/runtime/harness/run/resources.js +58 -0
  64. package/dist/runtime/harness/run/resume.d.ts +6 -0
  65. package/dist/runtime/harness/run/resume.js +56 -0
  66. package/dist/runtime/harness/run/routing.d.ts +12 -0
  67. package/dist/runtime/harness/run/routing.js +47 -0
  68. package/dist/runtime/harness/run/run-lifecycle.d.ts +37 -0
  69. package/dist/runtime/harness/run/run-lifecycle.js +109 -0
  70. package/dist/runtime/harness/run/run-queue.d.ts +17 -0
  71. package/dist/runtime/harness/run/run-queue.js +43 -0
  72. package/dist/runtime/{health-monitor.d.ts → harness/system/health-monitor.d.ts} +3 -3
  73. package/dist/runtime/{health-monitor.js → harness/system/health-monitor.js} +2 -2
  74. package/dist/runtime/{inventory.d.ts → harness/system/inventory.d.ts} +2 -2
  75. package/dist/runtime/{inventory.js → harness/system/inventory.js} +4 -4
  76. package/dist/runtime/{policy-engine.d.ts → harness/system/policy-engine.d.ts} +1 -1
  77. package/dist/runtime/{policy-engine.js → harness/system/policy-engine.js} +1 -1
  78. package/dist/runtime/{skill-requirements.d.ts → harness/system/skill-requirements.d.ts} +1 -1
  79. package/dist/runtime/{skill-requirements.js → harness/system/skill-requirements.js} +1 -1
  80. package/dist/runtime/{thread-memory-sync.d.ts → harness/system/thread-memory-sync.d.ts} +2 -2
  81. package/dist/runtime/{thread-memory-sync.js → harness/system/thread-memory-sync.js} +1 -1
  82. package/dist/runtime/harness.d.ts +2 -7
  83. package/dist/runtime/harness.js +158 -477
  84. package/dist/runtime/index.d.ts +7 -7
  85. package/dist/runtime/index.js +7 -7
  86. package/dist/runtime/maintenance/checkpoint-maintenance.d.ts +45 -0
  87. package/dist/runtime/maintenance/checkpoint-maintenance.js +259 -0
  88. package/dist/runtime/maintenance/file-checkpoint-saver.d.ts +20 -0
  89. package/dist/runtime/maintenance/file-checkpoint-saver.js +106 -0
  90. package/dist/runtime/maintenance/index.d.ts +4 -0
  91. package/dist/runtime/maintenance/index.js +4 -0
  92. package/dist/runtime/{runtime-record-maintenance.d.ts → maintenance/runtime-record-maintenance.d.ts} +1 -1
  93. package/dist/runtime/{runtime-record-maintenance.js → maintenance/runtime-record-maintenance.js} +2 -2
  94. package/dist/runtime/maintenance/sqlite-maintained-checkpoint-saver.d.ts +9 -0
  95. package/dist/runtime/maintenance/sqlite-maintained-checkpoint-saver.js +39 -0
  96. package/dist/runtime/parsing/stream-event-parsing.d.ts +6 -0
  97. package/dist/runtime/parsing/stream-event-parsing.js +231 -0
  98. package/dist/runtime/sqlite-maintained-checkpoint-saver.d.ts +1 -9
  99. package/dist/runtime/sqlite-maintained-checkpoint-saver.js +1 -39
  100. package/dist/runtime/support/harness-support.d.ts +4 -4
  101. package/dist/runtime/support/harness-support.js +14 -3
  102. package/dist/runtime/support/runtime-factories.d.ts +1 -1
  103. package/dist/runtime/support/runtime-factories.js +1 -1
  104. package/dist/workspace/agent-binding-compiler.js +39 -3
  105. package/dist/workspace/object-loader.js +5 -1
  106. package/package.json +4 -4
  107. package/dist/runtime/langgraph-presets.js +0 -165
  108. package/dist/runtime/langgraph-profiles.js +0 -206
  109. /package/dist/runtime/{langgraph-presets.d.ts → adapter/langgraph/presets.d.ts} +0 -0
  110. /package/dist/runtime/{declared-middleware.js → adapter/tool/declared-middleware.js} +0 -0
  111. /package/dist/runtime/{tool-hitl.js → adapter/tool/tool-hitl.js} +0 -0
  112. /package/dist/runtime/{event-bus.js → harness/events/event-bus.js} +0 -0
  113. /package/dist/runtime/{store.d.ts → harness/system/store.d.ts} +0 -0
  114. /package/dist/runtime/{store.js → harness/system/store.js} +0 -0
@@ -0,0 +1,229 @@
1
+ import type { ExecutionMode, RuntimeCapabilities, RuntimeModelRefMap, RuntimeModelSlot } from "./core.js";
2
+ export type ParsedAgentObject = {
3
+ id: string;
4
+ executionMode: ExecutionMode;
5
+ runtimeModelRefs?: RuntimeModelRefMap;
6
+ capabilities?: RuntimeCapabilities;
7
+ description: string;
8
+ modelRef: string;
9
+ runRoot?: string;
10
+ toolRefs: string[];
11
+ mcpServers?: Array<Record<string, unknown>>;
12
+ skillPathRefs: string[];
13
+ memorySources: string[];
14
+ subagentRefs: string[];
15
+ subagentPathRefs: string[];
16
+ langchainAgentConfig?: Record<string, unknown>;
17
+ deepAgentConfig?: Record<string, unknown>;
18
+ sourcePath: string;
19
+ };
20
+ export type WorkspaceObject = {
21
+ id: string;
22
+ kind: string;
23
+ sourcePath: string;
24
+ value: Record<string, unknown>;
25
+ };
26
+ export type ParsedModelObject = {
27
+ id: string;
28
+ provider: string;
29
+ model: string;
30
+ init: Record<string, unknown>;
31
+ clientRef?: string;
32
+ fallbacks: string[];
33
+ metadata?: Record<string, unknown>;
34
+ sourcePath: string;
35
+ };
36
+ export type ParsedEmbeddingModelObject = {
37
+ id: string;
38
+ provider: string;
39
+ model: string;
40
+ init: Record<string, unknown>;
41
+ clientRef?: string;
42
+ metadata?: Record<string, unknown>;
43
+ sourcePath: string;
44
+ };
45
+ export type ParsedVectorStoreObject = {
46
+ id: string;
47
+ kind: string;
48
+ url?: string;
49
+ authToken?: string;
50
+ table?: string;
51
+ column?: string;
52
+ embeddingModelRef?: string;
53
+ metadata?: Record<string, unknown>;
54
+ sourcePath: string;
55
+ };
56
+ export type ParsedMcpServerObject = {
57
+ id: string;
58
+ transport: "stdio" | "http" | "sse" | "websocket";
59
+ url?: string;
60
+ command?: string;
61
+ args?: string[];
62
+ env?: Record<string, string>;
63
+ cwd?: string;
64
+ token?: string;
65
+ headers?: Record<string, string>;
66
+ sourcePath: string;
67
+ };
68
+ export type ParsedToolObject = {
69
+ id: string;
70
+ type: string;
71
+ name: string;
72
+ description: string;
73
+ implementationName?: string;
74
+ config?: Record<string, unknown>;
75
+ inputSchemaRef?: string;
76
+ backendOperation?: string;
77
+ mcpRef?: string;
78
+ bundleRefs: string[];
79
+ hitl?: {
80
+ enabled: boolean;
81
+ allow?: Array<"approve" | "edit" | "reject">;
82
+ };
83
+ retryable?: boolean;
84
+ sourcePath: string;
85
+ };
86
+ export type CompiledModel = {
87
+ id: string;
88
+ provider: string;
89
+ model: string;
90
+ init: Record<string, unknown>;
91
+ clientRef?: string;
92
+ fallbacks: string[];
93
+ runtimeValue: string;
94
+ };
95
+ export type CompiledEmbeddingModel = {
96
+ id: string;
97
+ provider: string;
98
+ model: string;
99
+ init: Record<string, unknown>;
100
+ clientRef?: string;
101
+ runtimeValue: string;
102
+ };
103
+ export type CompiledVectorStore = {
104
+ id: string;
105
+ kind: string;
106
+ url?: string;
107
+ authToken?: string;
108
+ table?: string;
109
+ column?: string;
110
+ embeddingModelRef?: string;
111
+ runtimeValue: string;
112
+ };
113
+ export type CompiledTool = {
114
+ id: string;
115
+ type: string;
116
+ name: string;
117
+ description: string;
118
+ config?: Record<string, unknown>;
119
+ inputSchemaRef?: string;
120
+ backendOperation?: string;
121
+ mcpRef?: string;
122
+ bundleRefs: string[];
123
+ hitl?: {
124
+ enabled: boolean;
125
+ allow: Array<"approve" | "edit" | "reject">;
126
+ };
127
+ retryable?: boolean;
128
+ runtimeValue: {
129
+ name: string;
130
+ description: string;
131
+ type: string;
132
+ };
133
+ };
134
+ export type CompiledSubAgent = {
135
+ name: string;
136
+ description: string;
137
+ systemPrompt: string;
138
+ tools?: CompiledTool[];
139
+ model?: CompiledModel;
140
+ interruptOn?: Record<string, boolean | object>;
141
+ skills?: string[];
142
+ memory?: string[];
143
+ responseFormat?: unknown;
144
+ contextSchema?: unknown;
145
+ middleware?: Array<Record<string, unknown>>;
146
+ passthrough?: Record<string, unknown>;
147
+ };
148
+ export type LangChainAgentParams = {
149
+ model: CompiledModel;
150
+ tools: CompiledTool[];
151
+ systemPrompt?: string;
152
+ stateSchema?: unknown;
153
+ responseFormat?: unknown;
154
+ contextSchema?: unknown;
155
+ filesystem?: Record<string, unknown>;
156
+ middleware?: Array<Record<string, unknown>>;
157
+ passthrough?: Record<string, unknown>;
158
+ subagents?: CompiledSubAgent[];
159
+ memory?: string[];
160
+ skills?: string[];
161
+ generalPurposeAgent?: boolean;
162
+ taskDescription?: string;
163
+ includeAgentName?: "inline";
164
+ version?: "v1" | "v2";
165
+ name?: string;
166
+ description: string;
167
+ };
168
+ export type DeepAgentParams = {
169
+ model: CompiledModel;
170
+ tools: CompiledTool[];
171
+ systemPrompt?: string;
172
+ responseFormat?: unknown;
173
+ contextSchema?: unknown;
174
+ middleware?: Array<Record<string, unknown>>;
175
+ passthrough?: Record<string, unknown>;
176
+ description: string;
177
+ subagents: CompiledSubAgent[];
178
+ interruptOn?: Record<string, boolean | object>;
179
+ backend?: Record<string, unknown>;
180
+ store?: Record<string, unknown>;
181
+ name: string;
182
+ memory: string[];
183
+ skills: string[];
184
+ generalPurposeAgent?: boolean;
185
+ taskDescription?: string;
186
+ };
187
+ export type RuntimeModelMap = Partial<Record<RuntimeModelSlot, CompiledModel>>;
188
+ export type CompiledAgentBinding = {
189
+ agent: ParsedAgentObject;
190
+ adapter?: {
191
+ kind: string;
192
+ config: Record<string, unknown>;
193
+ };
194
+ langchainAgentParams?: LangChainAgentParams;
195
+ deepAgentParams?: DeepAgentParams;
196
+ harnessRuntime: {
197
+ runRoot: string;
198
+ workspaceRoot?: string;
199
+ modelRefs?: RuntimeModelRefMap;
200
+ models?: RuntimeModelMap;
201
+ capabilities?: RuntimeCapabilities;
202
+ resilience?: Record<string, unknown>;
203
+ checkpointer?: Record<string, unknown> | boolean;
204
+ store?: Record<string, unknown>;
205
+ runtimeMemory?: Record<string, unknown>;
206
+ };
207
+ };
208
+ export type WorkspaceBundle = {
209
+ workspaceRoot: string;
210
+ resourceSources: string[];
211
+ refs: Map<string, WorkspaceObject | ParsedAgentObject>;
212
+ models: Map<string, ParsedModelObject>;
213
+ embeddings: Map<string, ParsedEmbeddingModelObject>;
214
+ vectorStores: Map<string, ParsedVectorStoreObject>;
215
+ mcpServers: Map<string, ParsedMcpServerObject>;
216
+ tools: Map<string, ParsedToolObject>;
217
+ agents: Map<string, ParsedAgentObject>;
218
+ bindings: Map<string, CompiledAgentBinding>;
219
+ };
220
+ export type WorkspaceLoadOptions = {
221
+ /**
222
+ * Additional workspace roots to load before the runtime workspace root.
223
+ * Merge order is deterministic:
224
+ * framework defaults -> each overlayRoot (in order) -> workspaceRoot.
225
+ * Later values always override earlier values.
226
+ */
227
+ overlayRoots?: string[];
228
+ resourceSources?: string[];
229
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.94";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.96";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.94";
1
+ export const AGENT_HARNESS_VERSION = "0.0.96";
@@ -0,0 +1,16 @@
1
+ import type { CompiledModel, CompiledSubAgent } from "../../../contracts/types.js";
2
+ type DelegationPromptCompatibilityParams = {
3
+ subagents?: CompiledSubAgent[];
4
+ generalPurposeAgent?: boolean;
5
+ taskDescription?: string;
6
+ };
7
+ export declare function relativizeDeepAgentSkillSourcePaths(workspaceRoot: string | undefined, skillPaths: string[] | undefined): string[] | undefined;
8
+ export declare function materializeDeepAgentSkillSourcePaths(options: {
9
+ workspaceRoot?: string;
10
+ runRoot?: string;
11
+ ownerId: string;
12
+ skillPaths?: string[];
13
+ }): Promise<string[] | undefined>;
14
+ export declare function shouldRelaxDeepAgentDelegationPrompt(model: CompiledModel | undefined, params: DelegationPromptCompatibilityParams): boolean;
15
+ export declare function applyDeepAgentDelegationPromptCompatibility<T extends DelegationPromptCompatibilityParams>(model: CompiledModel | undefined, params: T): T;
16
+ export {};
@@ -0,0 +1,45 @@
1
+ import path from "node:path";
2
+ function isOpenAICompatibleGptOssModel(model) {
3
+ return model?.provider === "openai-compatible" && model.model.trim().toLowerCase().startsWith("gpt-oss");
4
+ }
5
+ export function relativizeDeepAgentSkillSourcePaths(workspaceRoot, skillPaths) {
6
+ if (!workspaceRoot || !skillPaths) {
7
+ return skillPaths;
8
+ }
9
+ return skillPaths.map((skillPath) => {
10
+ if (!path.isAbsolute(skillPath)) {
11
+ return skillPath;
12
+ }
13
+ const relative = path.relative(workspaceRoot, skillPath);
14
+ if (!relative || relative.startsWith("..")) {
15
+ return skillPath;
16
+ }
17
+ return relative.split(path.sep).join("/");
18
+ });
19
+ }
20
+ export async function materializeDeepAgentSkillSourcePaths(options) {
21
+ const { workspaceRoot, skillPaths } = options;
22
+ if (!skillPaths) {
23
+ return skillPaths;
24
+ }
25
+ return relativizeDeepAgentSkillSourcePaths(workspaceRoot, skillPaths) ?? skillPaths;
26
+ }
27
+ export function shouldRelaxDeepAgentDelegationPrompt(model, params) {
28
+ if (!isOpenAICompatibleGptOssModel(model)) {
29
+ return false;
30
+ }
31
+ if ((params.subagents?.length ?? 0) === 0) {
32
+ return false;
33
+ }
34
+ return params.generalPurposeAgent === true || Boolean(params.taskDescription?.trim());
35
+ }
36
+ export function applyDeepAgentDelegationPromptCompatibility(model, params) {
37
+ if (!shouldRelaxDeepAgentDelegationPrompt(model, params)) {
38
+ return params;
39
+ }
40
+ return {
41
+ ...params,
42
+ generalPurposeAgent: undefined,
43
+ taskDescription: undefined,
44
+ };
45
+ }
@@ -0,0 +1,2 @@
1
+ export declare function buildAuthOmittingFetch(baseFetch?: typeof fetch): typeof fetch;
2
+ export declare function normalizeOpenAICompatibleInit(init: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,43 @@
1
+ function asObject(value) {
2
+ return typeof value === "object" && value ? value : undefined;
3
+ }
4
+ function isPlaceholderApiKey(value) {
5
+ return typeof value === "string" && value.trim().toLowerCase() === "dummy";
6
+ }
7
+ export function buildAuthOmittingFetch(baseFetch = fetch) {
8
+ return async (input, init) => {
9
+ const sanitizedHeaders = new Headers(input instanceof Request ? input.headers : undefined);
10
+ const initHeaders = new Headers(init?.headers);
11
+ initHeaders.forEach((value, key) => {
12
+ sanitizedHeaders.set(key, value);
13
+ });
14
+ sanitizedHeaders.delete("authorization");
15
+ if (input instanceof Request) {
16
+ return baseFetch(new Request(input, {
17
+ ...init,
18
+ headers: sanitizedHeaders,
19
+ }));
20
+ }
21
+ return baseFetch(input, {
22
+ ...init,
23
+ headers: sanitizedHeaders,
24
+ });
25
+ };
26
+ }
27
+ export function normalizeOpenAICompatibleInit(init) {
28
+ const normalized = { ...init };
29
+ const configuration = asObject(init.configuration) ?? {};
30
+ const baseUrl = typeof init.baseUrl === "string" && init.baseUrl.trim() ? init.baseUrl.trim() : undefined;
31
+ const omitAuthHeader = init.omitAuthHeader === true || isPlaceholderApiKey(init.apiKey);
32
+ const nextConfiguration = { ...configuration };
33
+ if (baseUrl && typeof nextConfiguration.baseURL !== "string") {
34
+ nextConfiguration.baseURL = baseUrl;
35
+ }
36
+ if (omitAuthHeader) {
37
+ nextConfiguration.fetch = buildAuthOmittingFetch(typeof configuration.fetch === "function" ? configuration.fetch : fetch);
38
+ }
39
+ normalized.configuration = nextConfiguration;
40
+ delete normalized.baseUrl;
41
+ delete normalized.omitAuthHeader;
42
+ return normalized;
43
+ }
@@ -0,0 +1,15 @@
1
+ export * from "./tool/declared-middleware.js";
2
+ export * from "./compat/deepagent-compat.js";
3
+ export * from "./tool/interrupt-policy.js";
4
+ export * from "./model/invocation-request.js";
5
+ export * from "./langgraph/presets.js";
6
+ export * from "./langgraph/profiles.js";
7
+ export * from "./model/message-assembly.js";
8
+ export * from "./model/model-providers.js";
9
+ export * from "./compat/openai-compatible.js";
10
+ export * from "./tool/provider-tool.js";
11
+ export * from "./resilience.js";
12
+ export * from "./tool/resolved-tool.js";
13
+ export * from "./tool/tool-arguments.js";
14
+ export * from "./tool/tool-hitl.js";
15
+ export * from "./tool/tool-name-mapping.js";
@@ -0,0 +1,15 @@
1
+ export * from "./tool/declared-middleware.js";
2
+ export * from "./compat/deepagent-compat.js";
3
+ export * from "./tool/interrupt-policy.js";
4
+ export * from "./model/invocation-request.js";
5
+ export * from "./langgraph/presets.js";
6
+ export * from "./langgraph/profiles.js";
7
+ export * from "./model/message-assembly.js";
8
+ export * from "./model/model-providers.js";
9
+ export * from "./compat/openai-compatible.js";
10
+ export * from "./tool/provider-tool.js";
11
+ export * from "./resilience.js";
12
+ export * from "./tool/resolved-tool.js";
13
+ export * from "./tool/tool-arguments.js";
14
+ export * from "./tool/tool-hitl.js";
15
+ export * from "./tool/tool-name-mapping.js";
@@ -0,0 +1,165 @@
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,4 +1,4 @@
1
- import type { LangGraphPresetWorkflow } from "./langgraph-presets.js";
1
+ import type { LangGraphPresetWorkflow } from "./presets.js";
2
2
  export type LangGraphProfileName = "coding-runtime" | "personal-assistant" | "research-runtime" | "approval-review-runtime" | "claw-style-assistant" | "chat-operator" | "copilot-sidecar" | "task-delegation-hub";
3
3
  type LangGraphProfileOptions = Record<string, unknown>;
4
4
  export declare const SUPPORTED_LANGGRAPH_PROFILES: LangGraphProfileName[];