@synergenius/flow-weaver-pack-weaver 0.9.152 → 0.9.154
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/ai-chat-provider.js +4 -4
- package/dist/ai-chat-provider.js.map +1 -1
- package/dist/bot/ai-client.d.ts +30 -0
- package/dist/bot/ai-client.d.ts.map +1 -1
- package/dist/bot/ai-client.js +37 -0
- package/dist/bot/ai-client.js.map +1 -1
- package/dist/bot/behavior-defaults.d.ts.map +1 -1
- package/dist/bot/behavior-defaults.js +7 -2
- package/dist/bot/behavior-defaults.js.map +1 -1
- package/dist/bot/capability-registry.d.ts.map +1 -1
- package/dist/bot/capability-registry.js +46 -33
- package/dist/bot/capability-registry.js.map +1 -1
- package/dist/bot/file-validator.d.ts +7 -0
- package/dist/bot/file-validator.d.ts.map +1 -1
- package/dist/bot/file-validator.js +76 -0
- package/dist/bot/file-validator.js.map +1 -1
- package/dist/bot/instance-manager.d.ts +22 -7
- package/dist/bot/instance-manager.d.ts.map +1 -1
- package/dist/bot/instance-manager.js +69 -7
- package/dist/bot/instance-manager.js.map +1 -1
- package/dist/bot/orchestrator.d.ts +11 -9
- package/dist/bot/orchestrator.d.ts.map +1 -1
- package/dist/bot/orchestrator.js +56 -107
- package/dist/bot/orchestrator.js.map +1 -1
- package/dist/bot/runner.d.ts +29 -0
- package/dist/bot/runner.d.ts.map +1 -1
- package/dist/bot/runner.js +114 -73
- package/dist/bot/runner.js.map +1 -1
- package/dist/bot/step-executor.d.ts.map +1 -1
- package/dist/bot/step-executor.js +28 -9
- package/dist/bot/step-executor.js.map +1 -1
- package/dist/bot/swarm-controller.d.ts +7 -6
- package/dist/bot/swarm-controller.d.ts.map +1 -1
- package/dist/bot/swarm-controller.js +64 -74
- package/dist/bot/swarm-controller.js.map +1 -1
- package/dist/bot/system-prompt.d.ts.map +1 -1
- package/dist/bot/system-prompt.js +2 -0
- package/dist/bot/system-prompt.js.map +1 -1
- package/dist/bot/task-types.d.ts +1 -0
- package/dist/bot/task-types.d.ts.map +1 -1
- package/dist/bot/weaver-tools.d.ts +1 -1
- package/dist/bot/weaver-tools.d.ts.map +1 -1
- package/dist/bot/weaver-tools.js +12 -1
- package/dist/bot/weaver-tools.js.map +1 -1
- package/dist/node-types/agent-execute.js +2 -2
- package/dist/node-types/agent-execute.js.map +1 -1
- package/dist/node-types/bot-report.d.ts.map +1 -1
- package/dist/node-types/bot-report.js +5 -2
- package/dist/node-types/bot-report.js.map +1 -1
- package/dist/node-types/build-context.d.ts.map +1 -1
- package/dist/node-types/build-context.js +13 -1
- package/dist/node-types/build-context.js.map +1 -1
- package/dist/node-types/exec-validate-retry.d.ts +3 -3
- package/dist/node-types/exec-validate-retry.d.ts.map +1 -1
- package/dist/node-types/exec-validate-retry.js +13 -184
- package/dist/node-types/exec-validate-retry.js.map +1 -1
- package/dist/node-types/load-config.d.ts +1 -0
- package/dist/node-types/load-config.d.ts.map +1 -1
- package/dist/node-types/load-config.js +1 -0
- package/dist/node-types/load-config.js.map +1 -1
- package/dist/node-types/plan-task.d.ts +7 -5
- package/dist/node-types/plan-task.d.ts.map +1 -1
- package/dist/node-types/plan-task.js +282 -83
- package/dist/node-types/plan-task.js.map +1 -1
- package/dist/ui/bot-panel.js +1 -1
- package/dist/ui/capability-editor.js +46 -33
- package/dist/ui/chat-task-result.js +7 -7
- package/dist/ui/profile-editor.js +44 -31
- package/dist/ui/swarm-dashboard.js +80 -47
- package/dist/ui/task-detail-view.js +31 -11
- package/dist/ui/task-editor.js +1 -1
- package/dist/ui/task-pool-list.js +1 -1
- package/dist/workflows/weaver-bot.d.ts +5 -4
- package/dist/workflows/weaver-bot.d.ts.map +1 -1
- package/dist/workflows/weaver-bot.js +8 -7
- package/dist/workflows/weaver-bot.js.map +1 -1
- package/flowweaver.manifest.json +1 -1
- package/package.json +1 -1
- package/src/ai-chat-provider.ts +4 -4
- package/src/bot/ai-client.ts +65 -0
- package/src/bot/behavior-defaults.ts +5 -2
- package/src/bot/capability-registry.ts +46 -33
- package/src/bot/file-validator.ts +97 -0
- package/src/bot/instance-manager.ts +77 -7
- package/src/bot/orchestrator.ts +63 -126
- package/src/bot/runner.ts +124 -70
- package/src/bot/step-executor.ts +30 -9
- package/src/bot/swarm-controller.ts +65 -76
- package/src/bot/system-prompt.ts +2 -0
- package/src/bot/task-types.ts +1 -0
- package/src/bot/weaver-tools.ts +14 -1
- package/src/node-types/agent-execute.ts +2 -2
- package/src/node-types/bot-report.ts +5 -2
- package/src/node-types/build-context.ts +13 -1
- package/src/node-types/exec-validate-retry.ts +14 -203
- package/src/node-types/load-config.ts +1 -0
- package/src/node-types/plan-task.ts +313 -88
- package/src/ui/bot-panel.tsx +1 -1
- package/src/ui/chat-task-result.tsx +10 -8
- package/src/ui/swarm-dashboard.tsx +4 -4
- package/src/ui/task-detail-view.tsx +35 -12
- package/src/ui/task-editor.tsx +2 -2
- package/src/ui/task-pool-list.tsx +2 -2
- package/src/workflows/weaver-bot.ts +8 -7
|
@@ -1,56 +1,125 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { callPlatformWithMessages, callCapabilityTriage } from '../bot/ai-client.js';
|
|
2
2
|
import { auditEmit } from '../bot/audit-logger.js';
|
|
3
|
-
import {
|
|
3
|
+
import { executeStep } from '../bot/step-executor.js';
|
|
4
4
|
import { getCapabilitiesByNames, BUILT_IN_CAPABILITIES } from '../bot/capability-registry.js';
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
|
-
//
|
|
7
|
-
// structured JSON arguments instead of prose. Works across Anthropic and OpenAI.
|
|
6
|
+
// Tool definitions — built dynamically from capability-granted operations
|
|
8
7
|
// ---------------------------------------------------------------------------
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
/** All known tool schemas, keyed by operation name. */
|
|
9
|
+
const TOOL_SCHEMAS = {
|
|
10
|
+
read_file: {
|
|
11
|
+
name: 'read_file',
|
|
12
|
+
description: 'Read a file and return its content',
|
|
13
|
+
parameters: { type: 'object', properties: { file: { type: 'string' } }, required: ['file'] },
|
|
14
|
+
},
|
|
15
|
+
write_file: {
|
|
16
|
+
name: 'write_file',
|
|
17
|
+
description: 'Write a file (full content)',
|
|
18
|
+
parameters: { type: 'object', properties: { file: { type: 'string' }, content: { type: 'string' } }, required: ['file', 'content'] },
|
|
19
|
+
},
|
|
20
|
+
patch_file: {
|
|
21
|
+
name: 'patch_file',
|
|
22
|
+
description: 'Find and replace in a file',
|
|
15
23
|
parameters: {
|
|
16
24
|
type: 'object',
|
|
17
25
|
properties: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type: 'array',
|
|
21
|
-
description: 'Ordered list of operations to execute',
|
|
22
|
-
items: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
operation: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
description: `Tool to invoke: ${ops.join(', ')}`,
|
|
28
|
-
},
|
|
29
|
-
description: { type: 'string', description: 'What this step does' },
|
|
30
|
-
args: {
|
|
31
|
-
type: 'object',
|
|
32
|
-
description: 'Arguments for the operation (e.g. {file, content} for write_file, {file, find, replace} for patch_file)',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
required: ['operation', 'description', 'args'],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
26
|
+
file: { type: 'string' },
|
|
27
|
+
patches: { type: 'array', items: { type: 'object', properties: { find: { type: 'string' }, replace: { type: 'string' } } } },
|
|
38
28
|
},
|
|
39
|
-
required: ['
|
|
29
|
+
required: ['file', 'patches'],
|
|
40
30
|
},
|
|
41
|
-
}
|
|
31
|
+
},
|
|
32
|
+
run_shell: {
|
|
33
|
+
name: 'run_shell',
|
|
34
|
+
description: 'Run a shell command',
|
|
35
|
+
parameters: { type: 'object', properties: { command: { type: 'string' } }, required: ['command'] },
|
|
36
|
+
},
|
|
37
|
+
list_files: {
|
|
38
|
+
name: 'list_files',
|
|
39
|
+
description: 'List files in a directory',
|
|
40
|
+
parameters: { type: 'object', properties: { directory: { type: 'string' }, pattern: { type: 'string' } } },
|
|
41
|
+
},
|
|
42
|
+
task_create: {
|
|
43
|
+
name: 'task_create',
|
|
44
|
+
description: 'Create a swarm subtask',
|
|
45
|
+
parameters: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
title: { type: 'string' },
|
|
49
|
+
description: { type: 'string' },
|
|
50
|
+
assignedProfile: { type: 'string' },
|
|
51
|
+
parentId: { type: 'string' },
|
|
52
|
+
dependsOn: { type: 'array', items: { type: 'string' } },
|
|
53
|
+
complexity: { type: 'string' },
|
|
54
|
+
},
|
|
55
|
+
required: ['title'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
done: {
|
|
59
|
+
name: 'done',
|
|
60
|
+
description: 'Signal task completion. Call this when you have finished the task.',
|
|
61
|
+
parameters: { type: 'object', properties: { summary: { type: 'string' } }, required: ['summary'] },
|
|
62
|
+
},
|
|
63
|
+
remember: {
|
|
64
|
+
name: 'remember',
|
|
65
|
+
description: 'Save a project convention for future sessions',
|
|
66
|
+
parameters: { type: 'object', properties: { key: { type: 'string' }, value: { type: 'string' } }, required: ['key', 'value'] },
|
|
67
|
+
},
|
|
68
|
+
recall: {
|
|
69
|
+
name: 'recall',
|
|
70
|
+
description: 'Recall saved project conventions',
|
|
71
|
+
parameters: { type: 'object', properties: {} },
|
|
72
|
+
},
|
|
73
|
+
validate: {
|
|
74
|
+
name: 'validate',
|
|
75
|
+
description: 'Validate a Flow Weaver workflow file',
|
|
76
|
+
parameters: { type: 'object', properties: { file: { type: 'string' } }, required: ['file'] },
|
|
77
|
+
},
|
|
78
|
+
respond: {
|
|
79
|
+
name: 'respond',
|
|
80
|
+
description: 'Send a text response to the user',
|
|
81
|
+
parameters: { type: 'object', properties: { response: { type: 'string' } }, required: ['response'] },
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
/** Build tool definitions from capability-granted operation names. */
|
|
85
|
+
function buildToolDefinitions(grantedTools) {
|
|
86
|
+
const tools = [];
|
|
87
|
+
const seen = new Set();
|
|
88
|
+
for (const name of grantedTools) {
|
|
89
|
+
if (seen.has(name))
|
|
90
|
+
continue;
|
|
91
|
+
seen.add(name);
|
|
92
|
+
const schema = TOOL_SCHEMAS[name];
|
|
93
|
+
if (schema)
|
|
94
|
+
tools.push(schema);
|
|
95
|
+
}
|
|
96
|
+
// Always include 'done' so the AI can signal completion
|
|
97
|
+
if (!seen.has('done')) {
|
|
98
|
+
tools.push(TOOL_SCHEMAS.done);
|
|
99
|
+
}
|
|
100
|
+
return tools;
|
|
42
101
|
}
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
// Safety limits
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
const MAX_TOOL_CALLS = 30;
|
|
106
|
+
const AGENT_TIMEOUT_MS = 180_000; // 3 minutes
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// Agent Loop — replaces Plan Task + Execute & Validate
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
43
110
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
111
|
+
* Agent loop: sends task + tools to the AI, executes tool calls iteratively
|
|
112
|
+
* until the AI signals completion or a safety limit is reached.
|
|
113
|
+
*
|
|
114
|
+
* Replaces the old Plan Task → Execute & Validate two-phase workflow.
|
|
46
115
|
*
|
|
47
116
|
* @flowWeaver nodeType
|
|
48
|
-
* @label
|
|
49
|
-
* @icon
|
|
117
|
+
* @label Agent Loop
|
|
118
|
+
* @icon psychology
|
|
50
119
|
* @color blue
|
|
51
120
|
* @input ctx [order:0] - Weaver context (JSON)
|
|
52
121
|
* @input [modelOverride] [order:1] - Model ID override from profile behavior
|
|
53
|
-
* @output ctx [order:0] - Weaver context with
|
|
122
|
+
* @output ctx [order:0] - Weaver context with results (JSON)
|
|
54
123
|
* @output onSuccess [order:-2] - On Success
|
|
55
124
|
* @output onFailure [order:-1] [hidden] - On Failure
|
|
56
125
|
*/
|
|
@@ -59,13 +128,22 @@ export async function weaverPlanTask(execute, ctx, modelOverride) {
|
|
|
59
128
|
const { env } = context;
|
|
60
129
|
if (!execute) {
|
|
61
130
|
context.planJson = '{"steps":[],"summary":"dry run"}';
|
|
131
|
+
context.resultJson = JSON.stringify({ success: true, toolCallCount: 0 });
|
|
132
|
+
context.filesModified = '[]';
|
|
133
|
+
context.stepLogJson = '[]';
|
|
134
|
+
context.allValid = true;
|
|
62
135
|
return { onSuccess: true, onFailure: false, ctx: JSON.stringify(context) };
|
|
63
136
|
}
|
|
64
137
|
const pInfo = modelOverride
|
|
65
138
|
? { ...env.providerInfo, model: modelOverride }
|
|
66
139
|
: env.providerInfo;
|
|
140
|
+
const { projectDir } = env;
|
|
67
141
|
if (!context.taskJson) {
|
|
68
|
-
context.planJson = JSON.stringify({ steps: [], summary: '
|
|
142
|
+
context.planJson = JSON.stringify({ steps: [], summary: 'Agent loop failed: missing taskJson' });
|
|
143
|
+
context.resultJson = JSON.stringify({ success: false, error: 'missing taskJson' });
|
|
144
|
+
context.filesModified = '[]';
|
|
145
|
+
context.stepLogJson = '[]';
|
|
146
|
+
context.allValid = false;
|
|
69
147
|
return { onSuccess: false, onFailure: true, ctx: JSON.stringify(context) };
|
|
70
148
|
}
|
|
71
149
|
const task = JSON.parse(context.taskJson);
|
|
@@ -74,18 +152,16 @@ export async function weaverPlanTask(execute, ctx, modelOverride) {
|
|
|
74
152
|
const availableCapNames = behavior?.capabilities ?? BUILT_IN_CAPABILITIES.map(c => c.name);
|
|
75
153
|
const availableCaps = getCapabilitiesByNames(availableCapNames);
|
|
76
154
|
// Capability triage: cheap Haiku call selects which capabilities this task needs
|
|
77
|
-
let selectedCaps = availableCaps;
|
|
155
|
+
let selectedCaps = availableCaps;
|
|
78
156
|
const triageResult = await callCapabilityTriage(pInfo, task.instruction, availableCaps);
|
|
79
157
|
if (triageResult) {
|
|
80
158
|
selectedCaps = getCapabilitiesByNames(triageResult);
|
|
81
159
|
}
|
|
82
|
-
//
|
|
160
|
+
// Build system prompt from capabilities
|
|
83
161
|
let systemPrompt;
|
|
84
162
|
try {
|
|
85
163
|
const mod = await import('../bot/system-prompt.js');
|
|
86
164
|
const basePrompt = mod.buildPromptFromCapabilities(selectedCaps);
|
|
87
|
-
// Only include the context bundle if the 'context' capability was selected.
|
|
88
|
-
// This prevents sending 10k+ tokens of FW authoring docs for simple file creation tasks.
|
|
89
165
|
const selectedCapNames = new Set(selectedCaps.map(c => c.name));
|
|
90
166
|
const contextBundle = selectedCapNames.has('context') ? context.contextBundle : undefined;
|
|
91
167
|
const botPrompt = mod.buildBotSystemPrompt(contextBundle, undefined, context.env?.projectDir);
|
|
@@ -93,59 +169,182 @@ export async function weaverPlanTask(execute, ctx, modelOverride) {
|
|
|
93
169
|
}
|
|
94
170
|
catch (err) {
|
|
95
171
|
if (process.env.WEAVER_VERBOSE)
|
|
96
|
-
console.error('[
|
|
97
|
-
systemPrompt = 'You are Weaver, an AI workflow bot.
|
|
172
|
+
console.error('[agent-loop] system prompt build failed:', err);
|
|
173
|
+
systemPrompt = 'You are Weaver, an AI workflow bot. Use the provided tools to complete tasks.';
|
|
98
174
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Plan this task by calling the create_plan tool with concrete steps.
|
|
102
|
-
Rules:
|
|
103
|
-
1. Every step MUST have complete, concrete args — no empty patches, no placeholders.
|
|
104
|
-
2. For file creation tasks, use write_file with full file content in args.
|
|
105
|
-
3. If you need to discover file contents first, plan ONLY discovery steps (read_file, list_files).
|
|
106
|
-
4. Do NOT plan patch_file unless you know the exact find/replace strings.`;
|
|
175
|
+
// Build tool definitions from capability-granted operations
|
|
176
|
+
let tools;
|
|
107
177
|
try {
|
|
108
|
-
// Build plan tool with operations scoped to selected capabilities
|
|
109
178
|
const mod2 = await import('../bot/system-prompt.js');
|
|
110
179
|
const grantedTools = mod2.collectToolsFromCapabilities(selectedCaps);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
180
|
+
tools = buildToolDefinitions(grantedTools);
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
tools = buildToolDefinitions(['read_file', 'write_file', 'patch_file', 'run_shell', 'list_files', 'task_create']);
|
|
184
|
+
}
|
|
185
|
+
// Build initial user prompt
|
|
186
|
+
let userPrompt = `Task: ${task.instruction}\nMode: ${task.mode ?? 'create'}\n${task.id ? `Your Task ID is ${task.id}. Use parentId: "@self" in task_create to create subtasks under this task.` : ''}\n${task.targets ? 'Targets: ' + task.targets.join(', ') : ''}
|
|
187
|
+
|
|
188
|
+
Execute this task step by step using the available tools.
|
|
189
|
+
When you are done, call the "done" tool with a summary of what you accomplished.
|
|
190
|
+
Rules:
|
|
191
|
+
1. Read files before modifying them (use read_file to get exact content for patches).
|
|
192
|
+
2. Use patch_file for modifications, write_file only for new files.
|
|
193
|
+
3. Verify your work by running tests or tsc when appropriate.`;
|
|
194
|
+
// Append retry context when this is a retry attempt (attempt > 0)
|
|
195
|
+
const attempt = task.attempt ?? 0;
|
|
196
|
+
if (attempt > 0) {
|
|
197
|
+
const retryParts = ['\n\n--- RETRY CONTEXT (attempt ' + (attempt + 1) + ') ---'];
|
|
198
|
+
if (task.lastError) {
|
|
199
|
+
retryParts.push('Previous attempt failed with error: ' + task.lastError);
|
|
200
|
+
}
|
|
201
|
+
const summaries = task.runSummaries ?? [];
|
|
202
|
+
const lastSummary = summaries.length > 0 ? summaries[summaries.length - 1] : undefined;
|
|
203
|
+
if (lastSummary) {
|
|
204
|
+
if (lastSummary.outcome)
|
|
205
|
+
retryParts.push('Last outcome: ' + lastSummary.outcome);
|
|
206
|
+
if (lastSummary.summary)
|
|
207
|
+
retryParts.push('Last summary: ' + lastSummary.summary);
|
|
208
|
+
if (lastSummary.filesModified && lastSummary.filesModified.length > 0) {
|
|
209
|
+
retryParts.push('Files already created/modified: ' + lastSummary.filesModified.join(', '));
|
|
210
|
+
}
|
|
122
211
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
212
|
+
retryParts.push('Do NOT recreate files that already exist. Read them first and continue from where the previous attempt left off.');
|
|
213
|
+
retryParts.push('---');
|
|
214
|
+
userPrompt += retryParts.join('\n');
|
|
215
|
+
}
|
|
216
|
+
// Seed symbolic ID map for task references
|
|
217
|
+
const symbolicIdMap = {};
|
|
218
|
+
if (task.id)
|
|
219
|
+
symbolicIdMap['@self'] = task.id;
|
|
220
|
+
if (task.parentId)
|
|
221
|
+
symbolicIdMap['@parent'] = task.parentId;
|
|
222
|
+
// State tracking
|
|
223
|
+
const filesModified = [];
|
|
224
|
+
const stepLog = [];
|
|
225
|
+
let toolCallCount = 0;
|
|
226
|
+
const deadline = Date.now() + AGENT_TIMEOUT_MS;
|
|
227
|
+
// Messages array for multi-turn conversation
|
|
228
|
+
const messages = [
|
|
229
|
+
{ role: 'system', content: systemPrompt },
|
|
230
|
+
{ role: 'user', content: userPrompt },
|
|
231
|
+
];
|
|
232
|
+
auditEmit('run-start', { task: task.instruction, mode: 'agent-loop' });
|
|
233
|
+
try {
|
|
234
|
+
// Agent loop
|
|
235
|
+
let done = false;
|
|
236
|
+
while (!done && toolCallCount < MAX_TOOL_CALLS && Date.now() < deadline) {
|
|
237
|
+
const result = await callPlatformWithMessages(messages, tools, pInfo.model, pInfo.maxTokens ?? 8192);
|
|
238
|
+
// If AI returns text with no tool calls, we're done
|
|
239
|
+
if (!result.toolCalls || result.toolCalls.length === 0) {
|
|
240
|
+
if (result.content) {
|
|
241
|
+
console.log(`\x1b[36m→ Agent: ${result.content.slice(0, 200)}\x1b[0m`);
|
|
242
|
+
}
|
|
243
|
+
done = true;
|
|
244
|
+
break;
|
|
129
245
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
246
|
+
// Process each tool call
|
|
247
|
+
for (const tc of result.toolCalls) {
|
|
248
|
+
if (toolCallCount >= MAX_TOOL_CALLS || Date.now() >= deadline) {
|
|
249
|
+
done = true;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
toolCallCount++;
|
|
253
|
+
const toolName = tc.name;
|
|
254
|
+
const toolArgs = tc.arguments;
|
|
255
|
+
// Check for done signal
|
|
256
|
+
if (toolName === 'done' || toolName === 'complete') {
|
|
257
|
+
console.log(`\x1b[36m→ Agent done: ${toolArgs.summary ?? 'completed'}\x1b[0m`);
|
|
258
|
+
// Execute through step-executor for consistent handling
|
|
259
|
+
try {
|
|
260
|
+
const stepResult = await executeStep({ operation: toolName, args: toolArgs }, projectDir, symbolicIdMap);
|
|
261
|
+
stepLog.push({ step: `${toolCallCount}:${toolName}`, status: 'ok', detail: stepResult.output ?? 'done' });
|
|
262
|
+
}
|
|
263
|
+
catch {
|
|
264
|
+
stepLog.push({ step: `${toolCallCount}:${toolName}`, status: 'ok', detail: 'done' });
|
|
265
|
+
}
|
|
266
|
+
// Add assistant message with tool use and tool result to messages
|
|
267
|
+
messages.push({
|
|
268
|
+
role: 'assistant',
|
|
269
|
+
content: result.content || undefined,
|
|
270
|
+
tool_use: { id: tc.id, name: toolName, input: toolArgs },
|
|
271
|
+
});
|
|
272
|
+
messages.push({
|
|
273
|
+
role: 'user',
|
|
274
|
+
tool_use_id: tc.id,
|
|
275
|
+
content: 'Task completed.',
|
|
276
|
+
});
|
|
277
|
+
done = true;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
// Execute the tool via step-executor
|
|
281
|
+
let toolOutput;
|
|
282
|
+
try {
|
|
283
|
+
const stepResult = await executeStep({ operation: toolName, args: toolArgs }, projectDir, symbolicIdMap);
|
|
284
|
+
// Track files modified — only from write/patch operations, not reads/listings
|
|
285
|
+
const isWriteOp = toolName === 'write_file' || toolName === 'patch_file' || toolName === 'create_workflow' || toolName === 'modify_source' || toolName === 'implement_node';
|
|
286
|
+
if (isWriteOp && stepResult.file)
|
|
287
|
+
filesModified.push(stepResult.file);
|
|
288
|
+
// Build output for AI
|
|
289
|
+
if (stepResult.blocked) {
|
|
290
|
+
toolOutput = `BLOCKED: ${stepResult.blockReason}`;
|
|
291
|
+
stepLog.push({ step: `${toolCallCount}:${toolName}`, status: 'blocked', detail: stepResult.blockReason });
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
toolOutput = stepResult.output ?? 'OK';
|
|
295
|
+
stepLog.push({ step: `${toolCallCount}:${toolName}`, status: 'ok', detail: toolName });
|
|
296
|
+
}
|
|
297
|
+
console.log(`\x1b[32m + ${toolCallCount}: ${toolName}\x1b[0m`);
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
301
|
+
toolOutput = `ERROR: ${msg}`;
|
|
302
|
+
stepLog.push({ step: `${toolCallCount}:${toolName}`, status: 'error', detail: msg });
|
|
303
|
+
console.error(`\x1b[31m x ${toolCallCount}: ${toolName}: ${msg}\x1b[0m`);
|
|
304
|
+
}
|
|
305
|
+
// Append assistant tool_use + tool result to messages for next iteration
|
|
306
|
+
messages.push({
|
|
307
|
+
role: 'assistant',
|
|
308
|
+
content: result.content || undefined,
|
|
309
|
+
tool_use: { id: tc.id, name: toolName, input: toolArgs },
|
|
310
|
+
});
|
|
311
|
+
messages.push({
|
|
312
|
+
role: 'user',
|
|
313
|
+
tool_use_id: tc.id,
|
|
314
|
+
content: toolOutput,
|
|
315
|
+
});
|
|
138
316
|
}
|
|
139
317
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
context
|
|
318
|
+
// Deduplicate files
|
|
319
|
+
const uniqueFiles = [...new Set(filesModified)];
|
|
320
|
+
// Store results in context (compatible with exec-validate-retry output format)
|
|
321
|
+
context.resultJson = JSON.stringify({
|
|
322
|
+
success: true,
|
|
323
|
+
toolCallCount,
|
|
324
|
+
filesModified: uniqueFiles,
|
|
325
|
+
stepsCompleted: toolCallCount,
|
|
326
|
+
stepsTotal: toolCallCount,
|
|
327
|
+
});
|
|
328
|
+
context.planJson = JSON.stringify({ steps: [], summary: `Agent loop: ${toolCallCount} tool calls` });
|
|
329
|
+
context.filesModified = JSON.stringify(uniqueFiles);
|
|
330
|
+
context.stepLogJson = JSON.stringify(stepLog);
|
|
331
|
+
context.allValid = true;
|
|
332
|
+
auditEmit('run-complete', {
|
|
333
|
+
success: true,
|
|
334
|
+
toolCalls: toolCallCount,
|
|
335
|
+
filesModified: uniqueFiles.length,
|
|
336
|
+
});
|
|
337
|
+
console.log(`\x1b[36m→ Agent loop: ${toolCallCount} tool calls, ${uniqueFiles.length} files modified\x1b[0m`);
|
|
143
338
|
return { onSuccess: true, onFailure: false, ctx: JSON.stringify(context) };
|
|
144
339
|
}
|
|
145
340
|
catch (err) {
|
|
146
341
|
const msg = err instanceof Error ? err.message : String(err);
|
|
147
|
-
console.error(`\x1b[31m→
|
|
148
|
-
context.
|
|
342
|
+
console.error(`\x1b[31m→ Agent loop failed: ${msg}\x1b[0m`);
|
|
343
|
+
context.resultJson = JSON.stringify({ success: false, error: msg });
|
|
344
|
+
context.planJson = JSON.stringify({ steps: [], summary: `Agent loop failed: ${msg}` });
|
|
345
|
+
context.filesModified = JSON.stringify([...new Set(filesModified)]);
|
|
346
|
+
context.stepLogJson = JSON.stringify(stepLog);
|
|
347
|
+
context.allValid = false;
|
|
149
348
|
return { onSuccess: false, onFailure: true, ctx: JSON.stringify(context) };
|
|
150
349
|
}
|
|
151
350
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-task.js","sourceRoot":"","sources":["../../src/node-types/plan-task.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE9G,OAAO,E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,CAAC"}
|
package/dist/ui/bot-panel.js
CHANGED
|
@@ -280,7 +280,7 @@ function BotPanel() {
|
|
|
280
280
|
React.createElement(Typography, {
|
|
281
281
|
variant: "caption-thick",
|
|
282
282
|
color: "color-text-high"
|
|
283
|
-
}, `${inst.
|
|
283
|
+
}, inst.profileId ? `${inst.instanceId} (${inst.profileId})` : inst.instanceId),
|
|
284
284
|
React.createElement(StatusIcon, {
|
|
285
285
|
status: statusToIconStatus(inst.status),
|
|
286
286
|
size: "sm"
|
|
@@ -76,35 +76,28 @@ var CAP_ROLE_ORCHESTRATOR = {
|
|
|
76
76
|
You DECOMPOSE and ASSIGN. You never write code or create files directly.
|
|
77
77
|
|
|
78
78
|
Your job:
|
|
79
|
-
1. Analyze the objective
|
|
80
|
-
2.
|
|
81
|
-
3.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
### Project Brief Format
|
|
94
|
-
Include this at the TOP of every subtask description:
|
|
95
|
-
"PROJECT: [what we're building]. STRUCTURE: [file layout]. CONVENTIONS: [naming, patterns, exports]."
|
|
79
|
+
1. Analyze the objective
|
|
80
|
+
2. Break it into focused subtasks via task_create. Set parentId to "@self" on every subtask.
|
|
81
|
+
3. ALWAYS set assignedProfile: "developer", "reviewer", or "ops".
|
|
82
|
+
NEVER set assignedProfile to "orchestrator" \u2014 assigning to yourself creates an infinite loop.
|
|
83
|
+
4. Use the EXACT title of a previous subtask as dependsOn. The system resolves titles to real task IDs.
|
|
84
|
+
5. Include a project brief in every subtask: "PROJECT: [what]. FILES: [exact paths from workspace root]. CONVENTIONS: [patterns]."
|
|
85
|
+
|
|
86
|
+
CRITICAL: You do NOT have write_file, patch_file, or run_shell. Only plan and delegate.
|
|
87
|
+
|
|
88
|
+
### Design Phase (MANDATORY)
|
|
89
|
+
Your FIRST subtask MUST be a design task assigned to ops that creates a .design.md file in the project root. This is the single source of truth. It must contain:
|
|
90
|
+
- Module map, TypeScript interfaces (copy-paste ready), export contracts (function signatures)
|
|
91
|
+
- Dependency graph, conventions (naming, error handling, patterns)
|
|
92
|
+
Every subsequent developer task MUST read .design.md before writing code.
|
|
96
93
|
|
|
97
94
|
### Subtask Quality
|
|
98
|
-
Each subtask
|
|
99
|
-
- Focused (one file or one concern)
|
|
100
|
-
- Self-contained (has enough context to execute independently)
|
|
101
|
-
- Properly routed (assignedProfile is set)
|
|
102
|
-
- Ordered (dependsOn reflects real dependencies)
|
|
95
|
+
Each subtask: focused (one concern), self-contained, properly routed, ordered by dependsOn.
|
|
103
96
|
|
|
104
97
|
### Example
|
|
105
|
-
|
|
106
|
-
{ operation: "task_create", args: { title: "Setup project", parentId: "
|
|
107
|
-
{ operation: "task_create", args: { title: "Write code", parentId: "
|
|
98
|
+
{ operation: "task_create", args: { title: "Design: Create project contract", parentId: "@self", assignedProfile: "ops", complexity: "complex", description: "Create todo-app/.design.md with module map, TypeScript interfaces, export contracts.", dependsOn: [] } }
|
|
99
|
+
{ operation: "task_create", args: { title: "Setup project", parentId: "@self", assignedProfile: "ops", dependsOn: ["Design: Create project contract"] } }
|
|
100
|
+
{ operation: "task_create", args: { title: "Write code", parentId: "@self", assignedProfile: "developer", dependsOn: ["Setup project"] } }`
|
|
108
101
|
};
|
|
109
102
|
var CAP_ROLE_DEVELOPER = {
|
|
110
103
|
name: "role-developer",
|
|
@@ -113,17 +106,28 @@ var CAP_ROLE_DEVELOPER = {
|
|
|
113
106
|
You WRITE CODE. Execute the task directly using write_file, patch_file, and run_shell.
|
|
114
107
|
|
|
115
108
|
Your job:
|
|
116
|
-
1. Read the
|
|
117
|
-
2.
|
|
118
|
-
3.
|
|
119
|
-
4. Verify your
|
|
109
|
+
1. Read .design.md in the project root to understand interfaces and contracts
|
|
110
|
+
2. Read files created by previous tasks (your dependencies are done \u2014 their files are on disk)
|
|
111
|
+
3. Write code that MATCHES the contracts in .design.md exactly \u2014 same types, same function signatures, same exports
|
|
112
|
+
4. Verify your imports resolve to real exports in existing files
|
|
120
113
|
|
|
121
114
|
You do NOT have task_create. You cannot create subtasks or delegate.
|
|
122
115
|
If the task seems too large, do your best \u2014 the orchestrator already decomposed it for you.
|
|
123
116
|
|
|
117
|
+
### File Paths
|
|
118
|
+
All paths in write_file/patch_file are RELATIVE TO THE WORKSPACE ROOT. If the task says "inside todo-app/", your paths MUST start with todo-app/ (e.g., todo-app/src/cli.ts, NOT src/cli.ts).
|
|
119
|
+
|
|
120
|
+
### Code Quality
|
|
121
|
+
- Write COMPLETE, WORKING code. No TODOs, no placeholders, no empty function bodies, no "// implement later".
|
|
122
|
+
- Every function must be fully implemented with real logic.
|
|
123
|
+
- Use proper TypeScript types. Use strict mode patterns.
|
|
124
|
+
- Export everything that other files will import.
|
|
125
|
+
- Handle edge cases (empty input, file not found, invalid args).
|
|
126
|
+
- Use ESM-compatible patterns: import.meta.url instead of __dirname, import.meta.filename instead of __filename. Use fileURLToPath(import.meta.url) for path resolution.
|
|
127
|
+
|
|
124
128
|
### Output Requirements
|
|
125
129
|
Your plan MUST include at least one write_file, patch_file, or run_shell step.
|
|
126
|
-
A plan with only
|
|
130
|
+
A plan with only read_file, list_files, or respond steps is a FAILURE \u2014 you must produce artifacts.`
|
|
127
131
|
};
|
|
128
132
|
var CAP_ROLE_REVIEWER = {
|
|
129
133
|
name: "role-reviewer",
|
|
@@ -147,10 +151,19 @@ var CAP_ROLE_OPS = {
|
|
|
147
151
|
You SET UP infrastructure \u2014 package.json, tsconfig.json, directory structure, dependencies.
|
|
148
152
|
|
|
149
153
|
Your job:
|
|
150
|
-
1.
|
|
151
|
-
2.
|
|
152
|
-
3.
|
|
154
|
+
1. Create the project directory first: run_shell with mkdir -p <project>/src
|
|
155
|
+
2. Write config files (package.json, tsconfig.json) using write_file
|
|
156
|
+
3. Install dependencies with run_shell (npm install)
|
|
157
|
+
4. Ensure the project structure is ready for developers
|
|
153
158
|
|
|
159
|
+
### File Paths
|
|
160
|
+
All paths are RELATIVE TO THE WORKSPACE ROOT. If the project is in a subfolder (e.g., todo-app/), ALL your paths must include that prefix: todo-app/package.json, todo-app/tsconfig.json, todo-app/src/.
|
|
161
|
+
|
|
162
|
+
### Design Tasks
|
|
163
|
+
When the task is a Design task, create a .design.md file with detailed TypeScript interfaces, module exports, and dependency graph. This file must contain copy-paste ready interface definitions that developers will implement exactly.
|
|
164
|
+
|
|
165
|
+
### Output Requirements
|
|
166
|
+
Your plan MUST include write_file and/or run_shell steps that create real files.
|
|
154
167
|
You do NOT have task_create. You execute infrastructure tasks directly.`
|
|
155
168
|
};
|
|
156
169
|
var CAP_FILE_OPS = {
|