@synergenius/flow-weaver 0.22.7 → 0.22.8

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.
@@ -30,6 +30,8 @@ export async function runAgentLoop(provider, tools, executor, messages, options)
30
30
  model: options?.model,
31
31
  maxTokens: options?.maxTokens,
32
32
  signal,
33
+ executor,
34
+ onToolEvent,
33
35
  });
34
36
  for await (const event of stream) {
35
37
  onStreamEvent?.(event);
@@ -51,6 +53,10 @@ export async function runAgentLoop(provider, tools, executor, messages, options)
51
53
  });
52
54
  activeToolNames.delete(event.id);
53
55
  break;
56
+ case 'tool_result':
57
+ // CLI handled tool internally via MCP — count it
58
+ toolCallCount++;
59
+ break;
54
60
  case 'usage':
55
61
  totalPromptTokens += event.promptTokens;
56
62
  totalCompletionTokens += event.completionTokens;
@@ -23,7 +23,7 @@ export class ClaudeCliProvider {
23
23
  this.model = options.model;
24
24
  this.mcpConfigPath = options.mcpConfigPath;
25
25
  this.spawnFn = options.spawnFn ?? ((cmd, args, opts) => nodeSpawn(cmd, args, { ...opts, stdio: opts.stdio }));
26
- this.timeout = options.timeout ?? 120_000;
26
+ this.timeout = options.timeout ?? 600_000;
27
27
  }
28
28
  async *stream(messages, tools, options) {
29
29
  const model = options?.model ?? this.model;
@@ -34,11 +34,10 @@ export class ClaudeCliProvider {
34
34
  let bridge = null;
35
35
  let mcpConfigPath = this.mcpConfigPath;
36
36
  if (tools.length > 0 && !mcpConfigPath) {
37
- // Create a temporary bridge tool execution is handled by the agent loop,
38
- // but we still need to advertise tool definitions to the CLI via MCP.
39
- // The bridge executor won't be called because the CLI handles its own tool
40
- // loop internally when using MCP tools.
41
- bridge = await createMcpBridge(tools, async () => ({ result: 'Not implemented', isError: true }));
37
+ // Create MCP bridge with real executor so CLI tool calls go through our
38
+ // safety guards (path traversal, shrink detection, shell blocklist, etc.)
39
+ const executor = options?.executor ?? (async () => ({ result: 'Tool executor not provided', isError: true }));
40
+ bridge = await createMcpBridge(tools, executor, options?.onToolEvent);
42
41
  mcpConfigPath = bridge.configPath;
43
42
  }
44
43
  const args = [
@@ -70,10 +69,11 @@ export class ClaudeCliProvider {
70
69
  }, 2000);
71
70
  }, { once: true });
72
71
  }
73
- // Timeout
72
+ // Timeout — per-request override or provider default
73
+ const timeout = options?.timeout ?? this.timeout;
74
74
  const timer = setTimeout(() => {
75
75
  child.kill('SIGTERM');
76
- }, this.timeout);
76
+ }, timeout);
77
77
  child.stdin.write(prompt);
78
78
  child.stdin.end();
79
79
  // Collect events from the parser
@@ -70,6 +70,12 @@ export interface StreamOptions {
70
70
  model?: string;
71
71
  maxTokens?: number;
72
72
  signal?: AbortSignal;
73
+ /** Tool executor for providers that handle tool loops internally (e.g. CLI via MCP). */
74
+ executor?: ToolExecutor;
75
+ /** Event callback for tool events from internal tool loops. */
76
+ onToolEvent?: (event: ToolEvent) => void;
77
+ /** Per-request timeout in milliseconds (overrides provider default). */
78
+ timeout?: number;
73
79
  }
74
80
  export interface AgentProvider {
75
81
  stream(messages: AgentMessage[], tools: ToolDefinition[], options?: StreamOptions): AsyncGenerator<StreamEvent>;
@@ -9886,7 +9886,7 @@ var VERSION;
9886
9886
  var init_generated_version = __esm({
9887
9887
  "src/generated-version.ts"() {
9888
9888
  "use strict";
9889
- VERSION = "0.22.7";
9889
+ VERSION = "0.22.8";
9890
9890
  }
9891
9891
  });
9892
9892
 
@@ -94939,7 +94939,7 @@ var {
94939
94939
  // src/cli/index.ts
94940
94940
  init_logger();
94941
94941
  init_error_utils();
94942
- var version2 = true ? "0.22.7" : "0.0.0-dev";
94942
+ var version2 = true ? "0.22.8" : "0.0.0-dev";
94943
94943
  var program2 = new Command();
94944
94944
  program2.name("fw").description("Flow Weaver Annotations - Compile and validate workflow files").option("-v, --version", "Output the current version").option("--no-color", "Disable colors").option("--color", "Force colors").on("option:version", () => {
94945
94945
  logger.banner(version2);
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.22.7";
1
+ export declare const VERSION = "0.22.8";
2
2
  //# sourceMappingURL=generated-version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.ts — do not edit manually
2
- export const VERSION = '0.22.7';
2
+ export const VERSION = '0.22.8';
3
3
  //# sourceMappingURL=generated-version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.22.7",
3
+ "version": "0.22.8",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",