@rdmind/rdmind 0.1.3-alpha.2 → 0.1.3-alpha.4
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/cli.js +1194 -988
- package/locales/en.js +0 -13
- package/locales/zh.js +1 -11
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -89829,7 +89829,7 @@ var init_mcp_tool = __esm({
|
|
|
89829
89829
|
// Display original tool name in confirmation
|
|
89830
89830
|
toolDisplayName: this.displayName,
|
|
89831
89831
|
// Display global registry name exposed to model and user
|
|
89832
|
-
onConfirm: /* @__PURE__ */ __name(async (outcome) => {
|
|
89832
|
+
onConfirm: /* @__PURE__ */ __name(async (outcome, _payload) => {
|
|
89833
89833
|
if (outcome === "proceed_always_server" /* ProceedAlwaysServer */) {
|
|
89834
89834
|
_DiscoveredMCPToolInvocation.allowlist.add(serverAllowListKey);
|
|
89835
89835
|
} else if (outcome === "proceed_always_tool" /* ProceedAlwaysTool */) {
|
|
@@ -160739,7 +160739,7 @@ function createContentGeneratorConfig(config2, authType, generationConfig) {
|
|
|
160739
160739
|
};
|
|
160740
160740
|
}
|
|
160741
160741
|
async function createContentGenerator(config2, gcConfig, isInitialAuth) {
|
|
160742
|
-
const version3 = "0.1.3-alpha.
|
|
160742
|
+
const version3 = "0.1.3-alpha.4";
|
|
160743
160743
|
const userAgent2 = `QwenCode/${version3} (${process.platform}; ${process.arch})`;
|
|
160744
160744
|
const baseHeaders = {
|
|
160745
160745
|
"User-Agent": userAgent2
|
|
@@ -164752,11 +164752,11 @@ function getToolCallExamples(model) {
|
|
|
164752
164752
|
function getSubagentSystemReminder(agentTypes) {
|
|
164753
164753
|
return `<system-reminder>You have powerful specialized agents at your disposal, available agent types are: ${agentTypes.join(", ")}. PROACTIVELY use the ${ToolNames.TASK} tool to delegate user's task to appropriate agent when user's task matches agent capabilities. Ignore this message if user's task is not relevant to any agent. This message is for internal use only. Do not mention this to user in your response.</system-reminder>`;
|
|
164754
164754
|
}
|
|
164755
|
-
function getPlanModeSystemReminder() {
|
|
164755
|
+
function getPlanModeSystemReminder(planOnly = false) {
|
|
164756
164756
|
return `<system-reminder>
|
|
164757
164757
|
Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supercedes any other instructions you have received (for example, to make edits). Instead, you should:
|
|
164758
164758
|
1. Answer the user's query comprehensively
|
|
164759
|
-
2. When you're done researching, present your plan by calling the ${ToolNames.EXIT_PLAN_MODE} tool, which will prompt the user to confirm the plan. Do NOT make any file changes or run any tools that modify the system state in any way until the user has confirmed the plan.
|
|
164759
|
+
2. When you're done researching, present your plan ${planOnly ? "directly" : `by calling the ${ToolNames.EXIT_PLAN_MODE} tool, which will prompt the user to confirm the plan`}. Do NOT make any file changes or run any tools that modify the system state in any way until the user has confirmed the plan.
|
|
164760
164760
|
</system-reminder>`;
|
|
164761
164761
|
}
|
|
164762
164762
|
var generalToolCallExamples, qwenCoderToolCallExamples, qwenVlToolCallExamples;
|
|
@@ -178051,7 +178051,7 @@ var init_shell = __esm({
|
|
|
178051
178051
|
title: "Confirm Shell Command",
|
|
178052
178052
|
command: this.params.command,
|
|
178053
178053
|
rootCommand: commandsToConfirm.join(", "),
|
|
178054
|
-
onConfirm: /* @__PURE__ */ __name(async (outcome) => {
|
|
178054
|
+
onConfirm: /* @__PURE__ */ __name(async (outcome, _payload) => {
|
|
178055
178055
|
if (outcome === "proceed_always" /* ProceedAlways */) {
|
|
178056
178056
|
commandsToConfirm.forEach((command3) => this.allowlist.add(command3));
|
|
178057
178057
|
}
|
|
@@ -178848,7 +178848,7 @@ var init_coreToolScheduler = __esm({
|
|
|
178848
178848
|
);
|
|
178849
178849
|
this.setStatusInternal(reqInfo.callId, "scheduled");
|
|
178850
178850
|
} else {
|
|
178851
|
-
const shouldAutoDeny = !this.config.isInteractive() && !this.config.getIdeMode() && !this.config.getExperimentalZedIntegration()
|
|
178851
|
+
const shouldAutoDeny = !this.config.isInteractive() && !this.config.getIdeMode() && !this.config.getExperimentalZedIntegration() && this.config.getInputFormat() !== "stream-json" /* STREAM_JSON */;
|
|
178852
178852
|
if (shouldAutoDeny) {
|
|
178853
178853
|
const errorMessage = `RDMind requires permission to use "${reqInfo.name}", but that permission was declined.`;
|
|
178854
178854
|
this.setStatusInternal(
|
|
@@ -178928,19 +178928,14 @@ var init_coreToolScheduler = __esm({
|
|
|
178928
178928
|
const toolCall = this.toolCalls.find(
|
|
178929
178929
|
(c3) => c3.request.callId === callId && c3.status === "awaiting_approval"
|
|
178930
178930
|
);
|
|
178931
|
-
|
|
178932
|
-
await originalOnConfirm(outcome);
|
|
178933
|
-
}
|
|
178931
|
+
await originalOnConfirm(outcome, payload);
|
|
178934
178932
|
if (outcome === "proceed_always" /* ProceedAlways */) {
|
|
178935
178933
|
await this.autoApproveCompatiblePendingTools(signal, callId);
|
|
178936
178934
|
}
|
|
178937
178935
|
this.setToolCallOutcome(callId, outcome);
|
|
178938
178936
|
if (outcome === "cancel" /* Cancel */ || signal.aborted) {
|
|
178939
|
-
|
|
178940
|
-
|
|
178941
|
-
"cancelled",
|
|
178942
|
-
"User did not allow tool call"
|
|
178943
|
-
);
|
|
178937
|
+
const cancelMessage = payload?.cancelMessage || "User did not allow tool call";
|
|
178938
|
+
this.setStatusInternal(callId, "cancelled", cancelMessage);
|
|
178944
178939
|
} else if (outcome === "modify_with_editor" /* ModifyWithEditor */) {
|
|
178945
178940
|
const waitingToolCall = toolCall;
|
|
178946
178941
|
if (isModifiableDeclarativeTool(waitingToolCall.tool)) {
|
|
@@ -178986,7 +178981,7 @@ var init_coreToolScheduler = __esm({
|
|
|
178986
178981
|
* @private
|
|
178987
178982
|
*/
|
|
178988
178983
|
async _applyInlineModify(toolCall, payload, signal) {
|
|
178989
|
-
if (toolCall.confirmationDetails.type !== "edit" || !isModifiableDeclarativeTool(toolCall.tool)) {
|
|
178984
|
+
if (toolCall.confirmationDetails.type !== "edit" || !isModifiableDeclarativeTool(toolCall.tool) || !payload.newContent) {
|
|
178990
178985
|
return;
|
|
178991
178986
|
}
|
|
178992
178987
|
const modifyContext = toolCall.tool.getModifyContext(signal);
|
|
@@ -185714,7 +185709,9 @@ var init_client2 = __esm({
|
|
|
185714
185709
|
systemReminders.push(getSubagentSystemReminder(subagents));
|
|
185715
185710
|
}
|
|
185716
185711
|
if (this.config.getApprovalMode() === "plan" /* PLAN */) {
|
|
185717
|
-
systemReminders.push(
|
|
185712
|
+
systemReminders.push(
|
|
185713
|
+
getPlanModeSystemReminder(this.config.getSdkMode())
|
|
185714
|
+
);
|
|
185718
185715
|
}
|
|
185719
185716
|
requestToSent = [...systemReminders, ...requestToSent];
|
|
185720
185717
|
}
|
|
@@ -224711,6 +224708,13 @@ var init_subagent_manager = __esm({
|
|
|
224711
224708
|
*/
|
|
224712
224709
|
async createSubagent(config2, options2) {
|
|
224713
224710
|
this.validator.validateOrThrow(config2);
|
|
224711
|
+
if (options2.level === "session") {
|
|
224712
|
+
throw new SubagentError(
|
|
224713
|
+
`Cannot create session-level subagent "${config2.name}". Session agents are read-only and provided at runtime.`,
|
|
224714
|
+
SubagentErrorCode.INVALID_CONFIG,
|
|
224715
|
+
config2.name
|
|
224716
|
+
);
|
|
224717
|
+
}
|
|
224714
224718
|
const filePath = options2.customPath || this.getSubagentPath(config2.name, options2.level);
|
|
224715
224719
|
if (!options2.overwrite) {
|
|
224716
224720
|
try {
|
|
@@ -224757,8 +224761,17 @@ var init_subagent_manager = __esm({
|
|
|
224757
224761
|
if (level === "builtin") {
|
|
224758
224762
|
return BuiltinAgentRegistry.getBuiltinAgent(name3);
|
|
224759
224763
|
}
|
|
224764
|
+
if (level === "session") {
|
|
224765
|
+
const sessionSubagents2 = this.subagentsCache?.get("session") || [];
|
|
224766
|
+
return sessionSubagents2.find((agent) => agent.name === name3) || null;
|
|
224767
|
+
}
|
|
224760
224768
|
return this.findSubagentByNameAtLevel(name3, level);
|
|
224761
224769
|
}
|
|
224770
|
+
const sessionSubagents = this.subagentsCache?.get("session") || [];
|
|
224771
|
+
const sessionConfig = sessionSubagents.find((agent) => agent.name === name3);
|
|
224772
|
+
if (sessionConfig) {
|
|
224773
|
+
return sessionConfig;
|
|
224774
|
+
}
|
|
224762
224775
|
const projectConfig = await this.findSubagentByNameAtLevel(name3, "project");
|
|
224763
224776
|
if (projectConfig) {
|
|
224764
224777
|
return projectConfig;
|
|
@@ -224792,8 +224805,22 @@ var init_subagent_manager = __esm({
|
|
|
224792
224805
|
name3
|
|
224793
224806
|
);
|
|
224794
224807
|
}
|
|
224808
|
+
if (existing.level === "session") {
|
|
224809
|
+
throw new SubagentError(
|
|
224810
|
+
`Cannot update session-level subagent "${name3}"`,
|
|
224811
|
+
SubagentErrorCode.INVALID_CONFIG,
|
|
224812
|
+
name3
|
|
224813
|
+
);
|
|
224814
|
+
}
|
|
224795
224815
|
const updatedConfig = this.mergeConfigurations(existing, updates);
|
|
224796
224816
|
this.validator.validateOrThrow(updatedConfig);
|
|
224817
|
+
if (!existing.filePath) {
|
|
224818
|
+
throw new SubagentError(
|
|
224819
|
+
`Cannot update subagent "${name3}": no file path available`,
|
|
224820
|
+
SubagentErrorCode.FILE_ERROR,
|
|
224821
|
+
name3
|
|
224822
|
+
);
|
|
224823
|
+
}
|
|
224797
224824
|
const content = this.serializeSubagent(updatedConfig);
|
|
224798
224825
|
try {
|
|
224799
224826
|
await fs47.writeFile(existing.filePath, content, "utf8");
|
|
@@ -224824,7 +224851,7 @@ var init_subagent_manager = __esm({
|
|
|
224824
224851
|
const levelsToCheck = level ? [level] : ["project", "user"];
|
|
224825
224852
|
let deleted = false;
|
|
224826
224853
|
for (const currentLevel of levelsToCheck) {
|
|
224827
|
-
if (currentLevel === "builtin") {
|
|
224854
|
+
if (currentLevel === "builtin" || currentLevel === "session") {
|
|
224828
224855
|
continue;
|
|
224829
224856
|
}
|
|
224830
224857
|
const config2 = await this.findSubagentByNameAtLevel(name3, currentLevel);
|
|
@@ -224854,6 +224881,20 @@ var init_subagent_manager = __esm({
|
|
|
224854
224881
|
async listSubagents(options2 = {}) {
|
|
224855
224882
|
const subagents = [];
|
|
224856
224883
|
const seenNames = /* @__PURE__ */ new Set();
|
|
224884
|
+
if (this.config.getSdkMode()) {
|
|
224885
|
+
const levelsToCheck2 = options2.level ? [options2.level] : ["session"];
|
|
224886
|
+
for (const level of levelsToCheck2) {
|
|
224887
|
+
const levelSubagents = this.subagentsCache?.get(level) || [];
|
|
224888
|
+
for (const subagent of levelSubagents) {
|
|
224889
|
+
if (options2.hasTool && (!subagent.tools || !subagent.tools.includes(options2.hasTool))) {
|
|
224890
|
+
continue;
|
|
224891
|
+
}
|
|
224892
|
+
subagents.push(subagent);
|
|
224893
|
+
seenNames.add(subagent.name);
|
|
224894
|
+
}
|
|
224895
|
+
}
|
|
224896
|
+
return subagents;
|
|
224897
|
+
}
|
|
224857
224898
|
const levelsToCheck = options2.level ? [options2.level] : ["project", "user", "builtin"];
|
|
224858
224899
|
const shouldUseCache = !options2.force && this.subagentsCache !== null;
|
|
224859
224900
|
if (!shouldUseCache) {
|
|
@@ -224880,7 +224921,7 @@ var init_subagent_manager = __esm({
|
|
|
224880
224921
|
comparison = a.name.localeCompare(b.name);
|
|
224881
224922
|
break;
|
|
224882
224923
|
case "level": {
|
|
224883
|
-
const levelOrder = { project: 0, user: 1, builtin: 2 };
|
|
224924
|
+
const levelOrder = { project: 0, user: 1, builtin: 2, session: 3 };
|
|
224884
224925
|
comparison = levelOrder[a.level] - levelOrder[b.level];
|
|
224885
224926
|
break;
|
|
224886
224927
|
}
|
|
@@ -224893,6 +224934,24 @@ var init_subagent_manager = __esm({
|
|
|
224893
224934
|
}
|
|
224894
224935
|
return subagents;
|
|
224895
224936
|
}
|
|
224937
|
+
/**
|
|
224938
|
+
* Loads session-level subagents into the cache.
|
|
224939
|
+
* Session subagents are provided directly via config and are read-only.
|
|
224940
|
+
*
|
|
224941
|
+
* @param subagents - Array of session subagent configurations
|
|
224942
|
+
*/
|
|
224943
|
+
loadSessionSubagents(subagents) {
|
|
224944
|
+
if (!this.subagentsCache) {
|
|
224945
|
+
this.subagentsCache = /* @__PURE__ */ new Map();
|
|
224946
|
+
}
|
|
224947
|
+
const sessionSubagents = subagents.map((config2) => ({
|
|
224948
|
+
...config2,
|
|
224949
|
+
level: "session",
|
|
224950
|
+
filePath: `<session:${config2.name}>`
|
|
224951
|
+
}));
|
|
224952
|
+
this.subagentsCache.set("session", sessionSubagents);
|
|
224953
|
+
this.notifyChangeListeners();
|
|
224954
|
+
}
|
|
224896
224955
|
/**
|
|
224897
224956
|
* Refreshes the subagents cache by loading all subagents from disk.
|
|
224898
224957
|
* This method is called automatically when cache is null or when force=true.
|
|
@@ -225157,6 +225216,9 @@ ${config2.systemPrompt}
|
|
|
225157
225216
|
if (level === "builtin") {
|
|
225158
225217
|
return `<builtin:${name3}>`;
|
|
225159
225218
|
}
|
|
225219
|
+
if (level === "session") {
|
|
225220
|
+
return `<session:${name3}>`;
|
|
225221
|
+
}
|
|
225160
225222
|
const baseDir = level === "project" ? path52.join(
|
|
225161
225223
|
this.config.getProjectRoot(),
|
|
225162
225224
|
QWEN_CONFIG_DIR2,
|
|
@@ -225642,7 +225704,9 @@ var init_config3 = __esm({
|
|
|
225642
225704
|
toolCallCommand;
|
|
225643
225705
|
mcpServerCommand;
|
|
225644
225706
|
mcpServers;
|
|
225707
|
+
sessionSubagents;
|
|
225645
225708
|
userMemory;
|
|
225709
|
+
sdkMode;
|
|
225646
225710
|
geminiMdFileCount;
|
|
225647
225711
|
approvalMode;
|
|
225648
225712
|
showMemoryUsage;
|
|
@@ -225726,6 +225790,8 @@ var init_config3 = __esm({
|
|
|
225726
225790
|
this.toolCallCommand = params.toolCallCommand;
|
|
225727
225791
|
this.mcpServerCommand = params.mcpServerCommand;
|
|
225728
225792
|
this.mcpServers = params.mcpServers;
|
|
225793
|
+
this.sessionSubagents = params.sessionSubagents ?? [];
|
|
225794
|
+
this.sdkMode = params.sdkMode ?? false;
|
|
225729
225795
|
this.userMemory = params.userMemory ?? "";
|
|
225730
225796
|
this.geminiMdFileCount = params.geminiMdFileCount ?? 0;
|
|
225731
225797
|
this.approvalMode = params.approvalMode ?? "default" /* DEFAULT */;
|
|
@@ -225785,7 +225851,7 @@ var init_config3 = __esm({
|
|
|
225785
225851
|
this.webSearch = params.webSearch;
|
|
225786
225852
|
this.useRipgrep = params.useRipgrep ?? true;
|
|
225787
225853
|
this.useBuiltinRipgrep = params.useBuiltinRipgrep ?? true;
|
|
225788
|
-
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ??
|
|
225854
|
+
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? true;
|
|
225789
225855
|
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? true;
|
|
225790
225856
|
this.shellExecutionConfig = {
|
|
225791
225857
|
terminalWidth: params.shellExecutionConfig?.terminalWidth ?? 80,
|
|
@@ -225829,6 +225895,9 @@ var init_config3 = __esm({
|
|
|
225829
225895
|
}
|
|
225830
225896
|
this.promptRegistry = new PromptRegistry();
|
|
225831
225897
|
this.subagentManager = new SubagentManager(this);
|
|
225898
|
+
if (this.sessionSubagents.length > 0) {
|
|
225899
|
+
this.subagentManager.loadSessionSubagents(this.sessionSubagents);
|
|
225900
|
+
}
|
|
225832
225901
|
this.toolRegistry = await this.createToolRegistry();
|
|
225833
225902
|
await this.geminiClient.initialize();
|
|
225834
225903
|
logStartSession(this, new StartSessionEvent(this));
|
|
@@ -225999,6 +226068,27 @@ var init_config3 = __esm({
|
|
|
225999
226068
|
getMcpServers() {
|
|
226000
226069
|
return this.mcpServers;
|
|
226001
226070
|
}
|
|
226071
|
+
addMcpServers(servers) {
|
|
226072
|
+
if (this.initialized) {
|
|
226073
|
+
throw new Error("Cannot modify mcpServers after initialization");
|
|
226074
|
+
}
|
|
226075
|
+
this.mcpServers = { ...this.mcpServers, ...servers };
|
|
226076
|
+
}
|
|
226077
|
+
getSessionSubagents() {
|
|
226078
|
+
return this.sessionSubagents;
|
|
226079
|
+
}
|
|
226080
|
+
setSessionSubagents(subagents) {
|
|
226081
|
+
if (this.initialized) {
|
|
226082
|
+
throw new Error("Cannot modify sessionSubagents after initialization");
|
|
226083
|
+
}
|
|
226084
|
+
this.sessionSubagents = subagents;
|
|
226085
|
+
}
|
|
226086
|
+
getSdkMode() {
|
|
226087
|
+
return this.sdkMode;
|
|
226088
|
+
}
|
|
226089
|
+
setSdkMode(value) {
|
|
226090
|
+
this.sdkMode = value;
|
|
226091
|
+
}
|
|
226002
226092
|
getUserMemory() {
|
|
226003
226093
|
return this.userMemory;
|
|
226004
226094
|
}
|
|
@@ -226341,7 +226431,7 @@ var init_config3 = __esm({
|
|
|
226341
226431
|
registerCoreTool(ShellTool, this);
|
|
226342
226432
|
registerCoreTool(MemoryTool);
|
|
226343
226433
|
registerCoreTool(TodoWriteTool, this);
|
|
226344
|
-
registerCoreTool(ExitPlanModeTool, this);
|
|
226434
|
+
!this.sdkMode && registerCoreTool(ExitPlanModeTool, this);
|
|
226345
226435
|
registerCoreTool(WebFetchTool, this);
|
|
226346
226436
|
registerCoreTool(ReadKnowledgeExtTool);
|
|
226347
226437
|
registerCoreTool(ListKnowledgeExtTool);
|
|
@@ -235608,8 +235698,8 @@ var init_git_commit = __esm({
|
|
|
235608
235698
|
"packages/core/src/generated/git-commit.ts"() {
|
|
235609
235699
|
"use strict";
|
|
235610
235700
|
init_esbuild_shims();
|
|
235611
|
-
GIT_COMMIT_INFO = "
|
|
235612
|
-
CLI_VERSION = "0.1.3-alpha.
|
|
235701
|
+
GIT_COMMIT_INFO = "30365ed6";
|
|
235702
|
+
CLI_VERSION = "0.1.3-alpha.4";
|
|
235613
235703
|
}
|
|
235614
235704
|
});
|
|
235615
235705
|
|
|
@@ -259932,7 +260022,7 @@ var require_backend = __commonJS({
|
|
|
259932
260022
|
return function() {
|
|
259933
260023
|
};
|
|
259934
260024
|
}, "useCacheRefresh"),
|
|
259935
|
-
useCallback: /* @__PURE__ */ __name(function
|
|
260025
|
+
useCallback: /* @__PURE__ */ __name(function useCallback52(a) {
|
|
259936
260026
|
var b = C();
|
|
259937
260027
|
x2.push({
|
|
259938
260028
|
primitive: "Callback",
|
|
@@ -260026,7 +260116,7 @@ var require_backend = __commonJS({
|
|
|
260026
260116
|
});
|
|
260027
260117
|
return a;
|
|
260028
260118
|
}, "useRef"),
|
|
260029
|
-
useState: /* @__PURE__ */ __name(function
|
|
260119
|
+
useState: /* @__PURE__ */ __name(function useState66(a) {
|
|
260030
260120
|
var b = C();
|
|
260031
260121
|
a = null !== b ? b.memoizedState : "function" === typeof a ? a() : a;
|
|
260032
260122
|
x2.push({
|
|
@@ -276143,8 +276233,8 @@ var init_settingsSchema = __esm({
|
|
|
276143
276233
|
label: "Enable Interactive Shell",
|
|
276144
276234
|
category: "Tools",
|
|
276145
276235
|
requiresRestart: true,
|
|
276146
|
-
default:
|
|
276147
|
-
description: "Use node-pty for an interactive shell experience. Fallback to child_process still applies.",
|
|
276236
|
+
default: true,
|
|
276237
|
+
description: "Use node-pty for an interactive shell experience. Allows input to interactive commands (e.g., sudo password prompts). Fallback to child_process still applies.",
|
|
276148
276238
|
showInDialog: true
|
|
276149
276239
|
},
|
|
276150
276240
|
pager: {
|
|
@@ -306617,7 +306707,6 @@ var init_en3 = __esm({
|
|
|
306617
306707
|
"open full RDMind documentation in your browser": "open full RDMind documentation in your browser",
|
|
306618
306708
|
"Configuration not available.": "Configuration not available.",
|
|
306619
306709
|
"change the auth method": "change the auth method",
|
|
306620
|
-
"Show quit confirmation dialog": "Show quit confirmation dialog",
|
|
306621
306710
|
"Copy the last result or code snippet to clipboard": "Copy the last result or code snippet to clipboard",
|
|
306622
306711
|
// ============================================================================
|
|
306623
306712
|
// Commands - Agents
|
|
@@ -307041,14 +307130,6 @@ var init_en3 = __esm({
|
|
|
307041
307130
|
"Shell Command Execution": "Shell Command Execution",
|
|
307042
307131
|
"A custom command wants to run the following shell commands:": "A custom command wants to run the following shell commands:",
|
|
307043
307132
|
// ============================================================================
|
|
307044
|
-
// Dialogs - Quit Confirmation
|
|
307045
|
-
// ============================================================================
|
|
307046
|
-
"What would you like to do before exiting?": "What would you like to do before exiting?",
|
|
307047
|
-
"Quit immediately (/quit)": "Quit immediately (/quit)",
|
|
307048
|
-
"Generate summary and quit (/summary)": "Generate summary and quit (/summary)",
|
|
307049
|
-
"Save conversation and quit (/chat save)": "Save conversation and quit (/chat save)",
|
|
307050
|
-
"Cancel (stay in application)": "Cancel (stay in application)",
|
|
307051
|
-
// ============================================================================
|
|
307052
307133
|
// Dialogs - Pro Quota
|
|
307053
307134
|
// ============================================================================
|
|
307054
307135
|
"Pro quota limit reached for {{model}}.": "Pro quota limit reached for {{model}}.",
|
|
@@ -307471,12 +307552,11 @@ var init_zh = __esm({
|
|
|
307471
307552
|
'Theme "{{themeName}}" not found.': '\u672A\u627E\u5230\u4E3B\u9898 "{{themeName}}"\u3002',
|
|
307472
307553
|
'Theme "{{themeName}}" not found in selected scope.': '\u5728\u6240\u9009\u4F5C\u7528\u57DF\u4E2D\u672A\u627E\u5230\u4E3B\u9898 "{{themeName}}"\u3002',
|
|
307473
307554
|
"clear the screen and conversation history": "\u6E05\u5C4F\u5E76\u6E05\u9664\u5BF9\u8BDD\u5386\u53F2",
|
|
307474
|
-
"Clear conversation history and free up context": "\u6E05\u9664\u5BF9\u8BDD\u5386\u53F2
|
|
307555
|
+
"Clear conversation history and free up context": "\u6E05\u9664\u5BF9\u8BDD\u5386\u53F2",
|
|
307475
307556
|
"Compresses the context by replacing it with a summary.": "\u901A\u8FC7\u7528\u6458\u8981\u66FF\u6362\u6765\u538B\u7F29\u4E0A\u4E0B\u6587",
|
|
307476
307557
|
"open full RDMind documentation in your browser": "\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u5B8C\u6574\u7684 RDMind \u6587\u6863",
|
|
307477
307558
|
"Configuration not available.": "\u914D\u7F6E\u4E0D\u53EF\u7528",
|
|
307478
307559
|
"change the auth method": "\u66F4\u6539\u8BA4\u8BC1\u65B9\u6CD5",
|
|
307479
|
-
"Show quit confirmation dialog": "\u663E\u793A\u9000\u51FA\u786E\u8BA4\u5BF9\u8BDD\u6846",
|
|
307480
307560
|
"Copy the last result or code snippet to clipboard": "\u5C06\u6700\u540E\u7684\u7ED3\u679C\u6216\u4EE3\u7801\u7247\u6BB5\u590D\u5236\u5230\u526A\u8D34\u677F",
|
|
307481
307561
|
// ============================================================================
|
|
307482
307562
|
// Commands - Agents
|
|
@@ -307900,14 +307980,6 @@ var init_zh = __esm({
|
|
|
307900
307980
|
"Shell Command Execution": "Shell \u547D\u4EE4\u6267\u884C",
|
|
307901
307981
|
"A custom command wants to run the following shell commands:": "\u81EA\u5B9A\u4E49\u547D\u4EE4\u60F3\u8981\u8FD0\u884C\u4EE5\u4E0B shell \u547D\u4EE4\uFF1A",
|
|
307902
307982
|
// ============================================================================
|
|
307903
|
-
// Dialogs - Quit Confirmation
|
|
307904
|
-
// ============================================================================
|
|
307905
|
-
"What would you like to do before exiting?": "\u9000\u51FA\u524D\u60A8\u60F3\u8981\u505A\u4EC0\u4E48\uFF1F",
|
|
307906
|
-
"Quit immediately (/quit)": "\u7ACB\u5373\u9000\u51FA (/quit)",
|
|
307907
|
-
"Generate summary and quit (/summary)": "\u751F\u6210\u6458\u8981\u5E76\u9000\u51FA (/summary)",
|
|
307908
|
-
"Save conversation and quit (/chat save)": "\u4FDD\u5B58\u5BF9\u8BDD\u5E76\u9000\u51FA (/chat save)",
|
|
307909
|
-
"Cancel (stay in application)": "\u53D6\u6D88\uFF08\u7559\u5728\u5E94\u7528\u7A0B\u5E8F\u4E2D\uFF09",
|
|
307910
|
-
// ============================================================================
|
|
307911
307983
|
// Dialogs - Pro Quota
|
|
307912
307984
|
// ============================================================================
|
|
307913
307985
|
"Pro quota limit reached for {{model}}.": "{{model}} \u7684 Pro \u914D\u989D\u5DF2\u8FBE\u5230\u4E0A\u9650",
|
|
@@ -340140,7 +340212,7 @@ var measureElement = /* @__PURE__ */ __name((node) => ({
|
|
|
340140
340212
|
var measure_element_default = measureElement;
|
|
340141
340213
|
|
|
340142
340214
|
// packages/cli/src/gemini.tsx
|
|
340143
|
-
var
|
|
340215
|
+
var import_react136 = __toESM(require_react(), 1);
|
|
340144
340216
|
import dns from "node:dns";
|
|
340145
340217
|
import os48 from "node:os";
|
|
340146
340218
|
import { basename as basename19 } from "node:path";
|
|
@@ -346095,7 +346167,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
346095
346167
|
// packages/cli/src/utils/version.ts
|
|
346096
346168
|
async function getCliVersion() {
|
|
346097
346169
|
const pkgJson = await getPackageJson();
|
|
346098
|
-
return "0.1.3-alpha.
|
|
346170
|
+
return "0.1.3-alpha.4";
|
|
346099
346171
|
}
|
|
346100
346172
|
__name(getCliVersion, "getCliVersion");
|
|
346101
346173
|
|
|
@@ -349092,6 +349164,28 @@ async function parseArguments(settings) {
|
|
|
349092
349164
|
}).option("resume", {
|
|
349093
349165
|
type: "string",
|
|
349094
349166
|
description: "Resume a specific session by its ID. Use without an ID to show session picker."
|
|
349167
|
+
}).option("max-session-turns", {
|
|
349168
|
+
type: "number",
|
|
349169
|
+
description: "Maximum number of session turns"
|
|
349170
|
+
}).option("core-tools", {
|
|
349171
|
+
type: "array",
|
|
349172
|
+
string: true,
|
|
349173
|
+
description: "Core tool paths",
|
|
349174
|
+
coerce: /* @__PURE__ */ __name((tools) => tools.flatMap((tool) => tool.split(",").map((t4) => t4.trim())), "coerce")
|
|
349175
|
+
}).option("exclude-tools", {
|
|
349176
|
+
type: "array",
|
|
349177
|
+
string: true,
|
|
349178
|
+
description: "Tools to exclude",
|
|
349179
|
+
coerce: /* @__PURE__ */ __name((tools) => tools.flatMap((tool) => tool.split(",").map((t4) => t4.trim())), "coerce")
|
|
349180
|
+
}).option("allowed-tools", {
|
|
349181
|
+
type: "array",
|
|
349182
|
+
string: true,
|
|
349183
|
+
description: "Tools to allow, will bypass confirmation",
|
|
349184
|
+
coerce: /* @__PURE__ */ __name((tools) => tools.flatMap((tool) => tool.split(",").map((t4) => t4.trim())), "coerce")
|
|
349185
|
+
}).option("auth-type", {
|
|
349186
|
+
type: "string",
|
|
349187
|
+
choices: ["openai" /* USE_OPENAI */, "qwen-oauth" /* QWEN_OAUTH */],
|
|
349188
|
+
description: "Authentication type"
|
|
349095
349189
|
}).deprecateOption(
|
|
349096
349190
|
"show-memory-usage",
|
|
349097
349191
|
'Use the "ui.showMemoryUsage" setting in settings.json instead. This flag will be removed in a future version.'
|
|
@@ -349292,7 +349386,7 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, a
|
|
|
349292
349386
|
interactive = false;
|
|
349293
349387
|
}
|
|
349294
349388
|
const extraExcludes = [];
|
|
349295
|
-
if (!interactive && !argv.experimentalAcp) {
|
|
349389
|
+
if (!interactive && !argv.experimentalAcp && inputFormat !== "stream-json" /* STREAM_JSON */) {
|
|
349296
349390
|
switch (approvalMode) {
|
|
349297
349391
|
case "plan" /* PLAN */:
|
|
349298
349392
|
case "default" /* DEFAULT */:
|
|
@@ -349310,7 +349404,8 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, a
|
|
|
349310
349404
|
const excludeTools = mergeExcludeTools(
|
|
349311
349405
|
settings,
|
|
349312
349406
|
activeExtensions,
|
|
349313
|
-
extraExcludes.length > 0 ? extraExcludes : void 0
|
|
349407
|
+
extraExcludes.length > 0 ? extraExcludes : void 0,
|
|
349408
|
+
argv.excludeTools
|
|
349314
349409
|
);
|
|
349315
349410
|
const blockedMcpServers = [];
|
|
349316
349411
|
if (!argv.allowedMcpServerNames) {
|
|
@@ -349373,7 +349468,7 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, a
|
|
|
349373
349468
|
debugMode,
|
|
349374
349469
|
question,
|
|
349375
349470
|
fullContext: argv.allFiles || false,
|
|
349376
|
-
coreTools: settings.tools?.core || void 0,
|
|
349471
|
+
coreTools: argv.coreTools || settings.tools?.core || void 0,
|
|
349377
349472
|
allowedTools: argv.allowedTools || settings.tools?.allowed || void 0,
|
|
349378
349473
|
excludeTools,
|
|
349379
349474
|
toolDiscoveryCommand: settings.tools?.discoveryCommand,
|
|
@@ -349399,13 +349494,13 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, a
|
|
|
349399
349494
|
model: resolvedModel,
|
|
349400
349495
|
extensionContextFilePaths,
|
|
349401
349496
|
sessionTokenLimit: settings.model?.sessionTokenLimit ?? -1,
|
|
349402
|
-
maxSessionTurns: settings.model?.maxSessionTurns ?? -1,
|
|
349497
|
+
maxSessionTurns: argv.maxSessionTurns ?? settings.model?.maxSessionTurns ?? -1,
|
|
349403
349498
|
experimentalZedIntegration: argv.experimentalAcp || false,
|
|
349404
349499
|
listExtensions: argv.listExtensions || false,
|
|
349405
349500
|
extensions: allExtensions,
|
|
349406
349501
|
blockedMcpServers,
|
|
349407
349502
|
noBrowser: !!process.env["NO_BROWSER"],
|
|
349408
|
-
authType: settings.security?.auth?.selectedType,
|
|
349503
|
+
authType: argv.authType || settings.security?.auth?.selectedType,
|
|
349409
349504
|
inputFormat,
|
|
349410
349505
|
outputFormat,
|
|
349411
349506
|
includePartialMessages,
|
|
@@ -349501,8 +349596,9 @@ function mergeMcpServers(settings, extensions) {
|
|
|
349501
349596
|
return mcpServers;
|
|
349502
349597
|
}
|
|
349503
349598
|
__name(mergeMcpServers, "mergeMcpServers");
|
|
349504
|
-
function mergeExcludeTools(settings, extensions, extraExcludes) {
|
|
349599
|
+
function mergeExcludeTools(settings, extensions, extraExcludes, cliExcludeTools) {
|
|
349505
349600
|
const allExcludeTools = /* @__PURE__ */ new Set([
|
|
349601
|
+
...cliExcludeTools || [],
|
|
349506
349602
|
...settings.tools?.exclude || [],
|
|
349507
349603
|
...extraExcludes || []
|
|
349508
349604
|
]);
|
|
@@ -352438,7 +352534,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
352438
352534
|
|
|
352439
352535
|
// packages/cli/src/generated/git-commit.ts
|
|
352440
352536
|
init_esbuild_shims();
|
|
352441
|
-
var GIT_COMMIT_INFO2 = "
|
|
352537
|
+
var GIT_COMMIT_INFO2 = "30365ed6";
|
|
352442
352538
|
|
|
352443
352539
|
// packages/cli/src/utils/systemInfo.ts
|
|
352444
352540
|
async function getNpmVersion() {
|
|
@@ -356317,33 +356413,6 @@ var modelCommand = {
|
|
|
356317
356413
|
|
|
356318
356414
|
// packages/cli/src/ui/commands/quitCommand.ts
|
|
356319
356415
|
init_esbuild_shims();
|
|
356320
|
-
var quitConfirmCommand = {
|
|
356321
|
-
name: "quit-confirm",
|
|
356322
|
-
get description() {
|
|
356323
|
-
return t3("Show quit confirmation dialog");
|
|
356324
|
-
},
|
|
356325
|
-
kind: "built-in" /* BUILT_IN */,
|
|
356326
|
-
action: /* @__PURE__ */ __name((context2) => {
|
|
356327
|
-
const now = Date.now();
|
|
356328
|
-
const { sessionStartTime } = context2.session.stats;
|
|
356329
|
-
const wallDuration = now - sessionStartTime.getTime();
|
|
356330
|
-
return {
|
|
356331
|
-
type: "quit_confirmation",
|
|
356332
|
-
messages: [
|
|
356333
|
-
{
|
|
356334
|
-
type: "user",
|
|
356335
|
-
text: `/quit-confirm`,
|
|
356336
|
-
id: now - 1
|
|
356337
|
-
},
|
|
356338
|
-
{
|
|
356339
|
-
type: "quit_confirmation",
|
|
356340
|
-
duration: formatDuration(wallDuration),
|
|
356341
|
-
id: now
|
|
356342
|
-
}
|
|
356343
|
-
]
|
|
356344
|
-
};
|
|
356345
|
-
}, "action")
|
|
356346
|
-
};
|
|
356347
356416
|
var quitCommand = {
|
|
356348
356417
|
name: "quit",
|
|
356349
356418
|
altNames: ["exit"],
|
|
@@ -358977,7 +359046,6 @@ var BuiltinCommandLoader = class {
|
|
|
358977
359046
|
memoryCommand,
|
|
358978
359047
|
modelCommand,
|
|
358979
359048
|
quitCommand,
|
|
358980
|
-
quitConfirmCommand,
|
|
358981
359049
|
restoreCommand(this.config),
|
|
358982
359050
|
statsCommand,
|
|
358983
359051
|
summaryCommand,
|
|
@@ -359172,7 +359240,7 @@ async function buildSystemMessage(config2, sessionId, permissionMode) {
|
|
|
359172
359240
|
tools,
|
|
359173
359241
|
mcp_servers: mcpServerList,
|
|
359174
359242
|
model: config2.getModel(),
|
|
359175
|
-
permissionMode,
|
|
359243
|
+
permission_mode: permissionMode,
|
|
359176
359244
|
slash_commands: slashCommands,
|
|
359177
359245
|
qwen_code_version: config2.getCliVersion() || "unknown",
|
|
359178
359246
|
agents: agentNames
|
|
@@ -359678,6 +359746,16 @@ ${event.value}`, null);
|
|
|
359678
359746
|
}
|
|
359679
359747
|
this.finalizePendingBlocks(state, null);
|
|
359680
359748
|
break;
|
|
359749
|
+
case "error" /* Error */: {
|
|
359750
|
+
const errorText = parseAndFormatApiError(
|
|
359751
|
+
event.value.error,
|
|
359752
|
+
this.config.getContentGeneratorConfig()?.authType,
|
|
359753
|
+
void 0,
|
|
359754
|
+
this.config.getModel()
|
|
359755
|
+
);
|
|
359756
|
+
this.appendText(state, errorText, null);
|
|
359757
|
+
break;
|
|
359758
|
+
}
|
|
359681
359759
|
default:
|
|
359682
359760
|
break;
|
|
359683
359761
|
}
|
|
@@ -359934,14 +360012,30 @@ ${event.value}`, null);
|
|
|
359934
360012
|
};
|
|
359935
360013
|
this.emitMessageImpl(message);
|
|
359936
360014
|
}
|
|
360015
|
+
/**
|
|
360016
|
+
* Checks if responseParts contain any functionResponse with an error.
|
|
360017
|
+
* This handles cancelled responses and other error cases where the error
|
|
360018
|
+
* is embedded in responseParts rather than the top-level error field.
|
|
360019
|
+
* @param responseParts - Array of Part objects
|
|
360020
|
+
* @returns Error message if found, undefined otherwise
|
|
360021
|
+
*/
|
|
360022
|
+
checkResponsePartsForError(responseParts) {
|
|
360023
|
+
return checkResponsePartsForError(responseParts);
|
|
360024
|
+
}
|
|
359937
360025
|
/**
|
|
359938
360026
|
* Emits a tool result message.
|
|
359939
360027
|
* Collects execution denied tool calls for inclusion in result messages.
|
|
360028
|
+
* Handles both explicit errors (response.error) and errors embedded in
|
|
360029
|
+
* responseParts (e.g., cancelled responses).
|
|
359940
360030
|
* @param request - Tool call request info
|
|
359941
360031
|
* @param response - Tool call response info
|
|
359942
360032
|
* @param parentToolUseId - Parent tool use ID (null for main agent)
|
|
359943
360033
|
*/
|
|
359944
360034
|
emitToolResult(request4, response, parentToolUseId = null) {
|
|
360035
|
+
const responsePartsError = this.checkResponsePartsForError(
|
|
360036
|
+
response.responseParts
|
|
360037
|
+
);
|
|
360038
|
+
const hasError = Boolean(response.error) || Boolean(responsePartsError);
|
|
359945
360039
|
if (response.error && response.errorType === "execution_denied" /* EXECUTION_DENIED */) {
|
|
359946
360040
|
const denial = {
|
|
359947
360041
|
tool_name: request4.name,
|
|
@@ -359953,7 +360047,7 @@ ${event.value}`, null);
|
|
|
359953
360047
|
const block2 = {
|
|
359954
360048
|
type: "tool_result",
|
|
359955
360049
|
tool_use_id: request4.callId,
|
|
359956
|
-
is_error:
|
|
360050
|
+
is_error: hasError
|
|
359957
360051
|
};
|
|
359958
360052
|
const content = toolResultContent(response);
|
|
359959
360053
|
if (content !== void 0) {
|
|
@@ -360092,10 +360186,27 @@ function partsToContentBlock(parts) {
|
|
|
360092
360186
|
return blocks;
|
|
360093
360187
|
}
|
|
360094
360188
|
__name(partsToContentBlock, "partsToContentBlock");
|
|
360189
|
+
function checkResponsePartsForError(responseParts) {
|
|
360190
|
+
if (!responseParts || responseParts.length === 0) {
|
|
360191
|
+
return void 0;
|
|
360192
|
+
}
|
|
360193
|
+
for (const part of responseParts) {
|
|
360194
|
+
if ("functionResponse" in part && part.functionResponse?.response && typeof part.functionResponse.response === "object" && "error" in part.functionResponse.response && part.functionResponse.response["error"]) {
|
|
360195
|
+
const error2 = part.functionResponse.response["error"];
|
|
360196
|
+
return typeof error2 === "string" ? error2 : String(error2);
|
|
360197
|
+
}
|
|
360198
|
+
}
|
|
360199
|
+
return void 0;
|
|
360200
|
+
}
|
|
360201
|
+
__name(checkResponsePartsForError, "checkResponsePartsForError");
|
|
360095
360202
|
function toolResultContent(response) {
|
|
360096
360203
|
if (response.error) {
|
|
360097
360204
|
return response.error.message;
|
|
360098
360205
|
}
|
|
360206
|
+
const responsePartsError = checkResponsePartsForError(response.responseParts);
|
|
360207
|
+
if (responsePartsError) {
|
|
360208
|
+
return responsePartsError;
|
|
360209
|
+
}
|
|
360099
360210
|
if (typeof response.resultDisplay === "string" && response.resultDisplay.trim().length > 0) {
|
|
360100
360211
|
return response.resultDisplay;
|
|
360101
360212
|
}
|
|
@@ -361681,6 +361792,15 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
|
|
|
361681
361792
|
process.stdout.write(event.value);
|
|
361682
361793
|
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
361683
361794
|
toolCallRequests.push(event.value);
|
|
361795
|
+
} else if (event.type === "error" /* Error */) {
|
|
361796
|
+
const errorText = parseAndFormatApiError(
|
|
361797
|
+
event.value.error,
|
|
361798
|
+
config2.getContentGeneratorConfig()?.authType,
|
|
361799
|
+
void 0,
|
|
361800
|
+
config2.getModel()
|
|
361801
|
+
);
|
|
361802
|
+
process.stderr.write(`${errorText}
|
|
361803
|
+
`);
|
|
361684
361804
|
}
|
|
361685
361805
|
}
|
|
361686
361806
|
}
|
|
@@ -361692,6 +361812,8 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
|
|
|
361692
361812
|
const toolResponseParts = [];
|
|
361693
361813
|
for (const requestInfo of toolCallRequests) {
|
|
361694
361814
|
const finalRequestInfo = requestInfo;
|
|
361815
|
+
const inputFormat = typeof config2.getInputFormat === "function" ? config2.getInputFormat() : "text" /* TEXT */;
|
|
361816
|
+
const toolCallUpdateCallback = inputFormat === "stream-json" /* STREAM_JSON */ && options2.controlService ? options2.controlService.permission.getToolCallUpdateCallback() : void 0;
|
|
361695
361817
|
const isTaskTool = finalRequestInfo.name === "task";
|
|
361696
361818
|
const taskToolProgress = isTaskTool ? createTaskToolProgressHandler(
|
|
361697
361819
|
config2,
|
|
@@ -361704,12 +361826,10 @@ async function runNonInteractive(config2, settings, input, prompt_id, options2 =
|
|
|
361704
361826
|
finalRequestInfo,
|
|
361705
361827
|
abortController.signal,
|
|
361706
361828
|
isTaskTool && taskToolProgressHandler ? {
|
|
361707
|
-
outputUpdateHandler: taskToolProgressHandler
|
|
361708
|
-
|
|
361709
|
-
|
|
361710
|
-
|
|
361711
|
-
: undefined,
|
|
361712
|
-
*/
|
|
361829
|
+
outputUpdateHandler: taskToolProgressHandler,
|
|
361830
|
+
onToolCallsUpdate: toolCallUpdateCallback
|
|
361831
|
+
} : toolCallUpdateCallback ? {
|
|
361832
|
+
onToolCallsUpdate: toolCallUpdateCallback
|
|
361713
361833
|
} : void 0
|
|
361714
361834
|
);
|
|
361715
361835
|
if (toolResponse.error) {
|
|
@@ -361991,10 +362111,57 @@ var SystemController = class extends BaseController {
|
|
|
361991
362111
|
* Registers SDK MCP servers and returns capabilities
|
|
361992
362112
|
*/
|
|
361993
362113
|
async handleInitialize(payload) {
|
|
361994
|
-
|
|
361995
|
-
|
|
362114
|
+
this.context.config.setSdkMode(true);
|
|
362115
|
+
if (payload.sdkMcpServers && typeof payload.sdkMcpServers === "object") {
|
|
362116
|
+
for (const serverName of Object.keys(payload.sdkMcpServers)) {
|
|
361996
362117
|
this.context.sdkMcpServers.add(serverName);
|
|
361997
362118
|
}
|
|
362119
|
+
try {
|
|
362120
|
+
this.context.config.addMcpServers(payload.sdkMcpServers);
|
|
362121
|
+
if (this.context.debugMode) {
|
|
362122
|
+
console.error(
|
|
362123
|
+
`[SystemController] Added ${Object.keys(payload.sdkMcpServers).length} SDK MCP servers to config`
|
|
362124
|
+
);
|
|
362125
|
+
}
|
|
362126
|
+
} catch (error2) {
|
|
362127
|
+
if (this.context.debugMode) {
|
|
362128
|
+
console.error(
|
|
362129
|
+
"[SystemController] Failed to add SDK MCP servers:",
|
|
362130
|
+
error2
|
|
362131
|
+
);
|
|
362132
|
+
}
|
|
362133
|
+
}
|
|
362134
|
+
}
|
|
362135
|
+
if (payload.mcpServers && typeof payload.mcpServers === "object") {
|
|
362136
|
+
try {
|
|
362137
|
+
this.context.config.addMcpServers(payload.mcpServers);
|
|
362138
|
+
if (this.context.debugMode) {
|
|
362139
|
+
console.error(
|
|
362140
|
+
`[SystemController] Added ${Object.keys(payload.mcpServers).length} MCP servers to config`
|
|
362141
|
+
);
|
|
362142
|
+
}
|
|
362143
|
+
} catch (error2) {
|
|
362144
|
+
if (this.context.debugMode) {
|
|
362145
|
+
console.error("[SystemController] Failed to add MCP servers:", error2);
|
|
362146
|
+
}
|
|
362147
|
+
}
|
|
362148
|
+
}
|
|
362149
|
+
if (payload.agents && Array.isArray(payload.agents)) {
|
|
362150
|
+
try {
|
|
362151
|
+
this.context.config.setSessionSubagents(payload.agents);
|
|
362152
|
+
if (this.context.debugMode) {
|
|
362153
|
+
console.error(
|
|
362154
|
+
`[SystemController] Added ${payload.agents.length} session subagents to config`
|
|
362155
|
+
);
|
|
362156
|
+
}
|
|
362157
|
+
} catch (error2) {
|
|
362158
|
+
if (this.context.debugMode) {
|
|
362159
|
+
console.error(
|
|
362160
|
+
"[SystemController] Failed to add session subagents:",
|
|
362161
|
+
error2
|
|
362162
|
+
);
|
|
362163
|
+
}
|
|
362164
|
+
}
|
|
361998
362165
|
}
|
|
361999
362166
|
const capabilities = this.buildControlCapabilities();
|
|
362000
362167
|
if (this.context.debugMode) {
|
|
@@ -362017,29 +362184,12 @@ var SystemController = class extends BaseController {
|
|
|
362017
362184
|
buildControlCapabilities() {
|
|
362018
362185
|
const capabilities = {
|
|
362019
362186
|
can_handle_can_use_tool: true,
|
|
362020
|
-
can_handle_hook_callback:
|
|
362187
|
+
can_handle_hook_callback: false,
|
|
362021
362188
|
can_set_permission_mode: typeof this.context.config.setApprovalMode === "function",
|
|
362022
|
-
can_set_model: typeof this.context.config.setModel === "function"
|
|
362189
|
+
can_set_model: typeof this.context.config.setModel === "function",
|
|
362190
|
+
/* TODO: sdkMcpServers support */
|
|
362191
|
+
can_handle_mcp_message: false
|
|
362023
362192
|
};
|
|
362024
|
-
try {
|
|
362025
|
-
const mcpProvider = this.context.config;
|
|
362026
|
-
if (typeof mcpProvider.getMcpServers === "function") {
|
|
362027
|
-
const servers = mcpProvider.getMcpServers();
|
|
362028
|
-
capabilities["can_handle_mcp_message"] = Boolean(
|
|
362029
|
-
servers && Object.keys(servers).length > 0
|
|
362030
|
-
);
|
|
362031
|
-
} else {
|
|
362032
|
-
capabilities["can_handle_mcp_message"] = false;
|
|
362033
|
-
}
|
|
362034
|
-
} catch (error2) {
|
|
362035
|
-
if (this.context.debugMode) {
|
|
362036
|
-
console.error(
|
|
362037
|
-
"[SystemController] Failed to determine MCP capability:",
|
|
362038
|
-
error2
|
|
362039
|
-
);
|
|
362040
|
-
}
|
|
362041
|
-
capabilities["can_handle_mcp_message"] = false;
|
|
362042
|
-
}
|
|
362043
362193
|
return capabilities;
|
|
362044
362194
|
}
|
|
362045
362195
|
/**
|
|
@@ -362094,28 +362244,378 @@ var SystemController = class extends BaseController {
|
|
|
362094
362244
|
/**
|
|
362095
362245
|
* Handle supported_commands request
|
|
362096
362246
|
*
|
|
362097
|
-
* Returns list of supported
|
|
362098
|
-
*
|
|
362099
|
-
* Note: This list should match the ControlRequestType enum in
|
|
362100
|
-
* packages/sdk/typescript/src/types/controlRequests.ts
|
|
362247
|
+
* Returns list of supported slash commands loaded dynamically
|
|
362101
362248
|
*/
|
|
362102
362249
|
async handleSupportedCommands() {
|
|
362103
|
-
const
|
|
362104
|
-
"initialize",
|
|
362105
|
-
"interrupt",
|
|
362106
|
-
"set_model",
|
|
362107
|
-
"supported_commands",
|
|
362108
|
-
"can_use_tool",
|
|
362109
|
-
"set_permission_mode",
|
|
362110
|
-
"mcp_message",
|
|
362111
|
-
"mcp_server_status",
|
|
362112
|
-
"hook_callback"
|
|
362113
|
-
];
|
|
362250
|
+
const slashCommands = await this.loadSlashCommandNames();
|
|
362114
362251
|
return {
|
|
362115
362252
|
subtype: "supported_commands",
|
|
362116
|
-
commands
|
|
362253
|
+
commands: slashCommands
|
|
362254
|
+
};
|
|
362255
|
+
}
|
|
362256
|
+
/**
|
|
362257
|
+
* Load slash command names using CommandService
|
|
362258
|
+
*
|
|
362259
|
+
* @returns Promise resolving to array of slash command names
|
|
362260
|
+
*/
|
|
362261
|
+
async loadSlashCommandNames() {
|
|
362262
|
+
const controller = new AbortController();
|
|
362263
|
+
try {
|
|
362264
|
+
const service = await CommandService.create(
|
|
362265
|
+
[new BuiltinCommandLoader(this.context.config)],
|
|
362266
|
+
controller.signal
|
|
362267
|
+
);
|
|
362268
|
+
const names = /* @__PURE__ */ new Set();
|
|
362269
|
+
const commands = service.getCommands();
|
|
362270
|
+
for (const command2 of commands) {
|
|
362271
|
+
names.add(command2.name);
|
|
362272
|
+
}
|
|
362273
|
+
return Array.from(names).sort();
|
|
362274
|
+
} catch (error2) {
|
|
362275
|
+
if (this.context.debugMode) {
|
|
362276
|
+
console.error(
|
|
362277
|
+
"[SystemController] Failed to load slash commands:",
|
|
362278
|
+
error2
|
|
362279
|
+
);
|
|
362280
|
+
}
|
|
362281
|
+
return [];
|
|
362282
|
+
} finally {
|
|
362283
|
+
controller.abort();
|
|
362284
|
+
}
|
|
362285
|
+
}
|
|
362286
|
+
};
|
|
362287
|
+
|
|
362288
|
+
// packages/cli/src/nonInteractive/control/controllers/permissionController.ts
|
|
362289
|
+
init_esbuild_shims();
|
|
362290
|
+
init_core4();
|
|
362291
|
+
var PermissionController = class extends BaseController {
|
|
362292
|
+
static {
|
|
362293
|
+
__name(this, "PermissionController");
|
|
362294
|
+
}
|
|
362295
|
+
pendingOutgoingRequests = /* @__PURE__ */ new Set();
|
|
362296
|
+
/**
|
|
362297
|
+
* Handle permission control requests
|
|
362298
|
+
*/
|
|
362299
|
+
async handleRequestPayload(payload, _signal) {
|
|
362300
|
+
switch (payload.subtype) {
|
|
362301
|
+
case "can_use_tool":
|
|
362302
|
+
return this.handleCanUseTool(payload);
|
|
362303
|
+
case "set_permission_mode":
|
|
362304
|
+
return this.handleSetPermissionMode(
|
|
362305
|
+
payload
|
|
362306
|
+
);
|
|
362307
|
+
default:
|
|
362308
|
+
throw new Error(`Unsupported request subtype in PermissionController`);
|
|
362309
|
+
}
|
|
362310
|
+
}
|
|
362311
|
+
/**
|
|
362312
|
+
* Handle can_use_tool request
|
|
362313
|
+
*
|
|
362314
|
+
* Comprehensive permission evaluation based on:
|
|
362315
|
+
* - Permission mode (approval level)
|
|
362316
|
+
* - Tool registry validation
|
|
362317
|
+
* - Error handling with safe defaults
|
|
362318
|
+
*/
|
|
362319
|
+
async handleCanUseTool(payload) {
|
|
362320
|
+
const toolName = payload.tool_name;
|
|
362321
|
+
if (!toolName || typeof toolName !== "string" || toolName.trim().length === 0) {
|
|
362322
|
+
return {
|
|
362323
|
+
subtype: "can_use_tool",
|
|
362324
|
+
behavior: "deny",
|
|
362325
|
+
message: "Missing or invalid tool_name in can_use_tool request"
|
|
362326
|
+
};
|
|
362327
|
+
}
|
|
362328
|
+
let behavior = "allow";
|
|
362329
|
+
let message;
|
|
362330
|
+
try {
|
|
362331
|
+
const permissionResult = this.checkPermissionMode();
|
|
362332
|
+
if (!permissionResult.allowed) {
|
|
362333
|
+
behavior = "deny";
|
|
362334
|
+
message = permissionResult.message;
|
|
362335
|
+
}
|
|
362336
|
+
if (behavior === "allow") {
|
|
362337
|
+
const registryResult = this.checkToolRegistry(toolName);
|
|
362338
|
+
if (!registryResult.allowed) {
|
|
362339
|
+
behavior = "deny";
|
|
362340
|
+
message = registryResult.message;
|
|
362341
|
+
}
|
|
362342
|
+
}
|
|
362343
|
+
} catch (error2) {
|
|
362344
|
+
behavior = "deny";
|
|
362345
|
+
message = error2 instanceof Error ? `Failed to evaluate tool permission: ${error2.message}` : "Failed to evaluate tool permission";
|
|
362346
|
+
}
|
|
362347
|
+
const response = {
|
|
362348
|
+
subtype: "can_use_tool",
|
|
362349
|
+
behavior
|
|
362350
|
+
};
|
|
362351
|
+
if (message) {
|
|
362352
|
+
response["message"] = message;
|
|
362353
|
+
}
|
|
362354
|
+
return response;
|
|
362355
|
+
}
|
|
362356
|
+
/**
|
|
362357
|
+
* Check permission mode for tool execution
|
|
362358
|
+
*/
|
|
362359
|
+
checkPermissionMode() {
|
|
362360
|
+
const mode = this.context.permissionMode;
|
|
362361
|
+
switch (mode) {
|
|
362362
|
+
case "yolo":
|
|
362363
|
+
// Allow all tools
|
|
362364
|
+
case "auto-edit":
|
|
362365
|
+
// Auto-approve edit operations
|
|
362366
|
+
case "plan":
|
|
362367
|
+
return { allowed: true };
|
|
362368
|
+
case "default":
|
|
362369
|
+
// TODO: allow all tools for test
|
|
362370
|
+
default:
|
|
362371
|
+
return {
|
|
362372
|
+
allowed: false,
|
|
362373
|
+
message: "Tool execution requires manual approval. Update permission mode or approve via host."
|
|
362374
|
+
};
|
|
362375
|
+
}
|
|
362376
|
+
}
|
|
362377
|
+
/**
|
|
362378
|
+
* Check if tool exists in registry
|
|
362379
|
+
*/
|
|
362380
|
+
checkToolRegistry(toolName) {
|
|
362381
|
+
try {
|
|
362382
|
+
const config2 = this.context.config;
|
|
362383
|
+
const registryProvider = config2;
|
|
362384
|
+
if (typeof registryProvider.getToolRegistry === "function") {
|
|
362385
|
+
const registry2 = registryProvider.getToolRegistry();
|
|
362386
|
+
if (registry2 && typeof registry2.getTool === "function" && !registry2.getTool(toolName)) {
|
|
362387
|
+
return {
|
|
362388
|
+
allowed: false,
|
|
362389
|
+
message: `Tool "${toolName}" is not registered.`
|
|
362390
|
+
};
|
|
362391
|
+
}
|
|
362392
|
+
}
|
|
362393
|
+
return { allowed: true };
|
|
362394
|
+
} catch (error2) {
|
|
362395
|
+
return {
|
|
362396
|
+
allowed: false,
|
|
362397
|
+
message: `Failed to check tool registry: ${error2 instanceof Error ? error2.message : "Unknown error"}`
|
|
362398
|
+
};
|
|
362399
|
+
}
|
|
362400
|
+
}
|
|
362401
|
+
/**
|
|
362402
|
+
* Handle set_permission_mode request
|
|
362403
|
+
*
|
|
362404
|
+
* Updates the permission mode in the context
|
|
362405
|
+
*/
|
|
362406
|
+
async handleSetPermissionMode(payload) {
|
|
362407
|
+
const mode = payload.mode;
|
|
362408
|
+
const validModes = [
|
|
362409
|
+
"default",
|
|
362410
|
+
"plan",
|
|
362411
|
+
"auto-edit",
|
|
362412
|
+
"yolo"
|
|
362413
|
+
];
|
|
362414
|
+
if (!validModes.includes(mode)) {
|
|
362415
|
+
throw new Error(
|
|
362416
|
+
`Invalid permission mode: ${mode}. Valid values are: ${validModes.join(", ")}`
|
|
362417
|
+
);
|
|
362418
|
+
}
|
|
362419
|
+
this.context.permissionMode = mode;
|
|
362420
|
+
this.context.config.setApprovalMode(mode);
|
|
362421
|
+
if (this.context.debugMode) {
|
|
362422
|
+
console.error(
|
|
362423
|
+
`[PermissionController] Permission mode updated to: ${mode}`
|
|
362424
|
+
);
|
|
362425
|
+
}
|
|
362426
|
+
return { status: "updated", mode };
|
|
362427
|
+
}
|
|
362428
|
+
/**
|
|
362429
|
+
* Build permission suggestions for tool confirmation UI
|
|
362430
|
+
*
|
|
362431
|
+
* This method creates UI suggestions based on tool confirmation details,
|
|
362432
|
+
* helping the host application present appropriate permission options.
|
|
362433
|
+
*/
|
|
362434
|
+
buildPermissionSuggestions(confirmationDetails) {
|
|
362435
|
+
if (!confirmationDetails || typeof confirmationDetails !== "object" || !("type" in confirmationDetails)) {
|
|
362436
|
+
return null;
|
|
362437
|
+
}
|
|
362438
|
+
const details = confirmationDetails;
|
|
362439
|
+
const type = String(details["type"] ?? "");
|
|
362440
|
+
const title = typeof details["title"] === "string" ? details["title"] : void 0;
|
|
362441
|
+
const confirmationType = type;
|
|
362442
|
+
switch (confirmationType) {
|
|
362443
|
+
case "exec":
|
|
362444
|
+
return [
|
|
362445
|
+
{
|
|
362446
|
+
type: "allow",
|
|
362447
|
+
label: "Allow Command",
|
|
362448
|
+
description: `Execute: ${details["command"]}`
|
|
362449
|
+
},
|
|
362450
|
+
{
|
|
362451
|
+
type: "deny",
|
|
362452
|
+
label: "Deny",
|
|
362453
|
+
description: "Block this command execution"
|
|
362454
|
+
}
|
|
362455
|
+
];
|
|
362456
|
+
case "edit":
|
|
362457
|
+
return [
|
|
362458
|
+
{
|
|
362459
|
+
type: "allow",
|
|
362460
|
+
label: "Allow Edit",
|
|
362461
|
+
description: `Edit file: ${details["fileName"]}`
|
|
362462
|
+
},
|
|
362463
|
+
{
|
|
362464
|
+
type: "deny",
|
|
362465
|
+
label: "Deny",
|
|
362466
|
+
description: "Block this file edit"
|
|
362467
|
+
},
|
|
362468
|
+
{
|
|
362469
|
+
type: "modify",
|
|
362470
|
+
label: "Review Changes",
|
|
362471
|
+
description: "Review the proposed changes before applying"
|
|
362472
|
+
}
|
|
362473
|
+
];
|
|
362474
|
+
case "plan":
|
|
362475
|
+
return [
|
|
362476
|
+
{
|
|
362477
|
+
type: "allow",
|
|
362478
|
+
label: "Approve Plan",
|
|
362479
|
+
description: title || "Execute the proposed plan"
|
|
362480
|
+
},
|
|
362481
|
+
{
|
|
362482
|
+
type: "deny",
|
|
362483
|
+
label: "Reject Plan",
|
|
362484
|
+
description: "Do not execute this plan"
|
|
362485
|
+
}
|
|
362486
|
+
];
|
|
362487
|
+
case "mcp":
|
|
362488
|
+
return [
|
|
362489
|
+
{
|
|
362490
|
+
type: "allow",
|
|
362491
|
+
label: "Allow MCP Call",
|
|
362492
|
+
description: `${details["serverName"]}: ${details["toolName"]}`
|
|
362493
|
+
},
|
|
362494
|
+
{
|
|
362495
|
+
type: "deny",
|
|
362496
|
+
label: "Deny",
|
|
362497
|
+
description: "Block this MCP server call"
|
|
362498
|
+
}
|
|
362499
|
+
];
|
|
362500
|
+
case "info":
|
|
362501
|
+
return [
|
|
362502
|
+
{
|
|
362503
|
+
type: "allow",
|
|
362504
|
+
label: "Allow Info Request",
|
|
362505
|
+
description: title || "Allow information request"
|
|
362506
|
+
},
|
|
362507
|
+
{
|
|
362508
|
+
type: "deny",
|
|
362509
|
+
label: "Deny",
|
|
362510
|
+
description: "Block this information request"
|
|
362511
|
+
}
|
|
362512
|
+
];
|
|
362513
|
+
default:
|
|
362514
|
+
return [
|
|
362515
|
+
{
|
|
362516
|
+
type: "allow",
|
|
362517
|
+
label: "Allow",
|
|
362518
|
+
description: title || `Allow ${type} operation`
|
|
362519
|
+
},
|
|
362520
|
+
{
|
|
362521
|
+
type: "deny",
|
|
362522
|
+
label: "Deny",
|
|
362523
|
+
description: `Block ${type} operation`
|
|
362524
|
+
}
|
|
362525
|
+
];
|
|
362526
|
+
}
|
|
362527
|
+
}
|
|
362528
|
+
/**
|
|
362529
|
+
* Get callback for monitoring tool calls and handling outgoing permission requests
|
|
362530
|
+
* This is passed to executeToolCall to hook into CoreToolScheduler updates
|
|
362531
|
+
*/
|
|
362532
|
+
getToolCallUpdateCallback() {
|
|
362533
|
+
return (toolCalls) => {
|
|
362534
|
+
for (const call of toolCalls) {
|
|
362535
|
+
if (call && typeof call === "object" && call.status === "awaiting_approval") {
|
|
362536
|
+
const awaiting = call;
|
|
362537
|
+
if (typeof awaiting.confirmationDetails?.onConfirm === "function" && !this.pendingOutgoingRequests.has(awaiting.request.callId)) {
|
|
362538
|
+
this.pendingOutgoingRequests.add(awaiting.request.callId);
|
|
362539
|
+
void this.handleOutgoingPermissionRequest(awaiting);
|
|
362540
|
+
}
|
|
362541
|
+
}
|
|
362542
|
+
}
|
|
362117
362543
|
};
|
|
362118
362544
|
}
|
|
362545
|
+
/**
|
|
362546
|
+
* Handle outgoing permission request
|
|
362547
|
+
*
|
|
362548
|
+
* Behavior depends on input format:
|
|
362549
|
+
* - stream-json mode: Send can_use_tool to SDK and await response
|
|
362550
|
+
* - Other modes: Check local approval mode and decide immediately
|
|
362551
|
+
*/
|
|
362552
|
+
async handleOutgoingPermissionRequest(toolCall) {
|
|
362553
|
+
try {
|
|
362554
|
+
const inputFormat = this.context.config.getInputFormat?.();
|
|
362555
|
+
const isStreamJsonMode = inputFormat === "stream-json" /* STREAM_JSON */;
|
|
362556
|
+
if (!isStreamJsonMode) {
|
|
362557
|
+
const modeCheck = this.checkPermissionMode();
|
|
362558
|
+
const outcome = modeCheck.allowed ? "proceed_once" /* ProceedOnce */ : "cancel" /* Cancel */;
|
|
362559
|
+
await toolCall.confirmationDetails.onConfirm(outcome);
|
|
362560
|
+
return;
|
|
362561
|
+
}
|
|
362562
|
+
const permissionSuggestions = this.buildPermissionSuggestions(
|
|
362563
|
+
toolCall.confirmationDetails
|
|
362564
|
+
);
|
|
362565
|
+
const response = await this.sendControlRequest({
|
|
362566
|
+
subtype: "can_use_tool",
|
|
362567
|
+
tool_name: toolCall.request.name,
|
|
362568
|
+
tool_use_id: toolCall.request.callId,
|
|
362569
|
+
input: toolCall.request.args,
|
|
362570
|
+
permission_suggestions: permissionSuggestions,
|
|
362571
|
+
blocked_path: null
|
|
362572
|
+
});
|
|
362573
|
+
if (response.subtype !== "success") {
|
|
362574
|
+
await toolCall.confirmationDetails.onConfirm(
|
|
362575
|
+
"cancel" /* Cancel */
|
|
362576
|
+
);
|
|
362577
|
+
return;
|
|
362578
|
+
}
|
|
362579
|
+
const payload = response.response || {};
|
|
362580
|
+
const behavior = String(payload["behavior"] || "").toLowerCase();
|
|
362581
|
+
if (behavior === "allow") {
|
|
362582
|
+
const updatedInput = payload["updatedInput"];
|
|
362583
|
+
if (updatedInput && typeof updatedInput === "object") {
|
|
362584
|
+
toolCall.request.args = updatedInput;
|
|
362585
|
+
}
|
|
362586
|
+
await toolCall.confirmationDetails.onConfirm(
|
|
362587
|
+
"proceed_once" /* ProceedOnce */
|
|
362588
|
+
);
|
|
362589
|
+
} else {
|
|
362590
|
+
const cancelMessage = typeof payload["message"] === "string" ? payload["message"] : void 0;
|
|
362591
|
+
await toolCall.confirmationDetails.onConfirm(
|
|
362592
|
+
"cancel" /* Cancel */,
|
|
362593
|
+
cancelMessage ? { cancelMessage } : void 0
|
|
362594
|
+
);
|
|
362595
|
+
}
|
|
362596
|
+
} catch (error2) {
|
|
362597
|
+
if (this.context.debugMode) {
|
|
362598
|
+
console.error(
|
|
362599
|
+
"[PermissionController] Outgoing permission failed:",
|
|
362600
|
+
error2
|
|
362601
|
+
);
|
|
362602
|
+
}
|
|
362603
|
+
const confirmationType = toolCall.confirmationDetails.type;
|
|
362604
|
+
if (["edit", "exec", "mcp"].includes(confirmationType)) {
|
|
362605
|
+
const execOrMcpDetails = toolCall.confirmationDetails;
|
|
362606
|
+
await execOrMcpDetails.onConfirm(
|
|
362607
|
+
"cancel" /* Cancel */,
|
|
362608
|
+
void 0
|
|
362609
|
+
);
|
|
362610
|
+
} else {
|
|
362611
|
+
await toolCall.confirmationDetails.onConfirm(
|
|
362612
|
+
"cancel" /* Cancel */
|
|
362613
|
+
);
|
|
362614
|
+
}
|
|
362615
|
+
} finally {
|
|
362616
|
+
this.pendingOutgoingRequests.delete(toolCall.request.callId);
|
|
362617
|
+
}
|
|
362618
|
+
}
|
|
362119
362619
|
};
|
|
362120
362620
|
|
|
362121
362621
|
// packages/cli/src/nonInteractive/control/ControlDispatcher.ts
|
|
@@ -362126,7 +362626,7 @@ var ControlDispatcher = class {
|
|
|
362126
362626
|
context;
|
|
362127
362627
|
// Make controllers publicly accessible
|
|
362128
362628
|
systemController;
|
|
362129
|
-
|
|
362629
|
+
permissionController;
|
|
362130
362630
|
// readonly mcpController: MCPController;
|
|
362131
362631
|
// readonly hookController: HookController;
|
|
362132
362632
|
// Central pending request registries
|
|
@@ -362139,6 +362639,11 @@ var ControlDispatcher = class {
|
|
|
362139
362639
|
this,
|
|
362140
362640
|
"SystemController"
|
|
362141
362641
|
);
|
|
362642
|
+
this.permissionController = new PermissionController(
|
|
362643
|
+
context2,
|
|
362644
|
+
this,
|
|
362645
|
+
"PermissionController"
|
|
362646
|
+
);
|
|
362142
362647
|
this.context.abortSignal.addEventListener("abort", () => {
|
|
362143
362648
|
this.shutdown();
|
|
362144
362649
|
});
|
|
@@ -362243,6 +362748,7 @@ var ControlDispatcher = class {
|
|
|
362243
362748
|
}
|
|
362244
362749
|
this.pendingOutgoingRequests.clear();
|
|
362245
362750
|
this.systemController.cleanup();
|
|
362751
|
+
this.permissionController.cleanup();
|
|
362246
362752
|
}
|
|
362247
362753
|
/**
|
|
362248
362754
|
* Registers an incoming request in the pending registry
|
|
@@ -362295,9 +362801,9 @@ var ControlDispatcher = class {
|
|
|
362295
362801
|
case "set_model":
|
|
362296
362802
|
case "supported_commands":
|
|
362297
362803
|
return this.systemController;
|
|
362298
|
-
|
|
362299
|
-
|
|
362300
|
-
|
|
362804
|
+
case "can_use_tool":
|
|
362805
|
+
case "set_permission_mode":
|
|
362806
|
+
return this.permissionController;
|
|
362301
362807
|
// case 'mcp_message':
|
|
362302
362808
|
// case 'mcp_server_status':
|
|
362303
362809
|
// return this.mcpController;
|
|
@@ -362359,43 +362865,28 @@ var ControlService = class {
|
|
|
362359
362865
|
* Handles tool execution permissions, approval checks, and callbacks.
|
|
362360
362866
|
* Delegates to the shared PermissionController instance.
|
|
362361
362867
|
*/
|
|
362362
|
-
|
|
362363
|
-
|
|
362364
|
-
|
|
362365
|
-
|
|
362366
|
-
|
|
362367
|
-
|
|
362368
|
-
|
|
362369
|
-
|
|
362370
|
-
|
|
362371
|
-
|
|
362372
|
-
|
|
362373
|
-
|
|
362374
|
-
|
|
362375
|
-
|
|
362376
|
-
|
|
362377
|
-
|
|
362378
|
-
|
|
362379
|
-
|
|
362380
|
-
|
|
362381
|
-
|
|
362382
|
-
|
|
362383
|
-
|
|
362384
|
-
// */
|
|
362385
|
-
// buildPermissionSuggestions:
|
|
362386
|
-
// controller.buildPermissionSuggestions.bind(controller),
|
|
362387
|
-
//
|
|
362388
|
-
// /**
|
|
362389
|
-
// * Get callback for monitoring tool call status updates
|
|
362390
|
-
// *
|
|
362391
|
-
// * Returns callback function for integration with CoreToolScheduler.
|
|
362392
|
-
// *
|
|
362393
|
-
// * @returns Callback function for tool call updates
|
|
362394
|
-
// */
|
|
362395
|
-
// getToolCallUpdateCallback:
|
|
362396
|
-
// controller.getToolCallUpdateCallback.bind(controller),
|
|
362397
|
-
// };
|
|
362398
|
-
// }
|
|
362868
|
+
get permission() {
|
|
362869
|
+
const controller = this.dispatcher.permissionController;
|
|
362870
|
+
return {
|
|
362871
|
+
/**
|
|
362872
|
+
* Build UI suggestions for tool confirmation dialogs
|
|
362873
|
+
*
|
|
362874
|
+
* Creates actionable permission suggestions based on tool confirmation details.
|
|
362875
|
+
*
|
|
362876
|
+
* @param confirmationDetails - Tool confirmation details
|
|
362877
|
+
* @returns Array of permission suggestions or null
|
|
362878
|
+
*/
|
|
362879
|
+
buildPermissionSuggestions: controller.buildPermissionSuggestions.bind(controller),
|
|
362880
|
+
/**
|
|
362881
|
+
* Get callback for monitoring tool call status updates
|
|
362882
|
+
*
|
|
362883
|
+
* Returns callback function for integration with CoreToolScheduler.
|
|
362884
|
+
*
|
|
362885
|
+
* @returns Callback function for tool call updates
|
|
362886
|
+
*/
|
|
362887
|
+
getToolCallUpdateCallback: controller.getToolCallUpdateCallback.bind(controller)
|
|
362888
|
+
};
|
|
362889
|
+
}
|
|
362399
362890
|
/**
|
|
362400
362891
|
* System Domain API
|
|
362401
362892
|
*
|
|
@@ -362573,17 +363064,10 @@ var ConsolePatcher = class {
|
|
|
362573
363064
|
};
|
|
362574
363065
|
|
|
362575
363066
|
// packages/cli/src/nonInteractive/session.ts
|
|
362576
|
-
var
|
|
362577
|
-
INITIALIZING: "initializing",
|
|
362578
|
-
IDLE: "idle",
|
|
362579
|
-
PROCESSING_QUERY: "processing_query",
|
|
362580
|
-
SHUTTING_DOWN: "shutting_down"
|
|
362581
|
-
};
|
|
362582
|
-
var SessionManager = class {
|
|
363067
|
+
var Session2 = class {
|
|
362583
363068
|
static {
|
|
362584
|
-
__name(this, "
|
|
363069
|
+
__name(this, "Session");
|
|
362585
363070
|
}
|
|
362586
|
-
state = SESSION_STATE.INITIALIZING;
|
|
362587
363071
|
userMessageQueue = [];
|
|
362588
363072
|
abortController;
|
|
362589
363073
|
config;
|
|
@@ -362598,6 +363082,9 @@ var SessionManager = class {
|
|
|
362598
363082
|
debugMode;
|
|
362599
363083
|
shutdownHandler = null;
|
|
362600
363084
|
initialPrompt = null;
|
|
363085
|
+
processingPromise = null;
|
|
363086
|
+
isShuttingDown = false;
|
|
363087
|
+
configInitialized = false;
|
|
362601
363088
|
constructor(config2, initialPrompt) {
|
|
362602
363089
|
this.config = config2;
|
|
362603
363090
|
this.sessionId = config2.getSessionId();
|
|
@@ -362611,106 +363098,25 @@ var SessionManager = class {
|
|
|
362611
363098
|
);
|
|
362612
363099
|
this.setupSignalHandlers();
|
|
362613
363100
|
}
|
|
362614
|
-
/**
|
|
362615
|
-
* Get next prompt ID
|
|
362616
|
-
*/
|
|
362617
363101
|
getNextPromptId() {
|
|
362618
363102
|
this.promptIdCounter++;
|
|
362619
363103
|
return `${this.sessionId}########${this.promptIdCounter}`;
|
|
362620
363104
|
}
|
|
362621
|
-
|
|
362622
|
-
|
|
362623
|
-
|
|
362624
|
-
* Classifies incoming messages and routes them to appropriate handlers.
|
|
362625
|
-
*/
|
|
362626
|
-
route(message) {
|
|
362627
|
-
if (isControlRequest(message)) {
|
|
362628
|
-
return { type: "control_request", message };
|
|
362629
|
-
}
|
|
362630
|
-
if (isControlResponse(message)) {
|
|
362631
|
-
return { type: "control_response", message };
|
|
362632
|
-
}
|
|
362633
|
-
if (isControlCancel(message)) {
|
|
362634
|
-
return { type: "control_cancel", message };
|
|
362635
|
-
}
|
|
362636
|
-
if (isCLIUserMessage(message)) {
|
|
362637
|
-
return { type: "user", message };
|
|
362638
|
-
}
|
|
362639
|
-
if (isCLIAssistantMessage(message)) {
|
|
362640
|
-
return { type: "assistant", message };
|
|
362641
|
-
}
|
|
362642
|
-
if (isCLISystemMessage(message)) {
|
|
362643
|
-
return { type: "system", message };
|
|
362644
|
-
}
|
|
362645
|
-
if (isCLIResultMessage(message)) {
|
|
362646
|
-
return { type: "result", message };
|
|
362647
|
-
}
|
|
362648
|
-
if (isCLIPartialAssistantMessage(message)) {
|
|
362649
|
-
return { type: "stream_event", message };
|
|
363105
|
+
async ensureConfigInitialized() {
|
|
363106
|
+
if (this.configInitialized) {
|
|
363107
|
+
return;
|
|
362650
363108
|
}
|
|
362651
363109
|
if (this.debugMode) {
|
|
362652
|
-
console.error(
|
|
362653
|
-
"[SessionManager] Unknown message type:",
|
|
362654
|
-
JSON.stringify(message, null, 2)
|
|
362655
|
-
);
|
|
363110
|
+
console.error("[Session] Initializing config");
|
|
362656
363111
|
}
|
|
362657
|
-
return { type: "unknown", message };
|
|
362658
|
-
}
|
|
362659
|
-
/**
|
|
362660
|
-
* Process a single message with unified logic for both initial prompt and stream messages.
|
|
362661
|
-
*
|
|
362662
|
-
* Handles:
|
|
362663
|
-
* - Abort check
|
|
362664
|
-
* - First message detection and handling
|
|
362665
|
-
* - Normal message processing
|
|
362666
|
-
* - Shutdown state checks
|
|
362667
|
-
*
|
|
362668
|
-
* @param message - Message to process
|
|
362669
|
-
* @returns true if the calling code should exit (break/return), false to continue
|
|
362670
|
-
*/
|
|
362671
|
-
async processSingleMessage(message) {
|
|
362672
|
-
if (this.abortController.signal.aborted) {
|
|
362673
|
-
return true;
|
|
362674
|
-
}
|
|
362675
|
-
if (this.controlSystemEnabled === null) {
|
|
362676
|
-
const handled = await this.handleFirstMessage(message);
|
|
362677
|
-
if (handled) {
|
|
362678
|
-
return this.state === SESSION_STATE.SHUTTING_DOWN;
|
|
362679
|
-
}
|
|
362680
|
-
}
|
|
362681
|
-
await this.processMessage(message);
|
|
362682
|
-
return this.state === SESSION_STATE.SHUTTING_DOWN;
|
|
362683
|
-
}
|
|
362684
|
-
/**
|
|
362685
|
-
* Main entry point - run the session
|
|
362686
|
-
*/
|
|
362687
|
-
async run() {
|
|
362688
363112
|
try {
|
|
362689
|
-
|
|
362690
|
-
|
|
362691
|
-
}
|
|
362692
|
-
if (this.initialPrompt !== null) {
|
|
362693
|
-
const shouldExit = await this.processSingleMessage(this.initialPrompt);
|
|
362694
|
-
if (shouldExit) {
|
|
362695
|
-
await this.shutdown();
|
|
362696
|
-
return;
|
|
362697
|
-
}
|
|
362698
|
-
}
|
|
362699
|
-
for await (const message of this.inputReader.read()) {
|
|
362700
|
-
const shouldExit = await this.processSingleMessage(message);
|
|
362701
|
-
if (shouldExit) {
|
|
362702
|
-
break;
|
|
362703
|
-
}
|
|
362704
|
-
}
|
|
362705
|
-
await this.shutdown();
|
|
363113
|
+
await this.config.initialize();
|
|
363114
|
+
this.configInitialized = true;
|
|
362706
363115
|
} catch (error2) {
|
|
362707
363116
|
if (this.debugMode) {
|
|
362708
|
-
console.error("[
|
|
363117
|
+
console.error("[Session] Failed to initialize config:", error2);
|
|
362709
363118
|
}
|
|
362710
|
-
await this.shutdown();
|
|
362711
363119
|
throw error2;
|
|
362712
|
-
} finally {
|
|
362713
|
-
this.cleanupSignalHandlers();
|
|
362714
363120
|
}
|
|
362715
363121
|
}
|
|
362716
363122
|
ensureControlSystem() {
|
|
@@ -362741,219 +363147,64 @@ var SessionManager = class {
|
|
|
362741
363147
|
return this.dispatcher;
|
|
362742
363148
|
}
|
|
362743
363149
|
async handleFirstMessage(message) {
|
|
362744
|
-
|
|
362745
|
-
|
|
362746
|
-
const request4 = routed.message;
|
|
363150
|
+
if (isControlRequest(message)) {
|
|
363151
|
+
const request4 = message;
|
|
362747
363152
|
this.controlSystemEnabled = true;
|
|
362748
363153
|
this.ensureControlSystem();
|
|
362749
363154
|
if (request4.request.subtype === "initialize") {
|
|
362750
363155
|
await this.dispatcher?.dispatch(request4);
|
|
362751
|
-
this.
|
|
363156
|
+
await this.ensureConfigInitialized();
|
|
362752
363157
|
return true;
|
|
362753
363158
|
}
|
|
362754
|
-
|
|
363159
|
+
if (this.debugMode) {
|
|
363160
|
+
console.error(
|
|
363161
|
+
"[Session] Ignoring non-initialize control request during initialization"
|
|
363162
|
+
);
|
|
363163
|
+
}
|
|
363164
|
+
return true;
|
|
362755
363165
|
}
|
|
362756
|
-
if (
|
|
363166
|
+
if (isCLIUserMessage(message)) {
|
|
362757
363167
|
this.controlSystemEnabled = false;
|
|
362758
|
-
this.
|
|
362759
|
-
this.
|
|
362760
|
-
await this.processUserMessageQueue();
|
|
363168
|
+
await this.ensureConfigInitialized();
|
|
363169
|
+
this.enqueueUserMessage(message);
|
|
362761
363170
|
return true;
|
|
362762
363171
|
}
|
|
362763
363172
|
this.controlSystemEnabled = false;
|
|
362764
363173
|
return false;
|
|
362765
363174
|
}
|
|
362766
|
-
|
|
362767
|
-
* Process a single message from the stream
|
|
362768
|
-
*/
|
|
362769
|
-
async processMessage(message) {
|
|
362770
|
-
const routed = this.route(message);
|
|
362771
|
-
if (this.debugMode) {
|
|
362772
|
-
console.error(
|
|
362773
|
-
`[SessionManager] State: ${this.state}, Message type: ${routed.type}`
|
|
362774
|
-
);
|
|
362775
|
-
}
|
|
362776
|
-
switch (this.state) {
|
|
362777
|
-
case SESSION_STATE.INITIALIZING:
|
|
362778
|
-
await this.handleInitializingState(routed);
|
|
362779
|
-
break;
|
|
362780
|
-
case SESSION_STATE.IDLE:
|
|
362781
|
-
await this.handleIdleState(routed);
|
|
362782
|
-
break;
|
|
362783
|
-
case SESSION_STATE.PROCESSING_QUERY:
|
|
362784
|
-
await this.handleProcessingState(routed);
|
|
362785
|
-
break;
|
|
362786
|
-
case SESSION_STATE.SHUTTING_DOWN:
|
|
362787
|
-
break;
|
|
362788
|
-
default: {
|
|
362789
|
-
const _exhaustiveCheck = this.state;
|
|
362790
|
-
if (this.debugMode) {
|
|
362791
|
-
console.error("[SessionManager] Unknown state:", _exhaustiveCheck);
|
|
362792
|
-
}
|
|
362793
|
-
break;
|
|
362794
|
-
}
|
|
362795
|
-
}
|
|
362796
|
-
}
|
|
362797
|
-
/**
|
|
362798
|
-
* Handle messages in initializing state
|
|
362799
|
-
*/
|
|
362800
|
-
async handleInitializingState(routed) {
|
|
362801
|
-
if (routed.type === "control_request") {
|
|
362802
|
-
const request4 = routed.message;
|
|
362803
|
-
const dispatcher = this.getDispatcher();
|
|
362804
|
-
if (!dispatcher) {
|
|
362805
|
-
if (this.debugMode) {
|
|
362806
|
-
console.error(
|
|
362807
|
-
"[SessionManager] Control request received before control system initialization"
|
|
362808
|
-
);
|
|
362809
|
-
}
|
|
362810
|
-
return;
|
|
362811
|
-
}
|
|
362812
|
-
if (request4.request.subtype === "initialize") {
|
|
362813
|
-
await dispatcher.dispatch(request4);
|
|
362814
|
-
this.state = SESSION_STATE.IDLE;
|
|
362815
|
-
if (this.debugMode) {
|
|
362816
|
-
console.error("[SessionManager] Initialized, transitioning to idle");
|
|
362817
|
-
}
|
|
362818
|
-
} else {
|
|
362819
|
-
if (this.debugMode) {
|
|
362820
|
-
console.error(
|
|
362821
|
-
"[SessionManager] Ignoring non-initialize control request during initialization"
|
|
362822
|
-
);
|
|
362823
|
-
}
|
|
362824
|
-
}
|
|
362825
|
-
} else {
|
|
362826
|
-
if (this.debugMode) {
|
|
362827
|
-
console.error(
|
|
362828
|
-
"[SessionManager] Ignoring non-control message during initialization"
|
|
362829
|
-
);
|
|
362830
|
-
}
|
|
362831
|
-
}
|
|
362832
|
-
}
|
|
362833
|
-
/**
|
|
362834
|
-
* Handle messages in idle state
|
|
362835
|
-
*/
|
|
362836
|
-
async handleIdleState(routed) {
|
|
363175
|
+
async handleControlRequest(request4) {
|
|
362837
363176
|
const dispatcher = this.getDispatcher();
|
|
362838
|
-
if (
|
|
362839
|
-
if (!dispatcher) {
|
|
362840
|
-
if (this.debugMode) {
|
|
362841
|
-
console.error("[SessionManager] Ignoring control request (disabled)");
|
|
362842
|
-
}
|
|
362843
|
-
return;
|
|
362844
|
-
}
|
|
362845
|
-
const request4 = routed.message;
|
|
362846
|
-
await dispatcher.dispatch(request4);
|
|
362847
|
-
} else if (routed.type === "control_response") {
|
|
362848
|
-
if (!dispatcher) {
|
|
362849
|
-
return;
|
|
362850
|
-
}
|
|
362851
|
-
const response = routed.message;
|
|
362852
|
-
dispatcher.handleControlResponse(response);
|
|
362853
|
-
} else if (routed.type === "control_cancel") {
|
|
362854
|
-
if (!dispatcher) {
|
|
362855
|
-
return;
|
|
362856
|
-
}
|
|
362857
|
-
const cancelRequest = routed.message;
|
|
362858
|
-
dispatcher.handleCancel(cancelRequest.request_id);
|
|
362859
|
-
} else if (routed.type === "user") {
|
|
362860
|
-
const userMessage = routed.message;
|
|
362861
|
-
this.userMessageQueue.push(userMessage);
|
|
362862
|
-
await this.processUserMessageQueue();
|
|
362863
|
-
} else {
|
|
363177
|
+
if (!dispatcher) {
|
|
362864
363178
|
if (this.debugMode) {
|
|
362865
|
-
console.error(
|
|
362866
|
-
"[SessionManager] Ignoring message type in idle state:",
|
|
362867
|
-
routed.type
|
|
362868
|
-
);
|
|
363179
|
+
console.error("[Session] Control system not enabled");
|
|
362869
363180
|
}
|
|
363181
|
+
return;
|
|
362870
363182
|
}
|
|
363183
|
+
await dispatcher.dispatch(request4);
|
|
362871
363184
|
}
|
|
362872
|
-
|
|
362873
|
-
* Handle messages in processing state
|
|
362874
|
-
*/
|
|
362875
|
-
async handleProcessingState(routed) {
|
|
363185
|
+
handleControlResponse(response) {
|
|
362876
363186
|
const dispatcher = this.getDispatcher();
|
|
362877
|
-
if (
|
|
362878
|
-
|
|
362879
|
-
if (this.debugMode) {
|
|
362880
|
-
console.error(
|
|
362881
|
-
"[SessionManager] Control request ignored during processing (disabled)"
|
|
362882
|
-
);
|
|
362883
|
-
}
|
|
362884
|
-
return;
|
|
362885
|
-
}
|
|
362886
|
-
const request4 = routed.message;
|
|
362887
|
-
await dispatcher.dispatch(request4);
|
|
362888
|
-
} else if (routed.type === "control_response") {
|
|
362889
|
-
if (!dispatcher) {
|
|
362890
|
-
return;
|
|
362891
|
-
}
|
|
362892
|
-
const response = routed.message;
|
|
362893
|
-
dispatcher.handleControlResponse(response);
|
|
362894
|
-
} else if (routed.type === "user") {
|
|
362895
|
-
const userMessage = routed.message;
|
|
362896
|
-
this.userMessageQueue.push(userMessage);
|
|
362897
|
-
if (this.debugMode) {
|
|
362898
|
-
console.error(
|
|
362899
|
-
"[SessionManager] Enqueued user message during processing"
|
|
362900
|
-
);
|
|
362901
|
-
}
|
|
362902
|
-
} else {
|
|
362903
|
-
if (this.debugMode) {
|
|
362904
|
-
console.error(
|
|
362905
|
-
"[SessionManager] Ignoring message type during processing:",
|
|
362906
|
-
routed.type
|
|
362907
|
-
);
|
|
362908
|
-
}
|
|
363187
|
+
if (!dispatcher) {
|
|
363188
|
+
return;
|
|
362909
363189
|
}
|
|
363190
|
+
dispatcher.handleControlResponse(response);
|
|
362910
363191
|
}
|
|
362911
|
-
|
|
362912
|
-
|
|
362913
|
-
|
|
362914
|
-
async processUserMessageQueue() {
|
|
362915
|
-
while (this.userMessageQueue.length > 0 && !this.abortController.signal.aborted) {
|
|
362916
|
-
this.state = SESSION_STATE.PROCESSING_QUERY;
|
|
362917
|
-
const userMessage = this.userMessageQueue.shift();
|
|
362918
|
-
try {
|
|
362919
|
-
await this.processUserMessage(userMessage);
|
|
362920
|
-
} catch (error2) {
|
|
362921
|
-
if (this.debugMode) {
|
|
362922
|
-
console.error(
|
|
362923
|
-
"[SessionManager] Error processing user message:",
|
|
362924
|
-
error2
|
|
362925
|
-
);
|
|
362926
|
-
}
|
|
362927
|
-
this.emitErrorResult(error2);
|
|
362928
|
-
}
|
|
362929
|
-
}
|
|
362930
|
-
if (!this.abortController.signal.aborted && this.state === SESSION_STATE.PROCESSING_QUERY && this.controlSystemEnabled === false && this.userMessageQueue.length === 0) {
|
|
362931
|
-
if (this.debugMode) {
|
|
362932
|
-
console.error(
|
|
362933
|
-
"[SessionManager] Single-query mode: queue processed, shutting down"
|
|
362934
|
-
);
|
|
362935
|
-
}
|
|
362936
|
-
this.state = SESSION_STATE.SHUTTING_DOWN;
|
|
363192
|
+
handleControlCancel(cancelRequest) {
|
|
363193
|
+
const dispatcher = this.getDispatcher();
|
|
363194
|
+
if (!dispatcher) {
|
|
362937
363195
|
return;
|
|
362938
363196
|
}
|
|
362939
|
-
|
|
362940
|
-
this.state = SESSION_STATE.IDLE;
|
|
362941
|
-
if (this.debugMode) {
|
|
362942
|
-
console.error("[SessionManager] Queue processed, returning to idle");
|
|
362943
|
-
}
|
|
362944
|
-
}
|
|
363197
|
+
dispatcher.handleCancel(cancelRequest.request_id);
|
|
362945
363198
|
}
|
|
362946
|
-
/**
|
|
362947
|
-
* Process a single user message
|
|
362948
|
-
*/
|
|
362949
363199
|
async processUserMessage(userMessage) {
|
|
362950
363200
|
const input = extractUserMessageText(userMessage);
|
|
362951
363201
|
if (!input) {
|
|
362952
363202
|
if (this.debugMode) {
|
|
362953
|
-
console.error("[
|
|
363203
|
+
console.error("[Session] No text content in user message");
|
|
362954
363204
|
}
|
|
362955
363205
|
return;
|
|
362956
363206
|
}
|
|
363207
|
+
await this.ensureConfigInitialized();
|
|
362957
363208
|
const promptId = this.getNextPromptId();
|
|
362958
363209
|
try {
|
|
362959
363210
|
await runNonInteractive(
|
|
@@ -362969,13 +363220,41 @@ var SessionManager = class {
|
|
|
362969
363220
|
);
|
|
362970
363221
|
} catch (error2) {
|
|
362971
363222
|
if (this.debugMode) {
|
|
362972
|
-
console.error("[
|
|
363223
|
+
console.error("[Session] Query execution error:", error2);
|
|
362973
363224
|
}
|
|
362974
363225
|
}
|
|
362975
363226
|
}
|
|
362976
|
-
|
|
362977
|
-
|
|
362978
|
-
|
|
363227
|
+
async processUserMessageQueue() {
|
|
363228
|
+
if (this.isShuttingDown || this.abortController.signal.aborted) {
|
|
363229
|
+
return;
|
|
363230
|
+
}
|
|
363231
|
+
while (this.userMessageQueue.length > 0 && !this.isShuttingDown && !this.abortController.signal.aborted) {
|
|
363232
|
+
const userMessage = this.userMessageQueue.shift();
|
|
363233
|
+
try {
|
|
363234
|
+
await this.processUserMessage(userMessage);
|
|
363235
|
+
} catch (error2) {
|
|
363236
|
+
if (this.debugMode) {
|
|
363237
|
+
console.error("[Session] Error processing user message:", error2);
|
|
363238
|
+
}
|
|
363239
|
+
this.emitErrorResult(error2);
|
|
363240
|
+
}
|
|
363241
|
+
}
|
|
363242
|
+
}
|
|
363243
|
+
enqueueUserMessage(userMessage) {
|
|
363244
|
+
this.userMessageQueue.push(userMessage);
|
|
363245
|
+
this.ensureProcessingStarted();
|
|
363246
|
+
}
|
|
363247
|
+
ensureProcessingStarted() {
|
|
363248
|
+
if (this.processingPromise) {
|
|
363249
|
+
return;
|
|
363250
|
+
}
|
|
363251
|
+
this.processingPromise = this.processUserMessageQueue().finally(() => {
|
|
363252
|
+
this.processingPromise = null;
|
|
363253
|
+
if (this.userMessageQueue.length > 0 && !this.isShuttingDown && !this.abortController.signal.aborted) {
|
|
363254
|
+
this.ensureProcessingStarted();
|
|
363255
|
+
}
|
|
363256
|
+
});
|
|
363257
|
+
}
|
|
362979
363258
|
emitErrorResult(error2, numTurns = 0, durationMs = 0, apiDurationMs = 0) {
|
|
362980
363259
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
362981
363260
|
this.outputAdapter.emitResult({
|
|
@@ -362987,46 +363266,44 @@ var SessionManager = class {
|
|
|
362987
363266
|
usage: void 0
|
|
362988
363267
|
});
|
|
362989
363268
|
}
|
|
362990
|
-
/**
|
|
362991
|
-
* Handle interrupt control request
|
|
362992
|
-
*/
|
|
362993
363269
|
handleInterrupt() {
|
|
362994
363270
|
if (this.debugMode) {
|
|
362995
|
-
console.error("[
|
|
362996
|
-
}
|
|
362997
|
-
if (this.state === SESSION_STATE.PROCESSING_QUERY) {
|
|
362998
|
-
this.abortController.abort();
|
|
362999
|
-
this.abortController = new AbortController();
|
|
363271
|
+
console.error("[Session] Interrupt requested");
|
|
363000
363272
|
}
|
|
363273
|
+
this.abortController.abort();
|
|
363274
|
+
this.abortController = new AbortController();
|
|
363001
363275
|
}
|
|
363002
|
-
/**
|
|
363003
|
-
* Setup signal handlers for graceful shutdown
|
|
363004
|
-
*/
|
|
363005
363276
|
setupSignalHandlers() {
|
|
363006
363277
|
this.shutdownHandler = () => {
|
|
363007
363278
|
if (this.debugMode) {
|
|
363008
|
-
console.error("[
|
|
363279
|
+
console.error("[Session] Shutdown signal received");
|
|
363009
363280
|
}
|
|
363281
|
+
this.isShuttingDown = true;
|
|
363010
363282
|
this.abortController.abort();
|
|
363011
|
-
this.state = SESSION_STATE.SHUTTING_DOWN;
|
|
363012
363283
|
};
|
|
363013
363284
|
process.on("SIGINT", this.shutdownHandler);
|
|
363014
363285
|
process.on("SIGTERM", this.shutdownHandler);
|
|
363015
363286
|
}
|
|
363016
|
-
/**
|
|
363017
|
-
* Shutdown session and cleanup resources
|
|
363018
|
-
*/
|
|
363019
363287
|
async shutdown() {
|
|
363020
363288
|
if (this.debugMode) {
|
|
363021
|
-
console.error("[
|
|
363289
|
+
console.error("[Session] Shutting down");
|
|
363290
|
+
}
|
|
363291
|
+
this.isShuttingDown = true;
|
|
363292
|
+
if (this.processingPromise) {
|
|
363293
|
+
try {
|
|
363294
|
+
await this.processingPromise;
|
|
363295
|
+
} catch (error2) {
|
|
363296
|
+
if (this.debugMode) {
|
|
363297
|
+
console.error(
|
|
363298
|
+
"[Session] Error waiting for processing to complete:",
|
|
363299
|
+
error2
|
|
363300
|
+
);
|
|
363301
|
+
}
|
|
363302
|
+
}
|
|
363022
363303
|
}
|
|
363023
|
-
this.state = SESSION_STATE.SHUTTING_DOWN;
|
|
363024
363304
|
this.dispatcher?.shutdown();
|
|
363025
363305
|
this.cleanupSignalHandlers();
|
|
363026
363306
|
}
|
|
363027
|
-
/**
|
|
363028
|
-
* Remove signal handlers to prevent memory leaks
|
|
363029
|
-
*/
|
|
363030
363307
|
cleanupSignalHandlers() {
|
|
363031
363308
|
if (this.shutdownHandler) {
|
|
363032
363309
|
process.removeListener("SIGINT", this.shutdownHandler);
|
|
@@ -363034,6 +363311,81 @@ var SessionManager = class {
|
|
|
363034
363311
|
this.shutdownHandler = null;
|
|
363035
363312
|
}
|
|
363036
363313
|
}
|
|
363314
|
+
async run() {
|
|
363315
|
+
try {
|
|
363316
|
+
if (this.debugMode) {
|
|
363317
|
+
console.error("[Session] Starting session", this.sessionId);
|
|
363318
|
+
}
|
|
363319
|
+
if (this.initialPrompt !== null) {
|
|
363320
|
+
const handled = await this.handleFirstMessage(this.initialPrompt);
|
|
363321
|
+
if (handled && this.isShuttingDown) {
|
|
363322
|
+
await this.shutdown();
|
|
363323
|
+
return;
|
|
363324
|
+
}
|
|
363325
|
+
}
|
|
363326
|
+
try {
|
|
363327
|
+
for await (const message of this.inputReader.read()) {
|
|
363328
|
+
if (this.abortController.signal.aborted) {
|
|
363329
|
+
break;
|
|
363330
|
+
}
|
|
363331
|
+
if (this.controlSystemEnabled === null) {
|
|
363332
|
+
const handled = await this.handleFirstMessage(message);
|
|
363333
|
+
if (handled) {
|
|
363334
|
+
if (this.isShuttingDown) {
|
|
363335
|
+
break;
|
|
363336
|
+
}
|
|
363337
|
+
continue;
|
|
363338
|
+
}
|
|
363339
|
+
}
|
|
363340
|
+
if (isControlRequest(message)) {
|
|
363341
|
+
await this.handleControlRequest(message);
|
|
363342
|
+
} else if (isControlResponse(message)) {
|
|
363343
|
+
this.handleControlResponse(message);
|
|
363344
|
+
} else if (isControlCancel(message)) {
|
|
363345
|
+
this.handleControlCancel(message);
|
|
363346
|
+
} else if (isCLIUserMessage(message)) {
|
|
363347
|
+
this.enqueueUserMessage(message);
|
|
363348
|
+
} else if (this.debugMode) {
|
|
363349
|
+
if (!isCLIAssistantMessage(message) && !isCLISystemMessage(message) && !isCLIResultMessage(message) && !isCLIPartialAssistantMessage(message)) {
|
|
363350
|
+
console.error(
|
|
363351
|
+
"[Session] Unknown message type:",
|
|
363352
|
+
JSON.stringify(message, null, 2)
|
|
363353
|
+
);
|
|
363354
|
+
}
|
|
363355
|
+
}
|
|
363356
|
+
if (this.isShuttingDown) {
|
|
363357
|
+
break;
|
|
363358
|
+
}
|
|
363359
|
+
}
|
|
363360
|
+
} catch (streamError) {
|
|
363361
|
+
if (this.debugMode) {
|
|
363362
|
+
console.error("[Session] Stream reading error:", streamError);
|
|
363363
|
+
}
|
|
363364
|
+
throw streamError;
|
|
363365
|
+
}
|
|
363366
|
+
while (this.processingPromise) {
|
|
363367
|
+
if (this.debugMode) {
|
|
363368
|
+
console.error("[Session] Waiting for final processing to complete");
|
|
363369
|
+
}
|
|
363370
|
+
try {
|
|
363371
|
+
await this.processingPromise;
|
|
363372
|
+
} catch (error2) {
|
|
363373
|
+
if (this.debugMode) {
|
|
363374
|
+
console.error("[Session] Error in final processing:", error2);
|
|
363375
|
+
}
|
|
363376
|
+
}
|
|
363377
|
+
}
|
|
363378
|
+
await this.shutdown();
|
|
363379
|
+
} catch (error2) {
|
|
363380
|
+
if (this.debugMode) {
|
|
363381
|
+
console.error("[Session] Error:", error2);
|
|
363382
|
+
}
|
|
363383
|
+
await this.shutdown();
|
|
363384
|
+
throw error2;
|
|
363385
|
+
} finally {
|
|
363386
|
+
this.cleanupSignalHandlers();
|
|
363387
|
+
}
|
|
363388
|
+
}
|
|
363037
363389
|
};
|
|
363038
363390
|
function extractUserMessageText(message) {
|
|
363039
363391
|
const content = message.message.content;
|
|
@@ -363074,7 +363426,7 @@ async function runNonInteractiveStreamJson(config2, input) {
|
|
|
363074
363426
|
parent_tool_use_id: null
|
|
363075
363427
|
};
|
|
363076
363428
|
}
|
|
363077
|
-
const manager = new
|
|
363429
|
+
const manager = new Session2(config2, initialPrompt);
|
|
363078
363430
|
await manager.run();
|
|
363079
363431
|
} finally {
|
|
363080
363432
|
consolePatcher.cleanup();
|
|
@@ -363084,7 +363436,7 @@ __name(runNonInteractiveStreamJson, "runNonInteractiveStreamJson");
|
|
|
363084
363436
|
|
|
363085
363437
|
// packages/cli/src/ui/AppContainer.tsx
|
|
363086
363438
|
init_esbuild_shims();
|
|
363087
|
-
var
|
|
363439
|
+
var import_react133 = __toESM(require_react(), 1);
|
|
363088
363440
|
|
|
363089
363441
|
// packages/cli/src/ui/App.tsx
|
|
363090
363442
|
init_esbuild_shims();
|
|
@@ -383548,7 +383900,7 @@ var AgentSelectionStep = /* @__PURE__ */ __name(({
|
|
|
383548
383900
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
383549
383901
|
projectAgents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
|
|
383550
383902
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text3, { color: theme.text.primary, bold: true, children: t3("Project Level ({{path}})", {
|
|
383551
|
-
path: projectAgents[0].filePath
|
|
383903
|
+
path: projectAgents[0].filePath?.replace(/\/[^/]+$/, "") || ""
|
|
383552
383904
|
}) }),
|
|
383553
383905
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box_default, { marginTop: 1, flexDirection: "column", children: projectAgents.map((agent, index) => {
|
|
383554
383906
|
const isSelected = navigation.currentBlock === "project" && navigation.projectIndex === index;
|
|
@@ -383562,7 +383914,7 @@ var AgentSelectionStep = /* @__PURE__ */ __name(({
|
|
|
383562
383914
|
marginBottom: builtinAgents.length > 0 ? 1 : 0,
|
|
383563
383915
|
children: [
|
|
383564
383916
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text3, { color: theme.text.primary, bold: true, children: t3("User Level ({{path}})", {
|
|
383565
|
-
path: userAgents[0].filePath
|
|
383917
|
+
path: userAgents[0].filePath?.replace(/\/[^/]+$/, "") || ""
|
|
383566
383918
|
}) }),
|
|
383567
383919
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box_default, { marginTop: 1, flexDirection: "column", children: userAgents.map((agent, index) => {
|
|
383568
383920
|
const isSelected = navigation.currentBlock === "user" && navigation.userIndex === index;
|
|
@@ -383725,7 +384077,10 @@ function EditOptionsStep({
|
|
|
383725
384077
|
setError(null);
|
|
383726
384078
|
if (selectedValue === "editor") {
|
|
383727
384079
|
try {
|
|
383728
|
-
|
|
384080
|
+
if (!selectedAgent.filePath) {
|
|
384081
|
+
throw new Error("Agent has no file path");
|
|
384082
|
+
}
|
|
384083
|
+
await launchEditor(selectedAgent.filePath);
|
|
383729
384084
|
} catch (err) {
|
|
383730
384085
|
setError(
|
|
383731
384086
|
t3("Failed to launch editor: {{error}}", {
|
|
@@ -386667,7 +387022,6 @@ var HistoryItemDisplayComponent = /* @__PURE__ */ __name(({
|
|
|
386667
387022
|
itemForDisplay.type === "model_stats" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ModelStatsDisplay, {}),
|
|
386668
387023
|
itemForDisplay.type === "tool_stats" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ToolStatsDisplay, {}),
|
|
386669
387024
|
itemForDisplay.type === "quit" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SessionSummaryDisplay, { duration: itemForDisplay.duration }),
|
|
386670
|
-
itemForDisplay.type === "quit_confirmation" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SessionSummaryDisplay, { duration: itemForDisplay.duration }),
|
|
386671
387025
|
itemForDisplay.type === "tool_group" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
386672
387026
|
ToolGroupMessage,
|
|
386673
387027
|
{
|
|
@@ -390442,56 +390796,8 @@ function WelcomeBackDialog({
|
|
|
390442
390796
|
}
|
|
390443
390797
|
__name(WelcomeBackDialog, "WelcomeBackDialog");
|
|
390444
390798
|
|
|
390445
|
-
// packages/cli/src/ui/components/QuitConfirmationDialog.tsx
|
|
390446
|
-
init_esbuild_shims();
|
|
390447
|
-
var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
|
|
390448
|
-
var QuitConfirmationDialog = /* @__PURE__ */ __name(({
|
|
390449
|
-
onSelect
|
|
390450
|
-
}) => {
|
|
390451
|
-
useKeypress(
|
|
390452
|
-
(key) => {
|
|
390453
|
-
if (key.name === "escape") {
|
|
390454
|
-
onSelect("cancel" /* CANCEL */);
|
|
390455
|
-
}
|
|
390456
|
-
},
|
|
390457
|
-
{ isActive: true }
|
|
390458
|
-
);
|
|
390459
|
-
const options2 = [
|
|
390460
|
-
{
|
|
390461
|
-
key: "quit",
|
|
390462
|
-
label: t3("Quit immediately (/quit)"),
|
|
390463
|
-
value: "quit" /* QUIT */
|
|
390464
|
-
},
|
|
390465
|
-
{
|
|
390466
|
-
key: "summary-and-quit",
|
|
390467
|
-
label: t3("Generate summary and quit (/summary)"),
|
|
390468
|
-
value: "summary_and_quit" /* SUMMARY_AND_QUIT */
|
|
390469
|
-
},
|
|
390470
|
-
{
|
|
390471
|
-
key: "cancel",
|
|
390472
|
-
label: t3("Cancel (stay in application)"),
|
|
390473
|
-
value: "cancel" /* CANCEL */
|
|
390474
|
-
}
|
|
390475
|
-
];
|
|
390476
|
-
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
390477
|
-
Box_default,
|
|
390478
|
-
{
|
|
390479
|
-
flexDirection: "column",
|
|
390480
|
-
borderStyle: "round",
|
|
390481
|
-
borderColor: Colors.AccentYellow,
|
|
390482
|
-
padding: 1,
|
|
390483
|
-
width: "100%",
|
|
390484
|
-
marginLeft: 1,
|
|
390485
|
-
children: [
|
|
390486
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Text3, { children: t3("What would you like to do before exiting?") }) }),
|
|
390487
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(RadioButtonSelect, { items: options2, onSelect, isFocused: true })
|
|
390488
|
-
]
|
|
390489
|
-
}
|
|
390490
|
-
);
|
|
390491
|
-
}, "QuitConfirmationDialog");
|
|
390492
|
-
|
|
390493
390799
|
// packages/cli/src/ui/components/DialogManager.tsx
|
|
390494
|
-
var
|
|
390800
|
+
var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
|
|
390495
390801
|
var DialogManager = /* @__PURE__ */ __name(({
|
|
390496
390802
|
addItem,
|
|
390497
390803
|
terminalWidth
|
|
@@ -390511,7 +390817,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390511
390817
|
};
|
|
390512
390818
|
}, "getDefaultOpenAIConfig");
|
|
390513
390819
|
if (uiState.showWelcomeBackDialog && uiState.welcomeBackInfo?.hasHistory) {
|
|
390514
|
-
return /* @__PURE__ */ (0,
|
|
390820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390515
390821
|
WelcomeBackDialog,
|
|
390516
390822
|
{
|
|
390517
390823
|
welcomeBackInfo: uiState.welcomeBackInfo,
|
|
@@ -390521,10 +390827,10 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390521
390827
|
);
|
|
390522
390828
|
}
|
|
390523
390829
|
if (uiState.showIdeRestartPrompt) {
|
|
390524
|
-
return /* @__PURE__ */ (0,
|
|
390830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(IdeTrustChangeDialog, { reason: uiState.ideTrustRestartReason });
|
|
390525
390831
|
}
|
|
390526
390832
|
if (uiState.showWorkspaceMigrationDialog) {
|
|
390527
|
-
return /* @__PURE__ */ (0,
|
|
390833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390528
390834
|
WorkspaceMigrationDialog,
|
|
390529
390835
|
{
|
|
390530
390836
|
workspaceExtensions: uiState.workspaceExtensions,
|
|
@@ -390534,7 +390840,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390534
390840
|
);
|
|
390535
390841
|
}
|
|
390536
390842
|
if (uiState.proQuotaRequest) {
|
|
390537
|
-
return /* @__PURE__ */ (0,
|
|
390843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390538
390844
|
ProQuotaDialog,
|
|
390539
390845
|
{
|
|
390540
390846
|
failedModel: uiState.proQuotaRequest.failedModel,
|
|
@@ -390544,7 +390850,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390544
390850
|
);
|
|
390545
390851
|
}
|
|
390546
390852
|
if (uiState.shouldShowIdePrompt) {
|
|
390547
|
-
return /* @__PURE__ */ (0,
|
|
390853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390548
390854
|
IdeIntegrationNudge,
|
|
390549
390855
|
{
|
|
390550
390856
|
ide: uiState.currentIDE,
|
|
@@ -390553,7 +390859,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390553
390859
|
);
|
|
390554
390860
|
}
|
|
390555
390861
|
if (uiState.isFolderTrustDialogOpen) {
|
|
390556
|
-
return /* @__PURE__ */ (0,
|
|
390862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390557
390863
|
FolderTrustDialog,
|
|
390558
390864
|
{
|
|
390559
390865
|
onSelect: uiActions.handleFolderTrustSelect,
|
|
@@ -390562,37 +390868,18 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390562
390868
|
);
|
|
390563
390869
|
}
|
|
390564
390870
|
if (uiState.shellConfirmationRequest) {
|
|
390565
|
-
return /* @__PURE__ */ (0,
|
|
390871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ShellConfirmationDialog, { request: uiState.shellConfirmationRequest });
|
|
390566
390872
|
}
|
|
390567
390873
|
if (uiState.loopDetectionConfirmationRequest) {
|
|
390568
|
-
return /* @__PURE__ */ (0,
|
|
390874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390569
390875
|
LoopDetectionConfirmation,
|
|
390570
390876
|
{
|
|
390571
390877
|
onComplete: uiState.loopDetectionConfirmationRequest.onComplete
|
|
390572
390878
|
}
|
|
390573
390879
|
);
|
|
390574
390880
|
}
|
|
390575
|
-
if (uiState.quitConfirmationRequest) {
|
|
390576
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
390577
|
-
QuitConfirmationDialog,
|
|
390578
|
-
{
|
|
390579
|
-
onSelect: (choice2) => {
|
|
390580
|
-
if (choice2 === "cancel" /* CANCEL */) {
|
|
390581
|
-
uiState.quitConfirmationRequest?.onConfirm(false, "cancel");
|
|
390582
|
-
} else if (choice2 === "quit" /* QUIT */) {
|
|
390583
|
-
uiState.quitConfirmationRequest?.onConfirm(true, "quit");
|
|
390584
|
-
} else if (choice2 === "summary_and_quit" /* SUMMARY_AND_QUIT */) {
|
|
390585
|
-
uiState.quitConfirmationRequest?.onConfirm(
|
|
390586
|
-
true,
|
|
390587
|
-
"summary_and_quit"
|
|
390588
|
-
);
|
|
390589
|
-
}
|
|
390590
|
-
}
|
|
390591
|
-
}
|
|
390592
|
-
);
|
|
390593
|
-
}
|
|
390594
390881
|
if (uiState.confirmationRequest) {
|
|
390595
|
-
return /* @__PURE__ */ (0,
|
|
390882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390596
390883
|
ConsentPrompt,
|
|
390597
390884
|
{
|
|
390598
390885
|
prompt: uiState.confirmationRequest.prompt,
|
|
@@ -390603,7 +390890,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390603
390890
|
}
|
|
390604
390891
|
if (uiState.confirmUpdateExtensionRequests.length > 0) {
|
|
390605
390892
|
const request4 = uiState.confirmUpdateExtensionRequests[0];
|
|
390606
|
-
return /* @__PURE__ */ (0,
|
|
390893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390607
390894
|
ConsentPrompt,
|
|
390608
390895
|
{
|
|
390609
390896
|
prompt: request4.prompt,
|
|
@@ -390613,9 +390900,9 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390613
390900
|
);
|
|
390614
390901
|
}
|
|
390615
390902
|
if (uiState.isThemeDialogOpen) {
|
|
390616
|
-
return /* @__PURE__ */ (0,
|
|
390617
|
-
uiState.themeError && /* @__PURE__ */ (0,
|
|
390618
|
-
/* @__PURE__ */ (0,
|
|
390903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
390904
|
+
uiState.themeError && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Text3, { color: theme.status.error, children: uiState.themeError }) }),
|
|
390905
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390619
390906
|
ThemeDialog,
|
|
390620
390907
|
{
|
|
390621
390908
|
onSelect: uiActions.handleThemeSelect,
|
|
@@ -390628,7 +390915,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390628
390915
|
] });
|
|
390629
390916
|
}
|
|
390630
390917
|
if (uiState.isSettingsDialogOpen) {
|
|
390631
|
-
return /* @__PURE__ */ (0,
|
|
390918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390632
390919
|
SettingsDialog,
|
|
390633
390920
|
{
|
|
390634
390921
|
settings,
|
|
@@ -390641,7 +390928,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390641
390928
|
}
|
|
390642
390929
|
if (uiState.isApprovalModeDialogOpen) {
|
|
390643
390930
|
const currentMode = config2.getApprovalMode();
|
|
390644
|
-
return /* @__PURE__ */ (0,
|
|
390931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390645
390932
|
ApprovalModeDialog,
|
|
390646
390933
|
{
|
|
390647
390934
|
settings,
|
|
@@ -390652,18 +390939,18 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390652
390939
|
) });
|
|
390653
390940
|
}
|
|
390654
390941
|
if (uiState.isModelDialogOpen) {
|
|
390655
|
-
return /* @__PURE__ */ (0,
|
|
390942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModelDialog, { onClose: uiActions.closeModelDialog });
|
|
390656
390943
|
}
|
|
390657
390944
|
if (uiState.isVisionSwitchDialogOpen) {
|
|
390658
|
-
return /* @__PURE__ */ (0,
|
|
390945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModelSwitchDialog, { onSelect: uiActions.handleVisionSwitchSelect });
|
|
390659
390946
|
}
|
|
390660
390947
|
if (uiState.isAuthDialogOpen || uiState.authError) {
|
|
390661
|
-
return /* @__PURE__ */ (0,
|
|
390948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(AuthDialog, {}) });
|
|
390662
390949
|
}
|
|
390663
390950
|
if (uiState.isAuthenticating) {
|
|
390664
390951
|
if (uiState.pendingAuthType === "openai" /* USE_OPENAI */) {
|
|
390665
390952
|
const defaults3 = getDefaultOpenAIConfig();
|
|
390666
|
-
return /* @__PURE__ */ (0,
|
|
390953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390667
390954
|
OpenAIKeyPrompt,
|
|
390668
390955
|
{
|
|
390669
390956
|
onSubmit: (apiKey, baseUrl, model) => {
|
|
@@ -390684,7 +390971,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390684
390971
|
);
|
|
390685
390972
|
}
|
|
390686
390973
|
if (uiState.pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
390687
|
-
return /* @__PURE__ */ (0,
|
|
390974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390688
390975
|
QwenOAuthProgress,
|
|
390689
390976
|
{
|
|
390690
390977
|
deviceAuth: uiState.qwenAuthState.deviceAuth || void 0,
|
|
@@ -390704,9 +390991,9 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390704
390991
|
}
|
|
390705
390992
|
}
|
|
390706
390993
|
if (uiState.isEditorDialogOpen) {
|
|
390707
|
-
return /* @__PURE__ */ (0,
|
|
390708
|
-
uiState.editorError && /* @__PURE__ */ (0,
|
|
390709
|
-
/* @__PURE__ */ (0,
|
|
390994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
390995
|
+
uiState.editorError && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Text3, { color: theme.status.error, children: uiState.editorError }) }),
|
|
390996
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390710
390997
|
EditorSettingsDialog,
|
|
390711
390998
|
{
|
|
390712
390999
|
onSelect: uiActions.handleEditorSelect,
|
|
@@ -390717,7 +391004,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390717
391004
|
] });
|
|
390718
391005
|
}
|
|
390719
391006
|
if (uiState.isPermissionsDialogOpen) {
|
|
390720
|
-
return /* @__PURE__ */ (0,
|
|
391007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390721
391008
|
PermissionsModifyTrustDialog,
|
|
390722
391009
|
{
|
|
390723
391010
|
onExit: uiActions.closePermissionsDialog,
|
|
@@ -390726,7 +391013,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390726
391013
|
);
|
|
390727
391014
|
}
|
|
390728
391015
|
if (uiState.isSubagentCreateDialogOpen) {
|
|
390729
|
-
return /* @__PURE__ */ (0,
|
|
391016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390730
391017
|
AgentCreationWizard,
|
|
390731
391018
|
{
|
|
390732
391019
|
onClose: uiActions.closeSubagentCreateDialog,
|
|
@@ -390735,7 +391022,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
390735
391022
|
);
|
|
390736
391023
|
}
|
|
390737
391024
|
if (uiState.isAgentsManagerDialogOpen) {
|
|
390738
|
-
return /* @__PURE__ */ (0,
|
|
391025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
390739
391026
|
AgentsManagerDialog,
|
|
390740
391027
|
{
|
|
390741
391028
|
onClose: uiActions.closeAgentsManagerDialog,
|
|
@@ -390761,7 +391048,7 @@ function isNarrowWidth(width) {
|
|
|
390761
391048
|
__name(isNarrowWidth, "isNarrowWidth");
|
|
390762
391049
|
|
|
390763
391050
|
// packages/cli/src/ui/components/LoadingIndicator.tsx
|
|
390764
|
-
var
|
|
391051
|
+
var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
|
|
390765
391052
|
var LoadingIndicator = /* @__PURE__ */ __name(({
|
|
390766
391053
|
currentLoadingPhrase,
|
|
390767
391054
|
elapsedTime,
|
|
@@ -390778,41 +391065,41 @@ var LoadingIndicator = /* @__PURE__ */ __name(({
|
|
|
390778
391065
|
const cancelAndTimerContent = streamingState !== "waiting_for_confirmation" /* WaitingForConfirmation */ ? t3("(esc to cancel, {{time}})", {
|
|
390779
391066
|
time: elapsedTime < 60 ? `${elapsedTime}s` : formatDuration(elapsedTime * 1e3)
|
|
390780
391067
|
}) : null;
|
|
390781
|
-
return /* @__PURE__ */ (0,
|
|
390782
|
-
/* @__PURE__ */ (0,
|
|
391068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Box_default, { paddingLeft: 0, flexDirection: "column", children: [
|
|
391069
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
390783
391070
|
Box_default,
|
|
390784
391071
|
{
|
|
390785
391072
|
width: "100%",
|
|
390786
391073
|
flexDirection: isNarrow ? "column" : "row",
|
|
390787
391074
|
alignItems: isNarrow ? "flex-start" : "center",
|
|
390788
391075
|
children: [
|
|
390789
|
-
/* @__PURE__ */ (0,
|
|
390790
|
-
/* @__PURE__ */ (0,
|
|
391076
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Box_default, { children: [
|
|
391077
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { marginRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
390791
391078
|
GeminiRespondingSpinner,
|
|
390792
391079
|
{
|
|
390793
391080
|
nonRespondingDisplay: streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ ? "\u280F" : ""
|
|
390794
391081
|
}
|
|
390795
391082
|
) }),
|
|
390796
|
-
primaryText && /* @__PURE__ */ (0,
|
|
390797
|
-
!isNarrow && cancelAndTimerContent && /* @__PURE__ */ (0,
|
|
391083
|
+
primaryText && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Text3, { color: theme.text.accent, wrap: "truncate-end", children: primaryText }),
|
|
391084
|
+
!isNarrow && cancelAndTimerContent && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
390798
391085
|
" ",
|
|
390799
391086
|
cancelAndTimerContent
|
|
390800
391087
|
] })
|
|
390801
391088
|
] }),
|
|
390802
|
-
!isNarrow && /* @__PURE__ */ (0,
|
|
390803
|
-
!isNarrow && rightContent && /* @__PURE__ */ (0,
|
|
391089
|
+
!isNarrow && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { flexGrow: 1 }),
|
|
391090
|
+
!isNarrow && rightContent && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { children: rightContent })
|
|
390804
391091
|
]
|
|
390805
391092
|
}
|
|
390806
391093
|
),
|
|
390807
|
-
isNarrow && cancelAndTimerContent && /* @__PURE__ */ (0,
|
|
390808
|
-
isNarrow && rightContent && /* @__PURE__ */ (0,
|
|
391094
|
+
isNarrow && cancelAndTimerContent && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Text3, { color: theme.text.secondary, children: cancelAndTimerContent }) }),
|
|
391095
|
+
isNarrow && rightContent && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { children: rightContent })
|
|
390809
391096
|
] });
|
|
390810
391097
|
}, "LoadingIndicator");
|
|
390811
391098
|
|
|
390812
391099
|
// packages/cli/src/ui/components/ContextSummaryDisplay.tsx
|
|
390813
391100
|
init_esbuild_shims();
|
|
390814
391101
|
init_core4();
|
|
390815
|
-
var
|
|
391102
|
+
var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
|
|
390816
391103
|
var ContextSummaryDisplay = /* @__PURE__ */ __name(({
|
|
390817
391104
|
geminiMdFileCount,
|
|
390818
391105
|
contextFileNames,
|
|
@@ -390827,7 +391114,7 @@ var ContextSummaryDisplay = /* @__PURE__ */ __name(({
|
|
|
390827
391114
|
const blockedMcpServerCount = blockedMcpServers?.length || 0;
|
|
390828
391115
|
const openFileCount = ideContext?.workspaceState?.openFiles?.length ?? 0;
|
|
390829
391116
|
if (geminiMdFileCount === 0 && mcpServerCount === 0 && blockedMcpServerCount === 0 && openFileCount === 0) {
|
|
390830
|
-
return /* @__PURE__ */ (0,
|
|
391117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Text3, { children: " " });
|
|
390831
391118
|
}
|
|
390832
391119
|
const openFilesText = (() => {
|
|
390833
391120
|
if (openFileCount === 0) {
|
|
@@ -390885,16 +391172,16 @@ var ContextSummaryDisplay = /* @__PURE__ */ __name(({
|
|
|
390885
391172
|
})();
|
|
390886
391173
|
const summaryParts = [openFilesText, geminiMdText, mcpText].filter(Boolean);
|
|
390887
391174
|
if (isNarrow) {
|
|
390888
|
-
return /* @__PURE__ */ (0,
|
|
390889
|
-
/* @__PURE__ */ (0,
|
|
390890
|
-
summaryParts.map((part, index) => /* @__PURE__ */ (0,
|
|
391175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
391176
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Text3, { color: theme.text.secondary, children: t3("Using:") }),
|
|
391177
|
+
summaryParts.map((part, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
390891
391178
|
" ",
|
|
390892
391179
|
"- ",
|
|
390893
391180
|
part
|
|
390894
391181
|
] }, index))
|
|
390895
391182
|
] });
|
|
390896
391183
|
}
|
|
390897
|
-
return /* @__PURE__ */ (0,
|
|
391184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
390898
391185
|
t3("Using:"),
|
|
390899
391186
|
" ",
|
|
390900
391187
|
summaryParts.join(" | ")
|
|
@@ -390904,7 +391191,7 @@ var ContextSummaryDisplay = /* @__PURE__ */ __name(({
|
|
|
390904
391191
|
// packages/cli/src/ui/components/AutoAcceptIndicator.tsx
|
|
390905
391192
|
init_esbuild_shims();
|
|
390906
391193
|
init_core4();
|
|
390907
|
-
var
|
|
391194
|
+
var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
|
|
390908
391195
|
var AutoAcceptIndicator = /* @__PURE__ */ __name(({
|
|
390909
391196
|
approvalMode
|
|
390910
391197
|
}) => {
|
|
@@ -390931,29 +391218,29 @@ var AutoAcceptIndicator = /* @__PURE__ */ __name(({
|
|
|
390931
391218
|
default:
|
|
390932
391219
|
break;
|
|
390933
391220
|
}
|
|
390934
|
-
return /* @__PURE__ */ (0,
|
|
391221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Text3, { color: textColor, children: [
|
|
390935
391222
|
textContent2,
|
|
390936
|
-
subText && /* @__PURE__ */ (0,
|
|
391223
|
+
subText && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Text3, { color: theme.text.secondary, children: subText })
|
|
390937
391224
|
] }) });
|
|
390938
391225
|
}, "AutoAcceptIndicator");
|
|
390939
391226
|
|
|
390940
391227
|
// packages/cli/src/ui/components/ShellModeIndicator.tsx
|
|
390941
391228
|
init_esbuild_shims();
|
|
390942
|
-
var
|
|
390943
|
-
var ShellModeIndicator = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0,
|
|
391229
|
+
var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
|
|
391230
|
+
var ShellModeIndicator = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Text3, { color: theme.ui.symbol, children: [
|
|
390944
391231
|
"shell mode enabled",
|
|
390945
|
-
/* @__PURE__ */ (0,
|
|
391232
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Text3, { color: theme.text.secondary, children: " (esc to disable)" })
|
|
390946
391233
|
] }) }), "ShellModeIndicator");
|
|
390947
391234
|
|
|
390948
391235
|
// packages/cli/src/ui/components/DetailedMessagesDisplay.tsx
|
|
390949
391236
|
init_esbuild_shims();
|
|
390950
|
-
var
|
|
391237
|
+
var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
|
|
390951
391238
|
var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, width }) => {
|
|
390952
391239
|
if (messages.length === 0) {
|
|
390953
391240
|
return null;
|
|
390954
391241
|
}
|
|
390955
391242
|
const borderAndPadding = 4;
|
|
390956
|
-
return /* @__PURE__ */ (0,
|
|
391243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
390957
391244
|
Box_default,
|
|
390958
391245
|
{
|
|
390959
391246
|
flexDirection: "column",
|
|
@@ -390963,12 +391250,12 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
390963
391250
|
paddingX: 1,
|
|
390964
391251
|
width,
|
|
390965
391252
|
children: [
|
|
390966
|
-
/* @__PURE__ */ (0,
|
|
391253
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Text3, { bold: true, color: theme.text.primary, children: [
|
|
390967
391254
|
"Debug Console",
|
|
390968
391255
|
" ",
|
|
390969
|
-
/* @__PURE__ */ (0,
|
|
391256
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Text3, { color: theme.text.secondary, children: "(ctrl+o to close)" })
|
|
390970
391257
|
] }) }),
|
|
390971
|
-
/* @__PURE__ */ (0,
|
|
391258
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(MaxSizedBox, { maxHeight, maxWidth: width - borderAndPadding, children: messages.map((msg, index) => {
|
|
390972
391259
|
let textColor = theme.text.primary;
|
|
390973
391260
|
let icon = "\u2139";
|
|
390974
391261
|
switch (msg.type) {
|
|
@@ -390988,14 +391275,14 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
390988
391275
|
default:
|
|
390989
391276
|
break;
|
|
390990
391277
|
}
|
|
390991
|
-
return /* @__PURE__ */ (0,
|
|
390992
|
-
/* @__PURE__ */ (0,
|
|
391278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
391279
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Text3, { color: textColor, children: [
|
|
390993
391280
|
icon,
|
|
390994
391281
|
" "
|
|
390995
391282
|
] }),
|
|
390996
|
-
/* @__PURE__ */ (0,
|
|
391283
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Text3, { color: textColor, wrap: "wrap", children: [
|
|
390997
391284
|
msg.content,
|
|
390998
|
-
msg.count && msg.count > 1 && /* @__PURE__ */ (0,
|
|
391285
|
+
msg.count && msg.count > 1 && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
390999
391286
|
" (x",
|
|
391000
391287
|
msg.count,
|
|
391001
391288
|
")"
|
|
@@ -391018,7 +391305,7 @@ init_esbuild_shims();
|
|
|
391018
391305
|
// packages/cli/src/ui/components/PrepareLabel.tsx
|
|
391019
391306
|
init_esbuild_shims();
|
|
391020
391307
|
var import_react85 = __toESM(require_react(), 1);
|
|
391021
|
-
var
|
|
391308
|
+
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
|
|
391022
391309
|
var MAX_WIDTH = 150;
|
|
391023
391310
|
var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
391024
391311
|
label,
|
|
@@ -391030,7 +391317,7 @@ var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
|
391030
391317
|
const hasMatch = matchedIndex !== void 0 && matchedIndex >= 0 && matchedIndex < label.length && userInput.length > 0;
|
|
391031
391318
|
if (!hasMatch) {
|
|
391032
391319
|
const display = isExpanded ? label : label.length > MAX_WIDTH ? label.slice(0, MAX_WIDTH) + "..." : label;
|
|
391033
|
-
return /* @__PURE__ */ (0,
|
|
391320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Text3, { wrap: "wrap", color: textColor, children: display });
|
|
391034
391321
|
}
|
|
391035
391322
|
const matchLength = userInput.length;
|
|
391036
391323
|
let before = "";
|
|
@@ -391069,9 +391356,9 @@ var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
|
391069
391356
|
after = after.length >= 3 ? after.slice(0, -3) + "..." : "...";
|
|
391070
391357
|
}
|
|
391071
391358
|
}
|
|
391072
|
-
return /* @__PURE__ */ (0,
|
|
391359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Text3, { color: textColor, wrap: "wrap", children: [
|
|
391073
391360
|
before,
|
|
391074
|
-
match2 ? match2.split(/(\s+)/).map((part, index) => /* @__PURE__ */ (0,
|
|
391361
|
+
match2 ? match2.split(/(\s+)/).map((part, index) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
391075
391362
|
Text3,
|
|
391076
391363
|
{
|
|
391077
391364
|
color: theme.background.primary,
|
|
@@ -391086,7 +391373,7 @@ var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
|
391086
391373
|
var PrepareLabel = import_react85.default.memo(_PrepareLabel);
|
|
391087
391374
|
|
|
391088
391375
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
391089
|
-
var
|
|
391376
|
+
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
391090
391377
|
var MAX_SUGGESTIONS_TO_SHOW = 8;
|
|
391091
391378
|
function SuggestionsDisplay({
|
|
391092
391379
|
suggestions,
|
|
@@ -391099,7 +391386,7 @@ function SuggestionsDisplay({
|
|
|
391099
391386
|
expandedIndex
|
|
391100
391387
|
}) {
|
|
391101
391388
|
if (isLoading) {
|
|
391102
|
-
return /* @__PURE__ */ (0,
|
|
391389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Box_default, { paddingX: 1, width, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text3, { color: "gray", children: "Loading suggestions..." }) });
|
|
391103
391390
|
}
|
|
391104
391391
|
if (suggestions.length === 0) {
|
|
391105
391392
|
return null;
|
|
@@ -391115,8 +391402,8 @@ function SuggestionsDisplay({
|
|
|
391115
391402
|
...suggestions.map((s4) => getFullLabel(s4).length)
|
|
391116
391403
|
);
|
|
391117
391404
|
const commandColumnWidth = mode === "slash" ? Math.min(maxLabelLength, Math.floor(width * 0.5)) : 0;
|
|
391118
|
-
return /* @__PURE__ */ (0,
|
|
391119
|
-
scrollOffset > 0 && /* @__PURE__ */ (0,
|
|
391405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, width, children: [
|
|
391406
|
+
scrollOffset > 0 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text3, { color: theme.text.primary, children: "\u25B2" }),
|
|
391120
391407
|
visibleSuggestions.map((suggestion, index) => {
|
|
391121
391408
|
const originalIndex = startIndex + index;
|
|
391122
391409
|
const isActive = originalIndex === activeIndex;
|
|
@@ -391124,7 +391411,7 @@ function SuggestionsDisplay({
|
|
|
391124
391411
|
const textColor = isActive ? theme.text.accent : theme.text.secondary;
|
|
391125
391412
|
const displayLabel = suggestion.label ?? suggestion.value;
|
|
391126
391413
|
const isLong = displayLabel.length >= MAX_WIDTH;
|
|
391127
|
-
const labelElement = /* @__PURE__ */ (0,
|
|
391414
|
+
const labelElement = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
391128
391415
|
PrepareLabel,
|
|
391129
391416
|
{
|
|
391130
391417
|
label: displayLabel,
|
|
@@ -391134,23 +391421,23 @@ function SuggestionsDisplay({
|
|
|
391134
391421
|
isExpanded
|
|
391135
391422
|
}
|
|
391136
391423
|
);
|
|
391137
|
-
return /* @__PURE__ */ (0,
|
|
391138
|
-
/* @__PURE__ */ (0,
|
|
391424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
391425
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
391139
391426
|
Box_default,
|
|
391140
391427
|
{
|
|
391141
391428
|
...mode === "slash" ? { width: commandColumnWidth, flexShrink: 0 } : { flexShrink: 1 },
|
|
391142
|
-
children: /* @__PURE__ */ (0,
|
|
391429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Box_default, { children: [
|
|
391143
391430
|
labelElement,
|
|
391144
|
-
suggestion.commandKind === "mcp-prompt" /* MCP_PROMPT */ && /* @__PURE__ */ (0,
|
|
391431
|
+
suggestion.commandKind === "mcp-prompt" /* MCP_PROMPT */ && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text3, { color: textColor, children: " [MCP]" })
|
|
391145
391432
|
] })
|
|
391146
391433
|
}
|
|
391147
391434
|
),
|
|
391148
|
-
suggestion.description && /* @__PURE__ */ (0,
|
|
391149
|
-
isActive && isLong && /* @__PURE__ */ (0,
|
|
391435
|
+
suggestion.description && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Box_default, { flexGrow: 1, paddingLeft: 3, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text3, { color: textColor, wrap: "truncate", children: suggestion.description }) }),
|
|
391436
|
+
isActive && isLong && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text3, { color: Colors.Gray, children: isExpanded ? " \u2190 " : " \u2192 " }) })
|
|
391150
391437
|
] }, `${suggestion.value}-${originalIndex}`);
|
|
391151
391438
|
}),
|
|
391152
|
-
endIndex < suggestions.length && /* @__PURE__ */ (0,
|
|
391153
|
-
suggestions.length > MAX_SUGGESTIONS_TO_SHOW && /* @__PURE__ */ (0,
|
|
391439
|
+
endIndex < suggestions.length && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text3, { color: "gray", children: "\u25BC" }),
|
|
391440
|
+
suggestions.length > MAX_SUGGESTIONS_TO_SHOW && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Text3, { color: "gray", children: [
|
|
391154
391441
|
"(",
|
|
391155
391442
|
activeIndex + 1,
|
|
391156
391443
|
"/",
|
|
@@ -392423,7 +392710,7 @@ var ShellFocusContext = (0, import_react93.createContext)(true);
|
|
|
392423
392710
|
var useShellFocusState = /* @__PURE__ */ __name(() => (0, import_react93.useContext)(ShellFocusContext), "useShellFocusState");
|
|
392424
392711
|
|
|
392425
392712
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
392426
|
-
var
|
|
392713
|
+
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
392427
392714
|
var calculatePromptWidths = /* @__PURE__ */ __name((terminalWidth) => {
|
|
392428
392715
|
const widthFraction = 0.9;
|
|
392429
392716
|
const FRAME_PADDING_AND_BORDER = 4;
|
|
@@ -392932,21 +393219,21 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
392932
393219
|
statusColor = theme.status.warning;
|
|
392933
393220
|
statusText = t3("Accepting edits");
|
|
392934
393221
|
}
|
|
392935
|
-
return /* @__PURE__ */ (0,
|
|
392936
|
-
/* @__PURE__ */ (0,
|
|
393222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
393223
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
392937
393224
|
Box_default,
|
|
392938
393225
|
{
|
|
392939
393226
|
borderStyle: "round",
|
|
392940
393227
|
borderColor: isShellFocused && !isEmbeddedShellFocused ? statusColor ?? theme.border.focused : theme.border.default,
|
|
392941
393228
|
paddingX: 1,
|
|
392942
393229
|
children: [
|
|
392943
|
-
/* @__PURE__ */ (0,
|
|
393230
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
392944
393231
|
Text3,
|
|
392945
393232
|
{
|
|
392946
393233
|
color: statusColor ?? theme.text.accent,
|
|
392947
393234
|
"aria-label": statusText || void 0,
|
|
392948
393235
|
children: [
|
|
392949
|
-
shellModeActive ? reverseSearchActive ? /* @__PURE__ */ (0,
|
|
393236
|
+
shellModeActive ? reverseSearchActive ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
392950
393237
|
Text3,
|
|
392951
393238
|
{
|
|
392952
393239
|
color: theme.text.link,
|
|
@@ -392956,15 +393243,15 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
392956
393243
|
" "
|
|
392957
393244
|
]
|
|
392958
393245
|
}
|
|
392959
|
-
) : "!" : commandSearchActive ? /* @__PURE__ */ (0,
|
|
393246
|
+
) : "!" : commandSearchActive ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text3, { color: theme.text.accent, children: "(r:) " }) : showYoloStyling ? "*" : ">",
|
|
392960
393247
|
" "
|
|
392961
393248
|
]
|
|
392962
393249
|
}
|
|
392963
393250
|
),
|
|
392964
|
-
/* @__PURE__ */ (0,
|
|
393251
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Box_default, { flexGrow: 1, flexDirection: "column", children: buffer.text.length === 0 && placeholder ? showCursor ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Text3, { children: [
|
|
392965
393252
|
import_chalk7.default.inverse(placeholder.slice(0, 1)),
|
|
392966
|
-
/* @__PURE__ */ (0,
|
|
392967
|
-
] }) : /* @__PURE__ */ (0,
|
|
393253
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text3, { color: theme.text.secondary, children: placeholder.slice(1) })
|
|
393254
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text3, { color: theme.text.secondary, children: placeholder }) : linesToRender.map((lineText, visualIdxInRenderedSet) => {
|
|
392968
393255
|
const absoluteVisualIdx = scrollVisualRow + visualIdxInRenderedSet;
|
|
392969
393256
|
const mapEntry = buffer.visualToLogicalMap[absoluteVisualIdx];
|
|
392970
393257
|
const cursorVisualRow = cursorVisualRowAbsolute - scrollVisualRow;
|
|
@@ -393011,20 +393298,20 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
393011
393298
|
}
|
|
393012
393299
|
const color = seg.type === "command" || seg.type === "file" ? theme.text.accent : theme.text.primary;
|
|
393013
393300
|
renderedLine.push(
|
|
393014
|
-
/* @__PURE__ */ (0,
|
|
393301
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text3, { color, children: display }, `token-${segIdx}`)
|
|
393015
393302
|
);
|
|
393016
393303
|
});
|
|
393017
393304
|
if (isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText)) {
|
|
393018
393305
|
renderedLine.push(
|
|
393019
|
-
/* @__PURE__ */ (0,
|
|
393306
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text3, { children: showCursor ? import_chalk7.default.inverse(" ") : " " }, `cursor-end-${cursorVisualColAbsolute}`)
|
|
393020
393307
|
);
|
|
393021
393308
|
}
|
|
393022
|
-
return /* @__PURE__ */ (0,
|
|
393309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Box_default, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text3, { children: renderedLine }) }, `line-${visualIdxInRenderedSet}`);
|
|
393023
393310
|
}) })
|
|
393024
393311
|
]
|
|
393025
393312
|
}
|
|
393026
393313
|
),
|
|
393027
|
-
shouldShowSuggestions && /* @__PURE__ */ (0,
|
|
393314
|
+
shouldShowSuggestions && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Box_default, { paddingRight: 2, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
393028
393315
|
SuggestionsDisplay,
|
|
393029
393316
|
{
|
|
393030
393317
|
suggestions: activeCompletion.suggestions,
|
|
@@ -393046,7 +393333,7 @@ init_core4();
|
|
|
393046
393333
|
|
|
393047
393334
|
// packages/cli/src/ui/components/ConsoleSummaryDisplay.tsx
|
|
393048
393335
|
init_esbuild_shims();
|
|
393049
|
-
var
|
|
393336
|
+
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
393050
393337
|
var ConsoleSummaryDisplay = /* @__PURE__ */ __name(({
|
|
393051
393338
|
errorCount
|
|
393052
393339
|
}) => {
|
|
@@ -393054,14 +393341,14 @@ var ConsoleSummaryDisplay = /* @__PURE__ */ __name(({
|
|
|
393054
393341
|
return null;
|
|
393055
393342
|
}
|
|
393056
393343
|
const errorIcon = "\u2716";
|
|
393057
|
-
return /* @__PURE__ */ (0,
|
|
393344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Box_default, { children: errorCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Text3, { color: theme.status.error, children: [
|
|
393058
393345
|
errorIcon,
|
|
393059
393346
|
" ",
|
|
393060
393347
|
errorCount,
|
|
393061
393348
|
" error",
|
|
393062
393349
|
errorCount > 1 ? "s" : "",
|
|
393063
393350
|
" ",
|
|
393064
|
-
/* @__PURE__ */ (0,
|
|
393351
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text3, { color: theme.text.secondary, children: "(ctrl+o for details)" })
|
|
393065
393352
|
] }) });
|
|
393066
393353
|
}, "ConsoleSummaryDisplay");
|
|
393067
393354
|
|
|
@@ -393072,7 +393359,7 @@ import process35 from "node:process";
|
|
|
393072
393359
|
init_esbuild_shims();
|
|
393073
393360
|
var import_react95 = __toESM(require_react(), 1);
|
|
393074
393361
|
import process34 from "node:process";
|
|
393075
|
-
var
|
|
393362
|
+
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
393076
393363
|
var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
|
|
393077
393364
|
const [memoryUsage, setMemoryUsage] = (0, import_react95.useState)("");
|
|
393078
393365
|
const [memoryUsageColor, setMemoryUsageColor] = (0, import_react95.useState)(
|
|
@@ -393090,16 +393377,16 @@ var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
|
|
|
393090
393377
|
updateMemory();
|
|
393091
393378
|
return () => clearInterval(intervalId);
|
|
393092
393379
|
}, []);
|
|
393093
|
-
return /* @__PURE__ */ (0,
|
|
393094
|
-
/* @__PURE__ */ (0,
|
|
393095
|
-
/* @__PURE__ */ (0,
|
|
393380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(Box_default, { children: [
|
|
393381
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Text3, { color: theme.text.secondary, children: " | " }),
|
|
393382
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Text3, { color: memoryUsageColor, children: memoryUsage })
|
|
393096
393383
|
] });
|
|
393097
393384
|
}, "MemoryUsageDisplay");
|
|
393098
393385
|
|
|
393099
393386
|
// packages/cli/src/ui/components/ContextUsageDisplay.tsx
|
|
393100
393387
|
init_esbuild_shims();
|
|
393101
393388
|
init_core4();
|
|
393102
|
-
var
|
|
393389
|
+
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
|
|
393103
393390
|
var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
393104
393391
|
promptTokenCount,
|
|
393105
393392
|
model,
|
|
@@ -393108,7 +393395,7 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
|
393108
393395
|
const percentage = promptTokenCount / tokenLimit(model);
|
|
393109
393396
|
const percentageLeft = ((1 - percentage) * 100).toFixed(0);
|
|
393110
393397
|
const label = terminalWidth < 100 ? "%" : "% context left";
|
|
393111
|
-
return /* @__PURE__ */ (0,
|
|
393398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
393112
393399
|
"(",
|
|
393113
393400
|
percentageLeft,
|
|
393114
393401
|
label,
|
|
@@ -393119,7 +393406,7 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
|
393119
393406
|
// packages/cli/src/ui/components/DebugProfiler.tsx
|
|
393120
393407
|
init_esbuild_shims();
|
|
393121
393408
|
var import_react96 = __toESM(require_react(), 1);
|
|
393122
|
-
var
|
|
393409
|
+
var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
|
|
393123
393410
|
var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
393124
393411
|
const numRenders = (0, import_react96.useRef)(0);
|
|
393125
393412
|
const [showNumRenders, setShowNumRenders] = (0, import_react96.useState)(false);
|
|
@@ -393137,7 +393424,7 @@ var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
|
393137
393424
|
if (!showNumRenders) {
|
|
393138
393425
|
return null;
|
|
393139
393426
|
}
|
|
393140
|
-
return /* @__PURE__ */ (0,
|
|
393427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(Text3, { color: theme.status.warning, children: [
|
|
393141
393428
|
"Renders: ",
|
|
393142
393429
|
numRenders.current,
|
|
393143
393430
|
" "
|
|
@@ -393145,7 +393432,7 @@ var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
|
393145
393432
|
}, "DebugProfiler");
|
|
393146
393433
|
|
|
393147
393434
|
// packages/cli/src/ui/components/Footer.tsx
|
|
393148
|
-
var
|
|
393435
|
+
var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
|
|
393149
393436
|
var Footer = /* @__PURE__ */ __name(() => {
|
|
393150
393437
|
const uiState = useUIState();
|
|
393151
393438
|
const config2 = useConfig();
|
|
@@ -393185,7 +393472,7 @@ var Footer = /* @__PURE__ */ __name(() => {
|
|
|
393185
393472
|
const displayPath = shortenPath(tildeifyPath(targetDir), pathLength);
|
|
393186
393473
|
const justifyContent = hideCWD && hideModelInfo ? "center" : "space-between";
|
|
393187
393474
|
const displayVimMode = vimEnabled ? vimMode : void 0;
|
|
393188
|
-
return /* @__PURE__ */ (0,
|
|
393475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
393189
393476
|
Box_default,
|
|
393190
393477
|
{
|
|
393191
393478
|
justifyContent,
|
|
@@ -393193,57 +393480,57 @@ var Footer = /* @__PURE__ */ __name(() => {
|
|
|
393193
393480
|
flexDirection: "row",
|
|
393194
393481
|
alignItems: "center",
|
|
393195
393482
|
children: [
|
|
393196
|
-
(debugMode || displayVimMode || !hideCWD) && /* @__PURE__ */ (0,
|
|
393197
|
-
debugMode && /* @__PURE__ */ (0,
|
|
393198
|
-
displayVimMode && /* @__PURE__ */ (0,
|
|
393483
|
+
(debugMode || displayVimMode || !hideCWD) && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { children: [
|
|
393484
|
+
debugMode && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(DebugProfiler, {}),
|
|
393485
|
+
displayVimMode && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
393199
393486
|
"[",
|
|
393200
393487
|
displayVimMode,
|
|
393201
393488
|
"] "
|
|
393202
393489
|
] }),
|
|
393203
|
-
!hideCWD && (nightly ? /* @__PURE__ */ (0,
|
|
393490
|
+
!hideCWD && (nightly ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(dist_default5, { colors: theme.ui.gradient, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { children: [
|
|
393204
393491
|
displayPath,
|
|
393205
|
-
branchName && /* @__PURE__ */ (0,
|
|
393492
|
+
branchName && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { children: [
|
|
393206
393493
|
" (",
|
|
393207
393494
|
branchName,
|
|
393208
393495
|
"*)"
|
|
393209
393496
|
] })
|
|
393210
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
393497
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.text.link, children: [
|
|
393211
393498
|
displayPath,
|
|
393212
|
-
branchName && /* @__PURE__ */ (0,
|
|
393499
|
+
branchName && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
393213
393500
|
" (",
|
|
393214
393501
|
branchName,
|
|
393215
393502
|
"*)"
|
|
393216
393503
|
] })
|
|
393217
393504
|
] })),
|
|
393218
|
-
debugMode && /* @__PURE__ */ (0,
|
|
393505
|
+
debugMode && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.status.error, children: " " + (debugMessage || "--debug") })
|
|
393219
393506
|
] }),
|
|
393220
|
-
!hideSandboxStatus && /* @__PURE__ */ (0,
|
|
393507
|
+
!hideSandboxStatus && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
393221
393508
|
Box_default,
|
|
393222
393509
|
{
|
|
393223
393510
|
flexGrow: 1,
|
|
393224
393511
|
alignItems: "center",
|
|
393225
393512
|
justifyContent: "center",
|
|
393226
393513
|
display: "flex",
|
|
393227
|
-
children: isTrustedFolder === false ? /* @__PURE__ */ (0,
|
|
393514
|
+
children: isTrustedFolder === false ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.status.warning, children: "untrusted" }) : process35.env["SANDBOX"] && process35.env["SANDBOX"] !== "sandbox-exec" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: "green", children: process35.env["SANDBOX"].replace(/^gemini-(?:cli-)?/, "") }) : process35.env["SANDBOX"] === "sandbox-exec" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.status.warning, children: [
|
|
393228
393515
|
"macOS Seatbelt",
|
|
393229
393516
|
" ",
|
|
393230
|
-
/* @__PURE__ */ (0,
|
|
393517
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
393231
393518
|
"(",
|
|
393232
393519
|
process35.env["SEATBELT_PROFILE"],
|
|
393233
393520
|
")"
|
|
393234
393521
|
] })
|
|
393235
|
-
] }) : /* @__PURE__ */ (0,
|
|
393522
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.status.error, children: [
|
|
393236
393523
|
"no sandbox",
|
|
393237
|
-
terminalWidth >= 100 && /* @__PURE__ */ (0,
|
|
393524
|
+
terminalWidth >= 100 && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.text.secondary, children: " (see /docs)" })
|
|
393238
393525
|
] })
|
|
393239
393526
|
}
|
|
393240
393527
|
),
|
|
393241
|
-
!hideModelInfo && /* @__PURE__ */ (0,
|
|
393242
|
-
/* @__PURE__ */ (0,
|
|
393243
|
-
/* @__PURE__ */ (0,
|
|
393528
|
+
!hideModelInfo && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { alignItems: "center", justifyContent: "flex-end", children: [
|
|
393529
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { alignItems: "center", children: [
|
|
393530
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { color: theme.text.accent, children: [
|
|
393244
393531
|
model,
|
|
393245
393532
|
" ",
|
|
393246
|
-
/* @__PURE__ */ (0,
|
|
393533
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
393247
393534
|
ContextUsageDisplay,
|
|
393248
393535
|
{
|
|
393249
393536
|
promptTokenCount,
|
|
@@ -393252,20 +393539,20 @@ var Footer = /* @__PURE__ */ __name(() => {
|
|
|
393252
393539
|
}
|
|
393253
393540
|
)
|
|
393254
393541
|
] }),
|
|
393255
|
-
showMemoryUsage && /* @__PURE__ */ (0,
|
|
393542
|
+
showMemoryUsage && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(MemoryUsageDisplay, {})
|
|
393256
393543
|
] }),
|
|
393257
|
-
/* @__PURE__ */ (0,
|
|
393258
|
-
corgiMode && /* @__PURE__ */ (0,
|
|
393259
|
-
/* @__PURE__ */ (0,
|
|
393260
|
-
/* @__PURE__ */ (0,
|
|
393261
|
-
/* @__PURE__ */ (0,
|
|
393262
|
-
/* @__PURE__ */ (0,
|
|
393263
|
-
/* @__PURE__ */ (0,
|
|
393264
|
-
/* @__PURE__ */ (0,
|
|
393544
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { alignItems: "center", paddingLeft: 2, children: [
|
|
393545
|
+
corgiMode && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text3, { children: [
|
|
393546
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.ui.symbol, children: "| " }),
|
|
393547
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.status.error, children: "\u25BC" }),
|
|
393548
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.text.primary, children: "(\xB4" }),
|
|
393549
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.status.error, children: "\u1D25" }),
|
|
393550
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.text.primary, children: "`)" }),
|
|
393551
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.status.error, children: "\u25BC " })
|
|
393265
393552
|
] }),
|
|
393266
|
-
!showErrorDetails && errorCount > 0 && /* @__PURE__ */ (0,
|
|
393267
|
-
/* @__PURE__ */ (0,
|
|
393268
|
-
/* @__PURE__ */ (0,
|
|
393553
|
+
!showErrorDetails && errorCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { children: [
|
|
393554
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text3, { color: theme.ui.symbol, children: "| " }),
|
|
393555
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ConsoleSummaryDisplay, { errorCount })
|
|
393269
393556
|
] })
|
|
393270
393557
|
] })
|
|
393271
393558
|
] })
|
|
@@ -393276,7 +393563,7 @@ var Footer = /* @__PURE__ */ __name(() => {
|
|
|
393276
393563
|
|
|
393277
393564
|
// packages/cli/src/ui/components/QueuedMessageDisplay.tsx
|
|
393278
393565
|
init_esbuild_shims();
|
|
393279
|
-
var
|
|
393566
|
+
var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
|
|
393280
393567
|
var MAX_DISPLAYED_QUEUED_MESSAGES = 3;
|
|
393281
393568
|
var QueuedMessageDisplay = /* @__PURE__ */ __name(({
|
|
393282
393569
|
messageQueue
|
|
@@ -393284,12 +393571,12 @@ var QueuedMessageDisplay = /* @__PURE__ */ __name(({
|
|
|
393284
393571
|
if (messageQueue.length === 0) {
|
|
393285
393572
|
return null;
|
|
393286
393573
|
}
|
|
393287
|
-
return /* @__PURE__ */ (0,
|
|
393574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
393288
393575
|
messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
|
|
393289
393576
|
const preview = message.replace(/\s+/g, " ");
|
|
393290
|
-
return /* @__PURE__ */ (0,
|
|
393577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Box_default, { paddingLeft: 2, width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Text3, { dimColor: true, wrap: "truncate", children: preview }) }, index);
|
|
393291
393578
|
}),
|
|
393292
|
-
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ (0,
|
|
393579
|
+
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Text3, { dimColor: true, children: [
|
|
393293
393580
|
"... (+",
|
|
393294
393581
|
messageQueue.length - MAX_DISPLAYED_QUEUED_MESSAGES,
|
|
393295
393582
|
" more)"
|
|
@@ -393304,7 +393591,7 @@ init_core4();
|
|
|
393304
393591
|
init_esbuild_shims();
|
|
393305
393592
|
var import_react97 = __toESM(require_react(), 1);
|
|
393306
393593
|
init_core4();
|
|
393307
|
-
var
|
|
393594
|
+
var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
|
|
393308
393595
|
var ConfigInitDisplay = /* @__PURE__ */ __name(() => {
|
|
393309
393596
|
const config2 = useConfig();
|
|
393310
393597
|
const [message, setMessage] = (0, import_react97.useState)(t3("Initializing..."));
|
|
@@ -393332,15 +393619,15 @@ var ConfigInitDisplay = /* @__PURE__ */ __name(() => {
|
|
|
393332
393619
|
appEvents.off("mcp-client-update", onChange);
|
|
393333
393620
|
};
|
|
393334
393621
|
}, [config2]);
|
|
393335
|
-
return /* @__PURE__ */ (0,
|
|
393336
|
-
/* @__PURE__ */ (0,
|
|
393622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(Text3, { children: [
|
|
393623
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(GeminiSpinner, {}),
|
|
393337
393624
|
" ",
|
|
393338
|
-
/* @__PURE__ */ (0,
|
|
393625
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Text3, { color: theme.text.primary, children: message })
|
|
393339
393626
|
] }) });
|
|
393340
393627
|
}, "ConfigInitDisplay");
|
|
393341
393628
|
|
|
393342
393629
|
// packages/cli/src/ui/components/Composer.tsx
|
|
393343
|
-
var
|
|
393630
|
+
var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
|
|
393344
393631
|
var Composer = /* @__PURE__ */ __name(() => {
|
|
393345
393632
|
const config2 = useConfig();
|
|
393346
393633
|
const settings = useSettings();
|
|
@@ -393356,8 +393643,8 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
393356
393643
|
() => calculatePromptWidths(uiState.terminalWidth),
|
|
393357
393644
|
[uiState.terminalWidth]
|
|
393358
393645
|
);
|
|
393359
|
-
return /* @__PURE__ */ (0,
|
|
393360
|
-
!uiState.embeddedShellFocused && /* @__PURE__ */ (0,
|
|
393646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
393647
|
+
!uiState.embeddedShellFocused && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
393361
393648
|
LoadingIndicator,
|
|
393362
393649
|
{
|
|
393363
393650
|
thought: uiState.streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ || config2.getAccessibility()?.disableLoadingPhrases ? void 0 : uiState.thought,
|
|
@@ -393365,9 +393652,9 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
393365
393652
|
elapsedTime: uiState.elapsedTime
|
|
393366
393653
|
}
|
|
393367
393654
|
),
|
|
393368
|
-
!uiState.isConfigInitialized && /* @__PURE__ */ (0,
|
|
393369
|
-
/* @__PURE__ */ (0,
|
|
393370
|
-
/* @__PURE__ */ (0,
|
|
393655
|
+
!uiState.isConfigInitialized && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ConfigInitDisplay, {}),
|
|
393656
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(QueuedMessageDisplay, { messageQueue: uiState.messageQueue }),
|
|
393657
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
393371
393658
|
Box_default,
|
|
393372
393659
|
{
|
|
393373
393660
|
marginTop: 1,
|
|
@@ -393376,9 +393663,9 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
393376
393663
|
flexDirection: isNarrow ? "column" : "row",
|
|
393377
393664
|
alignItems: isNarrow ? "flex-start" : "center",
|
|
393378
393665
|
children: [
|
|
393379
|
-
/* @__PURE__ */ (0,
|
|
393380
|
-
process.env["GEMINI_SYSTEM_MD"] && /* @__PURE__ */ (0,
|
|
393381
|
-
uiState.ctrlCPressedOnce ? /* @__PURE__ */ (0,
|
|
393666
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Box_default, { marginRight: 1, children: [
|
|
393667
|
+
process.env["GEMINI_SYSTEM_MD"] && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text3, { color: theme.status.error, children: "|\u2310\u25A0_\u25A0| " }),
|
|
393668
|
+
uiState.ctrlCPressedOnce ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text3, { color: theme.status.warning, children: t3("Press Ctrl+C again to exit.") }) : uiState.ctrlDPressedOnce ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text3, { color: theme.status.warning, children: t3("Press Ctrl+D again to exit.") }) : uiState.showEscapePrompt ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text3, { color: theme.text.secondary, children: t3("Press Esc again to clear.") }) : !settings.merged.ui?.hideContextSummary && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
393382
393669
|
ContextSummaryDisplay,
|
|
393383
393670
|
{
|
|
393384
393671
|
ideContext: uiState.ideContextState,
|
|
@@ -393390,15 +393677,15 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
393390
393677
|
}
|
|
393391
393678
|
)
|
|
393392
393679
|
] }),
|
|
393393
|
-
/* @__PURE__ */ (0,
|
|
393394
|
-
showAutoAcceptIndicator !== "default" /* DEFAULT */ && !uiState.shellModeActive && /* @__PURE__ */ (0,
|
|
393395
|
-
uiState.shellModeActive && /* @__PURE__ */ (0,
|
|
393680
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Box_default, { paddingTop: isNarrow ? 1 : 0, children: [
|
|
393681
|
+
showAutoAcceptIndicator !== "default" /* DEFAULT */ && !uiState.shellModeActive && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }),
|
|
393682
|
+
uiState.shellModeActive && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ShellModeIndicator, {})
|
|
393396
393683
|
] })
|
|
393397
393684
|
]
|
|
393398
393685
|
}
|
|
393399
393686
|
),
|
|
393400
|
-
uiState.showErrorDetails && /* @__PURE__ */ (0,
|
|
393401
|
-
/* @__PURE__ */ (0,
|
|
393687
|
+
uiState.showErrorDetails && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(OverflowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
393688
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
393402
393689
|
DetailedMessagesDisplay,
|
|
393403
393690
|
{
|
|
393404
393691
|
messages: uiState.filteredConsoleMessages,
|
|
@@ -393406,9 +393693,9 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
393406
393693
|
width: containerWidth
|
|
393407
393694
|
}
|
|
393408
393695
|
),
|
|
393409
|
-
/* @__PURE__ */ (0,
|
|
393696
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ShowMoreLines, { constrainHeight: uiState.constrainHeight })
|
|
393410
393697
|
] }) }),
|
|
393411
|
-
uiState.isInputActive && /* @__PURE__ */ (0,
|
|
393698
|
+
uiState.isInputActive && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
393412
393699
|
InputPrompt,
|
|
393413
393700
|
{
|
|
393414
393701
|
buffer: uiState.buffer,
|
|
@@ -393430,65 +393717,65 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
393430
393717
|
placeholder: vimEnabled ? " " + t3("Press 'i' for INSERT mode and 'Esc' for NORMAL mode.") : " " + t3("Type your message or @path/to/file")
|
|
393431
393718
|
}
|
|
393432
393719
|
),
|
|
393433
|
-
!settings.merged.ui?.hideFooter && !isScreenReaderEnabled && /* @__PURE__ */ (0,
|
|
393720
|
+
!settings.merged.ui?.hideFooter && !isScreenReaderEnabled && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Footer, {})
|
|
393434
393721
|
] });
|
|
393435
393722
|
}, "Composer");
|
|
393436
393723
|
|
|
393437
393724
|
// packages/cli/src/ui/components/ExitWarning.tsx
|
|
393438
393725
|
init_esbuild_shims();
|
|
393439
|
-
var
|
|
393726
|
+
var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
|
|
393440
393727
|
var ExitWarning = /* @__PURE__ */ __name(() => {
|
|
393441
393728
|
const uiState = useUIState();
|
|
393442
|
-
return /* @__PURE__ */ (0,
|
|
393443
|
-
uiState.dialogsVisible && uiState.ctrlCPressedOnce && /* @__PURE__ */ (0,
|
|
393444
|
-
uiState.dialogsVisible && uiState.ctrlDPressedOnce && /* @__PURE__ */ (0,
|
|
393729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
393730
|
+
uiState.dialogsVisible && uiState.ctrlCPressedOnce && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text3, { color: theme.status.warning, children: "Press Ctrl+C again to exit." }) }),
|
|
393731
|
+
uiState.dialogsVisible && uiState.ctrlDPressedOnce && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text3, { color: theme.status.warning, children: "Press Ctrl+D again to exit." }) })
|
|
393445
393732
|
] });
|
|
393446
393733
|
}, "ExitWarning");
|
|
393447
393734
|
|
|
393448
393735
|
// packages/cli/src/ui/layouts/ScreenReaderAppLayout.tsx
|
|
393449
|
-
var
|
|
393736
|
+
var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
|
|
393450
393737
|
var ScreenReaderAppLayout = /* @__PURE__ */ __name(() => {
|
|
393451
393738
|
const uiState = useUIState();
|
|
393452
|
-
return /* @__PURE__ */ (0,
|
|
393453
|
-
/* @__PURE__ */ (0,
|
|
393454
|
-
/* @__PURE__ */ (0,
|
|
393455
|
-
/* @__PURE__ */ (0,
|
|
393456
|
-
uiState.dialogsVisible ? /* @__PURE__ */ (0,
|
|
393739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(Box_default, { flexDirection: "column", width: "90%", height: "100%", children: [
|
|
393740
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Notifications, {}),
|
|
393741
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Footer, {}),
|
|
393742
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Box_default, { flexGrow: 1, overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(MainContent, {}) }),
|
|
393743
|
+
uiState.dialogsVisible ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
393457
393744
|
DialogManager,
|
|
393458
393745
|
{
|
|
393459
393746
|
terminalWidth: uiState.terminalWidth,
|
|
393460
393747
|
addItem: uiState.historyManager.addItem
|
|
393461
393748
|
}
|
|
393462
|
-
) : /* @__PURE__ */ (0,
|
|
393463
|
-
/* @__PURE__ */ (0,
|
|
393749
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Composer, {}),
|
|
393750
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(ExitWarning, {})
|
|
393464
393751
|
] });
|
|
393465
393752
|
}, "ScreenReaderAppLayout");
|
|
393466
393753
|
|
|
393467
393754
|
// packages/cli/src/ui/layouts/DefaultAppLayout.tsx
|
|
393468
393755
|
init_esbuild_shims();
|
|
393469
|
-
var
|
|
393756
|
+
var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
|
|
393470
393757
|
var DefaultAppLayout = /* @__PURE__ */ __name(({
|
|
393471
393758
|
width = "90%"
|
|
393472
393759
|
}) => {
|
|
393473
393760
|
const uiState = useUIState();
|
|
393474
|
-
return /* @__PURE__ */ (0,
|
|
393475
|
-
/* @__PURE__ */ (0,
|
|
393476
|
-
/* @__PURE__ */ (0,
|
|
393477
|
-
/* @__PURE__ */ (0,
|
|
393478
|
-
uiState.dialogsVisible ? /* @__PURE__ */ (0,
|
|
393761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(Box_default, { flexDirection: "column", width, children: [
|
|
393762
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(MainContent, {}),
|
|
393763
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(Box_default, { flexDirection: "column", ref: uiState.mainControlsRef, children: [
|
|
393764
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Notifications, {}),
|
|
393765
|
+
uiState.dialogsVisible ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
393479
393766
|
DialogManager,
|
|
393480
393767
|
{
|
|
393481
393768
|
terminalWidth: uiState.terminalWidth,
|
|
393482
393769
|
addItem: uiState.historyManager.addItem
|
|
393483
393770
|
}
|
|
393484
|
-
) : /* @__PURE__ */ (0,
|
|
393485
|
-
/* @__PURE__ */ (0,
|
|
393771
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Composer, {}),
|
|
393772
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(ExitWarning, {})
|
|
393486
393773
|
] })
|
|
393487
393774
|
] });
|
|
393488
393775
|
}, "DefaultAppLayout");
|
|
393489
393776
|
|
|
393490
393777
|
// packages/cli/src/ui/App.tsx
|
|
393491
|
-
var
|
|
393778
|
+
var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
|
|
393492
393779
|
var getContainerWidth = /* @__PURE__ */ __name((terminalWidth) => {
|
|
393493
393780
|
if (terminalWidth <= 80) {
|
|
393494
393781
|
return "98%";
|
|
@@ -393506,9 +393793,9 @@ var App2 = /* @__PURE__ */ __name(() => {
|
|
|
393506
393793
|
const { columns } = useTerminalSize();
|
|
393507
393794
|
const containerWidth = getContainerWidth(columns);
|
|
393508
393795
|
if (uiState.quittingMessages) {
|
|
393509
|
-
return /* @__PURE__ */ (0,
|
|
393796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(QuittingDisplay, {});
|
|
393510
393797
|
}
|
|
393511
|
-
return /* @__PURE__ */ (0,
|
|
393798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(StreamingContext.Provider, { value: uiState.streamingState, children: isScreenReaderEnabled ? /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(ScreenReaderAppLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DefaultAppLayout, { width: containerWidth }) });
|
|
393512
393799
|
}, "App");
|
|
393513
393800
|
|
|
393514
393801
|
// packages/cli/src/ui/AppContainer.tsx
|
|
@@ -395196,7 +395483,6 @@ function serializeHistoryItemForRecording(item) {
|
|
|
395196
395483
|
__name(serializeHistoryItemForRecording, "serializeHistoryItemForRecording");
|
|
395197
395484
|
var SLASH_COMMANDS_SKIP_RECORDING = /* @__PURE__ */ new Set([
|
|
395198
395485
|
"quit",
|
|
395199
|
-
"quit-confirm",
|
|
395200
395486
|
"exit",
|
|
395201
395487
|
"clear",
|
|
395202
395488
|
"reset",
|
|
@@ -395211,7 +395497,6 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings, addIte
|
|
|
395211
395497
|
}, []);
|
|
395212
395498
|
const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react108.useState)(null);
|
|
395213
395499
|
const [confirmationRequest, setConfirmationRequest] = (0, import_react108.useState)(null);
|
|
395214
|
-
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0, import_react108.useState)(null);
|
|
395215
395500
|
const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react108.useState)(
|
|
395216
395501
|
/* @__PURE__ */ new Set()
|
|
395217
395502
|
);
|
|
@@ -395262,11 +395547,6 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings, addIte
|
|
|
395262
395547
|
type: "quit",
|
|
395263
395548
|
duration: message.duration
|
|
395264
395549
|
};
|
|
395265
|
-
} else if (message.type === "quit_confirmation" /* QUIT_CONFIRMATION */) {
|
|
395266
|
-
historyItemContent = {
|
|
395267
|
-
type: "quit_confirmation",
|
|
395268
|
-
duration: message.duration
|
|
395269
|
-
};
|
|
395270
395550
|
} else if (message.type === "compression" /* COMPRESSION */) {
|
|
395271
395551
|
historyItemContent = {
|
|
395272
395552
|
type: "compression",
|
|
@@ -395505,52 +395785,6 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings, addIte
|
|
|
395505
395785
|
});
|
|
395506
395786
|
return { type: "handled" };
|
|
395507
395787
|
}
|
|
395508
|
-
case "quit_confirmation":
|
|
395509
|
-
setQuitConfirmationRequest({
|
|
395510
|
-
onConfirm: /* @__PURE__ */ __name((shouldQuit, action) => {
|
|
395511
|
-
setQuitConfirmationRequest(null);
|
|
395512
|
-
if (!shouldQuit) {
|
|
395513
|
-
return;
|
|
395514
|
-
}
|
|
395515
|
-
if (shouldQuit) {
|
|
395516
|
-
if (action === "summary_and_quit") {
|
|
395517
|
-
handleSlashCommand2("/summary").then(() => {
|
|
395518
|
-
setTimeout(() => {
|
|
395519
|
-
handleSlashCommand2("/quit");
|
|
395520
|
-
}, 1200);
|
|
395521
|
-
}).catch((error2) => {
|
|
395522
|
-
addItemWithRecording(
|
|
395523
|
-
{
|
|
395524
|
-
type: "error",
|
|
395525
|
-
text: `Failed to generate summary before quit: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
395526
|
-
},
|
|
395527
|
-
Date.now()
|
|
395528
|
-
);
|
|
395529
|
-
setTimeout(() => {
|
|
395530
|
-
handleSlashCommand2("/quit");
|
|
395531
|
-
}, 1e3);
|
|
395532
|
-
});
|
|
395533
|
-
} else {
|
|
395534
|
-
const now = Date.now();
|
|
395535
|
-
const { sessionStartTime } = sessionStats;
|
|
395536
|
-
const wallDuration = now - sessionStartTime.getTime();
|
|
395537
|
-
actions.quit([
|
|
395538
|
-
{
|
|
395539
|
-
type: "user",
|
|
395540
|
-
text: `/quit`,
|
|
395541
|
-
id: now - 1
|
|
395542
|
-
},
|
|
395543
|
-
{
|
|
395544
|
-
type: "quit",
|
|
395545
|
-
duration: formatDuration(wallDuration),
|
|
395546
|
-
id: now
|
|
395547
|
-
}
|
|
395548
|
-
]);
|
|
395549
|
-
}
|
|
395550
|
-
}
|
|
395551
|
-
}, "onConfirm")
|
|
395552
|
-
});
|
|
395553
|
-
return { type: "handled" };
|
|
395554
395788
|
case "quit":
|
|
395555
395789
|
actions.quit(result.messages);
|
|
395556
395790
|
return { type: "handled" };
|
|
@@ -395720,8 +395954,7 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
|
|
|
395720
395954
|
setShellConfirmationRequest,
|
|
395721
395955
|
setSessionShellAllowlist,
|
|
395722
395956
|
setIsProcessing,
|
|
395723
|
-
setConfirmationRequest
|
|
395724
|
-
sessionStats
|
|
395957
|
+
setConfirmationRequest
|
|
395725
395958
|
]
|
|
395726
395959
|
);
|
|
395727
395960
|
return {
|
|
@@ -395731,7 +395964,6 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
|
|
|
395731
395964
|
commandContext,
|
|
395732
395965
|
shellConfirmationRequest,
|
|
395733
395966
|
confirmationRequest,
|
|
395734
|
-
quitConfirmationRequest,
|
|
395735
395967
|
reloadCommands
|
|
395736
395968
|
};
|
|
395737
395969
|
}, "useSlashCommandProcessor");
|
|
@@ -401857,44 +402089,18 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
401857
402089
|
};
|
|
401858
402090
|
}, "useExtensionUpdates");
|
|
401859
402091
|
|
|
401860
|
-
// packages/cli/src/ui/hooks/useQuitConfirmation.ts
|
|
401861
|
-
init_esbuild_shims();
|
|
401862
|
-
var import_react127 = __toESM(require_react(), 1);
|
|
401863
|
-
var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
401864
|
-
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0, import_react127.useState)(false);
|
|
401865
|
-
const showQuitConfirmation = (0, import_react127.useCallback)(() => {
|
|
401866
|
-
setIsQuitConfirmationOpen(true);
|
|
401867
|
-
}, []);
|
|
401868
|
-
const handleQuitConfirmationSelect = (0, import_react127.useCallback)((choice2) => {
|
|
401869
|
-
setIsQuitConfirmationOpen(false);
|
|
401870
|
-
if (choice2 === "cancel" /* CANCEL */) {
|
|
401871
|
-
return { shouldQuit: false, action: "cancel" };
|
|
401872
|
-
} else if (choice2 === "quit" /* QUIT */) {
|
|
401873
|
-
return { shouldQuit: true, action: "quit" };
|
|
401874
|
-
} else if (choice2 === "summary_and_quit" /* SUMMARY_AND_QUIT */) {
|
|
401875
|
-
return { shouldQuit: true, action: "summary_and_quit" };
|
|
401876
|
-
}
|
|
401877
|
-
return { shouldQuit: false, action: "cancel" };
|
|
401878
|
-
}, []);
|
|
401879
|
-
return {
|
|
401880
|
-
isQuitConfirmationOpen,
|
|
401881
|
-
showQuitConfirmation,
|
|
401882
|
-
handleQuitConfirmationSelect
|
|
401883
|
-
};
|
|
401884
|
-
}, "useQuitConfirmation");
|
|
401885
|
-
|
|
401886
402092
|
// packages/cli/src/ui/hooks/useWelcomeBack.ts
|
|
401887
402093
|
init_esbuild_shims();
|
|
401888
|
-
var
|
|
402094
|
+
var import_react127 = __toESM(require_react(), 1);
|
|
401889
402095
|
init_core4();
|
|
401890
402096
|
init_settingsSchema();
|
|
401891
402097
|
function useWelcomeBack(config2, submitQuery, buffer, settings) {
|
|
401892
|
-
const [welcomeBackInfo, setWelcomeBackInfo] = (0,
|
|
401893
|
-
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0,
|
|
401894
|
-
const [welcomeBackChoice, setWelcomeBackChoice] = (0,
|
|
401895
|
-
const [shouldFillInput, setShouldFillInput] = (0,
|
|
401896
|
-
const [inputFillText, setInputFillText] = (0,
|
|
401897
|
-
const checkWelcomeBack = (0,
|
|
402098
|
+
const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react127.useState)(null);
|
|
402099
|
+
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react127.useState)(false);
|
|
402100
|
+
const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react127.useState)(null);
|
|
402101
|
+
const [shouldFillInput, setShouldFillInput] = (0, import_react127.useState)(false);
|
|
402102
|
+
const [inputFillText, setInputFillText] = (0, import_react127.useState)(null);
|
|
402103
|
+
const checkWelcomeBack = (0, import_react127.useCallback)(async () => {
|
|
401898
402104
|
if (settings.ui?.enableWelcomeBack === false) {
|
|
401899
402105
|
return;
|
|
401900
402106
|
}
|
|
@@ -401908,7 +402114,7 @@ function useWelcomeBack(config2, submitQuery, buffer, settings) {
|
|
|
401908
402114
|
console.debug("Welcome back check failed:", error2);
|
|
401909
402115
|
}
|
|
401910
402116
|
}, [settings.ui?.enableWelcomeBack]);
|
|
401911
|
-
const handleWelcomeBackSelection = (0,
|
|
402117
|
+
const handleWelcomeBackSelection = (0, import_react127.useCallback)(
|
|
401912
402118
|
(choice2) => {
|
|
401913
402119
|
setWelcomeBackChoice(choice2);
|
|
401914
402120
|
setShowWelcomeBackDialog(false);
|
|
@@ -401920,21 +402126,21 @@ function useWelcomeBack(config2, submitQuery, buffer, settings) {
|
|
|
401920
402126
|
},
|
|
401921
402127
|
[welcomeBackInfo]
|
|
401922
402128
|
);
|
|
401923
|
-
const handleWelcomeBackClose = (0,
|
|
402129
|
+
const handleWelcomeBackClose = (0, import_react127.useCallback)(() => {
|
|
401924
402130
|
setWelcomeBackChoice("restart");
|
|
401925
402131
|
setShowWelcomeBackDialog(false);
|
|
401926
402132
|
}, []);
|
|
401927
|
-
const clearInputFill = (0,
|
|
402133
|
+
const clearInputFill = (0, import_react127.useCallback)(() => {
|
|
401928
402134
|
setShouldFillInput(false);
|
|
401929
402135
|
setInputFillText(null);
|
|
401930
402136
|
}, []);
|
|
401931
|
-
(0,
|
|
402137
|
+
(0, import_react127.useEffect)(() => {
|
|
401932
402138
|
if (shouldFillInput && inputFillText) {
|
|
401933
402139
|
buffer.setText(inputFillText);
|
|
401934
402140
|
clearInputFill();
|
|
401935
402141
|
}
|
|
401936
402142
|
}, [shouldFillInput, inputFillText, buffer, clearInputFill]);
|
|
401937
|
-
(0,
|
|
402143
|
+
(0, import_react127.useEffect)(() => {
|
|
401938
402144
|
checkWelcomeBack();
|
|
401939
402145
|
}, [checkWelcomeBack]);
|
|
401940
402146
|
return {
|
|
@@ -401955,10 +402161,10 @@ __name(useWelcomeBack, "useWelcomeBack");
|
|
|
401955
402161
|
|
|
401956
402162
|
// packages/cli/src/ui/hooks/useDialogClose.ts
|
|
401957
402163
|
init_esbuild_shims();
|
|
401958
|
-
var
|
|
402164
|
+
var import_react128 = __toESM(require_react(), 1);
|
|
401959
402165
|
init_settings();
|
|
401960
402166
|
function useDialogClose(options2) {
|
|
401961
|
-
const closeAnyOpenDialog = (0,
|
|
402167
|
+
const closeAnyOpenDialog = (0, import_react128.useCallback)(() => {
|
|
401962
402168
|
if (options2.isThemeDialogOpen) {
|
|
401963
402169
|
options2.handleThemeSelect(void 0, "User" /* User */);
|
|
401964
402170
|
return true;
|
|
@@ -401990,13 +402196,13 @@ __name(useDialogClose, "useDialogClose");
|
|
|
401990
402196
|
|
|
401991
402197
|
// packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
|
|
401992
402198
|
init_esbuild_shims();
|
|
401993
|
-
var
|
|
402199
|
+
var import_react129 = __toESM(require_react(), 1);
|
|
401994
402200
|
function useSubagentCreateDialog() {
|
|
401995
|
-
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0,
|
|
401996
|
-
const openSubagentCreateDialog = (0,
|
|
402201
|
+
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react129.useState)(false);
|
|
402202
|
+
const openSubagentCreateDialog = (0, import_react129.useCallback)(() => {
|
|
401997
402203
|
setIsSubagentCreateDialogOpen(true);
|
|
401998
402204
|
}, []);
|
|
401999
|
-
const closeSubagentCreateDialog = (0,
|
|
402205
|
+
const closeSubagentCreateDialog = (0, import_react129.useCallback)(() => {
|
|
402000
402206
|
setIsSubagentCreateDialogOpen(false);
|
|
402001
402207
|
}, []);
|
|
402002
402208
|
return {
|
|
@@ -402009,13 +402215,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
|
|
|
402009
402215
|
|
|
402010
402216
|
// packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
|
|
402011
402217
|
init_esbuild_shims();
|
|
402012
|
-
var
|
|
402218
|
+
var import_react130 = __toESM(require_react(), 1);
|
|
402013
402219
|
var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
402014
|
-
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0,
|
|
402015
|
-
const openAgentsManagerDialog = (0,
|
|
402220
|
+
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react130.useState)(false);
|
|
402221
|
+
const openAgentsManagerDialog = (0, import_react130.useCallback)(() => {
|
|
402016
402222
|
setIsAgentsManagerDialogOpen(true);
|
|
402017
402223
|
}, []);
|
|
402018
|
-
const closeAgentsManagerDialog = (0,
|
|
402224
|
+
const closeAgentsManagerDialog = (0, import_react130.useCallback)(() => {
|
|
402019
402225
|
setIsAgentsManagerDialogOpen(false);
|
|
402020
402226
|
}, []);
|
|
402021
402227
|
return {
|
|
@@ -402027,7 +402233,7 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
402027
402233
|
|
|
402028
402234
|
// packages/cli/src/ui/hooks/useAttentionNotifications.ts
|
|
402029
402235
|
init_esbuild_shims();
|
|
402030
|
-
var
|
|
402236
|
+
var import_react131 = __toESM(require_react(), 1);
|
|
402031
402237
|
|
|
402032
402238
|
// packages/cli/src/utils/attentionNotification.ts
|
|
402033
402239
|
init_esbuild_shims();
|
|
@@ -402055,9 +402261,9 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
402055
402261
|
streamingState,
|
|
402056
402262
|
elapsedTime
|
|
402057
402263
|
}) => {
|
|
402058
|
-
const awaitingNotificationSentRef = (0,
|
|
402059
|
-
const respondingElapsedRef = (0,
|
|
402060
|
-
(0,
|
|
402264
|
+
const awaitingNotificationSentRef = (0, import_react131.useRef)(false);
|
|
402265
|
+
const respondingElapsedRef = (0, import_react131.useRef)(0);
|
|
402266
|
+
(0, import_react131.useEffect)(() => {
|
|
402061
402267
|
if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current) {
|
|
402062
402268
|
notifyTerminalAttention("tool_approval" /* ToolApproval */);
|
|
402063
402269
|
awaitingNotificationSentRef.current = true;
|
|
@@ -402066,7 +402272,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
402066
402272
|
awaitingNotificationSentRef.current = false;
|
|
402067
402273
|
}
|
|
402068
402274
|
}, [isFocused, streamingState]);
|
|
402069
|
-
(0,
|
|
402275
|
+
(0, import_react131.useEffect)(() => {
|
|
402070
402276
|
if (streamingState === "responding" /* Responding */) {
|
|
402071
402277
|
respondingElapsedRef.current = elapsedTime;
|
|
402072
402278
|
return;
|
|
@@ -402084,7 +402290,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
402084
402290
|
|
|
402085
402291
|
// packages/cli/src/ui/hooks/useWebSocket.ts
|
|
402086
402292
|
init_esbuild_shims();
|
|
402087
|
-
var
|
|
402293
|
+
var import_react132 = __toESM(require_react(), 1);
|
|
402088
402294
|
|
|
402089
402295
|
// packages/cli/src/config/websocket.ts
|
|
402090
402296
|
init_esbuild_shims();
|
|
@@ -402682,9 +402888,13 @@ function getRdmindSsoId3() {
|
|
|
402682
402888
|
}
|
|
402683
402889
|
}
|
|
402684
402890
|
__name(getRdmindSsoId3, "getRdmindSsoId");
|
|
402685
|
-
function useWebSocket({
|
|
402686
|
-
|
|
402687
|
-
|
|
402891
|
+
function useWebSocket({
|
|
402892
|
+
onReloadCommands,
|
|
402893
|
+
debug: debug2,
|
|
402894
|
+
sessionId
|
|
402895
|
+
}) {
|
|
402896
|
+
const wsClientRef = (0, import_react132.useRef)(null);
|
|
402897
|
+
(0, import_react132.useEffect)(() => {
|
|
402688
402898
|
const wsRuntimeConfig = loadWebSocketRuntimeConfig(debug2);
|
|
402689
402899
|
if (!wsRuntimeConfig.enabled) {
|
|
402690
402900
|
if (debug2) {
|
|
@@ -402727,7 +402937,7 @@ __name(useWebSocket, "useWebSocket");
|
|
|
402727
402937
|
// packages/cli/src/ui/AppContainer.tsx
|
|
402728
402938
|
init_core4();
|
|
402729
402939
|
init_xhsSsoConfig();
|
|
402730
|
-
var
|
|
402940
|
+
var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
|
|
402731
402941
|
var CTRL_EXIT_PROMPT_DURATION_MS = 1e3;
|
|
402732
402942
|
function isToolExecuting(pendingHistoryItems) {
|
|
402733
402943
|
return pendingHistoryItems.some((item) => {
|
|
@@ -402746,22 +402956,22 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
402746
402956
|
const { settings, config: config2, initializationResult } = props;
|
|
402747
402957
|
const historyManager = useHistory();
|
|
402748
402958
|
useMemoryMonitor(historyManager);
|
|
402749
|
-
const [corgiMode, setCorgiMode] = (0,
|
|
402750
|
-
const [debugMessage, setDebugMessage] = (0,
|
|
402751
|
-
const [quittingMessages, setQuittingMessages] = (0,
|
|
402752
|
-
const [themeError, setThemeError] = (0,
|
|
402959
|
+
const [corgiMode, setCorgiMode] = (0, import_react133.useState)(false);
|
|
402960
|
+
const [debugMessage, setDebugMessage] = (0, import_react133.useState)("");
|
|
402961
|
+
const [quittingMessages, setQuittingMessages] = (0, import_react133.useState)(null);
|
|
402962
|
+
const [themeError, setThemeError] = (0, import_react133.useState)(
|
|
402753
402963
|
initializationResult.themeError
|
|
402754
402964
|
);
|
|
402755
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
402756
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] = (0,
|
|
402757
|
-
const [geminiMdFileCount, setGeminiMdFileCount] = (0,
|
|
402965
|
+
const [isProcessing, setIsProcessing] = (0, import_react133.useState)(false);
|
|
402966
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react133.useState)(false);
|
|
402967
|
+
const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react133.useState)(
|
|
402758
402968
|
initializationResult.geminiMdFileCount
|
|
402759
402969
|
);
|
|
402760
|
-
const [shellModeActive, setShellModeActive] = (0,
|
|
402761
|
-
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0,
|
|
402762
|
-
const [historyRemountKey, setHistoryRemountKey] = (0,
|
|
402763
|
-
const [updateInfo, setUpdateInfo] = (0,
|
|
402764
|
-
const [isTrustedFolder, setIsTrustedFolder] = (0,
|
|
402970
|
+
const [shellModeActive, setShellModeActive] = (0, import_react133.useState)(false);
|
|
402971
|
+
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react133.useState)(false);
|
|
402972
|
+
const [historyRemountKey, setHistoryRemountKey] = (0, import_react133.useState)(0);
|
|
402973
|
+
const [updateInfo, setUpdateInfo] = (0, import_react133.useState)(null);
|
|
402974
|
+
const [isTrustedFolder, setIsTrustedFolder] = (0, import_react133.useState)(
|
|
402765
402975
|
config2.isTrustedFolder()
|
|
402766
402976
|
);
|
|
402767
402977
|
const extensions = config2.getExtensions();
|
|
@@ -402776,38 +402986,38 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
402776
402986
|
historyManager.addItem,
|
|
402777
402987
|
config2.getWorkingDir()
|
|
402778
402988
|
);
|
|
402779
|
-
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0,
|
|
402780
|
-
const openPermissionsDialog = (0,
|
|
402989
|
+
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react133.useState)(false);
|
|
402990
|
+
const openPermissionsDialog = (0, import_react133.useCallback)(
|
|
402781
402991
|
() => setPermissionsDialogOpen(true),
|
|
402782
402992
|
[]
|
|
402783
402993
|
);
|
|
402784
|
-
const closePermissionsDialog = (0,
|
|
402994
|
+
const closePermissionsDialog = (0, import_react133.useCallback)(
|
|
402785
402995
|
() => setPermissionsDialogOpen(false),
|
|
402786
402996
|
[]
|
|
402787
402997
|
);
|
|
402788
|
-
const getEffectiveModel2 = (0,
|
|
402998
|
+
const getEffectiveModel2 = (0, import_react133.useCallback)(() => {
|
|
402789
402999
|
if (config2.isInFallbackMode()) {
|
|
402790
403000
|
return DEFAULT_GEMINI_FLASH_MODEL;
|
|
402791
403001
|
}
|
|
402792
403002
|
return config2.getModel();
|
|
402793
403003
|
}, [config2]);
|
|
402794
|
-
const [currentModel, setCurrentModel] = (0,
|
|
402795
|
-
const [userTier] = (0,
|
|
402796
|
-
const [isConfigInitialized, setConfigInitialized] = (0,
|
|
402797
|
-
const [userMessages, setUserMessages] = (0,
|
|
403004
|
+
const [currentModel, setCurrentModel] = (0, import_react133.useState)(getEffectiveModel2());
|
|
403005
|
+
const [userTier] = (0, import_react133.useState)(void 0);
|
|
403006
|
+
const [isConfigInitialized, setConfigInitialized] = (0, import_react133.useState)(false);
|
|
403007
|
+
const [userMessages, setUserMessages] = (0, import_react133.useState)([]);
|
|
402798
403008
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
402799
403009
|
const { stdin, setRawMode } = use_stdin_default();
|
|
402800
403010
|
const { stdout } = use_stdout_default();
|
|
402801
403011
|
const { stats: sessionStats } = useSessionStats();
|
|
402802
403012
|
const logger6 = useLogger(config2.storage, sessionStats.sessionId);
|
|
402803
403013
|
const branchName = useGitBranchName(config2.getTargetDir());
|
|
402804
|
-
const mainControlsRef = (0,
|
|
402805
|
-
const originalTitleRef = (0,
|
|
403014
|
+
const mainControlsRef = (0, import_react133.useRef)(null);
|
|
403015
|
+
const originalTitleRef = (0, import_react133.useRef)(
|
|
402806
403016
|
computeWindowTitle(basename18(config2.getTargetDir()))
|
|
402807
403017
|
);
|
|
402808
|
-
const lastTitleRef = (0,
|
|
403018
|
+
const lastTitleRef = (0, import_react133.useRef)(null);
|
|
402809
403019
|
const staticExtraHeight = 3;
|
|
402810
|
-
(0,
|
|
403020
|
+
(0, import_react133.useEffect)(() => {
|
|
402811
403021
|
(async () => {
|
|
402812
403022
|
await config2.initialize();
|
|
402813
403023
|
setConfigInitialized(true);
|
|
@@ -402825,11 +403035,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
402825
403035
|
await ideClient.disconnect();
|
|
402826
403036
|
});
|
|
402827
403037
|
}, [config2]);
|
|
402828
|
-
(0,
|
|
403038
|
+
(0, import_react133.useEffect)(
|
|
402829
403039
|
() => setUpdateHandler(historyManager.addItem, setUpdateInfo),
|
|
402830
403040
|
[historyManager.addItem]
|
|
402831
403041
|
);
|
|
402832
|
-
(0,
|
|
403042
|
+
(0, import_react133.useEffect)(() => {
|
|
402833
403043
|
const checkModelChange = /* @__PURE__ */ __name(() => {
|
|
402834
403044
|
const effectiveModel = getEffectiveModel2();
|
|
402835
403045
|
if (effectiveModel !== currentModel) {
|
|
@@ -402845,7 +403055,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
402845
403055
|
handleNewMessage,
|
|
402846
403056
|
clearConsoleMessages: clearConsoleMessagesState
|
|
402847
403057
|
} = useConsoleMessages();
|
|
402848
|
-
(0,
|
|
403058
|
+
(0, import_react133.useEffect)(() => {
|
|
402849
403059
|
const consolePatcher = new ConsolePatcher({
|
|
402850
403060
|
onNewMessage: handleNewMessage,
|
|
402851
403061
|
debugMode: config2.getDebugMode()
|
|
@@ -402853,13 +403063,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
402853
403063
|
consolePatcher.patch();
|
|
402854
403064
|
registerCleanup(consolePatcher.cleanup);
|
|
402855
403065
|
}, [handleNewMessage, config2]);
|
|
402856
|
-
const { inputWidth, suggestionsWidth } = (0,
|
|
403066
|
+
const { inputWidth, suggestionsWidth } = (0, import_react133.useMemo)(() => {
|
|
402857
403067
|
const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
|
|
402858
403068
|
return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
|
|
402859
403069
|
}, [terminalWidth]);
|
|
402860
403070
|
const mainAreaWidth = Math.floor(terminalWidth * 0.9);
|
|
402861
403071
|
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
|
|
402862
|
-
const isValidPath = (0,
|
|
403072
|
+
const isValidPath = (0, import_react133.useCallback)((filePath) => {
|
|
402863
403073
|
try {
|
|
402864
403074
|
return fs107.existsSync(filePath) && fs107.statSync(filePath).isFile();
|
|
402865
403075
|
} catch (_e) {
|
|
@@ -402874,7 +403084,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
402874
403084
|
isValidPath,
|
|
402875
403085
|
shellModeActive
|
|
402876
403086
|
});
|
|
402877
|
-
(0,
|
|
403087
|
+
(0, import_react133.useEffect)(() => {
|
|
402878
403088
|
const fetchUserMessages = /* @__PURE__ */ __name(async () => {
|
|
402879
403089
|
const pastMessagesRaw = await logger6?.getPreviousUserMessages() || [];
|
|
402880
403090
|
const currentSessionUserMessages = historyManager.history.filter(
|
|
@@ -402897,7 +403107,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
402897
403107
|
}, "fetchUserMessages");
|
|
402898
403108
|
fetchUserMessages();
|
|
402899
403109
|
}, [historyManager.history, logger6]);
|
|
402900
|
-
const refreshStatic = (0,
|
|
403110
|
+
const refreshStatic = (0, import_react133.useCallback)(() => {
|
|
402901
403111
|
stdout.write(base_exports.clearTerminal);
|
|
402902
403112
|
setHistoryRemountKey((prev) => prev + 1);
|
|
402903
403113
|
}, [setHistoryRemountKey, stdout]);
|
|
@@ -402929,7 +403139,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
402929
403139
|
openAuthDialog,
|
|
402930
403140
|
cancelAuthentication
|
|
402931
403141
|
} = useAuthCommand(settings, config2, historyManager.addItem);
|
|
402932
|
-
(0,
|
|
403142
|
+
(0, import_react133.useEffect)(() => {
|
|
402933
403143
|
if (!shouldTriggerAutoSSOAuth(settings)) {
|
|
402934
403144
|
return;
|
|
402935
403145
|
}
|
|
@@ -403108,17 +403318,17 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403108
403318
|
setAuthState,
|
|
403109
403319
|
setModelSwitchedFromQuotaError
|
|
403110
403320
|
});
|
|
403111
|
-
const handleQwenAuthTimeout = (0,
|
|
403321
|
+
const handleQwenAuthTimeout = (0, import_react133.useCallback)(() => {
|
|
403112
403322
|
onAuthError("Qwen OAuth authentication timed out. Please try again.");
|
|
403113
403323
|
cancelAuthentication();
|
|
403114
403324
|
setAuthState("updating" /* Updating */);
|
|
403115
403325
|
}, [onAuthError, cancelAuthentication, setAuthState]);
|
|
403116
|
-
const handleQwenAuthCancel = (0,
|
|
403326
|
+
const handleQwenAuthCancel = (0, import_react133.useCallback)(() => {
|
|
403117
403327
|
onAuthError("Qwen OAuth authentication cancelled.");
|
|
403118
403328
|
cancelAuthentication();
|
|
403119
403329
|
setAuthState("updating" /* Updating */);
|
|
403120
403330
|
}, [onAuthError, cancelAuthentication, setAuthState]);
|
|
403121
|
-
(0,
|
|
403331
|
+
(0, import_react133.useEffect)(() => {
|
|
403122
403332
|
if (settings.merged.security?.auth?.enforcedType && settings.merged.security?.auth.selectedType && settings.merged.security?.auth.enforcedType !== settings.merged.security?.auth.selectedType) {
|
|
403123
403333
|
onAuthError(
|
|
403124
403334
|
t3(
|
|
@@ -403143,7 +403353,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403143
403353
|
settings.merged.security?.auth?.useExternal,
|
|
403144
403354
|
onAuthError
|
|
403145
403355
|
]);
|
|
403146
|
-
const [editorError, setEditorError] = (0,
|
|
403356
|
+
const [editorError, setEditorError] = (0, import_react133.useState)(null);
|
|
403147
403357
|
const {
|
|
403148
403358
|
isEditorDialogOpen,
|
|
403149
403359
|
openEditorDialog,
|
|
@@ -403159,7 +403369,6 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403159
403369
|
onWorkspaceMigrationDialogClose
|
|
403160
403370
|
} = useWorkspaceMigration(settings);
|
|
403161
403371
|
const { toggleVimEnabled } = useVimMode();
|
|
403162
|
-
const { showQuitConfirmation } = useQuitConfirmation();
|
|
403163
403372
|
const {
|
|
403164
403373
|
isSubagentCreateDialogOpen,
|
|
403165
403374
|
openSubagentCreateDialog,
|
|
@@ -403170,9 +403379,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403170
403379
|
openAgentsManagerDialog,
|
|
403171
403380
|
closeAgentsManagerDialog
|
|
403172
403381
|
} = useAgentsManagerDialog();
|
|
403173
|
-
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0,
|
|
403174
|
-
const [visionSwitchResolver, setVisionSwitchResolver] = (0,
|
|
403175
|
-
const slashCommandActions = (0,
|
|
403382
|
+
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0, import_react133.useState)(false);
|
|
403383
|
+
const [visionSwitchResolver, setVisionSwitchResolver] = (0, import_react133.useState)(null);
|
|
403384
|
+
const slashCommandActions = (0, import_react133.useMemo)(
|
|
403176
403385
|
() => ({
|
|
403177
403386
|
openAuthDialog,
|
|
403178
403387
|
openThemeDialog,
|
|
@@ -403193,8 +403402,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403193
403402
|
dispatchExtensionStateUpdate,
|
|
403194
403403
|
addConfirmUpdateExtensionRequest,
|
|
403195
403404
|
openSubagentCreateDialog,
|
|
403196
|
-
openAgentsManagerDialog
|
|
403197
|
-
_showQuitConfirmation: showQuitConfirmation
|
|
403405
|
+
openAgentsManagerDialog
|
|
403198
403406
|
}),
|
|
403199
403407
|
[
|
|
403200
403408
|
openAuthDialog,
|
|
@@ -403208,7 +403416,6 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403208
403416
|
openPermissionsDialog,
|
|
403209
403417
|
openApprovalModeDialog,
|
|
403210
403418
|
addConfirmUpdateExtensionRequest,
|
|
403211
|
-
showQuitConfirmation,
|
|
403212
403419
|
openSubagentCreateDialog,
|
|
403213
403420
|
openAgentsManagerDialog
|
|
403214
403421
|
]
|
|
@@ -403220,7 +403427,6 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403220
403427
|
commandContext,
|
|
403221
403428
|
shellConfirmationRequest,
|
|
403222
403429
|
confirmationRequest,
|
|
403223
|
-
quitConfirmationRequest,
|
|
403224
403430
|
reloadCommands
|
|
403225
403431
|
} = useSlashCommandProcessor(
|
|
403226
403432
|
config2,
|
|
@@ -403242,14 +403448,14 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403242
403448
|
debug: config2.getDebugMode(),
|
|
403243
403449
|
sessionId: config2.getSessionId()
|
|
403244
403450
|
});
|
|
403245
|
-
const handleVisionSwitchRequired = (0,
|
|
403451
|
+
const handleVisionSwitchRequired = (0, import_react133.useCallback)(
|
|
403246
403452
|
async (_query) => new Promise((resolve26, reject) => {
|
|
403247
403453
|
setVisionSwitchResolver({ resolve: resolve26, reject });
|
|
403248
403454
|
setIsVisionSwitchDialogOpen(true);
|
|
403249
403455
|
}),
|
|
403250
403456
|
[]
|
|
403251
403457
|
);
|
|
403252
|
-
const handleVisionSwitchSelect = (0,
|
|
403458
|
+
const handleVisionSwitchSelect = (0, import_react133.useCallback)(
|
|
403253
403459
|
(outcome) => {
|
|
403254
403460
|
setIsVisionSwitchDialogOpen(false);
|
|
403255
403461
|
if (visionSwitchResolver) {
|
|
@@ -403260,10 +403466,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403260
403466
|
},
|
|
403261
403467
|
[visionSwitchResolver]
|
|
403262
403468
|
);
|
|
403263
|
-
const onDebugMessage = (0,
|
|
403469
|
+
const onDebugMessage = (0, import_react133.useCallback)((message) => {
|
|
403264
403470
|
console.debug(message);
|
|
403265
403471
|
}, []);
|
|
403266
|
-
const performMemoryRefresh = (0,
|
|
403472
|
+
const performMemoryRefresh = (0, import_react133.useCallback)(async () => {
|
|
403267
403473
|
historyManager.addItem(
|
|
403268
403474
|
{
|
|
403269
403475
|
type: "info" /* INFO */,
|
|
@@ -403314,7 +403520,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403314
403520
|
console.error("Error refreshing memory:", error2);
|
|
403315
403521
|
}
|
|
403316
403522
|
}, [config2, historyManager, settings.merged]);
|
|
403317
|
-
const cancelHandlerRef = (0,
|
|
403523
|
+
const cancelHandlerRef = (0, import_react133.useRef)(() => {
|
|
403318
403524
|
});
|
|
403319
403525
|
const {
|
|
403320
403526
|
streamingState,
|
|
@@ -403361,7 +403567,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403361
403567
|
streamingState,
|
|
403362
403568
|
submitQuery
|
|
403363
403569
|
});
|
|
403364
|
-
const handleFinalSubmit = (0,
|
|
403570
|
+
const handleFinalSubmit = (0, import_react133.useCallback)(
|
|
403365
403571
|
(submittedValue) => {
|
|
403366
403572
|
addMessage(submittedValue);
|
|
403367
403573
|
},
|
|
@@ -403374,7 +403580,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
403374
403580
|
handleWelcomeBackSelection,
|
|
403375
403581
|
handleWelcomeBackClose
|
|
403376
403582
|
} = useWelcomeBack(config2, handleFinalSubmit, buffer, settings.merged);
|
|
403377
|
-
cancelHandlerRef.current = (0,
|
|
403583
|
+
cancelHandlerRef.current = (0, import_react133.useCallback)(() => {
|
|
403378
403584
|
const pendingHistoryItems2 = [
|
|
403379
403585
|
...pendingSlashCommandHistoryItems,
|
|
403380
403586
|
...pendingGeminiHistoryItems
|
|
@@ -403403,7 +403609,7 @@ ${queuedText}` : queuedText;
|
|
|
403403
403609
|
pendingSlashCommandHistoryItems,
|
|
403404
403610
|
pendingGeminiHistoryItems
|
|
403405
403611
|
]);
|
|
403406
|
-
const handleClearScreen = (0,
|
|
403612
|
+
const handleClearScreen = (0, import_react133.useCallback)(() => {
|
|
403407
403613
|
historyManager.clearItems();
|
|
403408
403614
|
clearConsoleMessagesState();
|
|
403409
403615
|
console.clear();
|
|
@@ -403411,8 +403617,8 @@ ${queuedText}` : queuedText;
|
|
|
403411
403617
|
}, [historyManager, clearConsoleMessagesState, refreshStatic]);
|
|
403412
403618
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
403413
403619
|
const isInputActive = !initError && !isProcessing && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */) && !proQuotaRequest;
|
|
403414
|
-
const [controlsHeight, setControlsHeight] = (0,
|
|
403415
|
-
(0,
|
|
403620
|
+
const [controlsHeight, setControlsHeight] = (0, import_react133.useState)(0);
|
|
403621
|
+
(0, import_react133.useLayoutEffect)(() => {
|
|
403416
403622
|
if (mainControlsRef.current) {
|
|
403417
403623
|
const fullFooterMeasurement = measure_element_default(mainControlsRef.current);
|
|
403418
403624
|
if (fullFooterMeasurement.height > 0) {
|
|
@@ -403435,14 +403641,14 @@ ${queuedText}` : queuedText;
|
|
|
403435
403641
|
});
|
|
403436
403642
|
const isFocused = useFocus();
|
|
403437
403643
|
useBracketedPaste();
|
|
403438
|
-
const contextFileNames = (0,
|
|
403644
|
+
const contextFileNames = (0, import_react133.useMemo)(() => {
|
|
403439
403645
|
const fromSettings = settings.merged.context?.fileName;
|
|
403440
403646
|
return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
|
|
403441
403647
|
}, [settings.merged.context?.fileName]);
|
|
403442
|
-
const initialPrompt = (0,
|
|
403443
|
-
const initialPromptSubmitted = (0,
|
|
403648
|
+
const initialPrompt = (0, import_react133.useMemo)(() => config2.getQuestion(), [config2]);
|
|
403649
|
+
const initialPromptSubmitted = (0, import_react133.useRef)(false);
|
|
403444
403650
|
const geminiClient = config2.getGeminiClient();
|
|
403445
|
-
(0,
|
|
403651
|
+
(0, import_react133.useEffect)(() => {
|
|
403446
403652
|
if (activePtyId) {
|
|
403447
403653
|
ShellExecutionService.resizePty(
|
|
403448
403654
|
activePtyId,
|
|
@@ -403451,7 +403657,7 @@ ${queuedText}` : queuedText;
|
|
|
403451
403657
|
);
|
|
403452
403658
|
}
|
|
403453
403659
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
403454
|
-
(0,
|
|
403660
|
+
(0, import_react133.useEffect)(() => {
|
|
403455
403661
|
if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && !isVisionSwitchDialogOpen && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
|
|
403456
403662
|
handleFinalSubmit(initialPrompt);
|
|
403457
403663
|
initialPromptSubmitted.current = true;
|
|
@@ -403469,9 +403675,9 @@ ${queuedText}` : queuedText;
|
|
|
403469
403675
|
welcomeBackChoice,
|
|
403470
403676
|
geminiClient
|
|
403471
403677
|
]);
|
|
403472
|
-
const [idePromptAnswered, setIdePromptAnswered] = (0,
|
|
403473
|
-
const [currentIDE, setCurrentIDE] = (0,
|
|
403474
|
-
(0,
|
|
403678
|
+
const [idePromptAnswered, setIdePromptAnswered] = (0, import_react133.useState)(false);
|
|
403679
|
+
const [currentIDE, setCurrentIDE] = (0, import_react133.useState)(null);
|
|
403680
|
+
(0, import_react133.useEffect)(() => {
|
|
403475
403681
|
const getIde = /* @__PURE__ */ __name(async () => {
|
|
403476
403682
|
const ideClient = await IdeClient.getInstance();
|
|
403477
403683
|
const currentIde = ideClient.getCurrentIde();
|
|
@@ -403482,28 +403688,28 @@ ${queuedText}` : queuedText;
|
|
|
403482
403688
|
const shouldShowIdePrompt = Boolean(
|
|
403483
403689
|
currentIDE && !config2.getIdeMode() && !settings.merged.ide?.hasSeenNudge && !idePromptAnswered
|
|
403484
403690
|
);
|
|
403485
|
-
const [showErrorDetails, setShowErrorDetails] = (0,
|
|
403486
|
-
const [showToolDescriptions, setShowToolDescriptions] = (0,
|
|
403487
|
-
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0,
|
|
403488
|
-
const ctrlCTimerRef = (0,
|
|
403489
|
-
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0,
|
|
403490
|
-
const ctrlDTimerRef = (0,
|
|
403491
|
-
const [constrainHeight, setConstrainHeight] = (0,
|
|
403492
|
-
const [ideContextState, setIdeContextState] = (0,
|
|
403493
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
403494
|
-
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0,
|
|
403691
|
+
const [showErrorDetails, setShowErrorDetails] = (0, import_react133.useState)(false);
|
|
403692
|
+
const [showToolDescriptions, setShowToolDescriptions] = (0, import_react133.useState)(false);
|
|
403693
|
+
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react133.useState)(false);
|
|
403694
|
+
const ctrlCTimerRef = (0, import_react133.useRef)(null);
|
|
403695
|
+
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react133.useState)(false);
|
|
403696
|
+
const ctrlDTimerRef = (0, import_react133.useRef)(null);
|
|
403697
|
+
const [constrainHeight, setConstrainHeight] = (0, import_react133.useState)(true);
|
|
403698
|
+
const [ideContextState, setIdeContextState] = (0, import_react133.useState)();
|
|
403699
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react133.useState)(false);
|
|
403700
|
+
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react133.useState)(false);
|
|
403495
403701
|
const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings, setIsTrustedFolder);
|
|
403496
403702
|
const {
|
|
403497
403703
|
needsRestart: ideNeedsRestart,
|
|
403498
403704
|
restartReason: ideTrustRestartReason
|
|
403499
403705
|
} = useIdeTrustListener();
|
|
403500
|
-
const isInitialMount = (0,
|
|
403501
|
-
(0,
|
|
403706
|
+
const isInitialMount = (0, import_react133.useRef)(true);
|
|
403707
|
+
(0, import_react133.useEffect)(() => {
|
|
403502
403708
|
if (ideNeedsRestart) {
|
|
403503
403709
|
setShowIdeRestartPrompt(true);
|
|
403504
403710
|
}
|
|
403505
403711
|
}, [ideNeedsRestart]);
|
|
403506
|
-
(0,
|
|
403712
|
+
(0, import_react133.useEffect)(() => {
|
|
403507
403713
|
if (isInitialMount.current) {
|
|
403508
403714
|
isInitialMount.current = false;
|
|
403509
403715
|
return;
|
|
@@ -403515,12 +403721,12 @@ ${queuedText}` : queuedText;
|
|
|
403515
403721
|
clearTimeout(handler);
|
|
403516
403722
|
};
|
|
403517
403723
|
}, [terminalWidth, refreshStatic]);
|
|
403518
|
-
(0,
|
|
403724
|
+
(0, import_react133.useEffect)(() => {
|
|
403519
403725
|
const unsubscribe = ideContextStore.subscribe(setIdeContextState);
|
|
403520
403726
|
setIdeContextState(ideContextStore.get());
|
|
403521
403727
|
return unsubscribe;
|
|
403522
403728
|
}, []);
|
|
403523
|
-
(0,
|
|
403729
|
+
(0, import_react133.useEffect)(() => {
|
|
403524
403730
|
const openDebugConsole = /* @__PURE__ */ __name(() => {
|
|
403525
403731
|
setShowErrorDetails(true);
|
|
403526
403732
|
setConstrainHeight(false);
|
|
@@ -403539,10 +403745,10 @@ ${queuedText}` : queuedText;
|
|
|
403539
403745
|
appEvents.off("log-error" /* LogError */, logErrorHandler);
|
|
403540
403746
|
};
|
|
403541
403747
|
}, [handleNewMessage]);
|
|
403542
|
-
const handleEscapePromptChange = (0,
|
|
403748
|
+
const handleEscapePromptChange = (0, import_react133.useCallback)((showPrompt) => {
|
|
403543
403749
|
setShowEscapePrompt(showPrompt);
|
|
403544
403750
|
}, []);
|
|
403545
|
-
const handleIdePromptComplete = (0,
|
|
403751
|
+
const handleIdePromptComplete = (0, import_react133.useCallback)(
|
|
403546
403752
|
(result) => {
|
|
403547
403753
|
if (result.userSelection === "yes") {
|
|
403548
403754
|
handleSlashCommand2("/ide install");
|
|
@@ -403577,10 +403783,9 @@ ${queuedText}` : queuedText;
|
|
|
403577
403783
|
closeSettingsDialog,
|
|
403578
403784
|
isFolderTrustDialogOpen,
|
|
403579
403785
|
showWelcomeBackDialog,
|
|
403580
|
-
handleWelcomeBackClose
|
|
403581
|
-
quitConfirmationRequest
|
|
403786
|
+
handleWelcomeBackClose
|
|
403582
403787
|
});
|
|
403583
|
-
const handleExit = (0,
|
|
403788
|
+
const handleExit = (0, import_react133.useCallback)(
|
|
403584
403789
|
(pressedOnce, setPressedOnce, timerRef) => {
|
|
403585
403790
|
if (pressedOnce) {
|
|
403586
403791
|
if (timerRef.current) {
|
|
@@ -403589,10 +403794,6 @@ ${queuedText}` : queuedText;
|
|
|
403589
403794
|
handleSlashCommand2("/quit");
|
|
403590
403795
|
return;
|
|
403591
403796
|
}
|
|
403592
|
-
if (quitConfirmationRequest) {
|
|
403593
|
-
handleSlashCommand2("/quit");
|
|
403594
|
-
return;
|
|
403595
|
-
}
|
|
403596
403797
|
if (isAuthDialogOpen) {
|
|
403597
403798
|
setPressedOnce(true);
|
|
403598
403799
|
timerRef.current = setTimeout(() => {
|
|
@@ -403611,7 +403812,10 @@ ${queuedText}` : queuedText;
|
|
|
403611
403812
|
buffer.setText("");
|
|
403612
403813
|
return;
|
|
403613
403814
|
}
|
|
403614
|
-
|
|
403815
|
+
setPressedOnce(true);
|
|
403816
|
+
timerRef.current = setTimeout(() => {
|
|
403817
|
+
setPressedOnce(false);
|
|
403818
|
+
}, CTRL_EXIT_PROMPT_DURATION_MS);
|
|
403615
403819
|
},
|
|
403616
403820
|
[
|
|
403617
403821
|
isAuthDialogOpen,
|
|
@@ -403619,11 +403823,10 @@ ${queuedText}` : queuedText;
|
|
|
403619
403823
|
closeAnyOpenDialog,
|
|
403620
403824
|
streamingState,
|
|
403621
403825
|
cancelOngoingRequest,
|
|
403622
|
-
quitConfirmationRequest,
|
|
403623
403826
|
buffer
|
|
403624
403827
|
]
|
|
403625
403828
|
);
|
|
403626
|
-
const handleGlobalKeypress = (0,
|
|
403829
|
+
const handleGlobalKeypress = (0, import_react133.useCallback)(
|
|
403627
403830
|
(key) => {
|
|
403628
403831
|
if (settings.merged.general?.debugKeystrokeLogging) {
|
|
403629
403832
|
console.log("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
@@ -403696,7 +403899,7 @@ ${queuedText}` : queuedText;
|
|
|
403696
403899
|
]
|
|
403697
403900
|
);
|
|
403698
403901
|
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
403699
|
-
(0,
|
|
403902
|
+
(0, import_react133.useEffect)(() => {
|
|
403700
403903
|
if (!settings.merged.ui?.showStatusInTitle || settings.merged.ui?.hideWindowTitle)
|
|
403701
403904
|
return;
|
|
403702
403905
|
let title;
|
|
@@ -403718,23 +403921,23 @@ ${queuedText}` : queuedText;
|
|
|
403718
403921
|
settings.merged.ui?.hideWindowTitle,
|
|
403719
403922
|
stdout
|
|
403720
403923
|
]);
|
|
403721
|
-
const filteredConsoleMessages = (0,
|
|
403924
|
+
const filteredConsoleMessages = (0, import_react133.useMemo)(() => {
|
|
403722
403925
|
if (config2.getDebugMode()) {
|
|
403723
403926
|
return consoleMessages;
|
|
403724
403927
|
}
|
|
403725
403928
|
return consoleMessages.filter((msg) => msg.type !== "debug");
|
|
403726
403929
|
}, [consoleMessages, config2]);
|
|
403727
|
-
const errorCount = (0,
|
|
403930
|
+
const errorCount = (0, import_react133.useMemo)(
|
|
403728
403931
|
() => filteredConsoleMessages.filter((msg) => msg.type === "error").reduce((total, msg) => total + msg.count, 0),
|
|
403729
403932
|
[filteredConsoleMessages]
|
|
403730
403933
|
);
|
|
403731
403934
|
const nightly = props.version.includes("nightly");
|
|
403732
|
-
const dialogsVisible = showWelcomeBackDialog || showWorkspaceMigrationDialog || shouldShowIdePrompt || isFolderTrustDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!loopDetectionConfirmationRequest ||
|
|
403733
|
-
const pendingHistoryItems = (0,
|
|
403935
|
+
const dialogsVisible = showWelcomeBackDialog || showWorkspaceMigrationDialog || shouldShowIdePrompt || isFolderTrustDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!loopDetectionConfirmationRequest || isThemeDialogOpen || isSettingsDialogOpen || isModelDialogOpen || isVisionSwitchDialogOpen || isPermissionsDialogOpen || isAuthDialogOpen || isAuthenticating && isQwenAuthenticating || isEditorDialogOpen || showIdeRestartPrompt || !!proQuotaRequest || isSubagentCreateDialogOpen || isAgentsManagerDialogOpen || isApprovalModeDialogOpen;
|
|
403936
|
+
const pendingHistoryItems = (0, import_react133.useMemo)(
|
|
403734
403937
|
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
|
|
403735
403938
|
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
|
|
403736
403939
|
);
|
|
403737
|
-
const uiState = (0,
|
|
403940
|
+
const uiState = (0, import_react133.useMemo)(
|
|
403738
403941
|
() => ({
|
|
403739
403942
|
history: historyManager.history,
|
|
403740
403943
|
historyManager,
|
|
@@ -403768,7 +403971,6 @@ ${queuedText}` : queuedText;
|
|
|
403768
403971
|
confirmationRequest,
|
|
403769
403972
|
confirmUpdateExtensionRequests,
|
|
403770
403973
|
loopDetectionConfirmationRequest,
|
|
403771
|
-
quitConfirmationRequest,
|
|
403772
403974
|
geminiMdFileCount,
|
|
403773
403975
|
streamingState,
|
|
403774
403976
|
initError,
|
|
@@ -403865,7 +404067,6 @@ ${queuedText}` : queuedText;
|
|
|
403865
404067
|
confirmationRequest,
|
|
403866
404068
|
confirmUpdateExtensionRequests,
|
|
403867
404069
|
loopDetectionConfirmationRequest,
|
|
403868
|
-
quitConfirmationRequest,
|
|
403869
404070
|
geminiMdFileCount,
|
|
403870
404071
|
streamingState,
|
|
403871
404072
|
initError,
|
|
@@ -403933,7 +404134,7 @@ ${queuedText}` : queuedText;
|
|
|
403933
404134
|
isAgentsManagerDialogOpen
|
|
403934
404135
|
]
|
|
403935
404136
|
);
|
|
403936
|
-
const uiActions = (0,
|
|
404137
|
+
const uiActions = (0, import_react133.useMemo)(
|
|
403937
404138
|
() => ({
|
|
403938
404139
|
handleThemeSelect,
|
|
403939
404140
|
handleThemeHighlight,
|
|
@@ -404008,31 +404209,31 @@ ${queuedText}` : queuedText;
|
|
|
404008
404209
|
]
|
|
404009
404210
|
);
|
|
404010
404211
|
if (pendingAuthType === "xhs-sso" /* XHS_SSO */ && isAuthenticating) {
|
|
404011
|
-
return /* @__PURE__ */ (0,
|
|
404012
|
-
/* @__PURE__ */ (0,
|
|
404013
|
-
/* @__PURE__ */ (0,
|
|
404212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(Box_default, { flexDirection: "column", alignItems: "center", justifyContent: "center", children: [
|
|
404213
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Text3, { color: "cyan", children: "\u6B63\u5728\u8FDB\u884C\u5C0F\u7EA2\u4E66 SSO \u8BA4\u8BC1..." }),
|
|
404214
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(Text3, { color: "gray", dimColor: true, children: [
|
|
404014
404215
|
" ",
|
|
404015
404216
|
"\u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u5B8C\u6210\u8BA4\u8BC1"
|
|
404016
404217
|
] })
|
|
404017
404218
|
] });
|
|
404018
404219
|
}
|
|
404019
|
-
return /* @__PURE__ */ (0,
|
|
404220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(UIStateContext.Provider, { value: uiState, children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(UIActionsContext.Provider, { value: uiActions, children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(ConfigContext.Provider, { value: config2, children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
404020
404221
|
AppContext2.Provider,
|
|
404021
404222
|
{
|
|
404022
404223
|
value: {
|
|
404023
404224
|
version: props.version,
|
|
404024
404225
|
startupWarnings: props.startupWarnings || []
|
|
404025
404226
|
},
|
|
404026
|
-
children: /* @__PURE__ */ (0,
|
|
404227
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(ShellFocusContext.Provider, { value: isFocused, children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(App2, {}) })
|
|
404027
404228
|
}
|
|
404028
404229
|
) }) }) });
|
|
404029
404230
|
}, "AppContainer");
|
|
404030
404231
|
|
|
404031
404232
|
// packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
|
|
404032
404233
|
init_esbuild_shims();
|
|
404033
|
-
var
|
|
404234
|
+
var import_react134 = __toESM(require_react(), 1);
|
|
404034
404235
|
function useKittyKeyboardProtocol() {
|
|
404035
|
-
const [status] = (0,
|
|
404236
|
+
const [status] = (0, import_react134.useState)({
|
|
404036
404237
|
supported: isKittyProtocolSupported(),
|
|
404037
404238
|
enabled: isKittyProtocolEnabled(),
|
|
404038
404239
|
checking: false
|
|
@@ -405012,7 +405213,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
405012
405213
|
throw new Error(message);
|
|
405013
405214
|
}
|
|
405014
405215
|
}
|
|
405015
|
-
const effectiveAuthType = enforcedType || getAuthTypeFromEnv()
|
|
405216
|
+
const effectiveAuthType = enforcedType || configuredAuthType || getAuthTypeFromEnv();
|
|
405016
405217
|
if (!effectiveAuthType) {
|
|
405017
405218
|
const message = `Please set an Auth method in your ${USER_SETTINGS_PATH} or specify one of the following environment variables before running: QWEN_OAUTH, OPENAI_API_KEY`;
|
|
405018
405219
|
throw new Error(message);
|
|
@@ -405058,9 +405259,9 @@ __name(validateNonInteractiveAuth, "validateNonInteractiveAuth");
|
|
|
405058
405259
|
|
|
405059
405260
|
// packages/cli/src/ui/components/ResumeSessionPicker.tsx
|
|
405060
405261
|
init_esbuild_shims();
|
|
405061
|
-
var
|
|
405262
|
+
var import_react135 = __toESM(require_react(), 1);
|
|
405062
405263
|
init_core4();
|
|
405063
|
-
var
|
|
405264
|
+
var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
|
|
405064
405265
|
var PAGE_SIZE = 20;
|
|
405065
405266
|
function truncateText(text, maxWidth) {
|
|
405066
405267
|
if (text.length <= maxWidth) return text;
|
|
@@ -405075,20 +405276,20 @@ function SessionPicker({
|
|
|
405075
405276
|
onCancel
|
|
405076
405277
|
}) {
|
|
405077
405278
|
const { exit } = use_app_default();
|
|
405078
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
405079
|
-
const [sessionState, setSessionState] = (0,
|
|
405279
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react135.useState)(0);
|
|
405280
|
+
const [sessionState, setSessionState] = (0, import_react135.useState)({
|
|
405080
405281
|
sessions: [],
|
|
405081
405282
|
hasMore: true,
|
|
405082
405283
|
nextCursor: void 0
|
|
405083
405284
|
});
|
|
405084
|
-
const isLoadingMoreRef = (0,
|
|
405085
|
-
const [filterByBranch, setFilterByBranch] = (0,
|
|
405086
|
-
const [isExiting, setIsExiting] = (0,
|
|
405087
|
-
const [terminalSize, setTerminalSize] = (0,
|
|
405285
|
+
const isLoadingMoreRef = (0, import_react135.useRef)(false);
|
|
405286
|
+
const [filterByBranch, setFilterByBranch] = (0, import_react135.useState)(false);
|
|
405287
|
+
const [isExiting, setIsExiting] = (0, import_react135.useState)(false);
|
|
405288
|
+
const [terminalSize, setTerminalSize] = (0, import_react135.useState)({
|
|
405088
405289
|
width: process.stdout.columns || 80,
|
|
405089
405290
|
height: process.stdout.rows || 24
|
|
405090
405291
|
});
|
|
405091
|
-
(0,
|
|
405292
|
+
(0, import_react135.useEffect)(() => {
|
|
405092
405293
|
const handleResize = /* @__PURE__ */ __name(() => {
|
|
405093
405294
|
setTerminalSize({
|
|
405094
405295
|
width: process.stdout.columns || 80,
|
|
@@ -405104,10 +405305,10 @@ function SessionPicker({
|
|
|
405104
405305
|
(session) => session.gitBranch === currentBranch
|
|
405105
405306
|
) : sessionState.sessions;
|
|
405106
405307
|
const hasSentinel = sessionState.hasMore;
|
|
405107
|
-
(0,
|
|
405308
|
+
(0, import_react135.useEffect)(() => {
|
|
405108
405309
|
setSelectedIndex(0);
|
|
405109
405310
|
}, [filterByBranch]);
|
|
405110
|
-
const loadMoreSessions = (0,
|
|
405311
|
+
const loadMoreSessions = (0, import_react135.useCallback)(async () => {
|
|
405111
405312
|
if (!sessionState.hasMore || isLoadingMoreRef.current) return;
|
|
405112
405313
|
isLoadingMoreRef.current = true;
|
|
405113
405314
|
try {
|
|
@@ -405145,7 +405346,7 @@ function SessionPicker({
|
|
|
405145
405346
|
const showScrollUp = scrollOffset > 0;
|
|
405146
405347
|
const showScrollDown = scrollOffset + maxVisibleItems < filteredSessions.length;
|
|
405147
405348
|
const sentinelVisible = hasSentinel && scrollOffset + maxVisibleItems >= filteredSessions.length;
|
|
405148
|
-
(0,
|
|
405349
|
+
(0, import_react135.useEffect)(() => {
|
|
405149
405350
|
if (!sessionState.hasMore || isLoadingMoreRef.current) return;
|
|
405150
405351
|
const shouldLoadMore = filteredSessions.length === 0 || sentinelVisible || isLoadingMoreRef.current;
|
|
405151
405352
|
if (shouldLoadMore) {
|
|
@@ -405196,7 +405397,7 @@ function SessionPicker({
|
|
|
405196
405397
|
return;
|
|
405197
405398
|
}
|
|
405198
405399
|
});
|
|
405199
|
-
(0,
|
|
405400
|
+
(0, import_react135.useEffect)(() => {
|
|
405200
405401
|
if (selectedIndex >= filteredSessions.length && filteredSessions.length > 0) {
|
|
405201
405402
|
setSelectedIndex(filteredSessions.length - 1);
|
|
405202
405403
|
}
|
|
@@ -405204,16 +405405,16 @@ function SessionPicker({
|
|
|
405204
405405
|
const contentWidth = terminalSize.width - 4;
|
|
405205
405406
|
const promptMaxWidth = contentWidth - 4;
|
|
405206
405407
|
if (isExiting) {
|
|
405207
|
-
return /* @__PURE__ */ (0,
|
|
405408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Box_default, {});
|
|
405208
405409
|
}
|
|
405209
|
-
return /* @__PURE__ */ (0,
|
|
405410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
405210
405411
|
Box_default,
|
|
405211
405412
|
{
|
|
405212
405413
|
flexDirection: "column",
|
|
405213
405414
|
width: terminalSize.width,
|
|
405214
405415
|
height: terminalSize.height - 1,
|
|
405215
405416
|
overflow: "hidden",
|
|
405216
|
-
children: /* @__PURE__ */ (0,
|
|
405417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
405217
405418
|
Box_default,
|
|
405218
405419
|
{
|
|
405219
405420
|
flexDirection: "column",
|
|
@@ -405223,9 +405424,9 @@ function SessionPicker({
|
|
|
405223
405424
|
height: terminalSize.height - 1,
|
|
405224
405425
|
overflow: "hidden",
|
|
405225
405426
|
children: [
|
|
405226
|
-
/* @__PURE__ */ (0,
|
|
405227
|
-
/* @__PURE__ */ (0,
|
|
405228
|
-
/* @__PURE__ */ (0,
|
|
405427
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text3, { bold: true, color: theme.text.primary, children: "Resume Session" }) }),
|
|
405428
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text3, { color: theme.border.default, children: "\u2500".repeat(terminalSize.width - 2) }) }),
|
|
405429
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Box_default, { flexDirection: "column", flexGrow: 1, paddingX: 1, overflow: "hidden", children: filteredSessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Box_default, { paddingY: 1, justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text3, { color: theme.text.secondary, children: filterByBranch ? `No sessions found for branch "${currentBranch}"` : "No sessions found" }) }) : visibleSessions.map((session, visibleIndex) => {
|
|
405229
405430
|
const actualIndex = scrollOffset + visibleIndex;
|
|
405230
405431
|
const isSelected = actualIndex === selectedIndex;
|
|
405231
405432
|
const isFirst = visibleIndex === 0;
|
|
@@ -405235,21 +405436,21 @@ function SessionPicker({
|
|
|
405235
405436
|
const showUpIndicator = isFirst && showScrollUp;
|
|
405236
405437
|
const showDownIndicator = isLast && showScrollDown;
|
|
405237
405438
|
const prefix = isSelected ? "\u203A " : showUpIndicator ? "\u2191 " : showDownIndicator ? "\u2193 " : " ";
|
|
405238
|
-
return /* @__PURE__ */ (0,
|
|
405439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
405239
405440
|
Box_default,
|
|
405240
405441
|
{
|
|
405241
405442
|
flexDirection: "column",
|
|
405242
405443
|
marginBottom: isLast ? 0 : 1,
|
|
405243
405444
|
children: [
|
|
405244
|
-
/* @__PURE__ */ (0,
|
|
405245
|
-
/* @__PURE__ */ (0,
|
|
405445
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Box_default, { children: [
|
|
405446
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
405246
405447
|
Text3,
|
|
405247
405448
|
{
|
|
405248
405449
|
color: isSelected ? theme.text.accent : showUpIndicator || showDownIndicator ? theme.text.secondary : void 0,
|
|
405249
405450
|
children: prefix
|
|
405250
405451
|
}
|
|
405251
405452
|
),
|
|
405252
|
-
/* @__PURE__ */ (0,
|
|
405453
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
405253
405454
|
Text3,
|
|
405254
405455
|
{
|
|
405255
405456
|
bold: isSelected,
|
|
@@ -405261,9 +405462,9 @@ function SessionPicker({
|
|
|
405261
405462
|
}
|
|
405262
405463
|
)
|
|
405263
405464
|
] }),
|
|
405264
|
-
/* @__PURE__ */ (0,
|
|
405265
|
-
/* @__PURE__ */ (0,
|
|
405266
|
-
/* @__PURE__ */ (0,
|
|
405465
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Box_default, { children: [
|
|
405466
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text3, { children: " " }),
|
|
405467
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
405267
405468
|
timeAgo,
|
|
405268
405469
|
" \xB7 ",
|
|
405269
405470
|
messageText,
|
|
@@ -405275,10 +405476,10 @@ function SessionPicker({
|
|
|
405275
405476
|
session.sessionId
|
|
405276
405477
|
);
|
|
405277
405478
|
}) }),
|
|
405278
|
-
/* @__PURE__ */ (0,
|
|
405279
|
-
/* @__PURE__ */ (0,
|
|
405280
|
-
currentBranch && /* @__PURE__ */ (0,
|
|
405281
|
-
/* @__PURE__ */ (0,
|
|
405479
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Text3, { color: theme.border.default, children: "\u2500".repeat(terminalSize.width - 2) }) }),
|
|
405480
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Box_default, { paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(Text3, { color: theme.text.secondary, children: [
|
|
405481
|
+
currentBranch && /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
405482
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
405282
405483
|
Text3,
|
|
405283
405484
|
{
|
|
405284
405485
|
bold: filterByBranch,
|
|
@@ -405317,7 +405518,7 @@ async function showResumeSessionPicker(cwd7 = process.cwd()) {
|
|
|
405317
405518
|
return new Promise((resolve26) => {
|
|
405318
405519
|
let selectedId;
|
|
405319
405520
|
const { unmount, waitUntilExit } = render_default(
|
|
405320
|
-
/* @__PURE__ */ (0,
|
|
405521
|
+
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
405321
405522
|
SessionPicker,
|
|
405322
405523
|
{
|
|
405323
405524
|
sessionService,
|
|
@@ -406706,7 +406907,7 @@ var SubAgentTracker = class {
|
|
|
406706
406907
|
|
|
406707
406908
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
406708
406909
|
var ALLOWED_BUILTIN_COMMANDS_FOR_ACP = ["init"];
|
|
406709
|
-
var
|
|
406910
|
+
var Session3 = class {
|
|
406710
406911
|
constructor(id, chat, config2, client, settings) {
|
|
406711
406912
|
this.chat = chat;
|
|
406712
406913
|
this.config = config2;
|
|
@@ -407447,7 +407648,7 @@ var GeminiAgent = class {
|
|
|
407447
407648
|
name: APPROVAL_MODE_INFO[mode].name,
|
|
407448
407649
|
description: APPROVAL_MODE_INFO[mode].description
|
|
407449
407650
|
}));
|
|
407450
|
-
const version3 = "0.1.3-alpha.
|
|
407651
|
+
const version3 = "0.1.3-alpha.4";
|
|
407451
407652
|
return {
|
|
407452
407653
|
protocolVersion: PROTOCOL_VERSION,
|
|
407453
407654
|
agentInfo: {
|
|
@@ -407615,7 +407816,7 @@ var GeminiAgent = class {
|
|
|
407615
407816
|
const geminiClient = config2.getGeminiClient();
|
|
407616
407817
|
const history = conversation ? buildApiHistoryFromConversation(conversation) : void 0;
|
|
407617
407818
|
const chat = history ? await geminiClient.startChat(history) : await geminiClient.startChat();
|
|
407618
|
-
const session = new
|
|
407819
|
+
const session = new Session3(
|
|
407619
407820
|
sessionId,
|
|
407620
407821
|
chat,
|
|
407621
407822
|
config2,
|
|
@@ -407634,7 +407835,7 @@ var GeminiAgent = class {
|
|
|
407634
407835
|
};
|
|
407635
407836
|
|
|
407636
407837
|
// packages/cli/src/gemini.tsx
|
|
407637
|
-
var
|
|
407838
|
+
var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1);
|
|
407638
407839
|
function validateDnsResolutionOrder(order) {
|
|
407639
407840
|
const defaultValue = "ipv4first";
|
|
407640
407841
|
if (order === void 0) {
|
|
@@ -407699,14 +407900,14 @@ async function startInteractiveUI(config2, settings, startupWarnings, workspaceR
|
|
|
407699
407900
|
const AppWrapper = /* @__PURE__ */ __name(() => {
|
|
407700
407901
|
const kittyProtocolStatus = useKittyKeyboardProtocol();
|
|
407701
407902
|
const nodeMajorVersion = parseInt(process.versions.node.split(".")[0], 10);
|
|
407702
|
-
return /* @__PURE__ */ (0,
|
|
407903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SettingsContext.Provider, { value: settings, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
407703
407904
|
KeypressProvider,
|
|
407704
407905
|
{
|
|
407705
407906
|
kittyProtocolEnabled: kittyProtocolStatus.enabled,
|
|
407706
407907
|
config: config2,
|
|
407707
407908
|
debugKeystrokeLogging: settings.merged.general?.debugKeystrokeLogging,
|
|
407708
407909
|
pasteWorkaround: process.platform === "win32" || nodeMajorVersion < 20,
|
|
407709
|
-
children: /* @__PURE__ */ (0,
|
|
407910
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(SessionStatsProvider, { sessionId: config2.getSessionId(), children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(VimModeProvider, { settings, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
407710
407911
|
AppContainer,
|
|
407711
407912
|
{
|
|
407712
407913
|
config: config2,
|
|
@@ -407720,7 +407921,7 @@ async function startInteractiveUI(config2, settings, startupWarnings, workspaceR
|
|
|
407720
407921
|
) });
|
|
407721
407922
|
}, "AppWrapper");
|
|
407722
407923
|
const instance = render_default(
|
|
407723
|
-
process.env["DEBUG"] ? /* @__PURE__ */ (0,
|
|
407924
|
+
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_react136.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(AppWrapper, {}),
|
|
407724
407925
|
{
|
|
407725
407926
|
exitOnCtrlC: false,
|
|
407726
407927
|
isScreenReaderEnabled: config2.getScreenReader()
|
|
@@ -407883,7 +408084,11 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
407883
408084
|
kittyProtocolDetectionComplete = detectAndEnableKittyProtocol();
|
|
407884
408085
|
}
|
|
407885
408086
|
setMaxSizedBoxDebugging(isDebugMode2);
|
|
407886
|
-
const
|
|
408087
|
+
const inputFormat = typeof config2.getInputFormat === "function" ? config2.getInputFormat() : "text" /* TEXT */;
|
|
408088
|
+
let initializationResult;
|
|
408089
|
+
if (inputFormat !== "stream-json" /* STREAM_JSON */) {
|
|
408090
|
+
initializationResult = await initializeApp(config2, settings);
|
|
408091
|
+
}
|
|
407887
408092
|
if (settings.merged.security?.auth?.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config2.isBrowserLaunchSuppressed()) {
|
|
407888
408093
|
await getOauthClient(settings.merged.security.auth.selectedType, config2);
|
|
407889
408094
|
}
|
|
@@ -407937,8 +408142,9 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
407937
408142
|
);
|
|
407938
408143
|
return;
|
|
407939
408144
|
}
|
|
407940
|
-
|
|
407941
|
-
|
|
408145
|
+
if (inputFormat !== "stream-json" /* STREAM_JSON */) {
|
|
408146
|
+
await config2.initialize();
|
|
408147
|
+
}
|
|
407942
408148
|
if (inputFormat !== "stream-json" /* STREAM_JSON */ && !process.stdin.isTTY) {
|
|
407943
408149
|
const stdinData = await readStdin();
|
|
407944
408150
|
if (stdinData) {
|
|
@@ -407948,7 +408154,7 @@ ${input}`;
|
|
|
407948
408154
|
}
|
|
407949
408155
|
}
|
|
407950
408156
|
const nonInteractiveConfig = await validateNonInteractiveAuth(
|
|
407951
|
-
settings.merged.security?.auth?.selectedType,
|
|
408157
|
+
argv.authType || settings.merged.security?.auth?.selectedType,
|
|
407952
408158
|
settings.merged.security?.auth?.useExternal,
|
|
407953
408159
|
config2,
|
|
407954
408160
|
settings
|