pi-subagents 0.89.2 → 0.90.0

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 (76) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/bundle/agents.js +4 -4
  3. package/bundle/child-tool-plan.js +3 -3
  4. package/bundle/{chunk-U753SUBC.js → chunk-2LEBXCLU.js} +29 -19
  5. package/bundle/{chunk-UUW7P6KJ.js → chunk-37EJGDYO.js} +2 -2
  6. package/bundle/{chunk-ME4IS3Y3.js → chunk-4DA22WRU.js} +58 -29
  7. package/bundle/{chunk-77VQEATI.js → chunk-5J2RTMKW.js} +2 -2
  8. package/bundle/{chunk-UBPAMRVL.js → chunk-7HPZIT4W.js} +13 -13
  9. package/bundle/{chunk-SWGB2P5J.js → chunk-7Y4IJMCW.js} +1 -1
  10. package/bundle/{chunk-DGLXVN3F.js → chunk-ACTHBJUI.js} +1 -1
  11. package/bundle/{chunk-76WVWEFE.js → chunk-AJWRYQPH.js} +134 -74
  12. package/bundle/{chunk-TXC7WIPL.js → chunk-C45WQQZX.js} +1 -1
  13. package/bundle/{chunk-YJIU5WF4.js → chunk-CPWZN5KM.js} +1 -1
  14. package/bundle/{chunk-RHKIP45B.js → chunk-DNJ2GHSI.js} +6 -6
  15. package/bundle/{chunk-DYBRIEIF.js → chunk-EBGTTJKP.js} +6 -6
  16. package/bundle/{chunk-LWH7IGI3.js → chunk-F4NSLXB2.js} +8 -6
  17. package/bundle/{chunk-FO2GIU5F.js → chunk-G43SW4BT.js} +11 -10
  18. package/bundle/{chunk-Q4VH72JI.js → chunk-KNVQTRSY.js} +2 -2
  19. package/bundle/{chunk-5TXWZB73.js → chunk-P2M6RIVX.js} +1 -1
  20. package/bundle/{chunk-ROJH7KPK.js → chunk-PSB3VLMH.js} +2 -2
  21. package/bundle/{chunk-VEEUXJDO.js → chunk-PTN7XAXI.js} +2 -2
  22. package/bundle/{chunk-2UCFLUE4.js → chunk-RIBMW6V3.js} +9 -7
  23. package/bundle/{chunk-DHY5TY2Y.js → chunk-SIB2GQHL.js} +3 -3
  24. package/bundle/{chunk-JEZOSEWG.js → chunk-SRWJIAIP.js} +2 -0
  25. package/bundle/{chunk-JEYG7CNC.js → chunk-UC22RDXP.js} +2 -2
  26. package/bundle/{chunk-W2BZS6UC.js → chunk-VMJGZHUL.js} +9 -5
  27. package/bundle/{chunk-FF5K5HQU.js → chunk-WANQBKAZ.js} +5 -5
  28. package/bundle/{chunk-KA4MKMYT.js → chunk-WHHRG32M.js} +27 -20
  29. package/bundle/{chunk-464OJSDP.js → chunk-XIQKWTFY.js} +5 -5
  30. package/bundle/{chunk-4KQW5R6U.js → chunk-XYIVVS3A.js} +7 -3
  31. package/bundle/{chunk-AHGJSJYY.js → chunk-YVDKGAEO.js} +2 -2
  32. package/bundle/{chunk-SRCMJY4F.js → chunk-ZWGOHOGI.js} +5 -5
  33. package/bundle/control-channel.js +3 -3
  34. package/bundle/index.js +1 -1
  35. package/bundle/intercom-bridge.js +3 -3
  36. package/bundle/preflight.js +9 -9
  37. package/bundle/project-panes.js +4 -4
  38. package/bundle/shared-types.js +1 -1
  39. package/bundle/workflow-resources.js +1 -1
  40. package/docs/configuration.md +12 -3
  41. package/docs/models.md +1 -1
  42. package/docs/observability.md +7 -1
  43. package/docs/tool-reference.md +5 -2
  44. package/docs/workflows.md +1 -1
  45. package/package.json +1 -1
  46. package/skills/pi-subagents/SKILL.md +1 -1
  47. package/src/agents/agents.d.ts +2 -0
  48. package/src/agents/agents.js +4 -0
  49. package/src/extension/config.js +3 -0
  50. package/src/extension/public-execution.js +4 -2
  51. package/src/extension/reply-workflow-script.js +10 -1
  52. package/src/extension/schemas.d.ts +1 -0
  53. package/src/extension/schemas.js +2 -0
  54. package/src/extension/subagent-options.d.ts +2 -0
  55. package/src/extension/subagent-options.js +10 -4
  56. package/src/runs/background/async-execution.d.ts +1 -1
  57. package/src/runs/background/async-execution.js +3 -1
  58. package/src/runs/background/async-retention.js +48 -12
  59. package/src/runs/background/async-status.js +32 -17
  60. package/src/runs/background/retained-children.js +1 -1
  61. package/src/runs/foreground/execution.js +5 -7
  62. package/src/runs/foreground/subagent-executor.d.ts +1 -1
  63. package/src/runs/foreground/subagent-executor.js +122 -47
  64. package/src/runs/shared/fast-mode-extension.d.ts +2 -1
  65. package/src/runs/shared/fast-mode-extension.js +5 -3
  66. package/src/shared/capacity-resilient-json.d.ts +7 -3
  67. package/src/shared/capacity-resilient-json.js +8 -6
  68. package/src/shared/disabled-features.d.ts +4 -0
  69. package/src/shared/disabled-features.js +1 -0
  70. package/src/shared/types.d.ts +18 -1
  71. package/src/shared/types.js +2 -0
  72. package/src/tui/fleet.js +1 -0
  73. package/src/workflows/structured-workflow-scripts.js +6 -4
  74. package/src/workflows/workflow-resources.js +4 -2
  75. package/src/workflows/workflow-revival.d.ts +6 -0
  76. package/src/workflows/workflow-revival.js +1 -1
@@ -1669,6 +1669,8 @@ export interface AsyncStartedEvent {
1669
1669
  completionOwnerId?: string;
1670
1670
  mode?: SubagentRunMode;
1671
1671
  agent?: string;
1672
+ /** Launch label when set, else the agent's description or name; never the task prompt. */
1673
+ description?: string;
1672
1674
  agents?: string[];
1673
1675
  /** Redacted prompt marker for the first child task; workflow roots may omit this field. */
1674
1676
  task?: string;
@@ -2478,6 +2480,18 @@ export interface RequiredRunnerLauncher {
2478
2480
  export declare const SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete";
2479
2481
  export declare const SUBAGENT_PROCESS_TERMINAL_EVENT = "subagent:process-terminal";
2480
2482
  export declare const SUBAGENT_FOREGROUND_COMPLETE_EVENT = "subagent:foreground-complete";
2483
+ /** Generic lifecycle for a foreground child, so hosts can track runs that never emit `subagent:async-*`. Payload has no prompt text. */
2484
+ export declare const TASK_SUBAGENT_LIFECYCLE_EVENT = "task:subagent:lifecycle";
2485
+ export interface SubagentLifecycleEvent {
2486
+ id: string;
2487
+ status: "started" | "completed" | "failed" | "aborted";
2488
+ agent: string;
2489
+ description: string;
2490
+ success?: boolean;
2491
+ mode: "foreground";
2492
+ parentWorkflowRunId?: string;
2493
+ workflowKey?: string;
2494
+ }
2481
2495
  export declare const SUBAGENT_CONTROL_EVENT = "subagent:control-event";
2482
2496
  export declare const SUBAGENT_CONTROL_INTERCOM_EVENT = "subagent:control-intercom";
2483
2497
  export declare const SUBAGENT_STEERING_NOTICE_EVENT = "subagent:steering-notice";
@@ -2537,7 +2551,7 @@ export interface RunSyncOptions {
2537
2551
  remoteReads?: string[] | false;
2538
2552
  /** Original cwd input retained for launch diagnostics. */
2539
2553
  requestedCwd?: string;
2540
- /** Workflow child label; names the child session instead of the task excerpt. */
2554
+ /** Launch or workflow child label; names the child session instead of the task excerpt. */
2541
2555
  label?: string;
2542
2556
  signal?: AbortSignal;
2543
2557
  /** Report a child ended by `signal` as stopped; set for workflow children, whose signal is the workflow's. */
@@ -2672,6 +2686,7 @@ export interface ScheduledRunsConfig {
2672
2686
  }
2673
2687
  export type FleetViewPlacement = "aboveEditor" | "belowEditor";
2674
2688
  export type AsyncWidgetLayout = "adaptive" | "rows";
2689
+ export type FastServiceTier = "priority" | "ultrafast";
2675
2690
  export declare const FLEET_KEYBINDING_ACTIONS: readonly ["close", "scrollUp", "scrollDown", "selectUp", "selectDown", "selectFirst", "selectLast", "pageUp", "pageDown", "refresh", "steer", "inspect", "stop", "toggleTools"];
2676
2691
  export type FleetKeybindingAction = typeof FLEET_KEYBINDING_ACTIONS[number];
2677
2692
  export type FleetKeybindingsConfig = Partial<Record<FleetKeybindingAction, string[]>>;
@@ -2719,6 +2734,8 @@ export interface ExtensionConfig {
2719
2734
  asyncWidgetLayout?: AsyncWidgetLayout;
2720
2735
  /** Report subagent run state to the terminal with OSC 7501. Defaults to true. */
2721
2736
  programStatus?: boolean;
2737
+ /** OpenAI-Codex `service_tier` that `fast: true` requests for native children. Defaults to "priority". */
2738
+ fastServiceTier?: FastServiceTier;
2722
2739
  /** Add a short `active_subagents` system prompt section listing this session's active background runs. Defaults to false. */
2723
2740
  activeRunsPrompt?: boolean;
2724
2741
  /** Exact provider/model candidates mapped to operator-declared equivalent response IDs. Empty arrays add no accepted IDs. */
@@ -12,6 +12,8 @@ export const RUNNER_LAUNCHER_NAME_RULE = "must start with a letter or digit and
12
12
  export const SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete";
13
13
  export const SUBAGENT_PROCESS_TERMINAL_EVENT = "subagent:process-terminal";
14
14
  export const SUBAGENT_FOREGROUND_COMPLETE_EVENT = "subagent:foreground-complete";
15
+ /** Generic lifecycle for a foreground child, so hosts can track runs that never emit `subagent:async-*`. Payload has no prompt text. */
16
+ export const TASK_SUBAGENT_LIFECYCLE_EVENT = "task:subagent:lifecycle";
15
17
  export const SUBAGENT_CONTROL_EVENT = "subagent:control-event";
16
18
  export const SUBAGENT_CONTROL_INTERCOM_EVENT = "subagent:control-intercom";
17
19
  export const SUBAGENT_STEERING_NOTICE_EVENT = "subagent:steering-notice";
package/src/tui/fleet.js CHANGED
@@ -224,6 +224,7 @@ export function collectFleetSnapshot(state, options = {}) {
224
224
  entryLimit: MAX_FLEET_HISTORY_CANDIDATES,
225
225
  resultsDir: options.resultsDir ?? DIRS.results,
226
226
  reconcile: false,
227
+ includeNested: false,
227
228
  onCorruptStatus: (warning) => reportSessionWarning(state, warning),
228
229
  }).filter((run) => !trackedIds.has(run.id));
229
230
  runs = [...trackedRuns, ...history];
@@ -7,6 +7,8 @@ const OUTPUT_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
7
7
  const PLACEHOLDER_PATTERN = /\{(?:task|previous|outputs\.([A-Za-z_][A-Za-z0-9_]*))\}/g;
8
8
  /** Optional per-child launch fields copied verbatim onto the generated runs.all item. */
9
9
  const CHILD_FIELDS = ["cwd", "model"];
10
+ /** tasks items also take a label, which names the child the way a runs.all item's label does. */
11
+ const TASK_FIELDS = [...CHILD_FIELDS, "label"];
10
12
  // Outer subagent-call controls that default onto every workflow child (docs/workflows.md); output gets its own advice.
11
13
  const SHARED_CHILD_CONTROLS = new Set(["worktree", "baseRef", "context", "skill", "fast", "agentScope", "outputMode", "outputSchema", "agentContract", "acceptance", "gate", "toolBudget", "toolTimeoutMs", "control"]);
12
14
  // runs.run/runs.all child fields whose outer-call form is missing or means something else (async and timeoutMs apply to the workflow).
@@ -87,9 +89,9 @@ function compileTemplate(template, scope) {
87
89
  function prelude(originalTask) {
88
90
  return originalTask === undefined ? [SETTLE_HELPER] : [SETTLE_HELPER, `const originalTask = ${JSON.stringify(originalTask)};`];
89
91
  }
90
- function childFields(record, path) {
92
+ function childFields(record, path, allowed = CHILD_FIELDS) {
91
93
  const fields = {};
92
- for (const field of CHILD_FIELDS) {
94
+ for (const field of allowed) {
93
95
  if (record[field] !== undefined)
94
96
  fields[field] = nonEmptyString(record[field], `${path}.${field}`);
95
97
  }
@@ -119,7 +121,7 @@ function buildTasksScript(steps, originalTask, scripts) {
119
121
  throw new Error("tasks must be a non-empty array of { agent, task } items.");
120
122
  const children = steps.map((item, index) => {
121
123
  const path = `tasks[${index}]`;
122
- const record = exactFields(item, path, ["agent", "task", ...CHILD_FIELDS], "Each tasks item accepts agent and task, plus optional cwd and model.", scripts);
124
+ const record = exactFields(item, path, ["agent", "task", ...TASK_FIELDS], "Each tasks item accepts agent and task, plus optional cwd, model and label.", scripts);
123
125
  const agent = nonEmptyString(record.agent, `${path}.agent`);
124
126
  const task = nonEmptyString(record.task, `${path}.task`);
125
127
  const taskExpression = compileTemplate(task, {
@@ -128,7 +130,7 @@ function buildTasksScript(steps, originalTask, scripts) {
128
130
  previous: { unavailable: "tasks items may only use {task}." },
129
131
  outputsUnavailable: "tasks items may only use {task}.",
130
132
  });
131
- return { key: `task-${index + 1}`, agent, taskExpression, fields: childFields(record, path) };
133
+ return { key: `task-${index + 1}`, agent, taskExpression, fields: childFields(record, path, TASK_FIELDS) };
132
134
  });
133
135
  return [
134
136
  ...prelude(originalTask),
@@ -151,8 +151,10 @@ function resolveRunCi(args) {
151
151
  }
152
152
  function resolveParallel(args) {
153
153
  const unsupported = Object.keys(args).filter((key) => key !== "tasks");
154
- if (unsupported.length > 0)
155
- return { error: `workflow 'parallel' args contain unsupported fields: ${unsupported.join(", ")}. Pass args.tasks: [{ agent, task, cwd?, model? }, ...]. ${unsupportedChildFieldAdvice(unsupported, true)}` };
154
+ if (unsupported.length > 0) {
155
+ const concurrencyAdvice = unsupported.includes("concurrency") ? " To cap how many run at once, pass globalConcurrencyLimit at the top level, alongside workflow and args." : "";
156
+ return { error: `workflow 'parallel' args contain unsupported fields: ${unsupported.join(", ")}. Pass args.tasks: [{ agent, task, cwd?, model?, label? }, ...].${concurrencyAdvice} ${unsupportedChildFieldAdvice(unsupported, true)}` };
157
+ }
156
158
  try {
157
159
  return { script: buildStructuredWorkflowScript("tasks", args.tasks, undefined, true) };
158
160
  }
@@ -1,5 +1,11 @@
1
1
  import type { AsyncStatus } from "../shared/types.ts";
2
2
  import type { WorkflowScriptChildResult } from "./scripted-workflow.ts";
3
+ /**
4
+ * A top-level resume of a failed async workflow child starts a detached run. These records
5
+ * link that run back to its workflow key without writing the workflow's own status or receipt.
6
+ * The source run is terminal, so the live workflow host never writes its directory.
7
+ */
8
+ export declare const REVIVAL_LINK_FILE = "workflow-revival.json";
3
9
  /** The same link, kept in the revived run's directory so reviving it again keeps the key. */
4
10
  export declare const REVIVAL_ORIGIN_FILE = "workflow-revival-origin.json";
5
11
  export interface WorkflowKeyRevival {
@@ -7,7 +7,7 @@ import { readStatus } from "../shared/utils.js";
7
7
  * link that run back to its workflow key without writing the workflow's own status or receipt.
8
8
  * The source run is terminal, so the live workflow host never writes its directory.
9
9
  */
10
- const REVIVAL_LINK_FILE = "workflow-revival.json";
10
+ export const REVIVAL_LINK_FILE = "workflow-revival.json";
11
11
  /** The same link, kept in the revived run's directory so reviving it again keeps the key. */
12
12
  export const REVIVAL_ORIGIN_FILE = "workflow-revival-origin.json";
13
13
  /** Recording refuses a deeper link, so readers bounded by this always reach the chain's end. */