pi-agent-flow 1.1.0 → 1.2.0
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/README.md +158 -44
- package/agents/audit.md +37 -17
- package/agents/build.md +42 -38
- package/agents/craft.md +33 -17
- package/agents/debug.md +32 -15
- package/agents/ideas.md +33 -11
- package/agents/scout.md +32 -12
- package/package.json +4 -15
- package/{agents.ts → src/agents.ts} +10 -4
- package/src/ambient.d.ts +85 -0
- package/{batch.ts → src/batch.ts} +256 -118
- package/src/cli-args.ts +283 -0
- package/src/config.ts +305 -0
- package/{flow.ts → src/flow.ts} +39 -18
- package/{hooks.ts → src/hooks.ts} +6 -6
- package/{index.ts → src/index.ts} +361 -102
- package/{render-utils.ts → src/render-utils.ts} +2 -2
- package/{render.ts → src/render.ts} +15 -10
- package/src/runner-events.ts +692 -0
- package/{types.ts → src/types.ts} +2 -0
- package/config.ts +0 -102
- package/runner-cli.js +0 -254
- package/runner-events.js +0 -559
- /package/{web-tool.ts → src/web-tool.ts} +0 -0
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
isFlowError,
|
|
23
23
|
isFlowSuccess,
|
|
24
24
|
} from "./types.js";
|
|
25
|
-
import { formatCompactStats, formatFlowTypeName, truncateChars, contentBudget } from "./render-utils.js";
|
|
25
|
+
import { formatCompactStats, formatFlowTypeName, truncateChars, tailText, contentBudget } from "./render-utils.js";
|
|
26
26
|
|
|
27
27
|
function shortenPath(p: string): string {
|
|
28
28
|
const home = os.homedir();
|
|
@@ -66,9 +66,10 @@ function formatFlowToolCall(toolName: string, args: Record<string, unknown>, fg:
|
|
|
66
66
|
return fg("muted", "find ") + fg("accent", (args.pattern || "*") as string) + fg("dim", ` in ${shortenPath((args.path || ".") as string)}`);
|
|
67
67
|
case "grep":
|
|
68
68
|
return fg("muted", "grep ") + fg("accent", `/${(args.pattern || "") as string}/`) + fg("dim", ` in ${shortenPath((args.path || ".") as string)}`);
|
|
69
|
-
case "batch":
|
|
69
|
+
case "batch":
|
|
70
|
+
case "batch_read": {
|
|
70
71
|
const ops = Array.isArray(args.o) ? args.o : Array.isArray(args.op) ? args.op : Array.isArray(args.operations) ? args.operations : Array.isArray(args) ? args : [];
|
|
71
|
-
if (ops.length === 0) return fg("muted",
|
|
72
|
+
if (ops.length === 0) return fg("muted", `${toolName} (empty)`);
|
|
72
73
|
const parts: string[] = [];
|
|
73
74
|
for (const op of ops) {
|
|
74
75
|
const opObj = op as Record<string, unknown>;
|
|
@@ -84,7 +85,7 @@ function formatFlowToolCall(toolName: string, args: Record<string, unknown>, fg:
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
const summary = parts.length <= 3 ? parts.join(", ") : `${parts.slice(0, 2).join(", ")} +${parts.length - 2} more`;
|
|
87
|
-
return fg("muted",
|
|
88
|
+
return fg("muted", `${toolName} `) + fg("accent", summary);
|
|
88
89
|
}
|
|
89
90
|
default:
|
|
90
91
|
return fg("accent", toolName) + fg("dim", ` ${JSON.stringify(args)}`);
|
|
@@ -290,11 +291,14 @@ function renderFlowCollapsed(
|
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
// msg: line (last assistant text or streaming)
|
|
293
|
-
if (
|
|
294
|
-
const logContent =
|
|
294
|
+
if (r.exitCode === -1 && streamingText) {
|
|
295
|
+
const logContent = tailText(streamingText, contentBudget(10));
|
|
296
|
+
container.addChild(new TruncatedText(`${theme.fg("dim", "└─ msg:")} ${theme.fg("dim", logContent)}`, 0, 0));
|
|
297
|
+
} else if (flowOutput) {
|
|
298
|
+
const logContent = tailText(flowOutput, contentBudget(10));
|
|
295
299
|
container.addChild(new TruncatedText(`${theme.fg("dim", "└─ msg:")} ${theme.fg("dim", logContent)}`, 0, 0));
|
|
296
300
|
} else if (streamingText) {
|
|
297
|
-
const logContent =
|
|
301
|
+
const logContent = tailText(streamingText, contentBudget(10));
|
|
298
302
|
container.addChild(new TruncatedText(`${theme.fg("dim", "└─ msg:")} ${theme.fg("dim", logContent)}`, 0, 0));
|
|
299
303
|
} else if (error && r.errorMessage) {
|
|
300
304
|
const logContent = truncateChars(r.errorMessage, contentBudget(10));
|
|
@@ -421,10 +425,11 @@ function renderActivityPanel(
|
|
|
421
425
|
container.addChild(new TruncatedText(`${theme.fg("dim", indent + "├─ " + actPrefix)}${actContent}`, 0, 0));
|
|
422
426
|
}
|
|
423
427
|
|
|
424
|
-
// msg: line (last assistant text)
|
|
425
|
-
const
|
|
428
|
+
// msg: line (live streaming text or last assistant text)
|
|
429
|
+
const liveText = r.exitCode === -1 ? r.streamingText : undefined;
|
|
430
|
+
const lastText = liveText || getLastAssistantText(r.messages);
|
|
426
431
|
if (lastText) {
|
|
427
|
-
const logContent =
|
|
432
|
+
const logContent = tailText(lastText, contentBudget(10));
|
|
428
433
|
container.addChild(new TruncatedText(`${theme.fg("dim", indent + "└─ msg:")} ${theme.fg("dim", logContent)}`, 0, 0));
|
|
429
434
|
} else if (error && r.errorMessage) {
|
|
430
435
|
const logContent = truncateChars(r.errorMessage, contentBudget(10));
|