pi-subagents 0.87.0 → 0.88.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 +50 -0
- package/bundle/agents.js +3 -3
- package/bundle/child-tool-plan.js +3 -3
- package/bundle/{chunk-3CVOAS77.js → chunk-2DIEL4WG.js} +2 -2
- package/bundle/{chunk-ESWW6XSX.js → chunk-47ZN7NKR.js} +1 -1
- package/bundle/{chunk-C3KWLXDH.js → chunk-4MVDMA5C.js} +9 -1
- package/bundle/{chunk-XV7RTWTS.js → chunk-4ZQBZDF3.js} +21 -6
- package/bundle/{chunk-LZKVUWIY.js → chunk-5EMPFFO4.js} +30 -5
- package/bundle/{chunk-OOE3R7IQ.js → chunk-6CG2VAG4.js} +2 -2
- package/bundle/{chunk-LFKMM3UH.js → chunk-6OWNDN7R.js} +2 -2
- package/bundle/{chunk-HDICKROY.js → chunk-7OX6O7DQ.js} +31 -14
- package/bundle/{chunk-PGU4TZV3.js → chunk-CPSUJHZE.js} +417 -455
- package/bundle/{chunk-W52LJANO.js → chunk-CYKNHFXB.js} +1 -1
- package/bundle/{chunk-SIAQXPJ4.js → chunk-D32H53HM.js} +21 -9
- package/bundle/{chunk-YEXKJJVS.js → chunk-DSHQWGHO.js} +4 -4
- package/bundle/{chunk-DGTZKYIE.js → chunk-FLNDHNPE.js} +75 -44
- package/bundle/{chunk-6O7YH2QV.js → chunk-GDR2ILWY.js} +1 -1
- package/bundle/{chunk-C5QWQSSM.js → chunk-KXW62VBU.js} +1 -1
- package/bundle/{chunk-BFF6YDK6.js → chunk-L4YY2TOE.js} +1 -1
- package/bundle/{chunk-2NY5PCKQ.js → chunk-LV3CPYXJ.js} +4 -4
- package/bundle/{chunk-AIL46SZU.js → chunk-N6TAAIB3.js} +6 -4
- package/bundle/{chunk-EYGBK6CE.js → chunk-PCZEQQAQ.js} +114 -49
- package/bundle/{chunk-2D2DQGC2.js → chunk-PYKBTBY6.js} +27 -10
- package/bundle/{chunk-M2VBGET6.js → chunk-RMZAAXIR.js} +7 -2
- package/bundle/{chunk-OTLDAYEQ.js → chunk-VTUUOLM4.js} +14 -5
- package/bundle/{chunk-VFUFOZBU.js → chunk-W6HIYD2Z.js} +1 -1
- package/bundle/{chunk-USRX7QXD.js → chunk-XIA5GSEU.js} +2 -2
- package/bundle/{chunk-CTPAE36Y.js → chunk-YARY7JWU.js} +22 -0
- package/bundle/chunk-YDZ7BZD5.js +523 -0
- package/bundle/{chunk-JLDQ6YUR.js → chunk-YQSTGPEU.js} +12 -12
- package/bundle/{chunk-OZCPYJEY.js → chunk-ZJ2BT5TI.js} +130 -49
- package/bundle/control-channel.js +2 -2
- package/bundle/index.js +1 -1
- package/bundle/intercom-bridge.js +2 -2
- package/bundle/preflight.js +9 -9
- package/bundle/project-panes.js +3 -3
- package/bundle/required-child-extensions.js +1 -1
- package/docs/agents.md +4 -2
- package/docs/configuration.md +7 -3
- package/docs/observability.md +2 -0
- package/docs/tool-reference.md +4 -1
- package/docs/workflows.md +3 -1
- package/package.json +2 -2
- package/skills/pi-subagents/SKILL.md +8 -2
- package/src/agents/agent-management.d.ts +1 -0
- package/src/agents/agent-management.js +12 -4
- package/src/agents/agents.d.ts +1 -0
- package/src/agents/agents.js +2 -2
- package/src/extension/config.d.ts +1 -0
- package/src/extension/config.js +6 -0
- package/src/extension/index.d.ts +1 -1
- package/src/extension/index.js +47 -23
- package/src/extension/schemas.d.ts +2 -0
- package/src/extension/schemas.js +1 -0
- package/src/extension/subagent-launch-tool.d.ts +6 -2
- package/src/extension/subagent-launch-tool.js +13 -9
- package/src/extension/tool-activation.js +20 -3
- package/src/runs/background/async-resume.js +2 -1
- package/src/runs/background/async-retention.d.ts +0 -2
- package/src/runs/background/async-retention.js +11 -5
- package/src/runs/background/async-status.d.ts +2 -0
- package/src/runs/background/async-status.js +4 -0
- package/src/runs/background/run-child-session.d.ts +2 -2
- package/src/runs/background/run-child-session.js +4 -7
- package/src/runs/background/stale-run-reconciler.js +17 -8
- package/src/runs/background/steering.d.ts +2 -11
- package/src/runs/background/steering.js +11 -6
- package/src/runs/background/subagent-runner.d.ts +0 -2
- package/src/runs/background/subagent-runner.js +73 -58
- package/src/runs/foreground/async-steering-action.js +24 -9
- package/src/runs/foreground/execution.js +32 -15
- package/src/runs/foreground/prompt-audit.js +1 -0
- package/src/runs/foreground/subagent-executor.d.ts +1 -8
- package/src/runs/foreground/subagent-executor.js +17 -21
- package/src/runs/shared/async-status-projection.d.ts +2 -0
- package/src/runs/shared/async-status-projection.js +10 -0
- package/src/runs/shared/child-launch.js +6 -3
- package/src/runs/shared/child-session.d.ts +1 -1
- package/src/runs/shared/child-session.js +24 -30
- package/src/runs/shared/mcp-config-sources.d.ts +2 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.d.ts +5 -5
- package/src/runs/shared/mcp-direct-tool-allowlist.js +26 -15
- package/src/runs/shared/subagent-prompt-runtime.js +14 -2
- package/src/runs/shared/supervisor-wait-timer.d.ts +16 -0
- package/src/runs/shared/supervisor-wait-timer.js +61 -0
- package/src/shared/artifacts.d.ts +1 -0
- package/src/shared/artifacts.js +107 -9
- package/src/shared/compaction-interruption.d.ts +9 -0
- package/src/shared/compaction-interruption.js +47 -0
- package/src/shared/parent-wake.d.ts +3 -2
- package/src/shared/parent-wake.js +14 -3
- package/src/shared/reported-progress.d.ts +1 -0
- package/src/shared/reported-progress.js +12 -0
- package/src/shared/required-child-extensions.d.ts +2 -0
- package/src/shared/required-child-extensions.js +27 -0
- package/src/shared/status-format.d.ts +1 -0
- package/src/shared/status-format.js +1 -1
- package/src/shared/types.d.ts +9 -0
- package/src/shared/utils.d.ts +3 -1
- package/src/shared/utils.js +4 -0
- package/src/tui/fleet.d.ts +7 -2
- package/src/tui/fleet.js +22 -0
- package/src/tui/render.js +33 -2
- package/src/watchdog/permission-arbiter.js +1 -0
- package/src/watchdog/review.d.ts +0 -5
- package/src/watchdog/review.js +2 -1
- package/src/workflows/workflow-script-worker.js +3 -1
- package/bundle/chunk-XSDYTXHF.js +0 -242
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
snapshotRequiredChildExtensions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YARY7JWU.js";
|
|
4
4
|
import {
|
|
5
5
|
THINKING_LEVELS,
|
|
6
6
|
findConfiguredProjectRoot,
|
|
7
7
|
getAgentDir,
|
|
8
8
|
getConfigDirName,
|
|
9
9
|
getProjectConfigDir
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4MVDMA5C.js";
|
|
11
11
|
import {
|
|
12
12
|
TEMP_ROOT_DIR
|
|
13
13
|
} from "./chunk-JEZOSEWG.js";
|
|
@@ -509,17 +509,20 @@ function resolveMcpDirectToolResolution(mcpDirectTools, cwd = process.cwd(), run
|
|
|
509
509
|
const runtimeSelectionServers = /* @__PURE__ */ new Set([...selectedServers, ...selectedTools.keys()]);
|
|
510
510
|
const runtimeServers = resolveRuntimeMcpServers(config, runtimeSelectionServers, runtimeSnapshotHost);
|
|
511
511
|
const resolvedConfig = Object.keys(runtimeServers).length > 0 ? mergeConfigs(config, { mcpServers: runtimeServers }) : config;
|
|
512
|
-
|
|
512
|
+
const enabledSelectors = selectors.filter((selector) => resolvedConfig.mcpServers[selector.split("/", 1)[0]]?.disabled !== true);
|
|
513
|
+
validateSelectedServerDefinitions(resolvedConfig, enabledSelectors);
|
|
513
514
|
const runtime = Object.keys(runtimeServers).length > 0 ? { mcpConfig: resolvedConfig, runtimeServerNames: Object.keys(runtimeServers) } : {};
|
|
515
|
+
if (enabledSelectors.length === 0) return { selections: [], unresolvedSelectors: [], ...runtime };
|
|
514
516
|
const cache = loadMetadataCache();
|
|
515
|
-
if (!cache) return { selections: [], unresolvedSelectors:
|
|
517
|
+
if (!cache) return { selections: [], unresolvedSelectors: enabledSelectors, ...runtime };
|
|
516
518
|
const validMetadata = {};
|
|
517
519
|
for (const [serverName, definition] of Object.entries(resolvedConfig.mcpServers)) {
|
|
520
|
+
if (definition.disabled === true) continue;
|
|
518
521
|
const serverCache = cache.servers[serverName];
|
|
519
522
|
if (isServerCacheValid(serverCache, definition)) validMetadata[serverName] = serverCache;
|
|
520
523
|
}
|
|
521
524
|
const grant = planMcpDirectToolGrant({
|
|
522
|
-
selectors,
|
|
525
|
+
selectors: enabledSelectors,
|
|
523
526
|
servers: resolvedConfig.mcpServers,
|
|
524
527
|
metadata: validMetadata,
|
|
525
528
|
toolPrefix: resolvedConfig.settings?.toolPrefix
|
|
@@ -560,8 +563,8 @@ function formatUnresolvedBuiltinMcpSelectors(agentName, selectors) {
|
|
|
560
563
|
const subject = agentName ? `Agent '${agentName}'` : "Subagent";
|
|
561
564
|
return `${subject} selects MCP tools that Pi's built-in MCP does not offer: ${selectors.map((selector) => `mcp:${selector}`).join(", ")}. The server may be missing, disconnected, still connecting, or its tools hidden; check /mcp.`;
|
|
562
565
|
}
|
|
563
|
-
function extensionOnlyMcpServers(selections, host, cwd, projectTrusted) {
|
|
564
|
-
const registered = new Set(host.getMcpServers?.().map(({ name }) => name));
|
|
566
|
+
function extensionOnlyMcpServers(selections, host, cwd, projectTrusted, loadedByChild) {
|
|
567
|
+
const registered = new Set(host.getMcpServers?.().filter(({ extensionPath }) => !loadedByChild(extensionPath)).map(({ name }) => name));
|
|
565
568
|
const servers = [...new Set(selections.map(({ selector }) => selector.split("/")[0]))].filter((server) => registered.has(server));
|
|
566
569
|
if (servers.length === 0) return [];
|
|
567
570
|
const files = [path2.join(getAgentDir(), "mcp.json"), ...projectTrusted ? [path2.join(cwd, ".pi", "mcp.json")] : []];
|
|
@@ -714,11 +717,20 @@ function parseSettings(value) {
|
|
|
714
717
|
function mergeConfigs(base, next) {
|
|
715
718
|
const imports = [...base.imports ?? [], ...next.imports ?? []];
|
|
716
719
|
return {
|
|
717
|
-
mcpServers:
|
|
720
|
+
mcpServers: mergeServerDefinitions(base.mcpServers, next.mcpServers),
|
|
718
721
|
imports: imports.length ? [...new Set(imports)] : void 0,
|
|
719
722
|
settings: next.settings ? { ...base.settings, ...next.settings } : base.settings
|
|
720
723
|
};
|
|
721
724
|
}
|
|
725
|
+
function mergeServerDefinitions(base, next) {
|
|
726
|
+
const servers = { ...base };
|
|
727
|
+
for (const [name, definition] of Object.entries(next)) {
|
|
728
|
+
const previous = base[name];
|
|
729
|
+
if (previous && Object.keys(definition).every((key) => key === "disabled")) servers[name] = { ...previous, ...definition };
|
|
730
|
+
else servers[name] = previous?.disabled === void 0 ? definition : { disabled: previous.disabled, ...definition };
|
|
731
|
+
}
|
|
732
|
+
return servers;
|
|
733
|
+
}
|
|
722
734
|
function expandImports(config, cwd) {
|
|
723
735
|
if (!config.imports?.length) return config;
|
|
724
736
|
const importedServers = {};
|
|
@@ -738,7 +750,7 @@ function expandImports(config, cwd) {
|
|
|
738
750
|
return {
|
|
739
751
|
imports: config.imports,
|
|
740
752
|
settings: config.settings,
|
|
741
|
-
mcpServers:
|
|
753
|
+
mcpServers: mergeServerDefinitions(importedServers, config.mcpServers)
|
|
742
754
|
};
|
|
743
755
|
}
|
|
744
756
|
function resolveImportPath(importKind, cwd) {
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
remoteShellCommand,
|
|
5
5
|
runBoundedCommand,
|
|
6
6
|
sshMachineAccess
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GDR2ILWY.js";
|
|
8
8
|
import {
|
|
9
9
|
package_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6CG2VAG4.js";
|
|
11
11
|
import {
|
|
12
12
|
ensureSupervisorChannelDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CYKNHFXB.js";
|
|
14
14
|
import "./chunk-HXRB42AF.js";
|
|
15
15
|
import "./chunk-NIXWDZZV.js";
|
|
16
16
|
import {
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
resolveRexBinary,
|
|
35
35
|
rexCommandEnv,
|
|
36
36
|
rexGlobalArgs
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4MVDMA5C.js";
|
|
38
38
|
import "./chunk-JEZOSEWG.js";
|
|
39
39
|
import "./chunk-YFCK7H2S.js";
|
|
40
40
|
import "./chunk-QXASAHIA.js";
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
setInlineWorkflowCoverage,
|
|
11
11
|
setMainThinkingLevelSource,
|
|
12
12
|
widgetRenderKey
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5EMPFFO4.js";
|
|
14
14
|
import {
|
|
15
15
|
package_default
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6CG2VAG4.js";
|
|
17
17
|
import {
|
|
18
18
|
EXTERNAL_JOB_BRIDGE_REQUEST_DIR,
|
|
19
19
|
REVIVAL_ORIGIN_FILE,
|
|
@@ -23,6 +23,8 @@ import {
|
|
|
23
23
|
buildSubagentResultIntercomPayload,
|
|
24
24
|
clearProviderRetry,
|
|
25
25
|
compactNestedResultChildren,
|
|
26
|
+
compactionInProgress,
|
|
27
|
+
compactionInterruptedRun,
|
|
26
28
|
controlNotificationKey,
|
|
27
29
|
createParentWake,
|
|
28
30
|
createScheduledRunManager,
|
|
@@ -37,6 +39,7 @@ import {
|
|
|
37
39
|
getInspectorPlugins,
|
|
38
40
|
hasLiveSubagentWork,
|
|
39
41
|
hasWorkflowResumeRefusal,
|
|
42
|
+
installCompactionInterruptionCapture,
|
|
40
43
|
listRetainedChildren,
|
|
41
44
|
listScheduledRunSummaries,
|
|
42
45
|
markSeenWithTtl,
|
|
@@ -60,9 +63,10 @@ import {
|
|
|
60
63
|
sameProviderDiagnostics,
|
|
61
64
|
serviceExternalJobBridgeRequests,
|
|
62
65
|
snapshotProviderDiagnostics,
|
|
66
|
+
takeCompactionAbort,
|
|
63
67
|
workflowResumeClaimState,
|
|
64
68
|
workflowResumeRefusal
|
|
65
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-PCZEQQAQ.js";
|
|
66
70
|
import {
|
|
67
71
|
SUBAGENT_CHILD_ENV,
|
|
68
72
|
SUBAGENT_PARENT_SESSION_ENV,
|
|
@@ -82,14 +86,14 @@ import {
|
|
|
82
86
|
resolvePiSessionId,
|
|
83
87
|
resolveWaitToolConfig,
|
|
84
88
|
setDeclarationPinning
|
|
85
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-N6TAAIB3.js";
|
|
86
90
|
import {
|
|
87
91
|
deliverAsyncRunStop,
|
|
88
92
|
ownerConfirmedDead,
|
|
89
93
|
readSessionMessagesTail,
|
|
90
94
|
resolveSubagentRunId,
|
|
91
95
|
restoreForegroundRunHistory
|
|
92
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-LV3CPYXJ.js";
|
|
93
97
|
import {
|
|
94
98
|
ASYNC_STATUS_SNAPSHOT_KIND,
|
|
95
99
|
ASYNC_STATUS_SNAPSHOT_VERSION,
|
|
@@ -105,7 +109,7 @@ import {
|
|
|
105
109
|
resolveAsyncStatusChild,
|
|
106
110
|
runLaunchDir,
|
|
107
111
|
stopStoppableAsyncStatusChildren
|
|
108
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-4ZQBZDF3.js";
|
|
109
113
|
import {
|
|
110
114
|
CONTACT_SUPERVISOR_TOOL_NAME,
|
|
111
115
|
NATIVE_SUPERVISOR_TOOL_NAME,
|
|
@@ -115,7 +119,7 @@ import {
|
|
|
115
119
|
parseSupervisorReplyData,
|
|
116
120
|
parseSupervisorRequestDetails,
|
|
117
121
|
topLevelSupervisorTool
|
|
118
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-CYKNHFXB.js";
|
|
119
123
|
import {
|
|
120
124
|
MODEL_ONLY_TOOL,
|
|
121
125
|
canRenderComponents,
|
|
@@ -137,10 +141,11 @@ import {
|
|
|
137
141
|
loadConfig,
|
|
138
142
|
resolveAbandonedSlotReleaseAfterMs,
|
|
139
143
|
resolveAsyncByDefault,
|
|
144
|
+
resolveConfigDefaultTimeoutMs,
|
|
140
145
|
resolveDisabledFeatureSurface,
|
|
141
146
|
resolveMaxActiveAsyncRunsPerSession,
|
|
142
147
|
resolveScheduledStoreRoot
|
|
143
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-RMZAAXIR.js";
|
|
144
149
|
import {
|
|
145
150
|
ACTIVE_RUN_INDEX_DIR,
|
|
146
151
|
MissionNotFoundError,
|
|
@@ -191,28 +196,28 @@ import {
|
|
|
191
196
|
withWorkflowChildRunModel,
|
|
192
197
|
writeAsyncResultFile,
|
|
193
198
|
writeResultIndexForData
|
|
194
|
-
} from "./chunk-
|
|
195
|
-
import "./chunk-
|
|
199
|
+
} from "./chunk-CPSUJHZE.js";
|
|
200
|
+
import "./chunk-W6HIYD2Z.js";
|
|
196
201
|
import {
|
|
197
202
|
shouldUseNativeFsWatch
|
|
198
203
|
} from "./chunk-NIXWDZZV.js";
|
|
199
204
|
import {
|
|
200
205
|
validateIntercomBridgeConfig
|
|
201
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-47ZN7NKR.js";
|
|
202
207
|
import "./chunk-7F6RKT6W.js";
|
|
203
|
-
import "./chunk-
|
|
204
|
-
import "./chunk-
|
|
208
|
+
import "./chunk-D32H53HM.js";
|
|
209
|
+
import "./chunk-YARY7JWU.js";
|
|
205
210
|
import {
|
|
206
211
|
listHerdrProjectPaneRoots,
|
|
207
212
|
restoreHerdrProjectPaneSnapshots
|
|
208
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-2DIEL4WG.js";
|
|
209
214
|
import "./chunk-7J4ZXMY7.js";
|
|
210
215
|
import {
|
|
211
216
|
cleanupAllArtifactDirs,
|
|
212
217
|
cleanupOldArtifacts,
|
|
213
218
|
getArtifactPaths,
|
|
214
219
|
getArtifactsDir
|
|
215
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-YDZ7BZD5.js";
|
|
216
221
|
import {
|
|
217
222
|
listBackgroundWorkProviders
|
|
218
223
|
} from "./chunk-XA3DY6UG.js";
|
|
@@ -220,12 +225,12 @@ import "./chunk-YYREO77V.js";
|
|
|
220
225
|
import "./chunk-UKG4V45O.js";
|
|
221
226
|
import {
|
|
222
227
|
registerRuntimeAgentEventListener
|
|
223
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-L4YY2TOE.js";
|
|
224
229
|
import {
|
|
225
230
|
clearRuntimeAgentsForPi,
|
|
226
231
|
listRuntimeAgentConfigs,
|
|
227
232
|
mergeRuntimeAgents
|
|
228
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-KXW62VBU.js";
|
|
229
234
|
import {
|
|
230
235
|
DEFAULT_FILE_SYSTEM_RETRY_DELAYS_MS,
|
|
231
236
|
DEFAULT_WAIT_TOOL_NAME,
|
|
@@ -268,7 +273,7 @@ import {
|
|
|
268
273
|
waitToolName,
|
|
269
274
|
withSettingsFileLease,
|
|
270
275
|
writeAtomicJson
|
|
271
|
-
} from "./chunk-
|
|
276
|
+
} from "./chunk-4MVDMA5C.js";
|
|
272
277
|
import {
|
|
273
278
|
DEFAULT_ARTIFACT_CONFIG,
|
|
274
279
|
DIRS,
|
|
@@ -316,6 +321,7 @@ import { randomUUID as randomUUID3 } from "node:crypto";
|
|
|
316
321
|
import * as fs16 from "node:fs";
|
|
317
322
|
import * as os3 from "node:os";
|
|
318
323
|
import * as path16 from "node:path";
|
|
324
|
+
import { AgentSession } from "@earendil-works/pi-coding-agent";
|
|
319
325
|
import { Box as Box2, Container as Container3, Spacer as Spacer3, Text as Text2 } from "@earendil-works/pi-tui";
|
|
320
326
|
|
|
321
327
|
// src/agents/global-npm-root.ts
|
|
@@ -1570,9 +1576,13 @@ async function computeProcessStartIdentity(pid) {
|
|
|
1570
1576
|
}
|
|
1571
1577
|
if (process.platform === "win32") {
|
|
1572
1578
|
const started = await new Promise((resolve6) => {
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1579
|
+
try {
|
|
1580
|
+
execFile2("powershell.exe", ["-NoProfile", "-Command", `(Get-CimInstance Win32_Process -Filter "ProcessId=${pid}").CreationDate`], { encoding: "utf-8", windowsHide: true, timeout: 5e3 }, (error, stdout) => {
|
|
1581
|
+
resolve6(error ? "" : stdout.trim());
|
|
1582
|
+
});
|
|
1583
|
+
} catch {
|
|
1584
|
+
resolve6("");
|
|
1585
|
+
}
|
|
1576
1586
|
});
|
|
1577
1587
|
return started ? `win:${started}` : void 0;
|
|
1578
1588
|
}
|
|
@@ -5360,7 +5370,7 @@ function registerSlashCommands(pi, state, options = {}) {
|
|
|
5360
5370
|
}
|
|
5361
5371
|
fleetOpen = true;
|
|
5362
5372
|
try {
|
|
5363
|
-
const { openSubagentFleet } = await import("./chunk-
|
|
5373
|
+
const { openSubagentFleet } = await import("./chunk-PYKBTBY6.js");
|
|
5364
5374
|
await openSubagentFleet(ctx, state, { asyncDirRoot: DIRS.async, inspectorPlugins: () => getInspectorPlugins(pi), resultsDir: DIRS.results, fleetKeybindings: options.fleetKeybindings });
|
|
5365
5375
|
} finally {
|
|
5366
5376
|
fleetOpen = false;
|
|
@@ -8079,12 +8089,20 @@ ${advertised}` : ""}` }],
|
|
|
8079
8089
|
};
|
|
8080
8090
|
registerPinnedTool(pi, loader);
|
|
8081
8091
|
let loaderSelected = true;
|
|
8092
|
+
let undeclared;
|
|
8093
|
+
const activationState = () => [LOADER_NAME, SUBAGENT_NAME].map((name) => pi.getActiveTools().includes(name)).join();
|
|
8082
8094
|
const replyOwed = () => options.hasPendingSupervisorRequest?.() === true;
|
|
8083
|
-
|
|
8095
|
+
const decide = (ctx) => {
|
|
8084
8096
|
loaderSelected = applyRecordedSelection(pi, ctx, mode, replyOwed());
|
|
8097
|
+
undeclared = Array.isArray(pi.getActiveTools()) ? activationState() : void 0;
|
|
8098
|
+
};
|
|
8099
|
+
pi.on("session_start", (_event, ctx) => decide(ctx));
|
|
8100
|
+
pi.on("session_tree", (_event, ctx) => decide(ctx));
|
|
8101
|
+
pi.on("agent_start", () => {
|
|
8102
|
+
undeclared = void 0;
|
|
8085
8103
|
});
|
|
8086
|
-
pi.on("
|
|
8087
|
-
loaderSelected
|
|
8104
|
+
pi.on("model_select", (_event, ctx) => {
|
|
8105
|
+
if (mode === "auto" && ctx.isIdle() && undeclared === activationState() && loaderSelected !== addsToolsWithoutCheckpoint(ctx.model) && ctx.sessionManager.buildSessionContext().messages.length === 0) decide(ctx);
|
|
8088
8106
|
});
|
|
8089
8107
|
pi.on("before_agent_start", (event) => {
|
|
8090
8108
|
const available = pi.getAllTools();
|
|
@@ -8678,6 +8696,7 @@ function registerSubagentExtension(pi) {
|
|
|
8678
8696
|
if (process.env[SUBAGENT_CHILD_ENV] === "1") {
|
|
8679
8697
|
return;
|
|
8680
8698
|
}
|
|
8699
|
+
installCompactionInterruptionCapture(AgentSession);
|
|
8681
8700
|
const runtimeRegistry = getRuntimeRegistry();
|
|
8682
8701
|
setMainThinkingLevelSource(() => readMainThinkingLevel(() => pi.getThinkingLevel()));
|
|
8683
8702
|
DIRS.results = ensureAccessibleDir(DIRS.results);
|
|
@@ -8765,7 +8784,7 @@ function registerSubagentExtension(pi) {
|
|
|
8765
8784
|
const ctx = withLastUiContext((current) => current);
|
|
8766
8785
|
if (!ctx) return;
|
|
8767
8786
|
try {
|
|
8768
|
-
const { openSubagentFleet } = await import("./chunk-
|
|
8787
|
+
const { openSubagentFleet } = await import("./chunk-PYKBTBY6.js");
|
|
8769
8788
|
await openSubagentFleet(ctx, state, { initialKey: itemKey, asyncDirRoot: DIRS.async, resultsDir: DIRS.results, fleetKeybindings: config.fleetKeybindings, inspectorPlugins: () => getInspectorPlugins(pi) });
|
|
8770
8789
|
} catch (error) {
|
|
8771
8790
|
if (isStaleExtensionContextError(error)) {
|
|
@@ -8938,7 +8957,7 @@ function registerSubagentExtension(pi) {
|
|
|
8938
8957
|
])
|
|
8939
8958
|
});
|
|
8940
8959
|
} catch (error) {
|
|
8941
|
-
|
|
8960
|
+
reportSessionWarning(state, `Failed to clean retained async subagent state: ${error instanceof Error ? error.message : String(error)}`, "async-retention-cleanup");
|
|
8942
8961
|
}
|
|
8943
8962
|
}, ASYNC_RETENTION_DELAY_MS);
|
|
8944
8963
|
asyncRetentionTimer.unref?.();
|
|
@@ -8974,7 +8993,7 @@ function registerSubagentExtension(pi) {
|
|
|
8974
8993
|
let executor;
|
|
8975
8994
|
let executorPromise;
|
|
8976
8995
|
let executorModulePromise;
|
|
8977
|
-
const loadExecutorModule = () => executorModulePromise ??= import("./chunk-
|
|
8996
|
+
const loadExecutorModule = () => executorModulePromise ??= import("./chunk-ZJ2BT5TI.js");
|
|
8978
8997
|
const getExecutor = () => {
|
|
8979
8998
|
executorPromise ??= loadExecutorModule().then(({ createSubagentExecutor }) => {
|
|
8980
8999
|
executor = createSubagentExecutor(executorDeps);
|
|
@@ -8988,7 +9007,7 @@ function registerSubagentExtension(pi) {
|
|
|
8988
9007
|
modulePreloadTimer = setTimeout(() => {
|
|
8989
9008
|
loadExecutorModule().catch(() => {
|
|
8990
9009
|
});
|
|
8991
|
-
if (fleetViewEnabled) import("./chunk-
|
|
9010
|
+
if (fleetViewEnabled) import("./chunk-PYKBTBY6.js").catch(() => {
|
|
8992
9011
|
});
|
|
8993
9012
|
}, MODULE_PRELOAD_DELAY_MS);
|
|
8994
9013
|
modulePreloadTimer.unref?.();
|
|
@@ -9161,12 +9180,12 @@ ${close}` }]
|
|
|
9161
9180
|
registerWaitTool(pi, state, waitToolConfig.enabled, waitSubscriptionManager, waitToolConfig.defaultTimeoutMs, void 0, supervisorChannel.hasPendingRequests);
|
|
9162
9181
|
pi.on("agent_end", async (_event, ctx) => {
|
|
9163
9182
|
try {
|
|
9164
|
-
if (ctx.hasUI && ctx.signal?.aborted) {
|
|
9183
|
+
if (ctx.hasUI && ctx.signal?.aborted && !takeCompactionAbort(ctx.sessionManager)) {
|
|
9165
9184
|
parentWake.userAborted();
|
|
9166
9185
|
const active = activeAsyncJobCount();
|
|
9167
9186
|
if (active > 0) ctx.ui.notify(`${active} background subagent run${active === 1 ? " is" : "s are"} still active${slashCommandsEnabled ? " \xB7 /subagents-stop" : ""}`, "info");
|
|
9168
9187
|
}
|
|
9169
|
-
if (!ctx.hasUI) await drainOutstandingWork({ state, events: pi.events, hasPendingSupervisorRequest: supervisorChannel.hasPendingRequests }).then(resultWatcher.deliverPendingResults);
|
|
9188
|
+
if (!ctx.hasUI) await drainOutstandingWork({ state, events: pi.events, hasPendingSupervisorRequest: supervisorChannel.hasPendingRequests, timeoutMs: resolveConfigDefaultTimeoutMs(config.timeoutMs) }).then(resultWatcher.deliverPendingResults);
|
|
9170
9189
|
} finally {
|
|
9171
9190
|
const ownerSessionId = state.currentSessionId;
|
|
9172
9191
|
if (ownerSessionId) {
|
|
@@ -9477,9 +9496,11 @@ ${close}` }]
|
|
|
9477
9496
|
}
|
|
9478
9497
|
};
|
|
9479
9498
|
let compactionResumeTimer;
|
|
9499
|
+
let compactionInterruptedParent = false;
|
|
9480
9500
|
const cancelCompactionResume = () => {
|
|
9481
9501
|
clearTimeout(compactionResumeTimer);
|
|
9482
9502
|
compactionResumeTimer = void 0;
|
|
9503
|
+
compactionInterruptedParent = false;
|
|
9483
9504
|
};
|
|
9484
9505
|
pi.on("agent_start", () => {
|
|
9485
9506
|
cancelCompactionResume();
|
|
@@ -9499,32 +9520,42 @@ ${close}` }]
|
|
|
9499
9520
|
pi.on("session_before_compact", (event) => {
|
|
9500
9521
|
if (event.reason !== "manual") suspendWidgetsForCompaction();
|
|
9501
9522
|
});
|
|
9502
|
-
|
|
9523
|
+
const wakeAfterCompaction = (completed) => (event, ctx) => {
|
|
9503
9524
|
if (event.reason !== "manual") return;
|
|
9504
|
-
|
|
9505
|
-
|
|
9525
|
+
const sessionManager = ctx.sessionManager;
|
|
9526
|
+
if (completed && compactionInterruptedRun(sessionManager)) compactionInterruptedParent = true;
|
|
9527
|
+
if (compactionResumeTimer) return;
|
|
9506
9528
|
const sessionId = state.currentSessionId;
|
|
9507
9529
|
const deadline = Date.now() + COMPACTION_RESUME_DEADLINE_MS;
|
|
9508
|
-
const
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9530
|
+
const wakeWhenIdle = () => {
|
|
9531
|
+
compactionResumeTimer = void 0;
|
|
9532
|
+
if (state.currentSessionId !== sessionId) return;
|
|
9533
|
+
let idle;
|
|
9534
|
+
try {
|
|
9535
|
+
idle = ctx.isIdle();
|
|
9536
|
+
} catch {
|
|
9514
9537
|
return;
|
|
9515
9538
|
}
|
|
9516
|
-
|
|
9539
|
+
if (!idle || compactionInProgress(sessionManager)) {
|
|
9540
|
+
if (Date.now() < deadline) compactionResumeTimer = setTimeout(wakeWhenIdle, COMPACTION_RESUME_POLL_MS);
|
|
9541
|
+
return;
|
|
9542
|
+
}
|
|
9543
|
+
const interrupted = compactionInterruptedParent && activeAsyncJobCount() > 0 && withLastUiContext(() => true) === true;
|
|
9544
|
+
compactionInterruptedParent = false;
|
|
9545
|
+
if (!parentWake.takeDeferredWake() && !interrupted) return;
|
|
9517
9546
|
parentWake.sendMessage(
|
|
9518
9547
|
{
|
|
9519
9548
|
customType: "subagent-compaction-resume",
|
|
9520
|
-
content: "Compaction is complete. Resume the parent task now; background subagent results will arrive separately when ready.",
|
|
9549
|
+
content: interrupted ? "Compaction is complete. Resume the parent task now; background subagent results will arrive separately when ready." : "Compaction is complete. Act on the background subagent notices above.",
|
|
9521
9550
|
display: false
|
|
9522
9551
|
},
|
|
9523
9552
|
{ triggerTurn: true }
|
|
9524
9553
|
);
|
|
9525
9554
|
};
|
|
9526
|
-
compactionResumeTimer = setTimeout(
|
|
9527
|
-
}
|
|
9555
|
+
compactionResumeTimer = setTimeout(wakeWhenIdle, COMPACTION_RESUME_POLL_MS);
|
|
9556
|
+
};
|
|
9557
|
+
pi.on("session_compact", wakeAfterCompaction(true));
|
|
9558
|
+
pi.on("session_compact_failed", wakeAfterCompaction(false));
|
|
9528
9559
|
pi.on("session_start", (event, ctx) => {
|
|
9529
9560
|
parentWake.bindSession(ctx);
|
|
9530
9561
|
completionNotifier.bindSession(ctx.sessionManager);
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
validateCodeOwnedProfileRunner,
|
|
9
9
|
validatePermissionRules,
|
|
10
10
|
validateToolBudgetConfig
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4MVDMA5C.js";
|
|
12
12
|
|
|
13
13
|
// src/agents/runtime-agent-registry.ts
|
|
14
14
|
var RUNTIME_AGENT_REGISTRY_KEY = "pi-subagents.runtime-agents.v1";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
summarizeContextModes,
|
|
13
13
|
utf8Tail,
|
|
14
14
|
workflowPreflightLaneForRuntimeKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4ZQBZDF3.js";
|
|
16
16
|
import {
|
|
17
17
|
ownsRun
|
|
18
18
|
} from "./chunk-HXRB42AF.js";
|
|
@@ -34,11 +34,11 @@ import {
|
|
|
34
34
|
updateActiveRunIndex,
|
|
35
35
|
validateModelResponseAliases,
|
|
36
36
|
writeAsyncResultFile
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-CPSUJHZE.js";
|
|
38
38
|
import {
|
|
39
39
|
deliverStopRequest,
|
|
40
40
|
stopInboxClosedPath
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-W6HIYD2Z.js";
|
|
42
42
|
import {
|
|
43
43
|
SUBAGENT_STOPPED_MESSAGE,
|
|
44
44
|
formatDuration,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
waitToolName,
|
|
51
51
|
writeAtomicJson,
|
|
52
52
|
writePrivateAtomicJson
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-4MVDMA5C.js";
|
|
54
54
|
import {
|
|
55
55
|
DIRS
|
|
56
56
|
} from "./chunk-JEZOSEWG.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
projectTimeoutRecovery,
|
|
9
9
|
readAsyncRecoveryDescriptor,
|
|
10
10
|
utf8Tail
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4ZQBZDF3.js";
|
|
12
12
|
import {
|
|
13
13
|
MAX_ARGS_BYTES,
|
|
14
14
|
MAX_ARGS_DEPTH,
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
resultFilePath,
|
|
22
22
|
resultPayloadMatchesSessionRun,
|
|
23
23
|
resultPayloadPathForSessionRun
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-CPSUJHZE.js";
|
|
25
25
|
import {
|
|
26
26
|
PROJECT_SUBAGENTS_RELATIVE_DIR
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-YDZ7BZD5.js";
|
|
28
28
|
import {
|
|
29
29
|
listBackgroundWorkWakeChannels,
|
|
30
30
|
snapshotBackgroundWork
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
waitToolName,
|
|
51
51
|
withSettingsFileLease,
|
|
52
52
|
writePrivateAtomicJson
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-4MVDMA5C.js";
|
|
54
54
|
import {
|
|
55
55
|
DIRS,
|
|
56
56
|
INTERCOM_DETACH_REQUEST_EVENT,
|
|
@@ -820,6 +820,7 @@ var SubagentParamProperties = {
|
|
|
820
820
|
description: 'Management/control only; omit for execution. validate accepts workflow: true or a script path. Discover actions with {action:"guide",options:{topic:"tool-reference"}}.'
|
|
821
821
|
})),
|
|
822
822
|
capabilities: Type2.Optional(Type2.Boolean({ description: "list: compact capability rows/details without system prompts." })),
|
|
823
|
+
search: Type2.Optional(Type2.String({ minLength: 1, description: "list: case-insensitive match on agent name, alias, or description." })),
|
|
823
824
|
name: Type2.Optional(Type2.String({ description: "schedule.create name." })),
|
|
824
825
|
id: Type2.Optional(Type2.String({
|
|
825
826
|
description: "Run id/prefix for status/control."
|
|
@@ -4401,6 +4402,7 @@ async function runWatchdogAttempt(ctx, request, options) {
|
|
|
4401
4402
|
hasDiff: diffBaseline !== void 0
|
|
4402
4403
|
});
|
|
4403
4404
|
const agent2 = new Agent({
|
|
4405
|
+
sessionId,
|
|
4404
4406
|
initialState: {
|
|
4405
4407
|
systemPrompt,
|
|
4406
4408
|
model: selection.model,
|