pi-better-harness 0.3.18 → 0.3.20

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 (37) hide show
  1. package/node_modules/pi-better-background-tasks/package.json +1 -1
  2. package/node_modules/pi-better-background-tasks/src/shared-navigator.ts +67 -0
  3. package/node_modules/pi-better-plan/package.json +1 -1
  4. package/node_modules/pi-better-plan/src/plan-presentation.ts +0 -1
  5. package/node_modules/pi-better-subagents/README.md +1 -1
  6. package/node_modules/pi-better-subagents/agent-commands.ts +711 -0
  7. package/node_modules/pi-better-subagents/agent-inspection.ts +408 -0
  8. package/node_modules/pi-better-subagents/agent-operations.ts +56 -0
  9. package/node_modules/pi-better-subagents/agents-catalog-tool.ts +102 -0
  10. package/node_modules/pi-better-subagents/batch.mjs +20 -0
  11. package/node_modules/pi-better-subagents/catalog-identity.ts +258 -0
  12. package/node_modules/pi-better-subagents/catalog-resolver.ts +460 -0
  13. package/node_modules/pi-better-subagents/catalog-runtime.ts +576 -0
  14. package/node_modules/pi-better-subagents/catalog-schema.ts +1426 -0
  15. package/node_modules/pi-better-subagents/catalog-store.ts +787 -0
  16. package/node_modules/pi-better-subagents/codex-import.ts +717 -0
  17. package/node_modules/pi-better-subagents/config.ts +15 -0
  18. package/node_modules/pi-better-subagents/docs/agent-catalog-acceptance.md +89 -0
  19. package/node_modules/pi-better-subagents/docs/agent-catalog-lifecycle.md +39 -0
  20. package/node_modules/pi-better-subagents/docs/agent-catalog-operations.md +68 -0
  21. package/node_modules/pi-better-subagents/docs/agent-catalog.md +145 -0
  22. package/node_modules/pi-better-subagents/docs/agent-model-resolution.md +85 -0
  23. package/node_modules/pi-better-subagents/index.ts +249 -12
  24. package/node_modules/pi-better-subagents/model-resolution.ts +1071 -0
  25. package/node_modules/pi-better-subagents/navigator.mjs +3 -0
  26. package/node_modules/pi-better-subagents/package.json +12 -2
  27. package/node_modules/pi-better-subagents/registry.ts +630 -6
  28. package/node_modules/pi-better-subagents/role-assignment.ts +141 -0
  29. package/node_modules/pi-better-subagents/roles/role.architect.md +13 -0
  30. package/node_modules/pi-better-subagents/roles/role.developer.md +13 -0
  31. package/node_modules/pi-better-subagents/roles/role.explorer.md +14 -0
  32. package/node_modules/pi-better-subagents/roles/role.product-manager.md +14 -0
  33. package/node_modules/pi-better-subagents/roles/role.researcher.md +14 -0
  34. package/node_modules/pi-better-subagents/roles/role.reviewer.md +13 -0
  35. package/node_modules/pi-better-subagents/shared-navigator.ts +67 -0
  36. package/node_modules/pi-better-subagents/tier-policy.ts +126 -0
  37. package/package.json +5 -4
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-background-tasks",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "Pi extension for durable background shell tasks, watchers, logs, and status inspection.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1397,3 +1397,70 @@ function truncateVisible(value: string, width: number): string {
1397
1397
  if (visibleWidth(str) <= max) return str;
1398
1398
  return piTruncateToWidth(str, max);
1399
1399
  }
1400
+
1401
+ /**
1402
+ * Render one provider detail with the overlay line builder and the main-list
1403
+ * row formatter. Callers must already be inside the process that registered
1404
+ * the provider. `listedIds` is the live list; `rowLine` uses the same
1405
+ * formatter on the detail payload when the live list has filtered the run.
1406
+ */
1407
+ export function renderRegisteredWorkDetail(providerId: string, id: string, width = 100): {
1408
+ detail: BackgroundWorkDetail | null;
1409
+ lines: string[];
1410
+ rowLine: string | null;
1411
+ listLines: string[] | null;
1412
+ listedIds: string[];
1413
+ } {
1414
+ const s = state();
1415
+ const deps = s.deps;
1416
+ const ctx = s.uiCtx;
1417
+ const truncate = deps?.truncate ?? ((value: string, limit: number) => {
1418
+ const text = String(value ?? "");
1419
+ return text.length > limit ? text.slice(0, Math.max(0, limit)) : text;
1420
+ });
1421
+ const fg = ctx ? themeFg(ctx) : (_color: string, value: string) => value;
1422
+ const provider = s.providers.get(providerId);
1423
+ let listed: BackgroundWorkRow[] = [];
1424
+ try { listed = provider?.listRows(Date.now()) ?? []; } catch { listed = []; }
1425
+ const detail = detailFor(rowKey(providerId, id), Date.now(), { logTailLines: 40 });
1426
+ const listLines = s.lastMainListLines ?? null;
1427
+ const listedIds = listed.map((row) => row.id);
1428
+ if (!detail) return { detail: null, lines: [], rowLine: null, listLines, listedIds };
1429
+ const theme = (ctx?.ui as { theme?: unknown } | undefined)?.theme;
1430
+ let lines: string[];
1431
+ try {
1432
+ if (detail.transcript && deps?.createTranscriptComponent) {
1433
+ const transcriptLines = deps.createTranscriptComponent(detail, theme).render(width) ?? [];
1434
+ lines = buildTranscriptDetailLines(detail, transcriptLines, width, truncate, fg, { logTailRows: 12 });
1435
+ } else {
1436
+ lines = buildDetailLines(detail, width, truncate, fg, { logTailRows: 12 });
1437
+ }
1438
+ } catch {
1439
+ lines = buildDetailLines(detail, width, truncate, fg, { logTailRows: 12 });
1440
+ }
1441
+ const modelLine = detail.metadata.find((item) => item.label === "model")?.value ?? "";
1442
+ const effortMatch = modelLine.match(/ · effort (.+)$/);
1443
+ const elapsed = detail.metadata.find((item) => item.label === "elapsed")?.value ?? "-";
1444
+ const row: InternalRow = {
1445
+ providerId,
1446
+ id: detail.id,
1447
+ name: detail.title,
1448
+ model: effortMatch ? modelLine.slice(0, effortMatch.index) : modelLine,
1449
+ ...(effortMatch ? { effort: effortMatch[1] } : {}),
1450
+ status: detail.status,
1451
+ statusTone: detail.statusTone,
1452
+ kind: "subagent",
1453
+ elapsed,
1454
+ primary: "",
1455
+ sortStartedAt: 0,
1456
+ navigatorId: rowKey(providerId, detail.id),
1457
+ providerLabel: provider?.label ?? providerId,
1458
+ };
1459
+ return {
1460
+ detail,
1461
+ lines,
1462
+ rowLine: formatMainListRow(row, true, fg, width),
1463
+ listLines,
1464
+ listedIds,
1465
+ };
1466
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-plan",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Structured execution plans with persistent progress for Pi.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -56,7 +56,6 @@ export function renderPlanPresentation(
56
56
  const content = metadata.map((part) => theme.fg(part.color, planText(part.text))).join("");
57
57
  for (const line of wrapTextWithAnsi(content, Math.max(1, size - 2))) lines.push(` ${line}`);
58
58
  }
59
- lines.push("");
60
59
 
61
60
  const labelWidth = Math.min(12, Math.max(4, ...plan.rows.map((row) => visibleWidth(planText(row.label)))));
62
61
  const statusWidth = Math.min(24, Math.max(0, ...plan.rows.map((row) =>
@@ -11,7 +11,7 @@ Use `pi-better-subagents` when you want Pi to launch independent agent work with
11
11
  <p><img src="https://raw.githubusercontent.com/1aboveio/pi-better-harness/main/docs/images/package-gallery/pi-better-subagents.png" alt="pi-better-subagents rendered in Pi" width="49%" /><img src="https://raw.githubusercontent.com/1aboveio/pi-better-harness/main/docs/images/package-gallery/overview/pi-better-subagents.png" alt="pi-better-subagents package overview" width="49%" /></p>
12
12
 
13
13
  ## Core Features
14
- - Non-blocking subagent launches.
14
+ - Non-blocking subagent launches, with an optional role and named-agent catalog (`docs/agent-catalog.md`, `docs/agent-catalog-lifecycle.md`).
15
15
  - Default OS write sandboxing on macOS and Linux.
16
16
  - Explicit tool allowlists for child sessions.
17
17
  - Durable logs and result retrieval across reloads.