@synergenius/flow-weaver-pack-weaver 0.9.140 → 0.9.142
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/bot/assistant-tools.d.ts.map +1 -1
- package/dist/bot/assistant-tools.js +5 -11
- package/dist/bot/assistant-tools.js.map +1 -1
- package/dist/bot/capability-registry.d.ts.map +1 -1
- package/dist/bot/capability-registry.js +185 -15
- package/dist/bot/capability-registry.js.map +1 -1
- package/dist/bot/dashboard.js +3 -3
- package/dist/bot/dashboard.js.map +1 -1
- package/dist/bot/hierarchy-event-log.d.ts +37 -0
- package/dist/bot/hierarchy-event-log.d.ts.map +1 -0
- package/dist/bot/hierarchy-event-log.js +58 -0
- package/dist/bot/hierarchy-event-log.js.map +1 -0
- package/dist/bot/operations.d.ts +2 -0
- package/dist/bot/operations.d.ts.map +1 -1
- package/dist/bot/operations.js +5 -0
- package/dist/bot/operations.js.map +1 -1
- package/dist/bot/profile-store.d.ts.map +1 -1
- package/dist/bot/profile-store.js +39 -0
- package/dist/bot/profile-store.js.map +1 -1
- package/dist/bot/runner.d.ts.map +1 -1
- package/dist/bot/runner.js +7 -17
- package/dist/bot/runner.js.map +1 -1
- package/dist/bot/step-executor.d.ts.map +1 -1
- package/dist/bot/step-executor.js +33 -1
- package/dist/bot/step-executor.js.map +1 -1
- package/dist/bot/swarm-controller.d.ts +1 -0
- package/dist/bot/swarm-controller.d.ts.map +1 -1
- package/dist/bot/swarm-controller.js +59 -5
- package/dist/bot/swarm-controller.js.map +1 -1
- package/dist/bot/task-store.d.ts +1 -1
- package/dist/bot/task-store.d.ts.map +1 -1
- package/dist/bot/task-store.js +21 -36
- package/dist/bot/task-store.js.map +1 -1
- package/dist/bot/task-types.d.ts +5 -1
- package/dist/bot/task-types.d.ts.map +1 -1
- package/dist/node-types/bot-report.js +2 -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 +32 -0
- package/dist/node-types/build-context.js.map +1 -1
- package/dist/node-types/report.d.ts +1 -1
- package/dist/node-types/report.d.ts.map +1 -1
- package/dist/node-types/report.js +58 -8
- package/dist/node-types/report.js.map +1 -1
- package/dist/ui/capability-editor.js +184 -15
- package/dist/ui/profile-editor.js +184 -15
- package/dist/ui/swarm-dashboard.js +244 -44
- package/dist/ui/task-detail-view.js +60 -29
- package/dist/ui/use-stream-timeline.d.ts.map +1 -1
- package/dist/ui/use-stream-timeline.js +69 -29
- package/dist/ui/use-stream-timeline.js.map +1 -1
- package/flowweaver.manifest.json +1 -1
- package/package.json +1 -1
- package/src/bot/assistant-tools.ts +5 -11
- package/src/bot/capability-registry.ts +196 -18
- package/src/bot/dashboard.ts +3 -3
- package/src/bot/hierarchy-event-log.ts +64 -0
- package/src/bot/operations.ts +7 -0
- package/src/bot/profile-store.ts +39 -0
- package/src/bot/runner.ts +8 -19
- package/src/bot/step-executor.ts +29 -1
- package/src/bot/swarm-controller.ts +62 -5
- package/src/bot/task-store.ts +22 -38
- package/src/bot/task-types.ts +7 -1
- package/src/node-types/bot-report.ts +2 -2
- package/src/node-types/build-context.ts +32 -0
- package/src/node-types/report.ts +56 -8
- package/src/ui/use-stream-timeline.ts +73 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-context.js","sourceRoot":"","sources":["../../src/node-types/build-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"build-context.js","sourceRoot":"","sources":["../../src/node-types/build-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAEl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AAC,cAAc;gBAAE,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,GAAG,CAAC,CAAC;QAAC,CAAC;IAChH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @icon summarize
|
|
8
8
|
* @color cyan
|
|
9
9
|
* @input ctx [order:0] - Weaver context (JSON)
|
|
10
|
-
* @output summary [order:0] - Summary
|
|
10
|
+
* @output summary [order:0, format:md] - Summary
|
|
11
11
|
* @output onFailure [hidden]
|
|
12
12
|
*/
|
|
13
13
|
export declare function weaverReport(ctx: string): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/node-types/report.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/node-types/report.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CA2D7D"}
|
|
@@ -8,20 +8,70 @@ import * as path from 'node:path';
|
|
|
8
8
|
* @icon summarize
|
|
9
9
|
* @color cyan
|
|
10
10
|
* @input ctx [order:0] - Weaver context (JSON)
|
|
11
|
-
* @output summary [order:0] - Summary
|
|
11
|
+
* @output summary [order:0, format:md] - Summary
|
|
12
12
|
* @output onFailure [hidden]
|
|
13
13
|
*/
|
|
14
14
|
export function weaverReport(ctx) {
|
|
15
15
|
const context = JSON.parse(ctx);
|
|
16
16
|
const result = JSON.parse(context.resultJson);
|
|
17
17
|
const relPath = path.relative(context.env.projectDir, context.targetPath);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
console.log(`\x1b[32m✓ Weaver: ${result.outcome} (${relPath})\x1b[0m`);
|
|
19
|
+
const md = [];
|
|
20
|
+
md.push(`## ${result.outcome === 'success' ? 'Task Completed' : 'Task Failed'}`);
|
|
21
|
+
md.push('');
|
|
22
|
+
if (result.summary)
|
|
23
|
+
md.push(result.summary);
|
|
24
|
+
md.push('');
|
|
25
|
+
// Steps
|
|
26
|
+
try {
|
|
27
|
+
const steps = JSON.parse(context.stepLogJson ?? '[]');
|
|
28
|
+
if (steps.length > 0) {
|
|
29
|
+
md.push('### Steps');
|
|
30
|
+
md.push('');
|
|
31
|
+
for (const s of steps) {
|
|
32
|
+
const icon = s.status === 'ok' ? '**ok**' : s.status === 'error' ? '**error**' : '**blocked**';
|
|
33
|
+
md.push(`- ${s.step} (${icon})${s.detail ? `: ${s.detail}` : ''}`);
|
|
34
|
+
}
|
|
35
|
+
md.push('');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch { /* skip */ }
|
|
39
|
+
// Files
|
|
40
|
+
try {
|
|
41
|
+
const files = JSON.parse(context.filesModified ?? '[]');
|
|
42
|
+
if (files.length > 0) {
|
|
43
|
+
md.push('### Files Modified');
|
|
44
|
+
md.push('');
|
|
45
|
+
for (const f of files)
|
|
46
|
+
md.push(`- \`${f}\``);
|
|
47
|
+
md.push('');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch { /* skip */ }
|
|
51
|
+
// Review
|
|
52
|
+
try {
|
|
53
|
+
const review = JSON.parse(context.reviewJson ?? '{}');
|
|
54
|
+
if (review.intent || review.execution || review.result || review.completeness) {
|
|
55
|
+
md.push('### Review');
|
|
56
|
+
md.push('');
|
|
57
|
+
for (const key of ['intent', 'execution', 'result', 'completeness']) {
|
|
58
|
+
if (review[key])
|
|
59
|
+
md.push(`- **${key}:** ${review[key]}`);
|
|
60
|
+
}
|
|
61
|
+
if (review.reason)
|
|
62
|
+
md.push(`\n${review.reason}`);
|
|
63
|
+
md.push('');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch { /* skip */ }
|
|
67
|
+
// Meta
|
|
68
|
+
const meta = [];
|
|
22
69
|
if (result.executionTime)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
70
|
+
meta.push(`**Duration:** ${result.executionTime}s`);
|
|
71
|
+
if (context.env.providerInfo?.model)
|
|
72
|
+
meta.push(`**Model:** ${context.env.providerInfo.model}`);
|
|
73
|
+
if (meta.length > 0)
|
|
74
|
+
md.push(meta.join(' | '));
|
|
75
|
+
return { summary: md.join('\n') };
|
|
26
76
|
}
|
|
27
77
|
//# sourceMappingURL=report.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/node-types/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAkB,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAW,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,UAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/node-types/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAkB,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAW,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC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,CAAC;YACjD,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACd,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;IAEtB,OAAO;IACP,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,MAAM,CAAC,aAAa;QAAE,IAAI,CAAC,IAAI,CAAC,iBAAiB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC;IAC9E,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,cAAc,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC;IAC/F,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAE/C,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -35,6 +35,8 @@ var OP_VALIDATE = "validate";
|
|
|
35
35
|
var OP_TSC_CHECK = "tsc_check";
|
|
36
36
|
var OP_RUN_TESTS = "run_tests";
|
|
37
37
|
var OP_TASK_CREATE = "task_create";
|
|
38
|
+
var OP_REMEMBER = "remember";
|
|
39
|
+
var OP_RECALL = "recall";
|
|
38
40
|
var OP_RESPOND = "respond";
|
|
39
41
|
var PLAN_OPERATIONS = [
|
|
40
42
|
OP_WRITE_FILE,
|
|
@@ -95,13 +97,31 @@ Use run_shell for running tests (npx vitest), validation (flow-weaver validate),
|
|
|
95
97
|
};
|
|
96
98
|
var CAP_TASK_MGMT = {
|
|
97
99
|
name: "task-mgmt",
|
|
98
|
-
description: "Create and manage swarm subtasks for parallel execution.",
|
|
100
|
+
description: "Create and manage swarm subtasks for parallel execution, with decomposition and review nudges.",
|
|
99
101
|
tools: [OP_TASK_CREATE],
|
|
100
|
-
prompt: `## Task Management
|
|
101
|
-
- task_create: Create swarm subtasks for parallel execution. args: { title, description, complexity, subtasks[] }
|
|
102
|
-
- task_list, task_get, task_update: Query and update existing tasks
|
|
102
|
+
prompt: `## Task Management & Decomposition
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
- task_create: Create swarm subtasks. args: { title, description, complexity, subtasks[], dependsOn[], assignedProfile? }
|
|
105
|
+
|
|
106
|
+
### Decomposition
|
|
107
|
+
When you encounter a broad objective (multi-file, multi-concern), decompose into subtasks:
|
|
108
|
+
- If the task is bigger than a single file change, create subtasks instead of doing it all yourself.
|
|
109
|
+
- Minimize dependencies between subtasks to maximize parallel execution.
|
|
110
|
+
- Set complexity per subtask: trivial | simple | moderate | complex.
|
|
111
|
+
- Use dependsOn to express blocking relationships (e.g., setup before code, code before tests).
|
|
112
|
+
|
|
113
|
+
### Review Task Creation
|
|
114
|
+
After creating or modifying multiple files, create a review task:
|
|
115
|
+
- title: "Review: [what was changed]"
|
|
116
|
+
- description: List the files modified and what to check
|
|
117
|
+
- assignedProfile: "reviewer"
|
|
118
|
+
- complexity: "simple"
|
|
119
|
+
Skip review for trivial single-file tasks.
|
|
120
|
+
|
|
121
|
+
### Dependency Guidelines
|
|
122
|
+
- BAD: A \u2192 B \u2192 C \u2192 D (serial, slow)
|
|
123
|
+
- GOOD: A \u2192 [B + C + D] (A blocks all, but B/C/D run in parallel)
|
|
124
|
+
Structure as: setup \u2192 independent implementations \u2192 integration/testing.`
|
|
105
125
|
};
|
|
106
126
|
var CAP_FW_GRAMMAR = {
|
|
107
127
|
name: "fw-grammar",
|
|
@@ -179,17 +199,41 @@ Note: compile, validate, modify, diff, diagram, and describe operations are avai
|
|
|
179
199
|
};
|
|
180
200
|
var CAP_CODE_REVIEW = {
|
|
181
201
|
name: "code-review",
|
|
182
|
-
description: "
|
|
183
|
-
|
|
202
|
+
description: "Comprehensive code review with correctness, security, style, testing, and performance checks.",
|
|
203
|
+
tools: [OP_READ_FILE, OP_PATCH_FILE, OP_RUN_SHELL],
|
|
204
|
+
prompt: `## Code Review Checklist
|
|
205
|
+
|
|
206
|
+
### 1. Correctness
|
|
207
|
+
- Does the code do what the task asked?
|
|
208
|
+
- Edge cases handled (empty input, null, invalid types)?
|
|
209
|
+
- Error paths covered (try/catch, validation)?
|
|
210
|
+
- Return types match function signature?
|
|
184
211
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
212
|
+
### 2. Security
|
|
213
|
+
- NO hardcoded API keys, passwords, or tokens (use env vars)
|
|
214
|
+
- NO shell: true in child_process (command injection risk)
|
|
215
|
+
- NO eval() or Function() with untrusted input
|
|
216
|
+
- User input validated and sanitized before use
|
|
217
|
+
- File paths validated (no ../ traversal)
|
|
191
218
|
|
|
192
|
-
|
|
219
|
+
### 3. Style
|
|
220
|
+
- Naming is clear and consistent with project conventions
|
|
221
|
+
- No dead code (unused variables, unreachable branches)
|
|
222
|
+
- No debug statements left in (console.log, debugger)
|
|
223
|
+
- Imports organized, no duplicates
|
|
224
|
+
|
|
225
|
+
### 4. Testing
|
|
226
|
+
- Unit tests exist for new/changed functions
|
|
227
|
+
- Tests cover happy path AND edge cases
|
|
228
|
+
- Error cases have tests
|
|
229
|
+
- Code coverage adequate (aim for 80%+ of changed code)
|
|
230
|
+
|
|
231
|
+
### 5. Performance
|
|
232
|
+
- No O(n\xB2) loops where O(n) is possible
|
|
233
|
+
- No blocking I/O in async code
|
|
234
|
+
- No memory leaks (listeners removed, timers cleared)
|
|
235
|
+
|
|
236
|
+
Report findings as: FILE:LINE | SEVERITY (critical/high/medium/low) | ISSUE \u2192 Fix suggestion`
|
|
193
237
|
};
|
|
194
238
|
var CAP_WEB = {
|
|
195
239
|
name: "web",
|
|
@@ -206,6 +250,123 @@ var CAP_CONTEXT = {
|
|
|
206
250
|
Use list_files to understand the project structure before making changes.
|
|
207
251
|
The context bundle (when available) provides a snapshot of the workspace.`
|
|
208
252
|
};
|
|
253
|
+
var CAP_VERIFICATION = {
|
|
254
|
+
name: "verification",
|
|
255
|
+
description: "Post-write verification: run tsc and tests to catch errors before delivery.",
|
|
256
|
+
tools: [OP_RUN_SHELL],
|
|
257
|
+
prompt: `## Verification
|
|
258
|
+
|
|
259
|
+
After writing or patching code, ALWAYS verify your work:
|
|
260
|
+
1. Run \`npx tsc --noEmit\` in the project root to catch TypeScript errors
|
|
261
|
+
2. If package.json has a "test" script, run \`npm test\` to validate functionality
|
|
262
|
+
3. If verification fails, read the errors, fix the code, and re-verify
|
|
263
|
+
|
|
264
|
+
Include verification as explicit steps in your plan. Verification is NOT optional.
|
|
265
|
+
Do NOT deliver code that hasn't been verified.`
|
|
266
|
+
};
|
|
267
|
+
var CAP_CROSS_FILE_CHECK = {
|
|
268
|
+
name: "cross-file-check",
|
|
269
|
+
description: "Verify imports, exports, module paths, and cross-file dependencies.",
|
|
270
|
+
tools: [OP_READ_FILE, OP_LIST_FILES, OP_RUN_SHELL],
|
|
271
|
+
prompt: `## Cross-File Dependency Checks
|
|
272
|
+
|
|
273
|
+
When modifying code that affects multiple files:
|
|
274
|
+
1. If you rename an export, grep for all imports of it and update them
|
|
275
|
+
2. Verify relative import paths resolve correctly (../types vs ./types)
|
|
276
|
+
3. Check for circular dependencies (A imports B imports A)
|
|
277
|
+
4. If you change a function signature, update all callers
|
|
278
|
+
5. Use \`run_shell\` with grep to search: grep -r "functionName" src/
|
|
279
|
+
|
|
280
|
+
Do NOT move or rename exports without verifying all dependents.`
|
|
281
|
+
};
|
|
282
|
+
var CAP_PROJECT_SETUP = {
|
|
283
|
+
name: "project-setup",
|
|
284
|
+
description: "Initialize new projects with correct structure, config, and dependencies.",
|
|
285
|
+
tools: [OP_WRITE_FILE, OP_RUN_SHELL],
|
|
286
|
+
prompt: `## Project Setup
|
|
287
|
+
|
|
288
|
+
When initializing a project:
|
|
289
|
+
1. Create package.json with name, type: "module", main, scripts (build, test)
|
|
290
|
+
2. Create tsconfig.json with strict: true, module: "esnext", target: "ES2020"
|
|
291
|
+
3. Create standard directories: src/, tests/
|
|
292
|
+
4. Install dependencies with run_shell: npm install <deps>
|
|
293
|
+
5. Create .gitignore excluding node_modules/, dist/
|
|
294
|
+
6. Verify setup: run tsc --noEmit to ensure TypeScript compiles`
|
|
295
|
+
};
|
|
296
|
+
var CAP_SECURITY = {
|
|
297
|
+
name: "security",
|
|
298
|
+
description: "Audit code for vulnerabilities, secrets, and security best practices.",
|
|
299
|
+
tools: [OP_READ_FILE, OP_LIST_FILES, OP_RUN_SHELL],
|
|
300
|
+
prompt: `## Security Audit
|
|
301
|
+
|
|
302
|
+
Check for:
|
|
303
|
+
1. **Secrets**: NO hardcoded API keys, passwords, tokens. Use env vars.
|
|
304
|
+
grep -r "password\\|secret\\|apiKey\\|token" src/ to find leaks.
|
|
305
|
+
2. **Injection**: NO string concatenation in SQL. NO shell: true in child_process. NO eval().
|
|
306
|
+
3. **Dependencies**: Run npm audit to check for known CVEs.
|
|
307
|
+
4. **File paths**: Validate paths to prevent ../ traversal attacks.
|
|
308
|
+
5. **Data handling**: Validate user input (type, length, format). Sanitize before logging.
|
|
309
|
+
|
|
310
|
+
Report findings with severity: critical | high | medium | low.`
|
|
311
|
+
};
|
|
312
|
+
var CAP_DECOMPOSITION = {
|
|
313
|
+
name: "decomposition",
|
|
314
|
+
description: "Break complex objectives into subtask DAGs with dependencies for parallel execution.",
|
|
315
|
+
tools: [OP_TASK_CREATE],
|
|
316
|
+
prompt: `## Task Decomposition
|
|
317
|
+
|
|
318
|
+
When given a large objective, break it into smaller subtasks:
|
|
319
|
+
1. Identify all work items (files, features, tests)
|
|
320
|
+
2. Group by dependency: what must happen first?
|
|
321
|
+
3. Create subtasks with task_create, each focused on one responsibility
|
|
322
|
+
4. Set dependencies with dependsOn to model blocking relationships
|
|
323
|
+
5. Minimize dependencies to maximize parallel execution
|
|
324
|
+
6. Estimate complexity per subtask: trivial | simple | moderate | complex
|
|
325
|
+
|
|
326
|
+
Example: "Implement auth module"
|
|
327
|
+
- Task A: Extract shared auth types (simple)
|
|
328
|
+
- Task B: Rewrite login endpoint (moderate, depends on A)
|
|
329
|
+
- Task C: Add login tests (moderate, depends on B)
|
|
330
|
+
- Task D: Update auth docs (simple, independent \u2014 runs in parallel with B)
|
|
331
|
+
|
|
332
|
+
Assign profiles: code tasks \u2192 developer, review tasks \u2192 reviewer, infra \u2192 ops.`
|
|
333
|
+
};
|
|
334
|
+
var CAP_ROUTING = {
|
|
335
|
+
name: "routing",
|
|
336
|
+
description: "Route tasks to appropriate bot profiles based on capabilities and complexity.",
|
|
337
|
+
tools: [OP_TASK_CREATE],
|
|
338
|
+
prompt: `## Task Routing
|
|
339
|
+
|
|
340
|
+
When creating subtasks, assign the right profile:
|
|
341
|
+
- Code writing, file creation, bug fixes \u2192 developer profile
|
|
342
|
+
- Code review, quality checks \u2192 reviewer profile
|
|
343
|
+
- Shell commands, project setup, infrastructure \u2192 ops profile
|
|
344
|
+
- Leave assignedProfile empty for auto-triage when unsure
|
|
345
|
+
|
|
346
|
+
Match complexity to profile capabilities:
|
|
347
|
+
- trivial/simple tasks: any profile (prefer cheapest)
|
|
348
|
+
- moderate tasks: specialist profiles
|
|
349
|
+
- complex tasks: profiles with full capability sets`
|
|
350
|
+
};
|
|
351
|
+
var CAP_MEMORY = {
|
|
352
|
+
name: "memory",
|
|
353
|
+
description: "Remember and recall project conventions for continuity across sessions.",
|
|
354
|
+
tools: [OP_REMEMBER, OP_RECALL],
|
|
355
|
+
prompt: `## Project Memory
|
|
356
|
+
|
|
357
|
+
Persist project conventions for future sessions:
|
|
358
|
+
- remember: Save a convention. args: { key: "naming", value: "kebab-case for files" }
|
|
359
|
+
- recall: Load all saved conventions. args: {} \u2014 returns project memory.
|
|
360
|
+
|
|
361
|
+
What to remember:
|
|
362
|
+
- Naming conventions (file names, variable names)
|
|
363
|
+
- Architecture decisions (Result pattern, Zod for validation)
|
|
364
|
+
- Test patterns (where tests go, what framework)
|
|
365
|
+
- Common dependencies and their usage
|
|
366
|
+
|
|
367
|
+
Before planning, recall project memory to follow established patterns.
|
|
368
|
+
When you discover a new convention, remember it for future bots.`
|
|
369
|
+
};
|
|
209
370
|
var BUILT_IN_CAPABILITIES = [
|
|
210
371
|
CAP_CORE,
|
|
211
372
|
CAP_FILE_OPS,
|
|
@@ -217,7 +378,15 @@ var BUILT_IN_CAPABILITIES = [
|
|
|
217
378
|
CAP_FW_CLI,
|
|
218
379
|
CAP_CODE_REVIEW,
|
|
219
380
|
CAP_WEB,
|
|
220
|
-
CAP_CONTEXT
|
|
381
|
+
CAP_CONTEXT,
|
|
382
|
+
// Swarm improvement capabilities
|
|
383
|
+
CAP_VERIFICATION,
|
|
384
|
+
CAP_CROSS_FILE_CHECK,
|
|
385
|
+
CAP_PROJECT_SETUP,
|
|
386
|
+
CAP_SECURITY,
|
|
387
|
+
CAP_DECOMPOSITION,
|
|
388
|
+
CAP_ROUTING,
|
|
389
|
+
CAP_MEMORY
|
|
221
390
|
];
|
|
222
391
|
var capabilityMap = new Map(
|
|
223
392
|
BUILT_IN_CAPABILITIES.map((c) => [c.name, c])
|
|
@@ -217,6 +217,8 @@ var OP_VALIDATE = "validate";
|
|
|
217
217
|
var OP_TSC_CHECK = "tsc_check";
|
|
218
218
|
var OP_RUN_TESTS = "run_tests";
|
|
219
219
|
var OP_TASK_CREATE = "task_create";
|
|
220
|
+
var OP_REMEMBER = "remember";
|
|
221
|
+
var OP_RECALL = "recall";
|
|
220
222
|
|
|
221
223
|
// src/bot/capability-registry.ts
|
|
222
224
|
var CAP_CORE = {
|
|
@@ -266,13 +268,31 @@ Use run_shell for running tests (npx vitest), validation (flow-weaver validate),
|
|
|
266
268
|
};
|
|
267
269
|
var CAP_TASK_MGMT = {
|
|
268
270
|
name: "task-mgmt",
|
|
269
|
-
description: "Create and manage swarm subtasks for parallel execution.",
|
|
271
|
+
description: "Create and manage swarm subtasks for parallel execution, with decomposition and review nudges.",
|
|
270
272
|
tools: [OP_TASK_CREATE],
|
|
271
|
-
prompt: `## Task Management
|
|
272
|
-
- task_create: Create swarm subtasks for parallel execution. args: { title, description, complexity, subtasks[] }
|
|
273
|
-
- task_list, task_get, task_update: Query and update existing tasks
|
|
273
|
+
prompt: `## Task Management & Decomposition
|
|
274
274
|
|
|
275
|
-
|
|
275
|
+
- task_create: Create swarm subtasks. args: { title, description, complexity, subtasks[], dependsOn[], assignedProfile? }
|
|
276
|
+
|
|
277
|
+
### Decomposition
|
|
278
|
+
When you encounter a broad objective (multi-file, multi-concern), decompose into subtasks:
|
|
279
|
+
- If the task is bigger than a single file change, create subtasks instead of doing it all yourself.
|
|
280
|
+
- Minimize dependencies between subtasks to maximize parallel execution.
|
|
281
|
+
- Set complexity per subtask: trivial | simple | moderate | complex.
|
|
282
|
+
- Use dependsOn to express blocking relationships (e.g., setup before code, code before tests).
|
|
283
|
+
|
|
284
|
+
### Review Task Creation
|
|
285
|
+
After creating or modifying multiple files, create a review task:
|
|
286
|
+
- title: "Review: [what was changed]"
|
|
287
|
+
- description: List the files modified and what to check
|
|
288
|
+
- assignedProfile: "reviewer"
|
|
289
|
+
- complexity: "simple"
|
|
290
|
+
Skip review for trivial single-file tasks.
|
|
291
|
+
|
|
292
|
+
### Dependency Guidelines
|
|
293
|
+
- BAD: A \u2192 B \u2192 C \u2192 D (serial, slow)
|
|
294
|
+
- GOOD: A \u2192 [B + C + D] (A blocks all, but B/C/D run in parallel)
|
|
295
|
+
Structure as: setup \u2192 independent implementations \u2192 integration/testing.`
|
|
276
296
|
};
|
|
277
297
|
var CAP_FW_GRAMMAR = {
|
|
278
298
|
name: "fw-grammar",
|
|
@@ -350,17 +370,41 @@ Note: compile, validate, modify, diff, diagram, and describe operations are avai
|
|
|
350
370
|
};
|
|
351
371
|
var CAP_CODE_REVIEW = {
|
|
352
372
|
name: "code-review",
|
|
353
|
-
description: "
|
|
354
|
-
|
|
373
|
+
description: "Comprehensive code review with correctness, security, style, testing, and performance checks.",
|
|
374
|
+
tools: [OP_READ_FILE, OP_PATCH_FILE, OP_RUN_SHELL],
|
|
375
|
+
prompt: `## Code Review Checklist
|
|
376
|
+
|
|
377
|
+
### 1. Correctness
|
|
378
|
+
- Does the code do what the task asked?
|
|
379
|
+
- Edge cases handled (empty input, null, invalid types)?
|
|
380
|
+
- Error paths covered (try/catch, validation)?
|
|
381
|
+
- Return types match function signature?
|
|
355
382
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
383
|
+
### 2. Security
|
|
384
|
+
- NO hardcoded API keys, passwords, or tokens (use env vars)
|
|
385
|
+
- NO shell: true in child_process (command injection risk)
|
|
386
|
+
- NO eval() or Function() with untrusted input
|
|
387
|
+
- User input validated and sanitized before use
|
|
388
|
+
- File paths validated (no ../ traversal)
|
|
362
389
|
|
|
363
|
-
|
|
390
|
+
### 3. Style
|
|
391
|
+
- Naming is clear and consistent with project conventions
|
|
392
|
+
- No dead code (unused variables, unreachable branches)
|
|
393
|
+
- No debug statements left in (console.log, debugger)
|
|
394
|
+
- Imports organized, no duplicates
|
|
395
|
+
|
|
396
|
+
### 4. Testing
|
|
397
|
+
- Unit tests exist for new/changed functions
|
|
398
|
+
- Tests cover happy path AND edge cases
|
|
399
|
+
- Error cases have tests
|
|
400
|
+
- Code coverage adequate (aim for 80%+ of changed code)
|
|
401
|
+
|
|
402
|
+
### 5. Performance
|
|
403
|
+
- No O(n\xB2) loops where O(n) is possible
|
|
404
|
+
- No blocking I/O in async code
|
|
405
|
+
- No memory leaks (listeners removed, timers cleared)
|
|
406
|
+
|
|
407
|
+
Report findings as: FILE:LINE | SEVERITY (critical/high/medium/low) | ISSUE \u2192 Fix suggestion`
|
|
364
408
|
};
|
|
365
409
|
var CAP_WEB = {
|
|
366
410
|
name: "web",
|
|
@@ -377,6 +421,123 @@ var CAP_CONTEXT = {
|
|
|
377
421
|
Use list_files to understand the project structure before making changes.
|
|
378
422
|
The context bundle (when available) provides a snapshot of the workspace.`
|
|
379
423
|
};
|
|
424
|
+
var CAP_VERIFICATION = {
|
|
425
|
+
name: "verification",
|
|
426
|
+
description: "Post-write verification: run tsc and tests to catch errors before delivery.",
|
|
427
|
+
tools: [OP_RUN_SHELL],
|
|
428
|
+
prompt: `## Verification
|
|
429
|
+
|
|
430
|
+
After writing or patching code, ALWAYS verify your work:
|
|
431
|
+
1. Run \`npx tsc --noEmit\` in the project root to catch TypeScript errors
|
|
432
|
+
2. If package.json has a "test" script, run \`npm test\` to validate functionality
|
|
433
|
+
3. If verification fails, read the errors, fix the code, and re-verify
|
|
434
|
+
|
|
435
|
+
Include verification as explicit steps in your plan. Verification is NOT optional.
|
|
436
|
+
Do NOT deliver code that hasn't been verified.`
|
|
437
|
+
};
|
|
438
|
+
var CAP_CROSS_FILE_CHECK = {
|
|
439
|
+
name: "cross-file-check",
|
|
440
|
+
description: "Verify imports, exports, module paths, and cross-file dependencies.",
|
|
441
|
+
tools: [OP_READ_FILE, OP_LIST_FILES, OP_RUN_SHELL],
|
|
442
|
+
prompt: `## Cross-File Dependency Checks
|
|
443
|
+
|
|
444
|
+
When modifying code that affects multiple files:
|
|
445
|
+
1. If you rename an export, grep for all imports of it and update them
|
|
446
|
+
2. Verify relative import paths resolve correctly (../types vs ./types)
|
|
447
|
+
3. Check for circular dependencies (A imports B imports A)
|
|
448
|
+
4. If you change a function signature, update all callers
|
|
449
|
+
5. Use \`run_shell\` with grep to search: grep -r "functionName" src/
|
|
450
|
+
|
|
451
|
+
Do NOT move or rename exports without verifying all dependents.`
|
|
452
|
+
};
|
|
453
|
+
var CAP_PROJECT_SETUP = {
|
|
454
|
+
name: "project-setup",
|
|
455
|
+
description: "Initialize new projects with correct structure, config, and dependencies.",
|
|
456
|
+
tools: [OP_WRITE_FILE, OP_RUN_SHELL],
|
|
457
|
+
prompt: `## Project Setup
|
|
458
|
+
|
|
459
|
+
When initializing a project:
|
|
460
|
+
1. Create package.json with name, type: "module", main, scripts (build, test)
|
|
461
|
+
2. Create tsconfig.json with strict: true, module: "esnext", target: "ES2020"
|
|
462
|
+
3. Create standard directories: src/, tests/
|
|
463
|
+
4. Install dependencies with run_shell: npm install <deps>
|
|
464
|
+
5. Create .gitignore excluding node_modules/, dist/
|
|
465
|
+
6. Verify setup: run tsc --noEmit to ensure TypeScript compiles`
|
|
466
|
+
};
|
|
467
|
+
var CAP_SECURITY = {
|
|
468
|
+
name: "security",
|
|
469
|
+
description: "Audit code for vulnerabilities, secrets, and security best practices.",
|
|
470
|
+
tools: [OP_READ_FILE, OP_LIST_FILES, OP_RUN_SHELL],
|
|
471
|
+
prompt: `## Security Audit
|
|
472
|
+
|
|
473
|
+
Check for:
|
|
474
|
+
1. **Secrets**: NO hardcoded API keys, passwords, tokens. Use env vars.
|
|
475
|
+
grep -r "password\\|secret\\|apiKey\\|token" src/ to find leaks.
|
|
476
|
+
2. **Injection**: NO string concatenation in SQL. NO shell: true in child_process. NO eval().
|
|
477
|
+
3. **Dependencies**: Run npm audit to check for known CVEs.
|
|
478
|
+
4. **File paths**: Validate paths to prevent ../ traversal attacks.
|
|
479
|
+
5. **Data handling**: Validate user input (type, length, format). Sanitize before logging.
|
|
480
|
+
|
|
481
|
+
Report findings with severity: critical | high | medium | low.`
|
|
482
|
+
};
|
|
483
|
+
var CAP_DECOMPOSITION = {
|
|
484
|
+
name: "decomposition",
|
|
485
|
+
description: "Break complex objectives into subtask DAGs with dependencies for parallel execution.",
|
|
486
|
+
tools: [OP_TASK_CREATE],
|
|
487
|
+
prompt: `## Task Decomposition
|
|
488
|
+
|
|
489
|
+
When given a large objective, break it into smaller subtasks:
|
|
490
|
+
1. Identify all work items (files, features, tests)
|
|
491
|
+
2. Group by dependency: what must happen first?
|
|
492
|
+
3. Create subtasks with task_create, each focused on one responsibility
|
|
493
|
+
4. Set dependencies with dependsOn to model blocking relationships
|
|
494
|
+
5. Minimize dependencies to maximize parallel execution
|
|
495
|
+
6. Estimate complexity per subtask: trivial | simple | moderate | complex
|
|
496
|
+
|
|
497
|
+
Example: "Implement auth module"
|
|
498
|
+
- Task A: Extract shared auth types (simple)
|
|
499
|
+
- Task B: Rewrite login endpoint (moderate, depends on A)
|
|
500
|
+
- Task C: Add login tests (moderate, depends on B)
|
|
501
|
+
- Task D: Update auth docs (simple, independent \u2014 runs in parallel with B)
|
|
502
|
+
|
|
503
|
+
Assign profiles: code tasks \u2192 developer, review tasks \u2192 reviewer, infra \u2192 ops.`
|
|
504
|
+
};
|
|
505
|
+
var CAP_ROUTING = {
|
|
506
|
+
name: "routing",
|
|
507
|
+
description: "Route tasks to appropriate bot profiles based on capabilities and complexity.",
|
|
508
|
+
tools: [OP_TASK_CREATE],
|
|
509
|
+
prompt: `## Task Routing
|
|
510
|
+
|
|
511
|
+
When creating subtasks, assign the right profile:
|
|
512
|
+
- Code writing, file creation, bug fixes \u2192 developer profile
|
|
513
|
+
- Code review, quality checks \u2192 reviewer profile
|
|
514
|
+
- Shell commands, project setup, infrastructure \u2192 ops profile
|
|
515
|
+
- Leave assignedProfile empty for auto-triage when unsure
|
|
516
|
+
|
|
517
|
+
Match complexity to profile capabilities:
|
|
518
|
+
- trivial/simple tasks: any profile (prefer cheapest)
|
|
519
|
+
- moderate tasks: specialist profiles
|
|
520
|
+
- complex tasks: profiles with full capability sets`
|
|
521
|
+
};
|
|
522
|
+
var CAP_MEMORY = {
|
|
523
|
+
name: "memory",
|
|
524
|
+
description: "Remember and recall project conventions for continuity across sessions.",
|
|
525
|
+
tools: [OP_REMEMBER, OP_RECALL],
|
|
526
|
+
prompt: `## Project Memory
|
|
527
|
+
|
|
528
|
+
Persist project conventions for future sessions:
|
|
529
|
+
- remember: Save a convention. args: { key: "naming", value: "kebab-case for files" }
|
|
530
|
+
- recall: Load all saved conventions. args: {} \u2014 returns project memory.
|
|
531
|
+
|
|
532
|
+
What to remember:
|
|
533
|
+
- Naming conventions (file names, variable names)
|
|
534
|
+
- Architecture decisions (Result pattern, Zod for validation)
|
|
535
|
+
- Test patterns (where tests go, what framework)
|
|
536
|
+
- Common dependencies and their usage
|
|
537
|
+
|
|
538
|
+
Before planning, recall project memory to follow established patterns.
|
|
539
|
+
When you discover a new convention, remember it for future bots.`
|
|
540
|
+
};
|
|
380
541
|
var BUILT_IN_CAPABILITIES = [
|
|
381
542
|
CAP_CORE,
|
|
382
543
|
CAP_FILE_OPS,
|
|
@@ -388,7 +549,15 @@ var BUILT_IN_CAPABILITIES = [
|
|
|
388
549
|
CAP_FW_CLI,
|
|
389
550
|
CAP_CODE_REVIEW,
|
|
390
551
|
CAP_WEB,
|
|
391
|
-
CAP_CONTEXT
|
|
552
|
+
CAP_CONTEXT,
|
|
553
|
+
// Swarm improvement capabilities
|
|
554
|
+
CAP_VERIFICATION,
|
|
555
|
+
CAP_CROSS_FILE_CHECK,
|
|
556
|
+
CAP_PROJECT_SETUP,
|
|
557
|
+
CAP_SECURITY,
|
|
558
|
+
CAP_DECOMPOSITION,
|
|
559
|
+
CAP_ROUTING,
|
|
560
|
+
CAP_MEMORY
|
|
392
561
|
];
|
|
393
562
|
var capabilityMap = new Map(
|
|
394
563
|
BUILT_IN_CAPABILITIES.map((c) => [c.name, c])
|