pi-agent-flow 1.8.0 → 1.8.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-flow",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Flow-state delegation extension for Pi coding agent.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/index.ts CHANGED
@@ -634,7 +634,7 @@ function sanitizeForkSnapshot(snapshot: string | null, cache: Map<string, Compre
634
634
 
635
635
  function computeActiveTools(optimize: boolean): string[] {
636
636
  return optimize
637
- ? ["batch_read", "batch", "batch_bash_poll", "flow"]
637
+ ? ["batch_read", "batch_bash_poll", "flow"]
638
638
  : ["read", "write", "edit", "batch", "bash", "flow", "web"];
639
639
  }
640
640
 
@@ -51,13 +51,16 @@ export function formatCompactStats(
51
51
  usage: Partial<UsageStats>,
52
52
  model?: string,
53
53
  maxWidth?: number,
54
- options: { skipTokens?: boolean } = {},
54
+ options: { skipTokens?: boolean; skipContext?: boolean; hideModel?: boolean } = {},
55
55
  ): string {
56
56
  const tokenParts = [`↑ ${formatFixedTokens(usage.input || 0)}`, `↓ ${formatFixedTokens(usage.output || 0)}`];
57
- const runtimeParts = [`tps: ${formatTps(usage.smoothedTps)}`, `ctx: ${formatFixedTokens(usage.contextTokens || 0)}`];
57
+ let runtimeParts = [`tps: ${formatTps(usage.smoothedTps)}`];
58
+ if (!options.skipContext) {
59
+ runtimeParts.push(`ctx: ${formatFixedTokens(usage.contextTokens || 0)}`);
60
+ }
58
61
  const parts = options.skipTokens ? runtimeParts : [...tokenParts, ...runtimeParts];
59
62
 
60
- const displayModel = model ? model.replace(/^[^/]+\//, "") : undefined;
63
+ const displayModel = options.hideModel ? undefined : (model ? model.replace(/^[^/]+\//, "") : undefined);
61
64
  let result = parts.join(" · ") + (displayModel ? ` · ${displayModel}` : "");
62
65
  if (maxWidth && visibleLength(result) > maxWidth) {
63
66
  // Drop model first.
package/src/render.ts CHANGED
@@ -325,9 +325,10 @@ function renderFlowCollapsed(
325
325
  ): Container {
326
326
  const container = new Container();
327
327
  const maxWidth = process.stdout.columns ?? 80;
328
- const stats = formatCompactStats(r.usage, r.model, maxWidth, { skipTokens: true });
328
+ const stats = formatCompactStats(r.usage, r.model, maxWidth, { skipTokens: true, skipContext: true, hideModel: true });
329
329
  const typeName = formatCollapsedFlowHeaderTypeName(r.type);
330
- let header = `${theme.fg("accent", theme.bold(typeName))}${theme.fg("dim", ${stats}`)}`;
330
+ const modelLabel = r.model ? r.model.replace(/^[^/]+\//, "") : "";
331
+ let header = `${theme.fg("accent", theme.bold(typeName))}${theme.fg("dim", modelLabel ? ` ${modelLabel} - ` : " ")}${theme.fg("dim", stats)}`;
331
332
  if (error && r.stopReason) header += ` ${theme.fg("error", `[${r.stopReason}]`)}`;
332
333
  container.addChild(new TruncatedText(header, 0, 0));
333
334
 
@@ -457,13 +458,14 @@ function renderActivityPanel(
457
458
  for (let i = 0; i < results.length; i++) {
458
459
  const r = results[i];
459
460
  const isLast = i === results.length - 1;
460
- const stats = formatCompactStats(r.usage, r.model, maxWidth, { skipTokens: true });
461
+ const stats = formatCompactStats(r.usage, r.model, maxWidth, { skipTokens: true, skipContext: true, hideModel: true });
461
462
  const error = isFlowError(r);
462
463
  const typeName = formatCollapsedFlowHeaderTypeName(r.type);
463
464
 
464
465
  // Header line
465
466
  const headerPrefix = isLast ? "└─" : "├─";
466
- let headerLine = `${theme.fg("dim", headerPrefix)} ${theme.fg("accent", theme.bold(typeName))}${theme.fg("dim", `· ${stats}`)}`;
467
+ const modelLabel = r.model ? r.model.replace(/^[^/]+\//, "") : "";
468
+ let headerLine = `${theme.fg("dim", headerPrefix)} ${theme.fg("accent", theme.bold(typeName))}${theme.fg("dim", modelLabel ? ` ${modelLabel} - ` : " ")}${theme.fg("dim", stats)}`;
467
469
  if (error && r.stopReason) {
468
470
  headerLine += ` ${theme.fg("error", `[${r.stopReason}]`)}`;
469
471
  }