pi-subagents 0.64.0 → 0.65.1
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/CHANGELOG.md +65 -0
- package/README.md +2 -2
- package/agents/reviewer.md +1 -1
- package/agents/scout.md +1 -1
- package/docs/agents.md +19 -17
- package/docs/configuration.md +23 -15
- package/docs/extension-api.md +18 -6
- package/docs/missions.md +2 -0
- package/docs/observability.md +10 -12
- package/docs/tool-reference.md +15 -8
- package/docs/watchdog.md +1 -1
- package/docs/workflows.md +13 -3
- package/package.json +5 -4
- package/runner-server-preload.mjs +13 -0
- package/skills/pi-subagents/SKILL.md +2 -1
- package/skills/pi-subagents/references/constraints-and-recipes.md +1 -1
- package/skills/pi-subagents/references/execution-controls.md +7 -3
- package/skills/pi-subagents/references/multi-lane-orchestration.md +2 -0
- package/src/agents/agent-management.ts +47 -15
- package/src/api/capability-ceiling.ts +0 -1
- package/src/api/{pi-args.ts → child-tool-plan.ts} +1 -1
- package/src/api/preflight.ts +7 -4
- package/src/extension/config.ts +4 -2
- package/src/extension/doctor.ts +2 -10
- package/src/extension/fanout-child.ts +9 -11
- package/src/extension/index.ts +58 -7
- package/src/extension/public-execution.ts +14 -0
- package/src/extension/rpc.ts +3 -2
- package/src/extension/schemas.ts +3 -2
- package/src/extension/tool-description.ts +13 -8
- package/src/integrations/pi-web-session-liveness.ts +73 -0
- package/src/intercom/native-supervisor-channel.ts +159 -95
- package/src/intercom/supervisor-ui.ts +244 -0
- package/src/missions/workflow-state.ts +37 -16
- package/src/runs/background/async-execution.ts +51 -25
- package/src/runs/background/async-job-tracker.ts +11 -0
- package/src/runs/background/async-resume.ts +14 -3
- package/src/runs/background/async-retention.ts +9 -0
- package/src/runs/background/control-channel.ts +2 -204
- package/src/runs/background/notify.ts +2 -0
- package/src/runs/background/process-terminal.ts +1 -1
- package/src/runs/background/retained-nested-route-tracker.ts +96 -0
- package/src/runs/background/run-child-session.ts +614 -0
- package/src/runs/background/run-status.ts +0 -1
- package/src/runs/background/runner-aliases.ts +152 -0
- package/src/runs/background/runner-child-sessions.ts +31 -0
- package/src/runs/background/scheduled-runs.ts +18 -4
- package/src/runs/background/subagent-runner.ts +203 -901
- package/src/runs/foreground/async-steering-action.ts +1 -17
- package/src/runs/foreground/execution.ts +204 -378
- package/src/runs/foreground/foreground-control.ts +4 -0
- package/src/runs/foreground/foreground-history.ts +3 -1
- package/src/runs/foreground/prompt-audit.ts +9 -5
- package/src/runs/foreground/subagent-executor.ts +161 -91
- package/src/runs/foreground/workflow-foreground-steering.ts +24 -98
- package/src/runs/shared/abort-recovery.ts +3 -3
- package/src/runs/shared/acceptance.ts +14 -1
- package/src/runs/shared/capability-ceiling.ts +1 -2
- package/src/runs/shared/child-hooks.ts +25 -0
- package/src/runs/shared/child-identity.ts +13 -2
- package/src/runs/shared/child-launch.ts +314 -0
- package/src/runs/shared/child-lifecycle.ts +25 -0
- package/src/runs/shared/child-runtime-config.ts +126 -0
- package/src/runs/shared/child-session.ts +337 -0
- package/src/runs/shared/child-tool-plan.ts +530 -0
- package/src/runs/shared/claude-code-adapter.ts +5 -1
- package/src/runs/shared/completion-guard.ts +1 -1
- package/src/runs/shared/external-cli-preflight.ts +16 -0
- package/src/runs/shared/llm-intent-arbiter.ts +20 -11
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +5 -4
- package/src/runs/shared/model-exclusions.ts +84 -15
- package/src/runs/shared/model-fallback.ts +78 -6
- package/src/runs/shared/nested-events.ts +32 -48
- package/src/runs/shared/nested-path.ts +0 -14
- package/src/runs/shared/orca-progress-tabs.ts +12 -7
- package/src/runs/shared/parallel-utils.ts +1 -2
- package/src/runs/shared/permissions.ts +0 -13
- package/src/runs/shared/process-signal.ts +4 -1
- package/src/runs/shared/run-fanout-budget.ts +0 -13
- package/src/runs/shared/runtime-acknowledged-extensions.ts +0 -27
- package/src/runs/shared/structured-output.ts +17 -4
- package/src/runs/shared/subagent-control.ts +2 -0
- package/src/runs/shared/subagent-prompt-runtime.ts +87 -384
- package/src/runs/shared/tool-availability.ts +18 -62
- package/src/runs/shared/tool-budget.ts +0 -14
- package/src/runs/shared/worktree-cleanup-plan.ts +31 -9
- package/src/runs/shared/worktree.ts +192 -40
- package/src/shared/child-session-name.ts +1 -1
- package/src/shared/jsonl-writer.ts +11 -0
- package/src/shared/model-response-aliases.ts +13 -0
- package/src/shared/thinking-ceiling.ts +0 -6
- package/src/shared/types.ts +63 -28
- package/src/shared/utils.ts +6 -4
- package/src/shared/watch-strategy.ts +2 -0
- package/src/slash/slash-commands.ts +0 -6
- package/src/tui/fleet-status.ts +1 -1
- package/src/tui/fleet.ts +0 -1
- package/src/tui/render.ts +254 -41
- package/src/watchdog/child-status.ts +0 -1
- package/src/watchdog/register-child.ts +12 -12
- package/src/workflows/scripted-workflow.ts +80 -7
- package/src/workflows/workflow-checklist.ts +4 -3
- package/src/runs/shared/child-protocol.ts +0 -415
- package/src/runs/shared/pi-args.ts +0 -1059
- package/src/runs/shared/subagent-startup-retry.ts +0 -116
- package/src/shared/post-exit-stdio-guard.ts +0 -85
|
@@ -14,6 +14,7 @@ interface BeginForegroundChildInput {
|
|
|
14
14
|
thinking?: string;
|
|
15
15
|
interrupt: () => boolean;
|
|
16
16
|
detach?: () => boolean;
|
|
17
|
+
steer?: ForegroundChildControl["steer"];
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
function copyProgress(target: ForegroundChildControl, progress: AgentProgress | undefined): void {
|
|
@@ -56,6 +57,7 @@ function syncCurrentChild(control: ForegroundRunControl, child: ForegroundChildC
|
|
|
56
57
|
control.toolCount = child.toolCount;
|
|
57
58
|
control.interrupt = child.interrupt;
|
|
58
59
|
control.detach = child.detach;
|
|
60
|
+
control.steer = child.steer;
|
|
59
61
|
control.updatedAt = child.updatedAt;
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -79,6 +81,7 @@ function clearCurrentChild(control: ForegroundRunControl): void {
|
|
|
79
81
|
control.toolCount = undefined;
|
|
80
82
|
control.interrupt = undefined;
|
|
81
83
|
control.detach = undefined;
|
|
84
|
+
control.steer = undefined;
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
export function retainForegroundSchedulingOwner(control: ForegroundRunControl): void {
|
|
@@ -122,6 +125,7 @@ export function beginForegroundChild(control: ForegroundRunControl, input: Begin
|
|
|
122
125
|
return true;
|
|
123
126
|
};
|
|
124
127
|
}
|
|
128
|
+
if (input.steer) child.steer = input.steer;
|
|
125
129
|
control.activeChildren ??= new Map();
|
|
126
130
|
control.activeChildren.set(input.index, child);
|
|
127
131
|
registerLivePromptAudit(control, input.index, input.authoredTask, input.effectivePrompt, {
|
|
@@ -5,6 +5,7 @@ import { DIRS } from "../../shared/types.ts";
|
|
|
5
5
|
import { writePrivateAtomicJson } from "../../shared/atomic-json.ts";
|
|
6
6
|
import { utf8Tail } from "../../shared/utf8.ts";
|
|
7
7
|
import { validateAcceptanceInput } from "../shared/acceptance.ts";
|
|
8
|
+
import { validateModelResponseAliases } from "../../shared/model-response-aliases.ts";
|
|
8
9
|
|
|
9
10
|
export const MAX_REMEMBERED_FOREGROUND_RUNS = 50;
|
|
10
11
|
const HISTORY_VERSION = 1;
|
|
@@ -71,11 +72,12 @@ function isRestorableResumeContract(value: unknown): boolean {
|
|
|
71
72
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
72
73
|
try {
|
|
73
74
|
if (Buffer.byteLength(JSON.stringify(value), "utf8") > MAX_RESUME_CONTRACT_BYTES) return false;
|
|
75
|
+
validateModelResponseAliases((value as ForegroundResumeChild["resumeContract"])?.modelResponseAliases);
|
|
74
76
|
} catch {
|
|
75
77
|
return false;
|
|
76
78
|
}
|
|
77
79
|
const contract = value as NonNullable<ForegroundResumeChild["resumeContract"]>;
|
|
78
|
-
if (Object.keys(contract).some((key) => !["outputSchema", "agentContract", "acceptance", "output", "outputMode"].includes(key))) return false;
|
|
80
|
+
if (Object.keys(contract).some((key) => !["modelResponseAliases", "outputSchema", "agentContract", "acceptance", "output", "outputMode"].includes(key))) return false;
|
|
79
81
|
if (contract.outputSchema !== undefined && (!contract.outputSchema || typeof contract.outputSchema !== "object" || Array.isArray(contract.outputSchema))) return false;
|
|
80
82
|
if (contract.agentContract !== undefined && (!contract.agentContract || typeof contract.agentContract !== "object" || Array.isArray(contract.agentContract) || contract.agentContract.version !== 1)) return false;
|
|
81
83
|
if (validateAcceptanceInput(contract.acceptance).length > 0) return false;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Agent,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import type { Model, ProviderHeaders } from "@earendil-works/pi-ai";
|
|
1
|
+
import type { Agent, StreamFn, ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import type { ProviderHeaders } from "@earendil-works/pi-ai";
|
|
5
4
|
import { agentStreamOptions } from "../../shared/agent-stream-options.ts";
|
|
6
5
|
import type { ForegroundRunControl } from "../../shared/types.ts";
|
|
7
6
|
export type PromptAuditView = "authored" | "runtime" | "effective";
|
|
@@ -21,7 +20,7 @@ export interface LivePromptAudit {
|
|
|
21
20
|
|
|
22
21
|
const livePrompts = new WeakMap<ForegroundRunControl, Map<number, LivePromptAudit>>();
|
|
23
22
|
|
|
24
|
-
type RegistryModel =
|
|
23
|
+
type RegistryModel = NonNullable<ExtensionContext["model"]>;
|
|
25
24
|
|
|
26
25
|
function fullModelId(model: Pick<RegistryModel, "provider" | "id">): string {
|
|
27
26
|
return `${model.provider}/${model.id}`;
|
|
@@ -64,6 +63,11 @@ export async function rewritePromptWithGuidance(input: {
|
|
|
64
63
|
}): Promise<string> {
|
|
65
64
|
const model = input.ctx.model;
|
|
66
65
|
if (!model) throw new Error("Prompt redo needs the current session model to rewrite the authored task.");
|
|
66
|
+
const [{ Agent }, { convertToLlm }, { streamSimple }] = await Promise.all([
|
|
67
|
+
import("@earendil-works/pi-agent-core"),
|
|
68
|
+
import("@earendil-works/pi-coding-agent"),
|
|
69
|
+
import("@earendil-works/pi-ai/compat"),
|
|
70
|
+
]);
|
|
67
71
|
const auth = await resolveRewriteAuth(input.ctx, model);
|
|
68
72
|
const registeredProvider = (input.ctx.modelRegistry as {
|
|
69
73
|
getRegisteredProviderConfig?: (provider: string) => { api?: string; streamSimple?: StreamFn } | undefined;
|