pi-subagents 0.80.0 → 0.82.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.
- package/CHANGELOG.md +66 -0
- package/bundle/agents.js +18 -0
- package/bundle/background-work.js +16 -0
- package/bundle/capability-ceiling.js +22 -0
- package/bundle/child-tool-plan.js +11 -0
- package/bundle/chunk-43SCHIMD.js +57 -0
- package/bundle/chunk-4QFZZV3O.js +57 -0
- package/bundle/chunk-4SDU2BZX.js +1190 -0
- package/bundle/chunk-52UBALJL.js +753 -0
- package/bundle/chunk-5LFLVSTM.js +260 -0
- package/bundle/chunk-5TYMSZX3.js +235 -0
- package/bundle/chunk-62OCY2S4.js +14 -0
- package/bundle/chunk-7F6RKT6W.js +132 -0
- package/bundle/chunk-7IVSUMQQ.js +1337 -0
- package/bundle/chunk-7J4ZXMY7.js +18 -0
- package/bundle/chunk-7PCKZHR5.js +1234 -0
- package/bundle/chunk-7YMXOYEU.js +1373 -0
- package/bundle/chunk-B5EKXDHE.js +16870 -0
- package/bundle/chunk-CIZQXJ5Q.js +8619 -0
- package/bundle/chunk-CTPAE36Y.js +94 -0
- package/bundle/chunk-D4EHT5SJ.js +14 -0
- package/bundle/chunk-GC4DSPMH.js +946 -0
- package/bundle/chunk-GJECHSAR.js +179 -0
- package/bundle/chunk-M2CTFYT3.js +4164 -0
- package/bundle/chunk-MHZ4G23A.js +1296 -0
- package/bundle/chunk-N2BN7BF5.js +159 -0
- package/bundle/chunk-NF7IEKBH.js +490 -0
- package/bundle/chunk-NGGAFDL6.js +742 -0
- package/bundle/chunk-NIXWDZZV.js +9 -0
- package/bundle/chunk-NRQ75MGH.js +8327 -0
- package/bundle/chunk-OYF6AFDY.js +458 -0
- package/bundle/chunk-PLCCBLPY.js +526 -0
- package/bundle/chunk-RMQFMMAT.js +416 -0
- package/bundle/chunk-SIJ4S3EN.js +276 -0
- package/bundle/chunk-UKG4V45O.js +228 -0
- package/bundle/chunk-VH5OAWVG.js +4096 -0
- package/bundle/chunk-W2SZ22EM.js +5462 -0
- package/bundle/chunk-WVD4UEL4.js +9367 -0
- package/bundle/chunk-XSWOTIA3.js +175 -0
- package/bundle/chunk-YFCK7H2S.js +129 -0
- package/bundle/chunk-YKEWIB4M.js +380 -0
- package/bundle/chunk-YYREO77V.js +137 -0
- package/bundle/chunk-Z7KVHQHL.js +173 -0
- package/bundle/chunk-ZLINIYTP.js +8613 -0
- package/bundle/chunk-ZQGSDHL6.js +128 -0
- package/bundle/control-channel.js +11 -0
- package/bundle/delegation.js +14 -0
- package/bundle/external-job-provider.js +20 -0
- package/bundle/external-runs.js +21 -0
- package/bundle/index.js +30 -0
- package/bundle/inspectors.js +8 -0
- package/bundle/intercom-bridge.js +11 -0
- package/bundle/preflight.js +425 -0
- package/bundle/project-panes.js +28 -0
- package/bundle/required-child-extensions.js +6 -0
- package/bundle/shared-types.js +8 -0
- package/bundle/workflow-resources.js +7 -0
- package/docs/agents.md +31 -0
- package/docs/configuration.md +9 -1
- package/docs/extension-api.md +27 -0
- package/docs/observability.md +6 -2
- package/docs/tool-reference.md +3 -1
- package/docs/workflows.md +16 -0
- package/package.json +19 -19
- package/skills/pi-subagents/references/execution-controls.md +5 -4
- package/src/agents/agent-management.js +3 -3
- package/src/agents/agent-memory.js +3 -1
- package/src/agents/agents.js +6 -6
- package/src/agents/frontmatter.d.ts +4 -0
- package/src/agents/frontmatter.js +24 -3
- package/src/agents/skills.js +2 -1
- package/src/api/delegation.d.ts +20 -0
- package/src/extension/config.js +3 -0
- package/src/extension/herdr-pi-bridge.js +17 -10
- package/src/extension/index.js +109 -9
- package/src/extension/schemas.js +3 -3
- package/src/intercom/native-supervisor-channel.js +20 -0
- package/src/missions/lifecycle.js +7 -1
- package/src/runs/background/active-async-capacity.d.ts +1 -0
- package/src/runs/background/active-async-capacity.js +9 -3
- package/src/runs/background/async-execution.js +20 -10
- package/src/runs/background/async-job-tracker.d.ts +6 -1
- package/src/runs/background/async-job-tracker.js +9 -4
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +21 -2
- package/src/runs/background/await-async-run.js +3 -7
- package/src/runs/background/boot-id.d.ts +12 -0
- package/src/runs/background/boot-id.js +47 -0
- package/src/runs/background/interrupted-elsewhere.d.ts +22 -0
- package/src/runs/background/interrupted-elsewhere.js +68 -0
- package/src/runs/background/notify.d.ts +2 -0
- package/src/runs/background/notify.js +13 -0
- package/src/runs/background/result-delivery-ownership.d.ts +6 -0
- package/src/runs/background/result-delivery-ownership.js +19 -1
- package/src/runs/background/result-watcher.d.ts +3 -1
- package/src/runs/background/result-watcher.js +24 -8
- package/src/runs/background/run-child-session.d.ts +1 -6
- package/src/runs/background/run-child-session.js +19 -1
- package/src/runs/background/run-status.js +2 -1
- package/src/runs/background/stale-run-reconciler.d.ts +25 -0
- package/src/runs/background/stale-run-reconciler.js +54 -13
- package/src/runs/background/subagent-runner-bootstrap.js +3 -0
- package/src/runs/background/subagent-runner.d.ts +4 -0
- package/src/runs/background/subagent-runner.js +13 -5
- package/src/runs/background/subagent-wait.d.ts +1 -1
- package/src/runs/background/subagent-wait.js +6 -1
- package/src/runs/background/terminal-run-index.d.ts +1 -0
- package/src/runs/background/terminal-run-index.js +4 -2
- package/src/runs/foreground/async-stop-action.js +3 -1
- package/src/runs/foreground/execution.js +45 -5
- package/src/runs/foreground/foreground-history.d.ts +16 -2
- package/src/runs/foreground/foreground-history.js +133 -31
- package/src/runs/foreground/subagent-executor.d.ts +11 -0
- package/src/runs/foreground/subagent-executor.js +277 -74
- package/src/runs/shared/child-launch.d.ts +2 -2
- package/src/runs/shared/child-session.d.ts +3 -2
- package/src/runs/shared/child-session.js +51 -8
- package/src/runs/shared/child-tool-plan.d.ts +7 -0
- package/src/runs/shared/child-tool-plan.js +21 -6
- package/src/runs/shared/herdr-connection.d.ts +17 -8
- package/src/runs/shared/herdr-connection.js +19 -7
- package/src/runs/shared/herdr-external-adapters.d.ts +3 -2
- package/src/runs/shared/herdr-external-adapters.js +1 -1
- package/src/runs/shared/herdr-machine.d.ts +12 -2
- package/src/runs/shared/herdr-machine.js +55 -9
- package/src/runs/shared/herdr-pane-host.d.ts +88 -0
- package/src/runs/shared/herdr-pane-host.js +155 -0
- package/src/runs/shared/herdr-placed-run.d.ts +27 -150
- package/src/runs/shared/herdr-placed-run.js +48 -395
- package/src/runs/shared/local-machine-access.d.ts +5 -0
- package/src/runs/shared/local-machine-access.js +28 -0
- package/src/runs/shared/orca-progress-tabs.d.ts +0 -1
- package/src/runs/shared/orca-progress-tabs.js +1 -24
- package/src/runs/shared/parallel-utils.d.ts +1 -1
- package/src/runs/shared/placed-run-owner.d.ts +49 -0
- package/src/runs/shared/placed-run-owner.js +93 -0
- package/src/runs/shared/placement-host.d.ts +99 -0
- package/src/runs/shared/placement-host.js +157 -0
- package/src/runs/shared/rex-machine.d.ts +25 -0
- package/src/runs/shared/rex-machine.js +83 -0
- package/src/runs/shared/rex-pane-host.d.ts +62 -0
- package/src/runs/shared/rex-pane-host.js +327 -0
- package/src/runs/shared/structured-output.d.ts +1 -0
- package/src/runs/shared/structured-output.js +1 -0
- package/src/shared/accessible-dir.js +4 -1
- package/src/shared/completion-owner.d.ts +5 -0
- package/src/shared/completion-owner.js +5 -0
- package/src/shared/provider-diagnostics.d.ts +9 -0
- package/src/shared/provider-diagnostics.js +75 -0
- package/src/shared/session-identity.d.ts +2 -0
- package/src/shared/session-identity.js +26 -0
- package/src/shared/types.d.ts +48 -6
- package/src/slash/delegation-adapters.d.ts +3 -1
- package/src/slash/delegation-adapters.js +7 -0
- package/src/slash/prompt-template-bridge.js +3 -1
- package/src/slash/subagents-admin.d.ts +1 -0
- package/src/slash/subagents-admin.js +1 -1
- package/src/tui/fleet-layout.d.ts +20 -0
- package/src/tui/fleet-layout.js +17 -0
- package/src/tui/fleet-viewport.d.ts +12 -0
- package/src/tui/fleet-viewport.js +35 -0
- package/src/tui/fleet.d.ts +6 -6
- package/src/tui/fleet.js +93 -66
- package/src/tui/render.d.ts +6 -0
- package/src/tui/render.js +3 -3
- package/src/tui/subagent-messages.js +1 -0
- package/src/workflows/scripted-workflow.d.ts +1 -1
- package/src/workflows/structured-workflow-scripts.d.ts +1 -0
- package/src/workflows/structured-workflow-scripts.js +5 -4
- package/src/workflows/workflow-auto-resume.d.ts +32 -0
- package/src/workflows/workflow-auto-resume.js +102 -0
- package/src/workflows/workflow-launch-record.d.ts +27 -0
- package/src/workflows/workflow-launch-record.js +48 -0
- package/src/workflows/workflow-resources.js +2 -2
- package/src/workflows/workflow-resume-claim.d.ts +82 -0
- package/src/workflows/workflow-resume-claim.js +210 -0
- package/src/workflows/workflow-resume.d.ts +56 -0
- package/src/workflows/workflow-resume.js +106 -0
- package/src/workflows/workflow-reuse.d.ts +15 -9
- package/src/workflows/workflow-reuse.js +77 -14
- package/src/workflows/workflow-revival.d.ts +2 -0
- package/src/workflows/workflow-revival.js +2 -1
- package/src/workflows/workflow-stop-cause.d.ts +6 -0
- package/src/workflows/workflow-stop-cause.js +8 -0
package/src/shared/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Type definitions for the subagent extension
|
|
3
3
|
*/
|
|
4
4
|
import type { Message } from "@earendil-works/pi-ai";
|
|
5
|
+
import type { SubagentDelegationProviderDiagnostics } from "../api/delegation.ts";
|
|
5
6
|
import type { AgentConfig } from "../agents/agents.ts";
|
|
6
7
|
import type { FSWatcher } from "node:fs";
|
|
7
8
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
@@ -15,6 +16,8 @@ import type { ExtensionBindings } from "../runs/shared/extension-bindings.ts";
|
|
|
15
16
|
import type { WorkflowChildPermitContext } from "./workflow-child-permit.ts";
|
|
16
17
|
import type { WatchdogWarningDetails } from "../watchdog/types.ts";
|
|
17
18
|
import type { RequiredChildExtensionSnapshot } from "./required-child-extensions.ts";
|
|
19
|
+
import type { RecordedPid } from "../runs/background/stale-run-reconciler.ts";
|
|
20
|
+
import type { WorkflowStopCause } from "../workflows/workflow-stop-cause.ts";
|
|
18
21
|
export interface MaxOutputConfig {
|
|
19
22
|
bytes?: number;
|
|
20
23
|
lines?: number;
|
|
@@ -864,6 +867,7 @@ export interface ChildWatchdogProgress {
|
|
|
864
867
|
warnings?: ChildWatchdogWarningSummary[];
|
|
865
868
|
}
|
|
866
869
|
export interface AgentProgress {
|
|
870
|
+
providerDiagnostics?: SubagentDelegationProviderDiagnostics;
|
|
867
871
|
index: number;
|
|
868
872
|
agent: string;
|
|
869
873
|
/** Human-readable display name for the child's session, when derived at launch. */
|
|
@@ -1159,11 +1163,12 @@ export interface SingleResult {
|
|
|
1159
1163
|
toolBudget?: ToolBudgetState;
|
|
1160
1164
|
toolBudgetBlocked?: boolean;
|
|
1161
1165
|
messages?: Message[];
|
|
1166
|
+
providerDiagnostics?: SubagentDelegationProviderDiagnostics;
|
|
1162
1167
|
usage: Usage;
|
|
1163
1168
|
model?: string;
|
|
1164
1169
|
/** Authoritative before/after Git evidence captured by a pane-native remote machine. */
|
|
1165
1170
|
nativeMachine?: {
|
|
1166
|
-
provider: "
|
|
1171
|
+
provider: PlacementMachineReference["provider"];
|
|
1167
1172
|
machineId: string;
|
|
1168
1173
|
initialGit?: HerdrRemoteGitStatus;
|
|
1169
1174
|
finalGit?: HerdrRemoteGitStatus;
|
|
@@ -1428,10 +1433,17 @@ export interface Details {
|
|
|
1428
1433
|
argsDigest?: string;
|
|
1429
1434
|
/** SHA-256 of the workflow script source (async workflows). */
|
|
1430
1435
|
scriptDigest?: string;
|
|
1431
|
-
/** Structured stop cause
|
|
1432
|
-
stopCause?:
|
|
1433
|
-
/**
|
|
1436
|
+
/** Structured stop cause: `runtime-replaced` when the owning extension runtime was replaced; `owner-exited` when stale-run reconciliation found the owning Pi process dead. */
|
|
1437
|
+
stopCause?: WorkflowStopCause;
|
|
1438
|
+
/** Interrupted workflow run whose finished children this run reused. */
|
|
1434
1439
|
reusedFrom?: string;
|
|
1440
|
+
/** Owner-exited runs: the last time the dead Pi process updated the run (epoch ms), not the repair time. */
|
|
1441
|
+
ownerExitedAt?: number;
|
|
1442
|
+
/** Set on a run that resumes an interrupted one; `attempt` counts resumes that followed Pi exits. */
|
|
1443
|
+
resumeOrigin?: {
|
|
1444
|
+
sourceRunId: string;
|
|
1445
|
+
attempt: number;
|
|
1446
|
+
};
|
|
1435
1447
|
resource?: WorkflowResourceProvenance;
|
|
1436
1448
|
preflightWarnings?: string[];
|
|
1437
1449
|
trace: Array<{
|
|
@@ -1447,7 +1459,7 @@ export interface Details {
|
|
|
1447
1459
|
generatedLaneKey?: string;
|
|
1448
1460
|
warning?: string;
|
|
1449
1461
|
error?: string;
|
|
1450
|
-
/** Came from a previous runtime-replaced run of the same script (and args, unless named by options.reuseFrom); this run launched nothing. */
|
|
1462
|
+
/** Came from a previous runtime-replaced or owner-exited run of the same script (and args, unless named by options.reuseFrom); this run launched nothing. */
|
|
1451
1463
|
reused?: boolean;
|
|
1452
1464
|
}>;
|
|
1453
1465
|
emits: unknown[];
|
|
@@ -1670,6 +1682,24 @@ export interface HerdrMachineReference {
|
|
|
1670
1682
|
session?: string;
|
|
1671
1683
|
cwd: string;
|
|
1672
1684
|
}
|
|
1685
|
+
/** `machine: "local"`: a Rex pane in the parent's own Rex session on this machine. `session` is the Rex session id and `server` the Rex server address, both recorded in the parent at resolution time; `cwd` is the local launch directory. */
|
|
1686
|
+
export interface RexLocalMachineReference {
|
|
1687
|
+
provider: "rex";
|
|
1688
|
+
id: "local";
|
|
1689
|
+
session: string;
|
|
1690
|
+
server?: string;
|
|
1691
|
+
cwd: string;
|
|
1692
|
+
}
|
|
1693
|
+
/** A Rex machine reached over SSH, named in user settings (`subagents.machines.<id>.rex.ssh`). The pane opens in that machine's Rex session labeled `subagents`, found or created at launch and recorded with the run; `cwd` is the directory on that machine. */
|
|
1694
|
+
export interface RexSshMachineReference {
|
|
1695
|
+
provider: "rex";
|
|
1696
|
+
id: string;
|
|
1697
|
+
target: string;
|
|
1698
|
+
cwd: string;
|
|
1699
|
+
}
|
|
1700
|
+
export type RexMachineReference = RexLocalMachineReference | RexSshMachineReference;
|
|
1701
|
+
/** Where a placed native Pi child runs. */
|
|
1702
|
+
export type PlacementMachineReference = HerdrMachineReference | RexMachineReference;
|
|
1673
1703
|
export interface ExternalCliMachineStatus extends HerdrMachineReference {
|
|
1674
1704
|
remoteGit?: HerdrRemoteGitStatus;
|
|
1675
1705
|
}
|
|
@@ -1821,6 +1851,8 @@ export interface AsyncStatus {
|
|
|
1821
1851
|
runId: string;
|
|
1822
1852
|
/** Parent Pi process/window that owns local completion delivery. */
|
|
1823
1853
|
completionOwnerId?: string;
|
|
1854
|
+
/** The Pi process behind `completionOwnerId`; once it is dead, the session that owns the run delivers it. */
|
|
1855
|
+
completionOwnerProcess?: RecordedPid;
|
|
1824
1856
|
/** Host tool-call id retained when it differs from the internal run id. */
|
|
1825
1857
|
toolCallId?: string;
|
|
1826
1858
|
sessionId?: string;
|
|
@@ -1857,6 +1889,8 @@ export interface AsyncStatus {
|
|
|
1857
1889
|
pid?: number;
|
|
1858
1890
|
/** Linux PID namespace identity used to scope liveness probes. */
|
|
1859
1891
|
pidNamespaceScope?: string;
|
|
1892
|
+
/** Boot id of the machine when `pid` was recorded; a different current boot id proves the pid dead. */
|
|
1893
|
+
bootId?: string;
|
|
1860
1894
|
cwd?: string;
|
|
1861
1895
|
/** User-configured launcher that wrapped the background runner (argv only, never environment). */
|
|
1862
1896
|
launcher?: RunnerLauncher;
|
|
@@ -2132,6 +2166,10 @@ export interface ForegroundResumeRun {
|
|
|
2132
2166
|
sessionId?: string;
|
|
2133
2167
|
updatedAt: number;
|
|
2134
2168
|
children: ForegroundResumeChild[];
|
|
2169
|
+
/** Pi process running this run; only on records whose child is `running`. */
|
|
2170
|
+
owner?: RecordedPid;
|
|
2171
|
+
/** Workflow that launched this foreground child. */
|
|
2172
|
+
parentWorkflowRunId?: string;
|
|
2135
2173
|
}
|
|
2136
2174
|
export interface ForegroundChildControl {
|
|
2137
2175
|
index: number;
|
|
@@ -2315,6 +2353,8 @@ export interface SubagentState {
|
|
|
2315
2353
|
workflowControllers?: Map<string, AbortController>;
|
|
2316
2354
|
/** Live in-process workflow child stoppers keyed by parent workflow run id. */
|
|
2317
2355
|
workflowChildStops?: Map<string, (childId: string, message?: string) => boolean>;
|
|
2356
|
+
/** Background children awaited by a blocking workflow call: their parent cannot answer supervisor asks. */
|
|
2357
|
+
blockingWorkflowChildren?: Set<string>;
|
|
2318
2358
|
}
|
|
2319
2359
|
export interface HerdrProjectPaneSnapshot {
|
|
2320
2360
|
projectRoot: string;
|
|
@@ -2419,7 +2459,7 @@ export interface RunSyncOptions {
|
|
|
2419
2459
|
context?: "fresh" | "fork";
|
|
2420
2460
|
cwd?: string;
|
|
2421
2461
|
/** Resolved pane-native saved-machine placement. */
|
|
2422
|
-
machine?:
|
|
2462
|
+
machine?: PlacementMachineReference;
|
|
2423
2463
|
/** Explicit read override resolved by the remote ambient agent profile. */
|
|
2424
2464
|
remoteReads?: string[] | false;
|
|
2425
2465
|
/** Original cwd input retained for launch diagnostics. */
|
|
@@ -2580,6 +2620,8 @@ export interface ActiveAsyncCapacityConfig {
|
|
|
2580
2620
|
}
|
|
2581
2621
|
export interface ExtensionConfig {
|
|
2582
2622
|
asyncByDefault?: boolean;
|
|
2623
|
+
/** Relaunch this session's interrupted async workflows when the session is reopened or reloaded (default true). */
|
|
2624
|
+
autoResume?: boolean;
|
|
2583
2625
|
/** Set the context for launches that omit an explicit context. */
|
|
2584
2626
|
defaultSubagentContext?: "fresh" | "fork";
|
|
2585
2627
|
/** Configure how every resolved fork session is prepared before child spawn. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SubagentDelegationRequest, type SubagentDelegationResponse, type SubagentDelegationThinking, type SubagentDelegationUpdate, type SubagentDelegationUpdateUsage } from "../api/delegation.ts";
|
|
1
|
+
import { type SubagentDelegationProviderDiagnostics, type SubagentDelegationRequest, type SubagentDelegationResponse, type SubagentDelegationThinking, type SubagentDelegationUpdate, type SubagentDelegationUpdateUsage } from "../api/delegation.ts";
|
|
2
2
|
import type { AcceptanceInput, AgentContract, EffectsProjection, ExecutionProjection, IntercomBridgeConfig, JsonSchemaObject, ReviewProjection, ToolBudgetConfig, Usage } from "../shared/types.ts";
|
|
3
3
|
export interface PromptTemplateDelegationRequest {
|
|
4
4
|
requestId: string;
|
|
@@ -88,6 +88,7 @@ export interface PromptTemplateBridgeResult {
|
|
|
88
88
|
review?: ReviewProjection;
|
|
89
89
|
effects?: EffectsProjection;
|
|
90
90
|
usage?: Usage;
|
|
91
|
+
providerDiagnostics?: SubagentDelegationProviderDiagnostics;
|
|
91
92
|
progressSummary?: {
|
|
92
93
|
toolCount?: number;
|
|
93
94
|
durationMs?: number;
|
|
@@ -116,6 +117,7 @@ export interface PromptTemplateBridgeResult {
|
|
|
116
117
|
cacheRead?: number;
|
|
117
118
|
cacheWrite?: number;
|
|
118
119
|
turnCount?: number;
|
|
120
|
+
providerDiagnostics?: SubagentDelegationProviderDiagnostics;
|
|
119
121
|
}>;
|
|
120
122
|
};
|
|
121
123
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cloneJsonWithinByteLimit } from "./delegation-json.js";
|
|
2
|
+
import { clearProviderRetry, snapshotProviderDiagnostics } from "../shared/provider-diagnostics.js";
|
|
2
3
|
export function parsePromptTemplateRequest(data) {
|
|
3
4
|
if (!data || typeof data !== "object")
|
|
4
5
|
return undefined;
|
|
@@ -207,6 +208,9 @@ export function toSubagentDelegationUpdate(request, result) {
|
|
|
207
208
|
...(typeof legacy.durationMs === "number" ? { durationMs: legacy.durationMs } : {}),
|
|
208
209
|
...(typeof legacy.tokens === "number" ? { tokens: legacy.tokens } : {}),
|
|
209
210
|
...(legacy.usage ? { usage: legacy.usage } : {}),
|
|
211
|
+
...(result.details?.progress?.[0]?.providerDiagnostics ? {
|
|
212
|
+
providerDiagnostics: snapshotProviderDiagnostics(result.details.progress[0].providerDiagnostics),
|
|
213
|
+
} : {}),
|
|
210
214
|
};
|
|
211
215
|
}
|
|
212
216
|
function resolveSubagentDelegationStatus(result, aborted) {
|
|
@@ -282,6 +286,9 @@ export function toSubagentDelegationResponse(request, result, aborted) {
|
|
|
282
286
|
...(typeof child?.exitCode === "number" ? { exitCode: child.exitCode } : {}),
|
|
283
287
|
...(childLaunchContractDigest ? { launchContractDigest: childLaunchContractDigest } : {}),
|
|
284
288
|
...(projectedResult ? { result: projectedResult } : {}),
|
|
289
|
+
...(child?.providerDiagnostics ? {
|
|
290
|
+
providerDiagnostics: snapshotProviderDiagnostics(clearProviderRetry(child.providerDiagnostics)),
|
|
291
|
+
} : {}),
|
|
285
292
|
...(usage ? {
|
|
286
293
|
usage: {
|
|
287
294
|
input: usage.input,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SUBAGENT_DELEGATION_CANCEL_EVENT, SUBAGENT_DELEGATION_REQUEST_EVENT, SUBAGENT_DELEGATION_RESPONSE_EVENT, SUBAGENT_DELEGATION_STARTED_EVENT, SUBAGENT_DELEGATION_UPDATE_EVENT, } from "../api/delegation.js";
|
|
2
2
|
import { parseSubagentDelegationRequest } from "./delegation-request.js";
|
|
3
|
+
import { sameProviderDiagnostics } from "../shared/provider-diagnostics.js";
|
|
3
4
|
import { parsePromptTemplateRequest, toDelegationUpdate, toPromptTemplateResponse, toSubagentDelegationExecutionParams, toSubagentDelegationResponse, toSubagentDelegationUpdate, } from "./delegation-adapters.js";
|
|
4
5
|
export const PROMPT_TEMPLATE_SUBAGENT_REQUEST_EVENT = SUBAGENT_DELEGATION_REQUEST_EVENT;
|
|
5
6
|
export const PROMPT_TEMPLATE_SUBAGENT_STARTED_EVENT = SUBAGENT_DELEGATION_STARTED_EVENT;
|
|
@@ -58,7 +59,8 @@ function sameStructuredDelegationUpdateProgress(left, right) {
|
|
|
58
59
|
&& left.model === right.model
|
|
59
60
|
&& left.toolCount === right.toolCount
|
|
60
61
|
&& left.tokens === right.tokens
|
|
61
|
-
&& sameUpdateUsage(left.usage, right.usage)
|
|
62
|
+
&& sameUpdateUsage(left.usage, right.usage)
|
|
63
|
+
&& sameProviderDiagnostics(left.providerDiagnostics, right.providerDiagnostics);
|
|
62
64
|
}
|
|
63
65
|
export function registerPromptTemplateDelegationBridge(options) {
|
|
64
66
|
const legacyControllers = new Map();
|
|
@@ -7,7 +7,7 @@ import { editableAgentConfig, preservedAgentFrontmatterFields } from "../agents/
|
|
|
7
7
|
import { findModelInfo, getSupportedThinkingLevels, toModelInfo } from "../shared/model-info.js";
|
|
8
8
|
import { SelectorComponent } from "./selector.js";
|
|
9
9
|
import { canRenderComponents } from "../shared/extension-context.js";
|
|
10
|
-
const ADMIN_MESSAGE_TYPE = "subagents-admin";
|
|
10
|
+
export const ADMIN_MESSAGE_TYPE = "subagents-admin";
|
|
11
11
|
const INHERIT_MODEL_CHOICE = "Default / inherit session model";
|
|
12
12
|
const INHERIT_THINKING_CHOICE = "Default / inherit session thinking";
|
|
13
13
|
function sourceRank(source) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface FleetRect {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FleetLayout {
|
|
8
|
+
width: number;
|
|
9
|
+
rows: number;
|
|
10
|
+
bodyHeight: number;
|
|
11
|
+
roster: FleetRect;
|
|
12
|
+
output: FleetRect;
|
|
13
|
+
rosterStart: number;
|
|
14
|
+
rosterKeys: string[];
|
|
15
|
+
}
|
|
16
|
+
/** Coordinates are overlay-local, matching Pi's normalized input contract. */
|
|
17
|
+
export declare function fleetLayout(width: number, rows: number, selected: number, items: readonly {
|
|
18
|
+
key: string;
|
|
19
|
+
}[]): FleetLayout | undefined;
|
|
20
|
+
export declare function fleetContains(rect: FleetRect, x: number, y: number): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Coordinates are overlay-local, matching Pi's normalized input contract. */
|
|
2
|
+
export function fleetLayout(width, rows, selected, items) {
|
|
3
|
+
if (width < 36)
|
|
4
|
+
return undefined;
|
|
5
|
+
const bodyHeight = Math.max(2, Math.floor(rows * 0.85) - 6);
|
|
6
|
+
const rosterWidth = Math.max(22, Math.min(46, Math.floor((width - 3) * 0.38)));
|
|
7
|
+
const rosterStart = Math.max(0, Math.min(selected - bodyHeight + 1, Math.max(0, items.length - bodyHeight)));
|
|
8
|
+
return {
|
|
9
|
+
width, rows, bodyHeight, rosterStart,
|
|
10
|
+
roster: { x: 1, y: 3, width: rosterWidth, height: bodyHeight },
|
|
11
|
+
output: { x: rosterWidth + 2, y: 3, width: Math.max(1, width - rosterWidth - 3), height: bodyHeight },
|
|
12
|
+
rosterKeys: items.slice(rosterStart, rosterStart + bodyHeight).map((item) => item.key),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function fleetContains(rect, x, y) {
|
|
16
|
+
return x >= rect.x && x < rect.x + rect.width && y >= rect.y && y < rect.y + rect.height;
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ScrollView } from "@earendil-works/pi-tui";
|
|
2
|
+
/** Overlay-local clipping: ordinary overlays do not enter Pi's scroll layout traversal. */
|
|
3
|
+
export declare class FleetViewport {
|
|
4
|
+
private readonly body;
|
|
5
|
+
readonly scroll: ScrollView;
|
|
6
|
+
private readonly requestRender;
|
|
7
|
+
private resetTopOnLayout;
|
|
8
|
+
constructor(requestRender: () => void);
|
|
9
|
+
render(lines: string[], width: number, height: number): string[];
|
|
10
|
+
resetTop(): void;
|
|
11
|
+
follow(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ScrollView } from "@earendil-works/pi-tui";
|
|
2
|
+
/** Overlay-local clipping: ordinary overlays do not enter Pi's scroll layout traversal. */
|
|
3
|
+
export class FleetViewport {
|
|
4
|
+
body = {
|
|
5
|
+
lines: [],
|
|
6
|
+
render() { return this.lines; },
|
|
7
|
+
invalidate() { },
|
|
8
|
+
};
|
|
9
|
+
scroll = new ScrollView(this.body, { follow: "end", overscroll: "contain" });
|
|
10
|
+
requestRender;
|
|
11
|
+
resetTopOnLayout = false;
|
|
12
|
+
constructor(requestRender) {
|
|
13
|
+
this.requestRender = requestRender;
|
|
14
|
+
}
|
|
15
|
+
render(lines, width, height) {
|
|
16
|
+
this.body.lines = lines;
|
|
17
|
+
const rendered = this.scroll.render(width);
|
|
18
|
+
this.scroll.updateLayout(rendered.length, height, this.requestRender);
|
|
19
|
+
if (this.resetTopOnLayout) {
|
|
20
|
+
this.resetTopOnLayout = false;
|
|
21
|
+
this.scroll.scrollTo(0, { disableFollow: true });
|
|
22
|
+
}
|
|
23
|
+
return rendered.slice(this.scroll.scrollTop, this.scroll.scrollTop + this.scroll.viewportHeight);
|
|
24
|
+
}
|
|
25
|
+
resetTop() {
|
|
26
|
+
// Apply again after the new view's dimensions arrive: disableFollow suppresses following
|
|
27
|
+
// at the actual content end, which may differ from the previous view's end.
|
|
28
|
+
this.resetTopOnLayout = true;
|
|
29
|
+
this.scroll.scrollTo(0, { disableFollow: true });
|
|
30
|
+
}
|
|
31
|
+
follow() {
|
|
32
|
+
this.resetTopOnLayout = false;
|
|
33
|
+
this.scroll.scrollToEnd();
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/tui/fleet.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { type Component, type MarkdownTheme } from "@earendil-works/pi-tui";
|
|
2
|
+
import { type Component, type MarkdownTheme, type TuiMouseEvent, type TuiMouseEventResult } from "@earendil-works/pi-tui";
|
|
3
3
|
import { type ExternalRun } from "../api/external-runs.ts";
|
|
4
4
|
import { type FleetKeybindingAction, type FleetKeybindingsConfig, type ForegroundChildControl, type ForegroundResumeChild, type ForegroundResumeRun, type ForegroundRunControl, type SubagentState } from "../shared/types.ts";
|
|
5
5
|
import { type AsyncRunSummary } from "../runs/background/async-status.ts";
|
|
@@ -46,6 +46,7 @@ export type FleetItem = ({
|
|
|
46
46
|
updatedAt: number;
|
|
47
47
|
run: AsyncRunSummary;
|
|
48
48
|
step?: AsyncStep;
|
|
49
|
+
task?: string;
|
|
49
50
|
} | {
|
|
50
51
|
key: string;
|
|
51
52
|
kind: "external";
|
|
@@ -111,11 +112,8 @@ export declare class SubagentFleetComponent implements Component {
|
|
|
111
112
|
private snapshot;
|
|
112
113
|
private selected;
|
|
113
114
|
private selectedKey;
|
|
114
|
-
private
|
|
115
|
-
private
|
|
116
|
-
private detailLineCount;
|
|
117
|
-
private detailViewportHeight;
|
|
118
|
-
private bodyHeight;
|
|
115
|
+
private readonly viewport;
|
|
116
|
+
private renderedLayout;
|
|
119
117
|
private expandedTools;
|
|
120
118
|
private promptAuditOpen;
|
|
121
119
|
private promptAuditView;
|
|
@@ -141,6 +139,7 @@ export declare class SubagentFleetComponent implements Component {
|
|
|
141
139
|
private stopRefresh;
|
|
142
140
|
private refresh;
|
|
143
141
|
private moveSelection;
|
|
142
|
+
private selectItem;
|
|
144
143
|
private selectedPromptAudit;
|
|
145
144
|
private promptAuditItems;
|
|
146
145
|
private selectedPromptText;
|
|
@@ -155,6 +154,7 @@ export declare class SubagentFleetComponent implements Component {
|
|
|
155
154
|
private setActionNotice;
|
|
156
155
|
private runAction;
|
|
157
156
|
private scrollDetail;
|
|
157
|
+
handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
158
158
|
handleInput(data: string): void;
|
|
159
159
|
private rosterLines;
|
|
160
160
|
private renderedTranscript;
|