@arhen/pi-core-subagent 1.1.16 → 1.1.17
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/index.ts +19 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arhen/pi-core-subagent",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "pi extension: fast in-process subagents with single/parallel/chain, background runs, intercom and agent-to-agent mailbox. Leader defines agents inline.",
|
|
6
6
|
"license": "MIT",
|
package/src/index.ts
CHANGED
|
@@ -241,14 +241,25 @@ function themedTaskLine(task: TaskSnapshot, theme: Theme, activity = ""): string
|
|
|
241
241
|
}
|
|
242
242
|
return `${statusIcon(task.status)} ${task.agent} · ${activity}${colorNums(theme.fg("muted", tail), theme)}`;
|
|
243
243
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
244
|
+
/**
|
|
245
|
+
* Human-readable activity line: "Read src/index.ts", "Grep wrapSingleLine".
|
|
246
|
+
* ponytail: picks the first interesting string arg instead of a per-tool table —
|
|
247
|
+
* unknown/custom tools then read fine too. Add a case only if one reads badly.
|
|
248
|
+
*/
|
|
249
|
+
// Order matters: the most specific arg wins (grep's pattern beats its path).
|
|
250
|
+
const ARG_KEYS = ["pattern", "query", "command", "path", "file_path", "filePath", "url", "name", "subject", "task"];
|
|
251
|
+
export function describeCall(toolName: string, args: unknown, cwd?: string): string {
|
|
252
|
+
const verb = toolName.charAt(0).toUpperCase() + toolName.slice(1);
|
|
253
|
+
const obj = args && typeof args === "object" ? (args as Record<string, unknown>) : undefined;
|
|
254
|
+
if (!obj) return verb;
|
|
255
|
+
let value = ARG_KEYS.map((k) => obj[k]).find((v) => typeof v === "string" && v.trim() !== "") as string | undefined;
|
|
256
|
+
if (value === undefined) {
|
|
257
|
+
value = Object.values(obj).find((v) => typeof v === "string" && v.trim() !== "") as string | undefined;
|
|
251
258
|
}
|
|
259
|
+
if (value === undefined) return verb;
|
|
260
|
+
let text = value.replace(/\s+/g, " ").trim();
|
|
261
|
+
if (cwd && text.startsWith(`${cwd}/`)) text = text.slice(cwd.length + 1); // absolute paths inside the task cwd read as noise
|
|
262
|
+
return `${verb} ${text.length > 60 ? `${text.slice(0, 60)}…` : text}`;
|
|
252
263
|
}
|
|
253
264
|
function activitySnippet(text: string): string {
|
|
254
265
|
const flat = text.replace(/\s+/g, " ").trim();
|
|
@@ -788,7 +799,7 @@ class SubagentManager {
|
|
|
788
799
|
this.emit("subagent:session-event", { runId: run.id, taskId: task.id, seq: eventSeq++, event: { type: event.type } });
|
|
789
800
|
}
|
|
790
801
|
if (event.type === "tool_execution_start") {
|
|
791
|
-
this.updateTask(run, task, { toolCalls: task.toolCalls + 1, lastActivity:
|
|
802
|
+
this.updateTask(run, task, { toolCalls: task.toolCalls + 1, lastActivity: describeCall(event.toolName, event.args, task.cwd) }, ctx, onUpdate);
|
|
792
803
|
} else if (event.type === "tool_execution_end") {
|
|
793
804
|
this.scheduleWidget(run, ctx, onUpdate);
|
|
794
805
|
} else if (event.type === "message_end") {
|