@ashx-j/lunr 0.2.19 → 0.2.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.
- package/CHANGELOG.md +23 -0
- package/README.md +2 -2
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +0 -2
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts +6 -4
- package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js +93 -49
- package/dist/builtin-extensions/pi-intercom/broker/spawn.js.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-intercom/index.js +351 -351
- package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +80 -43
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +18 -8
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +36 -11
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -3
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +21 -12
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +7 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +225 -15
- package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts +29 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +179 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +89 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +541 -0
- package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +9 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +34 -9
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js +1 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +2 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +35 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +3 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +54 -38
- package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +3 -6
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +64 -5
- package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +21 -8
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +62 -16
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +75 -18
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +13 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +67 -11
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +5 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +13 -3
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +3 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +68 -11
- package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts +12 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js +21 -2
- package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +16 -4
- package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +2 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +24 -6
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +44 -4
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +227 -133
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts +2 -13
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js +5 -91
- package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js.map +1 -1
- package/dist/core/permissions.d.ts +1 -0
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +8 -4
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +0 -5
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/runtime-bridges.d.ts.map +1 -1
- package/dist/core/runtime-bridges.js +0 -2
- package/dist/core/runtime-bridges.js.map +1 -1
- package/dist/core/subagent-cancellation.d.ts +21 -0
- package/dist/core/subagent-cancellation.d.ts.map +1 -0
- package/dist/core/subagent-cancellation.js +53 -0
- package/dist/core/subagent-cancellation.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +12 -18
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +12 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +29 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/node-runtime/{agent-session-services-35WNVGMR.js → agent-session-services-75JKASCW.js} +3 -3
- package/dist/node-runtime/{builtin-extensions-322XDDEM.js → builtin-extensions-X4JMM4ZS.js} +2 -2
- package/dist/node-runtime/{chunk-XATUM2HK.js → chunk-25I2BHAA.js} +1 -1
- package/dist/node-runtime/{chunk-MCUNIRD5.js → chunk-46ECNOLF.js} +477 -246
- package/dist/node-runtime/{chunk-J26TSGDL.js → chunk-6N22HULO.js} +8 -5
- package/dist/node-runtime/{chunk-TFBIJTM3.js → chunk-AL2FMKKM.js} +7 -7
- package/dist/node-runtime/chunk-AOFXZQKA.js +24 -0
- package/dist/node-runtime/chunk-BBUVIEZB.js +51 -0
- package/dist/node-runtime/{chunk-ZRCBN365.js → chunk-ELWEXVO5.js} +7 -7
- package/dist/node-runtime/{chunk-ATGA2WLC.js → chunk-JYNNB7DU.js} +397 -34
- package/dist/node-runtime/{chunk-4FX25LWP.js → chunk-K3646JTM.js} +16 -117
- package/dist/node-runtime/{chunk-PNJSG3IZ.js → chunk-LTYWTR3V.js} +1 -369
- package/dist/node-runtime/{chunk-TXHKBRHZ.js → chunk-QKFMBRAL.js} +45 -31
- package/dist/node-runtime/{command-DWUM5X3U.js → command-RBTRL55A.js} +1 -1
- package/dist/node-runtime/{gateway-UZXMFGWY.js → gateway-L4ANRTVE.js} +2 -2
- package/dist/node-runtime/index.js +9 -8
- package/dist/node-runtime/{interactive-mode-QT5IKGQ5.js → interactive-mode-HPUNH7SV.js} +5 -4
- package/dist/node-runtime/{lunr-cron-QPBTKBGI.js → lunr-cron-NNYTWTGF.js} +2 -2
- package/dist/node-runtime/main.js +7 -7
- package/dist/node-runtime/{pi-intercom-EEMBGQID.js → pi-intercom-DDQMRNPJ.js} +96 -76
- package/dist/node-runtime/{pi-subagents-7YJ3I4VE.js → pi-subagents-T5WMMLBB.js} +1040 -318
- package/dist/node-runtime/rpc-entry.js +7 -7
- package/dist/node-runtime/{runtime-bridges-3RKBDLNA.js → runtime-bridges-NJQERQ72.js} +2 -4
- package/dist/node-runtime/{subagent-executor-5Q5A4HJ2.js → subagent-executor-SRFC26SJ.js} +168 -249
- package/docs/features.md +17 -3
- package/docs/keybindings.md +3 -1
- package/docs/settings.md +1 -1
- package/package.json +4 -4
- package/dist/builtin-extensions/lunr-settings-tools.d.ts +0 -4
- package/dist/builtin-extensions/lunr-settings-tools.d.ts.map +0 -1
- package/dist/builtin-extensions/lunr-settings-tools.js +0 -120
- package/dist/builtin-extensions/lunr-settings-tools.js.map +0 -1
- package/dist/core/settings-tools-bridge.d.ts +0 -35
- package/dist/core/settings-tools-bridge.d.ts.map +0 -1
- package/dist/core/settings-tools-bridge.js +0 -56
- package/dist/core/settings-tools-bridge.js.map +0 -1
- package/dist/node-runtime/chunk-3NMWLTPV.js +0 -64
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
checkForUpdate,
|
|
7
7
|
markUpdateNotified
|
|
8
8
|
} from "./chunk-KWA4OC2J.js";
|
|
9
|
+
import {
|
|
10
|
+
SubagentEscapeSequence,
|
|
11
|
+
getSubagentCancellation
|
|
12
|
+
} from "./chunk-BBUVIEZB.js";
|
|
9
13
|
import {
|
|
10
14
|
copyToClipboard,
|
|
11
15
|
readClipboardText
|
|
@@ -31,13 +35,25 @@ import {
|
|
|
31
35
|
import {
|
|
32
36
|
MissingSessionCwdError,
|
|
33
37
|
SessionImportFileNotFoundError,
|
|
38
|
+
beginTurn,
|
|
39
|
+
captureTreeChanges,
|
|
40
|
+
clearRollback,
|
|
41
|
+
disableRollbackForSession,
|
|
42
|
+
enableRollbackForSession,
|
|
34
43
|
formatCatalogRefreshSummary,
|
|
35
44
|
formatMissingSessionCwdPrompt,
|
|
36
45
|
hasGrokCliXaiAuth,
|
|
46
|
+
initRollback,
|
|
47
|
+
isRollbackEnabled,
|
|
48
|
+
isRollbackSessionForceEnabled,
|
|
49
|
+
migrateRollbackSession,
|
|
37
50
|
parseSkillBlock,
|
|
51
|
+
peekRollbackTurnsConsumed,
|
|
38
52
|
refreshModelCandidatesForInit,
|
|
53
|
+
rollbackLastTurn,
|
|
54
|
+
setRollbackWarningHandler,
|
|
39
55
|
stripJsonComments
|
|
40
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-JYNNB7DU.js";
|
|
41
57
|
import {
|
|
42
58
|
computeFileLists,
|
|
43
59
|
createFileOps,
|
|
@@ -96,21 +112,9 @@ import {
|
|
|
96
112
|
getModelTiersBridge
|
|
97
113
|
} from "./chunk-W3CVH5RX.js";
|
|
98
114
|
import {
|
|
99
|
-
beginTurn,
|
|
100
|
-
captureTreeChanges,
|
|
101
|
-
clearRollback,
|
|
102
|
-
disableRollbackForSession,
|
|
103
|
-
enableRollbackForSession,
|
|
104
115
|
getAllPlanUsageResults,
|
|
105
|
-
getUsageServiceBridge
|
|
106
|
-
|
|
107
|
-
isRollbackEnabled,
|
|
108
|
-
isRollbackSessionForceEnabled,
|
|
109
|
-
migrateRollbackSession,
|
|
110
|
-
peekRollbackTurnsConsumed,
|
|
111
|
-
rollbackLastTurn,
|
|
112
|
-
setRollbackWarningHandler
|
|
113
|
-
} from "./chunk-PNJSG3IZ.js";
|
|
116
|
+
getUsageServiceBridge
|
|
117
|
+
} from "./chunk-LTYWTR3V.js";
|
|
114
118
|
import {
|
|
115
119
|
convertToPng,
|
|
116
120
|
processImage
|
|
@@ -124,7 +128,7 @@ import {
|
|
|
124
128
|
resetPermissions,
|
|
125
129
|
restorePermissionModeAfterPlan,
|
|
126
130
|
setPermissionMode
|
|
127
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-6N22HULO.js";
|
|
128
132
|
import {
|
|
129
133
|
getGlobalInstructionsPath,
|
|
130
134
|
getModelInstructionsPath
|
|
@@ -1230,8 +1234,8 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
|
|
|
1230
1234
|
updateContent(message, options) {
|
|
1231
1235
|
this.lastMessage = message, this.thinkingSource = options?.thinkingSource, this.contentContainer.clear();
|
|
1232
1236
|
let sourceMessage = this.thinkingSource ?? message, sourceThinkingRuns = collectThinkingRuns(sourceMessage.content);
|
|
1233
|
-
|
|
1234
|
-
let isFirstTextBlock = !0, thinkingRunIndex = -1
|
|
1237
|
+
message.content.some((c) => c.type === "text" && c.text.trim() || !this.hideThinkingBlock && c.type === "thinking" && c.thinking.trim()) && this.contentContainer.addChild(new Spacer(1));
|
|
1238
|
+
let isFirstTextBlock = !0, thinkingRunIndex = -1;
|
|
1235
1239
|
for (let i = 0; i < message.content.length; i++) {
|
|
1236
1240
|
let content = message.content[i];
|
|
1237
1241
|
if (content.type === "text" && content.text.trim()) {
|
|
@@ -1249,18 +1253,12 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
|
|
|
1249
1253
|
let thinking = thinkingContent.thinking.trim();
|
|
1250
1254
|
thinking && displayBlocks.push(thinking);
|
|
1251
1255
|
}
|
|
1252
|
-
i
|
|
1253
|
-
let thinkingBlocks = sourceThinkingRuns[thinkingRunIndex] ?? displayBlocks;
|
|
1254
|
-
if (thinkingBlocks.length === 0 || this.hideThinkingBlock)
|
|
1256
|
+
if (i--, displayBlocks.length === 0 || this.hideThinkingBlock)
|
|
1255
1257
|
continue;
|
|
1256
|
-
|
|
1258
|
+
let sourceBlocks = sourceThinkingRuns[thinkingRunIndex] ?? [], fullyRevealed = displayBlocks.length === sourceBlocks.length && displayBlocks.every((block, index) => block === sourceBlocks[index]);
|
|
1259
|
+
this.renderThinkingRun(thinkingRunIndex, displayBlocks, message, i, fullyRevealed);
|
|
1257
1260
|
}
|
|
1258
1261
|
}
|
|
1259
|
-
if (!this.hideThinkingBlock && !renderedThinking && sourceThinkingRuns.length > 0) {
|
|
1260
|
-
thinkingRunIndex = 0;
|
|
1261
|
-
let thinkingBlocks = sourceThinkingRuns[0] ?? [];
|
|
1262
|
-
thinkingBlocks.length > 0 && this.renderThinkingRun(thinkingRunIndex, thinkingBlocks, message, -1);
|
|
1263
|
-
}
|
|
1264
1262
|
let hasToolCalls = message.content.some((c) => c.type === "toolCall");
|
|
1265
1263
|
if (this.hasToolCalls = hasToolCalls, message.stopReason === "length")
|
|
1266
1264
|
this.contentContainer.addChild(new Spacer(1)), this.contentContainer.addChild(new Text(theme.fg("error", "Error: Model stopped because it reached the maximum output token limit. The response may be incomplete."), this.outputPad, 0));
|
|
@@ -1274,8 +1272,8 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
|
|
|
1274
1272
|
}
|
|
1275
1273
|
}
|
|
1276
1274
|
}
|
|
1277
|
-
renderThinkingRun(thinkingRunIndex, thinkingBlocks, displayMessage, displayIndex) {
|
|
1278
|
-
let hasVisibleContentAfter = displayIndex >= 0 ? displayMessage.content.slice(displayIndex + 1).some((c) => c.type === "text" && c.text.trim() || c.type === "thinking" && c.thinking.trim()) : displayMessage.content.some((c) => c.type === "text" && c.text.trim()), runComplete = isThinkingRunComplete(!1, this.thinkingTimings?.[thinkingRunIndex], this.thinkingTimings !== void 0), wrap = (inner) => {
|
|
1275
|
+
renderThinkingRun(thinkingRunIndex, thinkingBlocks, displayMessage, displayIndex, fullyRevealed) {
|
|
1276
|
+
let hasVisibleContentAfter = displayIndex >= 0 ? displayMessage.content.slice(displayIndex + 1).some((c) => c.type === "text" && c.text.trim() || c.type === "thinking" && c.thinking.trim()) : displayMessage.content.some((c) => c.type === "text" && c.text.trim()), runComplete = fullyRevealed && isThinkingRunComplete(!1, this.thinkingTimings?.[thinkingRunIndex], this.thinkingTimings !== void 0), wrap = (inner) => {
|
|
1279
1277
|
this.contentContainer.addChild(new ThinkingRunBlock(this, thinkingRunIndex, inner));
|
|
1280
1278
|
};
|
|
1281
1279
|
if (this.thinkingCollapse && !this.isRunExpanded(thinkingRunIndex) && runComplete) {
|
|
@@ -1328,7 +1326,7 @@ function collectThinkingRuns(content) {
|
|
|
1328
1326
|
let thinking = thinkingContent.thinking.trim();
|
|
1329
1327
|
thinking && blocks.push(thinking);
|
|
1330
1328
|
}
|
|
1331
|
-
|
|
1329
|
+
runs.push(blocks);
|
|
1332
1330
|
}
|
|
1333
1331
|
return runs;
|
|
1334
1332
|
}
|
|
@@ -3976,7 +3974,13 @@ var ToolExecutionComponent = class extends Container14 {
|
|
|
3976
3974
|
return !!this.result?.isError && this.groupFollowed && !this.expanded && !this.isPartial && this.getRenderShell() === "default" && this.toolName !== "subagent" && this.toolName !== "subagent_wait";
|
|
3977
3975
|
}
|
|
3978
3976
|
shouldSkipCompactResult() {
|
|
3979
|
-
|
|
3977
|
+
if (this.result === void 0 || this.isPartial || this.expanded)
|
|
3978
|
+
return !1;
|
|
3979
|
+
if (this.toolName === "subagent") {
|
|
3980
|
+
let details = this.result.details;
|
|
3981
|
+
return !(this.result.isError || Array.isArray(details?.results) && details.results.length > 0 || details?.mode === "management");
|
|
3982
|
+
}
|
|
3983
|
+
return this.result.isError ? this.shouldHideGroupedErrorBody() : this.getRenderShell() === "default";
|
|
3980
3984
|
}
|
|
3981
3985
|
formatHoistedGroupErrors() {
|
|
3982
3986
|
if (this.groupFollowed || this.expanded)
|
|
@@ -5329,6 +5333,7 @@ var InteractiveMode = class _InteractiveMode {
|
|
|
5329
5333
|
hiddenThinkingLabel = this.defaultHiddenThinkingLabel;
|
|
5330
5334
|
lastSigintTime = 0;
|
|
5331
5335
|
lastEscapeTime = 0;
|
|
5336
|
+
subagentEscape = new SubagentEscapeSequence();
|
|
5332
5337
|
anthropicSubscriptionWarningShown = !1;
|
|
5333
5338
|
// Status line tracking (for mutating immediately-sequential status updates)
|
|
5334
5339
|
lastStatusSpacer = void 0;
|
|
@@ -6464,6 +6469,15 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
|
|
|
6464
6469
|
// =========================================================================
|
|
6465
6470
|
setupKeyHandlers() {
|
|
6466
6471
|
this.defaultEditor.onEscape = () => {
|
|
6472
|
+
let sessionId = this.session.sessionId, cancellation = getSubagentCancellation(sessionId), escapeAction = this.subagentEscape.press(sessionId, cancellation?.hasActiveRuns() ?? !1);
|
|
6473
|
+
if (escapeAction) {
|
|
6474
|
+
this.lastEscapeTime = 0, this.session.isStreaming ? this.restoreQueuedMessagesToEditor({ abort: !0 }) : this.session.isBashRunning && this.session.abortBash(), escapeAction === "children" && cancellation && cancellation.stop().then(({ requested, failed }) => {
|
|
6475
|
+
this.session.sessionId === sessionId && (failed ? this.showError(`Could not request stop for ${failed} async runs. Inspect subagent status.`) : requested && this.showStatus(`Stopping ${requested} async ${requested === 1 ? "run" : "runs"}`));
|
|
6476
|
+
}).catch((error) => {
|
|
6477
|
+
this.session.sessionId === sessionId && this.showError(error instanceof Error ? error.message : String(error));
|
|
6478
|
+
});
|
|
6479
|
+
return;
|
|
6480
|
+
}
|
|
6467
6481
|
if (this.session.isStreaming)
|
|
6468
6482
|
this.restoreQueuedMessagesToEditor({ abort: !0 });
|
|
6469
6483
|
else if (this.session.isBashRunning)
|
|
@@ -5,7 +5,7 @@ import "./chunk-BRJX2PRC.js";
|
|
|
5
5
|
async function handleGatewayCommand(args) {
|
|
6
6
|
if (args[0] !== "gateway")
|
|
7
7
|
return !1;
|
|
8
|
-
let { runGateway } = await import("./gateway-
|
|
8
|
+
let { runGateway } = await import("./gateway-L4ANRTVE.js"), code = await runGateway(args.slice(1));
|
|
9
9
|
return process.exitCode = code, !0;
|
|
10
10
|
}
|
|
11
11
|
export {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
listSessions,
|
|
6
6
|
splitMessage,
|
|
7
7
|
startGatewayCron
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ELWEXVO5.js";
|
|
9
9
|
import {
|
|
10
10
|
gatewayConfigPath,
|
|
11
11
|
isFeatureEnabled,
|
|
@@ -30,7 +30,7 @@ import "./chunk-AD6VXAO7.js";
|
|
|
30
30
|
import {
|
|
31
31
|
NO_HANDLER_REASON,
|
|
32
32
|
registerApprovalHandler
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-6N22HULO.js";
|
|
34
34
|
import "./chunk-M3LZLQW2.js";
|
|
35
35
|
import "./chunk-RQ2Q5IYR.js";
|
|
36
36
|
import "./chunk-QZMODZQ2.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
TreeSelectorComponent,
|
|
20
20
|
UserMessageComponent,
|
|
21
21
|
UserMessageSelectorComponent
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-QKFMBRAL.js";
|
|
23
23
|
import "./chunk-G6LRAP36.js";
|
|
24
24
|
import {
|
|
25
25
|
attachJsonlLineReader,
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
runPrintMode
|
|
31
31
|
} from "./chunk-OCVIXVTZ.js";
|
|
32
32
|
import "./chunk-KWA4OC2J.js";
|
|
33
|
+
import "./chunk-BBUVIEZB.js";
|
|
33
34
|
import {
|
|
34
35
|
copyToClipboard
|
|
35
36
|
} from "./chunk-Q5ZU2VRT.js";
|
|
@@ -38,14 +39,14 @@ import "./chunk-6BEIBLQ3.js";
|
|
|
38
39
|
import "./chunk-7N3YHTYF.js";
|
|
39
40
|
import {
|
|
40
41
|
main
|
|
41
|
-
} from "./chunk-
|
|
42
|
-
import "./chunk-
|
|
42
|
+
} from "./chunk-AL2FMKKM.js";
|
|
43
|
+
import "./chunk-K3646JTM.js";
|
|
43
44
|
import "./chunk-4DJ6HEGH.js";
|
|
44
45
|
import {
|
|
45
46
|
ProjectTrustStore,
|
|
46
47
|
hasTrustRequiringProjectResources
|
|
47
48
|
} from "./chunk-AROOY4BB.js";
|
|
48
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-25I2BHAA.js";
|
|
49
50
|
import {
|
|
50
51
|
AgentSession,
|
|
51
52
|
AgentSessionRuntime,
|
|
@@ -60,7 +61,7 @@ import {
|
|
|
60
61
|
readStoredCredential,
|
|
61
62
|
wrapRegisteredTool,
|
|
62
63
|
wrapRegisteredTools
|
|
63
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-JYNNB7DU.js";
|
|
64
65
|
import {
|
|
65
66
|
DEFAULT_COMPACTION_SETTINGS,
|
|
66
67
|
calculateContextTokens,
|
|
@@ -150,16 +151,16 @@ import {
|
|
|
150
151
|
import {
|
|
151
152
|
convertToLlm
|
|
152
153
|
} from "./chunk-FVDOXRUD.js";
|
|
153
|
-
import "./chunk-
|
|
154
|
+
import "./chunk-AOFXZQKA.js";
|
|
154
155
|
import "./chunk-W3CVH5RX.js";
|
|
155
|
-
import "./chunk-
|
|
156
|
+
import "./chunk-LTYWTR3V.js";
|
|
156
157
|
import "./chunk-PL6JKXWI.js";
|
|
157
158
|
import {
|
|
158
159
|
convertToPng,
|
|
159
160
|
formatDimensionNote,
|
|
160
161
|
resizeImage
|
|
161
162
|
} from "./chunk-AD6VXAO7.js";
|
|
162
|
-
import "./chunk-
|
|
163
|
+
import "./chunk-6N22HULO.js";
|
|
163
164
|
import "./chunk-M3LZLQW2.js";
|
|
164
165
|
import "./chunk-RQ2Q5IYR.js";
|
|
165
166
|
import "./chunk-JHYKXIMM.js";
|
|
@@ -3,15 +3,16 @@ import {
|
|
|
3
3
|
InteractiveMode,
|
|
4
4
|
formatResumeCommand,
|
|
5
5
|
startInteractiveToolInstalls
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QKFMBRAL.js";
|
|
7
7
|
import "./chunk-G6LRAP36.js";
|
|
8
8
|
import "./chunk-KWA4OC2J.js";
|
|
9
|
+
import "./chunk-BBUVIEZB.js";
|
|
9
10
|
import "./chunk-Q5ZU2VRT.js";
|
|
10
11
|
import "./chunk-NUIFPZWX.js";
|
|
11
12
|
import "./chunk-6BEIBLQ3.js";
|
|
12
13
|
import "./chunk-7N3YHTYF.js";
|
|
13
14
|
import "./chunk-AROOY4BB.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-JYNNB7DU.js";
|
|
15
16
|
import "./chunk-STERBGUB.js";
|
|
16
17
|
import "./chunk-4CSFRBCN.js";
|
|
17
18
|
import "./chunk-OBMWP3I5.js";
|
|
@@ -26,9 +27,9 @@ import "./chunk-CBGB57XT.js";
|
|
|
26
27
|
import "./chunk-GKLEQ3I4.js";
|
|
27
28
|
import "./chunk-FVDOXRUD.js";
|
|
28
29
|
import "./chunk-W3CVH5RX.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-LTYWTR3V.js";
|
|
30
31
|
import "./chunk-AD6VXAO7.js";
|
|
31
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-6N22HULO.js";
|
|
32
33
|
import "./chunk-M3LZLQW2.js";
|
|
33
34
|
import "./chunk-RQ2Q5IYR.js";
|
|
34
35
|
import "./chunk-H2EOZYMP.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
setCronDeliverValidator,
|
|
14
14
|
startScheduler,
|
|
15
15
|
updateJob
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ELWEXVO5.js";
|
|
17
17
|
import {
|
|
18
18
|
loadGatewayConfig
|
|
19
19
|
} from "./chunk-4I23VTC4.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
typebox_exports
|
|
27
27
|
} from "./chunk-PL6JKXWI.js";
|
|
28
28
|
import "./chunk-AD6VXAO7.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-6N22HULO.js";
|
|
30
30
|
import "./chunk-M3LZLQW2.js";
|
|
31
31
|
import "./chunk-RQ2Q5IYR.js";
|
|
32
32
|
import "./chunk-FQMM2EZ2.js";
|
|
@@ -2,12 +2,12 @@ import { createRequire as __lunrRequire } from "node:module"; const require = __
|
|
|
2
2
|
import {
|
|
3
3
|
main,
|
|
4
4
|
readPipedStdin
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-AL2FMKKM.js";
|
|
6
|
+
import "./chunk-K3646JTM.js";
|
|
7
7
|
import "./chunk-4DJ6HEGH.js";
|
|
8
8
|
import "./chunk-AROOY4BB.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-25I2BHAA.js";
|
|
10
|
+
import "./chunk-JYNNB7DU.js";
|
|
11
11
|
import "./chunk-STERBGUB.js";
|
|
12
12
|
import "./chunk-4CSFRBCN.js";
|
|
13
13
|
import "./chunk-OBMWP3I5.js";
|
|
@@ -21,12 +21,12 @@ import "./chunk-CSFI6YXL.js";
|
|
|
21
21
|
import "./chunk-CBGB57XT.js";
|
|
22
22
|
import "./chunk-GKLEQ3I4.js";
|
|
23
23
|
import "./chunk-FVDOXRUD.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-AOFXZQKA.js";
|
|
25
25
|
import "./chunk-W3CVH5RX.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-LTYWTR3V.js";
|
|
27
27
|
import "./chunk-PL6JKXWI.js";
|
|
28
28
|
import "./chunk-AD6VXAO7.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-6N22HULO.js";
|
|
30
30
|
import "./chunk-M3LZLQW2.js";
|
|
31
31
|
import "./chunk-RQ2Q5IYR.js";
|
|
32
32
|
import "./chunk-JHYKXIMM.js";
|
|
@@ -389,13 +389,13 @@ var IntercomClient = class extends EventEmitter {
|
|
|
389
389
|
|
|
390
390
|
// packages/coding-agent/dist/builtin-extensions/pi-intercom/broker/spawn.js
|
|
391
391
|
import { spawn } from "child_process";
|
|
392
|
-
import { existsSync, readFileSync as readFileSync2, unlinkSync, writeFileSync } from "fs";
|
|
392
|
+
import { closeSync, existsSync, openSync, readFileSync as readFileSync2, unlinkSync, writeFileSync } from "fs";
|
|
393
393
|
import { join as join2, dirname } from "path";
|
|
394
394
|
import { fileURLToPath } from "url";
|
|
395
395
|
import { createRequire } from "module";
|
|
396
396
|
import net2 from "net";
|
|
397
397
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
398
|
-
var INTERCOM_DIR = getIntercomDirPath(), EXTENSION_DIR = join2(dirname(fileURLToPath(new URL("../builtin-extensions/pi-intercom/broker/spawn.js", import.meta.url).href)), ".."), BROKER_PID = join2(INTERCOM_DIR, "broker.pid"), BROKER_SPAWN_LOCK = join2(INTERCOM_DIR, "broker.spawn.lock");
|
|
398
|
+
var INTERCOM_DIR = getIntercomDirPath(), EXTENSION_DIR = join2(dirname(fileURLToPath(new URL("../builtin-extensions/pi-intercom/broker/spawn.js", import.meta.url).href)), ".."), BROKER_PID = join2(INTERCOM_DIR, "broker.pid"), BROKER_SPAWN_LOCK = join2(INTERCOM_DIR, "broker.spawn.lock"), BROKER_STDERR = join2(INTERCOM_DIR, "broker.stderr.log"), NATIVE_SUPERVISOR_CHANNEL_DIR_ENV = "PI_SUBAGENT_SUPERVISOR_CHANNEL_DIR";
|
|
399
399
|
function sleep(ms) {
|
|
400
400
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
401
401
|
}
|
|
@@ -407,6 +407,16 @@ function getTsxCliPath(extensionDir = EXTENSION_DIR) {
|
|
|
407
407
|
return join2(extensionDir, "node_modules", "tsx", "dist", "cli.mjs");
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
|
+
function isNativeSupervisorChannelActive(env = process.env) {
|
|
411
|
+
return !!env[NATIVE_SUPERVISOR_CHANNEL_DIR_ENV]?.trim();
|
|
412
|
+
}
|
|
413
|
+
function resolveBrokerScriptPath(brokerDir = dirname(fileURLToPath(new URL("../builtin-extensions/pi-intercom/broker/spawn.js", import.meta.url).href))) {
|
|
414
|
+
let tsPath = join2(brokerDir, "broker.ts");
|
|
415
|
+
return existsSync(tsPath) ? tsPath : join2(brokerDir, "broker.js");
|
|
416
|
+
}
|
|
417
|
+
function isCompiledBrokerScript(brokerPath) {
|
|
418
|
+
return brokerPath.endsWith(".js");
|
|
419
|
+
}
|
|
410
420
|
function quoteWindowsArg(value) {
|
|
411
421
|
return `"${value.replace(/"/g, '""')}"`;
|
|
412
422
|
}
|
|
@@ -416,8 +426,15 @@ function getWindowsHiddenLauncherPath(intercomDir = INTERCOM_DIR) {
|
|
|
416
426
|
function usesDefaultBrokerCommand(brokerCommand, brokerArgs) {
|
|
417
427
|
return brokerCommand === "npx" && brokerArgs.length === 2 && brokerArgs[0] === "--no-install" && brokerArgs[1] === "tsx";
|
|
418
428
|
}
|
|
419
|
-
function
|
|
420
|
-
return usesDefaultBrokerCommand(brokerCommand, brokerArgs) ? [
|
|
429
|
+
function defaultBrokerArgv(brokerPath, extensionDir, nodePath, brokerCommand, brokerArgs) {
|
|
430
|
+
return usesDefaultBrokerCommand(brokerCommand, brokerArgs) && isCompiledBrokerScript(brokerPath) ? { command: nodePath, args: [brokerPath] } : usesDefaultBrokerCommand(brokerCommand, brokerArgs) ? { command: nodePath, args: [getTsxCliPath(extensionDir), brokerPath] } : { command: brokerCommand, args: [...brokerArgs, brokerPath] };
|
|
431
|
+
}
|
|
432
|
+
function withWindowsStderr(commandLine, stderrLogPath) {
|
|
433
|
+
return stderrLogPath ? `cmd.exe /s /c "${`${commandLine} 1>NUL 2>>${quoteWindowsArg(stderrLogPath)}`}"` : commandLine;
|
|
434
|
+
}
|
|
435
|
+
function getWindowsBrokerCommandLine(brokerPath, extensionDir = EXTENSION_DIR, nodePath = process.execPath, brokerCommand = "npx", brokerArgs = ["--no-install", "tsx"], stderrLogPath) {
|
|
436
|
+
let argv = defaultBrokerArgv(brokerPath, extensionDir, nodePath, brokerCommand, brokerArgs), commandLine = [quoteWindowsArg(argv.command), ...argv.args.map(quoteWindowsArg)].join(" ");
|
|
437
|
+
return withWindowsStderr(commandLine, stderrLogPath);
|
|
421
438
|
}
|
|
422
439
|
function getWindowsHiddenLauncherScript(commandLine) {
|
|
423
440
|
return [
|
|
@@ -440,7 +457,7 @@ function writeWindowsHiddenLauncher(commandLine, launcherPath = getWindowsHidden
|
|
|
440
457
|
mode: INTERCOM_RUNTIME_FILE_MODE
|
|
441
458
|
}), restrictIntercomRuntimeFile(launcherPath), launcherPath;
|
|
442
459
|
}
|
|
443
|
-
function getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir = EXTENSION_DIR, platform = process.platform, intercomDir = INTERCOM_DIR, nodePath = process.execPath) {
|
|
460
|
+
function getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir = EXTENSION_DIR, platform = process.platform, intercomDir = INTERCOM_DIR, nodePath = process.execPath, stderrLogPath) {
|
|
444
461
|
if (platform === "win32") {
|
|
445
462
|
let launcherPath = getWindowsHiddenLauncherPath(intercomDir);
|
|
446
463
|
return {
|
|
@@ -448,23 +465,20 @@ function getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir
|
|
|
448
465
|
command: "wscript.exe",
|
|
449
466
|
args: [launcherPath],
|
|
450
467
|
launcherPath,
|
|
451
|
-
launcherCommandLine: getWindowsBrokerCommandLine(brokerPath, extensionDir, nodePath, brokerCommand, brokerArgs)
|
|
468
|
+
launcherCommandLine: getWindowsBrokerCommandLine(brokerPath, extensionDir, nodePath, brokerCommand, brokerArgs, stderrLogPath)
|
|
452
469
|
};
|
|
453
470
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
command: nodePath,
|
|
457
|
-
args: [getTsxCliPath(extensionDir), brokerPath]
|
|
458
|
-
} : {
|
|
471
|
+
let argv = defaultBrokerArgv(brokerPath, extensionDir, nodePath, brokerCommand, brokerArgs);
|
|
472
|
+
return {
|
|
459
473
|
kind: "direct",
|
|
460
|
-
command:
|
|
461
|
-
args:
|
|
474
|
+
command: argv.command,
|
|
475
|
+
args: argv.args
|
|
462
476
|
};
|
|
463
477
|
}
|
|
464
|
-
function getBrokerSpawnOptions(extensionDir = EXTENSION_DIR, env = process.env) {
|
|
478
|
+
function getBrokerSpawnOptions(extensionDir = EXTENSION_DIR, env = process.env, stderrFd) {
|
|
465
479
|
return {
|
|
466
480
|
detached: !0,
|
|
467
|
-
stdio: "ignore",
|
|
481
|
+
stdio: stderrFd === void 0 ? "ignore" : ["ignore", "ignore", stderrFd],
|
|
468
482
|
cwd: extensionDir,
|
|
469
483
|
env: { ...env, PI_CODING_AGENT_DIR: getAgentDirPath(env), NODE_NO_WARNINGS: "1" },
|
|
470
484
|
windowsHide: !0
|
|
@@ -474,7 +488,7 @@ function toError2(error) {
|
|
|
474
488
|
return error instanceof Error ? error : new Error(String(error));
|
|
475
489
|
}
|
|
476
490
|
async function spawnBrokerIfNeeded(brokerCommand, brokerArgs) {
|
|
477
|
-
if (ensureIntercomRuntimeDir(INTERCOM_DIR), await isBrokerRunning())
|
|
491
|
+
if (isNativeSupervisorChannelActive() || (ensureIntercomRuntimeDir(INTERCOM_DIR), await isBrokerRunning()))
|
|
478
492
|
return;
|
|
479
493
|
if (!acquireSpawnLock()) {
|
|
480
494
|
await waitForBroker();
|
|
@@ -483,29 +497,43 @@ async function spawnBrokerIfNeeded(brokerCommand, brokerArgs) {
|
|
|
483
497
|
try {
|
|
484
498
|
if (await isBrokerRunning())
|
|
485
499
|
return;
|
|
486
|
-
let brokerPath =
|
|
500
|
+
let brokerPath = resolveBrokerScriptPath(), launch = getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, EXTENSION_DIR, process.platform, INTERCOM_DIR, process.execPath, BROKER_STDERR);
|
|
487
501
|
launch.kind === "windows-launcher" && writeWindowsHiddenLauncher(launch.launcherCommandLine, launch.launcherPath);
|
|
488
|
-
let
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
502
|
+
let stderrFd;
|
|
503
|
+
try {
|
|
504
|
+
stderrFd = openSync(BROKER_STDERR, "a");
|
|
505
|
+
} catch {
|
|
506
|
+
stderrFd = void 0;
|
|
507
|
+
}
|
|
508
|
+
try {
|
|
509
|
+
let child = spawn(launch.command, launch.args, getBrokerSpawnOptions(EXTENSION_DIR, process.env, launch.kind === "windows-launcher" ? void 0 : stderrFd));
|
|
510
|
+
child.unref(), await new Promise((resolve2, reject) => {
|
|
511
|
+
let cleanup = () => {
|
|
512
|
+
child.off("error", onError), child.off("exit", onExit);
|
|
513
|
+
}, onError = (error) => {
|
|
514
|
+
cleanup(), reject(new Error(`Failed to spawn intercom broker: ${error.message}`, { cause: error }));
|
|
515
|
+
}, onExit = (code, signal) => {
|
|
516
|
+
if (!(launch.kind === "windows-launcher" && code === 0 && signal === null)) {
|
|
517
|
+
if (cleanup(), signal) {
|
|
518
|
+
reject(new Error(`Intercom broker exited before startup with signal ${signal}`));
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
reject(new Error(`Intercom broker exited before startup with code ${code ?? "unknown"}`));
|
|
499
522
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
cleanup(), reject(toError2(error));
|
|
523
|
+
};
|
|
524
|
+
child.once("error", onError), child.once("exit", onExit), waitForBroker().then(() => {
|
|
525
|
+
cleanup(), resolve2();
|
|
526
|
+
}, (error) => {
|
|
527
|
+
cleanup(), reject(toError2(error));
|
|
528
|
+
});
|
|
507
529
|
});
|
|
508
|
-
}
|
|
530
|
+
} finally {
|
|
531
|
+
if (stderrFd !== void 0)
|
|
532
|
+
try {
|
|
533
|
+
closeSync(stderrFd);
|
|
534
|
+
} catch {
|
|
535
|
+
}
|
|
536
|
+
}
|
|
509
537
|
} finally {
|
|
510
538
|
releaseSpawnLock();
|
|
511
539
|
}
|
|
@@ -1531,8 +1559,9 @@ ${entry.bodyText}`,
|
|
|
1531
1559
|
}
|
|
1532
1560
|
function startSessionRuntime(ctx) {
|
|
1533
1561
|
let previousClient = client;
|
|
1534
|
-
previousClient && (client = null, previousClient.disconnect().catch(() => {
|
|
1535
|
-
})), shuttingDown = !1, disposed = !1, runtimeStarted = !0, runtimeGeneration += 1, reconnectAttempt = 0, clearReconnectTimer(), clearStartupConnectTimer(), clearNamePollTimer(), clearInboundFlushTimer(), rejectReplyWaiter(new Error("Session replaced")), replyTracker.reset(), pendingIdleMessages.length = 0, runtimeContext = ctx, currentSessionId = ctx.sessionManager.getSessionId(), publishIntercomSessionId(currentSessionId), currentModel = ctx.model?.id ?? "unknown", sessionStartedAt = Date.now(), lastPresenceName = buildPresenceIdentity(pi, currentSessionId).name, agentRunning = !1, activeTools.clear(), startNamePoll()
|
|
1562
|
+
if (previousClient && (client = null, previousClient.disconnect().catch(() => {
|
|
1563
|
+
})), shuttingDown = !1, disposed = !1, runtimeStarted = !0, runtimeGeneration += 1, reconnectAttempt = 0, clearReconnectTimer(), clearStartupConnectTimer(), clearNamePollTimer(), clearInboundFlushTimer(), rejectReplyWaiter(new Error("Session replaced")), replyTracker.reset(), pendingIdleMessages.length = 0, runtimeContext = ctx, currentSessionId = ctx.sessionManager.getSessionId(), publishIntercomSessionId(currentSessionId), currentModel = ctx.model?.id ?? "unknown", sessionStartedAt = Date.now(), lastPresenceName = buildPresenceIdentity(pi, currentSessionId).name, agentRunning = !1, activeTools.clear(), startNamePoll(), isNativeSupervisorChannelActive())
|
|
1564
|
+
return;
|
|
1536
1565
|
let startupGeneration = runtimeGeneration;
|
|
1537
1566
|
startupConnectTimer = setTimeout(() => {
|
|
1538
1567
|
startupConnectTimer = null, getLiveContext(ctx, startupGeneration) && ensureConnected("startup").catch(() => {
|
|
@@ -1547,50 +1576,41 @@ ${entry.bodyText}`,
|
|
|
1547
1576
|
...error ? { error: getErrorMessage(error) } : {}
|
|
1548
1577
|
});
|
|
1549
1578
|
}
|
|
1579
|
+
let resultDeliveries = /* @__PURE__ */ new Map(), acknowledgedResults = [];
|
|
1550
1580
|
function relaySubagentIntercomPayload(payload, options) {
|
|
1551
1581
|
let parsed = parseSubagentIntercomPayload(payload);
|
|
1552
1582
|
if (!parsed)
|
|
1553
1583
|
return;
|
|
1554
|
-
let relayGeneration = runtimeGeneration;
|
|
1555
|
-
(async () => {
|
|
1584
|
+
let relayGeneration = runtimeGeneration, key = options.acknowledge && parsed.requestId ? `${relayGeneration}:${parsed.requestId}` : void 0, delivery = key ? resultDeliveries.get(key) : void 0;
|
|
1585
|
+
delivery || (delivery = (async () => {
|
|
1556
1586
|
let relayStillLive = () => !runtimeStarted || !!getLiveContext(runtimeContext, relayGeneration);
|
|
1557
|
-
if (!relayStillLive())
|
|
1558
|
-
return;
|
|
1559
|
-
if (currentSessionTargetMatches(parsed.to)) {
|
|
1560
|
-
deliverLocalSubagentRelayMessage(options.sender, options.status, parsed.message), options.acknowledge && emitResultDelivery(parsed.requestId, !0);
|
|
1561
|
-
return;
|
|
1562
|
-
}
|
|
1563
|
-
let activeClient, target;
|
|
1564
1587
|
try {
|
|
1565
|
-
activeClient = await ensureConnected("background"), target = await resolveSessionTarget(activeClient, parsed.to) ?? parsed.to;
|
|
1566
|
-
} catch (error) {
|
|
1567
1588
|
if (!relayStillLive())
|
|
1568
|
-
return;
|
|
1569
|
-
|
|
1570
|
-
|
|
1589
|
+
return !1;
|
|
1590
|
+
if (currentSessionTargetMatches(parsed.to))
|
|
1591
|
+
return deliverLocalSubagentRelayMessage(options.sender, options.status, parsed.message), !0;
|
|
1592
|
+
let activeClient = await ensureConnected("background"), target = await resolveSessionTarget(activeClient, parsed.to) ?? parsed.to;
|
|
1593
|
+
if (!relayStillLive())
|
|
1594
|
+
return !1;
|
|
1595
|
+
if (currentSessionTargetMatches(parsed.to, target, activeClient))
|
|
1596
|
+
return deliverLocalSubagentRelayMessage(options.sender, options.status, parsed.message), !0;
|
|
1597
|
+
let result = await activeClient.send(target, { text: parsed.message });
|
|
1598
|
+
if (!result.delivered)
|
|
1599
|
+
throw new Error(result.reason ?? "Session may not exist or has disconnected.");
|
|
1600
|
+
return !0;
|
|
1601
|
+
} catch (error) {
|
|
1602
|
+
return relayStillLive() && recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error), !1;
|
|
1571
1603
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
}
|
|
1577
|
-
try {
|
|
1578
|
-
let result = await activeClient.send(target, { text: parsed.message });
|
|
1579
|
-
if (!relayStillLive())
|
|
1580
|
-
return;
|
|
1581
|
-
if (!result.delivered) {
|
|
1582
|
-
let error = new Error(result.reason ?? "Session may not exist or has disconnected.");
|
|
1583
|
-
recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error), options.acknowledge && emitResultDelivery(parsed.requestId, !1, error);
|
|
1584
|
-
return;
|
|
1585
|
-
}
|
|
1586
|
-
options.acknowledge && emitResultDelivery(parsed.requestId, !0);
|
|
1587
|
-
} catch (error) {
|
|
1588
|
-
if (!relayStillLive())
|
|
1589
|
-
return;
|
|
1590
|
-
recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error), options.acknowledge && emitResultDelivery(parsed.requestId, !1, error);
|
|
1591
|
-
}
|
|
1604
|
+
})(), key && (resultDeliveries.set(key, delivery), delivery.then((delivered) => {
|
|
1605
|
+
if (!delivered) {
|
|
1606
|
+
resultDeliveries.get(key) === delivery && resultDeliveries.delete(key);
|
|
1607
|
+
return;
|
|
1592
1608
|
}
|
|
1593
|
-
|
|
1609
|
+
for (acknowledgedResults.push(key); acknowledgedResults.length > 1024; )
|
|
1610
|
+
resultDeliveries.delete(acknowledgedResults.shift());
|
|
1611
|
+
}))), delivery.then((delivered) => {
|
|
1612
|
+
options.acknowledge && emitResultDelivery(parsed.requestId, delivered);
|
|
1613
|
+
});
|
|
1594
1614
|
}
|
|
1595
1615
|
let unsubscribeSubagentControlIntercom = pi.events.on(SUBAGENT_CONTROL_INTERCOM_EVENT, (payload) => {
|
|
1596
1616
|
relaySubagentIntercomPayload(payload, {
|
|
@@ -1649,8 +1669,8 @@ ${entry.bodyText}`,
|
|
|
1649
1669
|
if (details.error === !0 || details.delivered === !1)
|
|
1650
1670
|
return { isError: !0 };
|
|
1651
1671
|
});
|
|
1652
|
-
let childOrchestratorMetadata = readChildOrchestratorMetadata();
|
|
1653
|
-
childOrchestratorMetadata && pi.registerTool({
|
|
1672
|
+
let childOrchestratorMetadata = readChildOrchestratorMetadata(), nativeSupervisorChannel = isNativeSupervisorChannelActive();
|
|
1673
|
+
childOrchestratorMetadata && !nativeSupervisorChannel && pi.registerTool({
|
|
1654
1674
|
name: "contact_supervisor",
|
|
1655
1675
|
label: "Contact Supervisor",
|
|
1656
1676
|
description: "Subagent-only tool for contacting the supervisor agent that delegated this task. Use need_decision when blocked, uncertain, needing approval, or facing a product/API/scope decision before continuing; this waits for the supervisor's reply. Use interview_request when multiple structured questions need supervisor answers; this also waits for a reply. Use progress_update only for meaningful progress or unexpected discoveries that change the plan; this does not wait for a reply. Do not use for routine completion handoffs.",
|
|
@@ -1847,7 +1867,7 @@ ${replyText}${replyAttachments}` }],
|
|
|
1847
1867
|
return text += theme.fg(failed ? "error" : "text", textContent), parseWarning && (text += `
|
|
1848
1868
|
` + theme.fg("warning", `Structured reply parse issue: ${details.structuredReplyParseError}`)), new Text(text, 0, 0);
|
|
1849
1869
|
}
|
|
1850
|
-
}), pi.registerTool({
|
|
1870
|
+
}), nativeSupervisorChannel || pi.registerTool({
|
|
1851
1871
|
name: "intercom",
|
|
1852
1872
|
label: "Intercom",
|
|
1853
1873
|
description: `Send a message to another pi session running on this machine.
|