@d3ara1n/pi-subagent 1.5.0 → 1.5.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 +1 -1
- package/src/utils.test.ts +4 -7
- package/src/utils.ts +7 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d3ara1n/pi-subagent",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Role-based subagent orchestration for pi — delegates tasks to specialized pi child processes with configurable model roles",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/utils.test.ts
CHANGED
|
@@ -250,21 +250,18 @@ describe("previewArgs", () => {
|
|
|
250
250
|
test("command -> $ prefix", () => {
|
|
251
251
|
assert.equal(previewArgs({ command: "ls -la" }), "$ ls -la");
|
|
252
252
|
});
|
|
253
|
-
test("command
|
|
253
|
+
test("command is preserved for viewport-aware truncation", () => {
|
|
254
254
|
const long = "x".repeat(70);
|
|
255
|
-
|
|
256
|
-
assert.ok(r.startsWith("$ "));
|
|
257
|
-
assert.ok(r.endsWith("..."));
|
|
258
|
-
assert.ok(r.length < long.length);
|
|
255
|
+
assert.equal(previewArgs({ command: long }), `$ ${long}`);
|
|
259
256
|
});
|
|
260
257
|
test("file_path is shortened (home -> ~)", () => {
|
|
261
258
|
const r = previewArgs({ file_path: "/home/user/foo.ts" });
|
|
262
259
|
assert.ok(r.includes("foo.ts"));
|
|
263
260
|
});
|
|
264
|
-
test("url
|
|
261
|
+
test("url is preserved for viewport-aware truncation", () => {
|
|
265
262
|
assert.equal(previewArgs({ url: "https://example.com" }), "https://example.com");
|
|
266
263
|
const longUrl = "https://" + "x".repeat(70);
|
|
267
|
-
assert.
|
|
264
|
+
assert.equal(previewArgs({ url: longUrl }), longUrl);
|
|
268
265
|
});
|
|
269
266
|
test("query/pattern/regex/search -> /.../ form", () => {
|
|
270
267
|
assert.equal(previewArgs({ query: "foo" }), "/foo/");
|
package/src/utils.ts
CHANGED
|
@@ -149,8 +149,7 @@ export function formatToolCall(
|
|
|
149
149
|
}
|
|
150
150
|
case "bash": {
|
|
151
151
|
const command = (args.command as string) || "...";
|
|
152
|
-
|
|
153
|
-
return fg("muted", "$ ") + fg("toolOutput", preview);
|
|
152
|
+
return fg("muted", "$ ") + fg("toolOutput", command);
|
|
154
153
|
}
|
|
155
154
|
case "read": {
|
|
156
155
|
const rawPath = (args.file_path || args.path || "...") as string;
|
|
@@ -271,10 +270,8 @@ export function taskPreview(task: string): string {
|
|
|
271
270
|
* Width-aware collapsed-view component: renders each line truncated with "…"
|
|
272
271
|
* to the actual viewport width (never wraps), padded full-width like Text(0,0).
|
|
273
272
|
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* messages), which has no viewport semantics. This component is the TUI-side
|
|
277
|
-
* final guard, applied where the folding affordance exists.
|
|
273
|
+
* Content formatters leave tool-call arguments intact; this component is the
|
|
274
|
+
* TUI-side final guard, applied where the folding affordance exists.
|
|
278
275
|
*/
|
|
279
276
|
export function collapsedText(text: string): Component {
|
|
280
277
|
const lines = text.split("\n");
|
|
@@ -586,15 +583,14 @@ export function freezeFrame(r: SubagentResult): SubagentResult {
|
|
|
586
583
|
*/
|
|
587
584
|
export function previewArgs(args: Record<string, unknown>): string {
|
|
588
585
|
const command = args.command as string | undefined;
|
|
589
|
-
if (command) return `$ ${command
|
|
586
|
+
if (command) return `$ ${command}`;
|
|
590
587
|
const fp = (args.file_path || args.path) as string | undefined;
|
|
591
588
|
if (fp) return shortenPath(fp);
|
|
592
589
|
const url = args.url as string | undefined;
|
|
593
|
-
if (url) return url
|
|
590
|
+
if (url) return url;
|
|
594
591
|
const query = (args.query || args.pattern || args.regex || args.search) as string | undefined;
|
|
595
|
-
if (query) return `/${query
|
|
596
|
-
|
|
597
|
-
return argsStr.length > 50 ? argsStr.slice(0, 50) + "..." : argsStr;
|
|
592
|
+
if (query) return `/${query}/`;
|
|
593
|
+
return JSON.stringify(args);
|
|
598
594
|
}
|
|
599
595
|
|
|
600
596
|
// ── Numeric configuration ─────────────────────────────────────
|