@synergenius/flow-weaver 0.26.3 → 0.26.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.
@@ -20,9 +20,20 @@
20
20
  * 4. The CLI uses NDJSON for MCP stdio transport (not Content-Length framing).
21
21
  */
22
22
  import { randomUUID } from 'node:crypto';
23
+ import { readFileSync } from 'node:fs';
24
+ import { resolve, dirname } from 'node:path';
23
25
  import { spawn as nodeSpawn } from 'node:child_process';
26
+ import { fileURLToPath } from 'node:url';
24
27
  import { StreamJsonParser } from './streaming.js';
25
28
  const DEFAULT_IDLE_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes
29
+ // Package version included in session fingerprint so cached sessions
30
+ // auto-invalidate when the core is updated (e.g. npm update).
31
+ let CORE_VERSION = 'unknown';
32
+ try {
33
+ const pkgPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
34
+ CORE_VERSION = JSON.parse(readFileSync(pkgPath, 'utf-8')).version;
35
+ }
36
+ catch { /* non-fatal */ }
26
37
  export class CliSession {
27
38
  sessionId = randomUUID();
28
39
  child = null;
@@ -173,15 +184,16 @@ export class CliSession {
173
184
  }) + '\n';
174
185
  // Track whether this turn saw a 'result' event (definitive turn end)
175
186
  let sawResult = false;
176
- // Wrap pushEvent to detect result-driven message_stop as turn end
187
+ // Wrap pushEvent to suppress intermediate message_stop events.
188
+ // The CLI emits message_stop for each API turn, but the session's turn
189
+ // boundary is the `result` event. Intermediate message_stop events would
190
+ // cause runAgentLoop to exit early (thinking the model stopped), missing
191
+ // later events including the result's usage with total_cost_usd.
177
192
  const originalPush = this.pushEvent.bind(this);
178
193
  this.parser = new StreamJsonParser((event) => {
179
- // The result event emits message_stop — but in session mode,
180
- // we need to detect it as the turn boundary
181
194
  if (event.type === 'message_stop' && !sawResult) {
182
- // This is a stream_event message_stop (API turn), not CLI turn end.
183
- // Push it but don't complete the turn.
184
- originalPush(event);
195
+ // Suppress not the real turn end. The result event will emit
196
+ // the final message_stop after all usage data is captured.
185
197
  return;
186
198
  }
187
199
  originalPush(event);
@@ -277,6 +289,7 @@ export class CliSession {
277
289
  */
278
290
  static fingerprint(options) {
279
291
  return JSON.stringify({
292
+ _coreVersion: CORE_VERSION, // auto-invalidate cache on core update
280
293
  model: options.model,
281
294
  mcpConfigPath: options.mcpConfigPath,
282
295
  strictMcpConfig: options.strictMcpConfig,
@@ -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.26.3";
9889
+ VERSION = "0.26.5";
9890
9890
  }
9891
9891
  });
9892
9892
 
@@ -95973,7 +95973,7 @@ function parseIntStrict(value) {
95973
95973
  // src/cli/index.ts
95974
95974
  init_logger();
95975
95975
  init_error_utils();
95976
- var version2 = true ? "0.26.3" : "0.0.0-dev";
95976
+ var version2 = true ? "0.26.5" : "0.0.0-dev";
95977
95977
  var program2 = new Command();
95978
95978
  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", () => {
95979
95979
  logger.banner(version2);
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.26.3";
1
+ export declare const VERSION = "0.26.5";
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.26.3';
2
+ export const VERSION = '0.26.5';
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.26.3",
3
+ "version": "0.26.5",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",