@rdmind/rdmind 0.0.27 → 0.0.28-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +1192 -1044
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -26868,7 +26868,7 @@ var require_backend = __commonJS({
|
|
|
26868
26868
|
return [b, function() {
|
|
26869
26869
|
}];
|
|
26870
26870
|
}, "useReducer"),
|
|
26871
|
-
useRef: /* @__PURE__ */ __name(function
|
|
26871
|
+
useRef: /* @__PURE__ */ __name(function useRef22(a) {
|
|
26872
26872
|
var b = C();
|
|
26873
26873
|
a = null !== b ? b.memoizedState : {
|
|
26874
26874
|
current: a
|
|
@@ -26880,7 +26880,7 @@ var require_backend = __commonJS({
|
|
|
26880
26880
|
});
|
|
26881
26881
|
return a;
|
|
26882
26882
|
}, "useRef"),
|
|
26883
|
-
useState: /* @__PURE__ */ __name(function
|
|
26883
|
+
useState: /* @__PURE__ */ __name(function useState66(a) {
|
|
26884
26884
|
var b = C();
|
|
26885
26885
|
a = null !== b ? b.memoizedState : "function" === typeof a ? a() : a;
|
|
26886
26886
|
x.push({
|
|
@@ -98064,7 +98064,7 @@ function isDeviceTokenPending(response) {
|
|
|
98064
98064
|
function isErrorResponse(response) {
|
|
98065
98065
|
return "error" in response;
|
|
98066
98066
|
}
|
|
98067
|
-
async function getQwenOAuthClient(config) {
|
|
98067
|
+
async function getQwenOAuthClient(config, options2) {
|
|
98068
98068
|
const client = new QwenOAuth2Client();
|
|
98069
98069
|
const sharedManager = SharedTokenManager.getInstance();
|
|
98070
98070
|
try {
|
|
@@ -98072,10 +98072,6 @@ async function getQwenOAuthClient(config) {
|
|
|
98072
98072
|
client.setCredentials(credentials);
|
|
98073
98073
|
return client;
|
|
98074
98074
|
} catch (error) {
|
|
98075
|
-
console.debug(
|
|
98076
|
-
"Shared token manager failed, attempting device flow:",
|
|
98077
|
-
error
|
|
98078
|
-
);
|
|
98079
98075
|
if (error instanceof TokenManagerError) {
|
|
98080
98076
|
switch (error.type) {
|
|
98081
98077
|
case "NO_REFRESH_TOKEN" /* NO_REFRESH_TOKEN */:
|
|
@@ -98098,10 +98094,16 @@ async function getQwenOAuthClient(config) {
|
|
|
98098
98094
|
if (await loadCachedQwenCredentials(client)) {
|
|
98099
98095
|
const result2 = await authWithQwenDeviceFlow(client, config);
|
|
98100
98096
|
if (!result2.success) {
|
|
98101
|
-
|
|
98097
|
+
const errorMessage = result2.message || "Qwen OAuth authentication failed";
|
|
98098
|
+
throw new Error(errorMessage);
|
|
98102
98099
|
}
|
|
98103
98100
|
return client;
|
|
98104
98101
|
}
|
|
98102
|
+
if (options2?.requireCachedCredentials) {
|
|
98103
|
+
throw new Error(
|
|
98104
|
+
"No cached Qwen-OAuth credentials found. Please re-authenticate."
|
|
98105
|
+
);
|
|
98106
|
+
}
|
|
98105
98107
|
const result = await authWithQwenDeviceFlow(client, config);
|
|
98106
98108
|
if (!result.success) {
|
|
98107
98109
|
if (result.reason === "timeout") {
|
|
@@ -98111,19 +98113,20 @@ async function getQwenOAuthClient(config) {
|
|
|
98111
98113
|
"Authentication timed out. Please try again or select a different authentication method."
|
|
98112
98114
|
);
|
|
98113
98115
|
}
|
|
98114
|
-
|
|
98115
|
-
|
|
98116
|
-
|
|
98117
|
-
|
|
98118
|
-
|
|
98119
|
-
|
|
98120
|
-
|
|
98121
|
-
"Too many request for Qwen OAuth authentication, please try again later."
|
|
98122
|
-
|
|
98123
|
-
|
|
98124
|
-
|
|
98125
|
-
|
|
98126
|
-
}
|
|
98116
|
+
const errorMessage = result.message || (() => {
|
|
98117
|
+
switch (result.reason) {
|
|
98118
|
+
case "timeout":
|
|
98119
|
+
return "Qwen OAuth authentication timed out";
|
|
98120
|
+
case "cancelled":
|
|
98121
|
+
return "Qwen OAuth authentication was cancelled by user";
|
|
98122
|
+
case "rate_limit":
|
|
98123
|
+
return "Too many request for Qwen OAuth authentication, please try again later.";
|
|
98124
|
+
case "error":
|
|
98125
|
+
default:
|
|
98126
|
+
return "Qwen OAuth authentication failed";
|
|
98127
|
+
}
|
|
98128
|
+
})();
|
|
98129
|
+
throw new Error(errorMessage);
|
|
98127
98130
|
}
|
|
98128
98131
|
return client;
|
|
98129
98132
|
}
|
|
@@ -98187,13 +98190,10 @@ ${deviceAuth.verification_uri_complete}
|
|
|
98187
98190
|
);
|
|
98188
98191
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
98189
98192
|
if (isCancelled) {
|
|
98190
|
-
|
|
98191
|
-
|
|
98192
|
-
|
|
98193
|
-
|
|
98194
|
-
"Authentication cancelled by user."
|
|
98195
|
-
);
|
|
98196
|
-
return { success: false, reason: "cancelled" };
|
|
98193
|
+
const message = "Authentication cancelled by user.";
|
|
98194
|
+
console.debug("\n" + message);
|
|
98195
|
+
qwenOAuth2Events.emit("auth-progress" /* AuthProgress */, "error", message);
|
|
98196
|
+
return { success: false, reason: "cancelled", message };
|
|
98197
98197
|
}
|
|
98198
98198
|
try {
|
|
98199
98199
|
console.debug("polling for token...");
|
|
@@ -98255,13 +98255,14 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`
|
|
|
98255
98255
|
}, checkInterval);
|
|
98256
98256
|
});
|
|
98257
98257
|
if (isCancelled) {
|
|
98258
|
-
|
|
98258
|
+
const message = "Authentication cancelled by user.";
|
|
98259
|
+
console.debug("\n" + message);
|
|
98259
98260
|
qwenOAuth2Events.emit(
|
|
98260
98261
|
"auth-progress" /* AuthProgress */,
|
|
98261
98262
|
"error",
|
|
98262
|
-
|
|
98263
|
+
message
|
|
98263
98264
|
);
|
|
98264
|
-
return { success: false, reason: "cancelled" };
|
|
98265
|
+
return { success: false, reason: "cancelled", message };
|
|
98265
98266
|
}
|
|
98266
98267
|
continue;
|
|
98267
98268
|
}
|
|
@@ -98274,25 +98275,36 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`
|
|
|
98274
98275
|
} catch (error) {
|
|
98275
98276
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
98276
98277
|
const statusCode = error instanceof Error ? error.status : null;
|
|
98278
|
+
const handleError2 = /* @__PURE__ */ __name((reason, message2, eventType = "error") => {
|
|
98279
|
+
qwenOAuth2Events.emit(
|
|
98280
|
+
"auth-progress" /* AuthProgress */,
|
|
98281
|
+
eventType,
|
|
98282
|
+
message2
|
|
98283
|
+
);
|
|
98284
|
+
console.error("\n" + message2);
|
|
98285
|
+
return { success: false, reason, message: message2 };
|
|
98286
|
+
}, "handleError");
|
|
98287
|
+
if (errorMessage.includes("Failed to cache credentials")) {
|
|
98288
|
+
return handleError2("error", errorMessage);
|
|
98289
|
+
}
|
|
98277
98290
|
if (errorMessage.includes("401") || statusCode === 401) {
|
|
98278
|
-
|
|
98279
|
-
|
|
98280
|
-
|
|
98291
|
+
return handleError2(
|
|
98292
|
+
"error",
|
|
98293
|
+
"Device code expired or invalid, please restart the authorization process."
|
|
98294
|
+
);
|
|
98281
98295
|
}
|
|
98282
98296
|
if (errorMessage.includes("429") || statusCode === 429) {
|
|
98283
|
-
|
|
98284
|
-
qwenOAuth2Events.emit(
|
|
98285
|
-
"auth-progress" /* AuthProgress */,
|
|
98297
|
+
return handleError2(
|
|
98286
98298
|
"rate_limit",
|
|
98287
|
-
|
|
98299
|
+
"Too many requests. The server is rate limiting our requests. Please select a different authentication method or try again later.",
|
|
98300
|
+
"rate_limit"
|
|
98288
98301
|
);
|
|
98289
|
-
console.log("\n" + message2);
|
|
98290
|
-
return { success: false, reason: "rate_limit" };
|
|
98291
98302
|
}
|
|
98292
98303
|
const message = `Error polling for token: ${errorMessage}`;
|
|
98293
98304
|
qwenOAuth2Events.emit("auth-progress" /* AuthProgress */, "error", message);
|
|
98294
98305
|
if (isCancelled) {
|
|
98295
|
-
|
|
98306
|
+
const message2 = "Authentication cancelled by user.";
|
|
98307
|
+
return { success: false, reason: "cancelled", message: message2 };
|
|
98296
98308
|
}
|
|
98297
98309
|
await new Promise((resolve26) => setTimeout(resolve26, pollInterval));
|
|
98298
98310
|
}
|
|
@@ -98304,11 +98316,12 @@ Server requested to slow down, increasing poll interval to ${pollInterval}ms'`
|
|
|
98304
98316
|
timeoutMessage
|
|
98305
98317
|
);
|
|
98306
98318
|
console.error("\n" + timeoutMessage);
|
|
98307
|
-
return { success: false, reason: "timeout" };
|
|
98319
|
+
return { success: false, reason: "timeout", message: timeoutMessage };
|
|
98308
98320
|
} catch (error) {
|
|
98309
98321
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
98310
|
-
|
|
98311
|
-
|
|
98322
|
+
const message = `Device authorization flow failed: ${errorMessage}`;
|
|
98323
|
+
console.error(message);
|
|
98324
|
+
return { success: false, reason: "error", message };
|
|
98312
98325
|
} finally {
|
|
98313
98326
|
qwenOAuth2Events.off("auth-cancel" /* AuthCancel */, cancelHandler);
|
|
98314
98327
|
}
|
|
@@ -98330,9 +98343,22 @@ async function loadCachedQwenCredentials(client) {
|
|
|
98330
98343
|
}
|
|
98331
98344
|
async function cacheQwenCredentials(credentials) {
|
|
98332
98345
|
const filePath = getQwenCachedCredentialPath();
|
|
98333
|
-
|
|
98334
|
-
|
|
98335
|
-
|
|
98346
|
+
try {
|
|
98347
|
+
await fs11.mkdir(path7.dirname(filePath), { recursive: true });
|
|
98348
|
+
const credString = JSON.stringify(credentials, null, 2);
|
|
98349
|
+
await fs11.writeFile(filePath, credString);
|
|
98350
|
+
} catch (error) {
|
|
98351
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
98352
|
+
const errorCode = error instanceof Error && "code" in error ? error.code : void 0;
|
|
98353
|
+
if (errorCode === "EACCES") {
|
|
98354
|
+
throw new Error(
|
|
98355
|
+
`Failed to cache credentials: Permission denied (EACCES). Current user has no permission to access \`${filePath}\`. Please check permissions.`
|
|
98356
|
+
);
|
|
98357
|
+
}
|
|
98358
|
+
throw new Error(
|
|
98359
|
+
`Failed to cache credentials: error when creating folder \`${path7.dirname(filePath)}\` and writing to \`${filePath}\`. ${errorMessage}. Please check permissions.`
|
|
98360
|
+
);
|
|
98361
|
+
}
|
|
98336
98362
|
}
|
|
98337
98363
|
async function clearQwenCredentials() {
|
|
98338
98364
|
try {
|
|
@@ -114160,7 +114186,7 @@ function makeChatCompressionEvent({
|
|
|
114160
114186
|
tokens_after
|
|
114161
114187
|
};
|
|
114162
114188
|
}
|
|
114163
|
-
var StartSessionEvent, EndSessionEvent, UserPromptEvent, ToolCallEvent, ApiRequestEvent, ApiErrorEvent, ApiCancelEvent, ApiResponseEvent, FlashFallbackEvent, RipgrepFallbackEvent, LoopDetectedEvent, LoopDetectionDisabledEvent, NextSpeakerCheckEvent, IdeConnectionEvent, ConversationFinishedEvent, KittySequenceOverflowEvent, FileOperationEvent, ContentRetryEvent, ContentRetryFailureEvent, ExtensionInstallEvent, ToolOutputTruncatedEvent, ExtensionUninstallEvent, ExtensionEnableEvent, ModelSlashCommandEvent, SubagentExecutionEvent, ExtensionDisableEvent;
|
|
114189
|
+
var StartSessionEvent, EndSessionEvent, UserPromptEvent, ToolCallEvent, ApiRequestEvent, ApiErrorEvent, ApiCancelEvent, ApiResponseEvent, FlashFallbackEvent, RipgrepFallbackEvent, LoopDetectedEvent, LoopDetectionDisabledEvent, NextSpeakerCheckEvent, IdeConnectionEvent, ConversationFinishedEvent, KittySequenceOverflowEvent, FileOperationEvent, ContentRetryEvent, ContentRetryFailureEvent, ExtensionInstallEvent, ToolOutputTruncatedEvent, ExtensionUninstallEvent, ExtensionEnableEvent, ModelSlashCommandEvent, SubagentExecutionEvent, AuthEvent, ExtensionDisableEvent;
|
|
114164
114190
|
var init_types3 = __esm({
|
|
114165
114191
|
"packages/core/src/telemetry/types.ts"() {
|
|
114166
114192
|
"use strict";
|
|
@@ -114698,6 +114724,25 @@ var init_types3 = __esm({
|
|
|
114698
114724
|
this.execution_summary = options2?.execution_summary;
|
|
114699
114725
|
}
|
|
114700
114726
|
};
|
|
114727
|
+
AuthEvent = class {
|
|
114728
|
+
static {
|
|
114729
|
+
__name(this, "AuthEvent");
|
|
114730
|
+
}
|
|
114731
|
+
"event.name";
|
|
114732
|
+
"event.timestamp";
|
|
114733
|
+
auth_type;
|
|
114734
|
+
action_type;
|
|
114735
|
+
status;
|
|
114736
|
+
error_message;
|
|
114737
|
+
constructor(auth_type, action_type, status, error_message) {
|
|
114738
|
+
this["event.name"] = "auth";
|
|
114739
|
+
this["event.timestamp"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
114740
|
+
this.auth_type = auth_type;
|
|
114741
|
+
this.action_type = action_type;
|
|
114742
|
+
this.status = status;
|
|
114743
|
+
this.error_message = error_message;
|
|
114744
|
+
}
|
|
114745
|
+
};
|
|
114701
114746
|
ExtensionDisableEvent = class {
|
|
114702
114747
|
static {
|
|
114703
114748
|
__name(this, "ExtensionDisableEvent");
|
|
@@ -117112,7 +117157,7 @@ var init_esm = __esm({
|
|
|
117112
117157
|
});
|
|
117113
117158
|
|
|
117114
117159
|
// packages/core/src/telemetry/constants.ts
|
|
117115
|
-
var SERVICE_NAME, EVENT_USER_PROMPT, EVENT_TOOL_CALL, EVENT_API_REQUEST, EVENT_API_ERROR, EVENT_API_CANCEL, EVENT_API_RESPONSE, EVENT_CLI_CONFIG, EVENT_EXTENSION_DISABLE, EVENT_EXTENSION_ENABLE, EVENT_EXTENSION_INSTALL, EVENT_EXTENSION_UNINSTALL, EVENT_FLASH_FALLBACK, EVENT_RIPGREP_FALLBACK, EVENT_NEXT_SPEAKER_CHECK, EVENT_SLASH_COMMAND, EVENT_IDE_CONNECTION, EVENT_CHAT_COMPRESSION, EVENT_CONTENT_RETRY, EVENT_CONTENT_RETRY_FAILURE, EVENT_CONVERSATION_FINISHED, EVENT_FILE_OPERATION, EVENT_MODEL_SLASH_COMMAND, EVENT_SUBAGENT_EXECUTION;
|
|
117160
|
+
var SERVICE_NAME, EVENT_USER_PROMPT, EVENT_TOOL_CALL, EVENT_API_REQUEST, EVENT_API_ERROR, EVENT_API_CANCEL, EVENT_API_RESPONSE, EVENT_CLI_CONFIG, EVENT_EXTENSION_DISABLE, EVENT_EXTENSION_ENABLE, EVENT_EXTENSION_INSTALL, EVENT_EXTENSION_UNINSTALL, EVENT_FLASH_FALLBACK, EVENT_RIPGREP_FALLBACK, EVENT_NEXT_SPEAKER_CHECK, EVENT_SLASH_COMMAND, EVENT_IDE_CONNECTION, EVENT_CHAT_COMPRESSION, EVENT_CONTENT_RETRY, EVENT_CONTENT_RETRY_FAILURE, EVENT_CONVERSATION_FINISHED, EVENT_FILE_OPERATION, EVENT_MODEL_SLASH_COMMAND, EVENT_SUBAGENT_EXECUTION, EVENT_AUTH;
|
|
117116
117161
|
var init_constants = __esm({
|
|
117117
117162
|
"packages/core/src/telemetry/constants.ts"() {
|
|
117118
117163
|
"use strict";
|
|
@@ -117141,6 +117186,7 @@ var init_constants = __esm({
|
|
|
117141
117186
|
EVENT_FILE_OPERATION = "rdmind.file_operation";
|
|
117142
117187
|
EVENT_MODEL_SLASH_COMMAND = "rdmind.slash_command.model";
|
|
117143
117188
|
EVENT_SUBAGENT_EXECUTION = "rdmind.subagent_execution";
|
|
117189
|
+
EVENT_AUTH = "rdmind.auth";
|
|
117144
117190
|
}
|
|
117145
117191
|
});
|
|
117146
117192
|
|
|
@@ -121202,6 +121248,21 @@ var init_qwen_logger = __esm({
|
|
|
121202
121248
|
this.enqueueLogEvent(rumEvent);
|
|
121203
121249
|
this.flushIfNeeded();
|
|
121204
121250
|
}
|
|
121251
|
+
logAuthEvent(event) {
|
|
121252
|
+
const snapshots = {
|
|
121253
|
+
auth_type: event.auth_type,
|
|
121254
|
+
action_type: event.action_type,
|
|
121255
|
+
status: event.status
|
|
121256
|
+
};
|
|
121257
|
+
if (event.error_message) {
|
|
121258
|
+
snapshots["error_message"] = event.error_message;
|
|
121259
|
+
}
|
|
121260
|
+
const rumEvent = this.createActionEvent("auth", "auth", {
|
|
121261
|
+
snapshots: JSON.stringify(snapshots)
|
|
121262
|
+
});
|
|
121263
|
+
this.enqueueLogEvent(rumEvent);
|
|
121264
|
+
this.flushIfNeeded();
|
|
121265
|
+
}
|
|
121205
121266
|
// misc events
|
|
121206
121267
|
logFlashFallbackEvent(event) {
|
|
121207
121268
|
const rumEvent = this.createActionEvent("misc", "flash_fallback", {
|
|
@@ -171730,6 +171791,28 @@ function logExtensionDisable(config, event) {
|
|
|
171730
171791
|
};
|
|
171731
171792
|
logger6.emit(logRecord);
|
|
171732
171793
|
}
|
|
171794
|
+
function logAuth(config, event) {
|
|
171795
|
+
QwenLogger.getInstance(config)?.logAuthEvent(event);
|
|
171796
|
+
if (!isTelemetrySdkInitialized()) return;
|
|
171797
|
+
const attributes = {
|
|
171798
|
+
...getCommonAttributes(config),
|
|
171799
|
+
...event,
|
|
171800
|
+
"event.name": EVENT_AUTH,
|
|
171801
|
+
"event.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
171802
|
+
auth_type: event.auth_type,
|
|
171803
|
+
action_type: event.action_type,
|
|
171804
|
+
status: event.status
|
|
171805
|
+
};
|
|
171806
|
+
if (event.error_message) {
|
|
171807
|
+
attributes["error.message"] = event.error_message;
|
|
171808
|
+
}
|
|
171809
|
+
const logger6 = import_api_logs.logs.getLogger(SERVICE_NAME);
|
|
171810
|
+
const logRecord = {
|
|
171811
|
+
body: `Auth event: ${event.action_type} ${event.status} for ${event.auth_type}`,
|
|
171812
|
+
attributes
|
|
171813
|
+
};
|
|
171814
|
+
logger6.emit(logRecord);
|
|
171815
|
+
}
|
|
171733
171816
|
var import_api_logs, shouldLogUserPrompts;
|
|
171734
171817
|
var init_loggers = __esm({
|
|
171735
171818
|
"packages/core/src/telemetry/loggers.ts"() {
|
|
@@ -171773,6 +171856,7 @@ var init_loggers = __esm({
|
|
|
171773
171856
|
__name(logExtensionUninstall, "logExtensionUninstall");
|
|
171774
171857
|
__name(logExtensionEnable, "logExtensionEnable");
|
|
171775
171858
|
__name(logExtensionDisable, "logExtensionDisable");
|
|
171859
|
+
__name(logAuth, "logAuth");
|
|
171776
171860
|
}
|
|
171777
171861
|
});
|
|
171778
171862
|
|
|
@@ -183803,8 +183887,8 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
183803
183887
|
model: newContentGeneratorConfig?.model || DEFAULT_QWEN_MODEL
|
|
183804
183888
|
};
|
|
183805
183889
|
}
|
|
183806
|
-
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
183807
|
-
const version2 = "0.0.
|
|
183890
|
+
async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
|
|
183891
|
+
const version2 = "0.0.28-alpha.0";
|
|
183808
183892
|
const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
183809
183893
|
const baseHeaders = {
|
|
183810
183894
|
"User-Agent": userAgent2
|
|
@@ -183850,11 +183934,14 @@ async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
|
183850
183934
|
const { getQwenOAuthClient: getQwenOauthClient } = await Promise.resolve().then(() => (init_qwenOAuth2(), qwenOAuth2_exports));
|
|
183851
183935
|
const { QwenContentGenerator: QwenContentGenerator2 } = await Promise.resolve().then(() => (init_qwenContentGenerator(), qwenContentGenerator_exports));
|
|
183852
183936
|
try {
|
|
183853
|
-
const qwenClient = await getQwenOauthClient(
|
|
183937
|
+
const qwenClient = await getQwenOauthClient(
|
|
183938
|
+
gcConfig,
|
|
183939
|
+
isInitialAuth ? { requireCachedCredentials: true } : void 0
|
|
183940
|
+
);
|
|
183854
183941
|
return new QwenContentGenerator2(qwenClient, config, gcConfig);
|
|
183855
183942
|
} catch (error) {
|
|
183856
183943
|
throw new Error(
|
|
183857
|
-
|
|
183944
|
+
`${error instanceof Error ? error.message : String(error)}`
|
|
183858
183945
|
);
|
|
183859
183946
|
}
|
|
183860
183947
|
}
|
|
@@ -234346,7 +234433,7 @@ function getPlatformString(platform15) {
|
|
|
234346
234433
|
case "win32":
|
|
234347
234434
|
return platform15;
|
|
234348
234435
|
default:
|
|
234349
|
-
|
|
234436
|
+
return void 0;
|
|
234350
234437
|
}
|
|
234351
234438
|
}
|
|
234352
234439
|
function getArchitectureString(arch3) {
|
|
@@ -234355,12 +234442,15 @@ function getArchitectureString(arch3) {
|
|
|
234355
234442
|
case "arm64":
|
|
234356
234443
|
return arch3;
|
|
234357
234444
|
default:
|
|
234358
|
-
|
|
234445
|
+
return void 0;
|
|
234359
234446
|
}
|
|
234360
234447
|
}
|
|
234361
|
-
function
|
|
234448
|
+
function getBuiltinRipgrep() {
|
|
234362
234449
|
const platform15 = getPlatformString(process.platform);
|
|
234363
234450
|
const arch3 = getArchitectureString(process.arch);
|
|
234451
|
+
if (!platform15 || !arch3) {
|
|
234452
|
+
return null;
|
|
234453
|
+
}
|
|
234364
234454
|
const binaryName = platform15 === "win32" ? "rg.exe" : "rg";
|
|
234365
234455
|
const isBundled = !__filename2.includes(path39.join("src", "utils"));
|
|
234366
234456
|
const vendorPath = isBundled ? path39.join(
|
|
@@ -234381,32 +234471,36 @@ function getRipgrepPath() {
|
|
|
234381
234471
|
);
|
|
234382
234472
|
return vendorPath;
|
|
234383
234473
|
}
|
|
234384
|
-
async function
|
|
234474
|
+
async function getSystemRipgrep() {
|
|
234385
234475
|
try {
|
|
234386
|
-
if (useBuiltin) {
|
|
234387
|
-
const rgPath = getRipgrepPath();
|
|
234388
|
-
if (await fileExists(rgPath)) {
|
|
234389
|
-
return true;
|
|
234390
|
-
}
|
|
234391
|
-
}
|
|
234392
234476
|
const { spawn: spawn13 } = await import("node:child_process");
|
|
234393
|
-
|
|
234394
|
-
|
|
234477
|
+
const rgCommand = process.platform === "win32" ? "rg.exe" : "rg";
|
|
234478
|
+
const isAvailable = await new Promise((resolve26) => {
|
|
234479
|
+
const proc2 = spawn13(rgCommand, ["--version"]);
|
|
234395
234480
|
proc2.on("error", () => resolve26(false));
|
|
234396
234481
|
proc2.on("exit", (code2) => resolve26(code2 === 0));
|
|
234397
234482
|
});
|
|
234483
|
+
return isAvailable ? rgCommand : null;
|
|
234398
234484
|
} catch (_error) {
|
|
234399
|
-
return
|
|
234485
|
+
return null;
|
|
234400
234486
|
}
|
|
234401
234487
|
}
|
|
234402
|
-
async function
|
|
234403
|
-
|
|
234404
|
-
|
|
234405
|
-
|
|
234406
|
-
|
|
234407
|
-
|
|
234488
|
+
async function getRipgrepCommand(useBuiltin = true) {
|
|
234489
|
+
try {
|
|
234490
|
+
if (useBuiltin) {
|
|
234491
|
+
const rgPath = getBuiltinRipgrep();
|
|
234492
|
+
if (rgPath && await fileExists(rgPath)) {
|
|
234493
|
+
return rgPath;
|
|
234494
|
+
}
|
|
234495
|
+
}
|
|
234496
|
+
return await getSystemRipgrep();
|
|
234497
|
+
} catch (_error) {
|
|
234498
|
+
return null;
|
|
234408
234499
|
}
|
|
234409
|
-
|
|
234500
|
+
}
|
|
234501
|
+
async function canUseRipgrep(useBuiltin = true) {
|
|
234502
|
+
const rgPath = await getRipgrepCommand(useBuiltin);
|
|
234503
|
+
return rgPath !== null;
|
|
234410
234504
|
}
|
|
234411
234505
|
var __filename2, __dirname3;
|
|
234412
234506
|
var init_ripgrepUtils = __esm({
|
|
@@ -234418,16 +234512,16 @@ var init_ripgrepUtils = __esm({
|
|
|
234418
234512
|
__dirname3 = path39.dirname(__filename2);
|
|
234419
234513
|
__name(getPlatformString, "getPlatformString");
|
|
234420
234514
|
__name(getArchitectureString, "getArchitectureString");
|
|
234421
|
-
__name(
|
|
234515
|
+
__name(getBuiltinRipgrep, "getBuiltinRipgrep");
|
|
234516
|
+
__name(getSystemRipgrep, "getSystemRipgrep");
|
|
234517
|
+
__name(getRipgrepCommand, "getRipgrepCommand");
|
|
234422
234518
|
__name(canUseRipgrep, "canUseRipgrep");
|
|
234423
|
-
__name(ensureRipgrepPath, "ensureRipgrepPath");
|
|
234424
234519
|
}
|
|
234425
234520
|
});
|
|
234426
234521
|
|
|
234427
234522
|
// packages/core/src/tools/ripGrep.ts
|
|
234428
234523
|
import fs36 from "node:fs";
|
|
234429
234524
|
import path40 from "node:path";
|
|
234430
|
-
import { EOL as EOL3 } from "node:os";
|
|
234431
234525
|
import { spawn as spawn6 } from "node:child_process";
|
|
234432
234526
|
var GrepToolInvocation2, RipGrepTool;
|
|
234433
234527
|
var init_ripGrep = __esm({
|
|
@@ -234469,7 +234563,7 @@ var init_ripGrep = __esm({
|
|
|
234469
234563
|
const noMatchMsg = `No matches found for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}.`;
|
|
234470
234564
|
return { llmContent: noMatchMsg, returnDisplay: `No matches found` };
|
|
234471
234565
|
}
|
|
234472
|
-
const allLines = rawOutput.split(
|
|
234566
|
+
const allLines = rawOutput.split("\n").filter((line) => line.trim());
|
|
234473
234567
|
const totalMatches = allLines.length;
|
|
234474
234568
|
const matchTerm = totalMatches === 1 ? "match" : "matches";
|
|
234475
234569
|
const header = `Found ${totalMatches} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}:
|
|
@@ -234527,7 +234621,7 @@ var init_ripGrep = __esm({
|
|
|
234527
234621
|
returnDisplay: displayMessage
|
|
234528
234622
|
};
|
|
234529
234623
|
} catch (error) {
|
|
234530
|
-
console.error(`Error during
|
|
234624
|
+
console.error(`Error during ripgrep search operation: ${error}`);
|
|
234531
234625
|
const errorMessage = getErrorMessage(error);
|
|
234532
234626
|
return {
|
|
234533
234627
|
llmContent: `Error during grep search operation: ${errorMessage}`,
|
|
@@ -234564,9 +234658,14 @@ var init_ripGrep = __esm({
|
|
|
234564
234658
|
rgArgs.push("--threads", "4");
|
|
234565
234659
|
rgArgs.push(absolutePath);
|
|
234566
234660
|
try {
|
|
234567
|
-
const
|
|
234661
|
+
const rgCommand = await getRipgrepCommand(
|
|
234662
|
+
this.config.getUseBuiltinRipgrep()
|
|
234663
|
+
);
|
|
234664
|
+
if (!rgCommand) {
|
|
234665
|
+
throw new Error("ripgrep binary not found.");
|
|
234666
|
+
}
|
|
234568
234667
|
const output = await new Promise((resolve26, reject) => {
|
|
234569
|
-
const child = spawn6(
|
|
234668
|
+
const child = spawn6(rgCommand, rgArgs, {
|
|
234570
234669
|
windowsHide: true
|
|
234571
234670
|
});
|
|
234572
234671
|
const stdoutChunks = [];
|
|
@@ -234581,7 +234680,7 @@ var init_ripGrep = __esm({
|
|
|
234581
234680
|
child.stderr.on("data", (chunk) => stderrChunks.push(chunk));
|
|
234582
234681
|
child.on("error", (err) => {
|
|
234583
234682
|
options2.signal.removeEventListener("abort", cleanup);
|
|
234584
|
-
reject(new Error(`
|
|
234683
|
+
reject(new Error(`failed to start ripgrep: ${err.message}.`));
|
|
234585
234684
|
});
|
|
234586
234685
|
child.on("close", (code2) => {
|
|
234587
234686
|
options2.signal.removeEventListener("abort", cleanup);
|
|
@@ -234600,7 +234699,7 @@ var init_ripGrep = __esm({
|
|
|
234600
234699
|
});
|
|
234601
234700
|
return output;
|
|
234602
234701
|
} catch (error) {
|
|
234603
|
-
console.error(`
|
|
234702
|
+
console.error(`Ripgrep failed: ${getErrorMessage(error)}`);
|
|
234604
234703
|
throw error;
|
|
234605
234704
|
}
|
|
234606
234705
|
}
|
|
@@ -248130,7 +248229,7 @@ var init_config3 = __esm({
|
|
|
248130
248229
|
this._generationConfig.model = credentials.model;
|
|
248131
248230
|
}
|
|
248132
248231
|
}
|
|
248133
|
-
async refreshAuth(authMethod) {
|
|
248232
|
+
async refreshAuth(authMethod, isInitialAuth) {
|
|
248134
248233
|
if (this.contentGeneratorConfig?.authType === "gemini-api-key" /* USE_GEMINI */ && authMethod === "oauth-personal" /* LOGIN_WITH_GOOGLE */) {
|
|
248135
248234
|
this.geminiClient.stripThoughtsFromHistory();
|
|
248136
248235
|
}
|
|
@@ -248142,7 +248241,8 @@ var init_config3 = __esm({
|
|
|
248142
248241
|
this.contentGenerator = await createContentGenerator(
|
|
248143
248242
|
newContentGeneratorConfig,
|
|
248144
248243
|
this,
|
|
248145
|
-
this.getSessionId()
|
|
248244
|
+
this.getSessionId(),
|
|
248245
|
+
isInitialAuth
|
|
248146
248246
|
);
|
|
248147
248247
|
this.contentGeneratorConfig = newContentGeneratorConfig;
|
|
248148
248248
|
this.baseLlmClient = new BaseLlmClient(this.contentGenerator, this);
|
|
@@ -320560,7 +320660,7 @@ function CompressionMessage({
|
|
|
320560
320660
|
case 3 /* COMPRESSION_FAILED_TOKEN_COUNT_ERROR */:
|
|
320561
320661
|
return "Could not compress chat history due to a token counting error.";
|
|
320562
320662
|
case 5 /* NOOP */:
|
|
320563
|
-
return "
|
|
320663
|
+
return "Nothing to compress.";
|
|
320564
320664
|
default:
|
|
320565
320665
|
return "";
|
|
320566
320666
|
}
|
|
@@ -330885,6 +330985,7 @@ function saveSettings(settingsFile) {
|
|
|
330885
330985
|
);
|
|
330886
330986
|
} catch (error) {
|
|
330887
330987
|
console.error("Error saving user settings file:", error);
|
|
330988
|
+
throw error;
|
|
330888
330989
|
}
|
|
330889
330990
|
}
|
|
330890
330991
|
__name(saveSettings, "saveSettings");
|
|
@@ -332071,53 +332172,13 @@ function SettingsDialog({
|
|
|
332071
332172
|
}
|
|
332072
332173
|
__name(SettingsDialog, "SettingsDialog");
|
|
332073
332174
|
|
|
332074
|
-
// packages/cli/src/ui/auth/AuthInProgress.tsx
|
|
332075
|
-
init_esbuild_shims();
|
|
332076
|
-
var import_react73 = __toESM(require_react(), 1);
|
|
332077
|
-
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
|
|
332078
|
-
function AuthInProgress({
|
|
332079
|
-
onTimeout
|
|
332080
|
-
}) {
|
|
332081
|
-
const [timedOut, setTimedOut] = (0, import_react73.useState)(false);
|
|
332082
|
-
useKeypress(
|
|
332083
|
-
(key) => {
|
|
332084
|
-
if (key.name === "escape" || key.ctrl && key.name === "c") {
|
|
332085
|
-
onTimeout();
|
|
332086
|
-
}
|
|
332087
|
-
},
|
|
332088
|
-
{ isActive: true }
|
|
332089
|
-
);
|
|
332090
|
-
(0, import_react73.useEffect)(() => {
|
|
332091
|
-
const timer = setTimeout(() => {
|
|
332092
|
-
setTimedOut(true);
|
|
332093
|
-
onTimeout();
|
|
332094
|
-
}, 18e4);
|
|
332095
|
-
return () => clearTimeout(timer);
|
|
332096
|
-
}, [onTimeout]);
|
|
332097
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
332098
|
-
Box_default,
|
|
332099
|
-
{
|
|
332100
|
-
borderStyle: "round",
|
|
332101
|
-
borderColor: theme.border.default,
|
|
332102
|
-
flexDirection: "column",
|
|
332103
|
-
padding: 1,
|
|
332104
|
-
width: "100%",
|
|
332105
|
-
children: timedOut ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { color: theme.status.error, children: "Authentication timed out. Please try again." }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { children: [
|
|
332106
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(build_default, { type: "dots" }),
|
|
332107
|
-
" Waiting for auth... (Press ESC or CTRL+C to cancel)"
|
|
332108
|
-
] }) })
|
|
332109
|
-
}
|
|
332110
|
-
);
|
|
332111
|
-
}
|
|
332112
|
-
__name(AuthInProgress, "AuthInProgress");
|
|
332113
|
-
|
|
332114
332175
|
// packages/cli/src/ui/components/QwenOAuthProgress.tsx
|
|
332115
332176
|
init_esbuild_shims();
|
|
332116
|
-
var
|
|
332177
|
+
var import_react74 = __toESM(require_react(), 1);
|
|
332117
332178
|
|
|
332118
332179
|
// node_modules/ink-link/dist/index.js
|
|
332119
332180
|
init_esbuild_shims();
|
|
332120
|
-
var
|
|
332181
|
+
var import_react73 = __toESM(require_react(), 1);
|
|
332121
332182
|
var import_prop_types2 = __toESM(require_prop_types(), 1);
|
|
332122
332183
|
|
|
332123
332184
|
// node_modules/terminal-link/index.js
|
|
@@ -332265,10 +332326,10 @@ terminalLink.stderr.isSupported = import_supports_hyperlinks.default.stderr;
|
|
|
332265
332326
|
// node_modules/ink-link/dist/index.js
|
|
332266
332327
|
var Link = /* @__PURE__ */ __name(({ children, url: url2, fallback = true }) => (
|
|
332267
332328
|
// eslint-disable-line react/function-component-definition
|
|
332268
|
-
|
|
332329
|
+
import_react73.default.createElement(
|
|
332269
332330
|
Transform,
|
|
332270
332331
|
{ transform: /* @__PURE__ */ __name((children2) => terminalLink(children2, url2, { fallback }), "transform") },
|
|
332271
|
-
|
|
332332
|
+
import_react73.default.createElement(Text, null, children)
|
|
332272
332333
|
)
|
|
332273
332334
|
), "Link");
|
|
332274
332335
|
Link.propTypes = {
|
|
@@ -332284,7 +332345,7 @@ var dist_default5 = Link;
|
|
|
332284
332345
|
|
|
332285
332346
|
// packages/cli/src/ui/components/QwenOAuthProgress.tsx
|
|
332286
332347
|
var import_qrcode_terminal = __toESM(require_main2(), 1);
|
|
332287
|
-
var
|
|
332348
|
+
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
|
|
332288
332349
|
function QrCodeDisplay({
|
|
332289
332350
|
verificationUrl,
|
|
332290
332351
|
qrCodeData
|
|
@@ -332292,7 +332353,7 @@ function QrCodeDisplay({
|
|
|
332292
332353
|
if (!qrCodeData) {
|
|
332293
332354
|
return null;
|
|
332294
332355
|
}
|
|
332295
|
-
return /* @__PURE__ */ (0,
|
|
332356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
332296
332357
|
Box_default,
|
|
332297
332358
|
{
|
|
332298
332359
|
borderStyle: "round",
|
|
@@ -332301,11 +332362,11 @@ function QrCodeDisplay({
|
|
|
332301
332362
|
padding: 1,
|
|
332302
332363
|
width: "100%",
|
|
332303
332364
|
children: [
|
|
332304
|
-
/* @__PURE__ */ (0,
|
|
332305
|
-
/* @__PURE__ */ (0,
|
|
332306
|
-
/* @__PURE__ */ (0,
|
|
332307
|
-
/* @__PURE__ */ (0,
|
|
332308
|
-
/* @__PURE__ */ (0,
|
|
332365
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { bold: true, color: Colors.AccentBlue, children: "Qwen OAuth Authentication" }),
|
|
332366
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: "Please visit this URL to authorize:" }) }),
|
|
332367
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(dist_default5, { url: verificationUrl, fallback: false, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { color: Colors.AccentGreen, bold: true, children: verificationUrl }) }),
|
|
332368
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: "Or scan the QR code below:" }) }),
|
|
332369
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: qrCodeData }) })
|
|
332309
332370
|
]
|
|
332310
332371
|
}
|
|
332311
332372
|
);
|
|
@@ -332320,7 +332381,7 @@ function StatusDisplay({
|
|
|
332320
332381
|
const remainingSeconds = seconds % 60;
|
|
332321
332382
|
return `${minutes}:${remainingSeconds.toString().padStart(2, "0")}`;
|
|
332322
332383
|
}, "formatTime");
|
|
332323
|
-
return /* @__PURE__ */ (0,
|
|
332384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
332324
332385
|
Box_default,
|
|
332325
332386
|
{
|
|
332326
332387
|
borderStyle: "round",
|
|
@@ -332329,17 +332390,17 @@ function StatusDisplay({
|
|
|
332329
332390
|
padding: 1,
|
|
332330
332391
|
width: "100%",
|
|
332331
332392
|
children: [
|
|
332332
|
-
/* @__PURE__ */ (0,
|
|
332333
|
-
/* @__PURE__ */ (0,
|
|
332393
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { children: [
|
|
332394
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(build_default, { type: "dots" }),
|
|
332334
332395
|
" Waiting for authorization",
|
|
332335
332396
|
dots
|
|
332336
332397
|
] }) }),
|
|
332337
|
-
/* @__PURE__ */ (0,
|
|
332338
|
-
/* @__PURE__ */ (0,
|
|
332398
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Box_default, { marginTop: 1, justifyContent: "space-between", children: [
|
|
332399
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { color: Colors.Gray, children: [
|
|
332339
332400
|
"Time remaining: ",
|
|
332340
332401
|
formatTime(timeRemaining)
|
|
332341
332402
|
] }),
|
|
332342
|
-
/* @__PURE__ */ (0,
|
|
332403
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { color: Colors.AccentPurple, children: "(Press ESC or CTRL+C to cancel)" })
|
|
332343
332404
|
] })
|
|
332344
332405
|
]
|
|
332345
332406
|
}
|
|
@@ -332354,12 +332415,12 @@ function QwenOAuthProgress({
|
|
|
332354
332415
|
authMessage
|
|
332355
332416
|
}) {
|
|
332356
332417
|
const defaultTimeout = deviceAuth?.expires_in || 300;
|
|
332357
|
-
const [timeRemaining, setTimeRemaining] = (0,
|
|
332358
|
-
const [dots, setDots] = (0,
|
|
332359
|
-
const [qrCodeData, setQrCodeData] = (0,
|
|
332418
|
+
const [timeRemaining, setTimeRemaining] = (0, import_react74.useState)(defaultTimeout);
|
|
332419
|
+
const [dots, setDots] = (0, import_react74.useState)("");
|
|
332420
|
+
const [qrCodeData, setQrCodeData] = (0, import_react74.useState)(null);
|
|
332360
332421
|
useKeypress(
|
|
332361
332422
|
(key) => {
|
|
332362
|
-
if (authStatus === "timeout") {
|
|
332423
|
+
if (authStatus === "timeout" || authStatus === "error") {
|
|
332363
332424
|
onCancel();
|
|
332364
332425
|
} else if (key.name === "escape" || key.ctrl && key.name === "c") {
|
|
332365
332426
|
onCancel();
|
|
@@ -332367,7 +332428,7 @@ function QwenOAuthProgress({
|
|
|
332367
332428
|
},
|
|
332368
332429
|
{ isActive: true }
|
|
332369
332430
|
);
|
|
332370
|
-
(0,
|
|
332431
|
+
(0, import_react74.useEffect)(() => {
|
|
332371
332432
|
if (!deviceAuth?.verification_uri_complete) {
|
|
332372
332433
|
return;
|
|
332373
332434
|
}
|
|
@@ -332387,7 +332448,7 @@ function QwenOAuthProgress({
|
|
|
332387
332448
|
}, "generateQR");
|
|
332388
332449
|
generateQR();
|
|
332389
332450
|
}, [deviceAuth?.verification_uri_complete]);
|
|
332390
|
-
(0,
|
|
332451
|
+
(0, import_react74.useEffect)(() => {
|
|
332391
332452
|
const timer = setInterval(() => {
|
|
332392
332453
|
setTimeRemaining((prev) => {
|
|
332393
332454
|
if (prev <= 1) {
|
|
@@ -332399,7 +332460,7 @@ function QwenOAuthProgress({
|
|
|
332399
332460
|
}, 1e3);
|
|
332400
332461
|
return () => clearInterval(timer);
|
|
332401
332462
|
}, [onTimeout]);
|
|
332402
|
-
(0,
|
|
332463
|
+
(0, import_react74.useEffect)(() => {
|
|
332403
332464
|
const dotsTimer = setInterval(() => {
|
|
332404
332465
|
setDots((prev) => {
|
|
332405
332466
|
if (prev.length >= 3) return "";
|
|
@@ -332408,9 +332469,9 @@ function QwenOAuthProgress({
|
|
|
332408
332469
|
}, 500);
|
|
332409
332470
|
return () => clearInterval(dotsTimer);
|
|
332410
332471
|
}, []);
|
|
332411
|
-
const qrCodeDisplay = (0,
|
|
332472
|
+
const qrCodeDisplay = (0, import_react74.useMemo)(() => {
|
|
332412
332473
|
if (!deviceAuth?.verification_uri_complete) return null;
|
|
332413
|
-
return /* @__PURE__ */ (0,
|
|
332474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
332414
332475
|
QrCodeDisplay,
|
|
332415
332476
|
{
|
|
332416
332477
|
verificationUrl: deviceAuth.verification_uri_complete,
|
|
@@ -332419,7 +332480,7 @@ function QwenOAuthProgress({
|
|
|
332419
332480
|
);
|
|
332420
332481
|
}, [deviceAuth?.verification_uri_complete, qrCodeData]);
|
|
332421
332482
|
if (authStatus === "timeout") {
|
|
332422
|
-
return /* @__PURE__ */ (0,
|
|
332483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
332423
332484
|
Box_default,
|
|
332424
332485
|
{
|
|
332425
332486
|
borderStyle: "round",
|
|
@@ -332428,15 +332489,32 @@ function QwenOAuthProgress({
|
|
|
332428
332489
|
padding: 1,
|
|
332429
332490
|
width: "100%",
|
|
332430
332491
|
children: [
|
|
332431
|
-
/* @__PURE__ */ (0,
|
|
332432
|
-
/* @__PURE__ */ (0,
|
|
332433
|
-
/* @__PURE__ */ (0,
|
|
332492
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { bold: true, color: Colors.AccentRed, children: "Qwen OAuth Authentication Timeout" }),
|
|
332493
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: authMessage || `OAuth token expired (over ${defaultTimeout} seconds). Please select authentication method again.` }) }),
|
|
332494
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { color: Colors.Gray, children: "Press any key to return to authentication type selection." }) })
|
|
332495
|
+
]
|
|
332496
|
+
}
|
|
332497
|
+
);
|
|
332498
|
+
}
|
|
332499
|
+
if (authStatus === "error") {
|
|
332500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
332501
|
+
Box_default,
|
|
332502
|
+
{
|
|
332503
|
+
borderStyle: "round",
|
|
332504
|
+
borderColor: Colors.AccentRed,
|
|
332505
|
+
flexDirection: "column",
|
|
332506
|
+
padding: 1,
|
|
332507
|
+
width: "100%",
|
|
332508
|
+
children: [
|
|
332509
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { bold: true, color: Colors.AccentRed, children: "Qwen OAuth Authentication Error" }),
|
|
332510
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: authMessage || "An error occurred during authentication. Please try again." }) }),
|
|
332511
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { color: Colors.Gray, children: "Press any key to return to authentication type selection." }) })
|
|
332434
332512
|
]
|
|
332435
332513
|
}
|
|
332436
332514
|
);
|
|
332437
332515
|
}
|
|
332438
332516
|
if (!deviceAuth) {
|
|
332439
|
-
return /* @__PURE__ */ (0,
|
|
332517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
332440
332518
|
Box_default,
|
|
332441
332519
|
{
|
|
332442
332520
|
borderStyle: "round",
|
|
@@ -332445,26 +332523,26 @@ function QwenOAuthProgress({
|
|
|
332445
332523
|
padding: 1,
|
|
332446
332524
|
width: "100%",
|
|
332447
332525
|
children: [
|
|
332448
|
-
/* @__PURE__ */ (0,
|
|
332449
|
-
/* @__PURE__ */ (0,
|
|
332526
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { children: [
|
|
332527
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(build_default, { type: "dots" }),
|
|
332450
332528
|
" Waiting for Qwen OAuth authentication..."
|
|
332451
332529
|
] }) }),
|
|
332452
|
-
/* @__PURE__ */ (0,
|
|
332453
|
-
/* @__PURE__ */ (0,
|
|
332530
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Box_default, { marginTop: 1, justifyContent: "space-between", children: [
|
|
332531
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Text, { color: Colors.Gray, children: [
|
|
332454
332532
|
"Time remaining: ",
|
|
332455
332533
|
Math.floor(timeRemaining / 60),
|
|
332456
332534
|
":",
|
|
332457
332535
|
(timeRemaining % 60).toString().padStart(2, "0")
|
|
332458
332536
|
] }),
|
|
332459
|
-
/* @__PURE__ */ (0,
|
|
332537
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { color: Colors.AccentPurple, children: "(Press ESC or CTRL+C to cancel)" })
|
|
332460
332538
|
] })
|
|
332461
332539
|
]
|
|
332462
332540
|
}
|
|
332463
332541
|
);
|
|
332464
332542
|
}
|
|
332465
|
-
return /* @__PURE__ */ (0,
|
|
332543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Box_default, { flexDirection: "column", width: "100%", children: [
|
|
332466
332544
|
qrCodeDisplay,
|
|
332467
|
-
/* @__PURE__ */ (0,
|
|
332545
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(StatusDisplay, { timeRemaining, dots })
|
|
332468
332546
|
] });
|
|
332469
332547
|
}
|
|
332470
332548
|
__name(QwenOAuthProgress, "QwenOAuthProgress");
|
|
@@ -332474,30 +332552,85 @@ init_esbuild_shims();
|
|
|
332474
332552
|
var import_react77 = __toESM(require_react(), 1);
|
|
332475
332553
|
init_core2();
|
|
332476
332554
|
|
|
332477
|
-
// packages/cli/src/
|
|
332555
|
+
// packages/cli/src/ui/contexts/UIActionsContext.tsx
|
|
332478
332556
|
init_esbuild_shims();
|
|
332557
|
+
var import_react76 = __toESM(require_react(), 1);
|
|
332479
332558
|
init_core2();
|
|
332480
|
-
|
|
332481
|
-
|
|
332482
|
-
|
|
332483
|
-
|
|
332484
|
-
|
|
332485
|
-
|
|
332486
|
-
|
|
332559
|
+
|
|
332560
|
+
// packages/cli/src/ui/components/ModelSwitchDialog.tsx
|
|
332561
|
+
init_esbuild_shims();
|
|
332562
|
+
var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
|
|
332563
|
+
var ModelSwitchDialog = /* @__PURE__ */ __name(({
|
|
332564
|
+
onSelect
|
|
332565
|
+
}) => {
|
|
332566
|
+
useKeypress(
|
|
332567
|
+
(key) => {
|
|
332568
|
+
if (key.name === "escape") {
|
|
332569
|
+
onSelect("persist" /* ContinueWithCurrentModel */);
|
|
332570
|
+
}
|
|
332571
|
+
},
|
|
332572
|
+
{ isActive: true }
|
|
332573
|
+
);
|
|
332574
|
+
const options2 = [
|
|
332575
|
+
{
|
|
332576
|
+
key: "switch-once",
|
|
332577
|
+
label: "Switch for this request only",
|
|
332578
|
+
value: "once" /* SwitchOnce */
|
|
332579
|
+
},
|
|
332580
|
+
{
|
|
332581
|
+
key: "switch-session",
|
|
332582
|
+
label: "Switch session to vision model",
|
|
332583
|
+
value: "session" /* SwitchSessionToVL */
|
|
332584
|
+
},
|
|
332585
|
+
{
|
|
332586
|
+
key: "continue",
|
|
332587
|
+
label: "Continue with current model",
|
|
332588
|
+
value: "persist" /* ContinueWithCurrentModel */
|
|
332487
332589
|
}
|
|
332488
|
-
|
|
332489
|
-
|
|
332490
|
-
|
|
332491
|
-
|
|
332492
|
-
|
|
332493
|
-
|
|
332494
|
-
|
|
332495
|
-
|
|
332590
|
+
];
|
|
332591
|
+
const handleSelect = /* @__PURE__ */ __name((outcome) => {
|
|
332592
|
+
onSelect(outcome);
|
|
332593
|
+
}, "handleSelect");
|
|
332594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
332595
|
+
Box_default,
|
|
332596
|
+
{
|
|
332597
|
+
flexDirection: "column",
|
|
332598
|
+
borderStyle: "round",
|
|
332599
|
+
borderColor: Colors.AccentYellow,
|
|
332600
|
+
padding: 1,
|
|
332601
|
+
width: "100%",
|
|
332602
|
+
marginLeft: 1,
|
|
332603
|
+
children: [
|
|
332604
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
|
|
332605
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { bold: true, children: "Vision Model Switch Required" }),
|
|
332606
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { children: "Your message contains an image, but the current model doesn't support vision." }),
|
|
332607
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { children: "How would you like to proceed?" })
|
|
332608
|
+
] }),
|
|
332609
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
332610
|
+
RadioButtonSelect,
|
|
332611
|
+
{
|
|
332612
|
+
items: options2,
|
|
332613
|
+
initialIndex: 0,
|
|
332614
|
+
onSelect: handleSelect,
|
|
332615
|
+
isFocused: true
|
|
332616
|
+
}
|
|
332617
|
+
) }),
|
|
332618
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Text, { color: Colors.Gray, children: "Press Enter to select, Esc to cancel" }) })
|
|
332619
|
+
]
|
|
332620
|
+
}
|
|
332621
|
+
);
|
|
332622
|
+
}, "ModelSwitchDialog");
|
|
332496
332623
|
|
|
332497
332624
|
// packages/cli/src/ui/components/OpenAIKeyPrompt.tsx
|
|
332498
332625
|
init_esbuild_shims();
|
|
332499
|
-
var
|
|
332626
|
+
var import_react75 = __toESM(require_react(), 1);
|
|
332627
|
+
init_zod();
|
|
332500
332628
|
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
332629
|
+
var credentialSchema = external_exports.object({
|
|
332630
|
+
apiKey: external_exports.string().min(1, "API key is required"),
|
|
332631
|
+
baseUrl: external_exports.union([external_exports.string().url("Base URL must be a valid URL"), external_exports.literal("")]).optional(),
|
|
332632
|
+
model: external_exports.string().min(1, "Model must be a non-empty string").optional()
|
|
332633
|
+
});
|
|
332501
332634
|
function OpenAIKeyPrompt({
|
|
332502
332635
|
onSubmit,
|
|
332503
332636
|
onCancel,
|
|
@@ -332505,10 +332638,33 @@ function OpenAIKeyPrompt({
|
|
|
332505
332638
|
defaultBaseUrl,
|
|
332506
332639
|
defaultModel
|
|
332507
332640
|
}) {
|
|
332508
|
-
const [apiKey, setApiKey] = (0,
|
|
332509
|
-
const [baseUrl, setBaseUrl] = (0,
|
|
332510
|
-
const [model, setModel] = (0,
|
|
332511
|
-
const [currentField, setCurrentField] = (0,
|
|
332641
|
+
const [apiKey, setApiKey] = (0, import_react75.useState)(defaultApiKey || "");
|
|
332642
|
+
const [baseUrl, setBaseUrl] = (0, import_react75.useState)(defaultBaseUrl || "");
|
|
332643
|
+
const [model, setModel] = (0, import_react75.useState)(defaultModel || "");
|
|
332644
|
+
const [currentField, setCurrentField] = (0, import_react75.useState)("apiKey");
|
|
332645
|
+
const [validationError, setValidationError] = (0, import_react75.useState)(null);
|
|
332646
|
+
const validateAndSubmit = /* @__PURE__ */ __name(() => {
|
|
332647
|
+
setValidationError(null);
|
|
332648
|
+
try {
|
|
332649
|
+
const validated = credentialSchema.parse({
|
|
332650
|
+
apiKey: apiKey.trim(),
|
|
332651
|
+
baseUrl: baseUrl.trim() || void 0,
|
|
332652
|
+
model: model.trim() || void 0
|
|
332653
|
+
});
|
|
332654
|
+
onSubmit(
|
|
332655
|
+
validated.apiKey,
|
|
332656
|
+
validated.baseUrl === "" ? "" : validated.baseUrl || "",
|
|
332657
|
+
validated.model || ""
|
|
332658
|
+
);
|
|
332659
|
+
} catch (error) {
|
|
332660
|
+
if (error instanceof external_exports.ZodError) {
|
|
332661
|
+
const errorMessage = error.errors.map((e2) => `${e2.path.join(".")}: ${e2.message}`).join(", ");
|
|
332662
|
+
setValidationError(`Invalid credentials: ${errorMessage}`);
|
|
332663
|
+
} else {
|
|
332664
|
+
setValidationError("Failed to validate credentials");
|
|
332665
|
+
}
|
|
332666
|
+
}
|
|
332667
|
+
}, "validateAndSubmit");
|
|
332512
332668
|
useKeypress(
|
|
332513
332669
|
(key) => {
|
|
332514
332670
|
if (key.name === "escape") {
|
|
@@ -332524,7 +332680,7 @@ function OpenAIKeyPrompt({
|
|
|
332524
332680
|
return;
|
|
332525
332681
|
} else if (currentField === "model") {
|
|
332526
332682
|
if (apiKey.trim()) {
|
|
332527
|
-
|
|
332683
|
+
validateAndSubmit();
|
|
332528
332684
|
} else {
|
|
332529
332685
|
setCurrentField("apiKey");
|
|
332530
332686
|
}
|
|
@@ -332606,6 +332762,7 @@ function OpenAIKeyPrompt({
|
|
|
332606
332762
|
width: "100%",
|
|
332607
332763
|
children: [
|
|
332608
332764
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Text, { bold: true, color: Colors.AccentBlue, children: "OpenAI Configuration Required" }),
|
|
332765
|
+
validationError && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Text, { color: Colors.AccentRed, children: validationError }) }),
|
|
332609
332766
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(Text, { children: [
|
|
332610
332767
|
"Please enter your OpenAI configuration. You can get an API key from",
|
|
332611
332768
|
" ",
|
|
@@ -332657,6 +332814,16 @@ function OpenAIKeyPrompt({
|
|
|
332657
332814
|
}
|
|
332658
332815
|
__name(OpenAIKeyPrompt, "OpenAIKeyPrompt");
|
|
332659
332816
|
|
|
332817
|
+
// packages/cli/src/ui/contexts/UIActionsContext.tsx
|
|
332818
|
+
var UIActionsContext = (0, import_react76.createContext)(null);
|
|
332819
|
+
var useUIActions = /* @__PURE__ */ __name(() => {
|
|
332820
|
+
const context2 = (0, import_react76.useContext)(UIActionsContext);
|
|
332821
|
+
if (!context2) {
|
|
332822
|
+
throw new Error("useUIActions must be used within a UIActionsProvider");
|
|
332823
|
+
}
|
|
332824
|
+
return context2;
|
|
332825
|
+
}, "useUIActions");
|
|
332826
|
+
|
|
332660
332827
|
// packages/cli/src/ui/auth/AuthDialog.tsx
|
|
332661
332828
|
var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
|
|
332662
332829
|
function parseDefaultAuthType(defaultAuthType) {
|
|
@@ -332666,15 +332833,12 @@ function parseDefaultAuthType(defaultAuthType) {
|
|
|
332666
332833
|
return null;
|
|
332667
332834
|
}
|
|
332668
332835
|
__name(parseDefaultAuthType, "parseDefaultAuthType");
|
|
332669
|
-
function AuthDialog({
|
|
332670
|
-
|
|
332671
|
-
|
|
332672
|
-
|
|
332673
|
-
|
|
332674
|
-
const [
|
|
332675
|
-
initialErrorMessage || null
|
|
332676
|
-
);
|
|
332677
|
-
const [showOpenAIKeyPrompt, setShowOpenAIKeyPrompt] = (0, import_react77.useState)(false);
|
|
332836
|
+
function AuthDialog() {
|
|
332837
|
+
const { pendingAuthType, authError } = useUIState();
|
|
332838
|
+
const { handleAuthSelect: onAuthSelect } = useUIActions();
|
|
332839
|
+
const settings = useSettings();
|
|
332840
|
+
const [errorMessage, setErrorMessage] = (0, import_react77.useState)(null);
|
|
332841
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react77.useState)(null);
|
|
332678
332842
|
const items = [
|
|
332679
332843
|
{
|
|
332680
332844
|
key: "qwen-oauth" /* QWEN_OAUTH */,
|
|
@@ -332686,6 +332850,9 @@ function AuthDialog({
|
|
|
332686
332850
|
const initialAuthIndex = Math.max(
|
|
332687
332851
|
0,
|
|
332688
332852
|
items.findIndex((item) => {
|
|
332853
|
+
if (pendingAuthType) {
|
|
332854
|
+
return item.value === pendingAuthType;
|
|
332855
|
+
}
|
|
332689
332856
|
if (settings.merged.security?.auth?.selectedType) {
|
|
332690
332857
|
return item.value === settings.merged.security?.auth?.selectedType;
|
|
332691
332858
|
}
|
|
@@ -332698,37 +332865,18 @@ function AuthDialog({
|
|
|
332698
332865
|
return item.value === "qwen-oauth" /* QWEN_OAUTH */;
|
|
332699
332866
|
})
|
|
332700
332867
|
);
|
|
332701
|
-
const
|
|
332702
|
-
|
|
332703
|
-
|
|
332704
|
-
|
|
332705
|
-
|
|
332706
|
-
const error = validateAuthMethod(authMethod);
|
|
332707
|
-
if (error) {
|
|
332708
|
-
setErrorMessage(error);
|
|
332709
|
-
} else {
|
|
332710
|
-
setErrorMessage(null);
|
|
332711
|
-
onSelect(authMethod, "User" /* User */);
|
|
332712
|
-
}
|
|
332713
|
-
}
|
|
332868
|
+
const hasApiKey = Boolean(settings.merged.security?.auth?.apiKey);
|
|
332869
|
+
const currentSelectedAuthType = selectedIndex !== null ? items[selectedIndex]?.value : items[initialAuthIndex]?.value;
|
|
332870
|
+
const handleAuthSelect = /* @__PURE__ */ __name(async (authMethod) => {
|
|
332871
|
+
setErrorMessage(null);
|
|
332872
|
+
await onAuthSelect(authMethod, "User" /* User */);
|
|
332714
332873
|
}, "handleAuthSelect");
|
|
332715
|
-
const
|
|
332716
|
-
|
|
332717
|
-
|
|
332718
|
-
|
|
332719
|
-
baseUrl,
|
|
332720
|
-
model
|
|
332721
|
-
});
|
|
332722
|
-
}, "handleOpenAIKeySubmit");
|
|
332723
|
-
const handleOpenAIKeyCancel = /* @__PURE__ */ __name(() => {
|
|
332724
|
-
setShowOpenAIKeyPrompt(false);
|
|
332725
|
-
setErrorMessage("OpenAI API key is required to use OpenAI authentication.");
|
|
332726
|
-
}, "handleOpenAIKeyCancel");
|
|
332874
|
+
const handleHighlight = /* @__PURE__ */ __name((authMethod) => {
|
|
332875
|
+
const index = items.findIndex((item) => item.value === authMethod);
|
|
332876
|
+
setSelectedIndex(index);
|
|
332877
|
+
}, "handleHighlight");
|
|
332727
332878
|
useKeypress(
|
|
332728
332879
|
(key) => {
|
|
332729
|
-
if (showOpenAIKeyPrompt) {
|
|
332730
|
-
return;
|
|
332731
|
-
}
|
|
332732
332880
|
if (key.name === "escape") {
|
|
332733
332881
|
if (errorMessage) {
|
|
332734
332882
|
return;
|
|
@@ -332739,33 +332887,11 @@ function AuthDialog({
|
|
|
332739
332887
|
);
|
|
332740
332888
|
return;
|
|
332741
332889
|
}
|
|
332742
|
-
|
|
332890
|
+
onAuthSelect(void 0, "User" /* User */);
|
|
332743
332891
|
}
|
|
332744
332892
|
},
|
|
332745
332893
|
{ isActive: true }
|
|
332746
332894
|
);
|
|
332747
|
-
const getDefaultOpenAIConfig = /* @__PURE__ */ __name(() => {
|
|
332748
|
-
const fromSettings = settings.merged.security?.auth;
|
|
332749
|
-
const modelSettings = settings.merged.model;
|
|
332750
|
-
return {
|
|
332751
|
-
apiKey: fromSettings?.apiKey || process.env["OPENAI_API_KEY"] || "",
|
|
332752
|
-
baseUrl: fromSettings?.baseUrl || process.env["OPENAI_BASE_URL"] || "",
|
|
332753
|
-
model: modelSettings?.name || process.env["OPENAI_MODEL"] || ""
|
|
332754
|
-
};
|
|
332755
|
-
}, "getDefaultOpenAIConfig");
|
|
332756
|
-
if (showOpenAIKeyPrompt) {
|
|
332757
|
-
const defaults3 = getDefaultOpenAIConfig();
|
|
332758
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
332759
|
-
OpenAIKeyPrompt,
|
|
332760
|
-
{
|
|
332761
|
-
defaultApiKey: defaults3.apiKey,
|
|
332762
|
-
defaultBaseUrl: defaults3.baseUrl,
|
|
332763
|
-
defaultModel: defaults3.model,
|
|
332764
|
-
onSubmit: handleOpenAIKeySubmit,
|
|
332765
|
-
onCancel: handleOpenAIKeyCancel
|
|
332766
|
-
}
|
|
332767
|
-
);
|
|
332768
|
-
}
|
|
332769
332895
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
332770
332896
|
Box_default,
|
|
332771
332897
|
{
|
|
@@ -332782,11 +332908,13 @@ function AuthDialog({
|
|
|
332782
332908
|
{
|
|
332783
332909
|
items,
|
|
332784
332910
|
initialIndex: initialAuthIndex,
|
|
332785
|
-
onSelect: handleAuthSelect
|
|
332911
|
+
onSelect: handleAuthSelect,
|
|
332912
|
+
onHighlight: handleHighlight
|
|
332786
332913
|
}
|
|
332787
332914
|
) }),
|
|
332788
|
-
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Text, { color: Colors.AccentRed, children: errorMessage }) }),
|
|
332915
|
+
(authError || errorMessage) && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Text, { color: Colors.AccentRed, children: authError || errorMessage }) }),
|
|
332789
332916
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Text, { color: Colors.AccentPurple, children: "(Use Enter to Set Auth)" }) }),
|
|
332917
|
+
hasApiKey && currentSelectedAuthType === "qwen-oauth" /* QWEN_OAUTH */ && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Text, { color: Colors.Gray, children: "Note: Your existing API key in settings.json will not be cleared when using Qwen OAuth. You can switch back to OpenAI authentication later if needed." }) }),
|
|
332790
332918
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Text, { children: "Terms of Services and Privacy Notice for RDMind" }) }),
|
|
332791
332919
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Text, { color: Colors.AccentBlue, children: "https://docs.xiaohongshu.com/doc/03040f132e7201a6b8e95806118a11f3" }) })
|
|
332792
332920
|
]
|
|
@@ -333572,91 +333700,13 @@ function ApprovalModeDialog({
|
|
|
333572
333700
|
}
|
|
333573
333701
|
__name(ApprovalModeDialog, "ApprovalModeDialog");
|
|
333574
333702
|
|
|
333575
|
-
// packages/cli/src/ui/contexts/UIActionsContext.tsx
|
|
333576
|
-
init_esbuild_shims();
|
|
333577
|
-
var import_react83 = __toESM(require_react(), 1);
|
|
333578
|
-
init_core2();
|
|
333579
|
-
|
|
333580
|
-
// packages/cli/src/ui/components/ModelSwitchDialog.tsx
|
|
333581
|
-
init_esbuild_shims();
|
|
333582
|
-
var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
|
|
333583
|
-
var ModelSwitchDialog = /* @__PURE__ */ __name(({
|
|
333584
|
-
onSelect
|
|
333585
|
-
}) => {
|
|
333586
|
-
useKeypress(
|
|
333587
|
-
(key) => {
|
|
333588
|
-
if (key.name === "escape") {
|
|
333589
|
-
onSelect("persist" /* ContinueWithCurrentModel */);
|
|
333590
|
-
}
|
|
333591
|
-
},
|
|
333592
|
-
{ isActive: true }
|
|
333593
|
-
);
|
|
333594
|
-
const options2 = [
|
|
333595
|
-
{
|
|
333596
|
-
key: "switch-once",
|
|
333597
|
-
label: "Switch for this request only",
|
|
333598
|
-
value: "once" /* SwitchOnce */
|
|
333599
|
-
},
|
|
333600
|
-
{
|
|
333601
|
-
key: "switch-session",
|
|
333602
|
-
label: "Switch session to vision model",
|
|
333603
|
-
value: "session" /* SwitchSessionToVL */
|
|
333604
|
-
},
|
|
333605
|
-
{
|
|
333606
|
-
key: "continue",
|
|
333607
|
-
label: "Continue with current model",
|
|
333608
|
-
value: "persist" /* ContinueWithCurrentModel */
|
|
333609
|
-
}
|
|
333610
|
-
];
|
|
333611
|
-
const handleSelect = /* @__PURE__ */ __name((outcome) => {
|
|
333612
|
-
onSelect(outcome);
|
|
333613
|
-
}, "handleSelect");
|
|
333614
|
-
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
333615
|
-
Box_default,
|
|
333616
|
-
{
|
|
333617
|
-
flexDirection: "column",
|
|
333618
|
-
borderStyle: "round",
|
|
333619
|
-
borderColor: Colors.AccentYellow,
|
|
333620
|
-
padding: 1,
|
|
333621
|
-
width: "100%",
|
|
333622
|
-
marginLeft: 1,
|
|
333623
|
-
children: [
|
|
333624
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
|
|
333625
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { bold: true, children: "Vision Model Switch Required" }),
|
|
333626
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { children: "Your message contains an image, but the current model doesn't support vision." }),
|
|
333627
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { children: "How would you like to proceed?" })
|
|
333628
|
-
] }),
|
|
333629
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
333630
|
-
RadioButtonSelect,
|
|
333631
|
-
{
|
|
333632
|
-
items: options2,
|
|
333633
|
-
initialIndex: 0,
|
|
333634
|
-
onSelect: handleSelect,
|
|
333635
|
-
isFocused: true
|
|
333636
|
-
}
|
|
333637
|
-
) }),
|
|
333638
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Text, { color: Colors.Gray, children: "Press Enter to select, Esc to cancel" }) })
|
|
333639
|
-
]
|
|
333640
|
-
}
|
|
333641
|
-
);
|
|
333642
|
-
}, "ModelSwitchDialog");
|
|
333643
|
-
|
|
333644
|
-
// packages/cli/src/ui/contexts/UIActionsContext.tsx
|
|
333645
|
-
var UIActionsContext = (0, import_react83.createContext)(null);
|
|
333646
|
-
var useUIActions = /* @__PURE__ */ __name(() => {
|
|
333647
|
-
const context2 = (0, import_react83.useContext)(UIActionsContext);
|
|
333648
|
-
if (!context2) {
|
|
333649
|
-
throw new Error("useUIActions must be used within a UIActionsProvider");
|
|
333650
|
-
}
|
|
333651
|
-
return context2;
|
|
333652
|
-
}, "useUIActions");
|
|
333653
|
-
|
|
333654
333703
|
// packages/cli/src/ui/components/DialogManager.tsx
|
|
333704
|
+
init_core2();
|
|
333655
333705
|
import process29 from "node:process";
|
|
333656
333706
|
|
|
333657
333707
|
// packages/cli/src/ui/components/IdeTrustChangeDialog.tsx
|
|
333658
333708
|
init_esbuild_shims();
|
|
333659
|
-
var
|
|
333709
|
+
var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
|
|
333660
333710
|
var IdeTrustChangeDialog = /* @__PURE__ */ __name(({ reason }) => {
|
|
333661
333711
|
useKeypress(
|
|
333662
333712
|
(key) => {
|
|
@@ -333676,7 +333726,7 @@ var IdeTrustChangeDialog = /* @__PURE__ */ __name(({ reason }) => {
|
|
|
333676
333726
|
} else if (reason === "TRUST_CHANGE") {
|
|
333677
333727
|
message = "Workspace trust has changed due to a change in the IDE trust.";
|
|
333678
333728
|
}
|
|
333679
|
-
return /* @__PURE__ */ (0,
|
|
333729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Box_default, { borderStyle: "round", borderColor: theme.status.warning, paddingX: 1, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(Text, { color: theme.status.warning, children: [
|
|
333680
333730
|
message,
|
|
333681
333731
|
" Press 'r' to restart Gemini to apply the changes."
|
|
333682
333732
|
] }) });
|
|
@@ -333685,7 +333735,7 @@ var IdeTrustChangeDialog = /* @__PURE__ */ __name(({ reason }) => {
|
|
|
333685
333735
|
// packages/cli/src/ui/components/WelcomeBackDialog.tsx
|
|
333686
333736
|
init_esbuild_shims();
|
|
333687
333737
|
init_core2();
|
|
333688
|
-
var
|
|
333738
|
+
var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1);
|
|
333689
333739
|
function WelcomeBackDialog({
|
|
333690
333740
|
welcomeBackInfo,
|
|
333691
333741
|
onSelect,
|
|
@@ -333719,7 +333769,7 @@ function WelcomeBackDialog({
|
|
|
333719
333769
|
inProgressCount = 0,
|
|
333720
333770
|
pendingTasks = []
|
|
333721
333771
|
} = welcomeBackInfo;
|
|
333722
|
-
return /* @__PURE__ */ (0,
|
|
333772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
333723
333773
|
Box_default,
|
|
333724
333774
|
{
|
|
333725
333775
|
flexDirection: "column",
|
|
@@ -333729,18 +333779,18 @@ function WelcomeBackDialog({
|
|
|
333729
333779
|
width: "100%",
|
|
333730
333780
|
marginLeft: 1,
|
|
333731
333781
|
children: [
|
|
333732
|
-
/* @__PURE__ */ (0,
|
|
333782
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Box_default, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Text, { color: Colors.AccentBlue, bold: true, children: [
|
|
333733
333783
|
"\u{1F44B} Welcome back! (Last updated: ",
|
|
333734
333784
|
timeAgo,
|
|
333735
333785
|
")"
|
|
333736
333786
|
] }) }),
|
|
333737
|
-
goalContent && /* @__PURE__ */ (0,
|
|
333738
|
-
/* @__PURE__ */ (0,
|
|
333739
|
-
/* @__PURE__ */ (0,
|
|
333787
|
+
goalContent && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
|
|
333788
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text, { color: Colors.Foreground, bold: true, children: "\u{1F3AF} Overall Goal:" }),
|
|
333789
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Box_default, { marginTop: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text, { color: Colors.Gray, children: goalContent }) })
|
|
333740
333790
|
] }),
|
|
333741
|
-
totalTasks > 0 && /* @__PURE__ */ (0,
|
|
333742
|
-
/* @__PURE__ */ (0,
|
|
333743
|
-
/* @__PURE__ */ (0,
|
|
333791
|
+
totalTasks > 0 && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [
|
|
333792
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text, { color: Colors.Foreground, bold: true, children: "\u{1F4CB} Current Plan:" }),
|
|
333793
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Box_default, { marginTop: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Text, { color: Colors.Gray, children: [
|
|
333744
333794
|
"Progress: ",
|
|
333745
333795
|
doneCount,
|
|
333746
333796
|
"/",
|
|
@@ -333748,19 +333798,19 @@ function WelcomeBackDialog({
|
|
|
333748
333798
|
" tasks completed",
|
|
333749
333799
|
inProgressCount > 0 && `, ${inProgressCount} in progress`
|
|
333750
333800
|
] }) }),
|
|
333751
|
-
pendingTasks.length > 0 && /* @__PURE__ */ (0,
|
|
333752
|
-
/* @__PURE__ */ (0,
|
|
333753
|
-
pendingTasks.map((task, index) => /* @__PURE__ */ (0,
|
|
333801
|
+
pendingTasks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, paddingLeft: 2, children: [
|
|
333802
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text, { color: Colors.Foreground, bold: true, children: "Pending Tasks:" }),
|
|
333803
|
+
pendingTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Text, { color: Colors.Gray, children: [
|
|
333754
333804
|
"\u2022 ",
|
|
333755
333805
|
task
|
|
333756
333806
|
] }, index))
|
|
333757
333807
|
] })
|
|
333758
333808
|
] }),
|
|
333759
|
-
/* @__PURE__ */ (0,
|
|
333760
|
-
/* @__PURE__ */ (0,
|
|
333761
|
-
/* @__PURE__ */ (0,
|
|
333809
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
333810
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text, { bold: true, children: "What would you like to do?" }),
|
|
333811
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Text, { children: "Choose how to proceed with your session:" })
|
|
333762
333812
|
] }),
|
|
333763
|
-
/* @__PURE__ */ (0,
|
|
333813
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RadioButtonSelect, { items: options2, onSelect, isFocused: true }) })
|
|
333764
333814
|
]
|
|
333765
333815
|
}
|
|
333766
333816
|
);
|
|
@@ -333769,7 +333819,7 @@ __name(WelcomeBackDialog, "WelcomeBackDialog");
|
|
|
333769
333819
|
|
|
333770
333820
|
// packages/cli/src/ui/components/QuitConfirmationDialog.tsx
|
|
333771
333821
|
init_esbuild_shims();
|
|
333772
|
-
var
|
|
333822
|
+
var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
|
|
333773
333823
|
var QuitConfirmationDialog = /* @__PURE__ */ __name(({
|
|
333774
333824
|
onSelect
|
|
333775
333825
|
}) => {
|
|
@@ -333803,7 +333853,7 @@ var QuitConfirmationDialog = /* @__PURE__ */ __name(({
|
|
|
333803
333853
|
value: "cancel" /* CANCEL */
|
|
333804
333854
|
}
|
|
333805
333855
|
];
|
|
333806
|
-
return /* @__PURE__ */ (0,
|
|
333856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
333807
333857
|
Box_default,
|
|
333808
333858
|
{
|
|
333809
333859
|
flexDirection: "column",
|
|
@@ -333813,15 +333863,15 @@ var QuitConfirmationDialog = /* @__PURE__ */ __name(({
|
|
|
333813
333863
|
width: "100%",
|
|
333814
333864
|
marginLeft: 1,
|
|
333815
333865
|
children: [
|
|
333816
|
-
/* @__PURE__ */ (0,
|
|
333817
|
-
/* @__PURE__ */ (0,
|
|
333866
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Box_default, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Text, { children: "\u9000\u51FA\u524D\u60A8\u5E0C\u671B\u6267\u884C\u4EC0\u4E48\u64CD\u4F5C\uFF1F" }) }),
|
|
333867
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(RadioButtonSelect, { items: options2, onSelect, isFocused: true })
|
|
333818
333868
|
]
|
|
333819
333869
|
}
|
|
333820
333870
|
);
|
|
333821
333871
|
}, "QuitConfirmationDialog");
|
|
333822
333872
|
|
|
333823
333873
|
// packages/cli/src/ui/components/DialogManager.tsx
|
|
333824
|
-
var
|
|
333874
|
+
var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
|
|
333825
333875
|
var DialogManager = /* @__PURE__ */ __name(({
|
|
333826
333876
|
addItem,
|
|
333827
333877
|
terminalWidth
|
|
@@ -333831,8 +333881,17 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333831
333881
|
const uiState = useUIState();
|
|
333832
333882
|
const uiActions = useUIActions();
|
|
333833
333883
|
const { constrainHeight, terminalHeight, staticExtraHeight, mainAreaWidth } = uiState;
|
|
333884
|
+
const getDefaultOpenAIConfig = /* @__PURE__ */ __name(() => {
|
|
333885
|
+
const fromSettings = settings.merged.security?.auth;
|
|
333886
|
+
const modelSettings = settings.merged.model;
|
|
333887
|
+
return {
|
|
333888
|
+
apiKey: fromSettings?.apiKey || process29.env["OPENAI_API_KEY"] || "",
|
|
333889
|
+
baseUrl: fromSettings?.baseUrl || process29.env["OPENAI_BASE_URL"] || "",
|
|
333890
|
+
model: modelSettings?.name || process29.env["OPENAI_MODEL"] || ""
|
|
333891
|
+
};
|
|
333892
|
+
}, "getDefaultOpenAIConfig");
|
|
333834
333893
|
if (uiState.showWelcomeBackDialog && uiState.welcomeBackInfo?.hasHistory) {
|
|
333835
|
-
return /* @__PURE__ */ (0,
|
|
333894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333836
333895
|
WelcomeBackDialog,
|
|
333837
333896
|
{
|
|
333838
333897
|
welcomeBackInfo: uiState.welcomeBackInfo,
|
|
@@ -333842,10 +333901,10 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333842
333901
|
);
|
|
333843
333902
|
}
|
|
333844
333903
|
if (uiState.showIdeRestartPrompt) {
|
|
333845
|
-
return /* @__PURE__ */ (0,
|
|
333904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(IdeTrustChangeDialog, { reason: uiState.ideTrustRestartReason });
|
|
333846
333905
|
}
|
|
333847
333906
|
if (uiState.showWorkspaceMigrationDialog) {
|
|
333848
|
-
return /* @__PURE__ */ (0,
|
|
333907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333849
333908
|
WorkspaceMigrationDialog,
|
|
333850
333909
|
{
|
|
333851
333910
|
workspaceExtensions: uiState.workspaceExtensions,
|
|
@@ -333855,7 +333914,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333855
333914
|
);
|
|
333856
333915
|
}
|
|
333857
333916
|
if (uiState.proQuotaRequest) {
|
|
333858
|
-
return /* @__PURE__ */ (0,
|
|
333917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333859
333918
|
ProQuotaDialog,
|
|
333860
333919
|
{
|
|
333861
333920
|
failedModel: uiState.proQuotaRequest.failedModel,
|
|
@@ -333865,7 +333924,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333865
333924
|
);
|
|
333866
333925
|
}
|
|
333867
333926
|
if (uiState.shouldShowIdePrompt) {
|
|
333868
|
-
return /* @__PURE__ */ (0,
|
|
333927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333869
333928
|
IdeIntegrationNudge,
|
|
333870
333929
|
{
|
|
333871
333930
|
ide: uiState.currentIDE,
|
|
@@ -333874,7 +333933,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333874
333933
|
);
|
|
333875
333934
|
}
|
|
333876
333935
|
if (uiState.isFolderTrustDialogOpen) {
|
|
333877
|
-
return /* @__PURE__ */ (0,
|
|
333936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333878
333937
|
FolderTrustDialog,
|
|
333879
333938
|
{
|
|
333880
333939
|
onSelect: uiActions.handleFolderTrustSelect,
|
|
@@ -333883,10 +333942,10 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333883
333942
|
);
|
|
333884
333943
|
}
|
|
333885
333944
|
if (uiState.shellConfirmationRequest) {
|
|
333886
|
-
return /* @__PURE__ */ (0,
|
|
333945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ShellConfirmationDialog, { request: uiState.shellConfirmationRequest });
|
|
333887
333946
|
}
|
|
333888
333947
|
if (uiState.loopDetectionConfirmationRequest) {
|
|
333889
|
-
return /* @__PURE__ */ (0,
|
|
333948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333890
333949
|
LoopDetectionConfirmation,
|
|
333891
333950
|
{
|
|
333892
333951
|
onComplete: uiState.loopDetectionConfirmationRequest.onComplete
|
|
@@ -333894,7 +333953,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333894
333953
|
);
|
|
333895
333954
|
}
|
|
333896
333955
|
if (uiState.quitConfirmationRequest) {
|
|
333897
|
-
return /* @__PURE__ */ (0,
|
|
333956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333898
333957
|
QuitConfirmationDialog,
|
|
333899
333958
|
{
|
|
333900
333959
|
onSelect: (choice2) => {
|
|
@@ -333915,7 +333974,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333915
333974
|
);
|
|
333916
333975
|
}
|
|
333917
333976
|
if (uiState.confirmationRequest) {
|
|
333918
|
-
return /* @__PURE__ */ (0,
|
|
333977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333919
333978
|
ConsentPrompt,
|
|
333920
333979
|
{
|
|
333921
333980
|
prompt: uiState.confirmationRequest.prompt,
|
|
@@ -333926,7 +333985,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333926
333985
|
}
|
|
333927
333986
|
if (uiState.confirmUpdateExtensionRequests.length > 0) {
|
|
333928
333987
|
const request4 = uiState.confirmUpdateExtensionRequests[0];
|
|
333929
|
-
return /* @__PURE__ */ (0,
|
|
333988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333930
333989
|
ConsentPrompt,
|
|
333931
333990
|
{
|
|
333932
333991
|
prompt: request4.prompt,
|
|
@@ -333936,9 +333995,9 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333936
333995
|
);
|
|
333937
333996
|
}
|
|
333938
333997
|
if (uiState.isThemeDialogOpen) {
|
|
333939
|
-
return /* @__PURE__ */ (0,
|
|
333940
|
-
uiState.themeError && /* @__PURE__ */ (0,
|
|
333941
|
-
/* @__PURE__ */ (0,
|
|
333998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
333999
|
+
uiState.themeError && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Text, { color: theme.status.error, children: uiState.themeError }) }),
|
|
334000
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333942
334001
|
ThemeDialog,
|
|
333943
334002
|
{
|
|
333944
334003
|
onSelect: uiActions.handleThemeSelect,
|
|
@@ -333951,7 +334010,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333951
334010
|
] });
|
|
333952
334011
|
}
|
|
333953
334012
|
if (uiState.isSettingsDialogOpen) {
|
|
333954
|
-
return /* @__PURE__ */ (0,
|
|
334013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333955
334014
|
SettingsDialog,
|
|
333956
334015
|
{
|
|
333957
334016
|
settings,
|
|
@@ -333964,7 +334023,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333964
334023
|
}
|
|
333965
334024
|
if (uiState.isApprovalModeDialogOpen) {
|
|
333966
334025
|
const currentMode = config.getApprovalMode();
|
|
333967
|
-
return /* @__PURE__ */ (0,
|
|
334026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
333968
334027
|
ApprovalModeDialog,
|
|
333969
334028
|
{
|
|
333970
334029
|
settings,
|
|
@@ -333975,47 +334034,61 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
333975
334034
|
) });
|
|
333976
334035
|
}
|
|
333977
334036
|
if (uiState.isModelDialogOpen) {
|
|
333978
|
-
return /* @__PURE__ */ (0,
|
|
334037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModelDialog, { onClose: uiActions.closeModelDialog });
|
|
333979
334038
|
}
|
|
333980
334039
|
if (uiState.isVisionSwitchDialogOpen) {
|
|
333981
|
-
return /* @__PURE__ */ (0,
|
|
334040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ModelSwitchDialog, { onSelect: uiActions.handleVisionSwitchSelect });
|
|
334041
|
+
}
|
|
334042
|
+
if (uiState.isAuthDialogOpen || uiState.authError) {
|
|
334043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(AuthDialog, {}) });
|
|
333982
334044
|
}
|
|
333983
334045
|
if (uiState.isAuthenticating) {
|
|
333984
|
-
if (uiState.
|
|
333985
|
-
|
|
333986
|
-
|
|
334046
|
+
if (uiState.pendingAuthType === "openai" /* USE_OPENAI */) {
|
|
334047
|
+
const defaults3 = getDefaultOpenAIConfig();
|
|
334048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
334049
|
+
OpenAIKeyPrompt,
|
|
333987
334050
|
{
|
|
333988
|
-
|
|
333989
|
-
|
|
333990
|
-
|
|
333991
|
-
|
|
333992
|
-
|
|
334051
|
+
onSubmit: (apiKey, baseUrl, model) => {
|
|
334052
|
+
uiActions.handleAuthSelect("openai" /* USE_OPENAI */, "User" /* User */, {
|
|
334053
|
+
apiKey,
|
|
334054
|
+
baseUrl,
|
|
334055
|
+
model
|
|
334056
|
+
});
|
|
334057
|
+
},
|
|
334058
|
+
onCancel: () => {
|
|
334059
|
+
uiActions.cancelAuthentication();
|
|
334060
|
+
uiActions.setAuthState("updating" /* Updating */);
|
|
334061
|
+
},
|
|
334062
|
+
defaultApiKey: defaults3.apiKey,
|
|
334063
|
+
defaultBaseUrl: defaults3.baseUrl,
|
|
334064
|
+
defaultModel: defaults3.model
|
|
333993
334065
|
}
|
|
333994
334066
|
);
|
|
333995
334067
|
}
|
|
333996
|
-
|
|
333997
|
-
|
|
333998
|
-
|
|
333999
|
-
|
|
334000
|
-
|
|
334068
|
+
if (uiState.pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
334069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
334070
|
+
QwenOAuthProgress,
|
|
334071
|
+
{
|
|
334072
|
+
deviceAuth: uiState.qwenAuthState.deviceAuth || void 0,
|
|
334073
|
+
authStatus: uiState.qwenAuthState.authStatus,
|
|
334074
|
+
authMessage: uiState.qwenAuthState.authMessage,
|
|
334075
|
+
onTimeout: () => {
|
|
334076
|
+
uiActions.onAuthError("Qwen OAuth authentication timed out.");
|
|
334077
|
+
uiActions.cancelAuthentication();
|
|
334078
|
+
uiActions.setAuthState("updating" /* Updating */);
|
|
334079
|
+
},
|
|
334080
|
+
onCancel: () => {
|
|
334081
|
+
uiActions.cancelAuthentication();
|
|
334082
|
+
uiActions.setAuthState("updating" /* Updating */);
|
|
334083
|
+
}
|
|
334001
334084
|
}
|
|
334002
|
-
|
|
334003
|
-
|
|
334004
|
-
}
|
|
334005
|
-
if (uiState.isAuthDialogOpen) {
|
|
334006
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
334007
|
-
AuthDialog,
|
|
334008
|
-
{
|
|
334009
|
-
onSelect: uiActions.handleAuthSelect,
|
|
334010
|
-
settings,
|
|
334011
|
-
initialErrorMessage: uiState.authError
|
|
334012
|
-
}
|
|
334013
|
-
) });
|
|
334085
|
+
);
|
|
334086
|
+
}
|
|
334014
334087
|
}
|
|
334015
334088
|
if (uiState.isEditorDialogOpen) {
|
|
334016
|
-
return /* @__PURE__ */ (0,
|
|
334017
|
-
uiState.editorError && /* @__PURE__ */ (0,
|
|
334018
|
-
/* @__PURE__ */ (0,
|
|
334089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
334090
|
+
uiState.editorError && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Text, { color: theme.status.error, children: uiState.editorError }) }),
|
|
334091
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
334019
334092
|
EditorSettingsDialog,
|
|
334020
334093
|
{
|
|
334021
334094
|
onSelect: uiActions.handleEditorSelect,
|
|
@@ -334026,7 +334099,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
334026
334099
|
] });
|
|
334027
334100
|
}
|
|
334028
334101
|
if (uiState.isPermissionsDialogOpen) {
|
|
334029
|
-
return /* @__PURE__ */ (0,
|
|
334102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
334030
334103
|
PermissionsModifyTrustDialog,
|
|
334031
334104
|
{
|
|
334032
334105
|
onExit: uiActions.closePermissionsDialog,
|
|
@@ -334035,7 +334108,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
334035
334108
|
);
|
|
334036
334109
|
}
|
|
334037
334110
|
if (uiState.isSubagentCreateDialogOpen) {
|
|
334038
|
-
return /* @__PURE__ */ (0,
|
|
334111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
334039
334112
|
AgentCreationWizard,
|
|
334040
334113
|
{
|
|
334041
334114
|
onClose: uiActions.closeSubagentCreateDialog,
|
|
@@ -334044,7 +334117,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
334044
334117
|
);
|
|
334045
334118
|
}
|
|
334046
334119
|
if (uiState.isAgentsManagerDialogOpen) {
|
|
334047
|
-
return /* @__PURE__ */ (0,
|
|
334120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
334048
334121
|
AgentsManagerDialog,
|
|
334049
334122
|
{
|
|
334050
334123
|
onClose: uiActions.closeAgentsManagerDialog,
|
|
@@ -334057,7 +334130,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
334057
334130
|
|
|
334058
334131
|
// packages/cli/src/ui/components/Composer.tsx
|
|
334059
334132
|
init_esbuild_shims();
|
|
334060
|
-
var
|
|
334133
|
+
var import_react97 = __toESM(require_react(), 1);
|
|
334061
334134
|
|
|
334062
334135
|
// packages/cli/src/ui/components/LoadingIndicator.tsx
|
|
334063
334136
|
init_esbuild_shims();
|
|
@@ -334070,7 +334143,7 @@ function isNarrowWidth(width) {
|
|
|
334070
334143
|
__name(isNarrowWidth, "isNarrowWidth");
|
|
334071
334144
|
|
|
334072
334145
|
// packages/cli/src/ui/components/LoadingIndicator.tsx
|
|
334073
|
-
var
|
|
334146
|
+
var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
|
|
334074
334147
|
var LoadingIndicator = /* @__PURE__ */ __name(({
|
|
334075
334148
|
currentLoadingPhrase,
|
|
334076
334149
|
elapsedTime,
|
|
@@ -334085,41 +334158,41 @@ var LoadingIndicator = /* @__PURE__ */ __name(({
|
|
|
334085
334158
|
}
|
|
334086
334159
|
const primaryText = thought?.subject || currentLoadingPhrase;
|
|
334087
334160
|
const cancelAndTimerContent = streamingState !== "waiting_for_confirmation" /* WaitingForConfirmation */ ? `(esc to cancel, ${elapsedTime < 60 ? `${elapsedTime}s` : formatDuration(elapsedTime * 1e3)})` : null;
|
|
334088
|
-
return /* @__PURE__ */ (0,
|
|
334089
|
-
/* @__PURE__ */ (0,
|
|
334161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Box_default, { paddingLeft: 0, flexDirection: "column", children: [
|
|
334162
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
334090
334163
|
Box_default,
|
|
334091
334164
|
{
|
|
334092
334165
|
width: "100%",
|
|
334093
334166
|
flexDirection: isNarrow ? "column" : "row",
|
|
334094
334167
|
alignItems: isNarrow ? "flex-start" : "center",
|
|
334095
334168
|
children: [
|
|
334096
|
-
/* @__PURE__ */ (0,
|
|
334097
|
-
/* @__PURE__ */ (0,
|
|
334169
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Box_default, { children: [
|
|
334170
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { marginRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
334098
334171
|
GeminiRespondingSpinner,
|
|
334099
334172
|
{
|
|
334100
334173
|
nonRespondingDisplay: streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ ? "\u280F" : ""
|
|
334101
334174
|
}
|
|
334102
334175
|
) }),
|
|
334103
|
-
primaryText && /* @__PURE__ */ (0,
|
|
334104
|
-
!isNarrow && cancelAndTimerContent && /* @__PURE__ */ (0,
|
|
334176
|
+
primaryText && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Text, { color: theme.text.accent, wrap: "truncate-end", children: primaryText }),
|
|
334177
|
+
!isNarrow && cancelAndTimerContent && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
334105
334178
|
" ",
|
|
334106
334179
|
cancelAndTimerContent
|
|
334107
334180
|
] })
|
|
334108
334181
|
] }),
|
|
334109
|
-
!isNarrow && /* @__PURE__ */ (0,
|
|
334110
|
-
!isNarrow && rightContent && /* @__PURE__ */ (0,
|
|
334182
|
+
!isNarrow && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { flexGrow: 1 }),
|
|
334183
|
+
!isNarrow && rightContent && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { children: rightContent })
|
|
334111
334184
|
]
|
|
334112
334185
|
}
|
|
334113
334186
|
),
|
|
334114
|
-
isNarrow && cancelAndTimerContent && /* @__PURE__ */ (0,
|
|
334115
|
-
isNarrow && rightContent && /* @__PURE__ */ (0,
|
|
334187
|
+
isNarrow && cancelAndTimerContent && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Text, { color: theme.text.secondary, children: cancelAndTimerContent }) }),
|
|
334188
|
+
isNarrow && rightContent && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Box_default, { children: rightContent })
|
|
334116
334189
|
] });
|
|
334117
334190
|
}, "LoadingIndicator");
|
|
334118
334191
|
|
|
334119
334192
|
// packages/cli/src/ui/components/ContextSummaryDisplay.tsx
|
|
334120
334193
|
init_esbuild_shims();
|
|
334121
334194
|
init_core2();
|
|
334122
|
-
var
|
|
334195
|
+
var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
|
|
334123
334196
|
var ContextSummaryDisplay = /* @__PURE__ */ __name(({
|
|
334124
334197
|
geminiMdFileCount,
|
|
334125
334198
|
contextFileNames,
|
|
@@ -334134,7 +334207,7 @@ var ContextSummaryDisplay = /* @__PURE__ */ __name(({
|
|
|
334134
334207
|
const blockedMcpServerCount = blockedMcpServers?.length || 0;
|
|
334135
334208
|
const openFileCount = ideContext?.workspaceState?.openFiles?.length ?? 0;
|
|
334136
334209
|
if (geminiMdFileCount === 0 && mcpServerCount === 0 && blockedMcpServerCount === 0 && openFileCount === 0) {
|
|
334137
|
-
return /* @__PURE__ */ (0,
|
|
334210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Text, { children: " " });
|
|
334138
334211
|
}
|
|
334139
334212
|
const openFilesText = (() => {
|
|
334140
334213
|
if (openFileCount === 0) {
|
|
@@ -334179,16 +334252,16 @@ var ContextSummaryDisplay = /* @__PURE__ */ __name(({
|
|
|
334179
334252
|
})();
|
|
334180
334253
|
const summaryParts = [openFilesText, geminiMdText, mcpText].filter(Boolean);
|
|
334181
334254
|
if (isNarrow) {
|
|
334182
|
-
return /* @__PURE__ */ (0,
|
|
334183
|
-
/* @__PURE__ */ (0,
|
|
334184
|
-
summaryParts.map((part, index) => /* @__PURE__ */ (0,
|
|
334255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
334256
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Text, { color: theme.text.secondary, children: "Using:" }),
|
|
334257
|
+
summaryParts.map((part, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
334185
334258
|
" ",
|
|
334186
334259
|
"- ",
|
|
334187
334260
|
part
|
|
334188
334261
|
] }, index))
|
|
334189
334262
|
] });
|
|
334190
334263
|
}
|
|
334191
|
-
return /* @__PURE__ */ (0,
|
|
334264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
334192
334265
|
"Using: ",
|
|
334193
334266
|
summaryParts.join(" | ")
|
|
334194
334267
|
] }) });
|
|
@@ -334197,7 +334270,7 @@ var ContextSummaryDisplay = /* @__PURE__ */ __name(({
|
|
|
334197
334270
|
// packages/cli/src/ui/components/AutoAcceptIndicator.tsx
|
|
334198
334271
|
init_esbuild_shims();
|
|
334199
334272
|
init_core2();
|
|
334200
|
-
var
|
|
334273
|
+
var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
|
|
334201
334274
|
var AutoAcceptIndicator = /* @__PURE__ */ __name(({
|
|
334202
334275
|
approvalMode
|
|
334203
334276
|
}) => {
|
|
@@ -334224,29 +334297,29 @@ var AutoAcceptIndicator = /* @__PURE__ */ __name(({
|
|
|
334224
334297
|
default:
|
|
334225
334298
|
break;
|
|
334226
334299
|
}
|
|
334227
|
-
return /* @__PURE__ */ (0,
|
|
334300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Text, { color: textColor, children: [
|
|
334228
334301
|
textContent2,
|
|
334229
|
-
subText && /* @__PURE__ */ (0,
|
|
334302
|
+
subText && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Text, { color: theme.text.secondary, children: subText })
|
|
334230
334303
|
] }) });
|
|
334231
334304
|
}, "AutoAcceptIndicator");
|
|
334232
334305
|
|
|
334233
334306
|
// packages/cli/src/ui/components/ShellModeIndicator.tsx
|
|
334234
334307
|
init_esbuild_shims();
|
|
334235
|
-
var
|
|
334236
|
-
var ShellModeIndicator = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0,
|
|
334308
|
+
var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
|
|
334309
|
+
var ShellModeIndicator = /* @__PURE__ */ __name(() => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Text, { color: theme.ui.symbol, children: [
|
|
334237
334310
|
"shell mode enabled",
|
|
334238
|
-
/* @__PURE__ */ (0,
|
|
334311
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Text, { color: theme.text.secondary, children: " (esc to disable)" })
|
|
334239
334312
|
] }) }), "ShellModeIndicator");
|
|
334240
334313
|
|
|
334241
334314
|
// packages/cli/src/ui/components/DetailedMessagesDisplay.tsx
|
|
334242
334315
|
init_esbuild_shims();
|
|
334243
|
-
var
|
|
334316
|
+
var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
|
|
334244
334317
|
var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, width }) => {
|
|
334245
334318
|
if (messages.length === 0) {
|
|
334246
334319
|
return null;
|
|
334247
334320
|
}
|
|
334248
334321
|
const borderAndPadding = 4;
|
|
334249
|
-
return /* @__PURE__ */ (0,
|
|
334322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
334250
334323
|
Box_default,
|
|
334251
334324
|
{
|
|
334252
334325
|
flexDirection: "column",
|
|
@@ -334256,12 +334329,12 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
334256
334329
|
paddingX: 1,
|
|
334257
334330
|
width,
|
|
334258
334331
|
children: [
|
|
334259
|
-
/* @__PURE__ */ (0,
|
|
334332
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Text, { bold: true, color: theme.text.primary, children: [
|
|
334260
334333
|
"Debug Console",
|
|
334261
334334
|
" ",
|
|
334262
|
-
/* @__PURE__ */ (0,
|
|
334335
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Text, { color: theme.text.secondary, children: "(ctrl+o to close)" })
|
|
334263
334336
|
] }) }),
|
|
334264
|
-
/* @__PURE__ */ (0,
|
|
334337
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(MaxSizedBox, { maxHeight, maxWidth: width - borderAndPadding, children: messages.map((msg, index) => {
|
|
334265
334338
|
let textColor = theme.text.primary;
|
|
334266
334339
|
let icon = "\u2139";
|
|
334267
334340
|
switch (msg.type) {
|
|
@@ -334281,14 +334354,14 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
334281
334354
|
default:
|
|
334282
334355
|
break;
|
|
334283
334356
|
}
|
|
334284
|
-
return /* @__PURE__ */ (0,
|
|
334285
|
-
/* @__PURE__ */ (0,
|
|
334357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
334358
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Text, { color: textColor, children: [
|
|
334286
334359
|
icon,
|
|
334287
334360
|
" "
|
|
334288
334361
|
] }),
|
|
334289
|
-
/* @__PURE__ */ (0,
|
|
334362
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Text, { color: textColor, wrap: "wrap", children: [
|
|
334290
334363
|
msg.content,
|
|
334291
|
-
msg.count && msg.count > 1 && /* @__PURE__ */ (0,
|
|
334364
|
+
msg.count && msg.count > 1 && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
334292
334365
|
" (x",
|
|
334293
334366
|
msg.count,
|
|
334294
334367
|
")"
|
|
@@ -334303,15 +334376,15 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
334303
334376
|
|
|
334304
334377
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
334305
334378
|
init_esbuild_shims();
|
|
334306
|
-
var
|
|
334379
|
+
var import_react93 = __toESM(require_react(), 1);
|
|
334307
334380
|
|
|
334308
334381
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
334309
334382
|
init_esbuild_shims();
|
|
334310
334383
|
|
|
334311
334384
|
// packages/cli/src/ui/components/PrepareLabel.tsx
|
|
334312
334385
|
init_esbuild_shims();
|
|
334313
|
-
var
|
|
334314
|
-
var
|
|
334386
|
+
var import_react83 = __toESM(require_react(), 1);
|
|
334387
|
+
var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
|
|
334315
334388
|
var MAX_WIDTH = 150;
|
|
334316
334389
|
var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
334317
334390
|
label,
|
|
@@ -334323,7 +334396,7 @@ var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
|
334323
334396
|
const hasMatch = matchedIndex !== void 0 && matchedIndex >= 0 && matchedIndex < label.length && userInput.length > 0;
|
|
334324
334397
|
if (!hasMatch) {
|
|
334325
334398
|
const display = isExpanded ? label : label.length > MAX_WIDTH ? label.slice(0, MAX_WIDTH) + "..." : label;
|
|
334326
|
-
return /* @__PURE__ */ (0,
|
|
334399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Text, { wrap: "wrap", color: textColor, children: display });
|
|
334327
334400
|
}
|
|
334328
334401
|
const matchLength = userInput.length;
|
|
334329
334402
|
let before = "";
|
|
@@ -334362,9 +334435,9 @@ var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
|
334362
334435
|
after = after.length >= 3 ? after.slice(0, -3) + "..." : "...";
|
|
334363
334436
|
}
|
|
334364
334437
|
}
|
|
334365
|
-
return /* @__PURE__ */ (0,
|
|
334438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(Text, { color: textColor, wrap: "wrap", children: [
|
|
334366
334439
|
before,
|
|
334367
|
-
match2 ? match2.split(/(\s+)/).map((part, index) => /* @__PURE__ */ (0,
|
|
334440
|
+
match2 ? match2.split(/(\s+)/).map((part, index) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
334368
334441
|
Text,
|
|
334369
334442
|
{
|
|
334370
334443
|
color: theme.background.primary,
|
|
@@ -334376,10 +334449,10 @@ var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
|
334376
334449
|
after
|
|
334377
334450
|
] });
|
|
334378
334451
|
}, "_PrepareLabel");
|
|
334379
|
-
var PrepareLabel =
|
|
334452
|
+
var PrepareLabel = import_react83.default.memo(_PrepareLabel);
|
|
334380
334453
|
|
|
334381
334454
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
334382
|
-
var
|
|
334455
|
+
var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
|
|
334383
334456
|
var MAX_SUGGESTIONS_TO_SHOW = 8;
|
|
334384
334457
|
function SuggestionsDisplay({
|
|
334385
334458
|
suggestions,
|
|
@@ -334392,7 +334465,7 @@ function SuggestionsDisplay({
|
|
|
334392
334465
|
expandedIndex
|
|
334393
334466
|
}) {
|
|
334394
334467
|
if (isLoading) {
|
|
334395
|
-
return /* @__PURE__ */ (0,
|
|
334468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Box_default, { paddingX: 1, width, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text, { color: "gray", children: "Loading suggestions..." }) });
|
|
334396
334469
|
}
|
|
334397
334470
|
if (suggestions.length === 0) {
|
|
334398
334471
|
return null;
|
|
@@ -334408,15 +334481,15 @@ function SuggestionsDisplay({
|
|
|
334408
334481
|
...suggestions.map((s2) => getFullLabel(s2).length)
|
|
334409
334482
|
);
|
|
334410
334483
|
const commandColumnWidth = mode === "slash" ? Math.min(maxLabelLength, Math.floor(width * 0.5)) : 0;
|
|
334411
|
-
return /* @__PURE__ */ (0,
|
|
334412
|
-
scrollOffset > 0 && /* @__PURE__ */ (0,
|
|
334484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Box_default, { flexDirection: "column", paddingX: 1, width, children: [
|
|
334485
|
+
scrollOffset > 0 && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text, { color: theme.text.primary, children: "\u25B2" }),
|
|
334413
334486
|
visibleSuggestions.map((suggestion, index) => {
|
|
334414
334487
|
const originalIndex = startIndex + index;
|
|
334415
334488
|
const isActive = originalIndex === activeIndex;
|
|
334416
334489
|
const isExpanded = originalIndex === expandedIndex;
|
|
334417
334490
|
const textColor = isActive ? theme.text.accent : theme.text.secondary;
|
|
334418
334491
|
const isLong = suggestion.value.length >= MAX_WIDTH;
|
|
334419
|
-
const labelElement = /* @__PURE__ */ (0,
|
|
334492
|
+
const labelElement = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
334420
334493
|
PrepareLabel,
|
|
334421
334494
|
{
|
|
334422
334495
|
label: suggestion.value,
|
|
@@ -334426,23 +334499,23 @@ function SuggestionsDisplay({
|
|
|
334426
334499
|
isExpanded
|
|
334427
334500
|
}
|
|
334428
334501
|
);
|
|
334429
|
-
return /* @__PURE__ */ (0,
|
|
334430
|
-
/* @__PURE__ */ (0,
|
|
334502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
334503
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
334431
334504
|
Box_default,
|
|
334432
334505
|
{
|
|
334433
334506
|
...mode === "slash" ? { width: commandColumnWidth, flexShrink: 0 } : { flexShrink: 1 },
|
|
334434
|
-
children: /* @__PURE__ */ (0,
|
|
334507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Box_default, { children: [
|
|
334435
334508
|
labelElement,
|
|
334436
|
-
suggestion.commandKind === "mcp-prompt" /* MCP_PROMPT */ && /* @__PURE__ */ (0,
|
|
334509
|
+
suggestion.commandKind === "mcp-prompt" /* MCP_PROMPT */ && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text, { color: textColor, children: " [MCP]" })
|
|
334437
334510
|
] })
|
|
334438
334511
|
}
|
|
334439
334512
|
),
|
|
334440
|
-
suggestion.description && /* @__PURE__ */ (0,
|
|
334441
|
-
isActive && isLong && /* @__PURE__ */ (0,
|
|
334513
|
+
suggestion.description && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Box_default, { flexGrow: 1, paddingLeft: 3, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text, { color: textColor, wrap: "truncate", children: suggestion.description }) }),
|
|
334514
|
+
isActive && isLong && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text, { color: Colors.Gray, children: isExpanded ? " \u2190 " : " \u2192 " }) })
|
|
334442
334515
|
] }, `${suggestion.value}-${originalIndex}`);
|
|
334443
334516
|
}),
|
|
334444
|
-
endIndex < suggestions.length && /* @__PURE__ */ (0,
|
|
334445
|
-
suggestions.length > MAX_SUGGESTIONS_TO_SHOW && /* @__PURE__ */ (0,
|
|
334517
|
+
endIndex < suggestions.length && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Text, { color: "gray", children: "\u25BC" }),
|
|
334518
|
+
suggestions.length > MAX_SUGGESTIONS_TO_SHOW && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Text, { color: "gray", children: [
|
|
334446
334519
|
"(",
|
|
334447
334520
|
activeIndex + 1,
|
|
334448
334521
|
"/",
|
|
@@ -334455,7 +334528,7 @@ __name(SuggestionsDisplay, "SuggestionsDisplay");
|
|
|
334455
334528
|
|
|
334456
334529
|
// packages/cli/src/ui/hooks/useInputHistory.ts
|
|
334457
334530
|
init_esbuild_shims();
|
|
334458
|
-
var
|
|
334531
|
+
var import_react84 = __toESM(require_react(), 1);
|
|
334459
334532
|
function useInputHistory({
|
|
334460
334533
|
userMessages,
|
|
334461
334534
|
onSubmit,
|
|
@@ -334463,13 +334536,13 @@ function useInputHistory({
|
|
|
334463
334536
|
currentQuery,
|
|
334464
334537
|
onChange
|
|
334465
334538
|
}) {
|
|
334466
|
-
const [historyIndex, setHistoryIndex] = (0,
|
|
334467
|
-
const [originalQueryBeforeNav, setOriginalQueryBeforeNav] = (0,
|
|
334468
|
-
const resetHistoryNav = (0,
|
|
334539
|
+
const [historyIndex, setHistoryIndex] = (0, import_react84.useState)(-1);
|
|
334540
|
+
const [originalQueryBeforeNav, setOriginalQueryBeforeNav] = (0, import_react84.useState)("");
|
|
334541
|
+
const resetHistoryNav = (0, import_react84.useCallback)(() => {
|
|
334469
334542
|
setHistoryIndex(-1);
|
|
334470
334543
|
setOriginalQueryBeforeNav("");
|
|
334471
334544
|
}, []);
|
|
334472
|
-
const handleSubmit = (0,
|
|
334545
|
+
const handleSubmit = (0, import_react84.useCallback)(
|
|
334473
334546
|
(value) => {
|
|
334474
334547
|
const trimmedValue = value.trim();
|
|
334475
334548
|
if (trimmedValue) {
|
|
@@ -334479,7 +334552,7 @@ function useInputHistory({
|
|
|
334479
334552
|
},
|
|
334480
334553
|
[onSubmit, resetHistoryNav]
|
|
334481
334554
|
);
|
|
334482
|
-
const navigateUp = (0,
|
|
334555
|
+
const navigateUp = (0, import_react84.useCallback)(() => {
|
|
334483
334556
|
if (!isActive) return false;
|
|
334484
334557
|
if (userMessages.length === 0) return false;
|
|
334485
334558
|
let nextIndex = historyIndex;
|
|
@@ -334508,7 +334581,7 @@ function useInputHistory({
|
|
|
334508
334581
|
// Use currentQuery from props
|
|
334509
334582
|
setOriginalQueryBeforeNav
|
|
334510
334583
|
]);
|
|
334511
|
-
const navigateDown = (0,
|
|
334584
|
+
const navigateDown = (0, import_react84.useCallback)(() => {
|
|
334512
334585
|
if (!isActive) return false;
|
|
334513
334586
|
if (historyIndex === -1) return false;
|
|
334514
334587
|
const nextIndex = historyIndex - 1;
|
|
@@ -334541,7 +334614,7 @@ var import_chalk7 = __toESM(require_source(), 1);
|
|
|
334541
334614
|
|
|
334542
334615
|
// packages/cli/src/ui/hooks/useShellHistory.ts
|
|
334543
334616
|
init_esbuild_shims();
|
|
334544
|
-
var
|
|
334617
|
+
var import_react85 = __toESM(require_react(), 1);
|
|
334545
334618
|
init_core2();
|
|
334546
334619
|
import * as fs72 from "node:fs/promises";
|
|
334547
334620
|
import * as path74 from "node:path";
|
|
@@ -334586,10 +334659,10 @@ async function writeHistoryFile(filePath, history) {
|
|
|
334586
334659
|
}
|
|
334587
334660
|
__name(writeHistoryFile, "writeHistoryFile");
|
|
334588
334661
|
function useShellHistory(projectRoot, storage) {
|
|
334589
|
-
const [history, setHistory] = (0,
|
|
334590
|
-
const [historyIndex, setHistoryIndex] = (0,
|
|
334591
|
-
const [historyFilePath, setHistoryFilePath] = (0,
|
|
334592
|
-
(0,
|
|
334662
|
+
const [history, setHistory] = (0, import_react85.useState)([]);
|
|
334663
|
+
const [historyIndex, setHistoryIndex] = (0, import_react85.useState)(-1);
|
|
334664
|
+
const [historyFilePath, setHistoryFilePath] = (0, import_react85.useState)(null);
|
|
334665
|
+
(0, import_react85.useEffect)(() => {
|
|
334593
334666
|
async function loadHistory() {
|
|
334594
334667
|
const filePath = await getHistoryFilePath(projectRoot, storage);
|
|
334595
334668
|
setHistoryFilePath(filePath);
|
|
@@ -334599,7 +334672,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
334599
334672
|
__name(loadHistory, "loadHistory");
|
|
334600
334673
|
loadHistory();
|
|
334601
334674
|
}, [projectRoot, storage]);
|
|
334602
|
-
const addCommandToHistory = (0,
|
|
334675
|
+
const addCommandToHistory = (0, import_react85.useCallback)(
|
|
334603
334676
|
(command2) => {
|
|
334604
334677
|
if (!command2.trim() || !historyFilePath) {
|
|
334605
334678
|
return;
|
|
@@ -334611,7 +334684,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
334611
334684
|
},
|
|
334612
334685
|
[history, historyFilePath]
|
|
334613
334686
|
);
|
|
334614
|
-
const getPreviousCommand = (0,
|
|
334687
|
+
const getPreviousCommand = (0, import_react85.useCallback)(() => {
|
|
334615
334688
|
if (history.length === 0) {
|
|
334616
334689
|
return null;
|
|
334617
334690
|
}
|
|
@@ -334619,7 +334692,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
334619
334692
|
setHistoryIndex(newIndex);
|
|
334620
334693
|
return history[newIndex] ?? null;
|
|
334621
334694
|
}, [history, historyIndex]);
|
|
334622
|
-
const getNextCommand = (0,
|
|
334695
|
+
const getNextCommand = (0, import_react85.useCallback)(() => {
|
|
334623
334696
|
if (historyIndex < 0) {
|
|
334624
334697
|
return null;
|
|
334625
334698
|
}
|
|
@@ -334630,7 +334703,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
334630
334703
|
}
|
|
334631
334704
|
return history[newIndex] ?? null;
|
|
334632
334705
|
}, [history, historyIndex]);
|
|
334633
|
-
const resetHistoryPosition = (0,
|
|
334706
|
+
const resetHistoryPosition = (0, import_react85.useCallback)(() => {
|
|
334634
334707
|
setHistoryIndex(-1);
|
|
334635
334708
|
}, []);
|
|
334636
334709
|
return {
|
|
@@ -334645,19 +334718,19 @@ __name(useShellHistory, "useShellHistory");
|
|
|
334645
334718
|
|
|
334646
334719
|
// packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx
|
|
334647
334720
|
init_esbuild_shims();
|
|
334648
|
-
var
|
|
334721
|
+
var import_react87 = __toESM(require_react(), 1);
|
|
334649
334722
|
|
|
334650
334723
|
// packages/cli/src/ui/hooks/useCompletion.ts
|
|
334651
334724
|
init_esbuild_shims();
|
|
334652
|
-
var
|
|
334725
|
+
var import_react86 = __toESM(require_react(), 1);
|
|
334653
334726
|
function useCompletion() {
|
|
334654
|
-
const [suggestions, setSuggestions] = (0,
|
|
334655
|
-
const [activeSuggestionIndex, setActiveSuggestionIndex] = (0,
|
|
334656
|
-
const [visibleStartIndex, setVisibleStartIndex] = (0,
|
|
334657
|
-
const [showSuggestions, setShowSuggestions] = (0,
|
|
334658
|
-
const [isLoadingSuggestions, setIsLoadingSuggestions] = (0,
|
|
334659
|
-
const [isPerfectMatch, setIsPerfectMatch] = (0,
|
|
334660
|
-
const resetCompletionState = (0,
|
|
334727
|
+
const [suggestions, setSuggestions] = (0, import_react86.useState)([]);
|
|
334728
|
+
const [activeSuggestionIndex, setActiveSuggestionIndex] = (0, import_react86.useState)(-1);
|
|
334729
|
+
const [visibleStartIndex, setVisibleStartIndex] = (0, import_react86.useState)(0);
|
|
334730
|
+
const [showSuggestions, setShowSuggestions] = (0, import_react86.useState)(false);
|
|
334731
|
+
const [isLoadingSuggestions, setIsLoadingSuggestions] = (0, import_react86.useState)(false);
|
|
334732
|
+
const [isPerfectMatch, setIsPerfectMatch] = (0, import_react86.useState)(false);
|
|
334733
|
+
const resetCompletionState = (0, import_react86.useCallback)(() => {
|
|
334661
334734
|
setSuggestions([]);
|
|
334662
334735
|
setActiveSuggestionIndex(-1);
|
|
334663
334736
|
setVisibleStartIndex(0);
|
|
@@ -334665,7 +334738,7 @@ function useCompletion() {
|
|
|
334665
334738
|
setIsLoadingSuggestions(false);
|
|
334666
334739
|
setIsPerfectMatch(false);
|
|
334667
334740
|
}, []);
|
|
334668
|
-
const navigateUp = (0,
|
|
334741
|
+
const navigateUp = (0, import_react86.useCallback)(() => {
|
|
334669
334742
|
if (suggestions.length === 0) return;
|
|
334670
334743
|
setActiveSuggestionIndex((prevActiveIndex) => {
|
|
334671
334744
|
const newActiveIndex = prevActiveIndex <= 0 ? suggestions.length - 1 : prevActiveIndex - 1;
|
|
@@ -334681,7 +334754,7 @@ function useCompletion() {
|
|
|
334681
334754
|
return newActiveIndex;
|
|
334682
334755
|
});
|
|
334683
334756
|
}, [suggestions.length]);
|
|
334684
|
-
const navigateDown = (0,
|
|
334757
|
+
const navigateDown = (0, import_react86.useCallback)(() => {
|
|
334685
334758
|
if (suggestions.length === 0) return;
|
|
334686
334759
|
setActiveSuggestionIndex((prevActiveIndex) => {
|
|
334687
334760
|
const newActiveIndex = prevActiveIndex >= suggestions.length - 1 ? 0 : prevActiveIndex + 1;
|
|
@@ -334720,8 +334793,8 @@ __name(useCompletion, "useCompletion");
|
|
|
334720
334793
|
|
|
334721
334794
|
// packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx
|
|
334722
334795
|
function useDebouncedValue(value, delay4 = 200) {
|
|
334723
|
-
const [debounced, setDebounced] = (0,
|
|
334724
|
-
(0,
|
|
334796
|
+
const [debounced, setDebounced] = (0, import_react87.useState)(value);
|
|
334797
|
+
(0, import_react87.useEffect)(() => {
|
|
334725
334798
|
const handle = setTimeout(() => setDebounced(value), delay4);
|
|
334726
334799
|
return () => clearTimeout(handle);
|
|
334727
334800
|
}, [value, delay4]);
|
|
@@ -334744,19 +334817,19 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
334744
334817
|
setVisibleStartIndex
|
|
334745
334818
|
} = useCompletion();
|
|
334746
334819
|
const debouncedQuery = useDebouncedValue(buffer.text, 100);
|
|
334747
|
-
const prevQueryRef = (0,
|
|
334748
|
-
const prevMatchesRef = (0,
|
|
334749
|
-
(0,
|
|
334820
|
+
const prevQueryRef = (0, import_react87.useRef)("");
|
|
334821
|
+
const prevMatchesRef = (0, import_react87.useRef)([]);
|
|
334822
|
+
(0, import_react87.useEffect)(() => {
|
|
334750
334823
|
if (reverseSearchActive) {
|
|
334751
334824
|
prevQueryRef.current = "";
|
|
334752
334825
|
prevMatchesRef.current = [];
|
|
334753
334826
|
}
|
|
334754
334827
|
}, [reverseSearchActive]);
|
|
334755
|
-
(0,
|
|
334828
|
+
(0, import_react87.useEffect)(() => {
|
|
334756
334829
|
prevQueryRef.current = "";
|
|
334757
334830
|
prevMatchesRef.current = [];
|
|
334758
334831
|
}, [history]);
|
|
334759
|
-
const searchHistory = (0,
|
|
334832
|
+
const searchHistory = (0, import_react87.useCallback)(
|
|
334760
334833
|
(query, items) => {
|
|
334761
334834
|
const out = [];
|
|
334762
334835
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -334770,7 +334843,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
334770
334843
|
},
|
|
334771
334844
|
[]
|
|
334772
334845
|
);
|
|
334773
|
-
const matches = (0,
|
|
334846
|
+
const matches = (0, import_react87.useMemo)(() => {
|
|
334774
334847
|
if (!reverseSearchActive) return [];
|
|
334775
334848
|
if (debouncedQuery.length === 0)
|
|
334776
334849
|
return history.map((cmd) => ({
|
|
@@ -334783,7 +334856,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
334783
334856
|
const source2 = canUseCache ? prevMatchesRef.current.map((m) => m.value) : history;
|
|
334784
334857
|
return searchHistory(query, source2);
|
|
334785
334858
|
}, [debouncedQuery, history, reverseSearchActive, searchHistory]);
|
|
334786
|
-
(0,
|
|
334859
|
+
(0, import_react87.useEffect)(() => {
|
|
334787
334860
|
if (!reverseSearchActive) {
|
|
334788
334861
|
resetCompletionState();
|
|
334789
334862
|
return;
|
|
@@ -334805,7 +334878,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
334805
334878
|
setVisibleStartIndex,
|
|
334806
334879
|
resetCompletionState
|
|
334807
334880
|
]);
|
|
334808
|
-
const handleAutocomplete = (0,
|
|
334881
|
+
const handleAutocomplete = (0, import_react87.useCallback)(
|
|
334809
334882
|
(i) => {
|
|
334810
334883
|
if (i < 0 || i >= suggestions.length) return;
|
|
334811
334884
|
buffer.setText(suggestions[i].value);
|
|
@@ -334829,11 +334902,11 @@ __name(useReverseSearchCompletion, "useReverseSearchCompletion");
|
|
|
334829
334902
|
|
|
334830
334903
|
// packages/cli/src/ui/hooks/useCommandCompletion.tsx
|
|
334831
334904
|
init_esbuild_shims();
|
|
334832
|
-
var
|
|
334905
|
+
var import_react91 = __toESM(require_react(), 1);
|
|
334833
334906
|
|
|
334834
334907
|
// packages/cli/src/ui/hooks/useAtCompletion.ts
|
|
334835
334908
|
init_esbuild_shims();
|
|
334836
|
-
var
|
|
334909
|
+
var import_react88 = __toESM(require_react(), 1);
|
|
334837
334910
|
init_core2();
|
|
334838
334911
|
var initialState = {
|
|
334839
334912
|
status: "idle" /* IDLE */,
|
|
@@ -334892,20 +334965,20 @@ function useAtCompletion(props) {
|
|
|
334892
334965
|
setSuggestions,
|
|
334893
334966
|
setIsLoadingSuggestions
|
|
334894
334967
|
} = props;
|
|
334895
|
-
const [state, dispatch] = (0,
|
|
334896
|
-
const fileSearch = (0,
|
|
334897
|
-
const searchAbortController = (0,
|
|
334898
|
-
const slowSearchTimer = (0,
|
|
334899
|
-
(0,
|
|
334968
|
+
const [state, dispatch] = (0, import_react88.useReducer)(atCompletionReducer, initialState);
|
|
334969
|
+
const fileSearch = (0, import_react88.useRef)(null);
|
|
334970
|
+
const searchAbortController = (0, import_react88.useRef)(null);
|
|
334971
|
+
const slowSearchTimer = (0, import_react88.useRef)(null);
|
|
334972
|
+
(0, import_react88.useEffect)(() => {
|
|
334900
334973
|
setSuggestions(state.suggestions);
|
|
334901
334974
|
}, [state.suggestions, setSuggestions]);
|
|
334902
|
-
(0,
|
|
334975
|
+
(0, import_react88.useEffect)(() => {
|
|
334903
334976
|
setIsLoadingSuggestions(state.isLoading);
|
|
334904
334977
|
}, [state.isLoading, setIsLoadingSuggestions]);
|
|
334905
|
-
(0,
|
|
334978
|
+
(0, import_react88.useEffect)(() => {
|
|
334906
334979
|
dispatch({ type: "RESET" });
|
|
334907
334980
|
}, [cwd7, config]);
|
|
334908
|
-
(0,
|
|
334981
|
+
(0, import_react88.useEffect)(() => {
|
|
334909
334982
|
if (!enabled) {
|
|
334910
334983
|
if (state.status === "ready" /* READY */ || state.status === "error" /* ERROR */) {
|
|
334911
334984
|
dispatch({ type: "RESET" });
|
|
@@ -334922,7 +334995,7 @@ function useAtCompletion(props) {
|
|
|
334922
334995
|
dispatch({ type: "SEARCH", payload: pattern });
|
|
334923
334996
|
}
|
|
334924
334997
|
}, [enabled, pattern, state.status, state.pattern]);
|
|
334925
|
-
(0,
|
|
334998
|
+
(0, import_react88.useEffect)(() => {
|
|
334926
334999
|
const initialize = /* @__PURE__ */ __name(async () => {
|
|
334927
335000
|
try {
|
|
334928
335001
|
const searcher = FileSearchFactory.create({
|
|
@@ -334997,7 +335070,7 @@ __name(useAtCompletion, "useAtCompletion");
|
|
|
334997
335070
|
|
|
334998
335071
|
// packages/cli/src/ui/hooks/useSlashCompletion.ts
|
|
334999
335072
|
init_esbuild_shims();
|
|
335000
|
-
var
|
|
335073
|
+
var import_react89 = __toESM(require_react(), 1);
|
|
335001
335074
|
init_fzf_es();
|
|
335002
335075
|
function logErrorSafely(error, context2) {
|
|
335003
335076
|
if (error instanceof Error) {
|
|
@@ -335012,7 +335085,7 @@ function matchesCommand(cmd, query) {
|
|
|
335012
335085
|
}
|
|
335013
335086
|
__name(matchesCommand, "matchesCommand");
|
|
335014
335087
|
function useCommandParser(query, slashCommands) {
|
|
335015
|
-
return (0,
|
|
335088
|
+
return (0, import_react89.useMemo)(() => {
|
|
335016
335089
|
if (!query) {
|
|
335017
335090
|
return {
|
|
335018
335091
|
hasTrailingSpace: false,
|
|
@@ -335082,9 +335155,9 @@ function useCommandParser(query, slashCommands) {
|
|
|
335082
335155
|
}
|
|
335083
335156
|
__name(useCommandParser, "useCommandParser");
|
|
335084
335157
|
function useCommandSuggestions(parserResult, commandContext, getFzfForCommands, getPrefixSuggestions) {
|
|
335085
|
-
const [suggestions, setSuggestions] = (0,
|
|
335086
|
-
const [isLoading, setIsLoading] = (0,
|
|
335087
|
-
(0,
|
|
335158
|
+
const [suggestions, setSuggestions] = (0, import_react89.useState)([]);
|
|
335159
|
+
const [isLoading, setIsLoading] = (0, import_react89.useState)(false);
|
|
335160
|
+
(0, import_react89.useEffect)(() => {
|
|
335088
335161
|
const abortController = new AbortController();
|
|
335089
335162
|
const { signal } = abortController;
|
|
335090
335163
|
const {
|
|
@@ -335204,7 +335277,7 @@ function useCommandSuggestions(parserResult, commandContext, getFzfForCommands,
|
|
|
335204
335277
|
}
|
|
335205
335278
|
__name(useCommandSuggestions, "useCommandSuggestions");
|
|
335206
335279
|
function useCompletionPositions(query, parserResult) {
|
|
335207
|
-
return (0,
|
|
335280
|
+
return (0, import_react89.useMemo)(() => {
|
|
335208
335281
|
if (!query) {
|
|
335209
335282
|
return { start: -1, end: -1 };
|
|
335210
335283
|
}
|
|
@@ -335226,7 +335299,7 @@ function useCompletionPositions(query, parserResult) {
|
|
|
335226
335299
|
}
|
|
335227
335300
|
__name(useCompletionPositions, "useCompletionPositions");
|
|
335228
335301
|
function usePerfectMatch(parserResult) {
|
|
335229
|
-
return (0,
|
|
335302
|
+
return (0, import_react89.useMemo)(() => {
|
|
335230
335303
|
const { hasTrailingSpace, partial, leafCommand, currentLevel } = parserResult;
|
|
335231
335304
|
if (hasTrailingSpace) {
|
|
335232
335305
|
return { isPerfectMatch: false };
|
|
@@ -335256,13 +335329,13 @@ function useSlashCompletion(props) {
|
|
|
335256
335329
|
setIsLoadingSuggestions,
|
|
335257
335330
|
setIsPerfectMatch
|
|
335258
335331
|
} = props;
|
|
335259
|
-
const [completionStart, setCompletionStart] = (0,
|
|
335260
|
-
const [completionEnd, setCompletionEnd] = (0,
|
|
335261
|
-
const fzfInstanceCache = (0,
|
|
335332
|
+
const [completionStart, setCompletionStart] = (0, import_react89.useState)(-1);
|
|
335333
|
+
const [completionEnd, setCompletionEnd] = (0, import_react89.useState)(-1);
|
|
335334
|
+
const fzfInstanceCache = (0, import_react89.useMemo)(
|
|
335262
335335
|
() => /* @__PURE__ */ new WeakMap(),
|
|
335263
335336
|
[]
|
|
335264
335337
|
);
|
|
335265
|
-
const getFzfForCommands = (0,
|
|
335338
|
+
const getFzfForCommands = (0, import_react89.useMemo)(
|
|
335266
335339
|
() => (commands) => {
|
|
335267
335340
|
if (!commands || commands.length === 0) {
|
|
335268
335341
|
return null;
|
|
@@ -335306,7 +335379,7 @@ function useSlashCompletion(props) {
|
|
|
335306
335379
|
},
|
|
335307
335380
|
[fzfInstanceCache]
|
|
335308
335381
|
);
|
|
335309
|
-
const getPrefixSuggestions = (0,
|
|
335382
|
+
const getPrefixSuggestions = (0, import_react89.useMemo)(
|
|
335310
335383
|
() => (commands, partial) => commands.filter(
|
|
335311
335384
|
(cmd) => cmd.description && !cmd.hidden && (cmd.name.toLowerCase().startsWith(partial.toLowerCase()) || cmd.altNames?.some(
|
|
335312
335385
|
(alt) => alt.toLowerCase().startsWith(partial.toLowerCase())
|
|
@@ -335326,7 +335399,7 @@ function useSlashCompletion(props) {
|
|
|
335326
335399
|
parserResult
|
|
335327
335400
|
);
|
|
335328
335401
|
const { isPerfectMatch } = usePerfectMatch(parserResult);
|
|
335329
|
-
(0,
|
|
335402
|
+
(0, import_react89.useEffect)(() => {
|
|
335330
335403
|
if (!enabled) {
|
|
335331
335404
|
setSuggestions([]);
|
|
335332
335405
|
setIsLoadingSuggestions(false);
|
|
@@ -335335,7 +335408,7 @@ function useSlashCompletion(props) {
|
|
|
335335
335408
|
setCompletionEnd(-1);
|
|
335336
335409
|
}
|
|
335337
335410
|
}, [enabled, setSuggestions, setIsLoadingSuggestions, setIsPerfectMatch]);
|
|
335338
|
-
(0,
|
|
335411
|
+
(0, import_react89.useEffect)(() => {
|
|
335339
335412
|
if (!enabled || query === null) {
|
|
335340
335413
|
return;
|
|
335341
335414
|
}
|
|
@@ -335365,7 +335438,7 @@ __name(useSlashCompletion, "useSlashCompletion");
|
|
|
335365
335438
|
|
|
335366
335439
|
// packages/cli/src/ui/hooks/usePromptCompletion.ts
|
|
335367
335440
|
init_esbuild_shims();
|
|
335368
|
-
var
|
|
335441
|
+
var import_react90 = __toESM(require_react(), 1);
|
|
335369
335442
|
init_core2();
|
|
335370
335443
|
var PROMPT_COMPLETION_MIN_LENGTH = 5;
|
|
335371
335444
|
var PROMPT_COMPLETION_DEBOUNCE_MS = 250;
|
|
@@ -335374,18 +335447,18 @@ function usePromptCompletion({
|
|
|
335374
335447
|
config,
|
|
335375
335448
|
enabled
|
|
335376
335449
|
}) {
|
|
335377
|
-
const [ghostText, setGhostText] = (0,
|
|
335378
|
-
const [isLoadingGhostText, setIsLoadingGhostText] = (0,
|
|
335379
|
-
const abortControllerRef = (0,
|
|
335380
|
-
const [justSelectedSuggestion, setJustSelectedSuggestion] = (0,
|
|
335381
|
-
const lastSelectedTextRef = (0,
|
|
335382
|
-
const lastRequestedTextRef = (0,
|
|
335450
|
+
const [ghostText, setGhostText] = (0, import_react90.useState)("");
|
|
335451
|
+
const [isLoadingGhostText, setIsLoadingGhostText] = (0, import_react90.useState)(false);
|
|
335452
|
+
const abortControllerRef = (0, import_react90.useRef)(null);
|
|
335453
|
+
const [justSelectedSuggestion, setJustSelectedSuggestion] = (0, import_react90.useState)(false);
|
|
335454
|
+
const lastSelectedTextRef = (0, import_react90.useRef)("");
|
|
335455
|
+
const lastRequestedTextRef = (0, import_react90.useRef)("");
|
|
335383
335456
|
const isPromptCompletionEnabled = enabled && (config?.getEnablePromptCompletion() ?? false);
|
|
335384
|
-
const clearGhostText = (0,
|
|
335457
|
+
const clearGhostText = (0, import_react90.useCallback)(() => {
|
|
335385
335458
|
setGhostText("");
|
|
335386
335459
|
setIsLoadingGhostText(false);
|
|
335387
335460
|
}, []);
|
|
335388
|
-
const acceptGhostText = (0,
|
|
335461
|
+
const acceptGhostText = (0, import_react90.useCallback)(() => {
|
|
335389
335462
|
if (ghostText && ghostText.length > buffer.text.length) {
|
|
335390
335463
|
buffer.setText(ghostText);
|
|
335391
335464
|
setGhostText("");
|
|
@@ -335393,11 +335466,11 @@ function usePromptCompletion({
|
|
|
335393
335466
|
lastSelectedTextRef.current = ghostText;
|
|
335394
335467
|
}
|
|
335395
335468
|
}, [ghostText, buffer]);
|
|
335396
|
-
const markSuggestionSelected = (0,
|
|
335469
|
+
const markSuggestionSelected = (0, import_react90.useCallback)((selectedText) => {
|
|
335397
335470
|
setJustSelectedSuggestion(true);
|
|
335398
335471
|
lastSelectedTextRef.current = selectedText;
|
|
335399
335472
|
}, []);
|
|
335400
|
-
const generatePromptSuggestions = (0,
|
|
335473
|
+
const generatePromptSuggestions = (0, import_react90.useCallback)(async () => {
|
|
335401
335474
|
const trimmedText = buffer.text.trim();
|
|
335402
335475
|
const geminiClient = config?.getGeminiClient();
|
|
335403
335476
|
if (trimmedText === lastRequestedTextRef.current) {
|
|
@@ -335465,7 +335538,7 @@ function usePromptCompletion({
|
|
|
335465
335538
|
}
|
|
335466
335539
|
}
|
|
335467
335540
|
}, [buffer.text, config, clearGhostText, isPromptCompletionEnabled]);
|
|
335468
|
-
const isCursorAtEnd = (0,
|
|
335541
|
+
const isCursorAtEnd = (0, import_react90.useCallback)(() => {
|
|
335469
335542
|
const [cursorRow, cursorCol] = buffer.cursor;
|
|
335470
335543
|
const totalLines = buffer.lines.length;
|
|
335471
335544
|
if (cursorRow !== totalLines - 1) {
|
|
@@ -335474,7 +335547,7 @@ function usePromptCompletion({
|
|
|
335474
335547
|
const lastLine = buffer.lines[cursorRow] || "";
|
|
335475
335548
|
return cursorCol === lastLine.length;
|
|
335476
335549
|
}, [buffer.cursor, buffer.lines]);
|
|
335477
|
-
const handlePromptCompletion = (0,
|
|
335550
|
+
const handlePromptCompletion = (0, import_react90.useCallback)(() => {
|
|
335478
335551
|
if (!isCursorAtEnd()) {
|
|
335479
335552
|
clearGhostText();
|
|
335480
335553
|
return;
|
|
@@ -335495,14 +335568,14 @@ function usePromptCompletion({
|
|
|
335495
335568
|
isCursorAtEnd,
|
|
335496
335569
|
clearGhostText
|
|
335497
335570
|
]);
|
|
335498
|
-
(0,
|
|
335571
|
+
(0, import_react90.useEffect)(() => {
|
|
335499
335572
|
const timeoutId = setTimeout(
|
|
335500
335573
|
handlePromptCompletion,
|
|
335501
335574
|
PROMPT_COMPLETION_DEBOUNCE_MS
|
|
335502
335575
|
);
|
|
335503
335576
|
return () => clearTimeout(timeoutId);
|
|
335504
335577
|
}, [buffer.text, buffer.cursor, handlePromptCompletion]);
|
|
335505
|
-
(0,
|
|
335578
|
+
(0, import_react90.useEffect)(() => {
|
|
335506
335579
|
const currentText = buffer.text.trim();
|
|
335507
335580
|
if (ghostText && !isCursorAtEnd()) {
|
|
335508
335581
|
clearGhostText();
|
|
@@ -335512,8 +335585,8 @@ function usePromptCompletion({
|
|
|
335512
335585
|
clearGhostText();
|
|
335513
335586
|
}
|
|
335514
335587
|
}, [buffer.text, buffer.cursor, ghostText, clearGhostText, isCursorAtEnd]);
|
|
335515
|
-
(0,
|
|
335516
|
-
const isActive = (0,
|
|
335588
|
+
(0, import_react90.useEffect)(() => () => abortControllerRef.current?.abort(), []);
|
|
335589
|
+
const isActive = (0, import_react90.useMemo)(() => {
|
|
335517
335590
|
if (!isPromptCompletionEnabled) return false;
|
|
335518
335591
|
if (!isCursorAtEnd()) return false;
|
|
335519
335592
|
const trimmedText = buffer.text.trim();
|
|
@@ -335551,7 +335624,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
335551
335624
|
} = useCompletion();
|
|
335552
335625
|
const cursorRow = buffer.cursor[0];
|
|
335553
335626
|
const cursorCol = buffer.cursor[1];
|
|
335554
|
-
const { completionMode, query, completionStart, completionEnd } = (0,
|
|
335627
|
+
const { completionMode, query, completionStart, completionEnd } = (0, import_react91.useMemo)(() => {
|
|
335555
335628
|
const currentLine = buffer.lines[cursorRow] || "";
|
|
335556
335629
|
if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
|
|
335557
335630
|
return {
|
|
@@ -335635,11 +335708,11 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
335635
335708
|
config,
|
|
335636
335709
|
enabled: completionMode === "PROMPT" /* PROMPT */
|
|
335637
335710
|
});
|
|
335638
|
-
(0,
|
|
335711
|
+
(0, import_react91.useEffect)(() => {
|
|
335639
335712
|
setActiveSuggestionIndex(suggestions.length > 0 ? 0 : -1);
|
|
335640
335713
|
setVisibleStartIndex(0);
|
|
335641
335714
|
}, [suggestions, setActiveSuggestionIndex, setVisibleStartIndex]);
|
|
335642
|
-
(0,
|
|
335715
|
+
(0, import_react91.useEffect)(() => {
|
|
335643
335716
|
if (completionMode === "IDLE" /* IDLE */ || reverseSearchActive) {
|
|
335644
335717
|
resetCompletionState();
|
|
335645
335718
|
return;
|
|
@@ -335653,7 +335726,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
335653
335726
|
resetCompletionState,
|
|
335654
335727
|
setShowSuggestions
|
|
335655
335728
|
]);
|
|
335656
|
-
const handleAutocomplete = (0,
|
|
335729
|
+
const handleAutocomplete = (0, import_react91.useCallback)(
|
|
335657
335730
|
(indexToUse) => {
|
|
335658
335731
|
if (indexToUse < 0 || indexToUse >= suggestions.length) {
|
|
335659
335732
|
return;
|
|
@@ -335884,12 +335957,12 @@ import * as path76 from "node:path";
|
|
|
335884
335957
|
|
|
335885
335958
|
// packages/cli/src/ui/contexts/ShellFocusContext.tsx
|
|
335886
335959
|
init_esbuild_shims();
|
|
335887
|
-
var
|
|
335888
|
-
var ShellFocusContext = (0,
|
|
335889
|
-
var useShellFocusState = /* @__PURE__ */ __name(() => (0,
|
|
335960
|
+
var import_react92 = __toESM(require_react(), 1);
|
|
335961
|
+
var ShellFocusContext = (0, import_react92.createContext)(true);
|
|
335962
|
+
var useShellFocusState = /* @__PURE__ */ __name(() => (0, import_react92.useContext)(ShellFocusContext), "useShellFocusState");
|
|
335890
335963
|
|
|
335891
335964
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
335892
|
-
var
|
|
335965
|
+
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
335893
335966
|
var calculatePromptWidths = /* @__PURE__ */ __name((terminalWidth) => {
|
|
335894
335967
|
const widthFraction = 0.9;
|
|
335895
335968
|
const FRAME_PADDING_AND_BORDER = 4;
|
|
@@ -335927,29 +336000,29 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
335927
336000
|
isEmbeddedShellFocused
|
|
335928
336001
|
}) => {
|
|
335929
336002
|
const isShellFocused = useShellFocusState();
|
|
335930
|
-
const [justNavigatedHistory, setJustNavigatedHistory] = (0,
|
|
335931
|
-
const [escPressCount, setEscPressCount] = (0,
|
|
335932
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
335933
|
-
const escapeTimerRef = (0,
|
|
335934
|
-
const [recentPasteTime, setRecentPasteTime] = (0,
|
|
335935
|
-
const pasteTimeoutRef = (0,
|
|
335936
|
-
const [dirs, setDirs] = (0,
|
|
336003
|
+
const [justNavigatedHistory, setJustNavigatedHistory] = (0, import_react93.useState)(false);
|
|
336004
|
+
const [escPressCount, setEscPressCount] = (0, import_react93.useState)(0);
|
|
336005
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react93.useState)(false);
|
|
336006
|
+
const escapeTimerRef = (0, import_react93.useRef)(null);
|
|
336007
|
+
const [recentPasteTime, setRecentPasteTime] = (0, import_react93.useState)(null);
|
|
336008
|
+
const pasteTimeoutRef = (0, import_react93.useRef)(null);
|
|
336009
|
+
const [dirs, setDirs] = (0, import_react93.useState)(
|
|
335937
336010
|
config.getWorkspaceContext().getDirectories()
|
|
335938
336011
|
);
|
|
335939
336012
|
const dirsChanged = config.getWorkspaceContext().getDirectories();
|
|
335940
|
-
(0,
|
|
336013
|
+
(0, import_react93.useEffect)(() => {
|
|
335941
336014
|
if (dirs.length !== dirsChanged.length) {
|
|
335942
336015
|
setDirs(dirsChanged);
|
|
335943
336016
|
}
|
|
335944
336017
|
}, [dirs.length, dirsChanged]);
|
|
335945
|
-
const [reverseSearchActive, setReverseSearchActive] = (0,
|
|
335946
|
-
const [commandSearchActive, setCommandSearchActive] = (0,
|
|
335947
|
-
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0,
|
|
335948
|
-
const [cursorPosition, setCursorPosition] = (0,
|
|
336018
|
+
const [reverseSearchActive, setReverseSearchActive] = (0, import_react93.useState)(false);
|
|
336019
|
+
const [commandSearchActive, setCommandSearchActive] = (0, import_react93.useState)(false);
|
|
336020
|
+
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0, import_react93.useState)("");
|
|
336021
|
+
const [cursorPosition, setCursorPosition] = (0, import_react93.useState)([
|
|
335949
336022
|
0,
|
|
335950
336023
|
0
|
|
335951
336024
|
]);
|
|
335952
|
-
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0,
|
|
336025
|
+
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0, import_react93.useState)(-1);
|
|
335953
336026
|
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
335954
336027
|
const shellHistoryData = shellHistory.history;
|
|
335955
336028
|
const completion3 = useCommandCompletion(
|
|
@@ -335975,7 +336048,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
335975
336048
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
335976
336049
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
335977
336050
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused;
|
|
335978
|
-
const resetEscapeState = (0,
|
|
336051
|
+
const resetEscapeState = (0, import_react93.useCallback)(() => {
|
|
335979
336052
|
if (escapeTimerRef.current) {
|
|
335980
336053
|
clearTimeout(escapeTimerRef.current);
|
|
335981
336054
|
escapeTimerRef.current = null;
|
|
@@ -335983,12 +336056,12 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
335983
336056
|
setEscPressCount(0);
|
|
335984
336057
|
setShowEscapePrompt(false);
|
|
335985
336058
|
}, []);
|
|
335986
|
-
(0,
|
|
336059
|
+
(0, import_react93.useEffect)(() => {
|
|
335987
336060
|
if (onEscapePromptChange) {
|
|
335988
336061
|
onEscapePromptChange(showEscapePrompt);
|
|
335989
336062
|
}
|
|
335990
336063
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
335991
|
-
(0,
|
|
336064
|
+
(0, import_react93.useEffect)(
|
|
335992
336065
|
() => () => {
|
|
335993
336066
|
if (escapeTimerRef.current) {
|
|
335994
336067
|
clearTimeout(escapeTimerRef.current);
|
|
@@ -335999,7 +336072,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
335999
336072
|
},
|
|
336000
336073
|
[]
|
|
336001
336074
|
);
|
|
336002
|
-
const handleSubmitAndClear = (0,
|
|
336075
|
+
const handleSubmitAndClear = (0, import_react93.useCallback)(
|
|
336003
336076
|
(submittedValue) => {
|
|
336004
336077
|
if (shellModeActive) {
|
|
336005
336078
|
shellHistory.addCommandToHistory(submittedValue);
|
|
@@ -336018,7 +336091,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336018
336091
|
resetReverseSearchCompletionState
|
|
336019
336092
|
]
|
|
336020
336093
|
);
|
|
336021
|
-
const customSetTextAndResetCompletionSignal = (0,
|
|
336094
|
+
const customSetTextAndResetCompletionSignal = (0, import_react93.useCallback)(
|
|
336022
336095
|
(newText) => {
|
|
336023
336096
|
buffer.setText(newText);
|
|
336024
336097
|
setJustNavigatedHistory(true);
|
|
@@ -336032,7 +336105,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336032
336105
|
currentQuery: buffer.text,
|
|
336033
336106
|
onChange: customSetTextAndResetCompletionSignal
|
|
336034
336107
|
});
|
|
336035
|
-
(0,
|
|
336108
|
+
(0, import_react93.useEffect)(() => {
|
|
336036
336109
|
if (justNavigatedHistory) {
|
|
336037
336110
|
resetCompletionState();
|
|
336038
336111
|
resetReverseSearchCompletionState();
|
|
@@ -336048,7 +336121,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336048
336121
|
resetReverseSearchCompletionState,
|
|
336049
336122
|
resetCommandSearchCompletionState
|
|
336050
336123
|
]);
|
|
336051
|
-
const handleClipboardImage = (0,
|
|
336124
|
+
const handleClipboardImage = (0, import_react93.useCallback)(async () => {
|
|
336052
336125
|
try {
|
|
336053
336126
|
if (await clipboardHasImage()) {
|
|
336054
336127
|
const imagePath = await saveClipboardImage(config.getTargetDir());
|
|
@@ -336080,7 +336153,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336080
336153
|
console.error("Error handling clipboard image:", error);
|
|
336081
336154
|
}
|
|
336082
336155
|
}, [buffer, config]);
|
|
336083
|
-
const handleInput = (0,
|
|
336156
|
+
const handleInput = (0, import_react93.useCallback)(
|
|
336084
336157
|
(key) => {
|
|
336085
336158
|
if (!focus && !key.paste) {
|
|
336086
336159
|
return;
|
|
@@ -336386,7 +336459,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336386
336459
|
const linesToRender = buffer.viewportVisualLines;
|
|
336387
336460
|
const [cursorVisualRowAbsolute, cursorVisualColAbsolute] = buffer.visualCursor;
|
|
336388
336461
|
const scrollVisualRow = buffer.visualScrollRow;
|
|
336389
|
-
const getGhostTextLines = (0,
|
|
336462
|
+
const getGhostTextLines = (0, import_react93.useCallback)(() => {
|
|
336390
336463
|
if (!completion3.promptCompletion.text || !buffer.text || !completion3.promptCompletion.text.startsWith(buffer.text)) {
|
|
336391
336464
|
return { inlineGhost: "", additionalLines: [] };
|
|
336392
336465
|
}
|
|
@@ -336502,21 +336575,21 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336502
336575
|
statusColor = theme.status.warning;
|
|
336503
336576
|
statusText = "Accepting edits";
|
|
336504
336577
|
}
|
|
336505
|
-
return /* @__PURE__ */ (0,
|
|
336506
|
-
/* @__PURE__ */ (0,
|
|
336578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
336579
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
336507
336580
|
Box_default,
|
|
336508
336581
|
{
|
|
336509
336582
|
borderStyle: "round",
|
|
336510
336583
|
borderColor: isShellFocused && !isEmbeddedShellFocused ? statusColor ?? theme.border.focused : theme.border.default,
|
|
336511
336584
|
paddingX: 1,
|
|
336512
336585
|
children: [
|
|
336513
|
-
/* @__PURE__ */ (0,
|
|
336586
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
336514
336587
|
Text,
|
|
336515
336588
|
{
|
|
336516
336589
|
color: statusColor ?? theme.text.accent,
|
|
336517
336590
|
"aria-label": statusText || void 0,
|
|
336518
336591
|
children: [
|
|
336519
|
-
shellModeActive ? reverseSearchActive ? /* @__PURE__ */ (0,
|
|
336592
|
+
shellModeActive ? reverseSearchActive ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
336520
336593
|
Text,
|
|
336521
336594
|
{
|
|
336522
336595
|
color: theme.text.link,
|
|
@@ -336526,15 +336599,15 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336526
336599
|
" "
|
|
336527
336600
|
]
|
|
336528
336601
|
}
|
|
336529
|
-
) : "!" : commandSearchActive ? /* @__PURE__ */ (0,
|
|
336602
|
+
) : "!" : commandSearchActive ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { color: theme.text.accent, children: "(r:) " }) : showYoloStyling ? "*" : ">",
|
|
336530
336603
|
" "
|
|
336531
336604
|
]
|
|
336532
336605
|
}
|
|
336533
336606
|
),
|
|
336534
|
-
/* @__PURE__ */ (0,
|
|
336607
|
+
/* @__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)(Text, { children: [
|
|
336535
336608
|
import_chalk7.default.inverse(placeholder.slice(0, 1)),
|
|
336536
|
-
/* @__PURE__ */ (0,
|
|
336537
|
-
] }) : /* @__PURE__ */ (0,
|
|
336609
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { color: theme.text.secondary, children: placeholder.slice(1) })
|
|
336610
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { color: theme.text.secondary, children: placeholder }) : linesToRender.map((lineText, visualIdxInRenderedSet) => {
|
|
336538
336611
|
const absoluteVisualIdx = scrollVisualRow + visualIdxInRenderedSet;
|
|
336539
336612
|
const mapEntry = buffer.visualToLogicalMap[absoluteVisualIdx];
|
|
336540
336613
|
const cursorVisualRow = cursorVisualRowAbsolute - scrollVisualRow;
|
|
@@ -336581,22 +336654,22 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336581
336654
|
}
|
|
336582
336655
|
const color = seg.type === "command" || seg.type === "file" ? theme.text.accent : theme.text.primary;
|
|
336583
336656
|
renderedLine.push(
|
|
336584
|
-
/* @__PURE__ */ (0,
|
|
336657
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { color, children: display }, `token-${segIdx}`)
|
|
336585
336658
|
);
|
|
336586
336659
|
});
|
|
336587
336660
|
const currentLineGhost = isOnCursorLine ? inlineGhost : "";
|
|
336588
336661
|
if (isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText)) {
|
|
336589
336662
|
if (!currentLineGhost) {
|
|
336590
336663
|
renderedLine.push(
|
|
336591
|
-
/* @__PURE__ */ (0,
|
|
336664
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { children: showCursor ? import_chalk7.default.inverse(" ") : " " }, `cursor-end-${cursorVisualColAbsolute}`)
|
|
336592
336665
|
);
|
|
336593
336666
|
}
|
|
336594
336667
|
}
|
|
336595
336668
|
const showCursorBeforeGhost = focus && isOnCursorLine && cursorVisualColAbsolute === cpLen(lineText) && currentLineGhost;
|
|
336596
|
-
return /* @__PURE__ */ (0,
|
|
336669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Box_default, { height: 1, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Text, { children: [
|
|
336597
336670
|
renderedLine,
|
|
336598
336671
|
showCursorBeforeGhost && (showCursor ? import_chalk7.default.inverse(" ") : " "),
|
|
336599
|
-
currentLineGhost && /* @__PURE__ */ (0,
|
|
336672
|
+
currentLineGhost && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Text, { color: theme.text.secondary, children: currentLineGhost })
|
|
336600
336673
|
] }) }, `line-${visualIdxInRenderedSet}`);
|
|
336601
336674
|
}).concat(
|
|
336602
336675
|
additionalLines.map((ghostLine, index) => {
|
|
@@ -336604,7 +336677,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336604
336677
|
0,
|
|
336605
336678
|
inputWidth - stringWidth4(ghostLine)
|
|
336606
336679
|
);
|
|
336607
|
-
return /* @__PURE__ */ (0,
|
|
336680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
336608
336681
|
Text,
|
|
336609
336682
|
{
|
|
336610
336683
|
color: theme.text.secondary,
|
|
@@ -336620,7 +336693,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
336620
336693
|
]
|
|
336621
336694
|
}
|
|
336622
336695
|
),
|
|
336623
|
-
shouldShowSuggestions && /* @__PURE__ */ (0,
|
|
336696
|
+
shouldShowSuggestions && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Box_default, { paddingRight: 2, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
336624
336697
|
SuggestionsDisplay,
|
|
336625
336698
|
{
|
|
336626
336699
|
suggestions: activeCompletion.suggestions,
|
|
@@ -336642,7 +336715,7 @@ init_core2();
|
|
|
336642
336715
|
|
|
336643
336716
|
// packages/cli/src/ui/components/ConsoleSummaryDisplay.tsx
|
|
336644
336717
|
init_esbuild_shims();
|
|
336645
|
-
var
|
|
336718
|
+
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
336646
336719
|
var ConsoleSummaryDisplay = /* @__PURE__ */ __name(({
|
|
336647
336720
|
errorCount
|
|
336648
336721
|
}) => {
|
|
@@ -336650,14 +336723,14 @@ var ConsoleSummaryDisplay = /* @__PURE__ */ __name(({
|
|
|
336650
336723
|
return null;
|
|
336651
336724
|
}
|
|
336652
336725
|
const errorIcon = "\u2716";
|
|
336653
|
-
return /* @__PURE__ */ (0,
|
|
336726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Box_default, { children: errorCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Text, { color: theme.status.error, children: [
|
|
336654
336727
|
errorIcon,
|
|
336655
336728
|
" ",
|
|
336656
336729
|
errorCount,
|
|
336657
336730
|
" error",
|
|
336658
336731
|
errorCount > 1 ? "s" : "",
|
|
336659
336732
|
" ",
|
|
336660
|
-
/* @__PURE__ */ (0,
|
|
336733
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Text, { color: theme.text.secondary, children: "(ctrl+o for details)" })
|
|
336661
336734
|
] }) });
|
|
336662
336735
|
}, "ConsoleSummaryDisplay");
|
|
336663
336736
|
|
|
@@ -336666,15 +336739,15 @@ import process31 from "node:process";
|
|
|
336666
336739
|
|
|
336667
336740
|
// packages/cli/src/ui/components/MemoryUsageDisplay.tsx
|
|
336668
336741
|
init_esbuild_shims();
|
|
336669
|
-
var
|
|
336742
|
+
var import_react94 = __toESM(require_react(), 1);
|
|
336670
336743
|
import process30 from "node:process";
|
|
336671
|
-
var
|
|
336744
|
+
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
336672
336745
|
var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
|
|
336673
|
-
const [memoryUsage, setMemoryUsage] = (0,
|
|
336674
|
-
const [memoryUsageColor, setMemoryUsageColor] = (0,
|
|
336746
|
+
const [memoryUsage, setMemoryUsage] = (0, import_react94.useState)("");
|
|
336747
|
+
const [memoryUsageColor, setMemoryUsageColor] = (0, import_react94.useState)(
|
|
336675
336748
|
theme.text.secondary
|
|
336676
336749
|
);
|
|
336677
|
-
(0,
|
|
336750
|
+
(0, import_react94.useEffect)(() => {
|
|
336678
336751
|
const updateMemory = /* @__PURE__ */ __name(() => {
|
|
336679
336752
|
const usage2 = process30.memoryUsage().rss;
|
|
336680
336753
|
setMemoryUsage(formatMemoryUsage2(usage2));
|
|
@@ -336686,16 +336759,16 @@ var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
|
|
|
336686
336759
|
updateMemory();
|
|
336687
336760
|
return () => clearInterval(intervalId);
|
|
336688
336761
|
}, []);
|
|
336689
|
-
return /* @__PURE__ */ (0,
|
|
336690
|
-
/* @__PURE__ */ (0,
|
|
336691
|
-
/* @__PURE__ */ (0,
|
|
336762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(Box_default, { children: [
|
|
336763
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Text, { color: theme.text.secondary, children: " | " }),
|
|
336764
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Text, { color: memoryUsageColor, children: memoryUsage })
|
|
336692
336765
|
] });
|
|
336693
336766
|
}, "MemoryUsageDisplay");
|
|
336694
336767
|
|
|
336695
336768
|
// packages/cli/src/ui/components/ContextUsageDisplay.tsx
|
|
336696
336769
|
init_esbuild_shims();
|
|
336697
336770
|
init_core2();
|
|
336698
|
-
var
|
|
336771
|
+
var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
|
|
336699
336772
|
var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
336700
336773
|
promptTokenCount,
|
|
336701
336774
|
model,
|
|
@@ -336704,7 +336777,7 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
|
336704
336777
|
const percentage = promptTokenCount / tokenLimit(model);
|
|
336705
336778
|
const percentageLeft = ((1 - percentage) * 100).toFixed(0);
|
|
336706
336779
|
const label = terminalWidth < 100 ? "%" : "% context left";
|
|
336707
|
-
return /* @__PURE__ */ (0,
|
|
336780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
336708
336781
|
"(",
|
|
336709
336782
|
percentageLeft,
|
|
336710
336783
|
label,
|
|
@@ -336714,12 +336787,12 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
|
336714
336787
|
|
|
336715
336788
|
// packages/cli/src/ui/components/DebugProfiler.tsx
|
|
336716
336789
|
init_esbuild_shims();
|
|
336717
|
-
var
|
|
336718
|
-
var
|
|
336790
|
+
var import_react95 = __toESM(require_react(), 1);
|
|
336791
|
+
var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
|
|
336719
336792
|
var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
336720
|
-
const numRenders = (0,
|
|
336721
|
-
const [showNumRenders, setShowNumRenders] = (0,
|
|
336722
|
-
(0,
|
|
336793
|
+
const numRenders = (0, import_react95.useRef)(0);
|
|
336794
|
+
const [showNumRenders, setShowNumRenders] = (0, import_react95.useState)(false);
|
|
336795
|
+
(0, import_react95.useEffect)(() => {
|
|
336723
336796
|
numRenders.current++;
|
|
336724
336797
|
});
|
|
336725
336798
|
useKeypress(
|
|
@@ -336733,7 +336806,7 @@ var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
|
336733
336806
|
if (!showNumRenders) {
|
|
336734
336807
|
return null;
|
|
336735
336808
|
}
|
|
336736
|
-
return /* @__PURE__ */ (0,
|
|
336809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(Text, { color: theme.status.warning, children: [
|
|
336737
336810
|
"Renders: ",
|
|
336738
336811
|
numRenders.current,
|
|
336739
336812
|
" "
|
|
@@ -336741,7 +336814,7 @@ var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
|
336741
336814
|
}, "DebugProfiler");
|
|
336742
336815
|
|
|
336743
336816
|
// packages/cli/src/ui/components/Footer.tsx
|
|
336744
|
-
var
|
|
336817
|
+
var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
|
|
336745
336818
|
var Footer = /* @__PURE__ */ __name(() => {
|
|
336746
336819
|
const uiState = useUIState();
|
|
336747
336820
|
const config = useConfig();
|
|
@@ -336781,7 +336854,7 @@ var Footer = /* @__PURE__ */ __name(() => {
|
|
|
336781
336854
|
const displayPath = shortenPath(tildeifyPath(targetDir), pathLength);
|
|
336782
336855
|
const justifyContent = hideCWD && hideModelInfo ? "center" : "space-between";
|
|
336783
336856
|
const displayVimMode = vimEnabled ? vimMode : void 0;
|
|
336784
|
-
return /* @__PURE__ */ (0,
|
|
336857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
336785
336858
|
Box_default,
|
|
336786
336859
|
{
|
|
336787
336860
|
justifyContent,
|
|
@@ -336789,57 +336862,57 @@ var Footer = /* @__PURE__ */ __name(() => {
|
|
|
336789
336862
|
flexDirection: "row",
|
|
336790
336863
|
alignItems: "center",
|
|
336791
336864
|
children: [
|
|
336792
|
-
(debugMode || displayVimMode || !hideCWD) && /* @__PURE__ */ (0,
|
|
336793
|
-
debugMode && /* @__PURE__ */ (0,
|
|
336794
|
-
displayVimMode && /* @__PURE__ */ (0,
|
|
336865
|
+
(debugMode || displayVimMode || !hideCWD) && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { children: [
|
|
336866
|
+
debugMode && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(DebugProfiler, {}),
|
|
336867
|
+
displayVimMode && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
336795
336868
|
"[",
|
|
336796
336869
|
displayVimMode,
|
|
336797
336870
|
"] "
|
|
336798
336871
|
] }),
|
|
336799
|
-
!hideCWD && (nightly ? /* @__PURE__ */ (0,
|
|
336872
|
+
!hideCWD && (nightly ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(dist_default4, { colors: theme.ui.gradient, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { children: [
|
|
336800
336873
|
displayPath,
|
|
336801
|
-
branchName && /* @__PURE__ */ (0,
|
|
336874
|
+
branchName && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { children: [
|
|
336802
336875
|
" (",
|
|
336803
336876
|
branchName,
|
|
336804
336877
|
"*)"
|
|
336805
336878
|
] })
|
|
336806
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
336879
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { color: theme.text.link, children: [
|
|
336807
336880
|
displayPath,
|
|
336808
|
-
branchName && /* @__PURE__ */ (0,
|
|
336881
|
+
branchName && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
336809
336882
|
" (",
|
|
336810
336883
|
branchName,
|
|
336811
336884
|
"*)"
|
|
336812
336885
|
] })
|
|
336813
336886
|
] })),
|
|
336814
|
-
debugMode && /* @__PURE__ */ (0,
|
|
336887
|
+
debugMode && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.status.error, children: " " + (debugMessage || "--debug") })
|
|
336815
336888
|
] }),
|
|
336816
|
-
!hideSandboxStatus && /* @__PURE__ */ (0,
|
|
336889
|
+
!hideSandboxStatus && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
336817
336890
|
Box_default,
|
|
336818
336891
|
{
|
|
336819
336892
|
flexGrow: 1,
|
|
336820
336893
|
alignItems: "center",
|
|
336821
336894
|
justifyContent: "center",
|
|
336822
336895
|
display: "flex",
|
|
336823
|
-
children: isTrustedFolder === false ? /* @__PURE__ */ (0,
|
|
336896
|
+
children: isTrustedFolder === false ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.status.warning, children: "untrusted" }) : process31.env["SANDBOX"] && process31.env["SANDBOX"] !== "sandbox-exec" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: "green", children: process31.env["SANDBOX"].replace(/^gemini-(?:cli-)?/, "") }) : process31.env["SANDBOX"] === "sandbox-exec" ? /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { color: theme.status.warning, children: [
|
|
336824
336897
|
"macOS Seatbelt",
|
|
336825
336898
|
" ",
|
|
336826
|
-
/* @__PURE__ */ (0,
|
|
336899
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
336827
336900
|
"(",
|
|
336828
336901
|
process31.env["SEATBELT_PROFILE"],
|
|
336829
336902
|
")"
|
|
336830
336903
|
] })
|
|
336831
|
-
] }) : /* @__PURE__ */ (0,
|
|
336904
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { color: theme.status.error, children: [
|
|
336832
336905
|
"no sandbox",
|
|
336833
|
-
terminalWidth >= 100 && /* @__PURE__ */ (0,
|
|
336906
|
+
terminalWidth >= 100 && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.text.secondary, children: " (see /docs)" })
|
|
336834
336907
|
] })
|
|
336835
336908
|
}
|
|
336836
336909
|
),
|
|
336837
|
-
!hideModelInfo && /* @__PURE__ */ (0,
|
|
336838
|
-
/* @__PURE__ */ (0,
|
|
336839
|
-
/* @__PURE__ */ (0,
|
|
336910
|
+
!hideModelInfo && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { alignItems: "center", justifyContent: "flex-end", children: [
|
|
336911
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { alignItems: "center", children: [
|
|
336912
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { color: theme.text.accent, children: [
|
|
336840
336913
|
model,
|
|
336841
336914
|
" ",
|
|
336842
|
-
/* @__PURE__ */ (0,
|
|
336915
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
336843
336916
|
ContextUsageDisplay,
|
|
336844
336917
|
{
|
|
336845
336918
|
promptTokenCount,
|
|
@@ -336848,20 +336921,20 @@ var Footer = /* @__PURE__ */ __name(() => {
|
|
|
336848
336921
|
}
|
|
336849
336922
|
)
|
|
336850
336923
|
] }),
|
|
336851
|
-
showMemoryUsage && /* @__PURE__ */ (0,
|
|
336924
|
+
showMemoryUsage && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(MemoryUsageDisplay, {})
|
|
336852
336925
|
] }),
|
|
336853
|
-
/* @__PURE__ */ (0,
|
|
336854
|
-
corgiMode && /* @__PURE__ */ (0,
|
|
336855
|
-
/* @__PURE__ */ (0,
|
|
336856
|
-
/* @__PURE__ */ (0,
|
|
336857
|
-
/* @__PURE__ */ (0,
|
|
336858
|
-
/* @__PURE__ */ (0,
|
|
336859
|
-
/* @__PURE__ */ (0,
|
|
336860
|
-
/* @__PURE__ */ (0,
|
|
336926
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { alignItems: "center", paddingLeft: 2, children: [
|
|
336927
|
+
corgiMode && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Text, { children: [
|
|
336928
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.ui.symbol, children: "| " }),
|
|
336929
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.status.error, children: "\u25BC" }),
|
|
336930
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.text.primary, children: "(\xB4" }),
|
|
336931
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.status.error, children: "\u1D25" }),
|
|
336932
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.text.primary, children: "`)" }),
|
|
336933
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.status.error, children: "\u25BC " })
|
|
336861
336934
|
] }),
|
|
336862
|
-
!showErrorDetails && errorCount > 0 && /* @__PURE__ */ (0,
|
|
336863
|
-
/* @__PURE__ */ (0,
|
|
336864
|
-
/* @__PURE__ */ (0,
|
|
336935
|
+
!showErrorDetails && errorCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(Box_default, { children: [
|
|
336936
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Text, { color: theme.ui.symbol, children: "| " }),
|
|
336937
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ConsoleSummaryDisplay, { errorCount })
|
|
336865
336938
|
] })
|
|
336866
336939
|
] })
|
|
336867
336940
|
] })
|
|
@@ -336872,7 +336945,7 @@ var Footer = /* @__PURE__ */ __name(() => {
|
|
|
336872
336945
|
|
|
336873
336946
|
// packages/cli/src/ui/components/QueuedMessageDisplay.tsx
|
|
336874
336947
|
init_esbuild_shims();
|
|
336875
|
-
var
|
|
336948
|
+
var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
|
|
336876
336949
|
var MAX_DISPLAYED_QUEUED_MESSAGES = 3;
|
|
336877
336950
|
var QueuedMessageDisplay = /* @__PURE__ */ __name(({
|
|
336878
336951
|
messageQueue
|
|
@@ -336880,12 +336953,12 @@ var QueuedMessageDisplay = /* @__PURE__ */ __name(({
|
|
|
336880
336953
|
if (messageQueue.length === 0) {
|
|
336881
336954
|
return null;
|
|
336882
336955
|
}
|
|
336883
|
-
return /* @__PURE__ */ (0,
|
|
336956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
|
|
336884
336957
|
messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
|
|
336885
336958
|
const preview = message.replace(/\s+/g, " ");
|
|
336886
|
-
return /* @__PURE__ */ (0,
|
|
336959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Box_default, { paddingLeft: 2, width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Text, { dimColor: true, wrap: "truncate", children: preview }) }, index);
|
|
336887
336960
|
}),
|
|
336888
|
-
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ (0,
|
|
336961
|
+
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Box_default, { paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(Text, { dimColor: true, children: [
|
|
336889
336962
|
"... (+",
|
|
336890
336963
|
messageQueue.length - MAX_DISPLAYED_QUEUED_MESSAGES,
|
|
336891
336964
|
" more)"
|
|
@@ -336898,7 +336971,7 @@ init_core2();
|
|
|
336898
336971
|
|
|
336899
336972
|
// packages/cli/src/ui/components/ConfigInitDisplay.tsx
|
|
336900
336973
|
init_esbuild_shims();
|
|
336901
|
-
var
|
|
336974
|
+
var import_react96 = __toESM(require_react(), 1);
|
|
336902
336975
|
|
|
336903
336976
|
// packages/cli/src/utils/events.ts
|
|
336904
336977
|
init_esbuild_shims();
|
|
@@ -336907,11 +336980,11 @@ var appEvents = new EventEmitter8();
|
|
|
336907
336980
|
|
|
336908
336981
|
// packages/cli/src/ui/components/ConfigInitDisplay.tsx
|
|
336909
336982
|
init_core2();
|
|
336910
|
-
var
|
|
336983
|
+
var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
|
|
336911
336984
|
var ConfigInitDisplay = /* @__PURE__ */ __name(() => {
|
|
336912
336985
|
const config = useConfig();
|
|
336913
|
-
const [message, setMessage] = (0,
|
|
336914
|
-
(0,
|
|
336986
|
+
const [message, setMessage] = (0, import_react96.useState)("Initializing...");
|
|
336987
|
+
(0, import_react96.useEffect)(() => {
|
|
336915
336988
|
const onChange = /* @__PURE__ */ __name((clients) => {
|
|
336916
336989
|
if (!clients || clients.size === 0) {
|
|
336917
336990
|
setMessage(`Initializing...`);
|
|
@@ -336930,15 +337003,15 @@ var ConfigInitDisplay = /* @__PURE__ */ __name(() => {
|
|
|
336930
337003
|
appEvents.off("mcp-client-update", onChange);
|
|
336931
337004
|
};
|
|
336932
337005
|
}, [config]);
|
|
336933
|
-
return /* @__PURE__ */ (0,
|
|
336934
|
-
/* @__PURE__ */ (0,
|
|
337006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(Text, { children: [
|
|
337007
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(GeminiSpinner, {}),
|
|
336935
337008
|
" ",
|
|
336936
|
-
/* @__PURE__ */ (0,
|
|
337009
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Text, { color: theme.text.primary, children: message })
|
|
336937
337010
|
] }) });
|
|
336938
337011
|
}, "ConfigInitDisplay");
|
|
336939
337012
|
|
|
336940
337013
|
// packages/cli/src/ui/components/Composer.tsx
|
|
336941
|
-
var
|
|
337014
|
+
var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
|
|
336942
337015
|
var Composer = /* @__PURE__ */ __name(() => {
|
|
336943
337016
|
const config = useConfig();
|
|
336944
337017
|
const settings = useSettings();
|
|
@@ -336950,12 +337023,12 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
336950
337023
|
const isNarrow = isNarrowWidth(terminalWidth);
|
|
336951
337024
|
const debugConsoleMaxHeight = Math.floor(Math.max(terminalWidth * 0.2, 5));
|
|
336952
337025
|
const { contextFileNames, showAutoAcceptIndicator } = uiState;
|
|
336953
|
-
const { containerWidth } = (0,
|
|
337026
|
+
const { containerWidth } = (0, import_react97.useMemo)(
|
|
336954
337027
|
() => calculatePromptWidths(uiState.terminalWidth),
|
|
336955
337028
|
[uiState.terminalWidth]
|
|
336956
337029
|
);
|
|
336957
|
-
return /* @__PURE__ */ (0,
|
|
336958
|
-
!uiState.embeddedShellFocused && /* @__PURE__ */ (0,
|
|
337030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
337031
|
+
!uiState.embeddedShellFocused && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
336959
337032
|
LoadingIndicator,
|
|
336960
337033
|
{
|
|
336961
337034
|
thought: uiState.streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ || config.getAccessibility()?.disableLoadingPhrases ? void 0 : uiState.thought,
|
|
@@ -336963,9 +337036,9 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
336963
337036
|
elapsedTime: uiState.elapsedTime
|
|
336964
337037
|
}
|
|
336965
337038
|
),
|
|
336966
|
-
!uiState.isConfigInitialized && /* @__PURE__ */ (0,
|
|
336967
|
-
/* @__PURE__ */ (0,
|
|
336968
|
-
/* @__PURE__ */ (0,
|
|
337039
|
+
!uiState.isConfigInitialized && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ConfigInitDisplay, {}),
|
|
337040
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(QueuedMessageDisplay, { messageQueue: uiState.messageQueue }),
|
|
337041
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
336969
337042
|
Box_default,
|
|
336970
337043
|
{
|
|
336971
337044
|
marginTop: 1,
|
|
@@ -336974,9 +337047,9 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
336974
337047
|
flexDirection: isNarrow ? "column" : "row",
|
|
336975
337048
|
alignItems: isNarrow ? "flex-start" : "center",
|
|
336976
337049
|
children: [
|
|
336977
|
-
/* @__PURE__ */ (0,
|
|
336978
|
-
process.env["GEMINI_SYSTEM_MD"] && /* @__PURE__ */ (0,
|
|
336979
|
-
uiState.ctrlCPressedOnce ? /* @__PURE__ */ (0,
|
|
337050
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Box_default, { marginRight: 1, children: [
|
|
337051
|
+
process.env["GEMINI_SYSTEM_MD"] && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text, { color: theme.status.error, children: "|\u2310\u25A0_\u25A0| " }),
|
|
337052
|
+
uiState.ctrlCPressedOnce ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text, { color: theme.status.warning, children: "Press Ctrl+C again to exit." }) : uiState.ctrlDPressedOnce ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text, { color: theme.status.warning, children: "Press Ctrl+D again to exit." }) : uiState.showEscapePrompt ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Text, { color: theme.text.secondary, children: "Press Esc again to clear." }) : !settings.merged.ui?.hideContextSummary && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
336980
337053
|
ContextSummaryDisplay,
|
|
336981
337054
|
{
|
|
336982
337055
|
ideContext: uiState.ideContextState,
|
|
@@ -336988,15 +337061,15 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
336988
337061
|
}
|
|
336989
337062
|
)
|
|
336990
337063
|
] }),
|
|
336991
|
-
/* @__PURE__ */ (0,
|
|
336992
|
-
showAutoAcceptIndicator !== "default" /* DEFAULT */ && !uiState.shellModeActive && /* @__PURE__ */ (0,
|
|
336993
|
-
uiState.shellModeActive && /* @__PURE__ */ (0,
|
|
337064
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Box_default, { paddingTop: isNarrow ? 1 : 0, children: [
|
|
337065
|
+
showAutoAcceptIndicator !== "default" /* DEFAULT */ && !uiState.shellModeActive && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(AutoAcceptIndicator, { approvalMode: showAutoAcceptIndicator }),
|
|
337066
|
+
uiState.shellModeActive && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ShellModeIndicator, {})
|
|
336994
337067
|
] })
|
|
336995
337068
|
]
|
|
336996
337069
|
}
|
|
336997
337070
|
),
|
|
336998
|
-
uiState.showErrorDetails && /* @__PURE__ */ (0,
|
|
336999
|
-
/* @__PURE__ */ (0,
|
|
337071
|
+
uiState.showErrorDetails && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(OverflowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
337072
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
337000
337073
|
DetailedMessagesDisplay,
|
|
337001
337074
|
{
|
|
337002
337075
|
messages: uiState.filteredConsoleMessages,
|
|
@@ -337004,9 +337077,9 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
337004
337077
|
width: containerWidth
|
|
337005
337078
|
}
|
|
337006
337079
|
),
|
|
337007
|
-
/* @__PURE__ */ (0,
|
|
337080
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ShowMoreLines, { constrainHeight: uiState.constrainHeight })
|
|
337008
337081
|
] }) }),
|
|
337009
|
-
uiState.isInputActive && /* @__PURE__ */ (0,
|
|
337082
|
+
uiState.isInputActive && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
337010
337083
|
InputPrompt,
|
|
337011
337084
|
{
|
|
337012
337085
|
buffer: uiState.buffer,
|
|
@@ -337028,65 +337101,65 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
337028
337101
|
placeholder: vimEnabled ? " Press 'i' for INSERT mode and 'Esc' for NORMAL mode." : " Type your message or @path/to/file"
|
|
337029
337102
|
}
|
|
337030
337103
|
),
|
|
337031
|
-
!settings.merged.ui?.hideFooter && !isScreenReaderEnabled && /* @__PURE__ */ (0,
|
|
337104
|
+
!settings.merged.ui?.hideFooter && !isScreenReaderEnabled && /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(Footer, {})
|
|
337032
337105
|
] });
|
|
337033
337106
|
}, "Composer");
|
|
337034
337107
|
|
|
337035
337108
|
// packages/cli/src/ui/components/ExitWarning.tsx
|
|
337036
337109
|
init_esbuild_shims();
|
|
337037
|
-
var
|
|
337110
|
+
var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
|
|
337038
337111
|
var ExitWarning = /* @__PURE__ */ __name(() => {
|
|
337039
337112
|
const uiState = useUIState();
|
|
337040
|
-
return /* @__PURE__ */ (0,
|
|
337041
|
-
uiState.dialogsVisible && uiState.ctrlCPressedOnce && /* @__PURE__ */ (0,
|
|
337042
|
-
uiState.dialogsVisible && uiState.ctrlDPressedOnce && /* @__PURE__ */ (0,
|
|
337113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(import_jsx_runtime102.Fragment, { children: [
|
|
337114
|
+
uiState.dialogsVisible && uiState.ctrlCPressedOnce && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text, { color: theme.status.warning, children: "Press Ctrl+C again to exit." }) }),
|
|
337115
|
+
uiState.dialogsVisible && uiState.ctrlDPressedOnce && /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(Text, { color: theme.status.warning, children: "Press Ctrl+D again to exit." }) })
|
|
337043
337116
|
] });
|
|
337044
337117
|
}, "ExitWarning");
|
|
337045
337118
|
|
|
337046
337119
|
// packages/cli/src/ui/layouts/ScreenReaderAppLayout.tsx
|
|
337047
|
-
var
|
|
337120
|
+
var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
|
|
337048
337121
|
var ScreenReaderAppLayout = /* @__PURE__ */ __name(() => {
|
|
337049
337122
|
const uiState = useUIState();
|
|
337050
|
-
return /* @__PURE__ */ (0,
|
|
337051
|
-
/* @__PURE__ */ (0,
|
|
337052
|
-
/* @__PURE__ */ (0,
|
|
337053
|
-
/* @__PURE__ */ (0,
|
|
337054
|
-
uiState.dialogsVisible ? /* @__PURE__ */ (0,
|
|
337123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(Box_default, { flexDirection: "column", width: "90%", height: "100%", children: [
|
|
337124
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Notifications, {}),
|
|
337125
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Footer, {}),
|
|
337126
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Box_default, { flexGrow: 1, overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(MainContent, {}) }),
|
|
337127
|
+
uiState.dialogsVisible ? /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
|
|
337055
337128
|
DialogManager,
|
|
337056
337129
|
{
|
|
337057
337130
|
terminalWidth: uiState.terminalWidth,
|
|
337058
337131
|
addItem: uiState.historyManager.addItem
|
|
337059
337132
|
}
|
|
337060
|
-
) : /* @__PURE__ */ (0,
|
|
337061
|
-
/* @__PURE__ */ (0,
|
|
337133
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(Composer, {}),
|
|
337134
|
+
/* @__PURE__ */ (0, import_jsx_runtime103.jsx)(ExitWarning, {})
|
|
337062
337135
|
] });
|
|
337063
337136
|
}, "ScreenReaderAppLayout");
|
|
337064
337137
|
|
|
337065
337138
|
// packages/cli/src/ui/layouts/DefaultAppLayout.tsx
|
|
337066
337139
|
init_esbuild_shims();
|
|
337067
|
-
var
|
|
337140
|
+
var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
|
|
337068
337141
|
var DefaultAppLayout = /* @__PURE__ */ __name(({
|
|
337069
337142
|
width = "90%"
|
|
337070
337143
|
}) => {
|
|
337071
337144
|
const uiState = useUIState();
|
|
337072
|
-
return /* @__PURE__ */ (0,
|
|
337073
|
-
/* @__PURE__ */ (0,
|
|
337074
|
-
/* @__PURE__ */ (0,
|
|
337075
|
-
/* @__PURE__ */ (0,
|
|
337076
|
-
uiState.dialogsVisible ? /* @__PURE__ */ (0,
|
|
337145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(Box_default, { flexDirection: "column", width, children: [
|
|
337146
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(MainContent, {}),
|
|
337147
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(Box_default, { flexDirection: "column", ref: uiState.mainControlsRef, children: [
|
|
337148
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Notifications, {}),
|
|
337149
|
+
uiState.dialogsVisible ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
337077
337150
|
DialogManager,
|
|
337078
337151
|
{
|
|
337079
337152
|
terminalWidth: uiState.terminalWidth,
|
|
337080
337153
|
addItem: uiState.historyManager.addItem
|
|
337081
337154
|
}
|
|
337082
|
-
) : /* @__PURE__ */ (0,
|
|
337083
|
-
/* @__PURE__ */ (0,
|
|
337155
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Composer, {}),
|
|
337156
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(ExitWarning, {})
|
|
337084
337157
|
] })
|
|
337085
337158
|
] });
|
|
337086
337159
|
}, "DefaultAppLayout");
|
|
337087
337160
|
|
|
337088
337161
|
// packages/cli/src/ui/App.tsx
|
|
337089
|
-
var
|
|
337162
|
+
var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
|
|
337090
337163
|
var getContainerWidth = /* @__PURE__ */ __name((terminalWidth) => {
|
|
337091
337164
|
if (terminalWidth <= 80) {
|
|
337092
337165
|
return "98%";
|
|
@@ -337104,14 +337177,34 @@ var App2 = /* @__PURE__ */ __name(() => {
|
|
|
337104
337177
|
const { columns } = useTerminalSize();
|
|
337105
337178
|
const containerWidth = getContainerWidth(columns);
|
|
337106
337179
|
if (uiState.quittingMessages) {
|
|
337107
|
-
return /* @__PURE__ */ (0,
|
|
337180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(QuittingDisplay, {});
|
|
337108
337181
|
}
|
|
337109
|
-
return /* @__PURE__ */ (0,
|
|
337182
|
+
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 }) });
|
|
337110
337183
|
}, "App");
|
|
337111
337184
|
|
|
337112
337185
|
// packages/cli/src/ui/AppContainer.tsx
|
|
337113
337186
|
init_core2();
|
|
337114
337187
|
|
|
337188
|
+
// packages/cli/src/config/auth.ts
|
|
337189
|
+
init_esbuild_shims();
|
|
337190
|
+
init_core2();
|
|
337191
|
+
function validateAuthMethod(authMethod) {
|
|
337192
|
+
const settings = loadSettings();
|
|
337193
|
+
loadEnvironment(settings.merged);
|
|
337194
|
+
if (authMethod === "openai" /* USE_OPENAI */) {
|
|
337195
|
+
const hasApiKey = process.env["OPENAI_API_KEY"] || settings.merged.security?.auth?.apiKey;
|
|
337196
|
+
if (!hasApiKey) {
|
|
337197
|
+
return "OPENAI_API_KEY environment variable not found. You can enter it interactively or add it to your .env file.";
|
|
337198
|
+
}
|
|
337199
|
+
return null;
|
|
337200
|
+
}
|
|
337201
|
+
if (authMethod === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
337202
|
+
return null;
|
|
337203
|
+
}
|
|
337204
|
+
return "Invalid auth method selected.";
|
|
337205
|
+
}
|
|
337206
|
+
__name(validateAuthMethod, "validateAuthMethod");
|
|
337207
|
+
|
|
337115
337208
|
// packages/cli/src/config/config.ts
|
|
337116
337209
|
init_esbuild_shims();
|
|
337117
337210
|
|
|
@@ -343016,7 +343109,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
343016
343109
|
// packages/cli/src/utils/version.ts
|
|
343017
343110
|
async function getCliVersion() {
|
|
343018
343111
|
const pkgJson = await getPackageJson();
|
|
343019
|
-
return "0.0.
|
|
343112
|
+
return "0.0.28-alpha.0";
|
|
343020
343113
|
}
|
|
343021
343114
|
__name(getCliVersion, "getCliVersion");
|
|
343022
343115
|
|
|
@@ -344064,12 +344157,12 @@ import process50 from "node:process";
|
|
|
344064
344157
|
|
|
344065
344158
|
// packages/cli/src/ui/hooks/useMemoryMonitor.ts
|
|
344066
344159
|
init_esbuild_shims();
|
|
344067
|
-
var
|
|
344160
|
+
var import_react98 = __toESM(require_react(), 1);
|
|
344068
344161
|
import process33 from "node:process";
|
|
344069
344162
|
var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
|
|
344070
344163
|
var MEMORY_CHECK_INTERVAL = 60 * 1e3;
|
|
344071
344164
|
var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
344072
|
-
(0,
|
|
344165
|
+
(0, import_react98.useEffect)(() => {
|
|
344073
344166
|
const intervalId = setInterval(() => {
|
|
344074
344167
|
const usage2 = process33.memoryUsage().rss;
|
|
344075
344168
|
if (usage2 > MEMORY_WARNING_THRESHOLD) {
|
|
@@ -344089,11 +344182,11 @@ var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
|
344089
344182
|
|
|
344090
344183
|
// packages/cli/src/ui/hooks/useThemeCommand.ts
|
|
344091
344184
|
init_esbuild_shims();
|
|
344092
|
-
var
|
|
344185
|
+
var import_react99 = __toESM(require_react(), 1);
|
|
344093
344186
|
import process34 from "node:process";
|
|
344094
344187
|
var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, addItem, initialThemeError) => {
|
|
344095
|
-
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0,
|
|
344096
|
-
const openThemeDialog = (0,
|
|
344188
|
+
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react99.useState)(!!initialThemeError);
|
|
344189
|
+
const openThemeDialog = (0, import_react99.useCallback)(() => {
|
|
344097
344190
|
if (process34.env["NO_COLOR"]) {
|
|
344098
344191
|
addItem(
|
|
344099
344192
|
{
|
|
@@ -344106,7 +344199,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
344106
344199
|
}
|
|
344107
344200
|
setIsThemeDialogOpen(true);
|
|
344108
344201
|
}, [addItem]);
|
|
344109
|
-
const applyTheme = (0,
|
|
344202
|
+
const applyTheme = (0, import_react99.useCallback)(
|
|
344110
344203
|
(themeName) => {
|
|
344111
344204
|
if (!themeManager.setActiveTheme(themeName)) {
|
|
344112
344205
|
setIsThemeDialogOpen(true);
|
|
@@ -344117,13 +344210,13 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
344117
344210
|
},
|
|
344118
344211
|
[setThemeError]
|
|
344119
344212
|
);
|
|
344120
|
-
const handleThemeHighlight = (0,
|
|
344213
|
+
const handleThemeHighlight = (0, import_react99.useCallback)(
|
|
344121
344214
|
(themeName) => {
|
|
344122
344215
|
applyTheme(themeName);
|
|
344123
344216
|
},
|
|
344124
344217
|
[applyTheme]
|
|
344125
344218
|
);
|
|
344126
|
-
const handleThemeSelect = (0,
|
|
344219
|
+
const handleThemeSelect = (0, import_react99.useCallback)(
|
|
344127
344220
|
(themeName, scope) => {
|
|
344128
344221
|
try {
|
|
344129
344222
|
const mergedCustomThemes = {
|
|
@@ -344161,17 +344254,73 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
344161
344254
|
init_esbuild_shims();
|
|
344162
344255
|
var import_react101 = __toESM(require_react(), 1);
|
|
344163
344256
|
init_core2();
|
|
344164
|
-
|
|
344165
|
-
|
|
344166
|
-
|
|
344167
|
-
|
|
344168
|
-
|
|
344169
|
-
|
|
344170
|
-
|
|
344171
|
-
|
|
344172
|
-
|
|
344173
|
-
|
|
344174
|
-
|
|
344257
|
+
|
|
344258
|
+
// packages/cli/src/ui/hooks/useQwenAuth.ts
|
|
344259
|
+
init_esbuild_shims();
|
|
344260
|
+
var import_react100 = __toESM(require_react(), 1);
|
|
344261
|
+
init_core2();
|
|
344262
|
+
var useQwenAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
344263
|
+
const [qwenAuthState, setQwenAuthState] = (0, import_react100.useState)({
|
|
344264
|
+
deviceAuth: null,
|
|
344265
|
+
authStatus: "idle",
|
|
344266
|
+
authMessage: null
|
|
344267
|
+
});
|
|
344268
|
+
const isQwenAuth = pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */;
|
|
344269
|
+
(0, import_react100.useEffect)(() => {
|
|
344270
|
+
if (!isQwenAuth || !isAuthenticating) {
|
|
344271
|
+
setQwenAuthState({
|
|
344272
|
+
deviceAuth: null,
|
|
344273
|
+
authStatus: "idle",
|
|
344274
|
+
authMessage: null
|
|
344275
|
+
});
|
|
344276
|
+
return;
|
|
344277
|
+
}
|
|
344278
|
+
setQwenAuthState((prev) => ({
|
|
344279
|
+
...prev,
|
|
344280
|
+
authStatus: "idle"
|
|
344281
|
+
}));
|
|
344282
|
+
const handleDeviceAuth = /* @__PURE__ */ __name((deviceAuth) => {
|
|
344283
|
+
setQwenAuthState((prev) => ({
|
|
344284
|
+
...prev,
|
|
344285
|
+
deviceAuth: {
|
|
344286
|
+
verification_uri: deviceAuth.verification_uri,
|
|
344287
|
+
verification_uri_complete: deviceAuth.verification_uri_complete,
|
|
344288
|
+
user_code: deviceAuth.user_code,
|
|
344289
|
+
expires_in: deviceAuth.expires_in,
|
|
344290
|
+
device_code: deviceAuth.device_code
|
|
344291
|
+
},
|
|
344292
|
+
authStatus: "polling"
|
|
344293
|
+
}));
|
|
344294
|
+
}, "handleDeviceAuth");
|
|
344295
|
+
const handleAuthProgress = /* @__PURE__ */ __name((status, message) => {
|
|
344296
|
+
setQwenAuthState((prev) => ({
|
|
344297
|
+
...prev,
|
|
344298
|
+
authStatus: status,
|
|
344299
|
+
authMessage: message || null
|
|
344300
|
+
}));
|
|
344301
|
+
}, "handleAuthProgress");
|
|
344302
|
+
qwenOAuth2Events.on("auth-uri" /* AuthUri */, handleDeviceAuth);
|
|
344303
|
+
qwenOAuth2Events.on("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
344304
|
+
return () => {
|
|
344305
|
+
qwenOAuth2Events.off("auth-uri" /* AuthUri */, handleDeviceAuth);
|
|
344306
|
+
qwenOAuth2Events.off("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
344307
|
+
};
|
|
344308
|
+
}, [isQwenAuth, isAuthenticating]);
|
|
344309
|
+
const cancelQwenAuth = (0, import_react100.useCallback)(() => {
|
|
344310
|
+
qwenOAuth2Events.emit("auth-cancel" /* AuthCancel */);
|
|
344311
|
+
setQwenAuthState({
|
|
344312
|
+
deviceAuth: null,
|
|
344313
|
+
authStatus: "idle",
|
|
344314
|
+
authMessage: null
|
|
344315
|
+
});
|
|
344316
|
+
}, []);
|
|
344317
|
+
return {
|
|
344318
|
+
qwenAuthState,
|
|
344319
|
+
cancelQwenAuth
|
|
344320
|
+
};
|
|
344321
|
+
}, "useQwenAuth");
|
|
344322
|
+
|
|
344323
|
+
// packages/cli/src/ui/auth/useAuth.ts
|
|
344175
344324
|
var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
344176
344325
|
const unAuthenticated = settings.merged.security?.auth?.selectedType === void 0;
|
|
344177
344326
|
const [authState, setAuthState] = (0, import_react101.useState)(
|
|
@@ -344180,6 +344329,13 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
344180
344329
|
const [authError, setAuthError] = (0, import_react101.useState)(null);
|
|
344181
344330
|
const [isAuthenticating, setIsAuthenticating] = (0, import_react101.useState)(false);
|
|
344182
344331
|
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0, import_react101.useState)(unAuthenticated);
|
|
344332
|
+
const [pendingAuthType, setPendingAuthType] = (0, import_react101.useState)(
|
|
344333
|
+
void 0
|
|
344334
|
+
);
|
|
344335
|
+
const { qwenAuthState, cancelQwenAuth } = useQwenAuth(
|
|
344336
|
+
pendingAuthType,
|
|
344337
|
+
isAuthenticating
|
|
344338
|
+
);
|
|
344183
344339
|
const onAuthError = (0, import_react101.useCallback)(
|
|
344184
344340
|
(error) => {
|
|
344185
344341
|
setAuthError(error);
|
|
@@ -344190,75 +344346,123 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
344190
344346
|
},
|
|
344191
344347
|
[setAuthError, setAuthState]
|
|
344192
344348
|
);
|
|
344193
|
-
(0, import_react101.
|
|
344194
|
-
|
|
344195
|
-
|
|
344196
|
-
|
|
344197
|
-
|
|
344198
|
-
|
|
344199
|
-
|
|
344200
|
-
|
|
344201
|
-
|
|
344202
|
-
|
|
344203
|
-
|
|
344204
|
-
|
|
344205
|
-
|
|
344206
|
-
}
|
|
344207
|
-
try {
|
|
344208
|
-
setIsAuthenticating(true);
|
|
344209
|
-
await config.refreshAuth(authType);
|
|
344210
|
-
console.log(`Authenticated via "${authType}".`);
|
|
344211
|
-
setAuthError(null);
|
|
344212
|
-
setAuthState("authenticated" /* Authenticated */);
|
|
344213
|
-
} catch (e2) {
|
|
344214
|
-
onAuthError(`Failed to login. Message: ${getErrorMessage(e2)}`);
|
|
344215
|
-
} finally {
|
|
344216
|
-
setIsAuthenticating(false);
|
|
344349
|
+
const handleAuthFailure = (0, import_react101.useCallback)(
|
|
344350
|
+
(error) => {
|
|
344351
|
+
setIsAuthenticating(false);
|
|
344352
|
+
const errorMessage = `Failed to authenticate. Message: ${getErrorMessage(error)}`;
|
|
344353
|
+
onAuthError(errorMessage);
|
|
344354
|
+
if (pendingAuthType) {
|
|
344355
|
+
const authEvent = new AuthEvent(
|
|
344356
|
+
pendingAuthType,
|
|
344357
|
+
"manual",
|
|
344358
|
+
"error",
|
|
344359
|
+
errorMessage
|
|
344360
|
+
);
|
|
344361
|
+
logAuth(config, authEvent);
|
|
344217
344362
|
}
|
|
344218
|
-
},
|
|
344219
|
-
|
|
344220
|
-
|
|
344221
|
-
const
|
|
344363
|
+
},
|
|
344364
|
+
[onAuthError, pendingAuthType, config]
|
|
344365
|
+
);
|
|
344366
|
+
const handleAuthSuccess = (0, import_react101.useCallback)(
|
|
344222
344367
|
async (authType, scope, credentials) => {
|
|
344223
|
-
|
|
344224
|
-
|
|
344225
|
-
if (credentials) {
|
|
344226
|
-
|
|
344227
|
-
apiKey: credentials.apiKey,
|
|
344228
|
-
baseUrl: credentials.baseUrl,
|
|
344229
|
-
model: credentials.model
|
|
344230
|
-
});
|
|
344231
|
-
if (credentials.apiKey) {
|
|
344368
|
+
try {
|
|
344369
|
+
settings.setValue(scope, "security.auth.selectedType", authType);
|
|
344370
|
+
if (authType !== "qwen-oauth" /* QWEN_OAUTH */ && credentials) {
|
|
344371
|
+
if (credentials?.apiKey != null) {
|
|
344232
344372
|
settings.setValue(
|
|
344233
344373
|
scope,
|
|
344234
344374
|
"security.auth.apiKey",
|
|
344235
344375
|
credentials.apiKey
|
|
344236
344376
|
);
|
|
344237
344377
|
}
|
|
344238
|
-
if (credentials
|
|
344378
|
+
if (credentials?.baseUrl != null) {
|
|
344239
344379
|
settings.setValue(
|
|
344240
344380
|
scope,
|
|
344241
344381
|
"security.auth.baseUrl",
|
|
344242
344382
|
credentials.baseUrl
|
|
344243
344383
|
);
|
|
344244
344384
|
}
|
|
344245
|
-
if (credentials
|
|
344385
|
+
if (credentials?.model != null) {
|
|
344246
344386
|
settings.setValue(scope, "model.name", credentials.model);
|
|
344247
344387
|
}
|
|
344388
|
+
await clearCachedCredentialFile();
|
|
344248
344389
|
}
|
|
344249
|
-
|
|
344390
|
+
} catch (error) {
|
|
344391
|
+
handleAuthFailure(error);
|
|
344392
|
+
return;
|
|
344250
344393
|
}
|
|
344394
|
+
setAuthError(null);
|
|
344395
|
+
setAuthState("authenticated" /* Authenticated */);
|
|
344396
|
+
setPendingAuthType(void 0);
|
|
344251
344397
|
setIsAuthDialogOpen(false);
|
|
344398
|
+
setIsAuthenticating(false);
|
|
344399
|
+
const authEvent = new AuthEvent(authType, "manual", "success");
|
|
344400
|
+
logAuth(config, authEvent);
|
|
344401
|
+
},
|
|
344402
|
+
[settings, handleAuthFailure, config]
|
|
344403
|
+
);
|
|
344404
|
+
const performAuth = (0, import_react101.useCallback)(
|
|
344405
|
+
async (authType, scope, credentials) => {
|
|
344406
|
+
try {
|
|
344407
|
+
await config.refreshAuth(authType);
|
|
344408
|
+
handleAuthSuccess(authType, scope, credentials);
|
|
344409
|
+
} catch (e2) {
|
|
344410
|
+
handleAuthFailure(e2);
|
|
344411
|
+
}
|
|
344412
|
+
},
|
|
344413
|
+
[config, handleAuthSuccess, handleAuthFailure]
|
|
344414
|
+
);
|
|
344415
|
+
const handleAuthSelect = (0, import_react101.useCallback)(
|
|
344416
|
+
async (authType, scope, credentials) => {
|
|
344417
|
+
if (!authType) {
|
|
344418
|
+
setIsAuthDialogOpen(false);
|
|
344419
|
+
setAuthError(null);
|
|
344420
|
+
return;
|
|
344421
|
+
}
|
|
344422
|
+
setPendingAuthType(authType);
|
|
344252
344423
|
setAuthError(null);
|
|
344424
|
+
setIsAuthDialogOpen(false);
|
|
344425
|
+
setIsAuthenticating(true);
|
|
344426
|
+
if (authType === "openai" /* USE_OPENAI */) {
|
|
344427
|
+
if (credentials) {
|
|
344428
|
+
config.updateCredentials({
|
|
344429
|
+
apiKey: credentials.apiKey,
|
|
344430
|
+
baseUrl: credentials.baseUrl,
|
|
344431
|
+
model: credentials.model
|
|
344432
|
+
});
|
|
344433
|
+
await performAuth(authType, scope, credentials);
|
|
344434
|
+
}
|
|
344435
|
+
return;
|
|
344436
|
+
}
|
|
344437
|
+
await performAuth(authType, scope);
|
|
344253
344438
|
},
|
|
344254
|
-
[
|
|
344439
|
+
[config, performAuth]
|
|
344255
344440
|
);
|
|
344256
344441
|
const openAuthDialog = (0, import_react101.useCallback)(() => {
|
|
344257
344442
|
setIsAuthDialogOpen(true);
|
|
344258
344443
|
}, []);
|
|
344259
344444
|
const cancelAuthentication = (0, import_react101.useCallback)(() => {
|
|
344445
|
+
if (isAuthenticating && pendingAuthType === "qwen-oauth" /* QWEN_OAUTH */) {
|
|
344446
|
+
cancelQwenAuth();
|
|
344447
|
+
}
|
|
344448
|
+
if (isAuthenticating && pendingAuthType) {
|
|
344449
|
+
const authEvent = new AuthEvent(pendingAuthType, "manual", "cancelled");
|
|
344450
|
+
logAuth(config, authEvent);
|
|
344451
|
+
}
|
|
344260
344452
|
setIsAuthenticating(false);
|
|
344261
|
-
|
|
344453
|
+
setIsAuthDialogOpen(true);
|
|
344454
|
+
setAuthError(null);
|
|
344455
|
+
}, [isAuthenticating, pendingAuthType, cancelQwenAuth, config]);
|
|
344456
|
+
(0, import_react101.useEffect)(() => {
|
|
344457
|
+
const defaultAuthType = process.env["QWEN_DEFAULT_AUTH_TYPE"];
|
|
344458
|
+
if (defaultAuthType && !["qwen-oauth" /* QWEN_OAUTH */, "openai" /* USE_OPENAI */].includes(
|
|
344459
|
+
defaultAuthType
|
|
344460
|
+
)) {
|
|
344461
|
+
onAuthError(
|
|
344462
|
+
`Invalid QWEN_DEFAULT_AUTH_TYPE value: "${defaultAuthType}". Valid values are: ${["qwen-oauth" /* QWEN_OAUTH */, "openai" /* USE_OPENAI */].join(", ")}`
|
|
344463
|
+
);
|
|
344464
|
+
}
|
|
344465
|
+
}, [onAuthError]);
|
|
344262
344466
|
return {
|
|
344263
344467
|
authState,
|
|
344264
344468
|
setAuthState,
|
|
@@ -344266,85 +344470,18 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config) => {
|
|
|
344266
344470
|
onAuthError,
|
|
344267
344471
|
isAuthDialogOpen,
|
|
344268
344472
|
isAuthenticating,
|
|
344473
|
+
pendingAuthType,
|
|
344474
|
+
qwenAuthState,
|
|
344269
344475
|
handleAuthSelect,
|
|
344270
344476
|
openAuthDialog,
|
|
344271
344477
|
cancelAuthentication
|
|
344272
344478
|
};
|
|
344273
344479
|
}, "useAuthCommand");
|
|
344274
344480
|
|
|
344275
|
-
// packages/cli/src/ui/hooks/useQwenAuth.ts
|
|
344276
|
-
init_esbuild_shims();
|
|
344277
|
-
var import_react102 = __toESM(require_react(), 1);
|
|
344278
|
-
init_core2();
|
|
344279
|
-
var useQwenAuth = /* @__PURE__ */ __name((settings, isAuthenticating) => {
|
|
344280
|
-
const [qwenAuthState, setQwenAuthState] = (0, import_react102.useState)({
|
|
344281
|
-
isQwenAuthenticating: false,
|
|
344282
|
-
deviceAuth: null,
|
|
344283
|
-
authStatus: "idle",
|
|
344284
|
-
authMessage: null
|
|
344285
|
-
});
|
|
344286
|
-
const isQwenAuth = settings.merged.security?.auth?.selectedType === "qwen-oauth" /* QWEN_OAUTH */;
|
|
344287
|
-
(0, import_react102.useEffect)(() => {
|
|
344288
|
-
if (!isQwenAuth || !isAuthenticating) {
|
|
344289
|
-
setQwenAuthState({
|
|
344290
|
-
isQwenAuthenticating: false,
|
|
344291
|
-
deviceAuth: null,
|
|
344292
|
-
authStatus: "idle",
|
|
344293
|
-
authMessage: null
|
|
344294
|
-
});
|
|
344295
|
-
return;
|
|
344296
|
-
}
|
|
344297
|
-
setQwenAuthState((prev) => ({
|
|
344298
|
-
...prev,
|
|
344299
|
-
isQwenAuthenticating: true,
|
|
344300
|
-
authStatus: "idle"
|
|
344301
|
-
}));
|
|
344302
|
-
const handleDeviceAuth = /* @__PURE__ */ __name((deviceAuth) => {
|
|
344303
|
-
setQwenAuthState((prev) => ({
|
|
344304
|
-
...prev,
|
|
344305
|
-
deviceAuth: {
|
|
344306
|
-
verification_uri: deviceAuth.verification_uri,
|
|
344307
|
-
verification_uri_complete: deviceAuth.verification_uri_complete,
|
|
344308
|
-
user_code: deviceAuth.user_code,
|
|
344309
|
-
expires_in: deviceAuth.expires_in
|
|
344310
|
-
},
|
|
344311
|
-
authStatus: "polling"
|
|
344312
|
-
}));
|
|
344313
|
-
}, "handleDeviceAuth");
|
|
344314
|
-
const handleAuthProgress = /* @__PURE__ */ __name((status, message) => {
|
|
344315
|
-
setQwenAuthState((prev) => ({
|
|
344316
|
-
...prev,
|
|
344317
|
-
authStatus: status,
|
|
344318
|
-
authMessage: message || null
|
|
344319
|
-
}));
|
|
344320
|
-
}, "handleAuthProgress");
|
|
344321
|
-
qwenOAuth2Events.on("auth-uri" /* AuthUri */, handleDeviceAuth);
|
|
344322
|
-
qwenOAuth2Events.on("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
344323
|
-
return () => {
|
|
344324
|
-
qwenOAuth2Events.off("auth-uri" /* AuthUri */, handleDeviceAuth);
|
|
344325
|
-
qwenOAuth2Events.off("auth-progress" /* AuthProgress */, handleAuthProgress);
|
|
344326
|
-
};
|
|
344327
|
-
}, [isQwenAuth, isAuthenticating]);
|
|
344328
|
-
const cancelQwenAuth = (0, import_react102.useCallback)(() => {
|
|
344329
|
-
qwenOAuth2Events.emit("auth-cancel" /* AuthCancel */);
|
|
344330
|
-
setQwenAuthState({
|
|
344331
|
-
isQwenAuthenticating: false,
|
|
344332
|
-
deviceAuth: null,
|
|
344333
|
-
authStatus: "idle",
|
|
344334
|
-
authMessage: null
|
|
344335
|
-
});
|
|
344336
|
-
}, []);
|
|
344337
|
-
return {
|
|
344338
|
-
...qwenAuthState,
|
|
344339
|
-
isQwenAuth,
|
|
344340
|
-
cancelQwenAuth
|
|
344341
|
-
};
|
|
344342
|
-
}, "useQwenAuth");
|
|
344343
|
-
|
|
344344
344481
|
// packages/cli/src/ui/hooks/useQuotaAndFallback.ts
|
|
344345
344482
|
init_esbuild_shims();
|
|
344346
344483
|
init_core2();
|
|
344347
|
-
var
|
|
344484
|
+
var import_react102 = __toESM(require_react(), 1);
|
|
344348
344485
|
function useQuotaAndFallback({
|
|
344349
344486
|
config,
|
|
344350
344487
|
historyManager,
|
|
@@ -344352,9 +344489,9 @@ function useQuotaAndFallback({
|
|
|
344352
344489
|
setAuthState,
|
|
344353
344490
|
setModelSwitchedFromQuotaError
|
|
344354
344491
|
}) {
|
|
344355
|
-
const [proQuotaRequest, setProQuotaRequest] = (0,
|
|
344356
|
-
const isDialogPending = (0,
|
|
344357
|
-
(0,
|
|
344492
|
+
const [proQuotaRequest, setProQuotaRequest] = (0, import_react102.useState)(null);
|
|
344493
|
+
const isDialogPending = (0, import_react102.useRef)(false);
|
|
344494
|
+
(0, import_react102.useEffect)(() => {
|
|
344358
344495
|
const fallbackHandler = /* @__PURE__ */ __name(async (failedModel, fallbackModel, error) => {
|
|
344359
344496
|
if (config.isInFallbackMode()) {
|
|
344360
344497
|
return null;
|
|
@@ -344432,7 +344569,7 @@ function useQuotaAndFallback({
|
|
|
344432
344569
|
}, "fallbackHandler");
|
|
344433
344570
|
config.setFallbackModelHandler(fallbackHandler);
|
|
344434
344571
|
}, [config, historyManager, userTier, setModelSwitchedFromQuotaError]);
|
|
344435
|
-
const handleProQuotaChoice = (0,
|
|
344572
|
+
const handleProQuotaChoice = (0, import_react102.useCallback)(
|
|
344436
344573
|
(choice2) => {
|
|
344437
344574
|
if (!proQuotaRequest) return;
|
|
344438
344575
|
const intent = choice2 === "auth" ? "auth" : "retry";
|
|
@@ -344462,14 +344599,14 @@ __name(useQuotaAndFallback, "useQuotaAndFallback");
|
|
|
344462
344599
|
|
|
344463
344600
|
// packages/cli/src/ui/hooks/useEditorSettings.ts
|
|
344464
344601
|
init_esbuild_shims();
|
|
344465
|
-
var
|
|
344602
|
+
var import_react103 = __toESM(require_react(), 1);
|
|
344466
344603
|
init_core2();
|
|
344467
344604
|
var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError, addItem) => {
|
|
344468
|
-
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0,
|
|
344469
|
-
const openEditorDialog = (0,
|
|
344605
|
+
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react103.useState)(false);
|
|
344606
|
+
const openEditorDialog = (0, import_react103.useCallback)(() => {
|
|
344470
344607
|
setIsEditorDialogOpen(true);
|
|
344471
344608
|
}, []);
|
|
344472
|
-
const handleEditorSelect = (0,
|
|
344609
|
+
const handleEditorSelect = (0, import_react103.useCallback)(
|
|
344473
344610
|
(editorType, scope) => {
|
|
344474
344611
|
if (editorType && (!checkHasEditorType(editorType) || !allowEditorTypeInSandbox(editorType))) {
|
|
344475
344612
|
return;
|
|
@@ -344491,7 +344628,7 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
344491
344628
|
},
|
|
344492
344629
|
[loadedSettings, setEditorError, addItem]
|
|
344493
344630
|
);
|
|
344494
|
-
const exitEditorDialog = (0,
|
|
344631
|
+
const exitEditorDialog = (0, import_react103.useCallback)(() => {
|
|
344495
344632
|
setIsEditorDialogOpen(false);
|
|
344496
344633
|
}, []);
|
|
344497
344634
|
return {
|
|
@@ -344504,13 +344641,13 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
344504
344641
|
|
|
344505
344642
|
// packages/cli/src/ui/hooks/useSettingsCommand.ts
|
|
344506
344643
|
init_esbuild_shims();
|
|
344507
|
-
var
|
|
344644
|
+
var import_react104 = __toESM(require_react(), 1);
|
|
344508
344645
|
function useSettingsCommand() {
|
|
344509
|
-
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0,
|
|
344510
|
-
const openSettingsDialog = (0,
|
|
344646
|
+
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react104.useState)(false);
|
|
344647
|
+
const openSettingsDialog = (0, import_react104.useCallback)(() => {
|
|
344511
344648
|
setIsSettingsDialogOpen(true);
|
|
344512
344649
|
}, []);
|
|
344513
|
-
const closeSettingsDialog = (0,
|
|
344650
|
+
const closeSettingsDialog = (0, import_react104.useCallback)(() => {
|
|
344514
344651
|
setIsSettingsDialogOpen(false);
|
|
344515
344652
|
}, []);
|
|
344516
344653
|
return {
|
|
@@ -344523,13 +344660,13 @@ __name(useSettingsCommand, "useSettingsCommand");
|
|
|
344523
344660
|
|
|
344524
344661
|
// packages/cli/src/ui/hooks/useModelCommand.ts
|
|
344525
344662
|
init_esbuild_shims();
|
|
344526
|
-
var
|
|
344663
|
+
var import_react105 = __toESM(require_react(), 1);
|
|
344527
344664
|
var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
344528
|
-
const [isModelDialogOpen, setIsModelDialogOpen] = (0,
|
|
344529
|
-
const openModelDialog = (0,
|
|
344665
|
+
const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react105.useState)(false);
|
|
344666
|
+
const openModelDialog = (0, import_react105.useCallback)(() => {
|
|
344530
344667
|
setIsModelDialogOpen(true);
|
|
344531
344668
|
}, []);
|
|
344532
|
-
const closeModelDialog = (0,
|
|
344669
|
+
const closeModelDialog = (0, import_react105.useCallback)(() => {
|
|
344533
344670
|
setIsModelDialogOpen(false);
|
|
344534
344671
|
}, []);
|
|
344535
344672
|
return {
|
|
@@ -344541,13 +344678,13 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
|
344541
344678
|
|
|
344542
344679
|
// packages/cli/src/ui/hooks/useApprovalModeCommand.ts
|
|
344543
344680
|
init_esbuild_shims();
|
|
344544
|
-
var
|
|
344681
|
+
var import_react106 = __toESM(require_react(), 1);
|
|
344545
344682
|
var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) => {
|
|
344546
|
-
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0,
|
|
344547
|
-
const openApprovalModeDialog = (0,
|
|
344683
|
+
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react106.useState)(false);
|
|
344684
|
+
const openApprovalModeDialog = (0, import_react106.useCallback)(() => {
|
|
344548
344685
|
setIsApprovalModeDialogOpen(true);
|
|
344549
344686
|
}, []);
|
|
344550
|
-
const handleApprovalModeSelect = (0,
|
|
344687
|
+
const handleApprovalModeSelect = (0, import_react106.useCallback)(
|
|
344551
344688
|
(mode, scope) => {
|
|
344552
344689
|
try {
|
|
344553
344690
|
if (!mode) {
|
|
@@ -344573,7 +344710,7 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) =>
|
|
|
344573
344710
|
|
|
344574
344711
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
344575
344712
|
init_esbuild_shims();
|
|
344576
|
-
var
|
|
344713
|
+
var import_react109 = __toESM(require_react(), 1);
|
|
344577
344714
|
|
|
344578
344715
|
// packages/cli/node_modules/@google/genai/dist/node/index.mjs
|
|
344579
344716
|
init_esbuild_shims();
|
|
@@ -345049,7 +345186,7 @@ init_core2();
|
|
|
345049
345186
|
|
|
345050
345187
|
// packages/cli/src/generated/git-commit.ts
|
|
345051
345188
|
init_esbuild_shims();
|
|
345052
|
-
var GIT_COMMIT_INFO2 = "
|
|
345189
|
+
var GIT_COMMIT_INFO2 = "f6aa011d";
|
|
345053
345190
|
|
|
345054
345191
|
// packages/cli/src/utils/systemInfo.ts
|
|
345055
345192
|
async function getNpmVersion() {
|
|
@@ -345232,7 +345369,7 @@ ${issueUrl}`
|
|
|
345232
345369
|
|
|
345233
345370
|
// packages/cli/src/ui/commands/chatCommand.ts
|
|
345234
345371
|
init_esbuild_shims();
|
|
345235
|
-
var
|
|
345372
|
+
var import_react107 = __toESM(require_react(), 1);
|
|
345236
345373
|
import * as fsPromises5 from "node:fs/promises";
|
|
345237
345374
|
init_core2();
|
|
345238
345375
|
import path83 from "node:path";
|
|
@@ -345320,11 +345457,11 @@ var saveCommand = {
|
|
|
345320
345457
|
if (exists2) {
|
|
345321
345458
|
return {
|
|
345322
345459
|
type: "confirm_action",
|
|
345323
|
-
prompt:
|
|
345460
|
+
prompt: import_react107.default.createElement(
|
|
345324
345461
|
Text,
|
|
345325
345462
|
null,
|
|
345326
345463
|
"A checkpoint with the tag ",
|
|
345327
|
-
|
|
345464
|
+
import_react107.default.createElement(Text, { color: theme.text.accent }, tag2),
|
|
345328
345465
|
" already exists. Do you want to overwrite it?"
|
|
345329
345466
|
),
|
|
345330
345467
|
originalInvocation: {
|
|
@@ -347799,7 +347936,7 @@ init_esbuild_shims();
|
|
|
347799
347936
|
init_core2();
|
|
347800
347937
|
import * as fs78 from "node:fs";
|
|
347801
347938
|
import * as path87 from "node:path";
|
|
347802
|
-
var
|
|
347939
|
+
var import_react108 = __toESM(require_react(), 1);
|
|
347803
347940
|
var initCommand = {
|
|
347804
347941
|
name: "init",
|
|
347805
347942
|
description: "\u5206\u6790\u9879\u76EE\u5E76\u521B\u5EFA RDMind.md ",
|
|
@@ -347825,7 +347962,7 @@ var initCommand = {
|
|
|
347825
347962
|
type: "confirm_action",
|
|
347826
347963
|
// TODO: Move to .tsx file to use JSX syntax instead of React.createElement
|
|
347827
347964
|
// For now, using React.createElement to maintain .ts compatibility for PR review
|
|
347828
|
-
prompt:
|
|
347965
|
+
prompt: import_react108.default.createElement(
|
|
347829
347966
|
Text,
|
|
347830
347967
|
null,
|
|
347831
347968
|
`A ${contextFileName} file already exists in this directory. Do you want to regenerate it?`
|
|
@@ -351263,41 +351400,41 @@ var parseSlashCommand = /* @__PURE__ */ __name((query, commands) => {
|
|
|
351263
351400
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
351264
351401
|
var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, setGeminiMdFileCount, actions, extensionsUpdateState, isConfigInitialized) => {
|
|
351265
351402
|
const session = useSessionStats();
|
|
351266
|
-
const [commands, setCommands] = (0,
|
|
351267
|
-
const [reloadTrigger, setReloadTrigger] = (0,
|
|
351268
|
-
const reloadCommands = (0,
|
|
351403
|
+
const [commands, setCommands] = (0, import_react109.useState)([]);
|
|
351404
|
+
const [reloadTrigger, setReloadTrigger] = (0, import_react109.useState)(0);
|
|
351405
|
+
const reloadCommands = (0, import_react109.useCallback)(() => {
|
|
351269
351406
|
setReloadTrigger((v) => v + 1);
|
|
351270
351407
|
}, []);
|
|
351271
|
-
const [shellConfirmationRequest, setShellConfirmationRequest] = (0,
|
|
351272
|
-
const [confirmationRequest, setConfirmationRequest] = (0,
|
|
351273
|
-
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0,
|
|
351274
|
-
const [sessionShellAllowlist, setSessionShellAllowlist] = (0,
|
|
351408
|
+
const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react109.useState)(null);
|
|
351409
|
+
const [confirmationRequest, setConfirmationRequest] = (0, import_react109.useState)(null);
|
|
351410
|
+
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0, import_react109.useState)(null);
|
|
351411
|
+
const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react109.useState)(
|
|
351275
351412
|
/* @__PURE__ */ new Set()
|
|
351276
351413
|
);
|
|
351277
|
-
const gitService = (0,
|
|
351414
|
+
const gitService = (0, import_react109.useMemo)(() => {
|
|
351278
351415
|
if (!config?.getProjectRoot()) {
|
|
351279
351416
|
return;
|
|
351280
351417
|
}
|
|
351281
351418
|
return new GitService(config.getProjectRoot(), config.storage);
|
|
351282
351419
|
}, [config]);
|
|
351283
|
-
const logger6 = (0,
|
|
351420
|
+
const logger6 = (0, import_react109.useMemo)(() => {
|
|
351284
351421
|
const l2 = new Logger(
|
|
351285
351422
|
config?.getSessionId() || "",
|
|
351286
351423
|
config?.storage ?? new Storage(process37.cwd())
|
|
351287
351424
|
);
|
|
351288
351425
|
return l2;
|
|
351289
351426
|
}, [config]);
|
|
351290
|
-
const [pendingItem, setPendingItem] = (0,
|
|
351427
|
+
const [pendingItem, setPendingItem] = (0, import_react109.useState)(
|
|
351291
351428
|
null
|
|
351292
351429
|
);
|
|
351293
|
-
const pendingHistoryItems = (0,
|
|
351430
|
+
const pendingHistoryItems = (0, import_react109.useMemo)(() => {
|
|
351294
351431
|
const items = [];
|
|
351295
351432
|
if (pendingItem != null) {
|
|
351296
351433
|
items.push(pendingItem);
|
|
351297
351434
|
}
|
|
351298
351435
|
return items;
|
|
351299
351436
|
}, [pendingItem]);
|
|
351300
|
-
const addMessage = (0,
|
|
351437
|
+
const addMessage = (0, import_react109.useCallback)(
|
|
351301
351438
|
(message) => {
|
|
351302
351439
|
let historyItemContent;
|
|
351303
351440
|
if (message.type === "about" /* ABOUT */) {
|
|
@@ -351353,7 +351490,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
351353
351490
|
},
|
|
351354
351491
|
[addItem]
|
|
351355
351492
|
);
|
|
351356
|
-
const commandContext = (0,
|
|
351493
|
+
const commandContext = (0, import_react109.useMemo)(
|
|
351357
351494
|
() => ({
|
|
351358
351495
|
services: {
|
|
351359
351496
|
config,
|
|
@@ -351405,7 +351542,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
351405
351542
|
extensionsUpdateState
|
|
351406
351543
|
]
|
|
351407
351544
|
);
|
|
351408
|
-
(0,
|
|
351545
|
+
(0, import_react109.useEffect)(() => {
|
|
351409
351546
|
if (!config) {
|
|
351410
351547
|
return;
|
|
351411
351548
|
}
|
|
@@ -351423,7 +351560,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
351423
351560
|
})();
|
|
351424
351561
|
};
|
|
351425
351562
|
}, [config, reloadCommands]);
|
|
351426
|
-
(0,
|
|
351563
|
+
(0, import_react109.useEffect)(() => {
|
|
351427
351564
|
const controller = new AbortController();
|
|
351428
351565
|
const load = /* @__PURE__ */ __name(async () => {
|
|
351429
351566
|
const loaders = [
|
|
@@ -351442,7 +351579,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
351442
351579
|
controller.abort();
|
|
351443
351580
|
};
|
|
351444
351581
|
}, [config, reloadTrigger, isConfigInitialized]);
|
|
351445
|
-
const handleSlashCommand2 = (0,
|
|
351582
|
+
const handleSlashCommand2 = (0, import_react109.useCallback)(
|
|
351446
351583
|
async (rawQuery, oneTimeShellAllowlist, overwriteConfirmed) => {
|
|
351447
351584
|
if (typeof rawQuery !== "string") {
|
|
351448
351585
|
return false;
|
|
@@ -351748,7 +351885,7 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
|
|
|
351748
351885
|
|
|
351749
351886
|
// packages/cli/src/ui/hooks/useConsoleMessages.ts
|
|
351750
351887
|
init_esbuild_shims();
|
|
351751
|
-
var
|
|
351888
|
+
var import_react110 = __toESM(require_react(), 1);
|
|
351752
351889
|
function consoleMessagesReducer(state, action) {
|
|
351753
351890
|
switch (action.type) {
|
|
351754
351891
|
case "ADD_MESSAGES": {
|
|
@@ -351774,11 +351911,11 @@ function consoleMessagesReducer(state, action) {
|
|
|
351774
351911
|
}
|
|
351775
351912
|
__name(consoleMessagesReducer, "consoleMessagesReducer");
|
|
351776
351913
|
function useConsoleMessages() {
|
|
351777
|
-
const [consoleMessages, dispatch] = (0,
|
|
351778
|
-
const messageQueueRef = (0,
|
|
351779
|
-
const timeoutRef = (0,
|
|
351780
|
-
const [, startTransition] = (0,
|
|
351781
|
-
const processQueue = (0,
|
|
351914
|
+
const [consoleMessages, dispatch] = (0, import_react110.useReducer)(consoleMessagesReducer, []);
|
|
351915
|
+
const messageQueueRef = (0, import_react110.useRef)([]);
|
|
351916
|
+
const timeoutRef = (0, import_react110.useRef)(null);
|
|
351917
|
+
const [, startTransition] = (0, import_react110.useTransition)();
|
|
351918
|
+
const processQueue = (0, import_react110.useCallback)(() => {
|
|
351782
351919
|
if (messageQueueRef.current.length > 0) {
|
|
351783
351920
|
const messagesToProcess = messageQueueRef.current;
|
|
351784
351921
|
messageQueueRef.current = [];
|
|
@@ -351788,7 +351925,7 @@ function useConsoleMessages() {
|
|
|
351788
351925
|
}
|
|
351789
351926
|
timeoutRef.current = null;
|
|
351790
351927
|
}, []);
|
|
351791
|
-
const handleNewMessage = (0,
|
|
351928
|
+
const handleNewMessage = (0, import_react110.useCallback)(
|
|
351792
351929
|
(message) => {
|
|
351793
351930
|
messageQueueRef.current.push(message);
|
|
351794
351931
|
if (!timeoutRef.current) {
|
|
@@ -351797,7 +351934,7 @@ function useConsoleMessages() {
|
|
|
351797
351934
|
},
|
|
351798
351935
|
[processQueue]
|
|
351799
351936
|
);
|
|
351800
|
-
const clearConsoleMessages = (0,
|
|
351937
|
+
const clearConsoleMessages = (0, import_react110.useCallback)(() => {
|
|
351801
351938
|
if (timeoutRef.current) {
|
|
351802
351939
|
clearTimeout(timeoutRef.current);
|
|
351803
351940
|
timeoutRef.current = null;
|
|
@@ -351807,7 +351944,7 @@ function useConsoleMessages() {
|
|
|
351807
351944
|
dispatch({ type: "CLEAR" });
|
|
351808
351945
|
});
|
|
351809
351946
|
}, []);
|
|
351810
|
-
(0,
|
|
351947
|
+
(0, import_react110.useEffect)(
|
|
351811
351948
|
() => () => {
|
|
351812
351949
|
if (timeoutRef.current) {
|
|
351813
351950
|
clearTimeout(timeoutRef.current);
|
|
@@ -351837,11 +351974,11 @@ __name(computeWindowTitle, "computeWindowTitle");
|
|
|
351837
351974
|
|
|
351838
351975
|
// packages/cli/src/ui/hooks/useLogger.ts
|
|
351839
351976
|
init_esbuild_shims();
|
|
351840
|
-
var
|
|
351977
|
+
var import_react111 = __toESM(require_react(), 1);
|
|
351841
351978
|
init_core2();
|
|
351842
351979
|
var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
351843
|
-
const [logger6, setLogger] = (0,
|
|
351844
|
-
(0,
|
|
351980
|
+
const [logger6, setLogger] = (0, import_react111.useState)(null);
|
|
351981
|
+
(0, import_react111.useEffect)(() => {
|
|
351845
351982
|
const newLogger = new Logger(sessionId, storage);
|
|
351846
351983
|
newLogger.initialize().then(() => {
|
|
351847
351984
|
setLogger(newLogger);
|
|
@@ -351853,12 +351990,12 @@ var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
|
351853
351990
|
|
|
351854
351991
|
// packages/cli/src/ui/hooks/useGeminiStream.ts
|
|
351855
351992
|
init_esbuild_shims();
|
|
351856
|
-
var
|
|
351993
|
+
var import_react116 = __toESM(require_react(), 1);
|
|
351857
351994
|
init_core2();
|
|
351858
351995
|
|
|
351859
351996
|
// packages/cli/src/ui/hooks/shellCommandProcessor.ts
|
|
351860
351997
|
init_esbuild_shims();
|
|
351861
|
-
var
|
|
351998
|
+
var import_react112 = __toESM(require_react(), 1);
|
|
351862
351999
|
init_core2();
|
|
351863
352000
|
import crypto17 from "node:crypto";
|
|
351864
352001
|
import path94 from "node:path";
|
|
@@ -351887,8 +352024,8 @@ ${modelContent}
|
|
|
351887
352024
|
}
|
|
351888
352025
|
__name(addShellCommandToGeminiHistory, "addShellCommandToGeminiHistory");
|
|
351889
352026
|
var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config, geminiClient, setShellInputFocused, terminalWidth, terminalHeight) => {
|
|
351890
|
-
const [activeShellPtyId, setActiveShellPtyId] = (0,
|
|
351891
|
-
const handleShellCommand = (0,
|
|
352027
|
+
const [activeShellPtyId, setActiveShellPtyId] = (0, import_react112.useState)(null);
|
|
352028
|
+
const handleShellCommand = (0, import_react112.useCallback)(
|
|
351892
352029
|
(rawQuery, abortSignal) => {
|
|
351893
352030
|
if (typeof rawQuery !== "string" || rawQuery.trim() === "") {
|
|
351894
352031
|
return false;
|
|
@@ -352137,7 +352274,7 @@ ${finalOutput}`;
|
|
|
352137
352274
|
// packages/cli/src/ui/hooks/useVisionAutoSwitch.ts
|
|
352138
352275
|
init_esbuild_shims();
|
|
352139
352276
|
init_core2();
|
|
352140
|
-
var
|
|
352277
|
+
var import_react113 = __toESM(require_react(), 1);
|
|
352141
352278
|
init_core2();
|
|
352142
352279
|
function hasImageParts(parts) {
|
|
352143
352280
|
if (typeof parts === "string") {
|
|
@@ -352227,8 +352364,8 @@ function processVisionSwitchOutcome(outcome) {
|
|
|
352227
352364
|
}
|
|
352228
352365
|
__name(processVisionSwitchOutcome, "processVisionSwitchOutcome");
|
|
352229
352366
|
function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true, onVisionSwitchRequired) {
|
|
352230
|
-
const originalModelRef = (0,
|
|
352231
|
-
const handleVisionSwitch = (0,
|
|
352367
|
+
const originalModelRef = (0, import_react113.useRef)(null);
|
|
352368
|
+
const handleVisionSwitch = (0, import_react113.useCallback)(
|
|
352232
352369
|
async (query, userMessageTimestamp, isContinuation) => {
|
|
352233
352370
|
if (isContinuation || !onVisionSwitchRequired) {
|
|
352234
352371
|
return { shouldProceed: true };
|
|
@@ -352329,7 +352466,7 @@ function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true,
|
|
|
352329
352466
|
},
|
|
352330
352467
|
[config, addItem, visionModelPreviewEnabled, onVisionSwitchRequired]
|
|
352331
352468
|
);
|
|
352332
|
-
const restoreOriginalModel = (0,
|
|
352469
|
+
const restoreOriginalModel = (0, import_react113.useCallback)(async () => {
|
|
352333
352470
|
if (originalModelRef.current) {
|
|
352334
352471
|
await config.setModel(originalModelRef.current, {
|
|
352335
352472
|
reason: "vision_auto_switch",
|
|
@@ -352745,11 +352882,11 @@ var findLastSafeSplitPoint = /* @__PURE__ */ __name((content) => {
|
|
|
352745
352882
|
|
|
352746
352883
|
// packages/cli/src/ui/hooks/useStateAndRef.ts
|
|
352747
352884
|
init_esbuild_shims();
|
|
352748
|
-
var
|
|
352885
|
+
var import_react114 = __toESM(require_react(), 1);
|
|
352749
352886
|
var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
352750
|
-
const [state, setState] =
|
|
352751
|
-
const ref =
|
|
352752
|
-
const setStateInternal =
|
|
352887
|
+
const [state, setState] = import_react114.default.useState(initialValue);
|
|
352888
|
+
const ref = import_react114.default.useRef(initialValue);
|
|
352889
|
+
const setStateInternal = import_react114.default.useCallback(
|
|
352753
352890
|
(newStateOrCallback) => {
|
|
352754
352891
|
let newValue;
|
|
352755
352892
|
if (typeof newStateOrCallback === "function") {
|
|
@@ -352768,10 +352905,10 @@ var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
|
352768
352905
|
// packages/cli/src/ui/hooks/useReactToolScheduler.ts
|
|
352769
352906
|
init_esbuild_shims();
|
|
352770
352907
|
init_core2();
|
|
352771
|
-
var
|
|
352908
|
+
var import_react115 = __toESM(require_react(), 1);
|
|
352772
352909
|
function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorClose) {
|
|
352773
|
-
const [toolCallsForDisplay, setToolCallsForDisplay] = (0,
|
|
352774
|
-
const outputUpdateHandler = (0,
|
|
352910
|
+
const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react115.useState)([]);
|
|
352911
|
+
const outputUpdateHandler = (0, import_react115.useCallback)(
|
|
352775
352912
|
(toolCallId, outputChunk) => {
|
|
352776
352913
|
setToolCallsForDisplay(
|
|
352777
352914
|
(prevCalls) => prevCalls.map((tc) => {
|
|
@@ -352785,13 +352922,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
352785
352922
|
},
|
|
352786
352923
|
[]
|
|
352787
352924
|
);
|
|
352788
|
-
const allToolCallsCompleteHandler = (0,
|
|
352925
|
+
const allToolCallsCompleteHandler = (0, import_react115.useCallback)(
|
|
352789
352926
|
async (completedToolCalls) => {
|
|
352790
352927
|
await onComplete(completedToolCalls);
|
|
352791
352928
|
},
|
|
352792
352929
|
[onComplete]
|
|
352793
352930
|
);
|
|
352794
|
-
const toolCallsUpdateHandler = (0,
|
|
352931
|
+
const toolCallsUpdateHandler = (0, import_react115.useCallback)(
|
|
352795
352932
|
(updatedCoreToolCalls) => {
|
|
352796
352933
|
setToolCallsForDisplay(
|
|
352797
352934
|
(prevTrackedCalls) => updatedCoreToolCalls.map((coreTc) => {
|
|
@@ -352818,7 +352955,7 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
352818
352955
|
},
|
|
352819
352956
|
[setToolCallsForDisplay]
|
|
352820
352957
|
);
|
|
352821
|
-
const scheduler = (0,
|
|
352958
|
+
const scheduler = (0, import_react115.useMemo)(
|
|
352822
352959
|
() => new CoreToolScheduler({
|
|
352823
352960
|
outputUpdateHandler,
|
|
352824
352961
|
onAllToolCallsComplete: allToolCallsCompleteHandler,
|
|
@@ -352837,13 +352974,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
352837
352974
|
onEditorClose
|
|
352838
352975
|
]
|
|
352839
352976
|
);
|
|
352840
|
-
const schedule = (0,
|
|
352977
|
+
const schedule = (0, import_react115.useCallback)(
|
|
352841
352978
|
(request4, signal) => {
|
|
352842
352979
|
void scheduler.schedule(request4, signal);
|
|
352843
352980
|
},
|
|
352844
352981
|
[scheduler]
|
|
352845
352982
|
);
|
|
352846
|
-
const markToolsAsSubmitted = (0,
|
|
352983
|
+
const markToolsAsSubmitted = (0, import_react115.useCallback)(
|
|
352847
352984
|
(callIdsToMark) => {
|
|
352848
352985
|
setToolCallsForDisplay(
|
|
352849
352986
|
(prevCalls) => prevCalls.map(
|
|
@@ -352992,18 +353129,18 @@ function showCitations(settings) {
|
|
|
352992
353129
|
}
|
|
352993
353130
|
__name(showCitations, "showCitations");
|
|
352994
353131
|
var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, config, settings, onDebugMessage, handleSlashCommand2, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError, onEditorClose, onCancelSubmit, visionModelPreviewEnabled, setShellInputFocused, terminalWidth, terminalHeight, onVisionSwitchRequired, isShellFocused) => {
|
|
352995
|
-
const [initError, setInitError] = (0,
|
|
352996
|
-
const abortControllerRef = (0,
|
|
352997
|
-
const turnCancelledRef = (0,
|
|
352998
|
-
const isSubmittingQueryRef = (0,
|
|
352999
|
-
const [isResponding, setIsResponding] = (0,
|
|
353000
|
-
const [thought, setThought] = (0,
|
|
353132
|
+
const [initError, setInitError] = (0, import_react116.useState)(null);
|
|
353133
|
+
const abortControllerRef = (0, import_react116.useRef)(null);
|
|
353134
|
+
const turnCancelledRef = (0, import_react116.useRef)(false);
|
|
353135
|
+
const isSubmittingQueryRef = (0, import_react116.useRef)(false);
|
|
353136
|
+
const [isResponding, setIsResponding] = (0, import_react116.useState)(false);
|
|
353137
|
+
const [thought, setThought] = (0, import_react116.useState)(null);
|
|
353001
353138
|
const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
|
|
353002
|
-
const processedMemoryToolsRef = (0,
|
|
353139
|
+
const processedMemoryToolsRef = (0, import_react116.useRef)(/* @__PURE__ */ new Set());
|
|
353003
353140
|
const { startNewPrompt, getPromptCount } = useSessionStats();
|
|
353004
353141
|
const storage = config.storage;
|
|
353005
353142
|
const logger6 = useLogger(storage);
|
|
353006
|
-
const gitService = (0,
|
|
353143
|
+
const gitService = (0, import_react116.useMemo)(() => {
|
|
353007
353144
|
if (!config.getProjectRoot()) {
|
|
353008
353145
|
return;
|
|
353009
353146
|
}
|
|
@@ -353027,11 +353164,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353027
353164
|
getPreferredEditor,
|
|
353028
353165
|
onEditorClose
|
|
353029
353166
|
);
|
|
353030
|
-
const pendingToolCallGroupDisplay = (0,
|
|
353167
|
+
const pendingToolCallGroupDisplay = (0, import_react116.useMemo)(
|
|
353031
353168
|
() => toolCalls.length ? mapToDisplay(toolCalls) : void 0,
|
|
353032
353169
|
[toolCalls]
|
|
353033
353170
|
);
|
|
353034
|
-
const activeToolPtyId = (0,
|
|
353171
|
+
const activeToolPtyId = (0, import_react116.useMemo)(() => {
|
|
353035
353172
|
const executingShellTool = toolCalls?.find(
|
|
353036
353173
|
(tc) => tc.status === "executing" && tc.request.name === "run_shell_command"
|
|
353037
353174
|
);
|
|
@@ -353040,12 +353177,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353040
353177
|
}
|
|
353041
353178
|
return void 0;
|
|
353042
353179
|
}, [toolCalls]);
|
|
353043
|
-
const loopDetectedRef = (0,
|
|
353180
|
+
const loopDetectedRef = (0, import_react116.useRef)(false);
|
|
353044
353181
|
const [
|
|
353045
353182
|
loopDetectionConfirmationRequest,
|
|
353046
353183
|
setLoopDetectionConfirmationRequest
|
|
353047
|
-
] = (0,
|
|
353048
|
-
const onExec = (0,
|
|
353184
|
+
] = (0, import_react116.useState)(null);
|
|
353185
|
+
const onExec = (0, import_react116.useCallback)(async (done) => {
|
|
353049
353186
|
setIsResponding(true);
|
|
353050
353187
|
await done;
|
|
353051
353188
|
setIsResponding(false);
|
|
@@ -353068,12 +353205,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353068
353205
|
onVisionSwitchRequired
|
|
353069
353206
|
);
|
|
353070
353207
|
const activePtyId = activeShellPtyId || activeToolPtyId;
|
|
353071
|
-
(0,
|
|
353208
|
+
(0, import_react116.useEffect)(() => {
|
|
353072
353209
|
if (!activePtyId) {
|
|
353073
353210
|
setShellInputFocused(false);
|
|
353074
353211
|
}
|
|
353075
353212
|
}, [activePtyId, setShellInputFocused]);
|
|
353076
|
-
const streamingState = (0,
|
|
353213
|
+
const streamingState = (0, import_react116.useMemo)(() => {
|
|
353077
353214
|
if (toolCalls.some((tc) => tc.status === "awaiting_approval")) {
|
|
353078
353215
|
return "waiting_for_confirmation" /* WaitingForConfirmation */;
|
|
353079
353216
|
}
|
|
@@ -353084,7 +353221,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353084
353221
|
}
|
|
353085
353222
|
return "idle" /* Idle */;
|
|
353086
353223
|
}, [isResponding, toolCalls]);
|
|
353087
|
-
(0,
|
|
353224
|
+
(0, import_react116.useEffect)(() => {
|
|
353088
353225
|
if (config.getApprovalMode() === "yolo" /* YOLO */ && streamingState === "idle" /* Idle */) {
|
|
353089
353226
|
const lastUserMessageIndex = history.findLastIndex(
|
|
353090
353227
|
(item) => item.type === "user" /* USER */
|
|
@@ -353098,7 +353235,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353098
353235
|
}
|
|
353099
353236
|
}
|
|
353100
353237
|
}, [streamingState, config, history]);
|
|
353101
|
-
const cancelOngoingRequest = (0,
|
|
353238
|
+
const cancelOngoingRequest = (0, import_react116.useCallback)(() => {
|
|
353102
353239
|
if (streamingState !== "responding" /* Responding */) {
|
|
353103
353240
|
return;
|
|
353104
353241
|
}
|
|
@@ -353147,7 +353284,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353147
353284
|
},
|
|
353148
353285
|
{ isActive: streamingState === "responding" /* Responding */ }
|
|
353149
353286
|
);
|
|
353150
|
-
const prepareQueryForGemini = (0,
|
|
353287
|
+
const prepareQueryForGemini = (0, import_react116.useCallback)(
|
|
353151
353288
|
async (query, userMessageTimestamp, abortSignal, prompt_id) => {
|
|
353152
353289
|
if (turnCancelledRef.current) {
|
|
353153
353290
|
return { queryToSend: null, shouldProceed: false };
|
|
@@ -353242,7 +353379,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353242
353379
|
scheduleToolCalls
|
|
353243
353380
|
]
|
|
353244
353381
|
);
|
|
353245
|
-
const handleContentEvent = (0,
|
|
353382
|
+
const handleContentEvent = (0, import_react116.useCallback)(
|
|
353246
353383
|
(eventValue, currentGeminiMessageBuffer, userMessageTimestamp) => {
|
|
353247
353384
|
if (turnCancelledRef.current) {
|
|
353248
353385
|
return "";
|
|
@@ -353278,7 +353415,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353278
353415
|
},
|
|
353279
353416
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem]
|
|
353280
353417
|
);
|
|
353281
|
-
const handleUserCancelledEvent = (0,
|
|
353418
|
+
const handleUserCancelledEvent = (0, import_react116.useCallback)(
|
|
353282
353419
|
(userMessageTimestamp) => {
|
|
353283
353420
|
if (turnCancelledRef.current) {
|
|
353284
353421
|
return;
|
|
@@ -353307,7 +353444,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353307
353444
|
},
|
|
353308
353445
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, setThought]
|
|
353309
353446
|
);
|
|
353310
|
-
const handleErrorEvent = (0,
|
|
353447
|
+
const handleErrorEvent = (0, import_react116.useCallback)(
|
|
353311
353448
|
(eventValue, userMessageTimestamp) => {
|
|
353312
353449
|
if (pendingHistoryItemRef.current) {
|
|
353313
353450
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -353330,7 +353467,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353330
353467
|
},
|
|
353331
353468
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, config, setThought]
|
|
353332
353469
|
);
|
|
353333
|
-
const handleCitationEvent = (0,
|
|
353470
|
+
const handleCitationEvent = (0, import_react116.useCallback)(
|
|
353334
353471
|
(text, userMessageTimestamp) => {
|
|
353335
353472
|
if (!showCitations(settings)) {
|
|
353336
353473
|
return;
|
|
@@ -353343,7 +353480,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353343
353480
|
},
|
|
353344
353481
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, settings]
|
|
353345
353482
|
);
|
|
353346
|
-
const handleFinishedEvent = (0,
|
|
353483
|
+
const handleFinishedEvent = (0, import_react116.useCallback)(
|
|
353347
353484
|
(event, userMessageTimestamp) => {
|
|
353348
353485
|
const finishReason = event.value.reason;
|
|
353349
353486
|
if (!finishReason) {
|
|
@@ -353377,7 +353514,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353377
353514
|
},
|
|
353378
353515
|
[addItem]
|
|
353379
353516
|
);
|
|
353380
|
-
const handleChatCompressionEvent = (0,
|
|
353517
|
+
const handleChatCompressionEvent = (0, import_react116.useCallback)(
|
|
353381
353518
|
(eventValue, userMessageTimestamp) => {
|
|
353382
353519
|
if (pendingHistoryItemRef.current) {
|
|
353383
353520
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -353393,7 +353530,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353393
353530
|
},
|
|
353394
353531
|
[addItem, config, pendingHistoryItemRef, setPendingHistoryItem]
|
|
353395
353532
|
);
|
|
353396
|
-
const handleMaxSessionTurnsEvent = (0,
|
|
353533
|
+
const handleMaxSessionTurnsEvent = (0, import_react116.useCallback)(
|
|
353397
353534
|
() => addItem(
|
|
353398
353535
|
{
|
|
353399
353536
|
type: "info",
|
|
@@ -353403,7 +353540,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353403
353540
|
),
|
|
353404
353541
|
[addItem, config]
|
|
353405
353542
|
);
|
|
353406
|
-
const handleSessionTokenLimitExceededEvent = (0,
|
|
353543
|
+
const handleSessionTokenLimitExceededEvent = (0, import_react116.useCallback)(
|
|
353407
353544
|
(value) => addItem(
|
|
353408
353545
|
{
|
|
353409
353546
|
type: "error",
|
|
@@ -353418,7 +353555,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353418
353555
|
),
|
|
353419
353556
|
[addItem]
|
|
353420
353557
|
);
|
|
353421
|
-
const handleLoopDetectionConfirmation = (0,
|
|
353558
|
+
const handleLoopDetectionConfirmation = (0, import_react116.useCallback)(
|
|
353422
353559
|
(result) => {
|
|
353423
353560
|
setLoopDetectionConfirmationRequest(null);
|
|
353424
353561
|
if (result.userSelection === "disable") {
|
|
@@ -353442,12 +353579,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353442
353579
|
},
|
|
353443
353580
|
[config, addItem]
|
|
353444
353581
|
);
|
|
353445
|
-
const handleLoopDetectedEvent = (0,
|
|
353582
|
+
const handleLoopDetectedEvent = (0, import_react116.useCallback)(() => {
|
|
353446
353583
|
setLoopDetectionConfirmationRequest({
|
|
353447
353584
|
onComplete: handleLoopDetectionConfirmation
|
|
353448
353585
|
});
|
|
353449
353586
|
}, [handleLoopDetectionConfirmation]);
|
|
353450
|
-
const processGeminiStreamEvents = (0,
|
|
353587
|
+
const processGeminiStreamEvents = (0, import_react116.useCallback)(
|
|
353451
353588
|
async (stream2, userMessageTimestamp, signal) => {
|
|
353452
353589
|
let geminiMessageBuffer = "";
|
|
353453
353590
|
const toolCallRequests = [];
|
|
@@ -353521,7 +353658,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353521
353658
|
handleCitationEvent
|
|
353522
353659
|
]
|
|
353523
353660
|
);
|
|
353524
|
-
const submitQuery = (0,
|
|
353661
|
+
const submitQuery = (0, import_react116.useCallback)(
|
|
353525
353662
|
async (query, options2, prompt_id) => {
|
|
353526
353663
|
if (isSubmittingQueryRef.current && !options2?.isContinuation) {
|
|
353527
353664
|
return;
|
|
@@ -353654,7 +353791,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353654
353791
|
restoreOriginalModel
|
|
353655
353792
|
]
|
|
353656
353793
|
);
|
|
353657
|
-
const handleApprovalModeChange = (0,
|
|
353794
|
+
const handleApprovalModeChange = (0, import_react116.useCallback)(
|
|
353658
353795
|
async (newApprovalMode) => {
|
|
353659
353796
|
if (newApprovalMode === "yolo" /* YOLO */ || newApprovalMode === "auto-edit" /* AUTO_EDIT */) {
|
|
353660
353797
|
let awaitingApprovalCalls = toolCalls.filter(
|
|
@@ -353683,7 +353820,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353683
353820
|
},
|
|
353684
353821
|
[toolCalls]
|
|
353685
353822
|
);
|
|
353686
|
-
const handleCompletedTools = (0,
|
|
353823
|
+
const handleCompletedTools = (0, import_react116.useCallback)(
|
|
353687
353824
|
async (completedToolCallsFromScheduler) => {
|
|
353688
353825
|
if (isResponding) {
|
|
353689
353826
|
return;
|
|
@@ -353768,13 +353905,13 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353768
353905
|
modelSwitchedFromQuotaError
|
|
353769
353906
|
]
|
|
353770
353907
|
);
|
|
353771
|
-
const pendingHistoryItems = (0,
|
|
353908
|
+
const pendingHistoryItems = (0, import_react116.useMemo)(
|
|
353772
353909
|
() => [pendingHistoryItem, pendingToolCallGroupDisplay].filter(
|
|
353773
353910
|
(i) => i !== void 0 && i !== null
|
|
353774
353911
|
),
|
|
353775
353912
|
[pendingHistoryItem, pendingToolCallGroupDisplay]
|
|
353776
353913
|
);
|
|
353777
|
-
(0,
|
|
353914
|
+
(0, import_react116.useEffect)(() => {
|
|
353778
353915
|
const saveRestorableToolCalls = /* @__PURE__ */ __name(async () => {
|
|
353779
353916
|
if (!config.getCheckpointingEnabled()) {
|
|
353780
353917
|
return;
|
|
@@ -353893,7 +354030,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
|
|
|
353893
354030
|
|
|
353894
354031
|
// packages/cli/src/ui/hooks/vim.ts
|
|
353895
354032
|
init_esbuild_shims();
|
|
353896
|
-
var
|
|
354033
|
+
var import_react117 = __toESM(require_react(), 1);
|
|
353897
354034
|
var DIGIT_MULTIPLIER = 10;
|
|
353898
354035
|
var DEFAULT_COUNT = 1;
|
|
353899
354036
|
var DIGIT_1_TO_9 = /^[1-9]$/;
|
|
@@ -353956,22 +354093,22 @@ var vimReducer = /* @__PURE__ */ __name((state, action) => {
|
|
|
353956
354093
|
}, "vimReducer");
|
|
353957
354094
|
function useVim(buffer, onSubmit) {
|
|
353958
354095
|
const { vimEnabled, vimMode, setVimMode } = useVimMode();
|
|
353959
|
-
const [state, dispatch] = (0,
|
|
353960
|
-
(0,
|
|
354096
|
+
const [state, dispatch] = (0, import_react117.useReducer)(vimReducer, initialVimState);
|
|
354097
|
+
(0, import_react117.useEffect)(() => {
|
|
353961
354098
|
dispatch({ type: "SET_MODE", mode: vimMode });
|
|
353962
354099
|
}, [vimMode]);
|
|
353963
|
-
const updateMode = (0,
|
|
354100
|
+
const updateMode = (0, import_react117.useCallback)(
|
|
353964
354101
|
(mode) => {
|
|
353965
354102
|
setVimMode(mode);
|
|
353966
354103
|
dispatch({ type: "SET_MODE", mode });
|
|
353967
354104
|
},
|
|
353968
354105
|
[setVimMode]
|
|
353969
354106
|
);
|
|
353970
|
-
const getCurrentCount = (0,
|
|
354107
|
+
const getCurrentCount = (0, import_react117.useCallback)(
|
|
353971
354108
|
() => state.count || DEFAULT_COUNT,
|
|
353972
354109
|
[state.count]
|
|
353973
354110
|
);
|
|
353974
|
-
const executeCommand = (0,
|
|
354111
|
+
const executeCommand = (0, import_react117.useCallback)(
|
|
353975
354112
|
(cmdType, count) => {
|
|
353976
354113
|
switch (cmdType) {
|
|
353977
354114
|
case CMD_TYPES.DELETE_WORD_FORWARD: {
|
|
@@ -354047,7 +354184,7 @@ function useVim(buffer, onSubmit) {
|
|
|
354047
354184
|
},
|
|
354048
354185
|
[buffer, updateMode]
|
|
354049
354186
|
);
|
|
354050
|
-
const handleInsertModeInput = (0,
|
|
354187
|
+
const handleInsertModeInput = (0, import_react117.useCallback)(
|
|
354051
354188
|
(normalizedKey) => {
|
|
354052
354189
|
if (normalizedKey.name === "escape") {
|
|
354053
354190
|
buffer.vimEscapeInsertMode();
|
|
@@ -354078,7 +354215,7 @@ function useVim(buffer, onSubmit) {
|
|
|
354078
354215
|
},
|
|
354079
354216
|
[buffer, dispatch, updateMode, onSubmit]
|
|
354080
354217
|
);
|
|
354081
|
-
const normalizeKey = (0,
|
|
354218
|
+
const normalizeKey = (0, import_react117.useCallback)(
|
|
354082
354219
|
(key) => ({
|
|
354083
354220
|
name: key.name || "",
|
|
354084
354221
|
sequence: key.sequence || "",
|
|
@@ -354089,7 +354226,7 @@ function useVim(buffer, onSubmit) {
|
|
|
354089
354226
|
}),
|
|
354090
354227
|
[]
|
|
354091
354228
|
);
|
|
354092
|
-
const handleChangeMovement = (0,
|
|
354229
|
+
const handleChangeMovement = (0, import_react117.useCallback)(
|
|
354093
354230
|
(movement) => {
|
|
354094
354231
|
const count = getCurrentCount();
|
|
354095
354232
|
dispatch({ type: "CLEAR_COUNT" });
|
|
@@ -354110,7 +354247,7 @@ function useVim(buffer, onSubmit) {
|
|
|
354110
354247
|
},
|
|
354111
354248
|
[getCurrentCount, dispatch, buffer, updateMode]
|
|
354112
354249
|
);
|
|
354113
|
-
const handleOperatorMotion = (0,
|
|
354250
|
+
const handleOperatorMotion = (0, import_react117.useCallback)(
|
|
354114
354251
|
(operator2, motion) => {
|
|
354115
354252
|
const count = getCurrentCount();
|
|
354116
354253
|
const commandMap = {
|
|
@@ -354137,7 +354274,7 @@ function useVim(buffer, onSubmit) {
|
|
|
354137
354274
|
},
|
|
354138
354275
|
[getCurrentCount, executeCommand, dispatch]
|
|
354139
354276
|
);
|
|
354140
|
-
const handleInput = (0,
|
|
354277
|
+
const handleInput = (0, import_react117.useCallback)(
|
|
354141
354278
|
(key) => {
|
|
354142
354279
|
if (!vimEnabled) {
|
|
354143
354280
|
return false;
|
|
@@ -354447,9 +354584,14 @@ async function performInitialAuth(config, authType) {
|
|
|
354447
354584
|
return null;
|
|
354448
354585
|
}
|
|
354449
354586
|
try {
|
|
354450
|
-
await config.refreshAuth(authType);
|
|
354587
|
+
await config.refreshAuth(authType, true);
|
|
354588
|
+
const authEvent = new AuthEvent(authType, "auto", "success");
|
|
354589
|
+
logAuth(config, authEvent);
|
|
354451
354590
|
} catch (e2) {
|
|
354452
|
-
|
|
354591
|
+
const errorMessage = `Failed to login. Message: ${getErrorMessage(e2)}`;
|
|
354592
|
+
const authEvent = new AuthEvent(authType, "auto", "error", errorMessage);
|
|
354593
|
+
logAuth(config, authEvent);
|
|
354594
|
+
return errorMessage;
|
|
354453
354595
|
}
|
|
354454
354596
|
return null;
|
|
354455
354597
|
}
|
|
@@ -354468,10 +354610,15 @@ __name(validateTheme, "validateTheme");
|
|
|
354468
354610
|
|
|
354469
354611
|
// packages/cli/src/core/initializer.ts
|
|
354470
354612
|
async function initializeApp(config, settings) {
|
|
354471
|
-
const
|
|
354472
|
-
|
|
354473
|
-
|
|
354474
|
-
|
|
354613
|
+
const authType = settings.merged.security?.auth?.selectedType;
|
|
354614
|
+
const authError = await performInitialAuth(config, authType);
|
|
354615
|
+
if (authError) {
|
|
354616
|
+
settings.setValue(
|
|
354617
|
+
"User" /* User */,
|
|
354618
|
+
"security.auth.selectedType",
|
|
354619
|
+
void 0
|
|
354620
|
+
);
|
|
354621
|
+
}
|
|
354475
354622
|
const themeError = validateTheme(settings);
|
|
354476
354623
|
const shouldOpenAuthDialog = settings.merged.security?.auth?.selectedType === void 0 || !!authError;
|
|
354477
354624
|
if (config.getIdeMode()) {
|
|
@@ -354490,14 +354637,14 @@ __name(initializeApp, "initializeApp");
|
|
|
354490
354637
|
|
|
354491
354638
|
// packages/cli/src/ui/hooks/useBracketedPaste.ts
|
|
354492
354639
|
init_esbuild_shims();
|
|
354493
|
-
var
|
|
354640
|
+
var import_react118 = __toESM(require_react(), 1);
|
|
354494
354641
|
var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
|
|
354495
354642
|
var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|
|
354496
354643
|
var useBracketedPaste = /* @__PURE__ */ __name(() => {
|
|
354497
354644
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
354498
354645
|
process.stdout.write(DISABLE_BRACKETED_PASTE);
|
|
354499
354646
|
}, "cleanup");
|
|
354500
|
-
(0,
|
|
354647
|
+
(0, import_react118.useEffect)(() => {
|
|
354501
354648
|
process.stdout.write(ENABLE_BRACKETED_PASTE);
|
|
354502
354649
|
process.on("exit", cleanup);
|
|
354503
354650
|
process.on("SIGINT", cleanup);
|
|
@@ -354516,13 +354663,13 @@ init_esbuild_shims();
|
|
|
354516
354663
|
|
|
354517
354664
|
// packages/cli/src/ui/hooks/useTimer.ts
|
|
354518
354665
|
init_esbuild_shims();
|
|
354519
|
-
var
|
|
354666
|
+
var import_react119 = __toESM(require_react(), 1);
|
|
354520
354667
|
var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
354521
|
-
const [elapsedTime, setElapsedTime] = (0,
|
|
354522
|
-
const timerRef = (0,
|
|
354523
|
-
const prevResetKeyRef = (0,
|
|
354524
|
-
const prevIsActiveRef = (0,
|
|
354525
|
-
(0,
|
|
354668
|
+
const [elapsedTime, setElapsedTime] = (0, import_react119.useState)(0);
|
|
354669
|
+
const timerRef = (0, import_react119.useRef)(null);
|
|
354670
|
+
const prevResetKeyRef = (0, import_react119.useRef)(resetKey);
|
|
354671
|
+
const prevIsActiveRef = (0, import_react119.useRef)(isActive);
|
|
354672
|
+
(0, import_react119.useEffect)(() => {
|
|
354526
354673
|
let shouldResetTime = false;
|
|
354527
354674
|
if (prevResetKeyRef.current !== resetKey) {
|
|
354528
354675
|
shouldResetTime = true;
|
|
@@ -354560,7 +354707,7 @@ var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
|
354560
354707
|
|
|
354561
354708
|
// packages/cli/src/ui/hooks/usePhraseCycler.ts
|
|
354562
354709
|
init_esbuild_shims();
|
|
354563
|
-
var
|
|
354710
|
+
var import_react120 = __toESM(require_react(), 1);
|
|
354564
354711
|
var WITTY_LOADING_PHRASES = [
|
|
354565
354712
|
"\u51AC\u74DC\u3001\u9EC4\u74DC\u3001\u897F\u74DC\u3001\u5357\u74DC\u90FD\u80FD\u5403\uFF0C\u4EC0\u4E48\u74DC\u4E0D\u80FD\u5403\uFF1F",
|
|
354566
354713
|
"\u76C6\u91CC\u67096\u53EA\u9992\u5934\uFF0C6\u4E2A\u5C0F\u670B\u53CB\u6BCF\u4EBA\u5206\u52301\u53EA\uFF0C\u4F46\u76C6\u91CC\u8FD8\u7559\u77401\u53EA\uFF0C\u4E3A\u4EC0\u4E48\uFF1F",
|
|
@@ -354665,11 +354812,11 @@ var WITTY_LOADING_PHRASES = [
|
|
|
354665
354812
|
var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
354666
354813
|
var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
|
|
354667
354814
|
const loadingPhrases = customPhrases && customPhrases.length > 0 ? customPhrases : WITTY_LOADING_PHRASES;
|
|
354668
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0,
|
|
354815
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react120.useState)(
|
|
354669
354816
|
loadingPhrases[0]
|
|
354670
354817
|
);
|
|
354671
|
-
const phraseIntervalRef = (0,
|
|
354672
|
-
(0,
|
|
354818
|
+
const phraseIntervalRef = (0, import_react120.useRef)(null);
|
|
354819
|
+
(0, import_react120.useEffect)(() => {
|
|
354673
354820
|
if (isWaiting) {
|
|
354674
354821
|
setCurrentLoadingPhrase("Waiting for user confirmation...");
|
|
354675
354822
|
if (phraseIntervalRef.current) {
|
|
@@ -354706,9 +354853,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
|
|
|
354706
354853
|
}, "usePhraseCycler");
|
|
354707
354854
|
|
|
354708
354855
|
// packages/cli/src/ui/hooks/useLoadingIndicator.ts
|
|
354709
|
-
var
|
|
354856
|
+
var import_react121 = __toESM(require_react(), 1);
|
|
354710
354857
|
var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases) => {
|
|
354711
|
-
const [timerResetKey, setTimerResetKey] = (0,
|
|
354858
|
+
const [timerResetKey, setTimerResetKey] = (0, import_react121.useState)(0);
|
|
354712
354859
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
354713
354860
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
354714
354861
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -354718,9 +354865,9 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
354718
354865
|
isWaiting,
|
|
354719
354866
|
customWittyPhrases
|
|
354720
354867
|
);
|
|
354721
|
-
const [retainedElapsedTime, setRetainedElapsedTime] = (0,
|
|
354722
|
-
const prevStreamingStateRef = (0,
|
|
354723
|
-
(0,
|
|
354868
|
+
const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react121.useState)(0);
|
|
354869
|
+
const prevStreamingStateRef = (0, import_react121.useRef)(null);
|
|
354870
|
+
(0, import_react121.useEffect)(() => {
|
|
354724
354871
|
if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
|
|
354725
354872
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
354726
354873
|
setRetainedElapsedTime(0);
|
|
@@ -354740,20 +354887,20 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
354740
354887
|
|
|
354741
354888
|
// packages/cli/src/ui/hooks/useFolderTrust.ts
|
|
354742
354889
|
init_esbuild_shims();
|
|
354743
|
-
var
|
|
354890
|
+
var import_react122 = __toESM(require_react(), 1);
|
|
354744
354891
|
import * as process38 from "node:process";
|
|
354745
354892
|
var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
|
|
354746
|
-
const [isTrusted, setIsTrusted] = (0,
|
|
354747
|
-
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0,
|
|
354748
|
-
const [isRestarting, setIsRestarting] = (0,
|
|
354893
|
+
const [isTrusted, setIsTrusted] = (0, import_react122.useState)(void 0);
|
|
354894
|
+
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react122.useState)(false);
|
|
354895
|
+
const [isRestarting, setIsRestarting] = (0, import_react122.useState)(false);
|
|
354749
354896
|
const folderTrust = settings.merged.security?.folderTrust?.enabled;
|
|
354750
|
-
(0,
|
|
354897
|
+
(0, import_react122.useEffect)(() => {
|
|
354751
354898
|
const { isTrusted: trusted } = isWorkspaceTrusted(settings.merged);
|
|
354752
354899
|
setIsTrusted(trusted);
|
|
354753
354900
|
setIsFolderTrustDialogOpen(trusted === void 0);
|
|
354754
354901
|
onTrustChange(trusted);
|
|
354755
354902
|
}, [folderTrust, onTrustChange, settings.merged]);
|
|
354756
|
-
const handleFolderTrustSelect = (0,
|
|
354903
|
+
const handleFolderTrustSelect = (0, import_react122.useCallback)(
|
|
354757
354904
|
(choice2) => {
|
|
354758
354905
|
const trustedFolders = loadTrustedFolders();
|
|
354759
354906
|
const cwd7 = process38.cwd();
|
|
@@ -357938,27 +358085,27 @@ var ConsolePatcher = class {
|
|
|
357938
358085
|
|
|
357939
358086
|
// packages/cli/src/ui/hooks/useMessageQueue.ts
|
|
357940
358087
|
init_esbuild_shims();
|
|
357941
|
-
var
|
|
358088
|
+
var import_react123 = __toESM(require_react(), 1);
|
|
357942
358089
|
function useMessageQueue({
|
|
357943
358090
|
isConfigInitialized,
|
|
357944
358091
|
streamingState,
|
|
357945
358092
|
submitQuery
|
|
357946
358093
|
}) {
|
|
357947
|
-
const [messageQueue, setMessageQueue] = (0,
|
|
357948
|
-
const addMessage = (0,
|
|
358094
|
+
const [messageQueue, setMessageQueue] = (0, import_react123.useState)([]);
|
|
358095
|
+
const addMessage = (0, import_react123.useCallback)((message) => {
|
|
357949
358096
|
const trimmedMessage = message.trim();
|
|
357950
358097
|
if (trimmedMessage.length > 0) {
|
|
357951
358098
|
setMessageQueue((prev) => [...prev, trimmedMessage]);
|
|
357952
358099
|
}
|
|
357953
358100
|
}, []);
|
|
357954
|
-
const clearQueue = (0,
|
|
358101
|
+
const clearQueue = (0, import_react123.useCallback)(() => {
|
|
357955
358102
|
setMessageQueue([]);
|
|
357956
358103
|
}, []);
|
|
357957
|
-
const getQueuedMessagesText = (0,
|
|
358104
|
+
const getQueuedMessagesText = (0, import_react123.useCallback)(() => {
|
|
357958
358105
|
if (messageQueue.length === 0) return "";
|
|
357959
358106
|
return messageQueue.join("\n\n");
|
|
357960
358107
|
}, [messageQueue]);
|
|
357961
|
-
(0,
|
|
358108
|
+
(0, import_react123.useEffect)(() => {
|
|
357962
358109
|
if (isConfigInitialized && streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
357963
358110
|
const combinedMessage = messageQueue.join("\n\n");
|
|
357964
358111
|
setMessageQueue([]);
|
|
@@ -357977,15 +358124,15 @@ __name(useMessageQueue, "useMessageQueue");
|
|
|
357977
358124
|
// packages/cli/src/ui/hooks/useAutoAcceptIndicator.ts
|
|
357978
358125
|
init_esbuild_shims();
|
|
357979
358126
|
init_core2();
|
|
357980
|
-
var
|
|
358127
|
+
var import_react124 = __toESM(require_react(), 1);
|
|
357981
358128
|
function useAutoAcceptIndicator({
|
|
357982
358129
|
config,
|
|
357983
358130
|
addItem,
|
|
357984
358131
|
onApprovalModeChange
|
|
357985
358132
|
}) {
|
|
357986
358133
|
const currentConfigValue = config.getApprovalMode();
|
|
357987
|
-
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0,
|
|
357988
|
-
(0,
|
|
358134
|
+
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react124.useState)(currentConfigValue);
|
|
358135
|
+
(0, import_react124.useEffect)(() => {
|
|
357989
358136
|
setShowAutoAcceptIndicator(currentConfigValue);
|
|
357990
358137
|
}, [currentConfigValue]);
|
|
357991
358138
|
useKeypress(
|
|
@@ -358018,14 +358165,14 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
|
|
|
358018
358165
|
|
|
358019
358166
|
// packages/cli/src/ui/hooks/useWorkspaceMigration.ts
|
|
358020
358167
|
init_esbuild_shims();
|
|
358021
|
-
var
|
|
358168
|
+
var import_react125 = __toESM(require_react(), 1);
|
|
358022
358169
|
import process48 from "node:process";
|
|
358023
358170
|
function useWorkspaceMigration(settings) {
|
|
358024
|
-
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0,
|
|
358025
|
-
const [workspaceExtensions, setWorkspaceExtensions] = (0,
|
|
358171
|
+
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0, import_react125.useState)(false);
|
|
358172
|
+
const [workspaceExtensions, setWorkspaceExtensions] = (0, import_react125.useState)(
|
|
358026
358173
|
[]
|
|
358027
358174
|
);
|
|
358028
|
-
(0,
|
|
358175
|
+
(0, import_react125.useEffect)(() => {
|
|
358029
358176
|
if (!(settings.merged.experimental?.extensionManagement ?? true)) {
|
|
358030
358177
|
return;
|
|
358031
358178
|
}
|
|
@@ -358067,14 +358214,14 @@ __name(useWorkspaceMigration, "useWorkspaceMigration");
|
|
|
358067
358214
|
|
|
358068
358215
|
// packages/cli/src/ui/hooks/useGitBranchName.ts
|
|
358069
358216
|
init_esbuild_shims();
|
|
358070
|
-
var
|
|
358217
|
+
var import_react126 = __toESM(require_react(), 1);
|
|
358071
358218
|
init_core2();
|
|
358072
358219
|
import fs92 from "node:fs";
|
|
358073
358220
|
import fsPromises7 from "node:fs/promises";
|
|
358074
358221
|
import path106 from "node:path";
|
|
358075
358222
|
function useGitBranchName(cwd7) {
|
|
358076
|
-
const [branchName, setBranchName] = (0,
|
|
358077
|
-
const fetchBranchName = (0,
|
|
358223
|
+
const [branchName, setBranchName] = (0, import_react126.useState)(void 0);
|
|
358224
|
+
const fetchBranchName = (0, import_react126.useCallback)(async () => {
|
|
358078
358225
|
try {
|
|
358079
358226
|
const { stdout } = await spawnAsync(
|
|
358080
358227
|
"git",
|
|
@@ -358096,7 +358243,7 @@ function useGitBranchName(cwd7) {
|
|
|
358096
358243
|
setBranchName(void 0);
|
|
358097
358244
|
}
|
|
358098
358245
|
}, [cwd7, setBranchName]);
|
|
358099
|
-
(0,
|
|
358246
|
+
(0, import_react126.useEffect)(() => {
|
|
358100
358247
|
fetchBranchName();
|
|
358101
358248
|
const gitLogsHeadPath = path106.join(cwd7, ".git", "logs", "HEAD");
|
|
358102
358249
|
let watcher;
|
|
@@ -358122,7 +358269,7 @@ __name(useGitBranchName, "useGitBranchName");
|
|
|
358122
358269
|
|
|
358123
358270
|
// packages/cli/src/ui/hooks/useExtensionUpdates.ts
|
|
358124
358271
|
init_esbuild_shims();
|
|
358125
|
-
var
|
|
358272
|
+
var import_react127 = __toESM(require_react(), 1);
|
|
358126
358273
|
function confirmationRequestsReducer(state, action) {
|
|
358127
358274
|
switch (action.type) {
|
|
358128
358275
|
case "add":
|
|
@@ -358136,15 +358283,15 @@ function confirmationRequestsReducer(state, action) {
|
|
|
358136
358283
|
}
|
|
358137
358284
|
__name(confirmationRequestsReducer, "confirmationRequestsReducer");
|
|
358138
358285
|
var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) => {
|
|
358139
|
-
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0,
|
|
358286
|
+
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react127.useReducer)(
|
|
358140
358287
|
extensionUpdatesReducer,
|
|
358141
358288
|
initialExtensionUpdatesState
|
|
358142
358289
|
);
|
|
358143
358290
|
const [
|
|
358144
358291
|
confirmUpdateExtensionRequests,
|
|
358145
358292
|
dispatchConfirmUpdateExtensionRequests
|
|
358146
|
-
] = (0,
|
|
358147
|
-
const addConfirmUpdateExtensionRequest = (0,
|
|
358293
|
+
] = (0, import_react127.useReducer)(confirmationRequestsReducer, []);
|
|
358294
|
+
const addConfirmUpdateExtensionRequest = (0, import_react127.useCallback)(
|
|
358148
358295
|
(original) => {
|
|
358149
358296
|
const wrappedRequest = {
|
|
358150
358297
|
prompt: original.prompt,
|
|
@@ -358163,7 +358310,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
358163
358310
|
},
|
|
358164
358311
|
[dispatchConfirmUpdateExtensionRequests]
|
|
358165
358312
|
);
|
|
358166
|
-
(0,
|
|
358313
|
+
(0, import_react127.useEffect)(() => {
|
|
358167
358314
|
(async () => {
|
|
358168
358315
|
await checkForAllExtensionUpdates(
|
|
358169
358316
|
extensions,
|
|
@@ -358171,7 +358318,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
358171
358318
|
);
|
|
358172
358319
|
})();
|
|
358173
358320
|
}, [extensions, extensions.length, dispatchExtensionStateUpdate]);
|
|
358174
|
-
(0,
|
|
358321
|
+
(0, import_react127.useEffect)(() => {
|
|
358175
358322
|
if (extensionsUpdateState.batchChecksInProgress > 0) {
|
|
358176
358323
|
return;
|
|
358177
358324
|
}
|
|
@@ -358236,7 +358383,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
358236
358383
|
addItem,
|
|
358237
358384
|
cwd7
|
|
358238
358385
|
]);
|
|
358239
|
-
const extensionsUpdateStateComputed = (0,
|
|
358386
|
+
const extensionsUpdateStateComputed = (0, import_react127.useMemo)(() => {
|
|
358240
358387
|
const result = /* @__PURE__ */ new Map();
|
|
358241
358388
|
for (const [
|
|
358242
358389
|
key,
|
|
@@ -358257,13 +358404,13 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
358257
358404
|
|
|
358258
358405
|
// packages/cli/src/ui/hooks/useQuitConfirmation.ts
|
|
358259
358406
|
init_esbuild_shims();
|
|
358260
|
-
var
|
|
358407
|
+
var import_react128 = __toESM(require_react(), 1);
|
|
358261
358408
|
var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
358262
|
-
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0,
|
|
358263
|
-
const showQuitConfirmation = (0,
|
|
358409
|
+
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0, import_react128.useState)(false);
|
|
358410
|
+
const showQuitConfirmation = (0, import_react128.useCallback)(() => {
|
|
358264
358411
|
setIsQuitConfirmationOpen(true);
|
|
358265
358412
|
}, []);
|
|
358266
|
-
const handleQuitConfirmationSelect = (0,
|
|
358413
|
+
const handleQuitConfirmationSelect = (0, import_react128.useCallback)((choice2) => {
|
|
358267
358414
|
setIsQuitConfirmationOpen(false);
|
|
358268
358415
|
if (choice2 === "cancel" /* CANCEL */) {
|
|
358269
358416
|
return { shouldQuit: false, action: "cancel" };
|
|
@@ -358285,15 +358432,15 @@ var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
|
358285
358432
|
|
|
358286
358433
|
// packages/cli/src/ui/hooks/useWelcomeBack.ts
|
|
358287
358434
|
init_esbuild_shims();
|
|
358288
|
-
var
|
|
358435
|
+
var import_react129 = __toESM(require_react(), 1);
|
|
358289
358436
|
init_core2();
|
|
358290
358437
|
function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
358291
|
-
const [welcomeBackInfo, setWelcomeBackInfo] = (0,
|
|
358292
|
-
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0,
|
|
358293
|
-
const [welcomeBackChoice, setWelcomeBackChoice] = (0,
|
|
358294
|
-
const [shouldFillInput, setShouldFillInput] = (0,
|
|
358295
|
-
const [inputFillText, setInputFillText] = (0,
|
|
358296
|
-
const checkWelcomeBack = (0,
|
|
358438
|
+
const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react129.useState)(null);
|
|
358439
|
+
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react129.useState)(false);
|
|
358440
|
+
const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react129.useState)(null);
|
|
358441
|
+
const [shouldFillInput, setShouldFillInput] = (0, import_react129.useState)(false);
|
|
358442
|
+
const [inputFillText, setInputFillText] = (0, import_react129.useState)(null);
|
|
358443
|
+
const checkWelcomeBack = (0, import_react129.useCallback)(async () => {
|
|
358297
358444
|
if (settings.ui?.enableWelcomeBack === false) {
|
|
358298
358445
|
return;
|
|
358299
358446
|
}
|
|
@@ -358307,7 +358454,7 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
358307
358454
|
console.debug("Welcome back check failed:", error);
|
|
358308
358455
|
}
|
|
358309
358456
|
}, [settings.ui?.enableWelcomeBack]);
|
|
358310
|
-
const handleWelcomeBackSelection = (0,
|
|
358457
|
+
const handleWelcomeBackSelection = (0, import_react129.useCallback)(
|
|
358311
358458
|
(choice2) => {
|
|
358312
358459
|
setWelcomeBackChoice(choice2);
|
|
358313
358460
|
setShowWelcomeBackDialog(false);
|
|
@@ -358319,21 +358466,21 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
358319
358466
|
},
|
|
358320
358467
|
[welcomeBackInfo]
|
|
358321
358468
|
);
|
|
358322
|
-
const handleWelcomeBackClose = (0,
|
|
358469
|
+
const handleWelcomeBackClose = (0, import_react129.useCallback)(() => {
|
|
358323
358470
|
setWelcomeBackChoice("restart");
|
|
358324
358471
|
setShowWelcomeBackDialog(false);
|
|
358325
358472
|
}, []);
|
|
358326
|
-
const clearInputFill = (0,
|
|
358473
|
+
const clearInputFill = (0, import_react129.useCallback)(() => {
|
|
358327
358474
|
setShouldFillInput(false);
|
|
358328
358475
|
setInputFillText(null);
|
|
358329
358476
|
}, []);
|
|
358330
|
-
(0,
|
|
358477
|
+
(0, import_react129.useEffect)(() => {
|
|
358331
358478
|
if (shouldFillInput && inputFillText) {
|
|
358332
358479
|
buffer.setText(inputFillText);
|
|
358333
358480
|
clearInputFill();
|
|
358334
358481
|
}
|
|
358335
358482
|
}, [shouldFillInput, inputFillText, buffer, clearInputFill]);
|
|
358336
|
-
(0,
|
|
358483
|
+
(0, import_react129.useEffect)(() => {
|
|
358337
358484
|
checkWelcomeBack();
|
|
358338
358485
|
}, [checkWelcomeBack]);
|
|
358339
358486
|
return {
|
|
@@ -358354,9 +358501,9 @@ __name(useWelcomeBack, "useWelcomeBack");
|
|
|
358354
358501
|
|
|
358355
358502
|
// packages/cli/src/ui/hooks/useDialogClose.ts
|
|
358356
358503
|
init_esbuild_shims();
|
|
358357
|
-
var
|
|
358504
|
+
var import_react130 = __toESM(require_react(), 1);
|
|
358358
358505
|
function useDialogClose(options2) {
|
|
358359
|
-
const closeAnyOpenDialog = (0,
|
|
358506
|
+
const closeAnyOpenDialog = (0, import_react130.useCallback)(() => {
|
|
358360
358507
|
if (options2.isThemeDialogOpen) {
|
|
358361
358508
|
options2.handleThemeSelect(void 0, "User" /* User */);
|
|
358362
358509
|
return true;
|
|
@@ -358386,6 +358533,26 @@ function useDialogClose(options2) {
|
|
|
358386
358533
|
}
|
|
358387
358534
|
__name(useDialogClose, "useDialogClose");
|
|
358388
358535
|
|
|
358536
|
+
// packages/cli/src/ui/hooks/useInitializationAuthError.ts
|
|
358537
|
+
init_esbuild_shims();
|
|
358538
|
+
var import_react131 = __toESM(require_react(), 1);
|
|
358539
|
+
var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError) => {
|
|
358540
|
+
const hasHandled = (0, import_react131.useRef)(false);
|
|
358541
|
+
const authErrorRef = (0, import_react131.useRef)(authError);
|
|
358542
|
+
const onAuthErrorRef = (0, import_react131.useRef)(onAuthError);
|
|
358543
|
+
authErrorRef.current = authError;
|
|
358544
|
+
onAuthErrorRef.current = onAuthError;
|
|
358545
|
+
(0, import_react131.useEffect)(() => {
|
|
358546
|
+
if (hasHandled.current) {
|
|
358547
|
+
return;
|
|
358548
|
+
}
|
|
358549
|
+
if (authErrorRef.current) {
|
|
358550
|
+
hasHandled.current = true;
|
|
358551
|
+
onAuthErrorRef.current(authErrorRef.current);
|
|
358552
|
+
}
|
|
358553
|
+
}, [authError, onAuthError]);
|
|
358554
|
+
}, "useInitializationAuthError");
|
|
358555
|
+
|
|
358389
358556
|
// packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
|
|
358390
358557
|
init_esbuild_shims();
|
|
358391
358558
|
var import_react132 = __toESM(require_react(), 1);
|
|
@@ -358481,7 +358648,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
358481
358648
|
}, "useAttentionNotifications");
|
|
358482
358649
|
|
|
358483
358650
|
// packages/cli/src/ui/AppContainer.tsx
|
|
358484
|
-
var
|
|
358651
|
+
var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
|
|
358485
358652
|
var CTRL_EXIT_PROMPT_DURATION_MS = 1e3;
|
|
358486
358653
|
function isToolExecuting(pendingHistoryItems) {
|
|
358487
358654
|
return pendingHistoryItems.some((item) => {
|
|
@@ -358669,17 +358836,12 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
358669
358836
|
onAuthError,
|
|
358670
358837
|
isAuthDialogOpen,
|
|
358671
358838
|
isAuthenticating,
|
|
358839
|
+
pendingAuthType,
|
|
358840
|
+
qwenAuthState,
|
|
358672
358841
|
handleAuthSelect,
|
|
358673
|
-
openAuthDialog
|
|
358842
|
+
openAuthDialog,
|
|
358843
|
+
cancelAuthentication
|
|
358674
358844
|
} = useAuthCommand(settings, config);
|
|
358675
|
-
const {
|
|
358676
|
-
isQwenAuth,
|
|
358677
|
-
isQwenAuthenticating,
|
|
358678
|
-
deviceAuth,
|
|
358679
|
-
authStatus,
|
|
358680
|
-
authMessage,
|
|
358681
|
-
cancelQwenAuth
|
|
358682
|
-
} = useQwenAuth(settings, isAuthenticating);
|
|
358683
358845
|
const { proQuotaRequest, handleProQuotaChoice } = useQuotaAndFallback({
|
|
358684
358846
|
config,
|
|
358685
358847
|
historyManager,
|
|
@@ -358687,16 +358849,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
358687
358849
|
setAuthState,
|
|
358688
358850
|
setModelSwitchedFromQuotaError
|
|
358689
358851
|
});
|
|
358690
|
-
|
|
358691
|
-
onAuthError("Qwen OAuth authentication timed out. Please try again.");
|
|
358692
|
-
cancelQwenAuth();
|
|
358693
|
-
setAuthState("updating" /* Updating */);
|
|
358694
|
-
}, [onAuthError, cancelQwenAuth, setAuthState]);
|
|
358695
|
-
const handleQwenAuthCancel = (0, import_react135.useCallback)(() => {
|
|
358696
|
-
onAuthError("Qwen OAuth authentication cancelled.");
|
|
358697
|
-
cancelQwenAuth();
|
|
358698
|
-
setAuthState("updating" /* Updating */);
|
|
358699
|
-
}, [onAuthError, cancelQwenAuth, setAuthState]);
|
|
358852
|
+
useInitializationAuthError(initializationResult.authError, onAuthError);
|
|
358700
358853
|
(0, import_react135.useEffect)(() => {
|
|
358701
358854
|
if (settings.merged.security?.auth?.enforcedType && settings.merged.security?.auth.selectedType && settings.merged.security?.auth.enforcedType !== settings.merged.security?.auth.selectedType) {
|
|
358702
358855
|
onAuthError(
|
|
@@ -359136,7 +359289,7 @@ ${queuedText}` : queuedText;
|
|
|
359136
359289
|
handleApprovalModeSelect,
|
|
359137
359290
|
isAuthDialogOpen,
|
|
359138
359291
|
handleAuthSelect,
|
|
359139
|
-
|
|
359292
|
+
pendingAuthType,
|
|
359140
359293
|
isEditorDialogOpen,
|
|
359141
359294
|
exitEditorDialog,
|
|
359142
359295
|
isSettingsDialogOpen,
|
|
@@ -359295,7 +359448,7 @@ ${queuedText}` : queuedText;
|
|
|
359295
359448
|
[filteredConsoleMessages]
|
|
359296
359449
|
);
|
|
359297
359450
|
const nightly = props.version.includes("nightly");
|
|
359298
|
-
const dialogsVisible = showWelcomeBackDialog || showWorkspaceMigrationDialog || shouldShowIdePrompt || isFolderTrustDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!loopDetectionConfirmationRequest || !!quitConfirmationRequest || isThemeDialogOpen || isSettingsDialogOpen || isModelDialogOpen || isVisionSwitchDialogOpen || isPermissionsDialogOpen || isAuthDialogOpen || isAuthenticating
|
|
359451
|
+
const dialogsVisible = showWelcomeBackDialog || showWorkspaceMigrationDialog || shouldShowIdePrompt || isFolderTrustDialogOpen || !!shellConfirmationRequest || !!confirmationRequest || confirmUpdateExtensionRequests.length > 0 || !!loopDetectionConfirmationRequest || !!quitConfirmationRequest || isThemeDialogOpen || isSettingsDialogOpen || isModelDialogOpen || isVisionSwitchDialogOpen || isPermissionsDialogOpen || isAuthDialogOpen || isAuthenticating || isEditorDialogOpen || showIdeRestartPrompt || !!proQuotaRequest || isSubagentCreateDialogOpen || isAgentsManagerDialogOpen || isApprovalModeDialogOpen;
|
|
359299
359452
|
const pendingHistoryItems = (0, import_react135.useMemo)(
|
|
359300
359453
|
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
|
|
359301
359454
|
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
|
|
@@ -359310,12 +359463,9 @@ ${queuedText}` : queuedText;
|
|
|
359310
359463
|
isConfigInitialized,
|
|
359311
359464
|
authError,
|
|
359312
359465
|
isAuthDialogOpen,
|
|
359466
|
+
pendingAuthType,
|
|
359313
359467
|
// Qwen OAuth state
|
|
359314
|
-
|
|
359315
|
-
isQwenAuthenticating,
|
|
359316
|
-
deviceAuth,
|
|
359317
|
-
authStatus,
|
|
359318
|
-
authMessage,
|
|
359468
|
+
qwenAuthState,
|
|
359319
359469
|
editorError,
|
|
359320
359470
|
isEditorDialogOpen,
|
|
359321
359471
|
corgiMode,
|
|
@@ -359405,12 +359555,9 @@ ${queuedText}` : queuedText;
|
|
|
359405
359555
|
isConfigInitialized,
|
|
359406
359556
|
authError,
|
|
359407
359557
|
isAuthDialogOpen,
|
|
359558
|
+
pendingAuthType,
|
|
359408
359559
|
// Qwen OAuth state
|
|
359409
|
-
|
|
359410
|
-
isQwenAuthenticating,
|
|
359411
|
-
deviceAuth,
|
|
359412
|
-
authStatus,
|
|
359413
|
-
authMessage,
|
|
359560
|
+
qwenAuthState,
|
|
359414
359561
|
editorError,
|
|
359415
359562
|
isEditorDialogOpen,
|
|
359416
359563
|
corgiMode,
|
|
@@ -359503,9 +359650,7 @@ ${queuedText}` : queuedText;
|
|
|
359503
359650
|
handleAuthSelect,
|
|
359504
359651
|
setAuthState,
|
|
359505
359652
|
onAuthError,
|
|
359506
|
-
|
|
359507
|
-
handleQwenAuthTimeout,
|
|
359508
|
-
handleQwenAuthCancel,
|
|
359653
|
+
cancelAuthentication,
|
|
359509
359654
|
handleEditorSelect,
|
|
359510
359655
|
exitEditorDialog,
|
|
359511
359656
|
closeSettingsDialog,
|
|
@@ -359539,9 +359684,7 @@ ${queuedText}` : queuedText;
|
|
|
359539
359684
|
handleAuthSelect,
|
|
359540
359685
|
setAuthState,
|
|
359541
359686
|
onAuthError,
|
|
359542
|
-
|
|
359543
|
-
handleQwenAuthTimeout,
|
|
359544
|
-
handleQwenAuthCancel,
|
|
359687
|
+
cancelAuthentication,
|
|
359545
359688
|
handleEditorSelect,
|
|
359546
359689
|
exitEditorDialog,
|
|
359547
359690
|
closeSettingsDialog,
|
|
@@ -359567,14 +359710,14 @@ ${queuedText}` : queuedText;
|
|
|
359567
359710
|
closeAgentsManagerDialog
|
|
359568
359711
|
]
|
|
359569
359712
|
);
|
|
359570
|
-
return /* @__PURE__ */ (0,
|
|
359713
|
+
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: config, children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
359571
359714
|
AppContext2.Provider,
|
|
359572
359715
|
{
|
|
359573
359716
|
value: {
|
|
359574
359717
|
version: props.version,
|
|
359575
359718
|
startupWarnings: props.startupWarnings || []
|
|
359576
359719
|
},
|
|
359577
|
-
children: /* @__PURE__ */ (0,
|
|
359720
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(ShellFocusContext.Provider, { value: isFocused, children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(App2, {}) })
|
|
359578
359721
|
}
|
|
359579
359722
|
) }) }) });
|
|
359580
359723
|
}, "AppContainer");
|
|
@@ -362488,7 +362631,7 @@ function toPermissionOptions(confirmation) {
|
|
|
362488
362631
|
__name(toPermissionOptions, "toPermissionOptions");
|
|
362489
362632
|
|
|
362490
362633
|
// packages/cli/src/gemini.tsx
|
|
362491
|
-
var
|
|
362634
|
+
var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
|
|
362492
362635
|
function validateDnsResolutionOrder(order) {
|
|
362493
362636
|
const defaultValue = "ipv4first";
|
|
362494
362637
|
if (order === void 0) {
|
|
@@ -362553,14 +362696,14 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
362553
362696
|
const AppWrapper = /* @__PURE__ */ __name(() => {
|
|
362554
362697
|
const kittyProtocolStatus = useKittyKeyboardProtocol();
|
|
362555
362698
|
const nodeMajorVersion = parseInt(process.versions.node.split(".")[0], 10);
|
|
362556
|
-
return /* @__PURE__ */ (0,
|
|
362699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(SettingsContext.Provider, { value: settings, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
362557
362700
|
KeypressProvider,
|
|
362558
362701
|
{
|
|
362559
362702
|
kittyProtocolEnabled: kittyProtocolStatus.enabled,
|
|
362560
362703
|
config,
|
|
362561
362704
|
debugKeystrokeLogging: settings.merged.general?.debugKeystrokeLogging,
|
|
362562
362705
|
pasteWorkaround: process.platform === "win32" || nodeMajorVersion < 20,
|
|
362563
|
-
children: /* @__PURE__ */ (0,
|
|
362706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(SessionStatsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(VimModeProvider, { settings, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
362564
362707
|
AppContainer,
|
|
362565
362708
|
{
|
|
362566
362709
|
config,
|
|
@@ -362574,7 +362717,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
362574
362717
|
) });
|
|
362575
362718
|
}, "AppWrapper");
|
|
362576
362719
|
const instance = render_default(
|
|
362577
|
-
process.env["DEBUG"] ? /* @__PURE__ */ (0,
|
|
362720
|
+
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_react137.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(AppWrapper, {}),
|
|
362578
362721
|
{
|
|
362579
362722
|
exitOnCtrlC: false,
|
|
362580
362723
|
isScreenReaderEnabled: config.getScreenReader()
|
|
@@ -362814,6 +362957,11 @@ main().catch((error) => {
|
|
|
362814
362957
|
* Copyright 2025 Google LLC
|
|
362815
362958
|
* SPDX-License-Identifier: Apache-2.0
|
|
362816
362959
|
*/
|
|
362960
|
+
/**
|
|
362961
|
+
* @license
|
|
362962
|
+
* Copyright 2025 Qwen Team
|
|
362963
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
362964
|
+
*/
|
|
362817
362965
|
/*! Bundled license information:
|
|
362818
362966
|
|
|
362819
362967
|
react/cjs/react.production.js:
|