@synergenius/flow-weaver-pack-weaver 0.9.3 → 0.9.5
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/ansi.d.ts +13 -0
- package/dist/bot/ansi.d.ts.map +1 -0
- package/dist/bot/ansi.js +13 -0
- package/dist/bot/ansi.js.map +1 -0
- package/dist/bot/assistant-core.d.ts.map +1 -1
- package/dist/bot/assistant-core.js +68 -32
- package/dist/bot/assistant-core.js.map +1 -1
- package/dist/bot/assistant-tools.d.ts +3 -2
- package/dist/bot/assistant-tools.d.ts.map +1 -1
- package/dist/bot/assistant-tools.js +6 -284
- package/dist/bot/assistant-tools.js.map +1 -1
- package/dist/bot/conversation-store.d.ts.map +1 -1
- package/dist/bot/conversation-store.js +1 -1
- package/dist/bot/conversation-store.js.map +1 -1
- package/dist/bot/error-classifier.d.ts +27 -0
- package/dist/bot/error-classifier.d.ts.map +1 -0
- package/dist/bot/error-classifier.js +71 -0
- package/dist/bot/error-classifier.js.map +1 -0
- package/dist/bot/error-guide.d.ts +2 -7
- package/dist/bot/error-guide.d.ts.map +1 -1
- package/dist/bot/error-guide.js +2 -31
- package/dist/bot/error-guide.js.map +1 -1
- package/dist/bot/paths.d.ts +11 -0
- package/dist/bot/paths.d.ts.map +1 -0
- package/dist/bot/paths.js +26 -0
- package/dist/bot/paths.js.map +1 -0
- package/dist/bot/response-formatter.d.ts +15 -0
- package/dist/bot/response-formatter.d.ts.map +1 -0
- package/dist/bot/response-formatter.js +40 -0
- package/dist/bot/response-formatter.js.map +1 -0
- package/dist/bot/retry-utils.d.ts +2 -16
- package/dist/bot/retry-utils.d.ts.map +1 -1
- package/dist/bot/retry-utils.js +2 -61
- package/dist/bot/retry-utils.js.map +1 -1
- package/dist/bot/rich-input.d.ts +39 -0
- package/dist/bot/rich-input.d.ts.map +1 -0
- package/dist/bot/rich-input.js +308 -0
- package/dist/bot/rich-input.js.map +1 -0
- package/dist/bot/safety.d.ts +10 -0
- package/dist/bot/safety.d.ts.map +1 -0
- package/dist/bot/safety.js +14 -0
- package/dist/bot/safety.js.map +1 -0
- package/dist/bot/slash-commands.d.ts +20 -0
- package/dist/bot/slash-commands.d.ts.map +1 -0
- package/dist/bot/slash-commands.js +93 -0
- package/dist/bot/slash-commands.js.map +1 -0
- package/dist/bot/steering.js +2 -2
- package/dist/bot/steering.js.map +1 -1
- package/dist/bot/task-queue.d.ts.map +1 -1
- package/dist/bot/task-queue.js +2 -15
- package/dist/bot/task-queue.js.map +1 -1
- package/dist/bot/terminal-renderer.d.ts.map +1 -1
- package/dist/bot/terminal-renderer.js +12 -13
- package/dist/bot/terminal-renderer.js.map +1 -1
- package/dist/bot/tool-registry.d.ts +24 -0
- package/dist/bot/tool-registry.d.ts.map +1 -0
- package/dist/bot/tool-registry.js +458 -0
- package/dist/bot/tool-registry.js.map +1 -0
- package/dist/bot/weaver-tools.d.ts +2 -2
- package/dist/bot/weaver-tools.d.ts.map +1 -1
- package/dist/bot/weaver-tools.js +4 -95
- package/dist/bot/weaver-tools.js.map +1 -1
- package/dist/cli-handlers.d.ts.map +1 -1
- package/dist/cli-handlers.js +1 -2
- package/dist/cli-handlers.js.map +1 -1
- package/dist/node-types/agent-execute.d.ts.map +1 -1
- package/dist/node-types/agent-execute.js +4 -8
- package/dist/node-types/agent-execute.js.map +1 -1
- package/flowweaver.manifest.json +1 -1
- package/package.json +1 -1
- package/src/bot/ansi.ts +12 -0
- package/src/bot/assistant-core.ts +70 -33
- package/src/bot/assistant-tools.ts +7 -294
- package/src/bot/conversation-store.ts +1 -1
- package/src/bot/error-classifier.ts +90 -0
- package/src/bot/error-guide.ts +2 -32
- package/src/bot/paths.ts +27 -0
- package/src/bot/response-formatter.ts +42 -0
- package/src/bot/retry-utils.ts +2 -74
- package/src/bot/rich-input.ts +307 -0
- package/src/bot/safety.ts +16 -0
- package/src/bot/slash-commands.ts +114 -0
- package/src/bot/steering.ts +2 -2
- package/src/bot/task-queue.ts +2 -16
- package/src/bot/terminal-renderer.ts +11 -14
- package/src/bot/tool-registry.ts +477 -0
- package/src/bot/weaver-tools.ts +4 -95
- package/src/cli-handlers.ts +1 -2
- package/src/node-types/agent-execute.ts +3 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-execute.js","sourceRoot":"","sources":["../../src/node-types/agent-execute.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,GAOnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"agent-execute.js","sourceRoot":"","sources":["../../src/node-types/agent-execute.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,GAOnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,+CAA+C;AAC/C,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,SAAS,eAAe;IACtB,IAAI,iBAAiB;QAAE,OAAO;IAC9B,iBAAiB,GAAG,IAAI,CAAC;IACzB,MAAM,OAAO,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC;QAAC,kBAAkB,EAAE,CAAC;IAAC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QAAC,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;YAAE,OAAO,CAAC,KAAK,CAAC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AAS,qBAAqB,CAAC,KAAc,EAAE,UAAmB;IAChE,eAAe,EAAE,CAAC;IAClB,MAAM,GAAG,GAAG,UAAU,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACxC,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,EAAE;QACzC,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,KAAK,IAAI,mBAAmB;KACpC,CAAC,CAAC;IACH,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
|
package/flowweaver.manifest.json
CHANGED
package/package.json
CHANGED
package/src/bot/ansi.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared ANSI color helpers — single source of truth.
|
|
3
|
+
*/
|
|
4
|
+
export const c = {
|
|
5
|
+
green: (s: string) => `\x1b[32m${s}\x1b[0m`,
|
|
6
|
+
red: (s: string) => `\x1b[31m${s}\x1b[0m`,
|
|
7
|
+
yellow: (s: string) => `\x1b[33m${s}\x1b[0m`,
|
|
8
|
+
cyan: (s: string) => `\x1b[36m${s}\x1b[0m`,
|
|
9
|
+
dim: (s: string) => `\x1b[2m${s}\x1b[0m`,
|
|
10
|
+
bold: (s: string) => `\x1b[1m${s}\x1b[0m`,
|
|
11
|
+
redBold: (s: string) => `\x1b[1;31m${s}\x1b[0m`,
|
|
12
|
+
};
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* - API provider: tools collected and executed manually (tool_use_start/end events)
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import * as
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import * as os from 'node:os';
|
|
12
13
|
import {
|
|
13
14
|
runAgentLoop,
|
|
14
15
|
type AgentProvider,
|
|
@@ -17,6 +18,10 @@ import {
|
|
|
17
18
|
type ToolExecutor,
|
|
18
19
|
type StreamEvent,
|
|
19
20
|
} from '@synergenius/flow-weaver/agent';
|
|
21
|
+
import { c } from './ansi.js';
|
|
22
|
+
import { VERBOSE_TOOL_NAMES } from './tool-registry.js';
|
|
23
|
+
import { generateToolPromptSection, generateVerboseToolList } from './tool-registry.js';
|
|
24
|
+
import { CHARS_PER_TOKEN } from './safety.js';
|
|
20
25
|
|
|
21
26
|
export interface AssistantOptions {
|
|
22
27
|
provider: AgentProvider;
|
|
@@ -34,13 +39,9 @@ export interface AssistantOptions {
|
|
|
34
39
|
|
|
35
40
|
const DEFAULT_SYSTEM_PROMPT = `You are Weaver Assistant — a director-level AI that manages bot workers and the flow-weaver ecosystem.
|
|
36
41
|
|
|
37
|
-
You help users:
|
|
38
|
-
1. Spawn and manage multiple bot sessions (bot_spawn, bot_list, bot_status, bot_pause, bot_resume, bot_stop, bot_logs)
|
|
39
|
-
2. Queue tasks for bots (queue_add, queue_add_batch, queue_list, queue_retry)
|
|
40
|
-
3. Inspect workflows (fw_validate, fw_diagram, fw_describe)
|
|
41
|
-
4. Read and analyze project files (read_file, list_files, run_shell)
|
|
42
|
-
5. Generate reports on bot progress and costs
|
|
42
|
+
You help users with the following tools (grouped by category):
|
|
43
43
|
|
|
44
|
+
${generateToolPromptSection()}
|
|
44
45
|
USE TOOLS to fulfill requests. Don't describe what you'd do — actually do it.
|
|
45
46
|
When the user asks to "start a bot", call bot_spawn.
|
|
46
47
|
When they ask for status, call bot_list or bot_status.
|
|
@@ -56,16 +57,17 @@ CRITICAL: You are running in a terminal. Do NOT use markdown formatting.
|
|
|
56
57
|
- Use UPPERCASE or quotes for emphasis instead of markdown
|
|
57
58
|
- For lists, use simple dashes: - item
|
|
58
59
|
- For key-value pairs, use: key: value (one per line)
|
|
59
|
-
- Keep output scannable and clean
|
|
60
|
+
- Keep output scannable and clean
|
|
61
|
+
|
|
62
|
+
IMPORTANT: Some tool results are displayed DIRECTLY to the user in the terminal.
|
|
63
|
+
These tools show FULL output — the user already sees everything:
|
|
64
|
+
${generateVerboseToolList()}
|
|
65
|
+
For these: do NOT repeat, summarize, or reformat the output. Just add a brief comment if needed.
|
|
66
|
+
Never re-type ASCII art, diagrams, or large text blocks that were already printed.
|
|
67
|
+
|
|
68
|
+
Other tools show only a short preview.
|
|
69
|
+
For those: you may summarize or explain the result as needed.`;
|
|
60
70
|
|
|
61
|
-
// ANSI helpers
|
|
62
|
-
const c = {
|
|
63
|
-
cyan: (s: string) => `\x1b[36m${s}\x1b[0m`,
|
|
64
|
-
dim: (s: string) => `\x1b[2m${s}\x1b[0m`,
|
|
65
|
-
bold: (s: string) => `\x1b[1m${s}\x1b[0m`,
|
|
66
|
-
green: (s: string) => `\x1b[32m${s}\x1b[0m`,
|
|
67
|
-
red: (s: string) => `\x1b[31m${s}\x1b[0m`,
|
|
68
|
-
};
|
|
69
71
|
|
|
70
72
|
export async function runAssistant(opts: AssistantOptions): Promise<void> {
|
|
71
73
|
const { provider, tools, executor, projectDir } = opts;
|
|
@@ -123,23 +125,28 @@ export async function runAssistant(opts: AssistantOptions): Promise<void> {
|
|
|
123
125
|
} else {
|
|
124
126
|
out(` ${c.dim(`Conversation: ${conversation.id}`)}\n`);
|
|
125
127
|
}
|
|
126
|
-
out(` ${c.dim('Type your request. Ctrl+C to exit.')}\n\n`);
|
|
127
|
-
|
|
128
|
-
//
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
out(` ${c.dim('Type your request. Ctrl+C to exit. /help for commands.')}\n\n`);
|
|
129
|
+
|
|
130
|
+
// Rich input with history, arrows, tab completion, slash commands
|
|
131
|
+
const { RichInput } = await import('./rich-input.js');
|
|
132
|
+
const { getSlashCompletions, handleSlashCommand } = await import('./slash-commands.js');
|
|
133
|
+
const { formatResponse } = await import('./response-formatter.js');
|
|
134
|
+
|
|
135
|
+
const richInput = opts.inputMessages ? null : new RichInput({
|
|
136
|
+
historyFile: path.join(os.homedir(), '.weaver', 'input-history.txt'),
|
|
137
|
+
prompt: `${c.cyan('❯')} `,
|
|
138
|
+
completionProvider: (partial) => {
|
|
139
|
+
if (partial.startsWith('/')) return getSlashCompletions(partial);
|
|
140
|
+
return [];
|
|
141
|
+
},
|
|
142
|
+
});
|
|
132
143
|
|
|
133
144
|
const getNextInput = opts.inputMessages
|
|
134
145
|
? (() => {
|
|
135
146
|
let i = 0;
|
|
136
147
|
return (): Promise<string | null> => Promise.resolve(opts.inputMessages![i++] ?? null);
|
|
137
148
|
})()
|
|
138
|
-
: (): Promise<string | null> =>
|
|
139
|
-
rl!.prompt();
|
|
140
|
-
rl!.once('line', (line) => resolve(line.trim() || null));
|
|
141
|
-
rl!.once('close', () => resolve(null));
|
|
142
|
-
});
|
|
149
|
+
: (): Promise<string | null> => richInput!.getInput();
|
|
143
150
|
|
|
144
151
|
const onStreamEvent = (event: StreamEvent) => {
|
|
145
152
|
if (event.type === 'text_delta') {
|
|
@@ -156,19 +163,51 @@ export async function runAssistant(opts: AssistantOptions): Promise<void> {
|
|
|
156
163
|
}
|
|
157
164
|
if (event.type === 'tool_call_result') {
|
|
158
165
|
const icon = event.isError ? c.red('✗') : c.dim('→');
|
|
159
|
-
const
|
|
160
|
-
|
|
166
|
+
const raw = event.result ?? '';
|
|
167
|
+
// Show full output for diagram/describe/docs tools; truncate others
|
|
168
|
+
const isVerboseTool = VERBOSE_TOOL_NAMES.has(event.name);
|
|
169
|
+
if (isVerboseTool && raw.length > 150) {
|
|
170
|
+
out(` ${icon}\n${raw}\n`);
|
|
171
|
+
} else {
|
|
172
|
+
const result = raw.replace(/\n/g, ' ').slice(0, 200);
|
|
173
|
+
out(` ${icon} ${result}\n`);
|
|
174
|
+
}
|
|
161
175
|
}
|
|
162
176
|
};
|
|
163
177
|
|
|
178
|
+
// Slash command context
|
|
179
|
+
let shouldExit = false;
|
|
180
|
+
const slashCtx = {
|
|
181
|
+
executor,
|
|
182
|
+
out,
|
|
183
|
+
projectDir,
|
|
184
|
+
conversationId: conversation.id,
|
|
185
|
+
onClear: () => { history.length = 0; },
|
|
186
|
+
onExit: () => { shouldExit = true; },
|
|
187
|
+
onNew: () => { history.length = 0; conversation = store.create(projectDir); },
|
|
188
|
+
onVerbose: () => { out(` ${c.dim('Verbose toggling not yet wired to streaming.')}\n`); },
|
|
189
|
+
};
|
|
190
|
+
|
|
164
191
|
// Main conversation loop
|
|
165
|
-
while (
|
|
192
|
+
while (!shouldExit) {
|
|
166
193
|
const input = await getNextInput();
|
|
167
194
|
if (input === null) break;
|
|
168
195
|
if (!input.trim()) continue;
|
|
169
196
|
|
|
197
|
+
// Handle slash commands
|
|
198
|
+
if (input.startsWith('/')) {
|
|
199
|
+
const handled = await handleSlashCommand(input, slashCtx);
|
|
200
|
+
if (handled) continue;
|
|
201
|
+
// Unknown slash command — tell user
|
|
202
|
+
out(` ${c.dim('Unknown command. Type /help for available commands.')}\n\n`);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
|
|
170
206
|
out('\n');
|
|
171
207
|
|
|
208
|
+
// Reset Ctrl+C counter after successful input
|
|
209
|
+
richInput?.resetCtrlC();
|
|
210
|
+
|
|
172
211
|
// Add user message to history
|
|
173
212
|
history.push({ role: 'user', content: input });
|
|
174
213
|
|
|
@@ -226,7 +265,7 @@ export async function runAssistant(opts: AssistantOptions): Promise<void> {
|
|
|
226
265
|
out('\n');
|
|
227
266
|
}
|
|
228
267
|
|
|
229
|
-
|
|
268
|
+
richInput?.destroy();
|
|
230
269
|
out(`\n ${c.dim('Goodbye.')}\n\n`);
|
|
231
270
|
}
|
|
232
271
|
|
|
@@ -242,8 +281,6 @@ function toolPreview(name: string, args: Record<string, unknown>): string {
|
|
|
242
281
|
|
|
243
282
|
// --- Token-aware history compression ---
|
|
244
283
|
|
|
245
|
-
// Rough token estimate: ~4 chars per token for English text
|
|
246
|
-
const CHARS_PER_TOKEN = 4;
|
|
247
284
|
// Budget: leave room for system prompt (~2k) + tools (~3k) + response (~4k)
|
|
248
285
|
const MAX_HISTORY_TOKENS = 80_000;
|
|
249
286
|
// When compressing, truncate tool results to this size
|
|
@@ -10,6 +10,10 @@ import { execFileSync } from 'node:child_process';
|
|
|
10
10
|
import * as fs from 'node:fs';
|
|
11
11
|
import * as os from 'node:os';
|
|
12
12
|
import * as path from 'node:path';
|
|
13
|
+
import { ASSISTANT_TOOLS } from './tool-registry.js';
|
|
14
|
+
import { isBlockedCommand, isBlockedUrl } from './safety.js';
|
|
15
|
+
|
|
16
|
+
export { ASSISTANT_TOOLS };
|
|
13
17
|
|
|
14
18
|
// Shared bot manager instance
|
|
15
19
|
let manager: BotManager | null = null;
|
|
@@ -18,296 +22,6 @@ function getManager(): BotManager {
|
|
|
18
22
|
return manager;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
export const ASSISTANT_TOOLS: ToolDefinition[] = [
|
|
22
|
-
// Bot management
|
|
23
|
-
{
|
|
24
|
-
name: 'bot_spawn',
|
|
25
|
-
description: 'Start a new bot session. Returns the bot name and status.',
|
|
26
|
-
inputSchema: {
|
|
27
|
-
type: 'object',
|
|
28
|
-
properties: {
|
|
29
|
-
name: { type: 'string', description: 'Unique name for this bot (e.g. "fix-templates")' },
|
|
30
|
-
project_dir: { type: 'string', description: 'Project directory for the bot to work in' },
|
|
31
|
-
parallel: { type: 'number', description: 'Number of parallel tasks (1-5, default 1)' },
|
|
32
|
-
deadline: { type: 'string', description: 'Stop time in HH:MM format (optional)' },
|
|
33
|
-
branch: { type: 'string', description: 'Git branch for commits (keeps main clean, good for overnight runs)' },
|
|
34
|
-
},
|
|
35
|
-
required: ['name'],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'bot_list',
|
|
40
|
-
description: 'List all bot sessions with their status, task counts, and cost.',
|
|
41
|
-
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'bot_status',
|
|
45
|
-
description: 'Get detailed status of a specific bot including queue and recent activity.',
|
|
46
|
-
inputSchema: {
|
|
47
|
-
type: 'object',
|
|
48
|
-
properties: { name: { type: 'string', description: 'Bot name' } },
|
|
49
|
-
required: ['name'],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'bot_pause',
|
|
54
|
-
description: 'Pause a running bot. It will finish its current task then wait.',
|
|
55
|
-
inputSchema: {
|
|
56
|
-
type: 'object',
|
|
57
|
-
properties: { name: { type: 'string', description: 'Bot name' } },
|
|
58
|
-
required: ['name'],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'bot_resume',
|
|
63
|
-
description: 'Resume a paused bot.',
|
|
64
|
-
inputSchema: {
|
|
65
|
-
type: 'object',
|
|
66
|
-
properties: { name: { type: 'string', description: 'Bot name' } },
|
|
67
|
-
required: ['name'],
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: 'bot_stop',
|
|
72
|
-
description: 'Gracefully stop a bot (finishes current task, then exits).',
|
|
73
|
-
inputSchema: {
|
|
74
|
-
type: 'object',
|
|
75
|
-
properties: { name: { type: 'string', description: 'Bot name' } },
|
|
76
|
-
required: ['name'],
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'bot_logs',
|
|
81
|
-
description: 'Get recent output log from a bot.',
|
|
82
|
-
inputSchema: {
|
|
83
|
-
type: 'object',
|
|
84
|
-
properties: {
|
|
85
|
-
name: { type: 'string', description: 'Bot name' },
|
|
86
|
-
lines: { type: 'number', description: 'Number of lines to return (default 30)' },
|
|
87
|
-
},
|
|
88
|
-
required: ['name'],
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
// Queue management
|
|
93
|
-
{
|
|
94
|
-
name: 'queue_add',
|
|
95
|
-
description: 'Add a task to a bot\'s queue.',
|
|
96
|
-
inputSchema: {
|
|
97
|
-
type: 'object',
|
|
98
|
-
properties: {
|
|
99
|
-
bot: { type: 'string', description: 'Bot name' },
|
|
100
|
-
instruction: { type: 'string', description: 'Task instruction' },
|
|
101
|
-
targets: { type: 'array', items: { type: 'string' }, description: 'Target files (optional)' },
|
|
102
|
-
},
|
|
103
|
-
required: ['bot', 'instruction'],
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: 'queue_add_batch',
|
|
108
|
-
description: 'Add multiple tasks to a bot\'s queue at once.',
|
|
109
|
-
inputSchema: {
|
|
110
|
-
type: 'object',
|
|
111
|
-
properties: {
|
|
112
|
-
bot: { type: 'string', description: 'Bot name' },
|
|
113
|
-
tasks: {
|
|
114
|
-
type: 'array',
|
|
115
|
-
items: {
|
|
116
|
-
type: 'object',
|
|
117
|
-
properties: {
|
|
118
|
-
instruction: { type: 'string' },
|
|
119
|
-
targets: { type: 'array', items: { type: 'string' } },
|
|
120
|
-
},
|
|
121
|
-
required: ['instruction'],
|
|
122
|
-
},
|
|
123
|
-
description: 'Array of tasks to add',
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
required: ['bot', 'tasks'],
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'queue_list',
|
|
131
|
-
description: 'List all tasks in a bot\'s queue with their status.',
|
|
132
|
-
inputSchema: {
|
|
133
|
-
type: 'object',
|
|
134
|
-
properties: { bot: { type: 'string', description: 'Bot name' } },
|
|
135
|
-
required: ['bot'],
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: 'queue_retry',
|
|
140
|
-
description: 'Reset all failed tasks in a bot\'s queue to pending.',
|
|
141
|
-
inputSchema: {
|
|
142
|
-
type: 'object',
|
|
143
|
-
properties: { bot: { type: 'string', description: 'Bot name' } },
|
|
144
|
-
required: ['bot'],
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
// Flow-weaver tools
|
|
149
|
-
{
|
|
150
|
-
name: 'fw_validate',
|
|
151
|
-
description: 'Validate a workflow or directory of workflows. Returns errors and warnings.',
|
|
152
|
-
inputSchema: {
|
|
153
|
-
type: 'object',
|
|
154
|
-
properties: { path: { type: 'string', description: 'File or directory path' } },
|
|
155
|
-
required: ['path'],
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: 'fw_diagram',
|
|
160
|
-
description: 'Generate a text diagram of a workflow.',
|
|
161
|
-
inputSchema: {
|
|
162
|
-
type: 'object',
|
|
163
|
-
properties: { file: { type: 'string', description: 'Workflow file path' } },
|
|
164
|
-
required: ['file'],
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: 'fw_describe',
|
|
169
|
-
description: 'Get a natural language description of a workflow.',
|
|
170
|
-
inputSchema: {
|
|
171
|
-
type: 'object',
|
|
172
|
-
properties: { file: { type: 'string', description: 'Workflow file path' } },
|
|
173
|
-
required: ['file'],
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: 'fw_docs',
|
|
178
|
-
description: 'Look up Flow Weaver documentation by topic. Topics: concepts, jsdoc-grammar, advanced-annotations, built-in-nodes, scaffold, node-conversion, patterns, error-codes, debugging, export-interface.',
|
|
179
|
-
inputSchema: {
|
|
180
|
-
type: 'object',
|
|
181
|
-
properties: { topic: { type: 'string', description: 'Documentation topic slug' } },
|
|
182
|
-
required: ['topic'],
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
// Project tools
|
|
187
|
-
{
|
|
188
|
-
name: 'read_file',
|
|
189
|
-
description: 'Read a file and return its contents.',
|
|
190
|
-
inputSchema: {
|
|
191
|
-
type: 'object',
|
|
192
|
-
properties: { file: { type: 'string', description: 'File path' } },
|
|
193
|
-
required: ['file'],
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: 'list_files',
|
|
198
|
-
description: 'List files in a directory.',
|
|
199
|
-
inputSchema: {
|
|
200
|
-
type: 'object',
|
|
201
|
-
properties: {
|
|
202
|
-
directory: { type: 'string', description: 'Directory path' },
|
|
203
|
-
pattern: { type: 'string', description: 'Filter pattern (regex, optional)' },
|
|
204
|
-
},
|
|
205
|
-
required: ['directory'],
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: 'run_shell',
|
|
210
|
-
description: 'Run a shell command (read-only operations recommended).',
|
|
211
|
-
inputSchema: {
|
|
212
|
-
type: 'object',
|
|
213
|
-
properties: { command: { type: 'string', description: 'Shell command to execute' } },
|
|
214
|
-
required: ['command'],
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
// Conversation management
|
|
219
|
-
{
|
|
220
|
-
name: 'conversation_list',
|
|
221
|
-
description: 'List saved assistant conversations with message counts and timestamps.',
|
|
222
|
-
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: 'conversation_delete',
|
|
226
|
-
description: 'Delete a saved conversation by ID.',
|
|
227
|
-
inputSchema: {
|
|
228
|
-
type: 'object',
|
|
229
|
-
properties: { id: { type: 'string', description: 'Conversation ID to delete' } },
|
|
230
|
-
required: ['id'],
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
name: 'conversation_summary',
|
|
235
|
-
description: 'Get a summary of the current conversation (message count, tokens, bots spawned).',
|
|
236
|
-
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
// Web access
|
|
240
|
-
{
|
|
241
|
-
name: 'web_fetch',
|
|
242
|
-
description: 'Fetch HTTP content from a URL. Returns text body (max 10KB).',
|
|
243
|
-
inputSchema: {
|
|
244
|
-
type: 'object',
|
|
245
|
-
properties: {
|
|
246
|
-
url: { type: 'string', description: 'URL to fetch' },
|
|
247
|
-
method: { type: 'string', description: 'HTTP method (default GET)', enum: ['GET', 'POST'] },
|
|
248
|
-
},
|
|
249
|
-
required: ['url'],
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
// CI/CD
|
|
254
|
-
{
|
|
255
|
-
name: 'github_status',
|
|
256
|
-
description: 'Check GitHub Actions status for a branch or PR. Requires gh CLI installed.',
|
|
257
|
-
inputSchema: {
|
|
258
|
-
type: 'object',
|
|
259
|
-
properties: {
|
|
260
|
-
branch: { type: 'string', description: 'Branch name (optional, defaults to current)' },
|
|
261
|
-
pr: { type: 'number', description: 'PR number (optional, checks PR status instead of branch)' },
|
|
262
|
-
},
|
|
263
|
-
required: [],
|
|
264
|
-
},
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
// Cross-repo
|
|
268
|
-
{
|
|
269
|
-
name: 'project_list',
|
|
270
|
-
description: 'List known project directories that have been used with weaver.',
|
|
271
|
-
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
name: 'project_context',
|
|
275
|
-
description: 'Read package.json and .weaver-plan.md from a project directory to understand its context.',
|
|
276
|
-
inputSchema: {
|
|
277
|
-
type: 'object',
|
|
278
|
-
properties: { directory: { type: 'string', description: 'Absolute path to project directory' } },
|
|
279
|
-
required: ['directory'],
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
// Diagrams
|
|
284
|
-
{
|
|
285
|
-
name: 'fw_diagram_mermaid',
|
|
286
|
-
description: 'Generate a Mermaid diagram of a workflow (can be rendered in any Mermaid viewer).',
|
|
287
|
-
inputSchema: {
|
|
288
|
-
type: 'object',
|
|
289
|
-
properties: { file: { type: 'string', description: 'Workflow file path' } },
|
|
290
|
-
required: ['file'],
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
// Knowledge
|
|
295
|
-
{
|
|
296
|
-
name: 'knowledge_list',
|
|
297
|
-
description: 'List all stored knowledge entries for the current project.',
|
|
298
|
-
inputSchema: { type: 'object', properties: {}, required: [] },
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
name: 'knowledge_search',
|
|
302
|
-
description: 'Search stored knowledge by keyword.',
|
|
303
|
-
inputSchema: {
|
|
304
|
-
type: 'object',
|
|
305
|
-
properties: { query: { type: 'string', description: 'Search query' } },
|
|
306
|
-
required: ['query'],
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
];
|
|
310
|
-
|
|
311
25
|
export function createAssistantExecutor(projectDir: string): ToolExecutor {
|
|
312
26
|
const mgr = getManager();
|
|
313
27
|
|
|
@@ -416,7 +130,7 @@ export function createAssistantExecutor(projectDir: string): ToolExecutor {
|
|
|
416
130
|
return { result: output.trim() || 'Validation complete.', isError: false };
|
|
417
131
|
}
|
|
418
132
|
case 'fw_diagram': {
|
|
419
|
-
const output = execFileSync('npx', ['flow-weaver', 'diagram', String(args.file)], {
|
|
133
|
+
const output = execFileSync('npx', ['flow-weaver', 'diagram', String(args.file), '--format', 'ascii-compact'], {
|
|
420
134
|
encoding: 'utf-8', cwd: projectDir, timeout: 15_000, stdio: ['pipe', 'pipe', 'pipe'],
|
|
421
135
|
});
|
|
422
136
|
return { result: output.trim(), isError: false };
|
|
@@ -458,8 +172,7 @@ export function createAssistantExecutor(projectDir: string): ToolExecutor {
|
|
|
458
172
|
case 'run_shell': {
|
|
459
173
|
const cmd = String(args.command);
|
|
460
174
|
// Safety: block destructive commands
|
|
461
|
-
|
|
462
|
-
if (blocked.some(b => cmd.includes(b))) {
|
|
175
|
+
if (isBlockedCommand(cmd)) {
|
|
463
176
|
return { result: `Blocked: "${cmd}" is not allowed.`, isError: true };
|
|
464
177
|
}
|
|
465
178
|
const output = execFileSync('sh', ['-c', cmd], {
|
|
@@ -504,7 +217,7 @@ export function createAssistantExecutor(projectDir: string): ToolExecutor {
|
|
|
504
217
|
|
|
505
218
|
case 'web_fetch': {
|
|
506
219
|
const url = String(args.url);
|
|
507
|
-
if (
|
|
220
|
+
if (isBlockedUrl(url)) {
|
|
508
221
|
return { result: 'Blocked: cannot fetch internal/localhost URLs.', isError: true };
|
|
509
222
|
}
|
|
510
223
|
const resp = await fetch(url, { method: (args.method as string) ?? 'GET', signal: AbortSignal.timeout(15_000) });
|
|
@@ -15,6 +15,7 @@ import * as os from 'node:os';
|
|
|
15
15
|
import * as crypto from 'node:crypto';
|
|
16
16
|
import type { AgentMessage } from '@synergenius/flow-weaver/agent';
|
|
17
17
|
import { withFileLock } from './file-lock.js';
|
|
18
|
+
import { CHARS_PER_TOKEN } from './safety.js';
|
|
18
19
|
|
|
19
20
|
export interface ConversationRecord {
|
|
20
21
|
id: string;
|
|
@@ -37,7 +38,6 @@ interface StoredMessage {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
const MAX_INDEX_SIZE = 20;
|
|
40
|
-
const CHARS_PER_TOKEN = 4;
|
|
41
41
|
|
|
42
42
|
export class ConversationStore {
|
|
43
43
|
private baseDir: string;
|