@deathbeam/pi-delegate 0.0.35 → 0.0.37

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.
Files changed (3) hide show
  1. package/format.ts +6 -11
  2. package/index.ts +10 -5
  3. package/package.json +1 -1
package/format.ts CHANGED
@@ -47,12 +47,8 @@ export const STATUS_COLORS = {
47
47
  cancelled: "muted",
48
48
  interrupted: "warning",
49
49
  } as const satisfies Record<JobStatus, string>;
50
- /** Pi slices extension widgets at ten lines and appends its own truncation note. */
51
- const WIDGET_MAX_LINES = 10;
52
- /** Only a few jobs still fit with their tool-call and tool-result lines: 1 tally + 3 lines per job. */
53
- const WIDGET_MAX_DETAIL_JOBS = Math.floor((WIDGET_MAX_LINES - 1) / 3);
54
- /** In bulk, one row per job: 1 tally + N rows + 1 "more running" footer. */
55
- const WIDGET_MAX_JOBS = WIDGET_MAX_LINES - 2;
50
+ /** Each job takes up to 3 rows (job, tool call, tool result); older ones collapse into a footer. */
51
+ const WIDGET_MAX_JOBS = 5;
56
52
  export const COLLAPSED_OUTPUT_LINES = 10;
57
53
  const MAX_OUTPUT_BYTES = 50 * 1024;
58
54
  const EXPANDED_PAD = " ";
@@ -289,11 +285,10 @@ export function jobLine(info: { description?: string } & UsageInfo, elapsedMs: n
289
285
  return [info.description?.trim(), usageStats(info, elapsedMs)].filter(Boolean).join(" · ");
290
286
  }
291
287
 
292
- /** Omit detail rows in bulk so Pi's ten-line widget cap cannot split jobs. */
293
- export function widgetJobs<T>(jobs: T[]): { shown: T[]; hidden: number; detail: boolean } {
294
- const detail = jobs.length <= WIDGET_MAX_DETAIL_JOBS;
295
- const shown = detail ? jobs : jobs.slice(-WIDGET_MAX_JOBS);
296
- return { shown, hidden: jobs.length - shown.length, detail };
288
+ /** Shows the newest jobs; the rest are counted in a "more running" footer. */
289
+ export function widgetJobs<T>(jobs: T[]): { shown: T[]; hidden: number } {
290
+ const shown = jobs.slice(-WIDGET_MAX_JOBS);
291
+ return { shown, hidden: jobs.length - shown.length };
297
292
  }
298
293
 
299
294
  export type DelegateDetails = Pick<
package/index.ts CHANGED
@@ -152,7 +152,7 @@ export default function (pi: ExtensionAPI) {
152
152
  }
153
153
  const theme = ctx.ui.theme;
154
154
  const now = Date.now();
155
- const { shown, hidden, detail } = widgetJobs(jobs);
155
+ const { shown, hidden } = widgetJobs(jobs);
156
156
  const lines: string[] = [];
157
157
  const all = store.all();
158
158
  const counts = tally(jobs.length, all, now);
@@ -161,7 +161,6 @@ export default function (pi: ExtensionAPI) {
161
161
  lines.push(
162
162
  `${statusText(theme, "running", now)} ${jobIdentity(theme, job)} ${theme.fg("muted", jobLine(job, elapsedMs(job, now)))}`,
163
163
  );
164
- if (!detail) continue;
165
164
  const { tool, result } = lastToolCall(job);
166
165
  if (tool)
167
166
  lines.push(
@@ -172,8 +171,14 @@ export default function (pi: ExtensionAPI) {
172
171
  ` ${theme.fg("muted", "↳")} ${theme.fg(result.isError ? "error" : "toolOutput", result.text)}`,
173
172
  );
174
173
  }
175
- if (hidden) lines.push(` ${theme.fg("muted", `… ${hidden} more running`)}`);
176
- ctx.ui.setWidget(WIDGET_KEY, lines);
174
+ if (hidden) lines.push(` ${theme.fg("muted", `… ${hidden} more running · /delegate to view all`)}`);
175
+
176
+ // A component factory, because Pi cuts string-array widgets at ten lines.
177
+ ctx.ui.setWidget(WIDGET_KEY, () => {
178
+ const container = new Container();
179
+ for (const line of lines) container.addChild(new Text(line, 1, 0));
180
+ return container;
181
+ });
177
182
  };
178
183
 
179
184
  // The ticker animates spinners exactly while live jobs exist.
@@ -278,7 +283,7 @@ export default function (pi: ExtensionAPI) {
278
283
  if (isolation)
279
284
  args.push(
280
285
  "--append-system-prompt",
281
- `You are working in an isolated git clone at ${isolation.clone}. Your working directory is ${cwd}; run every command from it with relative paths. Any path under ${ctx.cwd} means the same file under ${cwd}. Your edits and commits stay in this clone until the orchestrator applies them.${tools.includes("bash") ? " `git diff main-snapshot` shows every change made in this clone." : ""}`,
286
+ `You are working in an isolated git clone at ${isolation.clone}. Your working directory is ${cwd}; run every command from it with relative paths. Any path under ${ctx.cwd} means the same file under ${cwd}. Your edits stay in this clone until the orchestrator applies them.${tools.includes("bash") ? " Git commands that write, such as commit and rebase, work here and change only this clone. `git diff main-snapshot` shows every change made in it." : ""}`,
282
287
  );
283
288
  const child = spawn(process.execPath, [entrypoint, "--mode", "rpc", ...args], {
284
289
  cwd,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deathbeam/pi-delegate",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "Minimal extension for delegating tasks to subagents.",
5
5
  "type": "module",
6
6
  "license": "MIT",