@synergenius/flow-weaver-pack-weaver 0.9.55 → 0.9.56
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/runner.d.ts.map +1 -1
- package/dist/bot/runner.js +35 -1
- package/dist/bot/runner.js.map +1 -1
- package/dist/bot/types.d.ts +4 -0
- package/dist/bot/types.d.ts.map +1 -1
- package/dist/docs/weaver-bot-usage.md +34 -0
- package/dist/docs/weaver-config.md +9 -15
- package/dist/docs/weaver-genesis.md +32 -0
- package/dist/docs/weaver-task-queue.md +34 -0
- package/dist/ui/bot-workspace.js +8 -3
- package/dist/ui/trace-to-timeline.d.ts +4 -0
- package/dist/ui/trace-to-timeline.d.ts.map +1 -1
- package/dist/ui/trace-to-timeline.js +1 -0
- package/dist/ui/trace-to-timeline.js.map +1 -1
- package/dist/ui/use-stream-timeline.d.ts.map +1 -1
- package/dist/ui/use-stream-timeline.js +4 -0
- package/dist/ui/use-stream-timeline.js.map +1 -1
- package/flowweaver.manifest.json +1 -1
- package/package.json +1 -1
- package/src/bot/runner.ts +37 -1
- package/src/bot/types.ts +1 -0
- package/src/ui/trace-to-timeline.ts +2 -0
- package/src/ui/use-stream-timeline.ts +6 -0
- package/dist/bot/agent-loop.d.ts +0 -20
- package/dist/bot/agent-loop.d.ts.map +0 -1
- package/dist/bot/agent-loop.js +0 -331
- package/dist/bot/agent-loop.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -749
- package/dist/cli.js.map +0 -1
- package/dist/templates/weaver-template.d.ts +0 -11
- package/dist/templates/weaver-template.d.ts.map +0 -1
- package/dist/templates/weaver-template.js +0 -53
- package/dist/templates/weaver-template.js.map +0 -1
- package/dist/workflows/weaver-bot-session.d.ts +0 -65
- package/dist/workflows/weaver-bot-session.d.ts.map +0 -1
- package/dist/workflows/weaver-bot-session.js +0 -68
- package/dist/workflows/weaver-bot-session.js.map +0 -1
- package/dist/workflows/weaver.d.ts +0 -24
- package/dist/workflows/weaver.d.ts.map +0 -1
- package/dist/workflows/weaver.js +0 -28
- package/dist/workflows/weaver.js.map +0 -1
package/src/bot/runner.ts
CHANGED
|
@@ -244,10 +244,40 @@ export async function runWorkflow(
|
|
|
244
244
|
} catch { /* non-fatal — live events will use code names */ }
|
|
245
245
|
|
|
246
246
|
// Always collect trace events for persistence; also forward to caller if provided.
|
|
247
|
-
// Track node start times so we can
|
|
247
|
+
// Track node start times and outputs so we can attach them on completion.
|
|
248
248
|
const nodeStartTimes = new Map<string, number>();
|
|
249
|
+
const nodeOutputs = new Map<string, Array<{ portLabel: string; value: unknown }>>();
|
|
250
|
+
|
|
251
|
+
/** Truncate a value to keep SSE payloads manageable. */
|
|
252
|
+
function truncateValue(value: unknown, maxLen = 1024): unknown {
|
|
253
|
+
if (typeof value === 'string' && value.length > maxLen) {
|
|
254
|
+
return value.slice(0, maxLen) + '…';
|
|
255
|
+
}
|
|
256
|
+
if (typeof value === 'object' && value !== null) {
|
|
257
|
+
const json = JSON.stringify(value);
|
|
258
|
+
if (json.length > maxLen) {
|
|
259
|
+
return JSON.parse(json.slice(0, maxLen - 20) + '"}') ?? json.slice(0, maxLen) + '…';
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return value;
|
|
263
|
+
}
|
|
249
264
|
|
|
250
265
|
const onTraceEvent = (traceEvent: { type: string; timestamp: number; data?: Record<string, unknown> }) => {
|
|
266
|
+
// Capture VARIABLE_SET events — these carry node output port values
|
|
267
|
+
if (traceEvent.type === 'VARIABLE_SET' && traceEvent.data) {
|
|
268
|
+
const ident = traceEvent.data.identifier as Record<string, unknown> | undefined;
|
|
269
|
+
if (ident) {
|
|
270
|
+
const nodeId = ident.id as string;
|
|
271
|
+
const portName = ident.portName as string;
|
|
272
|
+
if (nodeId && portName) {
|
|
273
|
+
const outputs = nodeOutputs.get(nodeId) ?? [];
|
|
274
|
+
outputs.push({ portLabel: portName, value: truncateValue(traceEvent.data.value) });
|
|
275
|
+
nodeOutputs.set(nodeId, outputs);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
251
281
|
if (traceEvent.type !== 'STATUS_CHANGED' || !traceEvent.data) return;
|
|
252
282
|
const nodeId = traceEvent.data.id as string | undefined;
|
|
253
283
|
const status = traceEvent.data.status as string | undefined;
|
|
@@ -272,6 +302,10 @@ export async function runWorkflow(
|
|
|
272
302
|
}
|
|
273
303
|
|
|
274
304
|
if (eventType) {
|
|
305
|
+
// Attach accumulated outputs on completion/error, then clear
|
|
306
|
+
const outputs = nodeOutputs.get(nodeId);
|
|
307
|
+
if (eventType !== 'node-start') nodeOutputs.delete(nodeId);
|
|
308
|
+
|
|
275
309
|
const event: ExecutionEvent = {
|
|
276
310
|
type: eventType,
|
|
277
311
|
nodeId,
|
|
@@ -279,12 +313,14 @@ export async function runWorkflow(
|
|
|
279
313
|
timestamp: traceEvent.timestamp,
|
|
280
314
|
durationMs,
|
|
281
315
|
error: traceEvent.data.error as string | undefined,
|
|
316
|
+
outputs: outputs && outputs.length > 0 ? outputs : undefined,
|
|
282
317
|
};
|
|
283
318
|
collectedTrace.push(event);
|
|
284
319
|
options?.onEvent?.(event);
|
|
285
320
|
const nodeLabel = nodeLabels.get(nodeId) ?? nodeLabels.get(event.nodeType ?? '') ?? undefined;
|
|
286
321
|
logEvent?.({ type: event.type, timestamp: event.timestamp, data: {
|
|
287
322
|
nodeId: event.nodeId, nodeType: event.nodeType, label: nodeLabel, durationMs: event.durationMs, error: event.error,
|
|
323
|
+
outputs: event.outputs,
|
|
288
324
|
}});
|
|
289
325
|
|
|
290
326
|
// Emit approval-needed when the approval gate starts
|
package/src/bot/types.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface HistoricalTraceEvent {
|
|
|
22
22
|
timestamp: number;
|
|
23
23
|
durationMs?: number;
|
|
24
24
|
error?: string;
|
|
25
|
+
outputs?: Array<{ portLabel: string; value: unknown }>;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export interface HistoricalStepLog {
|
|
@@ -111,6 +112,7 @@ export function traceToTimeline(run: HistoricalRun): TimelineEntry[] {
|
|
|
111
112
|
duration,
|
|
112
113
|
color: nm?.color,
|
|
113
114
|
icon: nm?.icon,
|
|
115
|
+
outputs: event.outputs && event.outputs.length > 0 ? event.outputs : undefined,
|
|
114
116
|
});
|
|
115
117
|
nodeStarts.delete(event.nodeId);
|
|
116
118
|
}
|
|
@@ -114,6 +114,8 @@ export function useStreamTimeline(events: StreamEvent[], isDone: boolean): Strea
|
|
|
114
114
|
(d.durationMs as number) ?? (startTs ? event.timestamp - startTs : undefined);
|
|
115
115
|
if (nodeId) nodeStarts.delete(nodeId);
|
|
116
116
|
|
|
117
|
+
const rawOutputs = d.outputs as Array<{ portLabel: string; value: unknown }> | undefined;
|
|
118
|
+
|
|
117
119
|
const completed: TimelineEntry = {
|
|
118
120
|
id: `s-${idCounter++}`,
|
|
119
121
|
timestamp: new Date(startTs ?? event.timestamp),
|
|
@@ -121,6 +123,7 @@ export function useStreamTimeline(events: StreamEvent[], isDone: boolean): Strea
|
|
|
121
123
|
nodeId,
|
|
122
124
|
label: (d.label as string) ?? (d.nodeType as string) ?? nodeId ?? 'Node',
|
|
123
125
|
duration,
|
|
126
|
+
outputs: rawOutputs && rawOutputs.length > 0 ? rawOutputs : undefined,
|
|
124
127
|
};
|
|
125
128
|
|
|
126
129
|
// Replace the node-started entry in-place
|
|
@@ -141,6 +144,8 @@ export function useStreamTimeline(events: StreamEvent[], isDone: boolean): Strea
|
|
|
141
144
|
(d.durationMs as number) ?? (startTs ? event.timestamp - startTs : undefined);
|
|
142
145
|
if (nodeId) nodeStarts.delete(nodeId);
|
|
143
146
|
|
|
147
|
+
const rawOutputs = d.outputs as Array<{ portLabel: string; value: unknown }> | undefined;
|
|
148
|
+
|
|
144
149
|
const failed: TimelineEntry = {
|
|
145
150
|
id: `s-${idCounter++}`,
|
|
146
151
|
timestamp: new Date(startTs ?? event.timestamp),
|
|
@@ -149,6 +154,7 @@ export function useStreamTimeline(events: StreamEvent[], isDone: boolean): Strea
|
|
|
149
154
|
label: (d.label as string) ?? (d.nodeType as string) ?? nodeId ?? 'Node',
|
|
150
155
|
detail: d.error as string | undefined,
|
|
151
156
|
duration,
|
|
157
|
+
outputs: rawOutputs && rawOutputs.length > 0 ? rawOutputs : undefined,
|
|
152
158
|
};
|
|
153
159
|
|
|
154
160
|
// Replace the node-started entry in-place
|
package/dist/bot/agent-loop.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool-use agent loop — Claude drives the entire task via tool calls.
|
|
3
|
-
*
|
|
4
|
-
* Instead of plan → execute → retry, the AI calls tools directly:
|
|
5
|
-
* validate → sees errors → read_file → sees code → patch_file → validate → done
|
|
6
|
-
*
|
|
7
|
-
* Supports two providers:
|
|
8
|
-
* - Anthropic API: direct streaming with tool_use blocks
|
|
9
|
-
* - Claude CLI: fallback via callCliAsync (no tool loop, uses --json-schema)
|
|
10
|
-
*/
|
|
11
|
-
import type { ProviderInfo, StepLogEntry } from './types.js';
|
|
12
|
-
export interface AgentLoopResult {
|
|
13
|
-
success: boolean;
|
|
14
|
-
summary: string;
|
|
15
|
-
filesModified: string[];
|
|
16
|
-
stepLog: StepLogEntry[];
|
|
17
|
-
toolCallCount: number;
|
|
18
|
-
}
|
|
19
|
-
export declare function runAgentLoop(pInfo: Pick<ProviderInfo, 'type' | 'apiKey' | 'model' | 'maxTokens'>, systemPrompt: string, taskPrompt: string, projectDir: string, maxIterations?: number): Promise<AgentLoopResult>;
|
|
20
|
-
//# sourceMappingURL=agent-loop.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../../src/bot/agent-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAqH7D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAaD,wBAAsB,YAAY,CAChC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC,EACpE,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,aAAa,SAAK,GACjB,OAAO,CAAC,eAAe,CAAC,CA8E1B"}
|
package/dist/bot/agent-loop.js
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool-use agent loop — Claude drives the entire task via tool calls.
|
|
3
|
-
*
|
|
4
|
-
* Instead of plan → execute → retry, the AI calls tools directly:
|
|
5
|
-
* validate → sees errors → read_file → sees code → patch_file → validate → done
|
|
6
|
-
*
|
|
7
|
-
* Supports two providers:
|
|
8
|
-
* - Anthropic API: direct streaming with tool_use blocks
|
|
9
|
-
* - Claude CLI: fallback via callCliAsync (no tool loop, uses --json-schema)
|
|
10
|
-
*/
|
|
11
|
-
import { executeStep } from './step-executor.js';
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
// Tool definitions
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
|
-
const TOOLS = [
|
|
16
|
-
{
|
|
17
|
-
name: 'validate',
|
|
18
|
-
description: 'Run flow-weaver validate on a workflow file. Returns JSON with errors and warnings. Use this FIRST to discover issues, and AFTER patching to confirm fixes.',
|
|
19
|
-
input_schema: { type: 'object', properties: { file: { type: 'string', description: 'Path to the workflow file to validate' } }, required: ['file'] },
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: 'read_file',
|
|
23
|
-
description: 'Read a file and return its full contents. Use this to understand file structure before patching.',
|
|
24
|
-
input_schema: { type: 'object', properties: { file: { type: 'string', description: 'Path to the file to read' } }, required: ['file'] },
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: 'patch_file',
|
|
28
|
-
description: 'Apply surgical find-and-replace patches to a file. Each patch must have exact "find" and "replace" strings. Preferred over write_file for modifications.',
|
|
29
|
-
input_schema: {
|
|
30
|
-
type: 'object',
|
|
31
|
-
properties: {
|
|
32
|
-
file: { type: 'string', description: 'Path to the file to patch' },
|
|
33
|
-
patches: {
|
|
34
|
-
type: 'array',
|
|
35
|
-
items: {
|
|
36
|
-
type: 'object',
|
|
37
|
-
properties: {
|
|
38
|
-
find: { type: 'string', description: 'Exact string to find' },
|
|
39
|
-
replace: { type: 'string', description: 'String to replace with' },
|
|
40
|
-
},
|
|
41
|
-
required: ['find', 'replace'],
|
|
42
|
-
},
|
|
43
|
-
description: 'Array of find/replace patches',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
required: ['file', 'patches'],
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'run_shell',
|
|
51
|
-
description: 'Execute a shell command and return output. Use for: npx flow-weaver validate, git status, etc. Blocked: rm -rf, git push, sudo.',
|
|
52
|
-
input_schema: { type: 'object', properties: { command: { type: 'string', description: 'Shell command to execute' } }, required: ['command'] },
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'list_files',
|
|
56
|
-
description: 'List files in a directory, optionally filtered by regex pattern.',
|
|
57
|
-
input_schema: {
|
|
58
|
-
type: 'object',
|
|
59
|
-
properties: {
|
|
60
|
-
directory: { type: 'string', description: 'Directory to list' },
|
|
61
|
-
pattern: { type: 'string', description: 'Optional regex filter pattern' },
|
|
62
|
-
},
|
|
63
|
-
required: ['directory'],
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'write_file',
|
|
68
|
-
description: 'Write content to a file (creates or overwrites). Use patch_file instead for modifications to existing files.',
|
|
69
|
-
input_schema: {
|
|
70
|
-
type: 'object',
|
|
71
|
-
properties: {
|
|
72
|
-
file: { type: 'string', description: 'Path to the file to write' },
|
|
73
|
-
content: { type: 'string', description: 'Complete file content' },
|
|
74
|
-
},
|
|
75
|
-
required: ['file', 'content'],
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
];
|
|
79
|
-
// ---------------------------------------------------------------------------
|
|
80
|
-
// Tool execution — delegates to step-executor with all safety guards
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
|
-
async function executeTool(name, args, projectDir) {
|
|
83
|
-
// Map tool names to step-executor operations
|
|
84
|
-
const operationMap = {
|
|
85
|
-
validate: 'run-shell',
|
|
86
|
-
read_file: 'read-file',
|
|
87
|
-
patch_file: 'patch-file',
|
|
88
|
-
run_shell: 'run-shell',
|
|
89
|
-
list_files: 'list-files',
|
|
90
|
-
write_file: 'write-file',
|
|
91
|
-
};
|
|
92
|
-
const operation = operationMap[name];
|
|
93
|
-
if (!operation) {
|
|
94
|
-
return { result: `Unknown tool: ${name}`, isError: true };
|
|
95
|
-
}
|
|
96
|
-
// Transform validate tool to run-shell with flow-weaver validate command
|
|
97
|
-
let stepArgs = { ...args };
|
|
98
|
-
if (name === 'validate') {
|
|
99
|
-
stepArgs = { command: `npx flow-weaver validate ${args.file} --json` };
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const result = await executeStep({ operation, args: stepArgs }, projectDir);
|
|
103
|
-
if (result.blocked) {
|
|
104
|
-
return { result: result.blockReason ?? 'Blocked by safety guard', isError: true };
|
|
105
|
-
}
|
|
106
|
-
return { result: result.output ?? 'Done', isError: false };
|
|
107
|
-
}
|
|
108
|
-
catch (err) {
|
|
109
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
110
|
-
return { result: msg, isError: true };
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export async function runAgentLoop(pInfo, systemPrompt, taskPrompt, projectDir, maxIterations = 15) {
|
|
114
|
-
if (pInfo.type !== 'anthropic' || !pInfo.apiKey) {
|
|
115
|
-
throw new Error('Agent loop requires Anthropic API provider with API key');
|
|
116
|
-
}
|
|
117
|
-
const messages = [{ role: 'user', content: taskPrompt }];
|
|
118
|
-
const filesModified = [];
|
|
119
|
-
const stepLog = [];
|
|
120
|
-
let toolCallCount = 0;
|
|
121
|
-
for (let iteration = 0; iteration < maxIterations; iteration++) {
|
|
122
|
-
// Call Anthropic API with streaming
|
|
123
|
-
const { text, toolCalls, finishReason } = await streamAnthropicWithTools(pInfo.apiKey, pInfo.model ?? 'claude-sonnet-4-20250514', systemPrompt, messages, pInfo.maxTokens ?? 8192);
|
|
124
|
-
// Add assistant response to history
|
|
125
|
-
if (toolCalls.length > 0) {
|
|
126
|
-
messages.push({ role: 'assistant', content: text || '', toolCalls });
|
|
127
|
-
}
|
|
128
|
-
else if (text) {
|
|
129
|
-
messages.push({ role: 'assistant', content: text });
|
|
130
|
-
}
|
|
131
|
-
// If no tool calls, we're done
|
|
132
|
-
if (finishReason !== 'tool_calls' || toolCalls.length === 0) {
|
|
133
|
-
return {
|
|
134
|
-
success: true,
|
|
135
|
-
summary: text || 'Task completed',
|
|
136
|
-
filesModified: [...new Set(filesModified)],
|
|
137
|
-
stepLog,
|
|
138
|
-
toolCallCount,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
// Execute tool calls and add results to history
|
|
142
|
-
for (const tc of toolCalls) {
|
|
143
|
-
toolCallCount++;
|
|
144
|
-
process.stderr.write(`\x1b[33m ⚡ ${tc.name}(${formatToolArgs(tc.arguments)})\x1b[0m\n`);
|
|
145
|
-
const { result, isError } = await executeTool(tc.name, tc.arguments, projectDir);
|
|
146
|
-
// Track files modified by patch_file and write_file
|
|
147
|
-
if ((tc.name === 'patch_file' || tc.name === 'write_file') && !isError && tc.arguments.file) {
|
|
148
|
-
filesModified.push(tc.arguments.file);
|
|
149
|
-
}
|
|
150
|
-
// Log step
|
|
151
|
-
stepLog.push({
|
|
152
|
-
step: `${tc.name}`,
|
|
153
|
-
status: isError ? 'error' : 'ok',
|
|
154
|
-
detail: isError ? result.slice(0, 200) : `${tc.name}(${formatToolArgs(tc.arguments)})`,
|
|
155
|
-
});
|
|
156
|
-
// Print result preview
|
|
157
|
-
const preview = result.slice(0, 150).replace(/\n/g, ' ');
|
|
158
|
-
const icon = isError ? '\x1b[31m ✗' : '\x1b[32m →';
|
|
159
|
-
process.stderr.write(`${icon} ${preview}\x1b[0m\n`);
|
|
160
|
-
// Add tool result to conversation
|
|
161
|
-
messages.push({
|
|
162
|
-
role: 'tool',
|
|
163
|
-
content: result.slice(0, 10000), // Cap tool result to prevent context overflow
|
|
164
|
-
toolCallId: tc.id,
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
success: false,
|
|
170
|
-
summary: `Reached max iterations (${maxIterations})`,
|
|
171
|
-
filesModified: [...new Set(filesModified)],
|
|
172
|
-
stepLog,
|
|
173
|
-
toolCallCount,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
function formatToolArgs(args) {
|
|
177
|
-
if (args.file)
|
|
178
|
-
return String(args.file).split('/').pop() ?? '';
|
|
179
|
-
if (args.command)
|
|
180
|
-
return String(args.command).slice(0, 60);
|
|
181
|
-
if (args.directory)
|
|
182
|
-
return String(args.directory);
|
|
183
|
-
return '';
|
|
184
|
-
}
|
|
185
|
-
// ---------------------------------------------------------------------------
|
|
186
|
-
// Anthropic streaming with tool support
|
|
187
|
-
// ---------------------------------------------------------------------------
|
|
188
|
-
async function streamAnthropicWithTools(apiKey, model, systemPrompt, messages, maxTokens) {
|
|
189
|
-
// Build Anthropic API request body
|
|
190
|
-
const apiMessages = messages.map((m) => {
|
|
191
|
-
if (m.role === 'tool') {
|
|
192
|
-
return {
|
|
193
|
-
role: 'user',
|
|
194
|
-
content: [{ type: 'tool_result', tool_use_id: m.toolCallId, content: m.content }],
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
if (m.role === 'assistant' && m.toolCalls?.length) {
|
|
198
|
-
const blocks = [];
|
|
199
|
-
if (m.content)
|
|
200
|
-
blocks.push({ type: 'text', text: m.content });
|
|
201
|
-
for (const tc of m.toolCalls) {
|
|
202
|
-
blocks.push({ type: 'tool_use', id: tc.id, name: tc.name, input: tc.arguments });
|
|
203
|
-
}
|
|
204
|
-
return { role: 'assistant', content: blocks };
|
|
205
|
-
}
|
|
206
|
-
return { role: m.role, content: m.content };
|
|
207
|
-
});
|
|
208
|
-
const body = JSON.stringify({
|
|
209
|
-
model,
|
|
210
|
-
max_tokens: maxTokens,
|
|
211
|
-
system: systemPrompt,
|
|
212
|
-
stream: true,
|
|
213
|
-
messages: apiMessages,
|
|
214
|
-
tools: TOOLS,
|
|
215
|
-
});
|
|
216
|
-
const response = await fetch('https://api.anthropic.com/v1/messages', {
|
|
217
|
-
method: 'POST',
|
|
218
|
-
headers: {
|
|
219
|
-
'x-api-key': apiKey,
|
|
220
|
-
'anthropic-version': '2025-04-15',
|
|
221
|
-
'content-type': 'application/json',
|
|
222
|
-
},
|
|
223
|
-
body,
|
|
224
|
-
signal: AbortSignal.timeout(300_000),
|
|
225
|
-
});
|
|
226
|
-
if (!response.ok) {
|
|
227
|
-
const err = await response.text();
|
|
228
|
-
throw new Error(`Anthropic API error ${response.status}: ${err.slice(0, 200)}`);
|
|
229
|
-
}
|
|
230
|
-
if (!response.body)
|
|
231
|
-
throw new Error('No response body');
|
|
232
|
-
// Parse SSE stream
|
|
233
|
-
const reader = response.body.getReader();
|
|
234
|
-
const decoder = new TextDecoder();
|
|
235
|
-
let buffer = '';
|
|
236
|
-
let textContent = '';
|
|
237
|
-
let finishReason = 'stop';
|
|
238
|
-
const toolCalls = [];
|
|
239
|
-
const activeToolUses = new Map();
|
|
240
|
-
let inThinking = false;
|
|
241
|
-
try {
|
|
242
|
-
while (true) {
|
|
243
|
-
const { done, value } = await reader.read();
|
|
244
|
-
if (done)
|
|
245
|
-
break;
|
|
246
|
-
buffer += decoder.decode(value, { stream: true });
|
|
247
|
-
const lines = buffer.split('\n');
|
|
248
|
-
buffer = lines.pop() || '';
|
|
249
|
-
for (const line of lines) {
|
|
250
|
-
if (!line.startsWith('data: '))
|
|
251
|
-
continue;
|
|
252
|
-
const jsonStr = line.slice(6).trim();
|
|
253
|
-
if (jsonStr === '[DONE]')
|
|
254
|
-
continue;
|
|
255
|
-
let event;
|
|
256
|
-
try {
|
|
257
|
-
event = JSON.parse(jsonStr);
|
|
258
|
-
}
|
|
259
|
-
catch {
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
const eventType = event.type;
|
|
263
|
-
if (eventType === 'content_block_start') {
|
|
264
|
-
const block = event.content_block;
|
|
265
|
-
const index = event.index;
|
|
266
|
-
if (block.type === 'tool_use' && block.id && block.name) {
|
|
267
|
-
activeToolUses.set(index, { id: block.id, name: block.name, jsonChunks: [] });
|
|
268
|
-
}
|
|
269
|
-
if (block.type === 'thinking') {
|
|
270
|
-
inThinking = true;
|
|
271
|
-
process.stderr.write('\x1b[90m thinking...');
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
if (eventType === 'content_block_delta') {
|
|
275
|
-
const delta = event.delta;
|
|
276
|
-
const index = event.index;
|
|
277
|
-
if (delta.type === 'text_delta' && delta.text) {
|
|
278
|
-
textContent += delta.text;
|
|
279
|
-
process.stderr.write(`\x1b[36m${delta.text}\x1b[0m`);
|
|
280
|
-
}
|
|
281
|
-
if (delta.type === 'thinking_delta' && delta.thinking) {
|
|
282
|
-
// Thinking — just show indicator, don't spam
|
|
283
|
-
}
|
|
284
|
-
if (delta.type === 'input_json_delta' && delta.partial_json !== undefined) {
|
|
285
|
-
const active = activeToolUses.get(index);
|
|
286
|
-
if (active)
|
|
287
|
-
active.jsonChunks.push(delta.partial_json);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (eventType === 'content_block_stop') {
|
|
291
|
-
const index = event.index;
|
|
292
|
-
if (inThinking) {
|
|
293
|
-
process.stderr.write('\x1b[0m\n');
|
|
294
|
-
inThinking = false;
|
|
295
|
-
}
|
|
296
|
-
const active = activeToolUses.get(index);
|
|
297
|
-
if (active) {
|
|
298
|
-
activeToolUses.delete(index);
|
|
299
|
-
let args = {};
|
|
300
|
-
try {
|
|
301
|
-
args = JSON.parse(active.jsonChunks.join(''));
|
|
302
|
-
}
|
|
303
|
-
catch { /* malformed */ }
|
|
304
|
-
toolCalls.push({ id: active.id, name: active.name, arguments: args });
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if (eventType === 'message_delta') {
|
|
308
|
-
const delta = event.delta;
|
|
309
|
-
if (delta.stop_reason === 'tool_use')
|
|
310
|
-
finishReason = 'tool_calls';
|
|
311
|
-
else if (delta.stop_reason === 'end_turn')
|
|
312
|
-
finishReason = 'stop';
|
|
313
|
-
else if (delta.stop_reason)
|
|
314
|
-
finishReason = delta.stop_reason;
|
|
315
|
-
}
|
|
316
|
-
if (eventType === 'error') {
|
|
317
|
-
const errObj = event.error;
|
|
318
|
-
throw new Error(`Anthropic stream error: ${errObj?.message ?? 'unknown'}`);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
finally {
|
|
324
|
-
reader.releaseLock();
|
|
325
|
-
}
|
|
326
|
-
// Newline after streamed text
|
|
327
|
-
if (textContent)
|
|
328
|
-
process.stderr.write('\n');
|
|
329
|
-
return { text: textContent, toolCalls, finishReason };
|
|
330
|
-
}
|
|
331
|
-
//# sourceMappingURL=agent-loop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-loop.js","sourceRoot":"","sources":["../../src/bot/agent-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AA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