@protolabsai/proto 0.35.0 → 0.36.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/bundled/qc-helper/docs/configuration/settings.md +9 -9
- package/cli.js +762 -475
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -12887,7 +12887,7 @@ var require_request2 = __commonJS({
|
|
|
12887
12887
|
var { URLSerializer } = require_data_url();
|
|
12888
12888
|
var { kConstruct } = require_symbols();
|
|
12889
12889
|
var assert4 = __require("node:assert");
|
|
12890
|
-
var { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __require("node:events");
|
|
12890
|
+
var { getMaxListeners, setMaxListeners: setMaxListeners2, getEventListeners, defaultMaxListeners } = __require("node:events");
|
|
12891
12891
|
var kAbortController = Symbol("abortController");
|
|
12892
12892
|
var requestFinalizer = new FinalizationRegistry2(({ signal, abort: abort2 }) => {
|
|
12893
12893
|
signal.removeEventListener("abort", abort2);
|
|
@@ -13125,9 +13125,9 @@ var require_request2 = __commonJS({
|
|
|
13125
13125
|
const abort2 = buildAbort(acRef);
|
|
13126
13126
|
try {
|
|
13127
13127
|
if (typeof getMaxListeners === "function" && getMaxListeners(signal) === defaultMaxListeners) {
|
|
13128
|
-
|
|
13128
|
+
setMaxListeners2(1500, signal);
|
|
13129
13129
|
} else if (getEventListeners(signal, "abort").length >= defaultMaxListeners) {
|
|
13130
|
-
|
|
13130
|
+
setMaxListeners2(1500, signal);
|
|
13131
13131
|
}
|
|
13132
13132
|
} catch {
|
|
13133
13133
|
}
|
|
@@ -155977,6 +155977,11 @@ var init_provider = __esm({
|
|
|
155977
155977
|
});
|
|
155978
155978
|
|
|
155979
155979
|
// packages/core/dist/src/core/openaiContentGenerator/pipeline.js
|
|
155980
|
+
import { setMaxListeners } from "node:events";
|
|
155981
|
+
function raiseAbortListenerCap(signal) {
|
|
155982
|
+
if (signal)
|
|
155983
|
+
setMaxListeners(0, signal);
|
|
155984
|
+
}
|
|
155980
155985
|
var debugLogger15, tracer2, StreamContentError, ContentGenerationPipeline;
|
|
155981
155986
|
var init_pipeline = __esm({
|
|
155982
155987
|
"packages/core/dist/src/core/openaiContentGenerator/pipeline.js"() {
|
|
@@ -155988,6 +155993,7 @@ var init_pipeline = __esm({
|
|
|
155988
155993
|
init_debugLogger();
|
|
155989
155994
|
debugLogger15 = createDebugLogger("OPENAI_PIPELINE");
|
|
155990
155995
|
tracer2 = trace.getTracer("proto.openai-pipeline", "1.0.0");
|
|
155996
|
+
__name(raiseAbortListenerCap, "raiseAbortListenerCap");
|
|
155991
155997
|
StreamContentError = class extends Error {
|
|
155992
155998
|
static {
|
|
155993
155999
|
__name(this, "StreamContentError");
|
|
@@ -156015,6 +156021,7 @@ var init_pipeline = __esm({
|
|
|
156015
156021
|
const effectiveModel = this.resolveEffectiveModel(request3);
|
|
156016
156022
|
this.converter.setModel(effectiveModel);
|
|
156017
156023
|
this.converter.setModalities(this.contentGeneratorConfig.modalities ?? {});
|
|
156024
|
+
raiseAbortListenerCap(request3.config?.abortSignal);
|
|
156018
156025
|
return this.executeWithErrorHandling(request3, userPromptId, false, effectiveModel, async (openaiRequest) => {
|
|
156019
156026
|
const openaiResponse = await this.client.chat.completions.create(openaiRequest, {
|
|
156020
156027
|
signal: request3.config?.abortSignal
|
|
@@ -156027,6 +156034,7 @@ var init_pipeline = __esm({
|
|
|
156027
156034
|
const effectiveModel = this.resolveEffectiveModel(request3);
|
|
156028
156035
|
this.converter.setModel(effectiveModel);
|
|
156029
156036
|
this.converter.setModalities(this.contentGeneratorConfig.modalities ?? {});
|
|
156037
|
+
raiseAbortListenerCap(request3.config?.abortSignal);
|
|
156030
156038
|
return this.executeWithErrorHandling(request3, userPromptId, true, effectiveModel, async (openaiRequest, context2) => {
|
|
156031
156039
|
const stream2 = await this.client.chat.completions.create(openaiRequest, {
|
|
156032
156040
|
signal: request3.config?.abortSignal
|
|
@@ -169151,7 +169159,7 @@ __export(geminiContentGenerator_exports, {
|
|
|
169151
169159
|
createGeminiContentGenerator: () => createGeminiContentGenerator
|
|
169152
169160
|
});
|
|
169153
169161
|
function createGeminiContentGenerator(config2, gcConfig) {
|
|
169154
|
-
const version2 = "0.
|
|
169162
|
+
const version2 = "0.36.0";
|
|
169155
169163
|
const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
169156
169164
|
const baseHeaders = {
|
|
169157
169165
|
"User-Agent": userAgent2
|
|
@@ -186826,6 +186834,8 @@ var init_shell = __esm({
|
|
|
186826
186834
|
let cumulativeOutput = "";
|
|
186827
186835
|
let lastUpdateTime = Date.now();
|
|
186828
186836
|
let isBinaryStream = false;
|
|
186837
|
+
let totalLines = 0;
|
|
186838
|
+
let totalBytes = 0;
|
|
186829
186839
|
const { result: resultPromise, pid } = await ShellExecutionService.execute(commandToExecute, cwd6, (event) => {
|
|
186830
186840
|
let shouldUpdate = false;
|
|
186831
186841
|
switch (event.type) {
|
|
@@ -186833,6 +186843,10 @@ var init_shell = __esm({
|
|
|
186833
186843
|
if (isBinaryStream)
|
|
186834
186844
|
break;
|
|
186835
186845
|
cumulativeOutput = event.chunk;
|
|
186846
|
+
if (Array.isArray(event.chunk)) {
|
|
186847
|
+
totalLines = event.chunk.length;
|
|
186848
|
+
totalBytes = event.chunk.reduce((sum, line) => sum + line.reduce((ls, token2) => ls + Buffer.byteLength(token2.text, "utf-8"), 0), 0);
|
|
186849
|
+
}
|
|
186836
186850
|
shouldUpdate = true;
|
|
186837
186851
|
break;
|
|
186838
186852
|
case "binary_detected":
|
|
@@ -186852,7 +186866,19 @@ var init_shell = __esm({
|
|
|
186852
186866
|
}
|
|
186853
186867
|
}
|
|
186854
186868
|
if (shouldUpdate && updateOutput2) {
|
|
186855
|
-
|
|
186869
|
+
if (typeof cumulativeOutput === "string") {
|
|
186870
|
+
updateOutput2(cumulativeOutput);
|
|
186871
|
+
} else {
|
|
186872
|
+
updateOutput2({
|
|
186873
|
+
ansiOutput: cumulativeOutput,
|
|
186874
|
+
totalLines,
|
|
186875
|
+
totalBytes,
|
|
186876
|
+
// Only include timeout when user explicitly set it
|
|
186877
|
+
...this.params.timeout != null && {
|
|
186878
|
+
timeoutMs: this.params.timeout
|
|
186879
|
+
}
|
|
186880
|
+
});
|
|
186881
|
+
}
|
|
186856
186882
|
lastUpdateTime = Date.now();
|
|
186857
186883
|
}
|
|
186858
186884
|
}, combinedSignal, shouldRunInBackground ? false : this.config.getShouldUseNodePtyShell(), shellExecutionConfig ?? {});
|
|
@@ -187378,6 +187404,7 @@ var init_coreToolScheduler = __esm({
|
|
|
187378
187404
|
tool: toolInstance,
|
|
187379
187405
|
status: "executing",
|
|
187380
187406
|
startTime: existingStartTime,
|
|
187407
|
+
executionStartTime: Date.now(),
|
|
187381
187408
|
outcome,
|
|
187382
187409
|
invocation
|
|
187383
187410
|
};
|
|
@@ -189631,6 +189658,7 @@ var init_agent_core = __esm({
|
|
|
189631
189658
|
let resolveBatch = null;
|
|
189632
189659
|
const emittedCallIds = /* @__PURE__ */ new Set();
|
|
189633
189660
|
const pidMap = /* @__PURE__ */ new Map();
|
|
189661
|
+
const executionStartedEmitted = /* @__PURE__ */ new Set();
|
|
189634
189662
|
const scheduler = new CoreToolScheduler({
|
|
189635
189663
|
config: this.runtimeContext,
|
|
189636
189664
|
outputUpdateHandler: /* @__PURE__ */ __name((callId, outputChunk) => {
|
|
@@ -189692,20 +189720,26 @@ var init_agent_core = __esm({
|
|
|
189692
189720
|
onToolCallsUpdate: /* @__PURE__ */ __name((calls) => {
|
|
189693
189721
|
for (const call of calls) {
|
|
189694
189722
|
if (call.status === "executing") {
|
|
189695
|
-
const
|
|
189723
|
+
const executing = call;
|
|
189724
|
+
const pid = executing.pid;
|
|
189725
|
+
const isNewPid = pid !== void 0 && !pidMap.has(call.request.callId);
|
|
189696
189726
|
if (pid !== void 0) {
|
|
189697
|
-
const isNewPid = !pidMap.has(call.request.callId);
|
|
189698
189727
|
pidMap.set(call.request.callId, pid);
|
|
189699
|
-
|
|
189700
|
-
|
|
189701
|
-
|
|
189702
|
-
|
|
189703
|
-
|
|
189704
|
-
|
|
189705
|
-
|
|
189706
|
-
|
|
189707
|
-
|
|
189708
|
-
|
|
189728
|
+
}
|
|
189729
|
+
const needsExecutionStartEmit = executing.executionStartTime !== void 0 && !executionStartedEmitted.has(call.request.callId);
|
|
189730
|
+
if (needsExecutionStartEmit) {
|
|
189731
|
+
executionStartedEmitted.add(call.request.callId);
|
|
189732
|
+
}
|
|
189733
|
+
if (isNewPid || needsExecutionStartEmit) {
|
|
189734
|
+
this.eventEmitter?.emit(AgentEventType.TOOL_OUTPUT_UPDATE, {
|
|
189735
|
+
subagentId: this.subagentId,
|
|
189736
|
+
round: currentRound,
|
|
189737
|
+
callId: call.request.callId,
|
|
189738
|
+
outputChunk: executing.liveOutput ?? "",
|
|
189739
|
+
pid,
|
|
189740
|
+
executionStartTime: executing.executionStartTime,
|
|
189741
|
+
timestamp: Date.now()
|
|
189742
|
+
});
|
|
189709
189743
|
}
|
|
189710
189744
|
}
|
|
189711
189745
|
if (call.status !== "awaiting_approval")
|
|
@@ -276984,6 +277018,96 @@ var init_evolveService = __esm({
|
|
|
276984
277018
|
}
|
|
276985
277019
|
});
|
|
276986
277020
|
|
|
277021
|
+
// packages/core/dist/src/recap/recapGenerator.js
|
|
277022
|
+
function pickRecapModel(config2) {
|
|
277023
|
+
const available = config2.getModelsConfig().getAllConfiguredModels();
|
|
277024
|
+
if (available.some((m3) => m3.id === PREFERRED_RECAP_MODEL_ID)) {
|
|
277025
|
+
return { model: PREFERRED_RECAP_MODEL_ID, isOverride: true };
|
|
277026
|
+
}
|
|
277027
|
+
return { model: config2.getModel(), isOverride: false };
|
|
277028
|
+
}
|
|
277029
|
+
async function generateRecap(config2, conversationHistory, abortSignal) {
|
|
277030
|
+
if (conversationHistory.length === 0)
|
|
277031
|
+
return null;
|
|
277032
|
+
try {
|
|
277033
|
+
const recent = conversationHistory.slice(-RECENT_MESSAGE_WINDOW);
|
|
277034
|
+
const contents = [
|
|
277035
|
+
...recent,
|
|
277036
|
+
{ role: "user", parts: [{ text: RECAP_PROMPT }] }
|
|
277037
|
+
];
|
|
277038
|
+
const { model, isOverride } = pickRecapModel(config2);
|
|
277039
|
+
const generator = config2.getContentGenerator();
|
|
277040
|
+
const response = await generator.generateContent({
|
|
277041
|
+
model,
|
|
277042
|
+
contents,
|
|
277043
|
+
config: {
|
|
277044
|
+
abortSignal,
|
|
277045
|
+
thinkingConfig: { includeThoughts: false },
|
|
277046
|
+
// Empty tools array (truthy) bypasses pipeline.ts buildRequest's
|
|
277047
|
+
// tool-stripping path. Without this, assistant turns containing
|
|
277048
|
+
// tool_calls — i.e. most of the agent's actual work — are dropped
|
|
277049
|
+
// before the request leaves, starving the recap of context.
|
|
277050
|
+
tools: [],
|
|
277051
|
+
// Opt into the model override path in the OpenAI pipeline. Pipeline
|
|
277052
|
+
// ignores request.model by default for safety; for recap we know the
|
|
277053
|
+
// alias resolves on the gateway, so honor it.
|
|
277054
|
+
...isOverride ? { allowModelOverride: true } : {}
|
|
277055
|
+
}
|
|
277056
|
+
}, "recap");
|
|
277057
|
+
const text = response.candidates?.[0]?.content?.parts?.map((p2) => p2.text ?? "").join("").trim();
|
|
277058
|
+
if (!text)
|
|
277059
|
+
return null;
|
|
277060
|
+
return text;
|
|
277061
|
+
} catch (error40) {
|
|
277062
|
+
if (abortSignal.aborted)
|
|
277063
|
+
return null;
|
|
277064
|
+
debugLogger85.warn(`[recap] generation failed: ${error40 instanceof Error ? error40.message : String(error40)}`);
|
|
277065
|
+
return null;
|
|
277066
|
+
}
|
|
277067
|
+
}
|
|
277068
|
+
var debugLogger85, RECENT_MESSAGE_WINDOW, PREFERRED_RECAP_MODEL_ID, RECAP_PROMPT;
|
|
277069
|
+
var init_recapGenerator = __esm({
|
|
277070
|
+
"packages/core/dist/src/recap/recapGenerator.js"() {
|
|
277071
|
+
"use strict";
|
|
277072
|
+
init_esbuild_shims();
|
|
277073
|
+
init_debugLogger();
|
|
277074
|
+
debugLogger85 = createDebugLogger("RECAP");
|
|
277075
|
+
RECENT_MESSAGE_WINDOW = 30;
|
|
277076
|
+
PREFERRED_RECAP_MODEL_ID = "protolabs/fast";
|
|
277077
|
+
RECAP_PROMPT = `That last agent turn was long. Summarize where we are so the user can pick back up cold.
|
|
277078
|
+
|
|
277079
|
+
Write exactly 1-3 short sentences. Lead with the high-level goal \u2014 what they're building or debugging, not implementation details. Then state the concrete current status or next step. No status reports, no commit recaps, no apologies.
|
|
277080
|
+
|
|
277081
|
+
Reply with ONLY the recap text \u2014 no headers, no quotes, no preamble.`;
|
|
277082
|
+
__name(pickRecapModel, "pickRecapModel");
|
|
277083
|
+
__name(generateRecap, "generateRecap");
|
|
277084
|
+
}
|
|
277085
|
+
});
|
|
277086
|
+
|
|
277087
|
+
// packages/core/dist/src/services/sessionRecap.js
|
|
277088
|
+
async function generateSessionRecap(config2, abortSignal) {
|
|
277089
|
+
const geminiClient = config2.getGeminiClient();
|
|
277090
|
+
if (!geminiClient)
|
|
277091
|
+
return null;
|
|
277092
|
+
const conversation = geminiClient.getHistory?.() ?? [];
|
|
277093
|
+
const hasModel = conversation.some((c4) => c4.role === "model");
|
|
277094
|
+
const hasUser = conversation.some((c4) => c4.role === "user");
|
|
277095
|
+
if (!hasModel || !hasUser)
|
|
277096
|
+
return null;
|
|
277097
|
+
const text = await generateRecap(config2, conversation, abortSignal);
|
|
277098
|
+
if (!text)
|
|
277099
|
+
return null;
|
|
277100
|
+
return { text };
|
|
277101
|
+
}
|
|
277102
|
+
var init_sessionRecap = __esm({
|
|
277103
|
+
"packages/core/dist/src/services/sessionRecap.js"() {
|
|
277104
|
+
"use strict";
|
|
277105
|
+
init_esbuild_shims();
|
|
277106
|
+
init_recapGenerator();
|
|
277107
|
+
__name(generateSessionRecap, "generateSessionRecap");
|
|
277108
|
+
}
|
|
277109
|
+
});
|
|
277110
|
+
|
|
276987
277111
|
// packages/core/dist/src/services/gitWorktreeService.js
|
|
276988
277112
|
import * as fs80 from "node:fs/promises";
|
|
276989
277113
|
import * as path88 from "node:path";
|
|
@@ -277850,14 +277974,14 @@ var init_constants8 = __esm({
|
|
|
277850
277974
|
import * as fs81 from "node:fs";
|
|
277851
277975
|
import * as path89 from "path";
|
|
277852
277976
|
import { pathToFileURL as pathToFileURL3 } from "url";
|
|
277853
|
-
var
|
|
277977
|
+
var debugLogger86, LspConfigLoader;
|
|
277854
277978
|
var init_LspConfigLoader = __esm({
|
|
277855
277979
|
"packages/core/dist/src/lsp/LspConfigLoader.js"() {
|
|
277856
277980
|
"use strict";
|
|
277857
277981
|
init_esbuild_shims();
|
|
277858
277982
|
init_variables();
|
|
277859
277983
|
init_debugLogger();
|
|
277860
|
-
|
|
277984
|
+
debugLogger86 = createDebugLogger("LSP");
|
|
277861
277985
|
LspConfigLoader = class {
|
|
277862
277986
|
static {
|
|
277863
277987
|
__name(this, "LspConfigLoader");
|
|
@@ -277880,7 +278004,7 @@ var init_LspConfigLoader = __esm({
|
|
|
277880
278004
|
const data = JSON.parse(configContent);
|
|
277881
278005
|
return this.parseConfigSource(data, lspConfigPath);
|
|
277882
278006
|
} catch (error40) {
|
|
277883
|
-
|
|
278007
|
+
debugLogger86.warn("Failed to load user .lsp.json config:", error40);
|
|
277884
278008
|
return [];
|
|
277885
278009
|
}
|
|
277886
278010
|
}
|
|
@@ -277898,7 +278022,7 @@ var init_LspConfigLoader = __esm({
|
|
|
277898
278022
|
if (typeof lspServers === "string") {
|
|
277899
278023
|
const configPath = this.resolveExtensionConfigPath(extension.path, lspServers);
|
|
277900
278024
|
if (!fs81.existsSync(configPath)) {
|
|
277901
|
-
|
|
278025
|
+
debugLogger86.warn(`LSP config not found for ${originBase}: ${configPath}`);
|
|
277902
278026
|
continue;
|
|
277903
278027
|
}
|
|
277904
278028
|
try {
|
|
@@ -277907,13 +278031,13 @@ var init_LspConfigLoader = __esm({
|
|
|
277907
278031
|
const hydrated = this.hydrateExtensionLspConfig(data, extension.path);
|
|
277908
278032
|
configs.push(...this.parseConfigSource(hydrated, `${originBase} (${configPath})`));
|
|
277909
278033
|
} catch (error40) {
|
|
277910
|
-
|
|
278034
|
+
debugLogger86.warn(`Failed to load extension LSP config from ${configPath}:`, error40);
|
|
277911
278035
|
}
|
|
277912
278036
|
} else if (this.isRecord(lspServers)) {
|
|
277913
278037
|
const hydrated = this.hydrateExtensionLspConfig(lspServers, extension.path);
|
|
277914
278038
|
configs.push(...this.parseConfigSource(hydrated, `${originBase} (lspServers)`));
|
|
277915
278039
|
} else {
|
|
277916
|
-
|
|
278040
|
+
debugLogger86.warn(`LSP config for ${originBase} must be an object or a JSON file path.`);
|
|
277917
278041
|
}
|
|
277918
278042
|
}
|
|
277919
278043
|
return configs;
|
|
@@ -278009,11 +278133,11 @@ var init_LspConfigLoader = __esm({
|
|
|
278009
278133
|
const trustRequired = typeof spec["trustRequired"] === "boolean" ? spec["trustRequired"] : true;
|
|
278010
278134
|
const socket = this.normalizeSocketOptions(spec);
|
|
278011
278135
|
if (transport === "stdio" && !command2) {
|
|
278012
|
-
|
|
278136
|
+
debugLogger86.warn(`LSP config error in ${origin}: ${name4} missing command`);
|
|
278013
278137
|
return null;
|
|
278014
278138
|
}
|
|
278015
278139
|
if (transport !== "stdio" && !socket) {
|
|
278016
|
-
|
|
278140
|
+
debugLogger86.warn(`LSP config error in ${origin}: ${name4} missing socket info`);
|
|
278017
278141
|
return null;
|
|
278018
278142
|
}
|
|
278019
278143
|
return {
|
|
@@ -278136,7 +278260,7 @@ var init_LspConfigLoader = __esm({
|
|
|
278136
278260
|
if (resolved === root || resolved.startsWith(root + path89.sep)) {
|
|
278137
278261
|
return resolved;
|
|
278138
278262
|
}
|
|
278139
|
-
|
|
278263
|
+
debugLogger86.warn(`LSP workspaceFolder must be within ${this.workspaceRoot}; using workspace root instead.`);
|
|
278140
278264
|
return this.workspaceRoot;
|
|
278141
278265
|
}
|
|
278142
278266
|
};
|
|
@@ -278146,14 +278270,14 @@ var init_LspConfigLoader = __esm({
|
|
|
278146
278270
|
// packages/core/dist/src/lsp/LspConnectionFactory.js
|
|
278147
278271
|
import * as cp from "node:child_process";
|
|
278148
278272
|
import * as net from "node:net";
|
|
278149
|
-
var
|
|
278273
|
+
var debugLogger87, JsonRpcConnection, LspConnectionFactory;
|
|
278150
278274
|
var init_LspConnectionFactory = __esm({
|
|
278151
278275
|
"packages/core/dist/src/lsp/LspConnectionFactory.js"() {
|
|
278152
278276
|
"use strict";
|
|
278153
278277
|
init_esbuild_shims();
|
|
278154
278278
|
init_constants8();
|
|
278155
278279
|
init_debugLogger();
|
|
278156
|
-
|
|
278280
|
+
debugLogger87 = createDebugLogger("LSP");
|
|
278157
278281
|
JsonRpcConnection = class {
|
|
278158
278282
|
static {
|
|
278159
278283
|
__name(this, "JsonRpcConnection");
|
|
@@ -278431,7 +278555,7 @@ var init_LspConnectionFactory = __esm({
|
|
|
278431
278555
|
try {
|
|
278432
278556
|
await lspConnection.connection.shutdown();
|
|
278433
278557
|
} catch (e4) {
|
|
278434
|
-
|
|
278558
|
+
debugLogger87.warn("LSP shutdown failed:", e4);
|
|
278435
278559
|
} finally {
|
|
278436
278560
|
lspConnection.connection.end();
|
|
278437
278561
|
}
|
|
@@ -279108,7 +279232,7 @@ import { spawn as spawn9 } from "node:child_process";
|
|
|
279108
279232
|
import * as fs82 from "node:fs";
|
|
279109
279233
|
import * as path90 from "path";
|
|
279110
279234
|
import { pathToFileURL as pathToFileURL4 } from "url";
|
|
279111
|
-
var
|
|
279235
|
+
var debugLogger88, LspServerManager;
|
|
279112
279236
|
var init_LspServerManager = __esm({
|
|
279113
279237
|
"packages/core/dist/src/lsp/LspServerManager.js"() {
|
|
279114
279238
|
"use strict";
|
|
@@ -279117,7 +279241,7 @@ var init_LspServerManager = __esm({
|
|
|
279117
279241
|
init_LspConnectionFactory();
|
|
279118
279242
|
init_constants8();
|
|
279119
279243
|
init_debugLogger();
|
|
279120
|
-
|
|
279244
|
+
debugLogger88 = createDebugLogger("LSP");
|
|
279121
279245
|
LspServerManager = class {
|
|
279122
279246
|
static {
|
|
279123
279247
|
__name(this, "LspServerManager");
|
|
@@ -279207,7 +279331,7 @@ var init_LspServerManager = __esm({
|
|
|
279207
279331
|
handle2.warmedUp = true;
|
|
279208
279332
|
return uri;
|
|
279209
279333
|
} catch (error40) {
|
|
279210
|
-
|
|
279334
|
+
debugLogger88.warn("TypeScript server warm-up failed:", error40);
|
|
279211
279335
|
return void 0;
|
|
279212
279336
|
}
|
|
279213
279337
|
}
|
|
@@ -279248,25 +279372,25 @@ var init_LspServerManager = __esm({
|
|
|
279248
279372
|
async doStartServer(name4, handle2) {
|
|
279249
279373
|
const workspaceTrusted = this.config.isTrustedFolder();
|
|
279250
279374
|
if ((this.requireTrustedWorkspace || handle2.config.trustRequired) && !workspaceTrusted) {
|
|
279251
|
-
|
|
279375
|
+
debugLogger88.warn(`LSP server ${name4} requires trusted workspace, skipping startup`);
|
|
279252
279376
|
handle2.status = "FAILED";
|
|
279253
279377
|
return;
|
|
279254
279378
|
}
|
|
279255
279379
|
const consent = await this.requestUserConsent(name4, handle2.config, workspaceTrusted);
|
|
279256
279380
|
if (!consent) {
|
|
279257
|
-
|
|
279381
|
+
debugLogger88.info(`User declined to start LSP server ${name4}`);
|
|
279258
279382
|
handle2.status = "FAILED";
|
|
279259
279383
|
return;
|
|
279260
279384
|
}
|
|
279261
279385
|
if (handle2.config.command) {
|
|
279262
279386
|
const commandCwd = handle2.config.workspaceFolder ?? this.workspaceRoot;
|
|
279263
279387
|
if (!await this.commandExists(handle2.config.command, handle2.config.env, commandCwd)) {
|
|
279264
|
-
|
|
279388
|
+
debugLogger88.warn(`LSP server ${name4} command not found: ${handle2.config.command}`);
|
|
279265
279389
|
handle2.status = "FAILED";
|
|
279266
279390
|
return;
|
|
279267
279391
|
}
|
|
279268
279392
|
if (!this.isPathSafe(handle2.config.command, this.workspaceRoot, commandCwd)) {
|
|
279269
|
-
|
|
279393
|
+
debugLogger88.warn(`LSP server ${name4} command path is unsafe: ${handle2.config.command}`);
|
|
279270
279394
|
handle2.status = "FAILED";
|
|
279271
279395
|
return;
|
|
279272
279396
|
}
|
|
@@ -279281,11 +279405,11 @@ var init_LspServerManager = __esm({
|
|
|
279281
279405
|
await this.initializeLspServer(connection, handle2.config);
|
|
279282
279406
|
handle2.status = "READY";
|
|
279283
279407
|
this.attachRestartHandler(name4, handle2);
|
|
279284
|
-
|
|
279408
|
+
debugLogger88.info(`LSP server ${name4} started successfully`);
|
|
279285
279409
|
} catch (error40) {
|
|
279286
279410
|
handle2.status = "FAILED";
|
|
279287
279411
|
handle2.error = error40;
|
|
279288
|
-
|
|
279412
|
+
debugLogger88.error(`LSP server ${name4} failed to start:`, error40);
|
|
279289
279413
|
}
|
|
279290
279414
|
}
|
|
279291
279415
|
/**
|
|
@@ -279297,7 +279421,7 @@ var init_LspServerManager = __esm({
|
|
|
279297
279421
|
try {
|
|
279298
279422
|
await this.shutdownConnection(handle2);
|
|
279299
279423
|
} catch (error40) {
|
|
279300
|
-
|
|
279424
|
+
debugLogger88.error(`Error closing LSP server ${name4}:`, error40);
|
|
279301
279425
|
}
|
|
279302
279426
|
} else if (handle2.process && handle2.process.exitCode === null) {
|
|
279303
279427
|
handle2.process.kill();
|
|
@@ -279345,12 +279469,12 @@ var init_LspServerManager = __esm({
|
|
|
279345
279469
|
}
|
|
279346
279470
|
const attempts = handle2.restartAttempts ?? 0;
|
|
279347
279471
|
if (attempts >= maxRestarts) {
|
|
279348
|
-
|
|
279472
|
+
debugLogger88.warn(`LSP server ${name4} reached max restart attempts (${maxRestarts}), stopping restarts`);
|
|
279349
279473
|
handle2.status = "FAILED";
|
|
279350
279474
|
return;
|
|
279351
279475
|
}
|
|
279352
279476
|
handle2.restartAttempts = attempts + 1;
|
|
279353
|
-
|
|
279477
|
+
debugLogger88.warn(`LSP server ${name4} exited (code ${code2 ?? "unknown"}), restarting (${handle2.restartAttempts}/${maxRestarts})`);
|
|
279354
279478
|
this.resetHandle(handle2);
|
|
279355
279479
|
void this.startServer(name4, handle2);
|
|
279356
279480
|
});
|
|
@@ -279577,10 +279701,10 @@ var init_LspServerManager = __esm({
|
|
|
279577
279701
|
return true;
|
|
279578
279702
|
}
|
|
279579
279703
|
if (this.requireTrustedWorkspace || serverConfig.trustRequired) {
|
|
279580
|
-
|
|
279704
|
+
debugLogger88.warn(`Workspace not trusted, skipping LSP server ${serverName} (${serverConfig.command ?? serverConfig.transport})`);
|
|
279581
279705
|
return false;
|
|
279582
279706
|
}
|
|
279583
|
-
|
|
279707
|
+
debugLogger88.info(`Untrusted workspace, but LSP server ${serverName} has trustRequired=false, attempting cautious startup`);
|
|
279584
279708
|
return true;
|
|
279585
279709
|
}
|
|
279586
279710
|
/**
|
|
@@ -279787,7 +279911,7 @@ var init_NativeLspClient = __esm({
|
|
|
279787
279911
|
import * as path91 from "path";
|
|
279788
279912
|
import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL5 } from "url";
|
|
279789
279913
|
import * as fs83 from "node:fs";
|
|
279790
|
-
var
|
|
279914
|
+
var debugLogger89, LANGUAGE_ID_TO_EXTENSIONS, DEFAULT_EXCLUDE_PATTERNS, NativeLspService;
|
|
279791
279915
|
var init_NativeLspService = __esm({
|
|
279792
279916
|
"packages/core/dist/src/lsp/NativeLspService.js"() {
|
|
279793
279917
|
"use strict";
|
|
@@ -279798,7 +279922,7 @@ var init_NativeLspService = __esm({
|
|
|
279798
279922
|
init_LspServerManager();
|
|
279799
279923
|
init_debugLogger();
|
|
279800
279924
|
init_esm11();
|
|
279801
|
-
|
|
279925
|
+
debugLogger89 = createDebugLogger("LSP");
|
|
279802
279926
|
LANGUAGE_ID_TO_EXTENSIONS = {
|
|
279803
279927
|
typescript: ["ts", "tsx"],
|
|
279804
279928
|
typescriptreact: ["tsx"],
|
|
@@ -279848,7 +279972,7 @@ var init_NativeLspService = __esm({
|
|
|
279848
279972
|
const workspaceTrusted = this.config.isTrustedFolder();
|
|
279849
279973
|
this.serverManager.clearServerHandles();
|
|
279850
279974
|
if (this.requireTrustedWorkspace && !workspaceTrusted) {
|
|
279851
|
-
|
|
279975
|
+
debugLogger89.warn("Workspace is not trusted, skipping LSP server discovery");
|
|
279852
279976
|
return;
|
|
279853
279977
|
}
|
|
279854
279978
|
const userConfigs = await this.configLoader.loadUserConfigs();
|
|
@@ -279916,14 +280040,14 @@ var init_NativeLspService = __esm({
|
|
|
279916
280040
|
try {
|
|
279917
280041
|
filePath = fileURLToPath9(uri);
|
|
279918
280042
|
} catch (error40) {
|
|
279919
|
-
|
|
280043
|
+
debugLogger89.warn(`Failed to resolve file path for ${uri}:`, error40);
|
|
279920
280044
|
return false;
|
|
279921
280045
|
}
|
|
279922
280046
|
let text;
|
|
279923
280047
|
try {
|
|
279924
280048
|
text = fs83.readFileSync(filePath, "utf-8");
|
|
279925
280049
|
} catch (error40) {
|
|
279926
|
-
|
|
280050
|
+
debugLogger89.warn(`Failed to read file for LSP didOpen: ${filePath}`, error40);
|
|
279927
280051
|
return false;
|
|
279928
280052
|
}
|
|
279929
280053
|
const languageId = this.resolveLanguageId(filePath, handle2) ?? "plaintext";
|
|
@@ -280120,7 +280244,7 @@ var init_NativeLspService = __esm({
|
|
|
280120
280244
|
}
|
|
280121
280245
|
}
|
|
280122
280246
|
} catch (error40) {
|
|
280123
|
-
|
|
280247
|
+
debugLogger89.warn(`LSP workspace/symbol failed for ${serverName}:`, error40);
|
|
280124
280248
|
}
|
|
280125
280249
|
}
|
|
280126
280250
|
return results.slice(0, limit2);
|
|
@@ -280158,7 +280282,7 @@ var init_NativeLspService = __esm({
|
|
|
280158
280282
|
return definitions.slice(0, limit2);
|
|
280159
280283
|
}
|
|
280160
280284
|
} catch (error40) {
|
|
280161
|
-
|
|
280285
|
+
debugLogger89.warn(`LSP textDocument/definition failed for ${name4}:`, error40);
|
|
280162
280286
|
}
|
|
280163
280287
|
}
|
|
280164
280288
|
return [];
|
|
@@ -280199,7 +280323,7 @@ var init_NativeLspService = __esm({
|
|
|
280199
280323
|
return refs.slice(0, limit2);
|
|
280200
280324
|
}
|
|
280201
280325
|
} catch (error40) {
|
|
280202
|
-
|
|
280326
|
+
debugLogger89.warn(`LSP textDocument/references failed for ${name4}:`, error40);
|
|
280203
280327
|
}
|
|
280204
280328
|
}
|
|
280205
280329
|
return [];
|
|
@@ -280227,7 +280351,7 @@ var init_NativeLspService = __esm({
|
|
|
280227
280351
|
return normalized2;
|
|
280228
280352
|
}
|
|
280229
280353
|
} catch (error40) {
|
|
280230
|
-
|
|
280354
|
+
debugLogger89.warn(`LSP textDocument/hover failed for ${name4}:`, error40);
|
|
280231
280355
|
}
|
|
280232
280356
|
}
|
|
280233
280357
|
return null;
|
|
@@ -280272,7 +280396,7 @@ var init_NativeLspService = __esm({
|
|
|
280272
280396
|
return symbols.slice(0, limit2);
|
|
280273
280397
|
}
|
|
280274
280398
|
} catch (error40) {
|
|
280275
|
-
|
|
280399
|
+
debugLogger89.warn(`LSP textDocument/documentSymbol failed for ${name4}:`, error40);
|
|
280276
280400
|
}
|
|
280277
280401
|
}
|
|
280278
280402
|
return [];
|
|
@@ -280310,7 +280434,7 @@ var init_NativeLspService = __esm({
|
|
|
280310
280434
|
return implementations.slice(0, limit2);
|
|
280311
280435
|
}
|
|
280312
280436
|
} catch (error40) {
|
|
280313
|
-
|
|
280437
|
+
debugLogger89.warn(`LSP textDocument/implementation failed for ${name4}:`, error40);
|
|
280314
280438
|
}
|
|
280315
280439
|
}
|
|
280316
280440
|
return [];
|
|
@@ -280348,7 +280472,7 @@ var init_NativeLspService = __esm({
|
|
|
280348
280472
|
return items.slice(0, limit2);
|
|
280349
280473
|
}
|
|
280350
280474
|
} catch (error40) {
|
|
280351
|
-
|
|
280475
|
+
debugLogger89.warn(`LSP textDocument/prepareCallHierarchy failed for ${name4}:`, error40);
|
|
280352
280476
|
}
|
|
280353
280477
|
}
|
|
280354
280478
|
return [];
|
|
@@ -280382,7 +280506,7 @@ var init_NativeLspService = __esm({
|
|
|
280382
280506
|
return calls.slice(0, limit2);
|
|
280383
280507
|
}
|
|
280384
280508
|
} catch (error40) {
|
|
280385
|
-
|
|
280509
|
+
debugLogger89.warn(`LSP callHierarchy/incomingCalls failed for ${name4}:`, error40);
|
|
280386
280510
|
}
|
|
280387
280511
|
}
|
|
280388
280512
|
return [];
|
|
@@ -280416,7 +280540,7 @@ var init_NativeLspService = __esm({
|
|
|
280416
280540
|
return calls.slice(0, limit2);
|
|
280417
280541
|
}
|
|
280418
280542
|
} catch (error40) {
|
|
280419
|
-
|
|
280543
|
+
debugLogger89.warn(`LSP callHierarchy/outgoingCalls failed for ${name4}:`, error40);
|
|
280420
280544
|
}
|
|
280421
280545
|
}
|
|
280422
280546
|
return [];
|
|
@@ -280447,7 +280571,7 @@ var init_NativeLspService = __esm({
|
|
|
280447
280571
|
}
|
|
280448
280572
|
}
|
|
280449
280573
|
} catch (error40) {
|
|
280450
|
-
|
|
280574
|
+
debugLogger89.warn(`LSP textDocument/diagnostic failed for ${name4}:`, error40);
|
|
280451
280575
|
}
|
|
280452
280576
|
}
|
|
280453
280577
|
return allDiagnostics;
|
|
@@ -280480,7 +280604,7 @@ var init_NativeLspService = __esm({
|
|
|
280480
280604
|
}
|
|
280481
280605
|
}
|
|
280482
280606
|
} catch (error40) {
|
|
280483
|
-
|
|
280607
|
+
debugLogger89.warn(`LSP workspace/diagnostic failed for ${name4}:`, error40);
|
|
280484
280608
|
}
|
|
280485
280609
|
if (results.length >= limit2) {
|
|
280486
280610
|
break;
|
|
@@ -280525,7 +280649,7 @@ var init_NativeLspService = __esm({
|
|
|
280525
280649
|
return actions.slice(0, limit2);
|
|
280526
280650
|
}
|
|
280527
280651
|
} catch (error40) {
|
|
280528
|
-
|
|
280652
|
+
debugLogger89.warn(`LSP textDocument/codeAction failed for ${name4}:`, error40);
|
|
280529
280653
|
}
|
|
280530
280654
|
}
|
|
280531
280655
|
return [];
|
|
@@ -280547,7 +280671,7 @@ var init_NativeLspService = __esm({
|
|
|
280547
280671
|
}
|
|
280548
280672
|
return true;
|
|
280549
280673
|
} catch (error40) {
|
|
280550
|
-
|
|
280674
|
+
debugLogger89.error("Failed to apply workspace edit:", error40);
|
|
280551
280675
|
return false;
|
|
280552
280676
|
}
|
|
280553
280677
|
}
|
|
@@ -280864,12 +280988,12 @@ var init_types19 = __esm({
|
|
|
280864
280988
|
// packages/core/dist/src/agents/backends/tmux-commands.js
|
|
280865
280989
|
async function tmuxResult(args2, serverName) {
|
|
280866
280990
|
const fullArgs = serverName ? ["-L", serverName, ...args2] : args2;
|
|
280867
|
-
|
|
280991
|
+
debugLogger90.info(`tmux ${fullArgs.join(" ")}`);
|
|
280868
280992
|
const result = await execCommand("tmux", fullArgs, {
|
|
280869
280993
|
preserveOutputOnError: true
|
|
280870
280994
|
});
|
|
280871
280995
|
if (result.code !== 0 && result.stderr.trim()) {
|
|
280872
|
-
|
|
280996
|
+
debugLogger90.error(`tmux error: ${result.stderr.trim()}`);
|
|
280873
280997
|
}
|
|
280874
280998
|
return result;
|
|
280875
280999
|
}
|
|
@@ -281049,14 +281173,14 @@ async function tmuxGetFirstPaneId(target, serverName) {
|
|
|
281049
281173
|
}
|
|
281050
281174
|
return firstLine.trim();
|
|
281051
281175
|
}
|
|
281052
|
-
var
|
|
281176
|
+
var debugLogger90, MIN_TMUX_VERSION;
|
|
281053
281177
|
var init_tmux_commands = __esm({
|
|
281054
281178
|
"packages/core/dist/src/agents/backends/tmux-commands.js"() {
|
|
281055
281179
|
"use strict";
|
|
281056
281180
|
init_esbuild_shims();
|
|
281057
281181
|
init_shell_utils();
|
|
281058
281182
|
init_debugLogger();
|
|
281059
|
-
|
|
281183
|
+
debugLogger90 = createDebugLogger("TMUX_CMD");
|
|
281060
281184
|
MIN_TMUX_VERSION = "3.0";
|
|
281061
281185
|
__name(tmuxResult, "tmuxResult");
|
|
281062
281186
|
__name(tmux, "tmux");
|
|
@@ -281093,7 +281217,7 @@ var init_tmux_commands = __esm({
|
|
|
281093
281217
|
function shellQuote(value) {
|
|
281094
281218
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
281095
281219
|
}
|
|
281096
|
-
var
|
|
281220
|
+
var debugLogger91, EXIT_POLL_INTERVAL_MS, TMUX_SERVER_PREFIX, DEFAULT_TMUX_SESSION, DEFAULT_TMUX_WINDOW, DEFAULT_LEADER_WIDTH_PERCENT, DEFAULT_FIRST_SPLIT_PERCENT, DEFAULT_PANE_BORDER_FORMAT, INTERNAL_LAYOUT_SETTLE_MS, EXTERNAL_LAYOUT_SETTLE_MS, TmuxBackend;
|
|
281097
281221
|
var init_TmuxBackend = __esm({
|
|
281098
281222
|
"packages/core/dist/src/agents/backends/TmuxBackend.js"() {
|
|
281099
281223
|
"use strict";
|
|
@@ -281101,7 +281225,7 @@ var init_TmuxBackend = __esm({
|
|
|
281101
281225
|
init_debugLogger();
|
|
281102
281226
|
init_types19();
|
|
281103
281227
|
init_tmux_commands();
|
|
281104
|
-
|
|
281228
|
+
debugLogger91 = createDebugLogger("TMUX_BACKEND");
|
|
281105
281229
|
EXIT_POLL_INTERVAL_MS = 500;
|
|
281106
281230
|
TMUX_SERVER_PREFIX = "arena-server";
|
|
281107
281231
|
DEFAULT_TMUX_SESSION = "arena-view";
|
|
@@ -281148,9 +281272,9 @@ var init_TmuxBackend = __esm({
|
|
|
281148
281272
|
if (this.insideTmux) {
|
|
281149
281273
|
this.mainPaneId = await tmuxCurrentPaneId();
|
|
281150
281274
|
this.windowTarget = await tmuxCurrentWindowTarget();
|
|
281151
|
-
|
|
281275
|
+
debugLogger91.info(`Initialized inside tmux: pane ${this.mainPaneId}, window ${this.windowTarget}`);
|
|
281152
281276
|
} else {
|
|
281153
|
-
|
|
281277
|
+
debugLogger91.info("Initialized outside tmux; will use external tmux server");
|
|
281154
281278
|
}
|
|
281155
281279
|
this.initialized = true;
|
|
281156
281280
|
}
|
|
@@ -281171,7 +281295,7 @@ var init_TmuxBackend = __esm({
|
|
|
281171
281295
|
async spawnAgentAsync(config2, cmd) {
|
|
281172
281296
|
const { agentId } = config2;
|
|
281173
281297
|
const options2 = this.resolveTmuxOptions(config2);
|
|
281174
|
-
|
|
281298
|
+
debugLogger91.info(`[spawnAgentAsync] Starting spawn for agent "${agentId}", mainPane="${this.mainPaneId}", currentPanesCount=${this.panes.size}`);
|
|
281175
281299
|
try {
|
|
281176
281300
|
let paneId = "";
|
|
281177
281301
|
if (this.insideTmux) {
|
|
@@ -281203,9 +281327,9 @@ var init_TmuxBackend = __esm({
|
|
|
281203
281327
|
this.activeAgentId = agentId;
|
|
281204
281328
|
}
|
|
281205
281329
|
this.startExitPolling();
|
|
281206
|
-
|
|
281330
|
+
debugLogger91.info(`[spawnAgentAsync] Spawned agent "${agentId}" in pane ${paneId} \u2014 SUCCESS`);
|
|
281207
281331
|
} catch (error40) {
|
|
281208
|
-
|
|
281332
|
+
debugLogger91.error(`[spawnAgentAsync] Failed to spawn agent "${agentId}":`, error40);
|
|
281209
281333
|
this.panes.set(agentId, {
|
|
281210
281334
|
agentId,
|
|
281211
281335
|
paneId: "",
|
|
@@ -281229,12 +281353,12 @@ var init_TmuxBackend = __esm({
|
|
|
281229
281353
|
try {
|
|
281230
281354
|
if (process.stdout.isTTY) {
|
|
281231
281355
|
process.stdout.emit("resize");
|
|
281232
|
-
|
|
281356
|
+
debugLogger91.info("[triggerMainProcessRedraw] Emitted stdout resize event");
|
|
281233
281357
|
}
|
|
281234
281358
|
process.kill(process.pid, "SIGWINCH");
|
|
281235
|
-
|
|
281359
|
+
debugLogger91.info("[triggerMainProcessRedraw] Sent SIGWINCH");
|
|
281236
281360
|
} catch (error40) {
|
|
281237
|
-
|
|
281361
|
+
debugLogger91.info(`[triggerMainProcessRedraw] Failed: ${error40}`);
|
|
281238
281362
|
}
|
|
281239
281363
|
}, 100);
|
|
281240
281364
|
}
|
|
@@ -281246,7 +281370,7 @@ var init_TmuxBackend = __esm({
|
|
|
281246
281370
|
void tmuxKillPane(pane.paneId, this.getServerName());
|
|
281247
281371
|
}
|
|
281248
281372
|
pane.status = "exited";
|
|
281249
|
-
|
|
281373
|
+
debugLogger91.info(`Killed pane for agent "${agentId}"`);
|
|
281250
281374
|
}
|
|
281251
281375
|
stopAll() {
|
|
281252
281376
|
for (const [agentId, pane] of this.panes.entries()) {
|
|
@@ -281255,7 +281379,7 @@ var init_TmuxBackend = __esm({
|
|
|
281255
281379
|
void tmuxKillPane(pane.paneId, this.getServerName());
|
|
281256
281380
|
}
|
|
281257
281381
|
pane.status = "exited";
|
|
281258
|
-
|
|
281382
|
+
debugLogger91.info(`Killed pane for agent "${agentId}"`);
|
|
281259
281383
|
}
|
|
281260
281384
|
}
|
|
281261
281385
|
}
|
|
@@ -281266,18 +281390,18 @@ var init_TmuxBackend = __esm({
|
|
|
281266
281390
|
if (pane.paneId) {
|
|
281267
281391
|
try {
|
|
281268
281392
|
await tmuxKillPane(pane.paneId, this.getServerName());
|
|
281269
|
-
|
|
281393
|
+
debugLogger91.info(`Killed agent pane ${pane.paneId}`);
|
|
281270
281394
|
} catch (_error) {
|
|
281271
|
-
|
|
281395
|
+
debugLogger91.info(`Failed to kill pane ${pane.paneId} (may already be gone)`);
|
|
281272
281396
|
}
|
|
281273
281397
|
}
|
|
281274
281398
|
}
|
|
281275
281399
|
if (!this.insideTmux && this.sessionName && this.serverName) {
|
|
281276
281400
|
try {
|
|
281277
281401
|
await tmuxKillSession(this.sessionName, this.serverName);
|
|
281278
|
-
|
|
281402
|
+
debugLogger91.info(`Killed external tmux session "${this.sessionName}" on server "${this.serverName}"`);
|
|
281279
281403
|
} catch (_error) {
|
|
281280
|
-
|
|
281404
|
+
debugLogger91.info(`Failed to kill external tmux session (may already be gone)`);
|
|
281281
281405
|
}
|
|
281282
281406
|
}
|
|
281283
281407
|
this.panes.clear();
|
|
@@ -281426,7 +281550,7 @@ var init_TmuxBackend = __esm({
|
|
|
281426
281550
|
const panes = await tmuxListPanes(this.windowTarget);
|
|
281427
281551
|
const paneCount = panes.length;
|
|
281428
281552
|
if (paneCount === 1) {
|
|
281429
|
-
|
|
281553
|
+
debugLogger91.info(`[spawnInsideTmux] First agent \u2014 split -h -l ${options2.firstSplitPercent}% from ${this.mainPaneId}`);
|
|
281430
281554
|
return await tmuxSplitWindow(this.mainPaneId, {
|
|
281431
281555
|
horizontal: true,
|
|
281432
281556
|
percent: options2.firstSplitPercent,
|
|
@@ -281435,7 +281559,7 @@ var init_TmuxBackend = __esm({
|
|
|
281435
281559
|
}
|
|
281436
281560
|
const splitTarget = this.pickMiddlePane(panes).paneId;
|
|
281437
281561
|
const horizontal = this.shouldSplitHorizontally(paneCount);
|
|
281438
|
-
|
|
281562
|
+
debugLogger91.info(`[spawnInsideTmux] Split from middle pane ${splitTarget} (${paneCount} panes, ${horizontal ? "horizontal" : "vertical"})`);
|
|
281439
281563
|
return await tmuxSplitWindow(splitTarget, {
|
|
281440
281564
|
horizontal,
|
|
281441
281565
|
command: cmd
|
|
@@ -281450,14 +281574,14 @@ var init_TmuxBackend = __esm({
|
|
|
281450
281574
|
if (this.panes.size === 0) {
|
|
281451
281575
|
const firstPaneId = await tmuxGetFirstPaneId(this.windowTarget, serverName);
|
|
281452
281576
|
this.mainPaneId = firstPaneId;
|
|
281453
|
-
|
|
281577
|
+
debugLogger91.info(`[spawnOutsideTmux] First agent \u2014 respawn in pane ${firstPaneId}`);
|
|
281454
281578
|
await tmuxRespawnPane(firstPaneId, cmd, serverName);
|
|
281455
281579
|
return firstPaneId;
|
|
281456
281580
|
}
|
|
281457
281581
|
const panes = await tmuxListPanes(this.windowTarget, serverName);
|
|
281458
281582
|
const splitTarget = this.pickMiddlePane(panes).paneId;
|
|
281459
281583
|
const horizontal = this.shouldSplitHorizontally(panes.length);
|
|
281460
|
-
|
|
281584
|
+
debugLogger91.info(`[spawnOutsideTmux] Split from middle pane ${splitTarget} (${panes.length} panes, ${horizontal ? "horizontal" : "vertical"})`);
|
|
281461
281585
|
return await tmuxSplitWindow(splitTarget, { horizontal, command: cmd }, serverName);
|
|
281462
281586
|
}
|
|
281463
281587
|
pickMiddlePane(panes) {
|
|
@@ -281521,8 +281645,8 @@ var init_TmuxBackend = __esm({
|
|
|
281521
281645
|
parts2.push(cmdParts.join(" "));
|
|
281522
281646
|
}
|
|
281523
281647
|
const fullCommand = parts2.join(" && ");
|
|
281524
|
-
|
|
281525
|
-
|
|
281648
|
+
debugLogger91.info(`[buildShellCommand] agentId=${config2.agentId}, command=${config2.command}, args=${JSON.stringify(config2.args)}, cwd=${config2.cwd}`);
|
|
281649
|
+
debugLogger91.info(`[buildShellCommand] full shell command: ${fullCommand}`);
|
|
281526
281650
|
return fullCommand;
|
|
281527
281651
|
}
|
|
281528
281652
|
allExited() {
|
|
@@ -281557,7 +281681,7 @@ var init_TmuxBackend = __esm({
|
|
|
281557
281681
|
return;
|
|
281558
281682
|
paneInfos = await tmuxListPanes(this.windowTarget, serverName);
|
|
281559
281683
|
} catch (err2) {
|
|
281560
|
-
|
|
281684
|
+
debugLogger91.info(`[pollPaneStatus] Failed to list panes for window "${this.windowTarget}": ${err2}`);
|
|
281561
281685
|
return;
|
|
281562
281686
|
}
|
|
281563
281687
|
const paneMap = /* @__PURE__ */ new Map();
|
|
@@ -281565,7 +281689,7 @@ var init_TmuxBackend = __esm({
|
|
|
281565
281689
|
paneMap.set(info2.paneId, info2);
|
|
281566
281690
|
}
|
|
281567
281691
|
if (this.panes.size > 0) {
|
|
281568
|
-
|
|
281692
|
+
debugLogger91.info(`[pollPaneStatus] paneCount=${paneInfos.length}, agentPanes=${JSON.stringify(Array.from(this.panes.values()).map((p2) => {
|
|
281569
281693
|
const info2 = paneMap.get(p2.paneId);
|
|
281570
281694
|
return {
|
|
281571
281695
|
agentId: p2.agentId,
|
|
@@ -281583,14 +281707,14 @@ var init_TmuxBackend = __esm({
|
|
|
281583
281707
|
if (!info2) {
|
|
281584
281708
|
agent.status = "exited";
|
|
281585
281709
|
agent.exitCode = 1;
|
|
281586
|
-
|
|
281710
|
+
debugLogger91.info(`[pollPaneStatus] Agent "${agent.agentId}" pane ${agent.paneId} not found in tmux list \u2014 marking as exited`);
|
|
281587
281711
|
this.onExitCallback?.(agent.agentId, 1, null);
|
|
281588
281712
|
continue;
|
|
281589
281713
|
}
|
|
281590
281714
|
if (info2.dead) {
|
|
281591
281715
|
agent.status = "exited";
|
|
281592
281716
|
agent.exitCode = info2.deadStatus;
|
|
281593
|
-
|
|
281717
|
+
debugLogger91.info(`[pollPaneStatus] Agent "${agent.agentId}" (pane ${agent.paneId}) detected as DEAD with exit code ${info2.deadStatus}`);
|
|
281594
281718
|
this.onExitCallback?.(agent.agentId, info2.deadStatus, null);
|
|
281595
281719
|
}
|
|
281596
281720
|
}
|
|
@@ -281605,12 +281729,12 @@ var init_TmuxBackend = __esm({
|
|
|
281605
281729
|
|
|
281606
281730
|
// packages/core/dist/src/agents/backends/iterm-it2.js
|
|
281607
281731
|
async function it2Result(args2) {
|
|
281608
|
-
|
|
281732
|
+
debugLogger92.info(`it2 ${args2.join(" ")}`);
|
|
281609
281733
|
const result = await execCommand("it2", args2, {
|
|
281610
281734
|
preserveOutputOnError: true
|
|
281611
281735
|
});
|
|
281612
281736
|
if (result.code !== 0 && result.stderr.trim()) {
|
|
281613
|
-
|
|
281737
|
+
debugLogger92.error(`it2 error: ${result.stderr.trim()}`);
|
|
281614
281738
|
}
|
|
281615
281739
|
return result;
|
|
281616
281740
|
}
|
|
@@ -281687,14 +281811,14 @@ async function itermSendText(sessionId, text) {
|
|
|
281687
281811
|
async function itermCloseSession(sessionId) {
|
|
281688
281812
|
await it2(["session", "close", "-s", sessionId]);
|
|
281689
281813
|
}
|
|
281690
|
-
var
|
|
281814
|
+
var debugLogger92;
|
|
281691
281815
|
var init_iterm_it2 = __esm({
|
|
281692
281816
|
"packages/core/dist/src/agents/backends/iterm-it2.js"() {
|
|
281693
281817
|
"use strict";
|
|
281694
281818
|
init_esbuild_shims();
|
|
281695
281819
|
init_shell_utils();
|
|
281696
281820
|
init_debugLogger();
|
|
281697
|
-
|
|
281821
|
+
debugLogger92 = createDebugLogger("ITERM_IT2");
|
|
281698
281822
|
__name(it2Result, "it2Result");
|
|
281699
281823
|
__name(it2, "it2");
|
|
281700
281824
|
__name(parseCreatedPaneId, "parseCreatedPaneId");
|
|
@@ -281717,7 +281841,7 @@ import * as os24 from "node:os";
|
|
|
281717
281841
|
function shellQuote2(value) {
|
|
281718
281842
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
281719
281843
|
}
|
|
281720
|
-
var
|
|
281844
|
+
var debugLogger93, EXIT_POLL_INTERVAL_MS2, ITermBackend, VALID_ENV_KEY;
|
|
281721
281845
|
var init_ITermBackend = __esm({
|
|
281722
281846
|
"packages/core/dist/src/agents/backends/ITermBackend.js"() {
|
|
281723
281847
|
"use strict";
|
|
@@ -281725,7 +281849,7 @@ var init_ITermBackend = __esm({
|
|
|
281725
281849
|
init_debugLogger();
|
|
281726
281850
|
init_types19();
|
|
281727
281851
|
init_iterm_it2();
|
|
281728
|
-
|
|
281852
|
+
debugLogger93 = createDebugLogger("ITERM_BACKEND");
|
|
281729
281853
|
EXIT_POLL_INTERVAL_MS2 = 500;
|
|
281730
281854
|
ITermBackend = class {
|
|
281731
281855
|
static {
|
|
@@ -281755,7 +281879,7 @@ var init_ITermBackend = __esm({
|
|
|
281755
281879
|
await verifyITerm();
|
|
281756
281880
|
await fs85.mkdir(this.exitMarkerDir, { recursive: true });
|
|
281757
281881
|
this.initialized = true;
|
|
281758
|
-
|
|
281882
|
+
debugLogger93.info("ITermBackend initialized");
|
|
281759
281883
|
}
|
|
281760
281884
|
// ─── Agent Lifecycle ────────────────────────────────────────
|
|
281761
281885
|
async spawnAgent(config2) {
|
|
@@ -281798,9 +281922,9 @@ var init_ITermBackend = __esm({
|
|
|
281798
281922
|
this.activeAgentId = agentId;
|
|
281799
281923
|
}
|
|
281800
281924
|
this.startExitPolling();
|
|
281801
|
-
|
|
281925
|
+
debugLogger93.info(`Spawned agent "${agentId}" in session ${sessionId}`);
|
|
281802
281926
|
} catch (error40) {
|
|
281803
|
-
|
|
281927
|
+
debugLogger93.error(`Failed to spawn agent "${agentId}":`, error40);
|
|
281804
281928
|
this.sessions.set(agentId, {
|
|
281805
281929
|
agentId,
|
|
281806
281930
|
sessionId: "",
|
|
@@ -281818,16 +281942,16 @@ var init_ITermBackend = __esm({
|
|
|
281818
281942
|
const session = this.sessions.get(agentId);
|
|
281819
281943
|
if (!session || session.status !== "running")
|
|
281820
281944
|
return;
|
|
281821
|
-
itermCloseSession(session.sessionId).catch((e4) =>
|
|
281945
|
+
itermCloseSession(session.sessionId).catch((e4) => debugLogger93.error(`Failed to close session for agent "${agentId}": ${e4}`));
|
|
281822
281946
|
session.status = "exited";
|
|
281823
281947
|
session.exitCode = 1;
|
|
281824
281948
|
this.onExitCallback?.(agentId, 1, null);
|
|
281825
|
-
|
|
281949
|
+
debugLogger93.info(`Closed iTerm2 session for agent "${agentId}"`);
|
|
281826
281950
|
}
|
|
281827
281951
|
stopAll() {
|
|
281828
281952
|
for (const session of this.sessions.values()) {
|
|
281829
281953
|
if (session.status === "running") {
|
|
281830
|
-
itermCloseSession(session.sessionId).catch((e4) =>
|
|
281954
|
+
itermCloseSession(session.sessionId).catch((e4) => debugLogger93.error(`Failed to close session for agent "${session.agentId}": ${e4}`));
|
|
281831
281955
|
session.status = "exited";
|
|
281832
281956
|
session.exitCode = 1;
|
|
281833
281957
|
this.onExitCallback?.(session.agentId, 1, null);
|
|
@@ -281843,7 +281967,7 @@ var init_ITermBackend = __esm({
|
|
|
281843
281967
|
try {
|
|
281844
281968
|
await itermCloseSession(session.sessionId);
|
|
281845
281969
|
} catch (error40) {
|
|
281846
|
-
|
|
281970
|
+
debugLogger93.error("Session cleanup error (ignored):", error40);
|
|
281847
281971
|
}
|
|
281848
281972
|
}
|
|
281849
281973
|
try {
|
|
@@ -281852,7 +281976,7 @@ var init_ITermBackend = __esm({
|
|
|
281852
281976
|
force: true
|
|
281853
281977
|
});
|
|
281854
281978
|
} catch (error40) {
|
|
281855
|
-
|
|
281979
|
+
debugLogger93.error("Exit marker cleanup error (ignored):", error40);
|
|
281856
281980
|
}
|
|
281857
281981
|
this.sessions.clear();
|
|
281858
281982
|
this.agentOrder = [];
|
|
@@ -281890,7 +282014,7 @@ var init_ITermBackend = __esm({
|
|
|
281890
282014
|
}
|
|
281891
282015
|
const session = this.sessions.get(agentId);
|
|
281892
282016
|
this.activeAgentId = agentId;
|
|
281893
|
-
itermFocusSession(session.sessionId).catch((e4) =>
|
|
282017
|
+
itermFocusSession(session.sessionId).catch((e4) => debugLogger93.error(`Failed to focus session for agent "${agentId}": ${e4}`));
|
|
281894
282018
|
}
|
|
281895
282019
|
switchToNext() {
|
|
281896
282020
|
if (this.agentOrder.length <= 1)
|
|
@@ -281929,7 +282053,7 @@ var init_ITermBackend = __esm({
|
|
|
281929
282053
|
const session = this.sessions.get(agentId);
|
|
281930
282054
|
if (!session || session.status !== "running")
|
|
281931
282055
|
return false;
|
|
281932
|
-
itermSendText(session.sessionId, data).catch((e4) =>
|
|
282056
|
+
itermSendText(session.sessionId, data).catch((e4) => debugLogger93.error(`Failed to send text to agent "${agentId}": ${e4}`));
|
|
281933
282057
|
return true;
|
|
281934
282058
|
}
|
|
281935
282059
|
// ─── Resize ─────────────────────────────────────────────────
|
|
@@ -282006,7 +282130,7 @@ var init_ITermBackend = __esm({
|
|
|
282006
282130
|
const exitCode = parseInt(content.trim(), 10);
|
|
282007
282131
|
agent.status = "exited";
|
|
282008
282132
|
agent.exitCode = isNaN(exitCode) ? 1 : exitCode;
|
|
282009
|
-
|
|
282133
|
+
debugLogger93.info(`Agent "${agent.agentId}" exited with code ${agent.exitCode}`);
|
|
282010
282134
|
this.onExitCallback?.(agent.agentId, agent.exitCode, null);
|
|
282011
282135
|
} catch {
|
|
282012
282136
|
}
|
|
@@ -282081,7 +282205,7 @@ function terminateModeMessage(mode) {
|
|
|
282081
282205
|
return null;
|
|
282082
282206
|
}
|
|
282083
282207
|
}
|
|
282084
|
-
var
|
|
282208
|
+
var debugLogger94, AgentInteractive;
|
|
282085
282209
|
var init_agent_interactive = __esm({
|
|
282086
282210
|
"packages/core/dist/src/agents/runtime/agent-interactive.js"() {
|
|
282087
282211
|
"use strict";
|
|
@@ -282091,7 +282215,7 @@ var init_agent_interactive = __esm({
|
|
|
282091
282215
|
init_tools();
|
|
282092
282216
|
init_asyncMessageQueue();
|
|
282093
282217
|
init_agent_types();
|
|
282094
|
-
|
|
282218
|
+
debugLogger94 = createDebugLogger("AGENT_INTERACTIVE");
|
|
282095
282219
|
AgentInteractive = class {
|
|
282096
282220
|
static {
|
|
282097
282221
|
__name(this, "AgentInteractive");
|
|
@@ -282140,6 +282264,11 @@ var init_agent_interactive = __esm({
|
|
|
282140
282264
|
// Populated by TOOL_OUTPUT_UPDATE when pid is present, cleared on TOOL_RESULT.
|
|
282141
282265
|
// The UI reads this via getShellPids() to enable interactive shell input.
|
|
282142
282266
|
shellPids = /* @__PURE__ */ new Map();
|
|
282267
|
+
// Wall-clock timestamp when each currently-executing tool transitioned into
|
|
282268
|
+
// the scheduler's `executing` state. Keyed by callId. First TOOL_OUTPUT_UPDATE
|
|
282269
|
+
// carrying executionStartTime wins; later events that re-carry it are ignored
|
|
282270
|
+
// so the timer is stable.
|
|
282271
|
+
executionStartTimes = /* @__PURE__ */ new Map();
|
|
282143
282272
|
constructor(config2, core) {
|
|
282144
282273
|
this.config = config2;
|
|
282145
282274
|
this.core = core;
|
|
@@ -282192,7 +282321,7 @@ var init_agent_interactive = __esm({
|
|
|
282192
282321
|
} catch (err2) {
|
|
282193
282322
|
this.error = err2 instanceof Error ? err2.message : String(err2);
|
|
282194
282323
|
this.setStatus(AgentStatus.FAILED);
|
|
282195
|
-
|
|
282324
|
+
debugLogger94.error("AgentInteractive processing failed:", err2);
|
|
282196
282325
|
} finally {
|
|
282197
282326
|
this.processing = false;
|
|
282198
282327
|
}
|
|
@@ -282233,7 +282362,7 @@ var init_agent_interactive = __esm({
|
|
|
282233
282362
|
return;
|
|
282234
282363
|
const errorMessage = err2 instanceof Error ? err2.message : String(err2);
|
|
282235
282364
|
this.lastRoundError = errorMessage;
|
|
282236
|
-
|
|
282365
|
+
debugLogger94.error("AgentInteractive round error:", err2);
|
|
282237
282366
|
this.addMessage("info", errorMessage, { metadata: { level: "error" } });
|
|
282238
282367
|
} finally {
|
|
282239
282368
|
this.masterAbortController.signal.removeEventListener("abort", onMasterAbort);
|
|
@@ -282477,6 +282606,16 @@ var init_agent_interactive = __esm({
|
|
|
282477
282606
|
getShellPids() {
|
|
282478
282607
|
return this.shellPids;
|
|
282479
282608
|
}
|
|
282609
|
+
/**
|
|
282610
|
+
* Returns wall-clock start timestamps (ms since epoch) for currently-
|
|
282611
|
+
* executing tools, from the scheduler's `→ executing` transition.
|
|
282612
|
+
* Keyed by callId; entries are cleared when TOOL_RESULT arrives. The UI
|
|
282613
|
+
* uses this to render an elapsed-time indicator that excludes approval
|
|
282614
|
+
* and scheduling wait.
|
|
282615
|
+
*/
|
|
282616
|
+
getExecutionStartTimes() {
|
|
282617
|
+
return this.executionStartTimes;
|
|
282618
|
+
}
|
|
282480
282619
|
/**
|
|
282481
282620
|
* Wait for the run loop to finish (used by InProcessBackend).
|
|
282482
282621
|
*/
|
|
@@ -282554,10 +282693,14 @@ var init_agent_interactive = __esm({
|
|
|
282554
282693
|
if (event.pid !== void 0) {
|
|
282555
282694
|
this.shellPids.set(event.callId, event.pid);
|
|
282556
282695
|
}
|
|
282696
|
+
if (event.executionStartTime !== void 0 && !this.executionStartTimes.has(event.callId)) {
|
|
282697
|
+
this.executionStartTimes.set(event.callId, event.executionStartTime);
|
|
282698
|
+
}
|
|
282557
282699
|
});
|
|
282558
282700
|
emitter.on(AgentEventType.TOOL_RESULT, (event) => {
|
|
282559
282701
|
this.liveOutputs.delete(event.callId);
|
|
282560
282702
|
this.shellPids.delete(event.callId);
|
|
282703
|
+
this.executionStartTimes.delete(event.callId);
|
|
282561
282704
|
this.pendingApprovals.delete(event.callId);
|
|
282562
282705
|
const statusText = event.success ? "succeeded" : "failed";
|
|
282563
282706
|
const summary = event.error ? `Tool ${event.name} ${statusText}: ${event.error}` : `Tool ${event.name} ${statusText}`;
|
|
@@ -282619,9 +282762,9 @@ async function createPerAgentConfig(base, cwd6, modelId, authOverrides) {
|
|
|
282619
282762
|
override.getContentGeneratorConfig = () => agentGeneratorConfig;
|
|
282620
282763
|
override.getAuthType = () => agentGeneratorConfig.authType;
|
|
282621
282764
|
override.getModel = () => agentGeneratorConfig.model;
|
|
282622
|
-
|
|
282765
|
+
debugLogger95.info(`Created per-agent ContentGenerator: authType=${authOverrides.authType}, model=${agentGeneratorConfig.model}`);
|
|
282623
282766
|
} catch (error40) {
|
|
282624
|
-
|
|
282767
|
+
debugLogger95.error("Failed to create per-agent ContentGenerator, falling back to parent:", error40);
|
|
282625
282768
|
}
|
|
282626
282769
|
}
|
|
282627
282770
|
return override;
|
|
@@ -282654,7 +282797,7 @@ function resolveCredentialField(explicitValue, inheritedValue, authType, field)
|
|
|
282654
282797
|
}
|
|
282655
282798
|
return void 0;
|
|
282656
282799
|
}
|
|
282657
|
-
var
|
|
282800
|
+
var debugLogger95, InProcessBackend;
|
|
282658
282801
|
var init_InProcessBackend = __esm({
|
|
282659
282802
|
"packages/core/dist/src/agents/backends/InProcessBackend.js"() {
|
|
282660
282803
|
"use strict";
|
|
@@ -282670,7 +282813,7 @@ var init_InProcessBackend = __esm({
|
|
|
282670
282813
|
init_types19();
|
|
282671
282814
|
init_workspaceContext();
|
|
282672
282815
|
init_fileDiscoveryService();
|
|
282673
|
-
|
|
282816
|
+
debugLogger95 = createDebugLogger("IN_PROCESS_BACKEND");
|
|
282674
282817
|
InProcessBackend = class {
|
|
282675
282818
|
static {
|
|
282676
282819
|
__name(this, "InProcessBackend");
|
|
@@ -282689,7 +282832,7 @@ var init_InProcessBackend = __esm({
|
|
|
282689
282832
|
}
|
|
282690
282833
|
// ─── Backend Interface ─────────────────────────────────────
|
|
282691
282834
|
async init() {
|
|
282692
|
-
|
|
282835
|
+
debugLogger95.info("InProcessBackend initialized");
|
|
282693
282836
|
}
|
|
282694
282837
|
async spawnAgent(config2) {
|
|
282695
282838
|
const inProcessConfig = config2.inProcess;
|
|
@@ -282728,9 +282871,9 @@ var init_InProcessBackend = __esm({
|
|
|
282728
282871
|
const exitCode = status === AgentStatus.COMPLETED ? 0 : status === AgentStatus.FAILED ? 1 : null;
|
|
282729
282872
|
this.exitCallback?.(config2.agentId, exitCode, null);
|
|
282730
282873
|
});
|
|
282731
|
-
|
|
282874
|
+
debugLogger95.info(`Spawned in-process agent: ${config2.agentId}`);
|
|
282732
282875
|
} catch (error40) {
|
|
282733
|
-
|
|
282876
|
+
debugLogger95.error(`Failed to start in-process agent "${config2.agentId}":`, error40);
|
|
282734
282877
|
this.exitCallback?.(config2.agentId, 1, null);
|
|
282735
282878
|
}
|
|
282736
282879
|
}
|
|
@@ -282738,14 +282881,14 @@ var init_InProcessBackend = __esm({
|
|
|
282738
282881
|
const agent = this.agents.get(agentId);
|
|
282739
282882
|
if (agent) {
|
|
282740
282883
|
agent.abort();
|
|
282741
|
-
|
|
282884
|
+
debugLogger95.info(`Stopped agent: ${agentId}`);
|
|
282742
282885
|
}
|
|
282743
282886
|
}
|
|
282744
282887
|
stopAll() {
|
|
282745
282888
|
for (const agent of this.agents.values()) {
|
|
282746
282889
|
agent.abort();
|
|
282747
282890
|
}
|
|
282748
|
-
|
|
282891
|
+
debugLogger95.info("Stopped all in-process agents");
|
|
282749
282892
|
}
|
|
282750
282893
|
async cleanup() {
|
|
282751
282894
|
this.cleanedUp = true;
|
|
@@ -282769,7 +282912,7 @@ var init_InProcessBackend = __esm({
|
|
|
282769
282912
|
this.agents.clear();
|
|
282770
282913
|
this.agentOrder.length = 0;
|
|
282771
282914
|
this.activeAgentId = null;
|
|
282772
|
-
|
|
282915
|
+
debugLogger95.info("InProcessBackend cleaned up");
|
|
282773
282916
|
}
|
|
282774
282917
|
setOnAgentExit(callback) {
|
|
282775
282918
|
this.exitCallback = callback;
|
|
@@ -282868,10 +283011,10 @@ var init_InProcessBackend = __esm({
|
|
|
282868
283011
|
// packages/core/dist/src/agents/backends/detect.js
|
|
282869
283012
|
async function detectBackend(preference, runtimeContext) {
|
|
282870
283013
|
const warning = preference && preference !== DISPLAY_MODE.IN_PROCESS ? `Display mode "${preference}" is not currently supported. Using in-process mode instead.` : void 0;
|
|
282871
|
-
|
|
283014
|
+
debugLogger96.info("Using InProcessBackend");
|
|
282872
283015
|
return { backend: new InProcessBackend(runtimeContext), warning };
|
|
282873
283016
|
}
|
|
282874
|
-
var
|
|
283017
|
+
var debugLogger96;
|
|
282875
283018
|
var init_detect = __esm({
|
|
282876
283019
|
"packages/core/dist/src/agents/backends/detect.js"() {
|
|
282877
283020
|
"use strict";
|
|
@@ -282879,7 +283022,7 @@ var init_detect = __esm({
|
|
|
282879
283022
|
init_debugLogger();
|
|
282880
283023
|
init_InProcessBackend();
|
|
282881
283024
|
init_types19();
|
|
282882
|
-
|
|
283025
|
+
debugLogger96 = createDebugLogger("BACKEND_DETECT");
|
|
282883
283026
|
__name(detectBackend, "detectBackend");
|
|
282884
283027
|
}
|
|
282885
283028
|
});
|
|
@@ -282945,7 +283088,7 @@ var init_arena_events = __esm({
|
|
|
282945
283088
|
// packages/core/dist/src/agents/arena/ArenaManager.js
|
|
282946
283089
|
import * as fs86 from "node:fs/promises";
|
|
282947
283090
|
import * as path94 from "node:path";
|
|
282948
|
-
var
|
|
283091
|
+
var debugLogger97, ARENA_POLL_INTERVAL_MS, ArenaManager;
|
|
282949
283092
|
var init_ArenaManager = __esm({
|
|
282950
283093
|
"packages/core/dist/src/agents/arena/ArenaManager.js"() {
|
|
282951
283094
|
"use strict";
|
|
@@ -282962,7 +283105,7 @@ var init_ArenaManager = __esm({
|
|
|
282962
283105
|
init_types();
|
|
282963
283106
|
init_agent_types();
|
|
282964
283107
|
init_telemetry();
|
|
282965
|
-
|
|
283108
|
+
debugLogger97 = createDebugLogger("ARENA");
|
|
282966
283109
|
ARENA_POLL_INTERVAL_MS = 500;
|
|
282967
283110
|
ArenaManager = class {
|
|
282968
283111
|
static {
|
|
@@ -283156,9 +283299,9 @@ var init_ArenaManager = __esm({
|
|
|
283156
283299
|
sourceRepoPath,
|
|
283157
283300
|
chatHistory: options2.chatHistory
|
|
283158
283301
|
};
|
|
283159
|
-
|
|
283160
|
-
|
|
283161
|
-
|
|
283302
|
+
debugLogger97.info(`Starting Arena session: ${this.sessionId}`);
|
|
283303
|
+
debugLogger97.info(`Task: ${options2.task}`);
|
|
283304
|
+
debugLogger97.info(`Models: ${options2.models.map((m3) => m3.modelId).join(", ")}`);
|
|
283162
283305
|
const gitCheck = await this.worktreeService.checkGitAvailable();
|
|
283163
283306
|
if (!gitCheck.available) {
|
|
283164
283307
|
throw new Error(gitCheck.error);
|
|
@@ -283233,7 +283376,7 @@ ${worktreeInfo}`);
|
|
|
283233
283376
|
if (!this.sessionId) {
|
|
283234
283377
|
return;
|
|
283235
283378
|
}
|
|
283236
|
-
|
|
283379
|
+
debugLogger97.info(`Cancelling Arena session: ${this.sessionId}`);
|
|
283237
283380
|
this.stopPolling();
|
|
283238
283381
|
this.masterAbortController?.abort();
|
|
283239
283382
|
this.backend?.stopAll();
|
|
@@ -283260,7 +283403,7 @@ ${worktreeInfo}`);
|
|
|
283260
283403
|
if (!this.sessionId) {
|
|
283261
283404
|
return;
|
|
283262
283405
|
}
|
|
283263
|
-
|
|
283406
|
+
debugLogger97.info(`Cleaning up Arena session: ${this.sessionId}`);
|
|
283264
283407
|
this.emitSessionEnded(this.sessionStatus === ArenaSessionStatus.CANCELLED ? "cancelled" : "discarded");
|
|
283265
283408
|
this.stopPolling();
|
|
283266
283409
|
this.teardownEventBridge();
|
|
@@ -283284,7 +283427,7 @@ ${worktreeInfo}`);
|
|
|
283284
283427
|
if (!this.sessionId) {
|
|
283285
283428
|
return;
|
|
283286
283429
|
}
|
|
283287
|
-
|
|
283430
|
+
debugLogger97.info(`Cleaning up Arena runtime (preserving artifacts): ${this.sessionId}`);
|
|
283288
283431
|
this.emitSessionEnded(this.sessionStatus === ArenaSessionStatus.CANCELLED ? "cancelled" : "discarded");
|
|
283289
283432
|
this.stopPolling();
|
|
283290
283433
|
this.teardownEventBridge();
|
|
@@ -283445,7 +283588,7 @@ ${worktreeInfo}`);
|
|
|
283445
283588
|
if (!this.arenaConfig) {
|
|
283446
283589
|
throw new Error("Arena config not initialized");
|
|
283447
283590
|
}
|
|
283448
|
-
|
|
283591
|
+
debugLogger97.info("Setting up worktrees for Arena agents");
|
|
283449
283592
|
const worktreeNames = this.arenaConfig.models.map((m3) => m3.modelId);
|
|
283450
283593
|
const result = await this.worktreeService.setupWorktrees({
|
|
283451
283594
|
sessionId: this.worktreeDirName,
|
|
@@ -283487,14 +283630,14 @@ ${worktreeInfo}`);
|
|
|
283487
283630
|
};
|
|
283488
283631
|
this.agents.set(agentId, agentState);
|
|
283489
283632
|
}
|
|
283490
|
-
|
|
283633
|
+
debugLogger97.info(`Created ${this.agents.size} agent worktrees`);
|
|
283491
283634
|
}
|
|
283492
283635
|
// ─── Private: Agent Execution ──────────────────────────────────
|
|
283493
283636
|
async runAgents() {
|
|
283494
283637
|
if (!this.arenaConfig) {
|
|
283495
283638
|
throw new Error("Arena config not initialized");
|
|
283496
283639
|
}
|
|
283497
|
-
|
|
283640
|
+
debugLogger97.info("Starting Arena agents sequentially via backend");
|
|
283498
283641
|
const backend = this.requireBackend();
|
|
283499
283642
|
backend.setOnAgentExit((agentId, exitCode, signal) => {
|
|
283500
283643
|
this.handleAgentExit(agentId, exitCode, signal);
|
|
@@ -283515,7 +283658,7 @@ ${worktreeInfo}`);
|
|
|
283515
283658
|
this.stopPolling();
|
|
283516
283659
|
}
|
|
283517
283660
|
if (!allSettled) {
|
|
283518
|
-
|
|
283661
|
+
debugLogger97.info("Arena session timed out, stopping remaining agents");
|
|
283519
283662
|
this.sessionStatus = ArenaSessionStatus.CANCELLED;
|
|
283520
283663
|
for (const agent of this.agents.values()) {
|
|
283521
283664
|
if (!isTerminalStatus(agent.status)) {
|
|
@@ -283526,7 +283669,7 @@ ${worktreeInfo}`);
|
|
|
283526
283669
|
}
|
|
283527
283670
|
}
|
|
283528
283671
|
}
|
|
283529
|
-
|
|
283672
|
+
debugLogger97.info("All Arena agents settled or timed out");
|
|
283530
283673
|
}
|
|
283531
283674
|
async spawnAgentPty(agent) {
|
|
283532
283675
|
if (!this.arenaConfig) {
|
|
@@ -283534,7 +283677,7 @@ ${worktreeInfo}`);
|
|
|
283534
283677
|
}
|
|
283535
283678
|
const backend = this.requireBackend();
|
|
283536
283679
|
const { agentId, model, worktree } = agent;
|
|
283537
|
-
|
|
283680
|
+
debugLogger97.info(`Spawning agent PTY: ${agentId}`);
|
|
283538
283681
|
agent.startedAt = Date.now();
|
|
283539
283682
|
this.updateAgentStatus(agentId, AgentStatus.RUNNING);
|
|
283540
283683
|
this.eventEmitter.emit(ArenaEventType.AGENT_START, {
|
|
@@ -283558,7 +283701,7 @@ ${worktreeInfo}`);
|
|
|
283558
283701
|
error: errorMessage,
|
|
283559
283702
|
timestamp: Date.now()
|
|
283560
283703
|
});
|
|
283561
|
-
|
|
283704
|
+
debugLogger97.error(`Failed to spawn agent: ${agentId}`, error40);
|
|
283562
283705
|
}
|
|
283563
283706
|
}
|
|
283564
283707
|
requireBackend() {
|
|
@@ -283592,7 +283735,7 @@ ${worktreeInfo}`);
|
|
|
283592
283735
|
});
|
|
283593
283736
|
}
|
|
283594
283737
|
this.updateAgentStatus(agentId, agent.abortController.signal.aborted ? AgentStatus.CANCELLED : AgentStatus.FAILED);
|
|
283595
|
-
|
|
283738
|
+
debugLogger97.info(`Agent exited: ${agentId} (exit code: ${exitCode})`);
|
|
283596
283739
|
}
|
|
283597
283740
|
/**
|
|
283598
283741
|
* Build the spawn configuration for an agent subprocess.
|
|
@@ -283658,9 +283801,9 @@ ${worktreeInfo}`);
|
|
|
283658
283801
|
chatHistory: this.arenaConfig?.chatHistory
|
|
283659
283802
|
}
|
|
283660
283803
|
};
|
|
283661
|
-
|
|
283662
|
-
|
|
283663
|
-
|
|
283804
|
+
debugLogger97.info(`[buildAgentSpawnConfig] agentId=${agentId}, command=${spawnConfig.command}, cliEntry=${process.argv[1]}, resolvedEntry=${path94.resolve(process.argv[1])}`);
|
|
283805
|
+
debugLogger97.info(`[buildAgentSpawnConfig] args=${JSON.stringify(spawnConfig.args)}`);
|
|
283806
|
+
debugLogger97.info(`[buildAgentSpawnConfig] cwd=${spawnConfig.cwd}, env keys=${Object.keys(env5).join(",")}`);
|
|
283664
283807
|
return spawnConfig;
|
|
283665
283808
|
}
|
|
283666
283809
|
// ─── Private: Status & Results ─────────────────────────────────
|
|
@@ -283810,7 +283953,7 @@ ${worktreeInfo}`);
|
|
|
283810
283953
|
}
|
|
283811
283954
|
this.pollingInterval = setInterval(() => {
|
|
283812
283955
|
this.pollAgentStatuses().catch((error40) => {
|
|
283813
|
-
|
|
283956
|
+
debugLogger97.error("Error polling agent statuses:", error40);
|
|
283814
283957
|
});
|
|
283815
283958
|
}, ARENA_POLL_INTERVAL_MS);
|
|
283816
283959
|
}
|
|
@@ -283861,11 +284004,11 @@ ${worktreeInfo}`);
|
|
|
283861
284004
|
applyStatus(event.newStatus, {
|
|
283862
284005
|
roundCancelledByUser: event.roundCancelledByUser
|
|
283863
284006
|
});
|
|
283864
|
-
this.flushInProcessStatusFiles().catch((err2) =>
|
|
284007
|
+
this.flushInProcessStatusFiles().catch((err2) => debugLogger97.error("Failed to flush in-process status files:", err2));
|
|
283865
284008
|
}, "onStatusChange");
|
|
283866
284009
|
const onUsageMetadata = /* @__PURE__ */ __name(() => {
|
|
283867
284010
|
syncStats();
|
|
283868
|
-
this.flushInProcessStatusFiles().catch((err2) =>
|
|
284011
|
+
this.flushInProcessStatusFiles().catch((err2) => debugLogger97.error("Failed to flush in-process status files:", err2));
|
|
283869
284012
|
}, "onUsageMetadata");
|
|
283870
284013
|
emitter.on(AgentEventType.STATUS_CHANGE, onStatusChange);
|
|
283871
284014
|
emitter.on(AgentEventType.USAGE_METADATA, onUsageMetadata);
|
|
@@ -283876,7 +284019,7 @@ ${worktreeInfo}`);
|
|
|
283876
284019
|
syncStats();
|
|
283877
284020
|
applyStatus(interactive.getStatus());
|
|
283878
284021
|
}
|
|
283879
|
-
this.flushInProcessStatusFiles().catch((err2) =>
|
|
284022
|
+
this.flushInProcessStatusFiles().catch((err2) => debugLogger97.error("Failed to flush in-process status files:", err2));
|
|
283880
284023
|
}
|
|
283881
284024
|
/**
|
|
283882
284025
|
* Remove all event bridge listeners registered by setupInProcessEventBridge.
|
|
@@ -283921,7 +284064,7 @@ ${worktreeInfo}`);
|
|
|
283921
284064
|
if (isNodeError(error40) && error40.code === "ENOENT") {
|
|
283922
284065
|
continue;
|
|
283923
284066
|
}
|
|
283924
|
-
|
|
284067
|
+
debugLogger97.error(`Error reading status for agent ${agent.agentId}:`, error40);
|
|
283925
284068
|
}
|
|
283926
284069
|
}
|
|
283927
284070
|
if (Object.keys(consolidatedAgents).length > 0) {
|
|
@@ -283954,7 +284097,7 @@ ${worktreeInfo}`);
|
|
|
283954
284097
|
config2.agents = agents;
|
|
283955
284098
|
await atomicWriteJSON(configPath, config2);
|
|
283956
284099
|
} catch (error40) {
|
|
283957
|
-
|
|
284100
|
+
debugLogger97.error("Failed to write consolidated status to config.json:", error40);
|
|
283958
284101
|
}
|
|
283959
284102
|
}
|
|
283960
284103
|
/**
|
|
@@ -284003,7 +284146,7 @@ ${worktreeInfo}`);
|
|
|
284003
284146
|
async sendControlSignal(agentId, type, reason) {
|
|
284004
284147
|
const agent = this.agents.get(agentId);
|
|
284005
284148
|
if (!agent) {
|
|
284006
|
-
|
|
284149
|
+
debugLogger97.error(`Cannot send control signal: agent ${agentId} not found`);
|
|
284007
284150
|
return;
|
|
284008
284151
|
}
|
|
284009
284152
|
const controlSignal = {
|
|
@@ -284017,9 +284160,9 @@ ${worktreeInfo}`);
|
|
|
284017
284160
|
try {
|
|
284018
284161
|
await fs86.mkdir(controlDir, { recursive: true });
|
|
284019
284162
|
await fs86.writeFile(controlPath, JSON.stringify(controlSignal, null, 2), "utf-8");
|
|
284020
|
-
|
|
284163
|
+
debugLogger97.info(`Sent ${type} control signal to agent ${agentId}: ${reason}`);
|
|
284021
284164
|
} catch (error40) {
|
|
284022
|
-
|
|
284165
|
+
debugLogger97.error(`Failed to send control signal to agent ${agentId}:`, error40);
|
|
284023
284166
|
}
|
|
284024
284167
|
}
|
|
284025
284168
|
async collectResults() {
|
|
@@ -284033,7 +284176,7 @@ ${worktreeInfo}`);
|
|
|
284033
284176
|
try {
|
|
284034
284177
|
result.diff = await this.worktreeService.getWorktreeDiff(agent.worktree.path);
|
|
284035
284178
|
} catch (error40) {
|
|
284036
|
-
|
|
284179
|
+
debugLogger97.error(`Failed to get diff for agent ${agent.agentId}:`, error40);
|
|
284037
284180
|
}
|
|
284038
284181
|
}
|
|
284039
284182
|
agents.push(result);
|
|
@@ -284083,13 +284226,13 @@ var init_runtime = __esm({
|
|
|
284083
284226
|
});
|
|
284084
284227
|
|
|
284085
284228
|
// packages/core/dist/src/agents/mailbox.js
|
|
284086
|
-
var
|
|
284229
|
+
var debugLogger98, TeamMailbox;
|
|
284087
284230
|
var init_mailbox = __esm({
|
|
284088
284231
|
"packages/core/dist/src/agents/mailbox.js"() {
|
|
284089
284232
|
"use strict";
|
|
284090
284233
|
init_esbuild_shims();
|
|
284091
284234
|
init_debugLogger();
|
|
284092
|
-
|
|
284235
|
+
debugLogger98 = createDebugLogger("TEAM_MAILBOX");
|
|
284093
284236
|
TeamMailbox = class {
|
|
284094
284237
|
static {
|
|
284095
284238
|
__name(this, "TeamMailbox");
|
|
@@ -284102,7 +284245,7 @@ var init_mailbox = __esm({
|
|
|
284102
284245
|
register(agentId) {
|
|
284103
284246
|
if (!this.inboxes.has(agentId)) {
|
|
284104
284247
|
this.inboxes.set(agentId, []);
|
|
284105
|
-
|
|
284248
|
+
debugLogger98.debug(`Registered inbox for agent: ${agentId}`);
|
|
284106
284249
|
}
|
|
284107
284250
|
}
|
|
284108
284251
|
/**
|
|
@@ -284110,7 +284253,7 @@ var init_mailbox = __esm({
|
|
|
284110
284253
|
*/
|
|
284111
284254
|
unregister(agentId) {
|
|
284112
284255
|
this.inboxes.delete(agentId);
|
|
284113
|
-
|
|
284256
|
+
debugLogger98.debug(`Unregistered inbox for agent: ${agentId}`);
|
|
284114
284257
|
}
|
|
284115
284258
|
/**
|
|
284116
284259
|
* Send a message from one agent to another.
|
|
@@ -284129,7 +284272,7 @@ var init_mailbox = __esm({
|
|
|
284129
284272
|
this.inboxes.set(to, []);
|
|
284130
284273
|
}
|
|
284131
284274
|
this.inboxes.get(to).push(message);
|
|
284132
|
-
|
|
284275
|
+
debugLogger98.debug(`Message ${message.id}: ${from} \u2192 ${to} (${content.length} chars)`);
|
|
284133
284276
|
return message;
|
|
284134
284277
|
}
|
|
284135
284278
|
/**
|
|
@@ -284143,7 +284286,7 @@ var init_mailbox = __esm({
|
|
|
284143
284286
|
messages.push(this.send(from, agentId, content));
|
|
284144
284287
|
}
|
|
284145
284288
|
}
|
|
284146
|
-
|
|
284289
|
+
debugLogger98.debug(`Broadcast from ${from} to ${messages.length} agents`);
|
|
284147
284290
|
return messages;
|
|
284148
284291
|
}
|
|
284149
284292
|
/**
|
|
@@ -284187,7 +284330,7 @@ var init_mailbox = __esm({
|
|
|
284187
284330
|
clear() {
|
|
284188
284331
|
this.inboxes.clear();
|
|
284189
284332
|
this.messageCounter = 0;
|
|
284190
|
-
|
|
284333
|
+
debugLogger98.debug("Mailbox cleared");
|
|
284191
284334
|
}
|
|
284192
284335
|
};
|
|
284193
284336
|
}
|
|
@@ -284213,7 +284356,7 @@ async function writeTeamConfig(projectDir, teamName, config2) {
|
|
|
284213
284356
|
await fs87.mkdir(path95.dirname(configPath), { recursive: true });
|
|
284214
284357
|
config2.updatedAt = Date.now();
|
|
284215
284358
|
await fs87.writeFile(configPath, JSON.stringify(config2, null, 2), "utf-8");
|
|
284216
|
-
|
|
284359
|
+
debugLogger99.debug(`Team config written: ${configPath}`);
|
|
284217
284360
|
}
|
|
284218
284361
|
async function listTeams(projectDir) {
|
|
284219
284362
|
const teamsDir = path95.join(projectDir, TEAMS_DIR);
|
|
@@ -284277,13 +284420,13 @@ async function deleteTeam(projectDir, teamName) {
|
|
|
284277
284420
|
return false;
|
|
284278
284421
|
}
|
|
284279
284422
|
}
|
|
284280
|
-
var
|
|
284423
|
+
var debugLogger99, TEAMS_DIR;
|
|
284281
284424
|
var init_team_config = __esm({
|
|
284282
284425
|
"packages/core/dist/src/agents/team-config.js"() {
|
|
284283
284426
|
"use strict";
|
|
284284
284427
|
init_esbuild_shims();
|
|
284285
284428
|
init_debugLogger();
|
|
284286
|
-
|
|
284429
|
+
debugLogger99 = createDebugLogger("TEAM_CONFIG");
|
|
284287
284430
|
TEAMS_DIR = ".proto/teams";
|
|
284288
284431
|
__name(getTeamConfigPath, "getTeamConfigPath");
|
|
284289
284432
|
__name(readTeamConfig, "readTeamConfig");
|
|
@@ -284409,7 +284552,7 @@ var init_mailbox_tools = __esm({
|
|
|
284409
284552
|
|
|
284410
284553
|
// packages/core/dist/src/agents/TeamOrchestrator.js
|
|
284411
284554
|
import * as path96 from "node:path";
|
|
284412
|
-
var
|
|
284555
|
+
var debugLogger100, TeamOrchestrator;
|
|
284413
284556
|
var init_TeamOrchestrator = __esm({
|
|
284414
284557
|
"packages/core/dist/src/agents/TeamOrchestrator.js"() {
|
|
284415
284558
|
"use strict";
|
|
@@ -284420,7 +284563,7 @@ var init_TeamOrchestrator = __esm({
|
|
|
284420
284563
|
init_team_config();
|
|
284421
284564
|
init_subagent_manager();
|
|
284422
284565
|
init_mailbox_tools();
|
|
284423
|
-
|
|
284566
|
+
debugLogger100 = createDebugLogger("TEAM_ORCHESTRATOR");
|
|
284424
284567
|
TeamOrchestrator = class _TeamOrchestrator {
|
|
284425
284568
|
static {
|
|
284426
284569
|
__name(this, "TeamOrchestrator");
|
|
@@ -284459,27 +284602,27 @@ var init_TeamOrchestrator = __esm({
|
|
|
284459
284602
|
*/
|
|
284460
284603
|
async start() {
|
|
284461
284604
|
if (this.started) {
|
|
284462
|
-
|
|
284605
|
+
debugLogger100.warn(`Team "${this.teamConfig.name}" is already started.`);
|
|
284463
284606
|
return;
|
|
284464
284607
|
}
|
|
284465
284608
|
this.started = true;
|
|
284466
284609
|
await this.backend.init();
|
|
284467
284610
|
for (const member of this.teamConfig.members) {
|
|
284468
284611
|
this.mailbox.register(member.agentId);
|
|
284469
|
-
|
|
284612
|
+
debugLogger100.debug(`Registered mailbox inbox for: ${member.agentId}`);
|
|
284470
284613
|
}
|
|
284471
284614
|
this.backend.setOnAgentExit((agentId, exitCode) => {
|
|
284472
284615
|
const member = this.teamConfig.members.find((m3) => m3.agentId === agentId);
|
|
284473
284616
|
if (member) {
|
|
284474
284617
|
const status = exitCode === 0 ? "completed" : "failed";
|
|
284475
284618
|
void updateMemberStatus(this.projectDir, this.teamConfig.name, member.name, status);
|
|
284476
|
-
|
|
284619
|
+
debugLogger100.info(`Member "${member.name}" exited \u2014 status: ${status}`);
|
|
284477
284620
|
}
|
|
284478
284621
|
});
|
|
284479
284622
|
for (const member of this.teamConfig.members) {
|
|
284480
284623
|
await this.spawnMember(member);
|
|
284481
284624
|
}
|
|
284482
|
-
|
|
284625
|
+
debugLogger100.info(`Team "${this.teamConfig.name}" started with ${this.teamConfig.members.length} members.`);
|
|
284483
284626
|
}
|
|
284484
284627
|
/**
|
|
284485
284628
|
* Stop all running agents, update config file, and release resources.
|
|
@@ -284500,13 +284643,13 @@ var init_TeamOrchestrator = __esm({
|
|
|
284500
284643
|
}
|
|
284501
284644
|
await writeTeamConfig(this.projectDir, this.teamConfig.name, config2);
|
|
284502
284645
|
}
|
|
284503
|
-
|
|
284646
|
+
debugLogger100.info(`Team "${this.teamConfig.name}" stopped.`);
|
|
284504
284647
|
}
|
|
284505
284648
|
// ─── Private ────────────────────────────────────────────────
|
|
284506
284649
|
async spawnMember(member) {
|
|
284507
284650
|
const subagentConfig = await this.subagentManager.loadSubagent(member.agentType);
|
|
284508
284651
|
if (!subagentConfig) {
|
|
284509
|
-
|
|
284652
|
+
debugLogger100.error(`Unknown agentType "${member.agentType}" for member "${member.name}". Skipping.`);
|
|
284510
284653
|
await updateMemberStatus(this.projectDir, this.teamConfig.name, member.name, "failed");
|
|
284511
284654
|
return;
|
|
284512
284655
|
}
|
|
@@ -284537,9 +284680,9 @@ var init_TeamOrchestrator = __esm({
|
|
|
284537
284680
|
await updateMemberStatus(this.projectDir, this.teamConfig.name, member.name, "running");
|
|
284538
284681
|
try {
|
|
284539
284682
|
await this.backend.spawnAgent(spawnConfig);
|
|
284540
|
-
|
|
284683
|
+
debugLogger100.info(`Spawned member "${member.name}" (${member.agentType}) as ${member.agentId}`);
|
|
284541
284684
|
} catch (error40) {
|
|
284542
|
-
|
|
284685
|
+
debugLogger100.error(`Failed to spawn member "${member.name}":`, error40);
|
|
284543
284686
|
await updateMemberStatus(this.projectDir, this.teamConfig.name, member.name, "failed");
|
|
284544
284687
|
}
|
|
284545
284688
|
}
|
|
@@ -285494,72 +285637,6 @@ var init_followup = __esm({
|
|
|
285494
285637
|
}
|
|
285495
285638
|
});
|
|
285496
285639
|
|
|
285497
|
-
// packages/core/dist/src/recap/recapGenerator.js
|
|
285498
|
-
function pickRecapModel(config2) {
|
|
285499
|
-
const available = config2.getModelsConfig().getAllConfiguredModels();
|
|
285500
|
-
if (available.some((m3) => m3.id === PREFERRED_RECAP_MODEL_ID)) {
|
|
285501
|
-
return { model: PREFERRED_RECAP_MODEL_ID, isOverride: true };
|
|
285502
|
-
}
|
|
285503
|
-
return { model: config2.getModel(), isOverride: false };
|
|
285504
|
-
}
|
|
285505
|
-
async function generateRecap(config2, conversationHistory, abortSignal) {
|
|
285506
|
-
if (conversationHistory.length === 0)
|
|
285507
|
-
return null;
|
|
285508
|
-
try {
|
|
285509
|
-
const recent = conversationHistory.slice(-RECENT_MESSAGE_WINDOW);
|
|
285510
|
-
const contents = [
|
|
285511
|
-
...recent,
|
|
285512
|
-
{ role: "user", parts: [{ text: RECAP_PROMPT }] }
|
|
285513
|
-
];
|
|
285514
|
-
const { model, isOverride } = pickRecapModel(config2);
|
|
285515
|
-
const generator = config2.getContentGenerator();
|
|
285516
|
-
const response = await generator.generateContent({
|
|
285517
|
-
model,
|
|
285518
|
-
contents,
|
|
285519
|
-
config: {
|
|
285520
|
-
abortSignal,
|
|
285521
|
-
thinkingConfig: { includeThoughts: false },
|
|
285522
|
-
// Empty tools array (truthy) bypasses pipeline.ts buildRequest's
|
|
285523
|
-
// tool-stripping path. Without this, assistant turns containing
|
|
285524
|
-
// tool_calls — i.e. most of the agent's actual work — are dropped
|
|
285525
|
-
// before the request leaves, starving the recap of context.
|
|
285526
|
-
tools: [],
|
|
285527
|
-
// Opt into the model override path in the OpenAI pipeline. Pipeline
|
|
285528
|
-
// ignores request.model by default for safety; for recap we know the
|
|
285529
|
-
// alias resolves on the gateway, so honor it.
|
|
285530
|
-
...isOverride ? { allowModelOverride: true } : {}
|
|
285531
|
-
}
|
|
285532
|
-
}, "recap");
|
|
285533
|
-
const text = response.candidates?.[0]?.content?.parts?.map((p2) => p2.text ?? "").join("").trim();
|
|
285534
|
-
if (!text)
|
|
285535
|
-
return null;
|
|
285536
|
-
return text;
|
|
285537
|
-
} catch (error40) {
|
|
285538
|
-
if (abortSignal.aborted)
|
|
285539
|
-
return null;
|
|
285540
|
-
debugLogger100.warn(`[recap] generation failed: ${error40 instanceof Error ? error40.message : String(error40)}`);
|
|
285541
|
-
return null;
|
|
285542
|
-
}
|
|
285543
|
-
}
|
|
285544
|
-
var debugLogger100, RECENT_MESSAGE_WINDOW, PREFERRED_RECAP_MODEL_ID, RECAP_PROMPT;
|
|
285545
|
-
var init_recapGenerator = __esm({
|
|
285546
|
-
"packages/core/dist/src/recap/recapGenerator.js"() {
|
|
285547
|
-
"use strict";
|
|
285548
|
-
init_esbuild_shims();
|
|
285549
|
-
init_debugLogger();
|
|
285550
|
-
debugLogger100 = createDebugLogger("RECAP");
|
|
285551
|
-
RECENT_MESSAGE_WINDOW = 30;
|
|
285552
|
-
PREFERRED_RECAP_MODEL_ID = "protolabs/fast";
|
|
285553
|
-
RECAP_PROMPT = `That last agent turn was long. Summarize where we are so the user can pick back up cold.
|
|
285554
|
-
|
|
285555
|
-
Write exactly 1-3 short sentences. Lead with the high-level goal \u2014 what they're building or debugging, not implementation details. Then state the concrete current status or next step. No status reports, no commit recaps, no apologies.
|
|
285556
|
-
|
|
285557
|
-
Reply with ONLY the recap text \u2014 no headers, no quotes, no preamble.`;
|
|
285558
|
-
__name(pickRecapModel, "pickRecapModel");
|
|
285559
|
-
__name(generateRecap, "generateRecap");
|
|
285560
|
-
}
|
|
285561
|
-
});
|
|
285562
|
-
|
|
285563
285640
|
// packages/core/dist/src/recap/index.js
|
|
285564
285641
|
var init_recap = __esm({
|
|
285565
285642
|
"packages/core/dist/src/recap/index.js"() {
|
|
@@ -288494,6 +288571,7 @@ var init_src2 = __esm({
|
|
|
288494
288571
|
init_fileDiscoveryService();
|
|
288495
288572
|
init_fileReadCache();
|
|
288496
288573
|
init_fileSystemService();
|
|
288574
|
+
init_sessionRecap();
|
|
288497
288575
|
init_gitService();
|
|
288498
288576
|
init_gitWorktreeService();
|
|
288499
288577
|
init_memory_consolidation();
|
|
@@ -289012,6 +289090,7 @@ __export(dist_exports, {
|
|
|
289012
289090
|
formatScopeViolationMessage: () => formatScopeViolationMessage,
|
|
289013
289091
|
generatePromptSuggestion: () => generatePromptSuggestion,
|
|
289014
289092
|
generateRecap: () => generateRecap,
|
|
289093
|
+
generateSessionRecap: () => generateSessionRecap,
|
|
289015
289094
|
generateValidName: () => generateValidName,
|
|
289016
289095
|
getActiveTurnContext: () => getActiveTurnContext,
|
|
289017
289096
|
getActiveTurnSpan: () => getActiveTurnSpan,
|
|
@@ -312382,7 +312461,7 @@ var require_backend = __commonJS({
|
|
|
312382
312461
|
});
|
|
312383
312462
|
return a2._currentValue;
|
|
312384
312463
|
}, "useContext"),
|
|
312385
|
-
useEffect: /* @__PURE__ */ __name(function
|
|
312464
|
+
useEffect: /* @__PURE__ */ __name(function useEffect77(a2) {
|
|
312386
312465
|
C3();
|
|
312387
312466
|
x3.push({
|
|
312388
312467
|
primitive: "Effect",
|
|
@@ -312447,7 +312526,7 @@ var require_backend = __commonJS({
|
|
|
312447
312526
|
return [b2, function() {
|
|
312448
312527
|
}];
|
|
312449
312528
|
}, "useReducer"),
|
|
312450
|
-
useRef: /* @__PURE__ */ __name(function
|
|
312529
|
+
useRef: /* @__PURE__ */ __name(function useRef31(a2) {
|
|
312451
312530
|
var b2 = C3();
|
|
312452
312531
|
a2 = null !== b2 ? b2.memoizedState : {
|
|
312453
312532
|
current: a2
|
|
@@ -319936,7 +320015,7 @@ var require_backend = __commonJS({
|
|
|
319936
320015
|
) : symbolOrNumber;
|
|
319937
320016
|
}
|
|
319938
320017
|
__name(getTypeSymbol, "getTypeSymbol");
|
|
319939
|
-
var _ReactTypeOfWork = ReactTypeOfWork, CacheComponent = _ReactTypeOfWork.CacheComponent, ClassComponent = _ReactTypeOfWork.ClassComponent, IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent, FunctionComponent = _ReactTypeOfWork.FunctionComponent, IndeterminateComponent = _ReactTypeOfWork.IndeterminateComponent, ForwardRef = _ReactTypeOfWork.ForwardRef, HostRoot = _ReactTypeOfWork.HostRoot, HostHoistable = _ReactTypeOfWork.HostHoistable, HostSingleton = _ReactTypeOfWork.HostSingleton, HostComponent = _ReactTypeOfWork.HostComponent, HostPortal = _ReactTypeOfWork.HostPortal, HostText = _ReactTypeOfWork.HostText,
|
|
320018
|
+
var _ReactTypeOfWork = ReactTypeOfWork, CacheComponent = _ReactTypeOfWork.CacheComponent, ClassComponent = _ReactTypeOfWork.ClassComponent, IncompleteClassComponent = _ReactTypeOfWork.IncompleteClassComponent, FunctionComponent = _ReactTypeOfWork.FunctionComponent, IndeterminateComponent = _ReactTypeOfWork.IndeterminateComponent, ForwardRef = _ReactTypeOfWork.ForwardRef, HostRoot = _ReactTypeOfWork.HostRoot, HostHoistable = _ReactTypeOfWork.HostHoistable, HostSingleton = _ReactTypeOfWork.HostSingleton, HostComponent = _ReactTypeOfWork.HostComponent, HostPortal = _ReactTypeOfWork.HostPortal, HostText = _ReactTypeOfWork.HostText, Fragment25 = _ReactTypeOfWork.Fragment, LazyComponent = _ReactTypeOfWork.LazyComponent, LegacyHiddenComponent = _ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = _ReactTypeOfWork.MemoComponent, OffscreenComponent = _ReactTypeOfWork.OffscreenComponent, Profiler = _ReactTypeOfWork.Profiler, ScopeComponent = _ReactTypeOfWork.ScopeComponent, SimpleMemoComponent = _ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = _ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = _ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = _ReactTypeOfWork.TracingMarkerComponent;
|
|
319940
320019
|
function resolveFiberType(type) {
|
|
319941
320020
|
var typeSymbol = getTypeSymbol(type);
|
|
319942
320021
|
switch (typeSymbol) {
|
|
@@ -319982,7 +320061,7 @@ var require_backend = __commonJS({
|
|
|
319982
320061
|
case HostPortal:
|
|
319983
320062
|
case HostText:
|
|
319984
320063
|
return null;
|
|
319985
|
-
case
|
|
320064
|
+
case Fragment25:
|
|
319986
320065
|
return "Fragment";
|
|
319987
320066
|
case LazyComponent:
|
|
319988
320067
|
return "Lazy";
|
|
@@ -320048,7 +320127,7 @@ var require_backend = __commonJS({
|
|
|
320048
320127
|
function attach(hook2, rendererID, renderer2, global2) {
|
|
320049
320128
|
var version2 = renderer2.reconcilerVersion || renderer2.version;
|
|
320050
320129
|
var _getInternalReactCons = getInternalReactConstants(version2), getDisplayNameForFiber = _getInternalReactCons.getDisplayNameForFiber, getTypeSymbol = _getInternalReactCons.getTypeSymbol, ReactPriorityLevels = _getInternalReactCons.ReactPriorityLevels, ReactTypeOfWork = _getInternalReactCons.ReactTypeOfWork, StrictModeBits = _getInternalReactCons.StrictModeBits;
|
|
320051
|
-
var CacheComponent = ReactTypeOfWork.CacheComponent, ClassComponent = ReactTypeOfWork.ClassComponent, ContextConsumer = ReactTypeOfWork.ContextConsumer, DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent, ForwardRef = ReactTypeOfWork.ForwardRef,
|
|
320130
|
+
var CacheComponent = ReactTypeOfWork.CacheComponent, ClassComponent = ReactTypeOfWork.ClassComponent, ContextConsumer = ReactTypeOfWork.ContextConsumer, DehydratedSuspenseComponent = ReactTypeOfWork.DehydratedSuspenseComponent, ForwardRef = ReactTypeOfWork.ForwardRef, Fragment25 = ReactTypeOfWork.Fragment, FunctionComponent = ReactTypeOfWork.FunctionComponent, HostRoot = ReactTypeOfWork.HostRoot, HostHoistable = ReactTypeOfWork.HostHoistable, HostSingleton = ReactTypeOfWork.HostSingleton, HostPortal = ReactTypeOfWork.HostPortal, HostComponent = ReactTypeOfWork.HostComponent, HostText = ReactTypeOfWork.HostText, IncompleteClassComponent = ReactTypeOfWork.IncompleteClassComponent, IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent, LegacyHiddenComponent = ReactTypeOfWork.LegacyHiddenComponent, MemoComponent = ReactTypeOfWork.MemoComponent, OffscreenComponent = ReactTypeOfWork.OffscreenComponent, SimpleMemoComponent = ReactTypeOfWork.SimpleMemoComponent, SuspenseComponent = ReactTypeOfWork.SuspenseComponent, SuspenseListComponent = ReactTypeOfWork.SuspenseListComponent, TracingMarkerComponent = ReactTypeOfWork.TracingMarkerComponent;
|
|
320052
320131
|
var ImmediatePriority = ReactPriorityLevels.ImmediatePriority, UserBlockingPriority = ReactPriorityLevels.UserBlockingPriority, NormalPriority = ReactPriorityLevels.NormalPriority, LowPriority = ReactPriorityLevels.LowPriority, IdlePriority = ReactPriorityLevels.IdlePriority, NoPriority = ReactPriorityLevels.NoPriority;
|
|
320053
320132
|
var getLaneLabelMap = renderer2.getLaneLabelMap, injectProfilingHooks = renderer2.injectProfilingHooks, overrideHookState = renderer2.overrideHookState, overrideHookStateDeletePath = renderer2.overrideHookStateDeletePath, overrideHookStateRenamePath = renderer2.overrideHookStateRenamePath, overrideProps = renderer2.overrideProps, overridePropsDeletePath = renderer2.overridePropsDeletePath, overridePropsRenamePath = renderer2.overridePropsRenamePath, scheduleRefresh = renderer2.scheduleRefresh, setErrorHandler = renderer2.setErrorHandler, setSuspenseHandler = renderer2.setSuspenseHandler, scheduleUpdate = renderer2.scheduleUpdate;
|
|
320054
320133
|
var supportsTogglingError = typeof setErrorHandler === "function" && typeof scheduleUpdate === "function";
|
|
@@ -320263,7 +320342,7 @@ var require_backend = __commonJS({
|
|
|
320263
320342
|
return true;
|
|
320264
320343
|
case HostRoot:
|
|
320265
320344
|
return false;
|
|
320266
|
-
case
|
|
320345
|
+
case Fragment25:
|
|
320267
320346
|
return key === null;
|
|
320268
320347
|
default:
|
|
320269
320348
|
var typeSymbol = getTypeSymbol(type);
|
|
@@ -320338,7 +320417,7 @@ var require_backend = __commonJS({
|
|
|
320338
320417
|
return ElementTypeHostComponent;
|
|
320339
320418
|
case HostPortal:
|
|
320340
320419
|
case HostText:
|
|
320341
|
-
case
|
|
320420
|
+
case Fragment25:
|
|
320342
320421
|
return ElementTypeOtherOrUnknown;
|
|
320343
320422
|
case MemoComponent:
|
|
320344
320423
|
case SimpleMemoComponent:
|
|
@@ -370205,7 +370284,7 @@ var require_request4 = __commonJS({
|
|
|
370205
370284
|
var { URLSerializer } = require_data_url2();
|
|
370206
370285
|
var { kConstruct } = require_symbols6();
|
|
370207
370286
|
var assert4 = __require("node:assert");
|
|
370208
|
-
var { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __require("node:events");
|
|
370287
|
+
var { getMaxListeners, setMaxListeners: setMaxListeners2, getEventListeners, defaultMaxListeners } = __require("node:events");
|
|
370209
370288
|
var kAbortController = Symbol("abortController");
|
|
370210
370289
|
var requestFinalizer = new FinalizationRegistry2(({ signal, abort: abort2 }) => {
|
|
370211
370290
|
signal.removeEventListener("abort", abort2);
|
|
@@ -370443,9 +370522,9 @@ var require_request4 = __commonJS({
|
|
|
370443
370522
|
const abort2 = buildAbort(acRef);
|
|
370444
370523
|
try {
|
|
370445
370524
|
if (typeof getMaxListeners === "function" && getMaxListeners(signal) === defaultMaxListeners) {
|
|
370446
|
-
|
|
370525
|
+
setMaxListeners2(1500, signal);
|
|
370447
370526
|
} else if (getEventListeners(signal, "abort").length >= defaultMaxListeners) {
|
|
370448
|
-
|
|
370527
|
+
setMaxListeners2(1500, signal);
|
|
370449
370528
|
}
|
|
370450
370529
|
} catch {
|
|
370451
370530
|
}
|
|
@@ -380129,7 +380208,7 @@ var require_react_is_development = __commonJS({
|
|
|
380129
380208
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
380130
380209
|
var Element2 = REACT_ELEMENT_TYPE;
|
|
380131
380210
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
380132
|
-
var
|
|
380211
|
+
var Fragment25 = REACT_FRAGMENT_TYPE;
|
|
380133
380212
|
var Lazy = REACT_LAZY_TYPE;
|
|
380134
380213
|
var Memo = REACT_MEMO_TYPE;
|
|
380135
380214
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -380201,7 +380280,7 @@ var require_react_is_development = __commonJS({
|
|
|
380201
380280
|
exports2.ContextProvider = ContextProvider;
|
|
380202
380281
|
exports2.Element = Element2;
|
|
380203
380282
|
exports2.ForwardRef = ForwardRef;
|
|
380204
|
-
exports2.Fragment =
|
|
380283
|
+
exports2.Fragment = Fragment25;
|
|
380205
380284
|
exports2.Lazy = Lazy;
|
|
380206
380285
|
exports2.Memo = Memo;
|
|
380207
380286
|
exports2.Portal = Portal;
|
|
@@ -404713,7 +404792,7 @@ var measureElement = /* @__PURE__ */ __name((node) => ({
|
|
|
404713
404792
|
var measure_element_default = measureElement;
|
|
404714
404793
|
|
|
404715
404794
|
// packages/cli/src/gemini.tsx
|
|
404716
|
-
var
|
|
404795
|
+
var import_react181 = __toESM(require_react(), 1);
|
|
404717
404796
|
import dns2 from "node:dns";
|
|
404718
404797
|
import os50 from "node:os";
|
|
404719
404798
|
import { basename as basename32 } from "node:path";
|
|
@@ -405928,6 +406007,24 @@ var SETTINGS_SCHEMA = {
|
|
|
405928
406007
|
description: "Enable automatic update checks and installations on startup.",
|
|
405929
406008
|
showInDialog: true
|
|
405930
406009
|
},
|
|
406010
|
+
showSessionRecap: {
|
|
406011
|
+
type: "boolean",
|
|
406012
|
+
label: "Auto-recap on return",
|
|
406013
|
+
category: "General",
|
|
406014
|
+
requiresRestart: false,
|
|
406015
|
+
default: false,
|
|
406016
|
+
description: "Automatically generate a one-line session recap when the terminal regains focus after a sustained idle period.",
|
|
406017
|
+
showInDialog: true
|
|
406018
|
+
},
|
|
406019
|
+
sessionRecapAwayThresholdMinutes: {
|
|
406020
|
+
type: "number",
|
|
406021
|
+
label: "Auto-recap idle threshold (minutes)",
|
|
406022
|
+
category: "General",
|
|
406023
|
+
requiresRestart: false,
|
|
406024
|
+
default: 5,
|
|
406025
|
+
description: "How many minutes the terminal must be blurred before an auto-recap fires on the next focus-in. Falsy or non-positive values fall back to the 5-minute default.",
|
|
406026
|
+
showInDialog: true
|
|
406027
|
+
},
|
|
405931
406028
|
gitCoAuthor: {
|
|
405932
406029
|
type: "boolean",
|
|
405933
406030
|
label: "Attribution: commit",
|
|
@@ -406123,6 +406220,15 @@ var SETTINGS_SCHEMA = {
|
|
|
406123
406220
|
description: "Show citations for generated text in the chat.",
|
|
406124
406221
|
showInDialog: false
|
|
406125
406222
|
},
|
|
406223
|
+
shellOutputMaxLines: {
|
|
406224
|
+
type: "number",
|
|
406225
|
+
label: "Shell Output Max Lines",
|
|
406226
|
+
category: "UI",
|
|
406227
|
+
requiresRestart: false,
|
|
406228
|
+
default: 5,
|
|
406229
|
+
description: "Max number of shell output lines shown inline. Set to 0 to disable the cap and show full output. The hidden line count is still surfaced via the `+N lines` indicator.",
|
|
406230
|
+
showInDialog: true
|
|
406231
|
+
},
|
|
406126
406232
|
customWittyPhrases: {
|
|
406127
406233
|
type: "array",
|
|
406128
406234
|
label: "Custom Witty Phrases",
|
|
@@ -417031,7 +417137,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
417031
417137
|
// packages/cli/src/utils/version.ts
|
|
417032
417138
|
async function getCliVersion() {
|
|
417033
417139
|
const pkgJson = await getPackageJson();
|
|
417034
|
-
return "0.
|
|
417140
|
+
return "0.36.0";
|
|
417035
417141
|
}
|
|
417036
417142
|
__name(getCliVersion, "getCliVersion");
|
|
417037
417143
|
|
|
@@ -425042,7 +425148,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
425042
425148
|
|
|
425043
425149
|
// packages/cli/src/generated/git-commit.ts
|
|
425044
425150
|
init_esbuild_shims();
|
|
425045
|
-
var GIT_COMMIT_INFO = "
|
|
425151
|
+
var GIT_COMMIT_INFO = "f2deea171";
|
|
425046
425152
|
|
|
425047
425153
|
// packages/cli/src/utils/systemInfo.ts
|
|
425048
425154
|
async function getNpmVersion() {
|
|
@@ -439423,7 +439529,7 @@ __name(runNonInteractiveStreamJson, "runNonInteractiveStreamJson");
|
|
|
439423
439529
|
|
|
439424
439530
|
// packages/cli/src/ui/AppContainer.tsx
|
|
439425
439531
|
init_esbuild_shims();
|
|
439426
|
-
var
|
|
439532
|
+
var import_react178 = __toESM(require_react(), 1);
|
|
439427
439533
|
|
|
439428
439534
|
// packages/cli/src/ui/App.tsx
|
|
439429
439535
|
init_esbuild_shims();
|
|
@@ -455165,6 +455271,14 @@ var AnsiOutputText = /* @__PURE__ */ __name(({
|
|
|
455165
455271
|
tokenIndex
|
|
455166
455272
|
)) : null }, lineIndex));
|
|
455167
455273
|
}, "AnsiOutputText");
|
|
455274
|
+
var ShellStatsBar = /* @__PURE__ */ __name(({
|
|
455275
|
+
totalLines,
|
|
455276
|
+
displayHeight = DEFAULT_HEIGHT
|
|
455277
|
+
}) => {
|
|
455278
|
+
if (!totalLines || totalLines <= displayHeight) return null;
|
|
455279
|
+
const hidden = totalLines - displayHeight;
|
|
455280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { flexDirection: "row", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text3, { color: theme.text.secondary, children: `+${hidden} lines` }) });
|
|
455281
|
+
}, "ShellStatsBar");
|
|
455168
455282
|
|
|
455169
455283
|
// packages/cli/src/ui/components/GeminiRespondingSpinner.tsx
|
|
455170
455284
|
init_esbuild_shims();
|
|
@@ -462458,6 +462572,7 @@ var STATIC_HEIGHT = 1;
|
|
|
462458
462572
|
var RESERVED_LINE_COUNT = 5;
|
|
462459
462573
|
var STATUS_INDICATOR_WIDTH = 3;
|
|
462460
462574
|
var MIN_LINES_SHOWN = 2;
|
|
462575
|
+
var DEFAULT_SHELL_OUTPUT_MAX_LINES = 5;
|
|
462461
462576
|
var MAXIMUM_RESULT_DISPLAY_CHARACTERS = 1e6;
|
|
462462
462577
|
function sliceTextForMaxHeight(text, maxHeight, maxWidth) {
|
|
462463
462578
|
if (maxHeight === void 0) {
|
|
@@ -462662,6 +462777,12 @@ var ToolMessage = /* @__PURE__ */ __name(({
|
|
|
462662
462777
|
MIN_LINES_SHOWN + 1
|
|
462663
462778
|
// enforce minimum lines shown
|
|
462664
462779
|
) : void 0;
|
|
462780
|
+
const isShellTool = name4 === SHELL_COMMAND_NAME || name4 === SHELL_NAME;
|
|
462781
|
+
const rawShellCap = settings2.merged.ui?.shellOutputMaxLines ?? DEFAULT_SHELL_OUTPUT_MAX_LINES;
|
|
462782
|
+
const shellOutputMaxLines = Math.max(0, Math.floor(rawShellCap || 0));
|
|
462783
|
+
const isCappingShell = isShellTool && shellOutputMaxLines > 0 && !isThisShellFocused;
|
|
462784
|
+
const shellCapHeight = isCappingShell ? Math.min(availableHeight ?? shellOutputMaxLines, shellOutputMaxLines) : availableHeight;
|
|
462785
|
+
const shellStringCapHeight = isCappingShell && shellCapHeight !== void 0 ? shellCapHeight + 1 : availableHeight;
|
|
462665
462786
|
const innerWidth = contentWidth - STATUS_INDICATOR_WIDTH;
|
|
462666
462787
|
if (availableHeight) {
|
|
462667
462788
|
renderOutputAsMarkdown = false;
|
|
@@ -462711,19 +462832,28 @@ var ToolMessage = /* @__PURE__ */ __name(({
|
|
|
462711
462832
|
settings: settings2
|
|
462712
462833
|
}
|
|
462713
462834
|
),
|
|
462714
|
-
displayRenderer.type === "ansi" && /* @__PURE__ */ (0, import_jsx_runtime35.
|
|
462715
|
-
|
|
462716
|
-
|
|
462717
|
-
|
|
462718
|
-
|
|
462719
|
-
|
|
462720
|
-
|
|
462835
|
+
displayRenderer.type === "ansi" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
462836
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
462837
|
+
AnsiOutputText,
|
|
462838
|
+
{
|
|
462839
|
+
data: displayRenderer.data,
|
|
462840
|
+
availableTerminalHeight: shellCapHeight
|
|
462841
|
+
}
|
|
462842
|
+
),
|
|
462843
|
+
isCappingShell && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
462844
|
+
ShellStatsBar,
|
|
462845
|
+
{
|
|
462846
|
+
totalLines: displayRenderer.data.length,
|
|
462847
|
+
displayHeight: shellCapHeight
|
|
462848
|
+
}
|
|
462849
|
+
)
|
|
462850
|
+
] }),
|
|
462721
462851
|
displayRenderer.type === "string" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
462722
462852
|
StringResultRenderer,
|
|
462723
462853
|
{
|
|
462724
462854
|
data: displayRenderer.data,
|
|
462725
462855
|
renderAsMarkdown: renderOutputAsMarkdown,
|
|
462726
|
-
availableHeight,
|
|
462856
|
+
availableHeight: shellStringCapHeight,
|
|
462727
462857
|
childWidth: innerWidth
|
|
462728
462858
|
}
|
|
462729
462859
|
)
|
|
@@ -480076,14 +480206,14 @@ function useResumeCommand(options2) {
|
|
|
480076
480206
|
const handleResume = (0, import_react145.useCallback)(
|
|
480077
480207
|
async (sessionId) => {
|
|
480078
480208
|
if (!config2 || !historyManager || !startNewSession) {
|
|
480079
|
-
return;
|
|
480209
|
+
return false;
|
|
480080
480210
|
}
|
|
480081
480211
|
closeResumeDialog();
|
|
480082
480212
|
const cwd6 = config2.getTargetDir();
|
|
480083
480213
|
const sessionService = new SessionService(cwd6);
|
|
480084
480214
|
const sessionData = await sessionService.loadSession(sessionId);
|
|
480085
480215
|
if (!sessionData) {
|
|
480086
|
-
return;
|
|
480216
|
+
return false;
|
|
480087
480217
|
}
|
|
480088
480218
|
startNewSession(sessionId);
|
|
480089
480219
|
const uiHistoryItems = buildResumedHistoryItems(sessionData, config2);
|
|
@@ -480101,6 +480231,7 @@ function useResumeCommand(options2) {
|
|
|
480101
480231
|
config2.getDebugLogger().warn(`SessionStart hook failed: ${err2}`);
|
|
480102
480232
|
}
|
|
480103
480233
|
remount?.();
|
|
480234
|
+
return true;
|
|
480104
480235
|
},
|
|
480105
480236
|
[closeResumeDialog, config2, historyManager, startNewSession, remount]
|
|
480106
480237
|
);
|
|
@@ -484143,16 +484274,119 @@ function useVim(buffer, onSubmit) {
|
|
|
484143
484274
|
}
|
|
484144
484275
|
__name(useVim, "useVim");
|
|
484145
484276
|
|
|
484146
|
-
// packages/cli/src/ui/hooks/
|
|
484277
|
+
// packages/cli/src/ui/hooks/useAwaySummary.ts
|
|
484147
484278
|
init_esbuild_shims();
|
|
484148
484279
|
var import_react153 = __toESM(require_react(), 1);
|
|
484280
|
+
init_dist4();
|
|
484281
|
+
var DEFAULT_AWAY_THRESHOLD_MINUTES = 5;
|
|
484282
|
+
var MIN_USER_MESSAGES_TO_FIRE = 3;
|
|
484283
|
+
var MIN_USER_MESSAGES_SINCE_LAST_RECAP = 2;
|
|
484284
|
+
function shouldFireRecap(history) {
|
|
484285
|
+
let userMessageCount = 0;
|
|
484286
|
+
let lastRecapIndex = -1;
|
|
484287
|
+
for (let i4 = 0; i4 < history.length; i4++) {
|
|
484288
|
+
const item = history[i4];
|
|
484289
|
+
if (item.type === "user") userMessageCount++;
|
|
484290
|
+
if (item.type === "recap") lastRecapIndex = i4;
|
|
484291
|
+
}
|
|
484292
|
+
if (userMessageCount < MIN_USER_MESSAGES_TO_FIRE) return false;
|
|
484293
|
+
if (lastRecapIndex === -1) return true;
|
|
484294
|
+
let userSinceLast = 0;
|
|
484295
|
+
for (let i4 = lastRecapIndex + 1; i4 < history.length; i4++) {
|
|
484296
|
+
if (history[i4].type === "user") userSinceLast++;
|
|
484297
|
+
}
|
|
484298
|
+
return userSinceLast >= MIN_USER_MESSAGES_SINCE_LAST_RECAP;
|
|
484299
|
+
}
|
|
484300
|
+
__name(shouldFireRecap, "shouldFireRecap");
|
|
484301
|
+
function useAwaySummary(options2) {
|
|
484302
|
+
const {
|
|
484303
|
+
enabled,
|
|
484304
|
+
config: config2,
|
|
484305
|
+
isFocused,
|
|
484306
|
+
isIdle,
|
|
484307
|
+
addItem,
|
|
484308
|
+
history,
|
|
484309
|
+
awayThresholdMinutes
|
|
484310
|
+
} = options2;
|
|
484311
|
+
const blurredAtRef = (0, import_react153.useRef)(null);
|
|
484312
|
+
const recapPendingRef = (0, import_react153.useRef)(false);
|
|
484313
|
+
const inFlightRef = (0, import_react153.useRef)(null);
|
|
484314
|
+
const isIdleRef = (0, import_react153.useRef)(isIdle);
|
|
484315
|
+
isIdleRef.current = isIdle;
|
|
484316
|
+
const historyRef = (0, import_react153.useRef)(history);
|
|
484317
|
+
historyRef.current = history;
|
|
484318
|
+
const thresholdMs = (awayThresholdMinutes && awayThresholdMinutes > 0 ? awayThresholdMinutes : DEFAULT_AWAY_THRESHOLD_MINUTES) * 60 * 1e3;
|
|
484319
|
+
(0, import_react153.useEffect)(() => {
|
|
484320
|
+
if (!enabled || !config2) {
|
|
484321
|
+
inFlightRef.current?.abort();
|
|
484322
|
+
inFlightRef.current = null;
|
|
484323
|
+
blurredAtRef.current = null;
|
|
484324
|
+
return;
|
|
484325
|
+
}
|
|
484326
|
+
if (!isFocused) {
|
|
484327
|
+
if (blurredAtRef.current === null) {
|
|
484328
|
+
blurredAtRef.current = Date.now();
|
|
484329
|
+
}
|
|
484330
|
+
return;
|
|
484331
|
+
}
|
|
484332
|
+
const blurredAt = blurredAtRef.current;
|
|
484333
|
+
if (blurredAt === null) return;
|
|
484334
|
+
if (Date.now() - blurredAt < thresholdMs) {
|
|
484335
|
+
blurredAtRef.current = null;
|
|
484336
|
+
return;
|
|
484337
|
+
}
|
|
484338
|
+
if (recapPendingRef.current) return;
|
|
484339
|
+
if (!isIdleRef.current) return;
|
|
484340
|
+
if (!shouldFireRecap(historyRef.current)) {
|
|
484341
|
+
blurredAtRef.current = null;
|
|
484342
|
+
return;
|
|
484343
|
+
}
|
|
484344
|
+
blurredAtRef.current = null;
|
|
484345
|
+
recapPendingRef.current = true;
|
|
484346
|
+
const controller = new AbortController();
|
|
484347
|
+
inFlightRef.current = controller;
|
|
484348
|
+
void generateSessionRecap(config2, controller.signal).then((recap) => {
|
|
484349
|
+
if (controller.signal.aborted || !recap) return;
|
|
484350
|
+
if (!isIdleRef.current) return;
|
|
484351
|
+
const item = {
|
|
484352
|
+
type: "recap" /* RECAP */,
|
|
484353
|
+
text: recap.text
|
|
484354
|
+
};
|
|
484355
|
+
addItem(item, Date.now());
|
|
484356
|
+
try {
|
|
484357
|
+
config2.getChatRecordingService?.()?.recordSlashCommand({
|
|
484358
|
+
phase: "result",
|
|
484359
|
+
rawCommand: "/recap",
|
|
484360
|
+
outputHistoryItems: [{ ...item }]
|
|
484361
|
+
});
|
|
484362
|
+
} catch {
|
|
484363
|
+
}
|
|
484364
|
+
}).finally(() => {
|
|
484365
|
+
if (inFlightRef.current === controller) {
|
|
484366
|
+
inFlightRef.current = null;
|
|
484367
|
+
}
|
|
484368
|
+
recapPendingRef.current = false;
|
|
484369
|
+
});
|
|
484370
|
+
}, [enabled, config2, isFocused, isIdle, addItem, thresholdMs]);
|
|
484371
|
+
(0, import_react153.useEffect)(
|
|
484372
|
+
() => () => {
|
|
484373
|
+
inFlightRef.current?.abort();
|
|
484374
|
+
},
|
|
484375
|
+
[]
|
|
484376
|
+
);
|
|
484377
|
+
}
|
|
484378
|
+
__name(useAwaySummary, "useAwaySummary");
|
|
484379
|
+
|
|
484380
|
+
// packages/cli/src/ui/hooks/useBracketedPaste.ts
|
|
484381
|
+
init_esbuild_shims();
|
|
484382
|
+
var import_react154 = __toESM(require_react(), 1);
|
|
484149
484383
|
var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
|
|
484150
484384
|
var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|
|
484151
484385
|
var useBracketedPaste = /* @__PURE__ */ __name(() => {
|
|
484152
484386
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
484153
484387
|
process.stdout.write(DISABLE_BRACKETED_PASTE);
|
|
484154
484388
|
}, "cleanup");
|
|
484155
|
-
(0,
|
|
484389
|
+
(0, import_react154.useEffect)(() => {
|
|
484156
484390
|
process.stdout.write(`\x1B[?2026h${ENABLE_BRACKETED_PASTE}\x1B[?2026l`);
|
|
484157
484391
|
process.on("exit", cleanup);
|
|
484158
484392
|
process.on("SIGINT", cleanup);
|
|
@@ -484168,7 +484402,7 @@ var useBracketedPaste = /* @__PURE__ */ __name(() => {
|
|
|
484168
484402
|
|
|
484169
484403
|
// packages/cli/src/ui/hooks/useKeyboardHandling.ts
|
|
484170
484404
|
init_esbuild_shims();
|
|
484171
|
-
var
|
|
484405
|
+
var import_react155 = __toESM(require_react(), 1);
|
|
484172
484406
|
init_dist4();
|
|
484173
484407
|
var CTRL_EXIT_PROMPT_DURATION_MS = 1e3;
|
|
484174
484408
|
function useKeyboardHandling(params) {
|
|
@@ -484191,20 +484425,20 @@ function useKeyboardHandling(params) {
|
|
|
484191
484425
|
debugKeystrokeLogging,
|
|
484192
484426
|
onBackgroundSession
|
|
484193
484427
|
} = params;
|
|
484194
|
-
const [showToolDescriptions, setShowToolDescriptions] = (0,
|
|
484195
|
-
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0,
|
|
484196
|
-
const ctrlCTimerRef = (0,
|
|
484197
|
-
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0,
|
|
484198
|
-
const ctrlDTimerRef = (0,
|
|
484199
|
-
const [escapePressedOnce, setEscapePressedOnce] = (0,
|
|
484200
|
-
const escapeTimerRef = (0,
|
|
484201
|
-
const dialogsVisibleRef = (0,
|
|
484202
|
-
const [constrainHeight, setConstrainHeight] = (0,
|
|
484203
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
484204
|
-
const handleEscapePromptChange = (0,
|
|
484428
|
+
const [showToolDescriptions, setShowToolDescriptions] = (0, import_react155.useState)(false);
|
|
484429
|
+
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react155.useState)(false);
|
|
484430
|
+
const ctrlCTimerRef = (0, import_react155.useRef)(null);
|
|
484431
|
+
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react155.useState)(false);
|
|
484432
|
+
const ctrlDTimerRef = (0, import_react155.useRef)(null);
|
|
484433
|
+
const [escapePressedOnce, setEscapePressedOnce] = (0, import_react155.useState)(false);
|
|
484434
|
+
const escapeTimerRef = (0, import_react155.useRef)(null);
|
|
484435
|
+
const dialogsVisibleRef = (0, import_react155.useRef)(false);
|
|
484436
|
+
const [constrainHeight, setConstrainHeight] = (0, import_react155.useState)(true);
|
|
484437
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react155.useState)(false);
|
|
484438
|
+
const handleEscapePromptChange = (0, import_react155.useCallback)((showPrompt) => {
|
|
484205
484439
|
setShowEscapePrompt(showPrompt);
|
|
484206
484440
|
}, []);
|
|
484207
|
-
const globalKeypressHandlerRef = (0,
|
|
484441
|
+
const globalKeypressHandlerRef = (0, import_react155.useRef)(() => {
|
|
484208
484442
|
});
|
|
484209
484443
|
globalKeypressHandlerRef.current = (key) => {
|
|
484210
484444
|
if (debugKeystrokeLogging) {
|
|
@@ -484314,7 +484548,7 @@ function useKeyboardHandling(params) {
|
|
|
484314
484548
|
return;
|
|
484315
484549
|
}
|
|
484316
484550
|
};
|
|
484317
|
-
const handleGlobalKeypress = (0,
|
|
484551
|
+
const handleGlobalKeypress = (0, import_react155.useCallback)(
|
|
484318
484552
|
(key) => globalKeypressHandlerRef.current(key),
|
|
484319
484553
|
[]
|
|
484320
484554
|
);
|
|
@@ -484339,22 +484573,22 @@ init_esbuild_shims();
|
|
|
484339
484573
|
|
|
484340
484574
|
// packages/cli/src/ui/hooks/usePhraseCycler.ts
|
|
484341
484575
|
init_esbuild_shims();
|
|
484342
|
-
var
|
|
484576
|
+
var import_react156 = __toESM(require_react(), 1);
|
|
484343
484577
|
var WITTY_LOADING_PHRASES = ["I'm Feeling Lucky"];
|
|
484344
484578
|
var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
484345
484579
|
var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
|
|
484346
|
-
const loadingPhrases = (0,
|
|
484580
|
+
const loadingPhrases = (0, import_react156.useMemo)(() => {
|
|
484347
484581
|
if (customPhrases && customPhrases.length > 0) {
|
|
484348
484582
|
return customPhrases;
|
|
484349
484583
|
}
|
|
484350
484584
|
const translatedPhrases = ta("WITTY_LOADING_PHRASES");
|
|
484351
484585
|
return translatedPhrases.length > 0 ? translatedPhrases : WITTY_LOADING_PHRASES;
|
|
484352
484586
|
}, [customPhrases]);
|
|
484353
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0,
|
|
484587
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react156.useState)(
|
|
484354
484588
|
loadingPhrases[0]
|
|
484355
484589
|
);
|
|
484356
|
-
const phraseIntervalRef = (0,
|
|
484357
|
-
(0,
|
|
484590
|
+
const phraseIntervalRef = (0, import_react156.useRef)(null);
|
|
484591
|
+
(0, import_react156.useEffect)(() => {
|
|
484358
484592
|
if (isWaiting) {
|
|
484359
484593
|
setCurrentLoadingPhrase(t4("Waiting for user confirmation..."));
|
|
484360
484594
|
if (phraseIntervalRef.current) {
|
|
@@ -484391,9 +484625,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
|
|
|
484391
484625
|
}, "usePhraseCycler");
|
|
484392
484626
|
|
|
484393
484627
|
// packages/cli/src/ui/hooks/useLoadingIndicator.ts
|
|
484394
|
-
var
|
|
484628
|
+
var import_react157 = __toESM(require_react(), 1);
|
|
484395
484629
|
var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases, currentCandidatesTokens) => {
|
|
484396
|
-
const [timerResetKey, setTimerResetKey] = (0,
|
|
484630
|
+
const [timerResetKey, setTimerResetKey] = (0, import_react157.useState)(0);
|
|
484397
484631
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
484398
484632
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
484399
484633
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -484403,10 +484637,10 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
484403
484637
|
isWaiting,
|
|
484404
484638
|
customWittyPhrases
|
|
484405
484639
|
);
|
|
484406
|
-
const [retainedElapsedTime, setRetainedElapsedTime] = (0,
|
|
484407
|
-
const [taskStartTokens, setTaskStartTokens] = (0,
|
|
484408
|
-
const prevStreamingStateRef = (0,
|
|
484409
|
-
(0,
|
|
484640
|
+
const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react157.useState)(0);
|
|
484641
|
+
const [taskStartTokens, setTaskStartTokens] = (0, import_react157.useState)(0);
|
|
484642
|
+
const prevStreamingStateRef = (0, import_react157.useRef)(null);
|
|
484643
|
+
(0, import_react157.useEffect)(() => {
|
|
484410
484644
|
if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
|
|
484411
484645
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
484412
484646
|
setRetainedElapsedTime(0);
|
|
@@ -484431,20 +484665,20 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
484431
484665
|
|
|
484432
484666
|
// packages/cli/src/ui/hooks/useFolderTrust.ts
|
|
484433
484667
|
init_esbuild_shims();
|
|
484434
|
-
var
|
|
484668
|
+
var import_react158 = __toESM(require_react(), 1);
|
|
484435
484669
|
import * as process38 from "node:process";
|
|
484436
484670
|
var useFolderTrust = /* @__PURE__ */ __name((settings2, onTrustChange) => {
|
|
484437
|
-
const [isTrusted, setIsTrusted] = (0,
|
|
484438
|
-
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0,
|
|
484439
|
-
const [isRestarting, setIsRestarting] = (0,
|
|
484671
|
+
const [isTrusted, setIsTrusted] = (0, import_react158.useState)(void 0);
|
|
484672
|
+
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react158.useState)(false);
|
|
484673
|
+
const [isRestarting, setIsRestarting] = (0, import_react158.useState)(false);
|
|
484440
484674
|
const folderTrust = settings2.merged.security?.folderTrust?.enabled;
|
|
484441
|
-
(0,
|
|
484675
|
+
(0, import_react158.useEffect)(() => {
|
|
484442
484676
|
const { isTrusted: trusted } = isWorkspaceTrusted(settings2.merged);
|
|
484443
484677
|
setIsTrusted(trusted);
|
|
484444
484678
|
setIsFolderTrustDialogOpen(trusted === void 0);
|
|
484445
484679
|
onTrustChange(trusted);
|
|
484446
484680
|
}, [folderTrust, onTrustChange, settings2.merged]);
|
|
484447
|
-
const handleFolderTrustSelect = (0,
|
|
484681
|
+
const handleFolderTrustSelect = (0, import_react158.useCallback)(
|
|
484448
484682
|
(choice2) => {
|
|
484449
484683
|
const trustedFolders = loadTrustedFolders();
|
|
484450
484684
|
const cwd6 = process38.cwd();
|
|
@@ -484487,7 +484721,7 @@ var useFolderTrust = /* @__PURE__ */ __name((settings2, onTrustChange) => {
|
|
|
484487
484721
|
|
|
484488
484722
|
// packages/cli/src/ui/hooks/useCommandMigration.ts
|
|
484489
484723
|
init_esbuild_shims();
|
|
484490
|
-
var
|
|
484724
|
+
var import_react159 = __toESM(require_react(), 1);
|
|
484491
484725
|
init_dist4();
|
|
484492
484726
|
|
|
484493
484727
|
// packages/cli/src/services/command-migration-tool.ts
|
|
@@ -484561,9 +484795,9 @@ __name(migrateTomlCommands, "migrateTomlCommands");
|
|
|
484561
484795
|
|
|
484562
484796
|
// packages/cli/src/ui/hooks/useCommandMigration.ts
|
|
484563
484797
|
function useCommandMigration(settings2, storage) {
|
|
484564
|
-
const [showMigrationNudge, setShowMigrationNudge] = (0,
|
|
484565
|
-
const [tomlFiles, setTomlFiles] = (0,
|
|
484566
|
-
(0,
|
|
484798
|
+
const [showMigrationNudge, setShowMigrationNudge] = (0, import_react159.useState)(false);
|
|
484799
|
+
const [tomlFiles, setTomlFiles] = (0, import_react159.useState)([]);
|
|
484800
|
+
(0, import_react159.useEffect)(() => {
|
|
484567
484801
|
const checkTomlCommands = /* @__PURE__ */ __name(async () => {
|
|
484568
484802
|
const allFiles = [];
|
|
484569
484803
|
const workspaceCommandsDir = storage.getProjectCommandsDir();
|
|
@@ -484589,9 +484823,9 @@ __name(useCommandMigration, "useCommandMigration");
|
|
|
484589
484823
|
|
|
484590
484824
|
// packages/cli/src/ui/hooks/useIdleMessageDrain.ts
|
|
484591
484825
|
init_esbuild_shims();
|
|
484592
|
-
var
|
|
484826
|
+
var import_react160 = __toESM(require_react(), 1);
|
|
484593
484827
|
function useIdleMessageDrain(isConfigInitialized, streamingState, messageQueue, drain, submitQuery) {
|
|
484594
|
-
(0,
|
|
484828
|
+
(0, import_react160.useEffect)(() => {
|
|
484595
484829
|
if (isConfigInitialized && streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
484596
484830
|
const combined = messageQueue.join("\n\n");
|
|
484597
484831
|
drain();
|
|
@@ -484603,7 +484837,7 @@ __name(useIdleMessageDrain, "useIdleMessageDrain");
|
|
|
484603
484837
|
|
|
484604
484838
|
// packages/cli/src/ui/hooks/useWindowTitle.ts
|
|
484605
484839
|
init_esbuild_shims();
|
|
484606
|
-
var
|
|
484840
|
+
var import_react161 = __toESM(require_react(), 1);
|
|
484607
484841
|
import { basename as basename31 } from "node:path";
|
|
484608
484842
|
|
|
484609
484843
|
// packages/cli/src/utils/windowTitle.ts
|
|
@@ -484620,9 +484854,9 @@ __name(computeWindowTitle, "computeWindowTitle");
|
|
|
484620
484854
|
|
|
484621
484855
|
// packages/cli/src/ui/hooks/useWindowTitle.ts
|
|
484622
484856
|
function useWindowTitle(streamingState, thought, settings2, stdout3, targetDir) {
|
|
484623
|
-
const originalTitleRef = (0,
|
|
484624
|
-
const lastTitleRef = (0,
|
|
484625
|
-
(0,
|
|
484857
|
+
const originalTitleRef = (0, import_react161.useRef)(computeWindowTitle(basename31(targetDir)));
|
|
484858
|
+
const lastTitleRef = (0, import_react161.useRef)(null);
|
|
484859
|
+
(0, import_react161.useEffect)(() => {
|
|
484626
484860
|
if (!settings2.merged.ui?.showStatusInTitle || settings2.merged.ui?.hideWindowTitle)
|
|
484627
484861
|
return;
|
|
484628
484862
|
let title;
|
|
@@ -484649,11 +484883,11 @@ __name(useWindowTitle, "useWindowTitle");
|
|
|
484649
484883
|
|
|
484650
484884
|
// packages/cli/src/ui/hooks/useInitializationEffects.ts
|
|
484651
484885
|
init_esbuild_shims();
|
|
484652
|
-
var
|
|
484886
|
+
var import_react162 = __toESM(require_react(), 1);
|
|
484653
484887
|
init_dist4();
|
|
484654
484888
|
var debugLogger157 = createDebugLogger("APP_CONTAINER");
|
|
484655
484889
|
function useInitializationEffects(config2, historyManager, setConfigInitialized) {
|
|
484656
|
-
(0,
|
|
484890
|
+
(0, import_react162.useEffect)(() => {
|
|
484657
484891
|
(async () => {
|
|
484658
484892
|
await config2.initialize();
|
|
484659
484893
|
setConfigInitialized(true);
|
|
@@ -484721,7 +484955,7 @@ __name(useInitializationEffects, "useInitializationEffects");
|
|
|
484721
484955
|
|
|
484722
484956
|
// packages/cli/src/ui/hooks/usePromptSuggestions.ts
|
|
484723
484957
|
init_esbuild_shims();
|
|
484724
|
-
var
|
|
484958
|
+
var import_react163 = __toESM(require_react(), 1);
|
|
484725
484959
|
init_dist4();
|
|
484726
484960
|
function usePromptSuggestions(params) {
|
|
484727
484961
|
const {
|
|
@@ -484737,17 +484971,17 @@ function usePromptSuggestions(params) {
|
|
|
484737
484971
|
settingInputRequests,
|
|
484738
484972
|
pendingGeminiHistoryItems
|
|
484739
484973
|
} = params;
|
|
484740
|
-
const [promptSuggestion, setPromptSuggestion] = (0,
|
|
484741
|
-
const prevStreamingStateRef = (0,
|
|
484742
|
-
const speculationRef = (0,
|
|
484743
|
-
const suggestionAbortRef = (0,
|
|
484744
|
-
const dismissPromptSuggestion = (0,
|
|
484974
|
+
const [promptSuggestion, setPromptSuggestion] = (0, import_react163.useState)(null);
|
|
484975
|
+
const prevStreamingStateRef = (0, import_react163.useRef)("idle" /* Idle */);
|
|
484976
|
+
const speculationRef = (0, import_react163.useRef)(IDLE_SPECULATION);
|
|
484977
|
+
const suggestionAbortRef = (0, import_react163.useRef)(null);
|
|
484978
|
+
const dismissPromptSuggestion = (0, import_react163.useCallback)(() => {
|
|
484745
484979
|
setPromptSuggestion(null);
|
|
484746
484980
|
suggestionAbortRef.current?.abort();
|
|
484747
484981
|
suggestionAbortRef.current = null;
|
|
484748
484982
|
}, []);
|
|
484749
484983
|
const followupSuggestionsEnabled = settings2.merged.ui?.enableFollowupSuggestions !== false;
|
|
484750
|
-
(0,
|
|
484984
|
+
(0, import_react163.useEffect)(() => {
|
|
484751
484985
|
if (!followupSuggestionsEnabled) {
|
|
484752
484986
|
suggestionAbortRef.current?.abort();
|
|
484753
484987
|
setPromptSuggestion(null);
|
|
@@ -484820,7 +485054,7 @@ function usePromptSuggestions(params) {
|
|
|
484820
485054
|
isPermissionsDialogOpen,
|
|
484821
485055
|
settingInputRequests
|
|
484822
485056
|
]);
|
|
484823
|
-
(0,
|
|
485057
|
+
(0, import_react163.useEffect)(() => {
|
|
484824
485058
|
if (!promptSuggestion && speculationRef.current.status !== "idle") {
|
|
484825
485059
|
abortSpeculation(speculationRef.current).catch(() => {
|
|
484826
485060
|
});
|
|
@@ -484838,7 +485072,7 @@ __name(usePromptSuggestions, "usePromptSuggestions");
|
|
|
484838
485072
|
|
|
484839
485073
|
// packages/cli/src/ui/hooks/useExitHandling.ts
|
|
484840
485074
|
init_esbuild_shims();
|
|
484841
|
-
var
|
|
485075
|
+
var import_react164 = __toESM(require_react(), 1);
|
|
484842
485076
|
function useExitHandling(params) {
|
|
484843
485077
|
const {
|
|
484844
485078
|
isAuthDialogOpen,
|
|
@@ -484848,7 +485082,7 @@ function useExitHandling(params) {
|
|
|
484848
485082
|
cancelOngoingRequest,
|
|
484849
485083
|
buffer
|
|
484850
485084
|
} = params;
|
|
484851
|
-
const handleExit = (0,
|
|
485085
|
+
const handleExit = (0, import_react164.useCallback)(
|
|
484852
485086
|
(pressedOnce, setPressedOnce, timerRef) => {
|
|
484853
485087
|
if (pressedOnce) {
|
|
484854
485088
|
if (timerRef.current) {
|
|
@@ -487991,7 +488225,7 @@ __name(setUpdateHandler, "setUpdateHandler");
|
|
|
487991
488225
|
|
|
487992
488226
|
// packages/cli/src/ui/hooks/useMessageQueue.ts
|
|
487993
488227
|
init_esbuild_shims();
|
|
487994
|
-
var
|
|
488228
|
+
var import_react165 = __toESM(require_react(), 1);
|
|
487995
488229
|
var MessageQueueStore = class {
|
|
487996
488230
|
static {
|
|
487997
488231
|
__name(this, "MessageQueueStore");
|
|
@@ -488045,15 +488279,15 @@ var MessageQueueStore = class {
|
|
|
488045
488279
|
}
|
|
488046
488280
|
};
|
|
488047
488281
|
function useMessageQueue() {
|
|
488048
|
-
const store = (0,
|
|
488049
|
-
const messageQueue = (0,
|
|
488050
|
-
const addMessage = (0,
|
|
488282
|
+
const store = (0, import_react165.useMemo)(() => new MessageQueueStore(), []);
|
|
488283
|
+
const messageQueue = (0, import_react165.useSyncExternalStore)(store.subscribe, store.getSnapshot);
|
|
488284
|
+
const addMessage = (0, import_react165.useCallback)(
|
|
488051
488285
|
(message) => store.addMessage(message),
|
|
488052
488286
|
[store]
|
|
488053
488287
|
);
|
|
488054
|
-
const clearQueue = (0,
|
|
488055
|
-
const popLast = (0,
|
|
488056
|
-
const drain = (0,
|
|
488288
|
+
const clearQueue = (0, import_react165.useCallback)(() => store.clearQueue(), [store]);
|
|
488289
|
+
const popLast = (0, import_react165.useCallback)(() => store.popLast(), [store]);
|
|
488290
|
+
const drain = (0, import_react165.useCallback)(() => store.drain(), [store]);
|
|
488057
488291
|
return { messageQueue, addMessage, clearQueue, popLast, drain };
|
|
488058
488292
|
}
|
|
488059
488293
|
__name(useMessageQueue, "useMessageQueue");
|
|
@@ -488061,7 +488295,7 @@ __name(useMessageQueue, "useMessageQueue");
|
|
|
488061
488295
|
// packages/cli/src/ui/hooks/useAutoAcceptIndicator.ts
|
|
488062
488296
|
init_esbuild_shims();
|
|
488063
488297
|
init_dist4();
|
|
488064
|
-
var
|
|
488298
|
+
var import_react166 = __toESM(require_react(), 1);
|
|
488065
488299
|
function useAutoAcceptIndicator({
|
|
488066
488300
|
config: config2,
|
|
488067
488301
|
addItem,
|
|
@@ -488070,8 +488304,8 @@ function useAutoAcceptIndicator({
|
|
|
488070
488304
|
disabled
|
|
488071
488305
|
}) {
|
|
488072
488306
|
const currentConfigValue = config2.getApprovalMode();
|
|
488073
|
-
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0,
|
|
488074
|
-
(0,
|
|
488307
|
+
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react166.useState)(currentConfigValue);
|
|
488308
|
+
(0, import_react166.useEffect)(() => {
|
|
488075
488309
|
setShowAutoAcceptIndicator(currentConfigValue);
|
|
488076
488310
|
}, [currentConfigValue]);
|
|
488077
488311
|
useKeypress(
|
|
@@ -488109,7 +488343,7 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
|
|
|
488109
488343
|
|
|
488110
488344
|
// packages/cli/src/ui/hooks/useExtensionUpdates.ts
|
|
488111
488345
|
init_esbuild_shims();
|
|
488112
|
-
var
|
|
488346
|
+
var import_react167 = __toESM(require_react(), 1);
|
|
488113
488347
|
function confirmationRequestsReducer(state, action) {
|
|
488114
488348
|
switch (action.type) {
|
|
488115
488349
|
case "add":
|
|
@@ -488126,8 +488360,8 @@ var useConfirmUpdateRequests = /* @__PURE__ */ __name(() => {
|
|
|
488126
488360
|
const [
|
|
488127
488361
|
confirmUpdateExtensionRequests,
|
|
488128
488362
|
dispatchConfirmUpdateExtensionRequests
|
|
488129
|
-
] = (0,
|
|
488130
|
-
const addConfirmUpdateExtensionRequest = (0,
|
|
488363
|
+
] = (0, import_react167.useReducer)(confirmationRequestsReducer, []);
|
|
488364
|
+
const addConfirmUpdateExtensionRequest = (0, import_react167.useCallback)(
|
|
488131
488365
|
(original) => {
|
|
488132
488366
|
const wrappedRequest = {
|
|
488133
488367
|
prompt: original.prompt,
|
|
@@ -488165,11 +488399,11 @@ function settingInputRequestsReducer(state, action) {
|
|
|
488165
488399
|
}
|
|
488166
488400
|
__name(settingInputRequestsReducer, "settingInputRequestsReducer");
|
|
488167
488401
|
var useSettingInputRequests = /* @__PURE__ */ __name(() => {
|
|
488168
|
-
const [settingInputRequests, dispatchSettingInputRequests] = (0,
|
|
488402
|
+
const [settingInputRequests, dispatchSettingInputRequests] = (0, import_react167.useReducer)(
|
|
488169
488403
|
settingInputRequestsReducer,
|
|
488170
488404
|
[]
|
|
488171
488405
|
);
|
|
488172
|
-
const addSettingInputRequest = (0,
|
|
488406
|
+
const addSettingInputRequest = (0, import_react167.useCallback)(
|
|
488173
488407
|
(original) => {
|
|
488174
488408
|
const wrappedRequest = {
|
|
488175
488409
|
settingName: original.settingName,
|
|
@@ -488216,11 +488450,11 @@ function pluginChoiceRequestsReducer(state, action) {
|
|
|
488216
488450
|
}
|
|
488217
488451
|
__name(pluginChoiceRequestsReducer, "pluginChoiceRequestsReducer");
|
|
488218
488452
|
var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
|
|
488219
|
-
const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0,
|
|
488453
|
+
const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0, import_react167.useReducer)(
|
|
488220
488454
|
pluginChoiceRequestsReducer,
|
|
488221
488455
|
[]
|
|
488222
488456
|
);
|
|
488223
|
-
const addPluginChoiceRequest = (0,
|
|
488457
|
+
const addPluginChoiceRequest = (0, import_react167.useCallback)(
|
|
488224
488458
|
(original) => {
|
|
488225
488459
|
const wrappedRequest = {
|
|
488226
488460
|
marketplaceName: original.marketplaceName,
|
|
@@ -488254,12 +488488,12 @@ var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
|
|
|
488254
488488
|
};
|
|
488255
488489
|
}, "usePluginChoiceRequests");
|
|
488256
488490
|
var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd6) => {
|
|
488257
|
-
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0,
|
|
488491
|
+
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react167.useReducer)(
|
|
488258
488492
|
extensionUpdatesReducer,
|
|
488259
488493
|
initialExtensionUpdatesState
|
|
488260
488494
|
);
|
|
488261
488495
|
const extensions = extensionManager.getLoadedExtensions();
|
|
488262
|
-
(0,
|
|
488496
|
+
(0, import_react167.useEffect)(() => {
|
|
488263
488497
|
(async () => {
|
|
488264
488498
|
const extensionsToCheck = extensions.filter((extension) => {
|
|
488265
488499
|
const currentStatus = extensionsUpdateState.extensionStatuses.get(
|
|
@@ -488287,7 +488521,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
|
|
|
488287
488521
|
extensionsUpdateState.extensionStatuses,
|
|
488288
488522
|
dispatchExtensionStateUpdate
|
|
488289
488523
|
]);
|
|
488290
|
-
(0,
|
|
488524
|
+
(0, import_react167.useEffect)(() => {
|
|
488291
488525
|
if (extensionsUpdateState.batchChecksInProgress > 0) {
|
|
488292
488526
|
return;
|
|
488293
488527
|
}
|
|
@@ -488346,7 +488580,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
|
|
|
488346
488580
|
);
|
|
488347
488581
|
}
|
|
488348
488582
|
}, [extensions, extensionManager, extensionsUpdateState, addItem, cwd6]);
|
|
488349
|
-
const extensionsUpdateStateComputed = (0,
|
|
488583
|
+
const extensionsUpdateStateComputed = (0, import_react167.useMemo)(() => {
|
|
488350
488584
|
const result = /* @__PURE__ */ new Map();
|
|
488351
488585
|
for (const [
|
|
488352
488586
|
key,
|
|
@@ -488365,15 +488599,15 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
|
|
|
488365
488599
|
|
|
488366
488600
|
// packages/cli/src/ui/hooks/useWelcomeBack.ts
|
|
488367
488601
|
init_esbuild_shims();
|
|
488368
|
-
var
|
|
488602
|
+
var import_react168 = __toESM(require_react(), 1);
|
|
488369
488603
|
init_dist4();
|
|
488370
488604
|
function useWelcomeBack(config2, submitQuery, buffer, settings2) {
|
|
488371
|
-
const [welcomeBackInfo, setWelcomeBackInfo] = (0,
|
|
488372
|
-
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0,
|
|
488373
|
-
const [welcomeBackChoice, setWelcomeBackChoice] = (0,
|
|
488374
|
-
const [shouldFillInput, setShouldFillInput] = (0,
|
|
488375
|
-
const [inputFillText, setInputFillText] = (0,
|
|
488376
|
-
const checkWelcomeBack = (0,
|
|
488605
|
+
const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react168.useState)(null);
|
|
488606
|
+
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react168.useState)(false);
|
|
488607
|
+
const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react168.useState)(null);
|
|
488608
|
+
const [shouldFillInput, setShouldFillInput] = (0, import_react168.useState)(false);
|
|
488609
|
+
const [inputFillText, setInputFillText] = (0, import_react168.useState)(null);
|
|
488610
|
+
const checkWelcomeBack = (0, import_react168.useCallback)(async () => {
|
|
488377
488611
|
if (settings2.ui?.enableWelcomeBack === false) {
|
|
488378
488612
|
return;
|
|
488379
488613
|
}
|
|
@@ -488387,7 +488621,7 @@ function useWelcomeBack(config2, submitQuery, buffer, settings2) {
|
|
|
488387
488621
|
config2.getDebugLogger().debug("Welcome back check failed:", error40);
|
|
488388
488622
|
}
|
|
488389
488623
|
}, [config2, settings2.ui?.enableWelcomeBack]);
|
|
488390
|
-
const handleWelcomeBackSelection = (0,
|
|
488624
|
+
const handleWelcomeBackSelection = (0, import_react168.useCallback)(
|
|
488391
488625
|
(choice2) => {
|
|
488392
488626
|
setWelcomeBackChoice(choice2);
|
|
488393
488627
|
setShowWelcomeBackDialog(false);
|
|
@@ -488399,21 +488633,21 @@ function useWelcomeBack(config2, submitQuery, buffer, settings2) {
|
|
|
488399
488633
|
},
|
|
488400
488634
|
[welcomeBackInfo]
|
|
488401
488635
|
);
|
|
488402
|
-
const handleWelcomeBackClose = (0,
|
|
488636
|
+
const handleWelcomeBackClose = (0, import_react168.useCallback)(() => {
|
|
488403
488637
|
setWelcomeBackChoice("restart");
|
|
488404
488638
|
setShowWelcomeBackDialog(false);
|
|
488405
488639
|
}, []);
|
|
488406
|
-
const clearInputFill = (0,
|
|
488640
|
+
const clearInputFill = (0, import_react168.useCallback)(() => {
|
|
488407
488641
|
setShouldFillInput(false);
|
|
488408
488642
|
setInputFillText(null);
|
|
488409
488643
|
}, []);
|
|
488410
|
-
(0,
|
|
488644
|
+
(0, import_react168.useEffect)(() => {
|
|
488411
488645
|
if (shouldFillInput && inputFillText) {
|
|
488412
488646
|
buffer.setText(inputFillText);
|
|
488413
488647
|
clearInputFill();
|
|
488414
488648
|
}
|
|
488415
488649
|
}, [shouldFillInput, inputFillText, buffer, clearInputFill]);
|
|
488416
|
-
(0,
|
|
488650
|
+
(0, import_react168.useEffect)(() => {
|
|
488417
488651
|
checkWelcomeBack();
|
|
488418
488652
|
}, [checkWelcomeBack]);
|
|
488419
488653
|
return {
|
|
@@ -488434,9 +488668,9 @@ __name(useWelcomeBack, "useWelcomeBack");
|
|
|
488434
488668
|
|
|
488435
488669
|
// packages/cli/src/ui/hooks/useDialogClose.ts
|
|
488436
488670
|
init_esbuild_shims();
|
|
488437
|
-
var
|
|
488671
|
+
var import_react169 = __toESM(require_react(), 1);
|
|
488438
488672
|
function useDialogClose(options2) {
|
|
488439
|
-
const closeAnyOpenDialog = (0,
|
|
488673
|
+
const closeAnyOpenDialog = (0, import_react169.useCallback)(() => {
|
|
488440
488674
|
if (options2.isThemeDialogOpen) {
|
|
488441
488675
|
options2.handleThemeSelect(void 0, "User" /* User */);
|
|
488442
488676
|
return true;
|
|
@@ -488472,14 +488706,14 @@ __name(useDialogClose, "useDialogClose");
|
|
|
488472
488706
|
|
|
488473
488707
|
// packages/cli/src/ui/hooks/useInitializationAuthError.ts
|
|
488474
488708
|
init_esbuild_shims();
|
|
488475
|
-
var
|
|
488709
|
+
var import_react170 = __toESM(require_react(), 1);
|
|
488476
488710
|
var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError) => {
|
|
488477
|
-
const hasHandled = (0,
|
|
488478
|
-
const authErrorRef = (0,
|
|
488479
|
-
const onAuthErrorRef = (0,
|
|
488711
|
+
const hasHandled = (0, import_react170.useRef)(false);
|
|
488712
|
+
const authErrorRef = (0, import_react170.useRef)(authError);
|
|
488713
|
+
const onAuthErrorRef = (0, import_react170.useRef)(onAuthError);
|
|
488480
488714
|
authErrorRef.current = authError;
|
|
488481
488715
|
onAuthErrorRef.current = onAuthError;
|
|
488482
|
-
(0,
|
|
488716
|
+
(0, import_react170.useEffect)(() => {
|
|
488483
488717
|
if (hasHandled.current) {
|
|
488484
488718
|
return;
|
|
488485
488719
|
}
|
|
@@ -488492,13 +488726,13 @@ var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError)
|
|
|
488492
488726
|
|
|
488493
488727
|
// packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
|
|
488494
488728
|
init_esbuild_shims();
|
|
488495
|
-
var
|
|
488729
|
+
var import_react171 = __toESM(require_react(), 1);
|
|
488496
488730
|
function useSubagentCreateDialog() {
|
|
488497
|
-
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0,
|
|
488498
|
-
const openSubagentCreateDialog = (0,
|
|
488731
|
+
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react171.useState)(false);
|
|
488732
|
+
const openSubagentCreateDialog = (0, import_react171.useCallback)(() => {
|
|
488499
488733
|
setIsSubagentCreateDialogOpen(true);
|
|
488500
488734
|
}, []);
|
|
488501
|
-
const closeSubagentCreateDialog = (0,
|
|
488735
|
+
const closeSubagentCreateDialog = (0, import_react171.useCallback)(() => {
|
|
488502
488736
|
setIsSubagentCreateDialogOpen(false);
|
|
488503
488737
|
}, []);
|
|
488504
488738
|
return {
|
|
@@ -488511,13 +488745,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
|
|
|
488511
488745
|
|
|
488512
488746
|
// packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
|
|
488513
488747
|
init_esbuild_shims();
|
|
488514
|
-
var
|
|
488748
|
+
var import_react172 = __toESM(require_react(), 1);
|
|
488515
488749
|
var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
488516
|
-
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0,
|
|
488517
|
-
const openAgentsManagerDialog = (0,
|
|
488750
|
+
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react172.useState)(false);
|
|
488751
|
+
const openAgentsManagerDialog = (0, import_react172.useCallback)(() => {
|
|
488518
488752
|
setIsAgentsManagerDialogOpen(true);
|
|
488519
488753
|
}, []);
|
|
488520
|
-
const closeAgentsManagerDialog = (0,
|
|
488754
|
+
const closeAgentsManagerDialog = (0, import_react172.useCallback)(() => {
|
|
488521
488755
|
setIsAgentsManagerDialogOpen(false);
|
|
488522
488756
|
}, []);
|
|
488523
488757
|
return {
|
|
@@ -488529,13 +488763,13 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
488529
488763
|
|
|
488530
488764
|
// packages/cli/src/ui/hooks/useExtensionsManagerDialog.ts
|
|
488531
488765
|
init_esbuild_shims();
|
|
488532
|
-
var
|
|
488766
|
+
var import_react173 = __toESM(require_react(), 1);
|
|
488533
488767
|
var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
488534
|
-
const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0,
|
|
488535
|
-
const openExtensionsManagerDialog = (0,
|
|
488768
|
+
const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0, import_react173.useState)(false);
|
|
488769
|
+
const openExtensionsManagerDialog = (0, import_react173.useCallback)(() => {
|
|
488536
488770
|
setIsExtensionsManagerDialogOpen(true);
|
|
488537
488771
|
}, []);
|
|
488538
|
-
const closeExtensionsManagerDialog = (0,
|
|
488772
|
+
const closeExtensionsManagerDialog = (0, import_react173.useCallback)(() => {
|
|
488539
488773
|
setIsExtensionsManagerDialogOpen(false);
|
|
488540
488774
|
}, []);
|
|
488541
488775
|
return {
|
|
@@ -488547,13 +488781,13 @@ var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
488547
488781
|
|
|
488548
488782
|
// packages/cli/src/ui/hooks/useMcpDialog.ts
|
|
488549
488783
|
init_esbuild_shims();
|
|
488550
|
-
var
|
|
488784
|
+
var import_react174 = __toESM(require_react(), 1);
|
|
488551
488785
|
var useMcpDialog = /* @__PURE__ */ __name(() => {
|
|
488552
|
-
const [isMcpDialogOpen, setIsMcpDialogOpen] = (0,
|
|
488553
|
-
const openMcpDialog = (0,
|
|
488786
|
+
const [isMcpDialogOpen, setIsMcpDialogOpen] = (0, import_react174.useState)(false);
|
|
488787
|
+
const openMcpDialog = (0, import_react174.useCallback)(() => {
|
|
488554
488788
|
setIsMcpDialogOpen(true);
|
|
488555
488789
|
}, []);
|
|
488556
|
-
const closeMcpDialog = (0,
|
|
488790
|
+
const closeMcpDialog = (0, import_react174.useCallback)(() => {
|
|
488557
488791
|
setIsMcpDialogOpen(false);
|
|
488558
488792
|
}, []);
|
|
488559
488793
|
return {
|
|
@@ -488565,13 +488799,13 @@ var useMcpDialog = /* @__PURE__ */ __name(() => {
|
|
|
488565
488799
|
|
|
488566
488800
|
// packages/cli/src/ui/hooks/useHooksDialog.ts
|
|
488567
488801
|
init_esbuild_shims();
|
|
488568
|
-
var
|
|
488802
|
+
var import_react175 = __toESM(require_react(), 1);
|
|
488569
488803
|
var useHooksDialog = /* @__PURE__ */ __name(() => {
|
|
488570
|
-
const [isHooksDialogOpen, setIsHooksDialogOpen] = (0,
|
|
488571
|
-
const openHooksDialog = (0,
|
|
488804
|
+
const [isHooksDialogOpen, setIsHooksDialogOpen] = (0, import_react175.useState)(false);
|
|
488805
|
+
const openHooksDialog = (0, import_react175.useCallback)(() => {
|
|
488572
488806
|
setIsHooksDialogOpen(true);
|
|
488573
488807
|
}, []);
|
|
488574
|
-
const closeHooksDialog = (0,
|
|
488808
|
+
const closeHooksDialog = (0, import_react175.useCallback)(() => {
|
|
488575
488809
|
setIsHooksDialogOpen(false);
|
|
488576
488810
|
}, []);
|
|
488577
488811
|
return {
|
|
@@ -488583,7 +488817,7 @@ var useHooksDialog = /* @__PURE__ */ __name(() => {
|
|
|
488583
488817
|
|
|
488584
488818
|
// packages/cli/src/ui/hooks/useAttentionNotifications.ts
|
|
488585
488819
|
init_esbuild_shims();
|
|
488586
|
-
var
|
|
488820
|
+
var import_react176 = __toESM(require_react(), 1);
|
|
488587
488821
|
|
|
488588
488822
|
// packages/cli/src/utils/attentionNotification.ts
|
|
488589
488823
|
init_esbuild_shims();
|
|
@@ -488620,10 +488854,10 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
488620
488854
|
config: config2
|
|
488621
488855
|
}) => {
|
|
488622
488856
|
const terminalBellEnabled = settings2?.merged?.general?.terminalBell ?? true;
|
|
488623
|
-
const awaitingNotificationSentRef = (0,
|
|
488624
|
-
const respondingElapsedRef = (0,
|
|
488625
|
-
const idleNotificationSentRef = (0,
|
|
488626
|
-
(0,
|
|
488857
|
+
const awaitingNotificationSentRef = (0, import_react176.useRef)(false);
|
|
488858
|
+
const respondingElapsedRef = (0, import_react176.useRef)(0);
|
|
488859
|
+
const idleNotificationSentRef = (0, import_react176.useRef)(false);
|
|
488860
|
+
(0, import_react176.useEffect)(() => {
|
|
488627
488861
|
if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current) {
|
|
488628
488862
|
notifyTerminalAttention("tool_approval" /* ToolApproval */, {
|
|
488629
488863
|
enabled: terminalBellEnabled
|
|
@@ -488634,7 +488868,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
488634
488868
|
awaitingNotificationSentRef.current = false;
|
|
488635
488869
|
}
|
|
488636
488870
|
}, [isFocused, streamingState, terminalBellEnabled]);
|
|
488637
|
-
(0,
|
|
488871
|
+
(0, import_react176.useEffect)(() => {
|
|
488638
488872
|
if (streamingState === "responding" /* Responding */) {
|
|
488639
488873
|
respondingElapsedRef.current = elapsedTime;
|
|
488640
488874
|
idleNotificationSentRef.current = false;
|
|
@@ -488670,7 +488904,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
488670
488904
|
|
|
488671
488905
|
// packages/cli/src/ui/hooks/useVoice.ts
|
|
488672
488906
|
init_esbuild_shims();
|
|
488673
|
-
var
|
|
488907
|
+
var import_react177 = __toESM(require_react(), 1);
|
|
488674
488908
|
import os46 from "node:os";
|
|
488675
488909
|
import path148 from "node:path";
|
|
488676
488910
|
import fs134 from "node:fs";
|
|
@@ -488705,12 +488939,12 @@ __name(transcribe, "transcribe");
|
|
|
488705
488939
|
|
|
488706
488940
|
// packages/cli/src/ui/hooks/useVoice.ts
|
|
488707
488941
|
function useVoice(sttEndpoint, sttApiKey) {
|
|
488708
|
-
const [voiceState, setVoiceState] = (0,
|
|
488709
|
-
const [error40, setError] = (0,
|
|
488710
|
-
const procRef = (0,
|
|
488711
|
-
const audioPathRef = (0,
|
|
488712
|
-
const backend = (0,
|
|
488713
|
-
const start2 = (0,
|
|
488942
|
+
const [voiceState, setVoiceState] = (0, import_react177.useState)("idle");
|
|
488943
|
+
const [error40, setError] = (0, import_react177.useState)(null);
|
|
488944
|
+
const procRef = (0, import_react177.useRef)(null);
|
|
488945
|
+
const audioPathRef = (0, import_react177.useRef)(null);
|
|
488946
|
+
const backend = (0, import_react177.useMemo)(() => detectBackend2(), []);
|
|
488947
|
+
const start2 = (0, import_react177.useCallback)(async () => {
|
|
488714
488948
|
if (voiceState !== "idle") return;
|
|
488715
488949
|
const tmpPath = path148.join(os46.tmpdir(), `proto-voice-${Date.now()}.wav`);
|
|
488716
488950
|
audioPathRef.current = tmpPath;
|
|
@@ -488723,7 +488957,7 @@ function useVoice(sttEndpoint, sttApiKey) {
|
|
|
488723
488957
|
setError(e4 instanceof Error ? e4.message : String(e4));
|
|
488724
488958
|
}
|
|
488725
488959
|
}, [voiceState, backend]);
|
|
488726
|
-
const stop3 = (0,
|
|
488960
|
+
const stop3 = (0, import_react177.useCallback)(async () => {
|
|
488727
488961
|
if (voiceState !== "recording" || !procRef.current || !audioPathRef.current) {
|
|
488728
488962
|
return "";
|
|
488729
488963
|
}
|
|
@@ -488756,7 +488990,7 @@ function useVoice(sttEndpoint, sttApiKey) {
|
|
|
488756
488990
|
return "";
|
|
488757
488991
|
}
|
|
488758
488992
|
}, [voiceState, sttEndpoint, sttApiKey]);
|
|
488759
|
-
const reset = (0,
|
|
488993
|
+
const reset = (0, import_react177.useCallback)(() => {
|
|
488760
488994
|
setVoiceState("idle");
|
|
488761
488995
|
setError(null);
|
|
488762
488996
|
}, []);
|
|
@@ -488791,21 +489025,21 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
488791
489025
|
const { settings: settings2, config: config2, initializationResult } = props;
|
|
488792
489026
|
const historyManager = useHistory();
|
|
488793
489027
|
useMemoryMonitor(historyManager);
|
|
488794
|
-
const [debugMessage, setDebugMessage] = (0,
|
|
488795
|
-
const [quittingMessages, setQuittingMessages] = (0,
|
|
488796
|
-
const [themeError, setThemeError] = (0,
|
|
489028
|
+
const [debugMessage, setDebugMessage] = (0, import_react178.useState)("");
|
|
489029
|
+
const [quittingMessages, setQuittingMessages] = (0, import_react178.useState)(null);
|
|
489030
|
+
const [themeError, setThemeError] = (0, import_react178.useState)(
|
|
488797
489031
|
initializationResult.themeError
|
|
488798
489032
|
);
|
|
488799
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
488800
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] = (0,
|
|
488801
|
-
const [geminiMdFileCount, setGeminiMdFileCount] = (0,
|
|
489033
|
+
const [isProcessing, setIsProcessing] = (0, import_react178.useState)(false);
|
|
489034
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react178.useState)(false);
|
|
489035
|
+
const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react178.useState)(
|
|
488802
489036
|
initializationResult.geminiMdFileCount
|
|
488803
489037
|
);
|
|
488804
|
-
const [shellModeActive, setShellModeActive] = (0,
|
|
488805
|
-
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0,
|
|
488806
|
-
const [historyRemountKey, setHistoryRemountKey] = (0,
|
|
488807
|
-
const [updateInfo, setUpdateInfo] = (0,
|
|
488808
|
-
const [isTrustedFolder, setIsTrustedFolder] = (0,
|
|
489038
|
+
const [shellModeActive, setShellModeActive] = (0, import_react178.useState)(false);
|
|
489039
|
+
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react178.useState)(false);
|
|
489040
|
+
const [historyRemountKey, setHistoryRemountKey] = (0, import_react178.useState)(0);
|
|
489041
|
+
const [updateInfo, setUpdateInfo] = (0, import_react178.useState)(null);
|
|
489042
|
+
const [isTrustedFolder, setIsTrustedFolder] = (0, import_react178.useState)(
|
|
488809
489043
|
config2.isTrustedFolder()
|
|
488810
489044
|
);
|
|
488811
489045
|
const extensionManager = config2.getExtensionManager();
|
|
@@ -488860,37 +489094,37 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
488860
489094
|
config2.getWorkingDir()
|
|
488861
489095
|
);
|
|
488862
489096
|
const { codingPlanUpdateRequest, dismissCodingPlanUpdate } = useCodingPlanUpdates(settings2, config2, historyManager.addItem);
|
|
488863
|
-
const [isTrustDialogOpen, setTrustDialogOpen] = (0,
|
|
488864
|
-
const openTrustDialog = (0,
|
|
488865
|
-
const closeTrustDialog = (0,
|
|
488866
|
-
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0,
|
|
488867
|
-
const openPermissionsDialog = (0,
|
|
489097
|
+
const [isTrustDialogOpen, setTrustDialogOpen] = (0, import_react178.useState)(false);
|
|
489098
|
+
const openTrustDialog = (0, import_react178.useCallback)(() => setTrustDialogOpen(true), []);
|
|
489099
|
+
const closeTrustDialog = (0, import_react178.useCallback)(() => setTrustDialogOpen(false), []);
|
|
489100
|
+
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react178.useState)(false);
|
|
489101
|
+
const openPermissionsDialog = (0, import_react178.useCallback)(
|
|
488868
489102
|
() => setPermissionsDialogOpen(true),
|
|
488869
489103
|
[]
|
|
488870
489104
|
);
|
|
488871
|
-
const closePermissionsDialog = (0,
|
|
489105
|
+
const closePermissionsDialog = (0, import_react178.useCallback)(
|
|
488872
489106
|
() => setPermissionsDialogOpen(false),
|
|
488873
489107
|
[]
|
|
488874
489108
|
);
|
|
488875
|
-
const [currentModel, setCurrentModel] = (0,
|
|
488876
|
-
const [isConfigInitialized, setConfigInitialized] = (0,
|
|
488877
|
-
const [userMessages, setUserMessages] = (0,
|
|
489109
|
+
const [currentModel, setCurrentModel] = (0, import_react178.useState)(() => config2.getModel());
|
|
489110
|
+
const [isConfigInitialized, setConfigInitialized] = (0, import_react178.useState)(false);
|
|
489111
|
+
const [userMessages, setUserMessages] = (0, import_react178.useState)([]);
|
|
488878
489112
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
488879
489113
|
const { stdin: stdin3, setRawMode } = use_stdin_default();
|
|
488880
489114
|
const { stdout: stdout3 } = use_stdout_default();
|
|
488881
489115
|
const { stats: sessionStats, startNewSession } = useSessionStats();
|
|
488882
489116
|
const logger10 = useLogger(config2.storage, sessionStats.sessionId);
|
|
488883
489117
|
const branchName = useGitBranchName(config2.getTargetDir());
|
|
488884
|
-
const mainControlsRef = (0,
|
|
489118
|
+
const mainControlsRef = (0, import_react178.useRef)(null);
|
|
488885
489119
|
const staticExtraHeight = 3;
|
|
488886
489120
|
useInitializationEffects(config2, historyManager, setConfigInitialized);
|
|
488887
|
-
(0,
|
|
489121
|
+
(0, import_react178.useEffect)(
|
|
488888
489122
|
() => setUpdateHandler(historyManager.addItem, setUpdateInfo),
|
|
488889
489123
|
[historyManager.addItem]
|
|
488890
489124
|
);
|
|
488891
489125
|
const { lastFinished } = useBackgroundAgentProgress();
|
|
488892
489126
|
const addHistoryItem = historyManager.addItem;
|
|
488893
|
-
(0,
|
|
489127
|
+
(0, import_react178.useEffect)(() => {
|
|
488894
489128
|
if (!lastFinished?.hitLimit) return;
|
|
488895
489129
|
addHistoryItem(
|
|
488896
489130
|
{
|
|
@@ -488900,19 +489134,19 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
488900
489134
|
Date.now()
|
|
488901
489135
|
);
|
|
488902
489136
|
}, [lastFinished, addHistoryItem]);
|
|
488903
|
-
(0,
|
|
489137
|
+
(0, import_react178.useEffect)(() => {
|
|
488904
489138
|
const unsubscribe = config2.onModelChange((model) => {
|
|
488905
489139
|
setCurrentModel(model);
|
|
488906
489140
|
});
|
|
488907
489141
|
return unsubscribe;
|
|
488908
489142
|
}, [config2]);
|
|
488909
|
-
const { inputWidth, suggestionsWidth } = (0,
|
|
489143
|
+
const { inputWidth, suggestionsWidth } = (0, import_react178.useMemo)(() => {
|
|
488910
489144
|
const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
|
|
488911
489145
|
return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
|
|
488912
489146
|
}, [terminalWidth]);
|
|
488913
489147
|
const mainAreaWidth = Math.min(terminalWidth - 4, 100);
|
|
488914
489148
|
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
|
|
488915
|
-
const isValidPath = (0,
|
|
489149
|
+
const isValidPath = (0, import_react178.useCallback)((filePath) => {
|
|
488916
489150
|
try {
|
|
488917
489151
|
return fs135.existsSync(filePath) && fs135.statSync(filePath).isFile();
|
|
488918
489152
|
} catch (_e2) {
|
|
@@ -488927,7 +489161,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
488927
489161
|
isValidPath,
|
|
488928
489162
|
shellModeActive
|
|
488929
489163
|
});
|
|
488930
|
-
(0,
|
|
489164
|
+
(0, import_react178.useEffect)(() => {
|
|
488931
489165
|
const fetchUserMessages = /* @__PURE__ */ __name(async () => {
|
|
488932
489166
|
const pastMessagesRaw = await logger10?.getPreviousUserMessages() || [];
|
|
488933
489167
|
const currentSessionUserMessages = historyManager.history.filter(
|
|
@@ -488950,13 +489184,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
488950
489184
|
}, "fetchUserMessages");
|
|
488951
489185
|
fetchUserMessages();
|
|
488952
489186
|
}, [historyManager.history, logger10]);
|
|
488953
|
-
const refreshStatic = (0,
|
|
489187
|
+
const refreshStatic = (0, import_react178.useCallback)(() => {
|
|
488954
489188
|
stdout3.write("\x1B[?2026h");
|
|
488955
489189
|
stdout3.write(base_exports.clearTerminal);
|
|
488956
489190
|
stdout3.write("\x1B[?2026l");
|
|
488957
489191
|
setHistoryRemountKey((prev) => prev + 1);
|
|
488958
489192
|
}, [setHistoryRemountKey, stdout3]);
|
|
488959
|
-
(0,
|
|
489193
|
+
(0, import_react178.useEffect)(() => {
|
|
488960
489194
|
const unsubscribe = config2.onModelChange((model) => {
|
|
488961
489195
|
setCurrentModel((prev) => {
|
|
488962
489196
|
if (prev === model) {
|
|
@@ -488998,7 +489232,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
488998
489232
|
cancelAuthentication
|
|
488999
489233
|
} = useAuthCommand(settings2, config2, historyManager.addItem, refreshStatic);
|
|
489000
489234
|
useInitializationAuthError(initializationResult.authError, onAuthError);
|
|
489001
|
-
(0,
|
|
489235
|
+
(0, import_react178.useEffect)(() => {
|
|
489002
489236
|
const currentAuthType = config2.getModelsConfig().getCurrentAuthType();
|
|
489003
489237
|
if (settings2.merged.security?.auth?.enforcedType && currentAuthType && settings2.merged.security?.auth.enforcedType !== currentAuthType) {
|
|
489004
489238
|
onAuthError(
|
|
@@ -489024,7 +489258,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489024
489258
|
config2,
|
|
489025
489259
|
onAuthError
|
|
489026
489260
|
]);
|
|
489027
|
-
const [editorError, setEditorError] = (0,
|
|
489261
|
+
const [editorError, setEditorError] = (0, import_react178.useState)(null);
|
|
489028
489262
|
const {
|
|
489029
489263
|
isEditorDialogOpen,
|
|
489030
489264
|
openEditorDialog,
|
|
@@ -489068,10 +489302,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489068
489302
|
} = useExtensionsManagerDialog();
|
|
489069
489303
|
const { isMcpDialogOpen, openMcpDialog, closeMcpDialog } = useMcpDialog();
|
|
489070
489304
|
const { isHooksDialogOpen, openHooksDialog, closeHooksDialog } = useHooksDialog();
|
|
489071
|
-
const [isRewindDialogOpen, setIsRewindDialogOpen] = (0,
|
|
489072
|
-
const openRewindDialog = (0,
|
|
489073
|
-
const closeRewindDialog = (0,
|
|
489074
|
-
const slashCommandActions = (0,
|
|
489305
|
+
const [isRewindDialogOpen, setIsRewindDialogOpen] = (0, import_react178.useState)(false);
|
|
489306
|
+
const openRewindDialog = (0, import_react178.useCallback)(() => setIsRewindDialogOpen(true), []);
|
|
489307
|
+
const closeRewindDialog = (0, import_react178.useCallback)(() => setIsRewindDialogOpen(false), []);
|
|
489308
|
+
const slashCommandActions = (0, import_react178.useMemo)(
|
|
489075
489309
|
() => ({
|
|
489076
489310
|
openAuthDialog,
|
|
489077
489311
|
openThemeDialog,
|
|
@@ -489149,14 +489383,14 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489149
489383
|
isConfigInitialized,
|
|
489150
489384
|
logger10
|
|
489151
489385
|
);
|
|
489152
|
-
const onDebugMessage = (0,
|
|
489386
|
+
const onDebugMessage = (0, import_react178.useCallback)(
|
|
489153
489387
|
(message) => {
|
|
489154
489388
|
config2.getDebugLogger().debug(message);
|
|
489155
489389
|
},
|
|
489156
489390
|
[config2]
|
|
489157
489391
|
);
|
|
489158
489392
|
const stableAddItem = historyManager.addItem;
|
|
489159
|
-
const performMemoryRefresh = (0,
|
|
489393
|
+
const performMemoryRefresh = (0, import_react178.useCallback)(async () => {
|
|
489160
489394
|
stableAddItem(
|
|
489161
489395
|
{
|
|
489162
489396
|
type: "info" /* INFO */,
|
|
@@ -489202,7 +489436,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489202
489436
|
debugLogger161.error("Error refreshing memory:", error40);
|
|
489203
489437
|
}
|
|
489204
489438
|
}, [config2, stableAddItem, settings2.merged]);
|
|
489205
|
-
const cancelHandlerRef = (0,
|
|
489439
|
+
const cancelHandlerRef = (0, import_react178.useRef)(() => {
|
|
489206
489440
|
});
|
|
489207
489441
|
const { messageQueue, addMessage, popLast, drain } = useMessageQueue();
|
|
489208
489442
|
const voiceEnabled = settings2.merged.voice?.enabled ?? false;
|
|
@@ -489254,7 +489488,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489254
489488
|
drain,
|
|
489255
489489
|
submitQuery
|
|
489256
489490
|
);
|
|
489257
|
-
const [hasSuggestionsVisible, setHasSuggestionsVisible] = (0,
|
|
489491
|
+
const [hasSuggestionsVisible, setHasSuggestionsVisible] = (0, import_react178.useState)(false);
|
|
489258
489492
|
const agentViewState = useAgentViewState();
|
|
489259
489493
|
const geminiClient = config2.getGeminiClient();
|
|
489260
489494
|
const showAutoAcceptIndicator = useAutoAcceptIndicator({
|
|
@@ -489282,7 +489516,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489282
489516
|
settingInputRequests,
|
|
489283
489517
|
pendingGeminiHistoryItems
|
|
489284
489518
|
});
|
|
489285
|
-
const handleFinalSubmit = (0,
|
|
489519
|
+
const handleFinalSubmit = (0, import_react178.useCallback)(
|
|
489286
489520
|
(submittedValue) => {
|
|
489287
489521
|
if (agentViewState.activeView !== "main") {
|
|
489288
489522
|
const agent = agentViewState.agents.get(agentViewState.activeView);
|
|
@@ -489390,7 +489624,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489390
489624
|
speculationRef
|
|
489391
489625
|
]
|
|
489392
489626
|
);
|
|
489393
|
-
const handleArenaModelsSelected = (0,
|
|
489627
|
+
const handleArenaModelsSelected = (0, import_react178.useCallback)(
|
|
489394
489628
|
(models) => {
|
|
489395
489629
|
const value = models.join(",");
|
|
489396
489630
|
buffer.setText(`/arena start --models ${value} `);
|
|
@@ -489405,7 +489639,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489405
489639
|
handleWelcomeBackSelection,
|
|
489406
489640
|
handleWelcomeBackClose
|
|
489407
489641
|
} = useWelcomeBack(config2, handleFinalSubmit, buffer, settings2.merged);
|
|
489408
|
-
cancelHandlerRef.current = (0,
|
|
489642
|
+
cancelHandlerRef.current = (0, import_react178.useCallback)(() => {
|
|
489409
489643
|
const pendingHistoryItems2 = [
|
|
489410
489644
|
...pendingSlashCommandHistoryItems,
|
|
489411
489645
|
...pendingGeminiHistoryItems
|
|
@@ -489430,15 +489664,15 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489430
489664
|
pendingSlashCommandHistoryItems,
|
|
489431
489665
|
pendingGeminiHistoryItems
|
|
489432
489666
|
]);
|
|
489433
|
-
const handleClearScreen = (0,
|
|
489667
|
+
const handleClearScreen = (0, import_react178.useCallback)(() => {
|
|
489434
489668
|
historyManager.clearItems();
|
|
489435
489669
|
clearScreen2();
|
|
489436
489670
|
refreshStatic();
|
|
489437
489671
|
}, [historyManager, refreshStatic]);
|
|
489438
489672
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
489439
489673
|
const isInputActive = !initError && !isProcessing && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */);
|
|
489440
|
-
const [controlsHeight, setControlsHeight] = (0,
|
|
489441
|
-
(0,
|
|
489674
|
+
const [controlsHeight, setControlsHeight] = (0, import_react178.useState)(0);
|
|
489675
|
+
(0, import_react178.useLayoutEffect)(() => {
|
|
489442
489676
|
if (mainControlsRef.current) {
|
|
489443
489677
|
const fullFooterMeasurement = measure_element_default(mainControlsRef.current);
|
|
489444
489678
|
if (fullFooterMeasurement.height > 0) {
|
|
@@ -489462,13 +489696,22 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489462
489696
|
});
|
|
489463
489697
|
const isFocused = useFocus();
|
|
489464
489698
|
useBracketedPaste();
|
|
489465
|
-
|
|
489699
|
+
useAwaySummary({
|
|
489700
|
+
enabled: settings2.merged.general?.showSessionRecap ?? false,
|
|
489701
|
+
config: config2,
|
|
489702
|
+
isFocused,
|
|
489703
|
+
isIdle: streamingState === "idle" /* Idle */,
|
|
489704
|
+
addItem: historyManager.addItem,
|
|
489705
|
+
history: historyManager.history,
|
|
489706
|
+
awayThresholdMinutes: settings2.merged.general?.sessionRecapAwayThresholdMinutes
|
|
489707
|
+
});
|
|
489708
|
+
const contextFileNames = (0, import_react178.useMemo)(() => {
|
|
489466
489709
|
const fromSettings = settings2.merged.context?.fileName;
|
|
489467
489710
|
return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
|
|
489468
489711
|
}, [settings2.merged.context?.fileName]);
|
|
489469
|
-
const initialPrompt = (0,
|
|
489470
|
-
const initialPromptSubmitted = (0,
|
|
489471
|
-
(0,
|
|
489712
|
+
const initialPrompt = (0, import_react178.useMemo)(() => config2.getQuestion(), [config2]);
|
|
489713
|
+
const initialPromptSubmitted = (0, import_react178.useRef)(false);
|
|
489714
|
+
(0, import_react178.useEffect)(() => {
|
|
489472
489715
|
if (activePtyId) {
|
|
489473
489716
|
ShellExecutionService.resizePty(
|
|
489474
489717
|
activePtyId,
|
|
@@ -489477,7 +489720,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489477
489720
|
);
|
|
489478
489721
|
}
|
|
489479
489722
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
489480
|
-
(0,
|
|
489723
|
+
(0, import_react178.useEffect)(() => {
|
|
489481
489724
|
if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
|
|
489482
489725
|
handleFinalSubmit(initialPrompt);
|
|
489483
489726
|
initialPromptSubmitted.current = true;
|
|
@@ -489494,9 +489737,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489494
489737
|
welcomeBackChoice,
|
|
489495
489738
|
geminiClient
|
|
489496
489739
|
]);
|
|
489497
|
-
const [idePromptAnswered, setIdePromptAnswered] = (0,
|
|
489498
|
-
const [currentIDE, setCurrentIDE] = (0,
|
|
489499
|
-
(0,
|
|
489740
|
+
const [idePromptAnswered, setIdePromptAnswered] = (0, import_react178.useState)(false);
|
|
489741
|
+
const [currentIDE, setCurrentIDE] = (0, import_react178.useState)(null);
|
|
489742
|
+
(0, import_react178.useEffect)(() => {
|
|
489500
489743
|
const getIde = /* @__PURE__ */ __name(async () => {
|
|
489501
489744
|
const ideClient = await IdeClient.getInstance();
|
|
489502
489745
|
const currentIde = ideClient.getCurrentIde();
|
|
@@ -489512,24 +489755,24 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489512
489755
|
tomlFiles: commandMigrationTomlFiles,
|
|
489513
489756
|
setShowMigrationNudge: setShowCommandMigrationNudge
|
|
489514
489757
|
} = useCommandMigration(settings2, config2.storage);
|
|
489515
|
-
const [ideContextState, setIdeContextState] = (0,
|
|
489516
|
-
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0,
|
|
489758
|
+
const [ideContextState, setIdeContextState] = (0, import_react178.useState)();
|
|
489759
|
+
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react178.useState)(false);
|
|
489517
489760
|
const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings2, setIsTrustedFolder);
|
|
489518
489761
|
const {
|
|
489519
489762
|
needsRestart: ideNeedsRestart,
|
|
489520
489763
|
restartReason: ideTrustRestartReason
|
|
489521
489764
|
} = useIdeTrustListener();
|
|
489522
|
-
(0,
|
|
489765
|
+
(0, import_react178.useEffect)(() => {
|
|
489523
489766
|
if (ideNeedsRestart) {
|
|
489524
489767
|
setShowIdeRestartPrompt(true);
|
|
489525
489768
|
}
|
|
489526
489769
|
}, [ideNeedsRestart]);
|
|
489527
|
-
(0,
|
|
489770
|
+
(0, import_react178.useEffect)(() => {
|
|
489528
489771
|
const unsubscribe = ideContextStore.subscribe(setIdeContextState);
|
|
489529
489772
|
setIdeContextState(ideContextStore.get());
|
|
489530
489773
|
return unsubscribe;
|
|
489531
489774
|
}, []);
|
|
489532
|
-
const handleIdePromptComplete = (0,
|
|
489775
|
+
const handleIdePromptComplete = (0, import_react178.useCallback)(
|
|
489533
489776
|
(result) => {
|
|
489534
489777
|
if (result.userSelection === "yes") {
|
|
489535
489778
|
if (result.isExtensionPreInstalled) {
|
|
@@ -489545,7 +489788,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
489545
489788
|
},
|
|
489546
489789
|
[handleSlashCommand2, settings2]
|
|
489547
489790
|
);
|
|
489548
|
-
const handleCommandMigrationComplete = (0,
|
|
489791
|
+
const handleCommandMigrationComplete = (0, import_react178.useCallback)(
|
|
489549
489792
|
async (result) => {
|
|
489550
489793
|
setShowCommandMigrationNudge(false);
|
|
489551
489794
|
if (result.userSelection === "yes") {
|
|
@@ -489704,11 +489947,11 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
|
|
|
489704
489947
|
history: historyManager.history,
|
|
489705
489948
|
sessionStats
|
|
489706
489949
|
});
|
|
489707
|
-
const pendingHistoryItems = (0,
|
|
489950
|
+
const pendingHistoryItems = (0, import_react178.useMemo)(
|
|
489708
489951
|
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
|
|
489709
489952
|
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
|
|
489710
489953
|
);
|
|
489711
|
-
const uiState = (0,
|
|
489954
|
+
const uiState = (0, import_react178.useMemo)(
|
|
489712
489955
|
() => ({
|
|
489713
489956
|
history: historyManager.history,
|
|
489714
489957
|
historyManager,
|
|
@@ -489933,7 +490176,7 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
|
|
|
489933
490176
|
dismissPromptSuggestion
|
|
489934
490177
|
]
|
|
489935
490178
|
);
|
|
489936
|
-
const uiActions = (0,
|
|
490179
|
+
const uiActions = (0, import_react178.useMemo)(
|
|
489937
490180
|
() => ({
|
|
489938
490181
|
openThemeDialog,
|
|
489939
490182
|
openEditorDialog,
|
|
@@ -490084,9 +490327,9 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
|
|
|
490084
490327
|
|
|
490085
490328
|
// packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
|
|
490086
490329
|
init_esbuild_shims();
|
|
490087
|
-
var
|
|
490330
|
+
var import_react179 = __toESM(require_react(), 1);
|
|
490088
490331
|
function useKittyKeyboardProtocol() {
|
|
490089
|
-
const [status] = (0,
|
|
490332
|
+
const [status] = (0, import_react179.useState)({
|
|
490090
490333
|
supported: isKittyProtocolSupported(),
|
|
490091
490334
|
enabled: isKittyProtocolEnabled(),
|
|
490092
490335
|
checking: false
|
|
@@ -491066,7 +491309,7 @@ __name(validateNonInteractiveAuth, "validateNonInteractiveAuth");
|
|
|
491066
491309
|
|
|
491067
491310
|
// packages/cli/src/ui/components/StandaloneSessionPicker.tsx
|
|
491068
491311
|
init_esbuild_shims();
|
|
491069
|
-
var
|
|
491312
|
+
var import_react180 = __toESM(require_react(), 1);
|
|
491070
491313
|
init_dist4();
|
|
491071
491314
|
var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1);
|
|
491072
491315
|
var PREVIEW_CONFIG_STUB = {
|
|
@@ -491086,7 +491329,7 @@ function StandalonePickerScreen({
|
|
|
491086
491329
|
currentBranch
|
|
491087
491330
|
}) {
|
|
491088
491331
|
const { exit } = use_app_default();
|
|
491089
|
-
const [isExiting, setIsExiting] = (0,
|
|
491332
|
+
const [isExiting, setIsExiting] = (0, import_react180.useState)(false);
|
|
491090
491333
|
const handleExit = /* @__PURE__ */ __name(() => {
|
|
491091
491334
|
setIsExiting(true);
|
|
491092
491335
|
exit();
|
|
@@ -494189,7 +494432,7 @@ var QwenAgent = class {
|
|
|
494189
494432
|
async initialize(args2) {
|
|
494190
494433
|
this.clientCapabilities = args2.clientCapabilities;
|
|
494191
494434
|
const authMethods = buildAuthMethods();
|
|
494192
|
-
const version2 = "0.
|
|
494435
|
+
const version2 = "0.36.0";
|
|
494193
494436
|
return {
|
|
494194
494437
|
protocolVersion: PROTOCOL_VERSION,
|
|
494195
494438
|
agentInfo: {
|
|
@@ -494863,7 +495106,7 @@ async function startInteractiveUI(config2, settings2, startupWarnings, workspace
|
|
|
494863
495106
|
) });
|
|
494864
495107
|
}, "AppWrapper");
|
|
494865
495108
|
const instance2 = render_default(
|
|
494866
|
-
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
495109
|
+
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(import_react181.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(AppWrapper, {}),
|
|
494867
495110
|
{
|
|
494868
495111
|
exitOnCtrlC: false,
|
|
494869
495112
|
patchConsole: false,
|
|
@@ -495346,6 +495589,32 @@ main().catch((error40) => {
|
|
|
495346
495589
|
* One registry per Config — singleton per session. Output files live at
|
|
495347
495590
|
* <projectTempDir>/<sessionId>/tasks/<taskId>.output.
|
|
495348
495591
|
*/
|
|
495592
|
+
/**
|
|
495593
|
+
* @license
|
|
495594
|
+
* Copyright 2025 protoLabs Studio
|
|
495595
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
495596
|
+
*
|
|
495597
|
+
* Recap Generator
|
|
495598
|
+
*
|
|
495599
|
+
* Generates a 1-3 sentence "where we left off" card after long agent turns.
|
|
495600
|
+
* Modeled on cc-2.18's awaySummary, but triggered by turn duration / tool count
|
|
495601
|
+
* rather than terminal blur.
|
|
495602
|
+
*/
|
|
495603
|
+
/**
|
|
495604
|
+
* @license
|
|
495605
|
+
* Copyright 2026 protoLabs
|
|
495606
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
495607
|
+
*
|
|
495608
|
+
* Session-level wrapper around `generateRecap`. Callers that don't already
|
|
495609
|
+
* hold the conversation history (e.g. the auto-fire-on-return hook) want a
|
|
495610
|
+
* single function that pulls the latest history off the GeminiClient and
|
|
495611
|
+
* returns the polished recap. Returns null on empty / aborted / failed
|
|
495612
|
+
* generation; the auto-fire path treats that as "skip".
|
|
495613
|
+
*
|
|
495614
|
+
* Adapted from QwenLM/qwen-code's `services/sessionRecap.ts` (introduced in
|
|
495615
|
+
* #3434, refined in #3478/#3482) — the wrapper shape `{ text }` matches
|
|
495616
|
+
* upstream so the auto-fire hook can be ported without diverging.
|
|
495617
|
+
*/
|
|
495349
495618
|
/**
|
|
495350
495619
|
* @license
|
|
495351
495620
|
* Copyright 2025 protoLabs
|
|
@@ -495430,17 +495699,6 @@ main().catch((error40) => {
|
|
|
495430
495699
|
*
|
|
495431
495700
|
* Exports for the prompt suggestion feature.
|
|
495432
495701
|
*/
|
|
495433
|
-
/**
|
|
495434
|
-
* @license
|
|
495435
|
-
* Copyright 2025 protoLabs Studio
|
|
495436
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
495437
|
-
*
|
|
495438
|
-
* Recap Generator
|
|
495439
|
-
*
|
|
495440
|
-
* Generates a 1-3 sentence "where we left off" card after long agent turns.
|
|
495441
|
-
* Modeled on cc-2.18's awaySummary, but triggered by turn duration / tool count
|
|
495442
|
-
* rather than terminal blur.
|
|
495443
|
-
*/
|
|
495444
495702
|
/**
|
|
495445
495703
|
* @license
|
|
495446
495704
|
* Copyright 2025 Proto
|
|
@@ -495510,6 +495768,35 @@ main().catch((error40) => {
|
|
|
495510
495768
|
* Copyright 2025 ProtoLabs
|
|
495511
495769
|
* SPDX-License-Identifier: Apache-2.0
|
|
495512
495770
|
*/
|
|
495771
|
+
/**
|
|
495772
|
+
* @license
|
|
495773
|
+
* Copyright 2026 protoLabs
|
|
495774
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
495775
|
+
*
|
|
495776
|
+
* Generates and displays a 1-3 sentence "where you left off" recap when the
|
|
495777
|
+
* user returns to a terminal that has been blurred for ≥
|
|
495778
|
+
* `awayThresholdMinutes`. Best-effort: silently no-ops on disabled,
|
|
495779
|
+
* unavailable config, in-flight turn, or any generation failure. The recap
|
|
495780
|
+
* is debounced per blur cycle — a single back-and-forth produces at most
|
|
495781
|
+
* one recap.
|
|
495782
|
+
*
|
|
495783
|
+
* Adapted from QwenLM/qwen-code's `useAwaySummary` hook (introduced in
|
|
495784
|
+
* #3434, finalized in #3482). Differences from upstream:
|
|
495785
|
+
*
|
|
495786
|
+
* - Uses our existing `HistoryItemRecap` (`type: 'recap'`) instead of
|
|
495787
|
+
* the upstream-only `HistoryItemAwayRecap` (`type: 'away_recap'`). One
|
|
495788
|
+
* item type, rendered the same way regardless of whether it came from
|
|
495789
|
+
* `/recap` or the auto-fire path.
|
|
495790
|
+
* - Dedup gate counts `'recap'` items, matching the unified type.
|
|
495791
|
+
*
|
|
495792
|
+
* Mirrors Claude Code's gating constants exactly:
|
|
495793
|
+
* - Need at least MIN_USER_MESSAGES_TO_FIRE user turns total before any
|
|
495794
|
+
* auto-recap fires (don't fire on a near-empty session).
|
|
495795
|
+
* - If a recap is already in history, need at least
|
|
495796
|
+
* MIN_USER_MESSAGES_SINCE_LAST_RECAP new user turns since then before
|
|
495797
|
+
* another can fire (prevents back-to-back duplicates when the user
|
|
495798
|
+
* briefly alt-tabs twice with no new work between).
|
|
495799
|
+
*/
|
|
495513
495800
|
/*! Bundled license information:
|
|
495514
495801
|
|
|
495515
495802
|
undici/lib/web/fetch/body.js:
|