@arhen/pi-core-subagent 1.1.16 → 1.1.18
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 +1 -1
- package/package.json +1 -1
- package/src/index.ts +21 -9
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ Background + intercom:
|
|
|
100
100
|
| `send_agent_message` | message to a sibling subagent's mailbox (`to` = its task id, or `"leader"`) |
|
|
101
101
|
| `poll_agent_messages` | drain this subagent's mailbox |
|
|
102
102
|
|
|
103
|
-
## Peek — `/peek` or `ctrl+shift+
|
|
103
|
+
## Peek — `/peek` or `ctrl+shift+a`
|
|
104
104
|
|
|
105
105
|
Read-only pane over the session's subagents:
|
|
106
106
|
|
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.18",
|
|
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") {
|
|
@@ -1227,7 +1238,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
1227
1238
|
);
|
|
1228
1239
|
};
|
|
1229
1240
|
pi.registerCommand("peek", { description: "Peek at running subagents (↑↓ move, enter tails)", handler: (_args, ctx) => openPeek(ctx) });
|
|
1230
|
-
|
|
1241
|
+
// ctrl+shift+s belongs to pi-web-access (search curator); 'a' for agents is free.
|
|
1242
|
+
pi.registerShortcut("ctrl+shift+a", { description: "Peek at running subagents", handler: openPeek });
|
|
1231
1243
|
|
|
1232
1244
|
pi.on("agent_start", (_event, ctx) => {
|
|
1233
1245
|
if (!manager.turnActivity && !manager.hasActiveRun()) manager.clearWidget(ctx);
|