pi-agent-flow 1.0.5 → 1.0.7

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.
@@ -2,7 +2,7 @@
2
2
  name: architect
3
3
  description: Plan structure, break down requirements, design solutions
4
4
  tools: read, bash, find, grep, ls
5
- maxDepth: 2
5
+ maxDepth: 0
6
6
  ---
7
7
 
8
8
  During this architect flow — your mission is to design. Be conservative: prefer existing patterns and proven conventions over novelty. The conversation history above provides background context; treat it as reference only and do not let it distract from your objective.
package/agents/code.md CHANGED
@@ -2,7 +2,7 @@
2
2
  name: code
3
3
  description: Implement features, fix bugs, write tests, deploy, and ship
4
4
  tools: read, write, edit, bash, find, grep, ls
5
- maxDepth: 2
5
+ maxDepth: 0
6
6
  ---
7
7
 
8
8
  During this code flow — your mission is to build and ship. Be a craftsman: verify first, then ship. The conversation history above provides background context; treat it as reference only and do not let it distract from your objective.
package/agents/review.md CHANGED
@@ -2,7 +2,7 @@
2
2
  name: review
3
3
  description: Audit security, quality, correctness
4
4
  tools: read, bash, find, grep, ls
5
- maxDepth: 2
5
+ maxDepth: 0
6
6
  ---
7
7
 
8
8
  During this review flow — your mission is to audit. Be adversarial: look for what others miss, but stay honest. The conversation history above provides background context; treat it as reference only and do not let it distract from your objective.
package/flow.ts CHANGED
@@ -49,7 +49,7 @@ function mergeStreamingUsage(
49
49
  ...actual,
50
50
  ...(estimatedOutputTokens > 0 ? { output: Math.max(actual.output, estimatedOutputTokens) } : {}),
51
51
  ...(ctxEstimate > 0 ? { contextTokens: Math.max(actual.contextTokens, ctxEstimate) } : {}),
52
- ...(smoothedTps > 0 ? { smoothedTps } : {}),
52
+ ...(smoothedTps > 0 ? { smoothedTps: Math.max(actual.smoothedTps ?? 0, smoothedTps) } : {}),
53
53
  };
54
54
  }
55
55
 
@@ -436,6 +436,15 @@ export async function runFlow(opts: RunFlowOptions): Promise<SingleResult> {
436
436
  });
437
437
 
438
438
  result.exitCode = exitCode;
439
+
440
+ // Persist final smoothed TPS into the result's usage so it survives after streaming ends.
441
+ // During streaming, emitUpdate() only merges smoothedTps into a temporary display object;
442
+ // without this, result.usage.smoothedTps stays at 0 and the UI shows a dash.
443
+ const finalSmoothedTps = drainSmoothedTps(result);
444
+ if (finalSmoothedTps > 0) {
445
+ result.usage.smoothedTps = finalSmoothedTps;
446
+ }
447
+
439
448
  return normalizeFlowResult(result, wasAborted);
440
449
  } finally {
441
450
  cleanupFlowTempDir(forkSessionTmpDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-flow",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Flow-state delegation extension for Pi coding agent.",
5
5
  "type": "module",
6
6
  "main": "index.ts",
package/runner-events.js CHANGED
@@ -52,7 +52,7 @@ export function drainStreamingText(result) {
52
52
  const CHARS_PER_TOKEN = 4;
53
53
 
54
54
  /** EMA smoothing factor for tokens-per-second (higher = more responsive). */
55
- const EMA_ALPHA = 0.3;
55
+ const EMA_ALPHA = 0.15;
56
56
 
57
57
  function getStreamingEstimate(result) {
58
58
  if (!Object.prototype.hasOwnProperty.call(result, "__streamingEstimate")) {