osagent 0.1.17 → 0.1.18
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/dist/cli.js +508 -499
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -142539,7 +142539,7 @@ var init_anthropic = __esm({
|
|
|
142539
142539
|
const lowerModel = model.toLowerCase();
|
|
142540
142540
|
return lowerModel.includes("claude");
|
|
142541
142541
|
}
|
|
142542
|
-
buildRequest(request4,
|
|
142542
|
+
buildRequest(request4, _userPromptId) {
|
|
142543
142543
|
const result = { ...request4 };
|
|
142544
142544
|
if (result.temperature !== void 0 && result.top_p !== void 0) {
|
|
142545
142545
|
delete result.top_p;
|
|
@@ -142577,7 +142577,7 @@ var init_openrouter = __esm({
|
|
|
142577
142577
|
"X-Title": "OSAgent"
|
|
142578
142578
|
};
|
|
142579
142579
|
}
|
|
142580
|
-
buildRequest(request4,
|
|
142580
|
+
buildRequest(request4, _userPromptId) {
|
|
142581
142581
|
const result = { ...request4 };
|
|
142582
142582
|
if (result.temperature !== void 0 && result.top_p !== void 0 && AnthropicOpenAICompatibleProvider.isClaudeModel(result.model)) {
|
|
142583
142583
|
delete result.top_p;
|
|
@@ -142611,14 +142611,14 @@ var init_ollama = __esm({
|
|
|
142611
142611
|
*/
|
|
142612
142612
|
static isOllamaProvider(config) {
|
|
142613
142613
|
const baseUrl = config.baseUrl?.toLowerCase() || "";
|
|
142614
|
-
return baseUrl.includes("ollama.com") || baseUrl.includes("localhost:11434") || baseUrl.includes("127.0.0.1:11434");
|
|
142614
|
+
return baseUrl.includes("osa.dev") || baseUrl.includes("ollama.com") || baseUrl.includes("localhost:11434") || baseUrl.includes("127.0.0.1:11434");
|
|
142615
142615
|
}
|
|
142616
142616
|
/**
|
|
142617
|
-
* Check if this is
|
|
142617
|
+
* Check if this is OS Agent Cloud (vs Local)
|
|
142618
142618
|
*/
|
|
142619
142619
|
isCloud() {
|
|
142620
142620
|
const baseUrl = this.contentGeneratorConfig.baseUrl?.toLowerCase() || "";
|
|
142621
|
-
return baseUrl.includes("ollama.com");
|
|
142621
|
+
return baseUrl.includes("osa.dev") || baseUrl.includes("ollama.com");
|
|
142622
142622
|
}
|
|
142623
142623
|
buildHeaders() {
|
|
142624
142624
|
const version2 = this.cliConfig.getCliVersion() || "unknown";
|
|
@@ -146088,7 +146088,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
146088
146088
|
return {
|
|
146089
146089
|
...newContentGeneratorConfig,
|
|
146090
146090
|
model: newContentGeneratorConfig?.model || DEFAULT_OLLAMA_CODER_MODEL,
|
|
146091
|
-
baseUrl: newContentGeneratorConfig?.baseUrl || "https://
|
|
146091
|
+
baseUrl: newContentGeneratorConfig?.baseUrl || "https://osa.dev",
|
|
146092
146092
|
// API key from OLLAMA_API_KEY env var or settings
|
|
146093
146093
|
apiKey: newContentGeneratorConfig?.apiKey || process.env["OLLAMA_API_KEY"]
|
|
146094
146094
|
};
|
|
@@ -146108,7 +146108,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
146108
146108
|
};
|
|
146109
146109
|
}
|
|
146110
146110
|
async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
|
|
146111
|
-
const version2 = "0.1.
|
|
146111
|
+
const version2 = "0.1.18";
|
|
146112
146112
|
const userAgent2 = `OSAgent/${version2} (${process.platform}; ${process.arch})`;
|
|
146113
146113
|
const baseHeaders = {
|
|
146114
146114
|
"User-Agent": userAgent2
|
|
@@ -226107,14 +226107,14 @@ var require_react_reconciler_production = __commonJS({
|
|
|
226107
226107
|
__name(markRetryLaneIfNotHydrated, "markRetryLaneIfNotHydrated");
|
|
226108
226108
|
var exports3 = {};
|
|
226109
226109
|
"use strict";
|
|
226110
|
-
var
|
|
226110
|
+
var React29 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
226111
226111
|
Symbol.for("react.scope");
|
|
226112
226112
|
var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
|
|
226113
226113
|
Symbol.for("react.legacy_hidden");
|
|
226114
226114
|
Symbol.for("react.tracing_marker");
|
|
226115
226115
|
var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
|
|
226116
226116
|
Symbol.for("react.view_transition");
|
|
226117
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals =
|
|
226117
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React29.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance2 = $$$config.createInstance;
|
|
226118
226118
|
$$$config.cloneMutableInstance;
|
|
226119
226119
|
var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
|
|
226120
226120
|
$$$config.cloneMutableTextInstance;
|
|
@@ -237330,14 +237330,14 @@ var require_react_reconciler_development = __commonJS({
|
|
|
237330
237330
|
__name(getLaneLabelMap, "getLaneLabelMap");
|
|
237331
237331
|
var exports3 = {};
|
|
237332
237332
|
"use strict";
|
|
237333
|
-
var
|
|
237333
|
+
var React29 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
237334
237334
|
Symbol.for("react.scope");
|
|
237335
237335
|
var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
|
|
237336
237336
|
Symbol.for("react.legacy_hidden");
|
|
237337
237337
|
Symbol.for("react.tracing_marker");
|
|
237338
237338
|
var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
|
|
237339
237339
|
Symbol.for("react.view_transition");
|
|
237340
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals =
|
|
237340
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React29.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance2 = $$$config.createInstance;
|
|
237341
237341
|
$$$config.cloneMutableInstance;
|
|
237342
237342
|
var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
|
|
237343
237343
|
$$$config.cloneMutableTextInstance;
|
|
@@ -272878,20 +272878,20 @@ var require_react_jsx_runtime_development = __commonJS({
|
|
|
272878
272878
|
"object" === typeof node && null !== node && node.$$typeof === REACT_ELEMENT_TYPE && node._store && (node._store.validated = 1);
|
|
272879
272879
|
}
|
|
272880
272880
|
__name(validateChildKeys, "validateChildKeys");
|
|
272881
|
-
var
|
|
272881
|
+
var React29 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
272882
272882
|
Symbol.for("react.provider");
|
|
272883
|
-
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals =
|
|
272883
|
+
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React29.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty2 = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
272884
272884
|
return null;
|
|
272885
272885
|
};
|
|
272886
|
-
|
|
272886
|
+
React29 = {
|
|
272887
272887
|
"react-stack-bottom-frame": /* @__PURE__ */ __name(function(callStackForError) {
|
|
272888
272888
|
return callStackForError();
|
|
272889
272889
|
}, "react-stack-bottom-frame")
|
|
272890
272890
|
};
|
|
272891
272891
|
var specialPropKeyWarningShown;
|
|
272892
272892
|
var didWarnAboutElementRef = {};
|
|
272893
|
-
var unknownOwnerDebugStack =
|
|
272894
|
-
|
|
272893
|
+
var unknownOwnerDebugStack = React29["react-stack-bottom-frame"].bind(
|
|
272894
|
+
React29,
|
|
272895
272895
|
UnknownOwner
|
|
272896
272896
|
)();
|
|
272897
272897
|
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
@@ -287093,8 +287093,7 @@ init_esbuild_shims();
|
|
|
287093
287093
|
|
|
287094
287094
|
// packages/cli/src/patches/punycode-shim.ts
|
|
287095
287095
|
init_esbuild_shims();
|
|
287096
|
-
import Module from "node:module";
|
|
287097
|
-
import { createRequire as createRequire2 } from "node:module";
|
|
287096
|
+
import Module, { createRequire as createRequire2 } from "node:module";
|
|
287098
287097
|
var require2 = createRequire2(import.meta.url);
|
|
287099
287098
|
var userlandPunycode = require2.resolve("punycode/");
|
|
287100
287099
|
var moduleAny = Module;
|
|
@@ -294096,7 +294095,7 @@ var measureElement = /* @__PURE__ */ __name((node) => ({
|
|
|
294096
294095
|
var measure_element_default = measureElement;
|
|
294097
294096
|
|
|
294098
294097
|
// packages/cli/src/gemini.tsx
|
|
294099
|
-
var
|
|
294098
|
+
var import_react138 = __toESM(require_react(), 1);
|
|
294100
294099
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
294101
294100
|
import dns from "node:dns";
|
|
294102
294101
|
import os44 from "node:os";
|
|
@@ -303773,8 +303772,8 @@ function saveSettings(settingsFile) {
|
|
|
303773
303772
|
__name(saveSettings, "saveSettings");
|
|
303774
303773
|
|
|
303775
303774
|
// packages/cli/src/config/auth.ts
|
|
303776
|
-
function validateAuthMethod(authMethod) {
|
|
303777
|
-
const settings = loadSettings();
|
|
303775
|
+
function validateAuthMethod(authMethod, mergedSettings) {
|
|
303776
|
+
const settings = mergedSettings ? { merged: mergedSettings } : loadSettings();
|
|
303778
303777
|
loadEnvironment(settings.merged);
|
|
303779
303778
|
if (authMethod === AuthType2.USE_OPENAI) {
|
|
303780
303779
|
const hasApiKey = process.env["OPENAI_API_KEY"] || settings.merged.security?.auth?.apiKey;
|
|
@@ -303786,6 +303785,16 @@ function validateAuthMethod(authMethod) {
|
|
|
303786
303785
|
if (authMethod === AuthType2.OSA_OAUTH) {
|
|
303787
303786
|
return null;
|
|
303788
303787
|
}
|
|
303788
|
+
if (authMethod === AuthType2.OLLAMA_CLOUD) {
|
|
303789
|
+
const hasApiKey = process.env["OLLAMA_API_KEY"] || settings.merged.security?.auth?.apiKey;
|
|
303790
|
+
if (!hasApiKey) {
|
|
303791
|
+
return "OLLAMA_API_KEY environment variable not found. Get your API key at https://osa.dev";
|
|
303792
|
+
}
|
|
303793
|
+
return null;
|
|
303794
|
+
}
|
|
303795
|
+
if (authMethod === AuthType2.OLLAMA_LOCAL) {
|
|
303796
|
+
return null;
|
|
303797
|
+
}
|
|
303789
303798
|
return "Invalid auth method selected.";
|
|
303790
303799
|
}
|
|
303791
303800
|
__name(validateAuthMethod, "validateAuthMethod");
|
|
@@ -309690,7 +309699,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
309690
309699
|
// packages/cli/src/utils/version.ts
|
|
309691
309700
|
async function getCliVersion() {
|
|
309692
309701
|
const pkgJson = await getPackageJson();
|
|
309693
|
-
return "0.1.
|
|
309702
|
+
return "0.1.18";
|
|
309694
309703
|
}
|
|
309695
309704
|
__name(getCliVersion, "getCliVersion");
|
|
309696
309705
|
|
|
@@ -313695,7 +313704,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
313695
313704
|
|
|
313696
313705
|
// packages/cli/src/generated/git-commit.ts
|
|
313697
313706
|
init_esbuild_shims();
|
|
313698
|
-
var GIT_COMMIT_INFO2 = "
|
|
313707
|
+
var GIT_COMMIT_INFO2 = "c6060b4";
|
|
313699
313708
|
|
|
313700
313709
|
// packages/cli/src/utils/systemInfo.ts
|
|
313701
313710
|
async function getNpmVersion() {
|
|
@@ -313900,16 +313909,14 @@ Execute each agent with the same task and synthesize their combined results.`;
|
|
|
313900
313909
|
return t2("List all available built-in and custom agents.");
|
|
313901
313910
|
},
|
|
313902
313911
|
kind: "built-in" /* BUILT_IN */,
|
|
313903
|
-
action: /* @__PURE__ */ __name(() => {
|
|
313904
|
-
|
|
313905
|
-
|
|
313906
|
-
|
|
313907
|
-
|
|
313908
|
-
|
|
313909
|
-
|
|
313910
|
-
|
|
313911
|
-
};
|
|
313912
|
-
}, "action")
|
|
313912
|
+
action: /* @__PURE__ */ __name(() => ({
|
|
313913
|
+
type: "submit_prompt",
|
|
313914
|
+
content: [
|
|
313915
|
+
{
|
|
313916
|
+
text: `List all available subagents with their names and descriptions. Include both built-in agents (general-purpose, research-explorer, code-reviewer, test-writer, documentation, osa-orchestrator) and any custom agents defined in .osagent/agents/`
|
|
313917
|
+
}
|
|
313918
|
+
]
|
|
313919
|
+
}), "action")
|
|
313913
313920
|
}
|
|
313914
313921
|
]
|
|
313915
313922
|
};
|
|
@@ -314539,13 +314546,11 @@ var consultCommand = {
|
|
|
314539
314546
|
return t2("Enable active consultation mode");
|
|
314540
314547
|
},
|
|
314541
314548
|
kind: "built-in" /* BUILT_IN */,
|
|
314542
|
-
action: /* @__PURE__ */ __name(async () => {
|
|
314543
|
-
|
|
314544
|
-
|
|
314545
|
-
|
|
314546
|
-
|
|
314547
|
-
};
|
|
314548
|
-
}, "action")
|
|
314549
|
+
action: /* @__PURE__ */ __name(async () => ({
|
|
314550
|
+
type: "message",
|
|
314551
|
+
messageType: "info",
|
|
314552
|
+
content: t2("Consultation mode: ACTIVE\nThe agent will ask clarifying questions as you work.\nPress [a] to answer, [s] to skip questions.")
|
|
314553
|
+
}), "action")
|
|
314549
314554
|
},
|
|
314550
314555
|
{
|
|
314551
314556
|
name: "off",
|
|
@@ -314553,13 +314558,11 @@ var consultCommand = {
|
|
|
314553
314558
|
return t2("Disable consultation mode");
|
|
314554
314559
|
},
|
|
314555
314560
|
kind: "built-in" /* BUILT_IN */,
|
|
314556
|
-
action: /* @__PURE__ */ __name(async () => {
|
|
314557
|
-
|
|
314558
|
-
|
|
314559
|
-
|
|
314560
|
-
|
|
314561
|
-
};
|
|
314562
|
-
}, "action")
|
|
314561
|
+
action: /* @__PURE__ */ __name(async () => ({
|
|
314562
|
+
type: "message",
|
|
314563
|
+
messageType: "info",
|
|
314564
|
+
content: t2("Consultation mode: OFF\nNo questions will be asked.")
|
|
314565
|
+
}), "action")
|
|
314563
314566
|
},
|
|
314564
314567
|
{
|
|
314565
314568
|
name: "blocking",
|
|
@@ -314567,13 +314570,11 @@ var consultCommand = {
|
|
|
314567
314570
|
return t2("Enable blocking mode - high priority questions pause the agent");
|
|
314568
314571
|
},
|
|
314569
314572
|
kind: "built-in" /* BUILT_IN */,
|
|
314570
|
-
action: /* @__PURE__ */ __name(async () => {
|
|
314571
|
-
|
|
314572
|
-
|
|
314573
|
-
|
|
314574
|
-
|
|
314575
|
-
};
|
|
314576
|
-
}, "action")
|
|
314573
|
+
action: /* @__PURE__ */ __name(async () => ({
|
|
314574
|
+
type: "message",
|
|
314575
|
+
messageType: "info",
|
|
314576
|
+
content: t2("Consultation mode: BLOCKING\nHigh priority questions will pause the agent until answered.\nThis ensures critical decisions get your input.")
|
|
314577
|
+
}), "action")
|
|
314577
314578
|
},
|
|
314578
314579
|
{
|
|
314579
314580
|
name: "context",
|
|
@@ -314581,13 +314582,11 @@ var consultCommand = {
|
|
|
314581
314582
|
return t2("Show collected context from consultation");
|
|
314582
314583
|
},
|
|
314583
314584
|
kind: "built-in" /* BUILT_IN */,
|
|
314584
|
-
action: /* @__PURE__ */ __name(async () => {
|
|
314585
|
-
|
|
314586
|
-
|
|
314587
|
-
|
|
314588
|
-
|
|
314589
|
-
};
|
|
314590
|
-
}, "action")
|
|
314585
|
+
action: /* @__PURE__ */ __name(async () => ({
|
|
314586
|
+
type: "message",
|
|
314587
|
+
messageType: "info",
|
|
314588
|
+
content: t2("Use this to view all context gathered through consultation.\n(Context will appear here when questions are answered)")
|
|
314589
|
+
}), "action")
|
|
314591
314590
|
},
|
|
314592
314591
|
{
|
|
314593
314592
|
name: "clear",
|
|
@@ -314595,13 +314594,11 @@ var consultCommand = {
|
|
|
314595
314594
|
return t2("Clear all collected consultation context");
|
|
314596
314595
|
},
|
|
314597
314596
|
kind: "built-in" /* BUILT_IN */,
|
|
314598
|
-
action: /* @__PURE__ */ __name(async () => {
|
|
314599
|
-
|
|
314600
|
-
|
|
314601
|
-
|
|
314602
|
-
|
|
314603
|
-
};
|
|
314604
|
-
}, "action")
|
|
314597
|
+
action: /* @__PURE__ */ __name(async () => ({
|
|
314598
|
+
type: "message",
|
|
314599
|
+
messageType: "info",
|
|
314600
|
+
content: t2("Consultation context cleared.")
|
|
314601
|
+
}), "action")
|
|
314605
314602
|
}
|
|
314606
314603
|
],
|
|
314607
314604
|
action: /* @__PURE__ */ __name(async (_context, args) => {
|
|
@@ -315405,7 +315402,7 @@ var doctorCommand = {
|
|
|
315405
315402
|
content: t2(`\u2713 Updated to osagent@${newVersion}
|
|
315406
315403
|
Restart osagent to use the new version.`)
|
|
315407
315404
|
};
|
|
315408
|
-
} catch (
|
|
315405
|
+
} catch (_error) {
|
|
315409
315406
|
return {
|
|
315410
315407
|
type: "message",
|
|
315411
315408
|
messageType: "error",
|
|
@@ -323118,7 +323115,7 @@ __name(runNonInteractiveStreamJson, "runNonInteractiveStreamJson");
|
|
|
323118
323115
|
|
|
323119
323116
|
// packages/cli/src/ui/AppContainer.tsx
|
|
323120
323117
|
init_esbuild_shims();
|
|
323121
|
-
var
|
|
323118
|
+
var import_react136 = __toESM(require_react(), 1);
|
|
323122
323119
|
|
|
323123
323120
|
// packages/cli/src/ui/App.tsx
|
|
323124
323121
|
init_esbuild_shims();
|
|
@@ -344877,9 +344874,7 @@ var TodoProvider = /* @__PURE__ */ __name(({
|
|
|
344877
344874
|
const clearTodos = (0, import_react63.useCallback)(() => {
|
|
344878
344875
|
setTodosState([]);
|
|
344879
344876
|
}, []);
|
|
344880
|
-
const getActiveTodo = (0, import_react63.useCallback)(() =>
|
|
344881
|
-
return todos.find((todo) => todo.status === "in_progress");
|
|
344882
|
-
}, [todos]);
|
|
344877
|
+
const getActiveTodo = (0, import_react63.useCallback)(() => todos.find((todo) => todo.status === "in_progress"), [todos]);
|
|
344883
344878
|
const value = (0, import_react63.useMemo)(
|
|
344884
344879
|
() => ({
|
|
344885
344880
|
todos,
|
|
@@ -349284,7 +349279,7 @@ function AuthDialog() {
|
|
|
349284
349279
|
"Note: Your existing API key in settings.json will not be cleared when using Ollama Cloud. You can switch to a different authentication method later if needed."
|
|
349285
349280
|
) }) }),
|
|
349286
349281
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Text3, { children: t2("OSAgent - AI Coding Assistant") }) }),
|
|
349287
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Text3, { color: Colors.AccentBlue, children: "https://
|
|
349282
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Text3, { color: Colors.AccentBlue, children: "https://osa.dev" }) })
|
|
349288
349283
|
]
|
|
349289
349284
|
}
|
|
349290
349285
|
);
|
|
@@ -350397,7 +350392,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
350397
350392
|
onSubmit: (apiKey, baseUrl, model) => {
|
|
350398
350393
|
uiActions.handleAuthSelect(AuthType2.OLLAMA_CLOUD, "User" /* User */, {
|
|
350399
350394
|
apiKey,
|
|
350400
|
-
baseUrl: baseUrl || "https://
|
|
350395
|
+
baseUrl: baseUrl || "https://osa.dev",
|
|
350401
350396
|
model: model || "qwen3-coder:480b-cloud"
|
|
350402
350397
|
});
|
|
350403
350398
|
},
|
|
@@ -350406,10 +350401,10 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
350406
350401
|
uiActions.setAuthState("updating" /* Updating */);
|
|
350407
350402
|
},
|
|
350408
350403
|
defaultApiKey: fromSettings?.apiKey || process34.env["OLLAMA_API_KEY"] || "",
|
|
350409
|
-
defaultBaseUrl: fromSettings?.baseUrl || "https://
|
|
350404
|
+
defaultBaseUrl: fromSettings?.baseUrl || "https://osa.dev",
|
|
350410
350405
|
defaultModel: modelSettings?.name || "qwen3-coder:480b-cloud",
|
|
350411
350406
|
providerName: "Ollama Cloud",
|
|
350412
|
-
apiKeyUrl: "https://
|
|
350407
|
+
apiKeyUrl: "https://osa.dev/settings/keys"
|
|
350413
350408
|
}
|
|
350414
350409
|
);
|
|
350415
350410
|
}
|
|
@@ -350478,7 +350473,7 @@ var DialogManager = /* @__PURE__ */ __name(({
|
|
|
350478
350473
|
|
|
350479
350474
|
// packages/cli/src/ui/components/Composer.tsx
|
|
350480
350475
|
init_esbuild_shims();
|
|
350481
|
-
var
|
|
350476
|
+
var import_react100 = __toESM(require_react(), 1);
|
|
350482
350477
|
|
|
350483
350478
|
// packages/cli/src/ui/components/LoadingIndicator.tsx
|
|
350484
350479
|
init_esbuild_shims();
|
|
@@ -350559,7 +350554,6 @@ var LoadingIndicator = /* @__PURE__ */ __name(({
|
|
|
350559
350554
|
|
|
350560
350555
|
// packages/cli/src/ui/components/ConsultationDisplay.tsx
|
|
350561
350556
|
init_esbuild_shims();
|
|
350562
|
-
var import_react87 = __toESM(require_react(), 1);
|
|
350563
350557
|
var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
|
|
350564
350558
|
var ConsultationDisplay = /* @__PURE__ */ __name(({
|
|
350565
350559
|
isStreamingActive = false,
|
|
@@ -350822,14 +350816,14 @@ var DetailedMessagesDisplay = /* @__PURE__ */ __name(({ messages, maxHeight, wid
|
|
|
350822
350816
|
|
|
350823
350817
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
350824
350818
|
init_esbuild_shims();
|
|
350825
|
-
var
|
|
350819
|
+
var import_react96 = __toESM(require_react(), 1);
|
|
350826
350820
|
|
|
350827
350821
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
350828
350822
|
init_esbuild_shims();
|
|
350829
350823
|
|
|
350830
350824
|
// packages/cli/src/ui/components/PrepareLabel.tsx
|
|
350831
350825
|
init_esbuild_shims();
|
|
350832
|
-
var
|
|
350826
|
+
var import_react87 = __toESM(require_react(), 1);
|
|
350833
350827
|
var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
|
|
350834
350828
|
var MAX_WIDTH = 150;
|
|
350835
350829
|
var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
@@ -350895,7 +350889,7 @@ var _PrepareLabel = /* @__PURE__ */ __name(({
|
|
|
350895
350889
|
after
|
|
350896
350890
|
] });
|
|
350897
350891
|
}, "_PrepareLabel");
|
|
350898
|
-
var PrepareLabel =
|
|
350892
|
+
var PrepareLabel = import_react87.default.memo(_PrepareLabel);
|
|
350899
350893
|
|
|
350900
350894
|
// packages/cli/src/ui/components/SuggestionsDisplay.tsx
|
|
350901
350895
|
var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -350974,7 +350968,7 @@ __name(SuggestionsDisplay, "SuggestionsDisplay");
|
|
|
350974
350968
|
|
|
350975
350969
|
// packages/cli/src/ui/hooks/useInputHistory.ts
|
|
350976
350970
|
init_esbuild_shims();
|
|
350977
|
-
var
|
|
350971
|
+
var import_react88 = __toESM(require_react(), 1);
|
|
350978
350972
|
function useInputHistory({
|
|
350979
350973
|
userMessages,
|
|
350980
350974
|
onSubmit,
|
|
@@ -350982,13 +350976,13 @@ function useInputHistory({
|
|
|
350982
350976
|
currentQuery,
|
|
350983
350977
|
onChange
|
|
350984
350978
|
}) {
|
|
350985
|
-
const [historyIndex, setHistoryIndex] = (0,
|
|
350986
|
-
const [originalQueryBeforeNav, setOriginalQueryBeforeNav] = (0,
|
|
350987
|
-
const resetHistoryNav = (0,
|
|
350979
|
+
const [historyIndex, setHistoryIndex] = (0, import_react88.useState)(-1);
|
|
350980
|
+
const [originalQueryBeforeNav, setOriginalQueryBeforeNav] = (0, import_react88.useState)("");
|
|
350981
|
+
const resetHistoryNav = (0, import_react88.useCallback)(() => {
|
|
350988
350982
|
setHistoryIndex(-1);
|
|
350989
350983
|
setOriginalQueryBeforeNav("");
|
|
350990
350984
|
}, []);
|
|
350991
|
-
const handleSubmit = (0,
|
|
350985
|
+
const handleSubmit = (0, import_react88.useCallback)(
|
|
350992
350986
|
(value) => {
|
|
350993
350987
|
const trimmedValue = value.trim();
|
|
350994
350988
|
if (trimmedValue) {
|
|
@@ -350998,7 +350992,7 @@ function useInputHistory({
|
|
|
350998
350992
|
},
|
|
350999
350993
|
[onSubmit, resetHistoryNav]
|
|
351000
350994
|
);
|
|
351001
|
-
const navigateUp = (0,
|
|
350995
|
+
const navigateUp = (0, import_react88.useCallback)(() => {
|
|
351002
350996
|
if (!isActive) return false;
|
|
351003
350997
|
if (userMessages.length === 0) return false;
|
|
351004
350998
|
let nextIndex = historyIndex;
|
|
@@ -351027,7 +351021,7 @@ function useInputHistory({
|
|
|
351027
351021
|
// Use currentQuery from props
|
|
351028
351022
|
setOriginalQueryBeforeNav
|
|
351029
351023
|
]);
|
|
351030
|
-
const navigateDown = (0,
|
|
351024
|
+
const navigateDown = (0, import_react88.useCallback)(() => {
|
|
351031
351025
|
if (!isActive) return false;
|
|
351032
351026
|
if (historyIndex === -1) return false;
|
|
351033
351027
|
const nextIndex = historyIndex - 1;
|
|
@@ -351057,7 +351051,7 @@ __name(useInputHistory, "useInputHistory");
|
|
|
351057
351051
|
|
|
351058
351052
|
// packages/cli/src/ui/hooks/useShellHistory.ts
|
|
351059
351053
|
init_esbuild_shims();
|
|
351060
|
-
var
|
|
351054
|
+
var import_react89 = __toESM(require_react(), 1);
|
|
351061
351055
|
import * as fs85 from "node:fs/promises";
|
|
351062
351056
|
import * as path95 from "node:path";
|
|
351063
351057
|
var MAX_HISTORY_LENGTH2 = 100;
|
|
@@ -351101,10 +351095,10 @@ async function writeHistoryFile(filePath, history) {
|
|
|
351101
351095
|
}
|
|
351102
351096
|
__name(writeHistoryFile, "writeHistoryFile");
|
|
351103
351097
|
function useShellHistory(projectRoot, storage) {
|
|
351104
|
-
const [history, setHistory] = (0,
|
|
351105
|
-
const [historyIndex, setHistoryIndex] = (0,
|
|
351106
|
-
const [historyFilePath, setHistoryFilePath] = (0,
|
|
351107
|
-
(0,
|
|
351098
|
+
const [history, setHistory] = (0, import_react89.useState)([]);
|
|
351099
|
+
const [historyIndex, setHistoryIndex] = (0, import_react89.useState)(-1);
|
|
351100
|
+
const [historyFilePath, setHistoryFilePath] = (0, import_react89.useState)(null);
|
|
351101
|
+
(0, import_react89.useEffect)(() => {
|
|
351108
351102
|
async function loadHistory() {
|
|
351109
351103
|
const filePath = await getHistoryFilePath(projectRoot, storage);
|
|
351110
351104
|
setHistoryFilePath(filePath);
|
|
@@ -351114,7 +351108,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
351114
351108
|
__name(loadHistory, "loadHistory");
|
|
351115
351109
|
loadHistory();
|
|
351116
351110
|
}, [projectRoot, storage]);
|
|
351117
|
-
const addCommandToHistory = (0,
|
|
351111
|
+
const addCommandToHistory = (0, import_react89.useCallback)(
|
|
351118
351112
|
(command2) => {
|
|
351119
351113
|
if (!command2.trim() || !historyFilePath) {
|
|
351120
351114
|
return;
|
|
@@ -351126,7 +351120,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
351126
351120
|
},
|
|
351127
351121
|
[history, historyFilePath]
|
|
351128
351122
|
);
|
|
351129
|
-
const getPreviousCommand = (0,
|
|
351123
|
+
const getPreviousCommand = (0, import_react89.useCallback)(() => {
|
|
351130
351124
|
if (history.length === 0) {
|
|
351131
351125
|
return null;
|
|
351132
351126
|
}
|
|
@@ -351134,7 +351128,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
351134
351128
|
setHistoryIndex(newIndex);
|
|
351135
351129
|
return history[newIndex] ?? null;
|
|
351136
351130
|
}, [history, historyIndex]);
|
|
351137
|
-
const getNextCommand = (0,
|
|
351131
|
+
const getNextCommand = (0, import_react89.useCallback)(() => {
|
|
351138
351132
|
if (historyIndex < 0) {
|
|
351139
351133
|
return null;
|
|
351140
351134
|
}
|
|
@@ -351145,7 +351139,7 @@ function useShellHistory(projectRoot, storage) {
|
|
|
351145
351139
|
}
|
|
351146
351140
|
return history[newIndex] ?? null;
|
|
351147
351141
|
}, [history, historyIndex]);
|
|
351148
|
-
const resetHistoryPosition = (0,
|
|
351142
|
+
const resetHistoryPosition = (0, import_react89.useCallback)(() => {
|
|
351149
351143
|
setHistoryIndex(-1);
|
|
351150
351144
|
}, []);
|
|
351151
351145
|
return {
|
|
@@ -351160,19 +351154,19 @@ __name(useShellHistory, "useShellHistory");
|
|
|
351160
351154
|
|
|
351161
351155
|
// packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx
|
|
351162
351156
|
init_esbuild_shims();
|
|
351163
|
-
var
|
|
351157
|
+
var import_react91 = __toESM(require_react(), 1);
|
|
351164
351158
|
|
|
351165
351159
|
// packages/cli/src/ui/hooks/useCompletion.ts
|
|
351166
351160
|
init_esbuild_shims();
|
|
351167
|
-
var
|
|
351161
|
+
var import_react90 = __toESM(require_react(), 1);
|
|
351168
351162
|
function useCompletion() {
|
|
351169
|
-
const [suggestions, setSuggestions] = (0,
|
|
351170
|
-
const [activeSuggestionIndex, setActiveSuggestionIndex] = (0,
|
|
351171
|
-
const [visibleStartIndex, setVisibleStartIndex] = (0,
|
|
351172
|
-
const [showSuggestions, setShowSuggestions] = (0,
|
|
351173
|
-
const [isLoadingSuggestions, setIsLoadingSuggestions] = (0,
|
|
351174
|
-
const [isPerfectMatch, setIsPerfectMatch] = (0,
|
|
351175
|
-
const resetCompletionState = (0,
|
|
351163
|
+
const [suggestions, setSuggestions] = (0, import_react90.useState)([]);
|
|
351164
|
+
const [activeSuggestionIndex, setActiveSuggestionIndex] = (0, import_react90.useState)(-1);
|
|
351165
|
+
const [visibleStartIndex, setVisibleStartIndex] = (0, import_react90.useState)(0);
|
|
351166
|
+
const [showSuggestions, setShowSuggestions] = (0, import_react90.useState)(false);
|
|
351167
|
+
const [isLoadingSuggestions, setIsLoadingSuggestions] = (0, import_react90.useState)(false);
|
|
351168
|
+
const [isPerfectMatch, setIsPerfectMatch] = (0, import_react90.useState)(false);
|
|
351169
|
+
const resetCompletionState = (0, import_react90.useCallback)(() => {
|
|
351176
351170
|
setSuggestions([]);
|
|
351177
351171
|
setActiveSuggestionIndex(-1);
|
|
351178
351172
|
setVisibleStartIndex(0);
|
|
@@ -351180,7 +351174,7 @@ function useCompletion() {
|
|
|
351180
351174
|
setIsLoadingSuggestions(false);
|
|
351181
351175
|
setIsPerfectMatch(false);
|
|
351182
351176
|
}, []);
|
|
351183
|
-
const navigateUp = (0,
|
|
351177
|
+
const navigateUp = (0, import_react90.useCallback)(() => {
|
|
351184
351178
|
if (suggestions.length === 0) return;
|
|
351185
351179
|
setActiveSuggestionIndex((prevActiveIndex) => {
|
|
351186
351180
|
const newActiveIndex = prevActiveIndex <= 0 ? suggestions.length - 1 : prevActiveIndex - 1;
|
|
@@ -351196,7 +351190,7 @@ function useCompletion() {
|
|
|
351196
351190
|
return newActiveIndex;
|
|
351197
351191
|
});
|
|
351198
351192
|
}, [suggestions.length]);
|
|
351199
|
-
const navigateDown = (0,
|
|
351193
|
+
const navigateDown = (0, import_react90.useCallback)(() => {
|
|
351200
351194
|
if (suggestions.length === 0) return;
|
|
351201
351195
|
setActiveSuggestionIndex((prevActiveIndex) => {
|
|
351202
351196
|
const newActiveIndex = prevActiveIndex >= suggestions.length - 1 ? 0 : prevActiveIndex + 1;
|
|
@@ -351235,8 +351229,8 @@ __name(useCompletion, "useCompletion");
|
|
|
351235
351229
|
|
|
351236
351230
|
// packages/cli/src/ui/hooks/useReverseSearchCompletion.tsx
|
|
351237
351231
|
function useDebouncedValue(value, delay4 = 200) {
|
|
351238
|
-
const [debounced, setDebounced] = (0,
|
|
351239
|
-
(0,
|
|
351232
|
+
const [debounced, setDebounced] = (0, import_react91.useState)(value);
|
|
351233
|
+
(0, import_react91.useEffect)(() => {
|
|
351240
351234
|
const handle = setTimeout(() => setDebounced(value), delay4);
|
|
351241
351235
|
return () => clearTimeout(handle);
|
|
351242
351236
|
}, [value, delay4]);
|
|
@@ -351259,19 +351253,19 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
351259
351253
|
setVisibleStartIndex
|
|
351260
351254
|
} = useCompletion();
|
|
351261
351255
|
const debouncedQuery = useDebouncedValue(buffer.text, 100);
|
|
351262
|
-
const prevQueryRef = (0,
|
|
351263
|
-
const prevMatchesRef = (0,
|
|
351264
|
-
(0,
|
|
351256
|
+
const prevQueryRef = (0, import_react91.useRef)("");
|
|
351257
|
+
const prevMatchesRef = (0, import_react91.useRef)([]);
|
|
351258
|
+
(0, import_react91.useEffect)(() => {
|
|
351265
351259
|
if (reverseSearchActive) {
|
|
351266
351260
|
prevQueryRef.current = "";
|
|
351267
351261
|
prevMatchesRef.current = [];
|
|
351268
351262
|
}
|
|
351269
351263
|
}, [reverseSearchActive]);
|
|
351270
|
-
(0,
|
|
351264
|
+
(0, import_react91.useEffect)(() => {
|
|
351271
351265
|
prevQueryRef.current = "";
|
|
351272
351266
|
prevMatchesRef.current = [];
|
|
351273
351267
|
}, [history]);
|
|
351274
|
-
const searchHistory = (0,
|
|
351268
|
+
const searchHistory = (0, import_react91.useCallback)(
|
|
351275
351269
|
(query, items) => {
|
|
351276
351270
|
const out = [];
|
|
351277
351271
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -351285,7 +351279,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
351285
351279
|
},
|
|
351286
351280
|
[]
|
|
351287
351281
|
);
|
|
351288
|
-
const matches = (0,
|
|
351282
|
+
const matches = (0, import_react91.useMemo)(() => {
|
|
351289
351283
|
if (!reverseSearchActive) return [];
|
|
351290
351284
|
if (debouncedQuery.length === 0)
|
|
351291
351285
|
return history.map((cmd) => ({
|
|
@@ -351298,7 +351292,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
351298
351292
|
const source2 = canUseCache ? prevMatchesRef.current.map((m) => m.value) : history;
|
|
351299
351293
|
return searchHistory(query, source2);
|
|
351300
351294
|
}, [debouncedQuery, history, reverseSearchActive, searchHistory]);
|
|
351301
|
-
(0,
|
|
351295
|
+
(0, import_react91.useEffect)(() => {
|
|
351302
351296
|
if (!reverseSearchActive) {
|
|
351303
351297
|
resetCompletionState();
|
|
351304
351298
|
return;
|
|
@@ -351320,7 +351314,7 @@ function useReverseSearchCompletion(buffer, history, reverseSearchActive) {
|
|
|
351320
351314
|
setVisibleStartIndex,
|
|
351321
351315
|
resetCompletionState
|
|
351322
351316
|
]);
|
|
351323
|
-
const handleAutocomplete = (0,
|
|
351317
|
+
const handleAutocomplete = (0, import_react91.useCallback)(
|
|
351324
351318
|
(i) => {
|
|
351325
351319
|
if (i < 0 || i >= suggestions.length) return;
|
|
351326
351320
|
buffer.setText(suggestions[i].value);
|
|
@@ -351344,11 +351338,11 @@ __name(useReverseSearchCompletion, "useReverseSearchCompletion");
|
|
|
351344
351338
|
|
|
351345
351339
|
// packages/cli/src/ui/hooks/useCommandCompletion.tsx
|
|
351346
351340
|
init_esbuild_shims();
|
|
351347
|
-
var
|
|
351341
|
+
var import_react94 = __toESM(require_react(), 1);
|
|
351348
351342
|
|
|
351349
351343
|
// packages/cli/src/ui/hooks/useAtCompletion.ts
|
|
351350
351344
|
init_esbuild_shims();
|
|
351351
|
-
var
|
|
351345
|
+
var import_react92 = __toESM(require_react(), 1);
|
|
351352
351346
|
var initialState = {
|
|
351353
351347
|
status: "idle" /* IDLE */,
|
|
351354
351348
|
suggestions: [],
|
|
@@ -351406,20 +351400,20 @@ function useAtCompletion(props) {
|
|
|
351406
351400
|
setSuggestions,
|
|
351407
351401
|
setIsLoadingSuggestions
|
|
351408
351402
|
} = props;
|
|
351409
|
-
const [state, dispatch] = (0,
|
|
351410
|
-
const fileSearch = (0,
|
|
351411
|
-
const searchAbortController = (0,
|
|
351412
|
-
const slowSearchTimer = (0,
|
|
351413
|
-
(0,
|
|
351403
|
+
const [state, dispatch] = (0, import_react92.useReducer)(atCompletionReducer, initialState);
|
|
351404
|
+
const fileSearch = (0, import_react92.useRef)(null);
|
|
351405
|
+
const searchAbortController = (0, import_react92.useRef)(null);
|
|
351406
|
+
const slowSearchTimer = (0, import_react92.useRef)(null);
|
|
351407
|
+
(0, import_react92.useEffect)(() => {
|
|
351414
351408
|
setSuggestions(state.suggestions);
|
|
351415
351409
|
}, [state.suggestions, setSuggestions]);
|
|
351416
|
-
(0,
|
|
351410
|
+
(0, import_react92.useEffect)(() => {
|
|
351417
351411
|
setIsLoadingSuggestions(state.isLoading);
|
|
351418
351412
|
}, [state.isLoading, setIsLoadingSuggestions]);
|
|
351419
|
-
(0,
|
|
351413
|
+
(0, import_react92.useEffect)(() => {
|
|
351420
351414
|
dispatch({ type: "RESET" });
|
|
351421
351415
|
}, [cwd7, config]);
|
|
351422
|
-
(0,
|
|
351416
|
+
(0, import_react92.useEffect)(() => {
|
|
351423
351417
|
if (!enabled) {
|
|
351424
351418
|
if (state.status === "ready" /* READY */ || state.status === "error" /* ERROR */) {
|
|
351425
351419
|
dispatch({ type: "RESET" });
|
|
@@ -351436,7 +351430,7 @@ function useAtCompletion(props) {
|
|
|
351436
351430
|
dispatch({ type: "SEARCH", payload: pattern });
|
|
351437
351431
|
}
|
|
351438
351432
|
}, [enabled, pattern, state.status, state.pattern]);
|
|
351439
|
-
(0,
|
|
351433
|
+
(0, import_react92.useEffect)(() => {
|
|
351440
351434
|
const initialize = /* @__PURE__ */ __name(async () => {
|
|
351441
351435
|
try {
|
|
351442
351436
|
const searcher = FileSearchFactory.create({
|
|
@@ -351511,7 +351505,7 @@ __name(useAtCompletion, "useAtCompletion");
|
|
|
351511
351505
|
|
|
351512
351506
|
// packages/cli/src/ui/hooks/useSlashCompletion.ts
|
|
351513
351507
|
init_esbuild_shims();
|
|
351514
|
-
var
|
|
351508
|
+
var import_react93 = __toESM(require_react(), 1);
|
|
351515
351509
|
init_fzf_es();
|
|
351516
351510
|
function logErrorSafely(error, context2) {
|
|
351517
351511
|
if (error instanceof Error) {
|
|
@@ -351526,7 +351520,7 @@ function matchesCommand(cmd, query) {
|
|
|
351526
351520
|
}
|
|
351527
351521
|
__name(matchesCommand, "matchesCommand");
|
|
351528
351522
|
function useCommandParser(query, slashCommands) {
|
|
351529
|
-
return (0,
|
|
351523
|
+
return (0, import_react93.useMemo)(() => {
|
|
351530
351524
|
if (!query) {
|
|
351531
351525
|
return {
|
|
351532
351526
|
hasTrailingSpace: false,
|
|
@@ -351596,9 +351590,9 @@ function useCommandParser(query, slashCommands) {
|
|
|
351596
351590
|
}
|
|
351597
351591
|
__name(useCommandParser, "useCommandParser");
|
|
351598
351592
|
function useCommandSuggestions(parserResult, commandContext, getFzfForCommands, getPrefixSuggestions) {
|
|
351599
|
-
const [suggestions, setSuggestions] = (0,
|
|
351600
|
-
const [isLoading, setIsLoading] = (0,
|
|
351601
|
-
(0,
|
|
351593
|
+
const [suggestions, setSuggestions] = (0, import_react93.useState)([]);
|
|
351594
|
+
const [isLoading, setIsLoading] = (0, import_react93.useState)(false);
|
|
351595
|
+
(0, import_react93.useEffect)(() => {
|
|
351602
351596
|
const abortController = new AbortController();
|
|
351603
351597
|
const { signal } = abortController;
|
|
351604
351598
|
const {
|
|
@@ -351718,7 +351712,7 @@ function useCommandSuggestions(parserResult, commandContext, getFzfForCommands,
|
|
|
351718
351712
|
}
|
|
351719
351713
|
__name(useCommandSuggestions, "useCommandSuggestions");
|
|
351720
351714
|
function useCompletionPositions(query, parserResult) {
|
|
351721
|
-
return (0,
|
|
351715
|
+
return (0, import_react93.useMemo)(() => {
|
|
351722
351716
|
if (!query) {
|
|
351723
351717
|
return { start: -1, end: -1 };
|
|
351724
351718
|
}
|
|
@@ -351740,7 +351734,7 @@ function useCompletionPositions(query, parserResult) {
|
|
|
351740
351734
|
}
|
|
351741
351735
|
__name(useCompletionPositions, "useCompletionPositions");
|
|
351742
351736
|
function usePerfectMatch(parserResult) {
|
|
351743
|
-
return (0,
|
|
351737
|
+
return (0, import_react93.useMemo)(() => {
|
|
351744
351738
|
const { hasTrailingSpace, partial, leafCommand, currentLevel } = parserResult;
|
|
351745
351739
|
if (hasTrailingSpace) {
|
|
351746
351740
|
return { isPerfectMatch: false };
|
|
@@ -351770,13 +351764,13 @@ function useSlashCompletion(props) {
|
|
|
351770
351764
|
setIsLoadingSuggestions,
|
|
351771
351765
|
setIsPerfectMatch
|
|
351772
351766
|
} = props;
|
|
351773
|
-
const [completionStart, setCompletionStart] = (0,
|
|
351774
|
-
const [completionEnd, setCompletionEnd] = (0,
|
|
351775
|
-
const fzfInstanceCache = (0,
|
|
351767
|
+
const [completionStart, setCompletionStart] = (0, import_react93.useState)(-1);
|
|
351768
|
+
const [completionEnd, setCompletionEnd] = (0, import_react93.useState)(-1);
|
|
351769
|
+
const fzfInstanceCache = (0, import_react93.useMemo)(
|
|
351776
351770
|
() => /* @__PURE__ */ new WeakMap(),
|
|
351777
351771
|
[]
|
|
351778
351772
|
);
|
|
351779
|
-
const getFzfForCommands = (0,
|
|
351773
|
+
const getFzfForCommands = (0, import_react93.useMemo)(
|
|
351780
351774
|
() => (commands) => {
|
|
351781
351775
|
if (!commands || commands.length === 0) {
|
|
351782
351776
|
return null;
|
|
@@ -351820,7 +351814,7 @@ function useSlashCompletion(props) {
|
|
|
351820
351814
|
},
|
|
351821
351815
|
[fzfInstanceCache]
|
|
351822
351816
|
);
|
|
351823
|
-
const getPrefixSuggestions = (0,
|
|
351817
|
+
const getPrefixSuggestions = (0, import_react93.useMemo)(
|
|
351824
351818
|
() => (commands, partial) => commands.filter(
|
|
351825
351819
|
(cmd) => cmd.description && !cmd.hidden && (cmd.name.toLowerCase().startsWith(partial.toLowerCase()) || cmd.altNames?.some(
|
|
351826
351820
|
(alt) => alt.toLowerCase().startsWith(partial.toLowerCase())
|
|
@@ -351840,7 +351834,7 @@ function useSlashCompletion(props) {
|
|
|
351840
351834
|
parserResult
|
|
351841
351835
|
);
|
|
351842
351836
|
const { isPerfectMatch } = usePerfectMatch(parserResult);
|
|
351843
|
-
(0,
|
|
351837
|
+
(0, import_react93.useEffect)(() => {
|
|
351844
351838
|
if (!enabled) {
|
|
351845
351839
|
setSuggestions([]);
|
|
351846
351840
|
setIsLoadingSuggestions(false);
|
|
@@ -351849,7 +351843,7 @@ function useSlashCompletion(props) {
|
|
|
351849
351843
|
setCompletionEnd(-1);
|
|
351850
351844
|
}
|
|
351851
351845
|
}, [enabled, setSuggestions, setIsLoadingSuggestions, setIsPerfectMatch]);
|
|
351852
|
-
(0,
|
|
351846
|
+
(0, import_react93.useEffect)(() => {
|
|
351853
351847
|
if (!enabled || query === null) {
|
|
351854
351848
|
return;
|
|
351855
351849
|
}
|
|
@@ -351898,7 +351892,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
351898
351892
|
} = useCompletion();
|
|
351899
351893
|
const cursorRow = buffer.cursor[0];
|
|
351900
351894
|
const cursorCol = buffer.cursor[1];
|
|
351901
|
-
const { completionMode, query, completionStart, completionEnd } = (0,
|
|
351895
|
+
const { completionMode, query, completionStart, completionEnd } = (0, import_react94.useMemo)(() => {
|
|
351902
351896
|
const currentLine = buffer.lines[cursorRow] || "";
|
|
351903
351897
|
if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
|
|
351904
351898
|
return {
|
|
@@ -351967,11 +351961,11 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
351967
351961
|
setIsLoadingSuggestions,
|
|
351968
351962
|
setIsPerfectMatch
|
|
351969
351963
|
});
|
|
351970
|
-
(0,
|
|
351964
|
+
(0, import_react94.useEffect)(() => {
|
|
351971
351965
|
setActiveSuggestionIndex(suggestions.length > 0 ? 0 : -1);
|
|
351972
351966
|
setVisibleStartIndex(0);
|
|
351973
351967
|
}, [suggestions, setActiveSuggestionIndex, setVisibleStartIndex]);
|
|
351974
|
-
(0,
|
|
351968
|
+
(0, import_react94.useEffect)(() => {
|
|
351975
351969
|
if (completionMode === "IDLE" /* IDLE */ || reverseSearchActive) {
|
|
351976
351970
|
resetCompletionState();
|
|
351977
351971
|
return;
|
|
@@ -351985,7 +351979,7 @@ function useCommandCompletion(buffer, dirs, cwd7, slashCommands, commandContext,
|
|
|
351985
351979
|
resetCompletionState,
|
|
351986
351980
|
setShowSuggestions
|
|
351987
351981
|
]);
|
|
351988
|
-
const handleAutocomplete = (0,
|
|
351982
|
+
const handleAutocomplete = (0, import_react94.useCallback)(
|
|
351989
351983
|
(indexToUse) => {
|
|
351990
351984
|
if (indexToUse < 0 || indexToUse >= suggestions.length) {
|
|
351991
351985
|
return;
|
|
@@ -352211,9 +352205,9 @@ import * as path97 from "node:path";
|
|
|
352211
352205
|
|
|
352212
352206
|
// packages/cli/src/ui/contexts/ShellFocusContext.tsx
|
|
352213
352207
|
init_esbuild_shims();
|
|
352214
|
-
var
|
|
352215
|
-
var ShellFocusContext = (0,
|
|
352216
|
-
var useShellFocusState = /* @__PURE__ */ __name(() => (0,
|
|
352208
|
+
var import_react95 = __toESM(require_react(), 1);
|
|
352209
|
+
var ShellFocusContext = (0, import_react95.createContext)(true);
|
|
352210
|
+
var useShellFocusState = /* @__PURE__ */ __name(() => (0, import_react95.useContext)(ShellFocusContext), "useShellFocusState");
|
|
352217
352211
|
|
|
352218
352212
|
// packages/cli/src/ui/components/InputPrompt.tsx
|
|
352219
352213
|
var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -352253,29 +352247,29 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
352253
352247
|
isEmbeddedShellFocused
|
|
352254
352248
|
}) => {
|
|
352255
352249
|
const isShellFocused = useShellFocusState();
|
|
352256
|
-
const [justNavigatedHistory, setJustNavigatedHistory] = (0,
|
|
352257
|
-
const [escPressCount, setEscPressCount] = (0,
|
|
352258
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
352259
|
-
const escapeTimerRef = (0,
|
|
352260
|
-
const [recentPasteTime, setRecentPasteTime] = (0,
|
|
352261
|
-
const pasteTimeoutRef = (0,
|
|
352262
|
-
const [dirs, setDirs] = (0,
|
|
352250
|
+
const [justNavigatedHistory, setJustNavigatedHistory] = (0, import_react96.useState)(false);
|
|
352251
|
+
const [escPressCount, setEscPressCount] = (0, import_react96.useState)(0);
|
|
352252
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react96.useState)(false);
|
|
352253
|
+
const escapeTimerRef = (0, import_react96.useRef)(null);
|
|
352254
|
+
const [recentPasteTime, setRecentPasteTime] = (0, import_react96.useState)(null);
|
|
352255
|
+
const pasteTimeoutRef = (0, import_react96.useRef)(null);
|
|
352256
|
+
const [dirs, setDirs] = (0, import_react96.useState)(
|
|
352263
352257
|
config.getWorkspaceContext().getDirectories()
|
|
352264
352258
|
);
|
|
352265
352259
|
const dirsChanged = config.getWorkspaceContext().getDirectories();
|
|
352266
|
-
(0,
|
|
352260
|
+
(0, import_react96.useEffect)(() => {
|
|
352267
352261
|
if (dirs.length !== dirsChanged.length) {
|
|
352268
352262
|
setDirs(dirsChanged);
|
|
352269
352263
|
}
|
|
352270
352264
|
}, [dirs.length, dirsChanged]);
|
|
352271
|
-
const [reverseSearchActive, setReverseSearchActive] = (0,
|
|
352272
|
-
const [commandSearchActive, setCommandSearchActive] = (0,
|
|
352273
|
-
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0,
|
|
352274
|
-
const [cursorPosition, setCursorPosition] = (0,
|
|
352265
|
+
const [reverseSearchActive, setReverseSearchActive] = (0, import_react96.useState)(false);
|
|
352266
|
+
const [commandSearchActive, setCommandSearchActive] = (0, import_react96.useState)(false);
|
|
352267
|
+
const [textBeforeReverseSearch, setTextBeforeReverseSearch] = (0, import_react96.useState)("");
|
|
352268
|
+
const [cursorPosition, setCursorPosition] = (0, import_react96.useState)([
|
|
352275
352269
|
0,
|
|
352276
352270
|
0
|
|
352277
352271
|
]);
|
|
352278
|
-
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0,
|
|
352272
|
+
const [expandedSuggestionIndex, setExpandedSuggestionIndex] = (0, import_react96.useState)(-1);
|
|
352279
352273
|
const shellHistory = useShellHistory(config.getProjectRoot());
|
|
352280
352274
|
const shellHistoryData = shellHistory.history;
|
|
352281
352275
|
const completion3 = useCommandCompletion(
|
|
@@ -352301,7 +352295,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
352301
352295
|
const resetReverseSearchCompletionState = reverseSearchCompletion.resetCompletionState;
|
|
352302
352296
|
const resetCommandSearchCompletionState = commandSearchCompletion.resetCompletionState;
|
|
352303
352297
|
const showCursor = focus && isShellFocused && !isEmbeddedShellFocused;
|
|
352304
|
-
const resetEscapeState = (0,
|
|
352298
|
+
const resetEscapeState = (0, import_react96.useCallback)(() => {
|
|
352305
352299
|
if (escapeTimerRef.current) {
|
|
352306
352300
|
clearTimeout(escapeTimerRef.current);
|
|
352307
352301
|
escapeTimerRef.current = null;
|
|
@@ -352309,12 +352303,12 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
352309
352303
|
setEscPressCount(0);
|
|
352310
352304
|
setShowEscapePrompt(false);
|
|
352311
352305
|
}, []);
|
|
352312
|
-
(0,
|
|
352306
|
+
(0, import_react96.useEffect)(() => {
|
|
352313
352307
|
if (onEscapePromptChange) {
|
|
352314
352308
|
onEscapePromptChange(showEscapePrompt);
|
|
352315
352309
|
}
|
|
352316
352310
|
}, [showEscapePrompt, onEscapePromptChange]);
|
|
352317
|
-
(0,
|
|
352311
|
+
(0, import_react96.useEffect)(
|
|
352318
352312
|
() => () => {
|
|
352319
352313
|
if (escapeTimerRef.current) {
|
|
352320
352314
|
clearTimeout(escapeTimerRef.current);
|
|
@@ -352325,7 +352319,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
352325
352319
|
},
|
|
352326
352320
|
[]
|
|
352327
352321
|
);
|
|
352328
|
-
const handleSubmitAndClear = (0,
|
|
352322
|
+
const handleSubmitAndClear = (0, import_react96.useCallback)(
|
|
352329
352323
|
(submittedValue) => {
|
|
352330
352324
|
if (shellModeActive) {
|
|
352331
352325
|
shellHistory.addCommandToHistory(submittedValue);
|
|
@@ -352344,7 +352338,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
352344
352338
|
resetReverseSearchCompletionState
|
|
352345
352339
|
]
|
|
352346
352340
|
);
|
|
352347
|
-
const customSetTextAndResetCompletionSignal = (0,
|
|
352341
|
+
const customSetTextAndResetCompletionSignal = (0, import_react96.useCallback)(
|
|
352348
352342
|
(newText) => {
|
|
352349
352343
|
buffer.setText(newText);
|
|
352350
352344
|
setJustNavigatedHistory(true);
|
|
@@ -352358,7 +352352,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
352358
352352
|
currentQuery: buffer.text,
|
|
352359
352353
|
onChange: customSetTextAndResetCompletionSignal
|
|
352360
352354
|
});
|
|
352361
|
-
(0,
|
|
352355
|
+
(0, import_react96.useEffect)(() => {
|
|
352362
352356
|
if (justNavigatedHistory) {
|
|
352363
352357
|
resetCompletionState();
|
|
352364
352358
|
resetReverseSearchCompletionState();
|
|
@@ -352374,7 +352368,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
352374
352368
|
resetReverseSearchCompletionState,
|
|
352375
352369
|
resetCommandSearchCompletionState
|
|
352376
352370
|
]);
|
|
352377
|
-
const handleClipboardImage = (0,
|
|
352371
|
+
const handleClipboardImage = (0, import_react96.useCallback)(async () => {
|
|
352378
352372
|
try {
|
|
352379
352373
|
if (await clipboardHasImage()) {
|
|
352380
352374
|
const imagePath = await saveClipboardImage(config.getTargetDir());
|
|
@@ -352406,7 +352400,7 @@ var InputPrompt = /* @__PURE__ */ __name(({
|
|
|
352406
352400
|
console.error("Error handling clipboard image:", error);
|
|
352407
352401
|
}
|
|
352408
352402
|
}, [buffer, config]);
|
|
352409
|
-
const handleInput = (0,
|
|
352403
|
+
const handleInput = (0, import_react96.useCallback)(
|
|
352410
352404
|
(key) => {
|
|
352411
352405
|
if (!focus && !key.paste) {
|
|
352412
352406
|
return;
|
|
@@ -352862,15 +352856,15 @@ import process36 from "node:process";
|
|
|
352862
352856
|
|
|
352863
352857
|
// packages/cli/src/ui/components/MemoryUsageDisplay.tsx
|
|
352864
352858
|
init_esbuild_shims();
|
|
352865
|
-
var
|
|
352859
|
+
var import_react97 = __toESM(require_react(), 1);
|
|
352866
352860
|
import process35 from "node:process";
|
|
352867
352861
|
var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
|
|
352868
352862
|
var MemoryUsageDisplay = /* @__PURE__ */ __name(() => {
|
|
352869
|
-
const [memoryUsage, setMemoryUsage] = (0,
|
|
352870
|
-
const [memoryUsageColor, setMemoryUsageColor] = (0,
|
|
352863
|
+
const [memoryUsage, setMemoryUsage] = (0, import_react97.useState)("");
|
|
352864
|
+
const [memoryUsageColor, setMemoryUsageColor] = (0, import_react97.useState)(
|
|
352871
352865
|
theme.text.secondary
|
|
352872
352866
|
);
|
|
352873
|
-
(0,
|
|
352867
|
+
(0, import_react97.useEffect)(() => {
|
|
352874
352868
|
const updateMemory = /* @__PURE__ */ __name(() => {
|
|
352875
352869
|
const usage2 = process35.memoryUsage().rss;
|
|
352876
352870
|
setMemoryUsage(formatMemoryUsage2(usage2));
|
|
@@ -352961,12 +352955,12 @@ var ContextUsageDisplay = /* @__PURE__ */ __name(({
|
|
|
352961
352955
|
|
|
352962
352956
|
// packages/cli/src/ui/components/DebugProfiler.tsx
|
|
352963
352957
|
init_esbuild_shims();
|
|
352964
|
-
var
|
|
352958
|
+
var import_react98 = __toESM(require_react(), 1);
|
|
352965
352959
|
var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
|
|
352966
352960
|
var DebugProfiler = /* @__PURE__ */ __name(() => {
|
|
352967
|
-
const numRenders = (0,
|
|
352968
|
-
const [showNumRenders, setShowNumRenders] = (0,
|
|
352969
|
-
(0,
|
|
352961
|
+
const numRenders = (0, import_react98.useRef)(0);
|
|
352962
|
+
const [showNumRenders, setShowNumRenders] = (0, import_react98.useState)(false);
|
|
352963
|
+
(0, import_react98.useEffect)(() => {
|
|
352970
352964
|
numRenders.current++;
|
|
352971
352965
|
});
|
|
352972
352966
|
useKeypress(
|
|
@@ -353152,12 +353146,12 @@ var QueuedMessageDisplay = /* @__PURE__ */ __name(({
|
|
|
353152
353146
|
|
|
353153
353147
|
// packages/cli/src/ui/components/ConfigInitDisplay.tsx
|
|
353154
353148
|
init_esbuild_shims();
|
|
353155
|
-
var
|
|
353149
|
+
var import_react99 = __toESM(require_react(), 1);
|
|
353156
353150
|
var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
|
|
353157
353151
|
var ConfigInitDisplay = /* @__PURE__ */ __name(() => {
|
|
353158
353152
|
const config = useConfig();
|
|
353159
|
-
const [message2, setMessage] = (0,
|
|
353160
|
-
(0,
|
|
353153
|
+
const [message2, setMessage] = (0, import_react99.useState)(t2("Initializing..."));
|
|
353154
|
+
(0, import_react99.useEffect)(() => {
|
|
353161
353155
|
const onChange = /* @__PURE__ */ __name((clients) => {
|
|
353162
353156
|
if (!clients || clients.size === 0) {
|
|
353163
353157
|
setMessage(t2("Initializing..."));
|
|
@@ -353201,7 +353195,7 @@ var Composer = /* @__PURE__ */ __name(() => {
|
|
|
353201
353195
|
const isNarrow = isNarrowWidth(terminalWidth);
|
|
353202
353196
|
const debugConsoleMaxHeight = Math.floor(Math.max(terminalWidth * 0.2, 5));
|
|
353203
353197
|
const { contextFileNames, showAutoAcceptIndicator } = uiState;
|
|
353204
|
-
const { containerWidth } = (0,
|
|
353198
|
+
const { containerWidth } = (0, import_react100.useMemo)(
|
|
353205
353199
|
() => calculatePromptWidths(uiState.terminalWidth),
|
|
353206
353200
|
[uiState.terminalWidth]
|
|
353207
353201
|
);
|
|
@@ -353456,12 +353450,12 @@ import process52 from "node:process";
|
|
|
353456
353450
|
|
|
353457
353451
|
// packages/cli/src/ui/hooks/useMemoryMonitor.ts
|
|
353458
353452
|
init_esbuild_shims();
|
|
353459
|
-
var
|
|
353453
|
+
var import_react101 = __toESM(require_react(), 1);
|
|
353460
353454
|
import process37 from "node:process";
|
|
353461
353455
|
var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
|
|
353462
353456
|
var MEMORY_CHECK_INTERVAL = 60 * 1e3;
|
|
353463
353457
|
var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
353464
|
-
(0,
|
|
353458
|
+
(0, import_react101.useEffect)(() => {
|
|
353465
353459
|
const intervalId = setInterval(() => {
|
|
353466
353460
|
const usage2 = process37.memoryUsage().rss;
|
|
353467
353461
|
if (usage2 > MEMORY_WARNING_THRESHOLD) {
|
|
@@ -353481,11 +353475,11 @@ var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
|
|
|
353481
353475
|
|
|
353482
353476
|
// packages/cli/src/ui/hooks/useThemeCommand.ts
|
|
353483
353477
|
init_esbuild_shims();
|
|
353484
|
-
var
|
|
353478
|
+
var import_react102 = __toESM(require_react(), 1);
|
|
353485
353479
|
import process38 from "node:process";
|
|
353486
353480
|
var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, addItem, initialThemeError) => {
|
|
353487
|
-
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0,
|
|
353488
|
-
const openThemeDialog = (0,
|
|
353481
|
+
const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react102.useState)(!!initialThemeError);
|
|
353482
|
+
const openThemeDialog = (0, import_react102.useCallback)(() => {
|
|
353489
353483
|
if (process38.env["NO_COLOR"]) {
|
|
353490
353484
|
addItem(
|
|
353491
353485
|
{
|
|
@@ -353500,7 +353494,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
353500
353494
|
}
|
|
353501
353495
|
setIsThemeDialogOpen(true);
|
|
353502
353496
|
}, [addItem]);
|
|
353503
|
-
const applyTheme = (0,
|
|
353497
|
+
const applyTheme = (0, import_react102.useCallback)(
|
|
353504
353498
|
(themeName) => {
|
|
353505
353499
|
if (!themeManager.setActiveTheme(themeName)) {
|
|
353506
353500
|
setIsThemeDialogOpen(true);
|
|
@@ -353515,13 +353509,13 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
353515
353509
|
},
|
|
353516
353510
|
[setThemeError]
|
|
353517
353511
|
);
|
|
353518
|
-
const handleThemeHighlight = (0,
|
|
353512
|
+
const handleThemeHighlight = (0, import_react102.useCallback)(
|
|
353519
353513
|
(themeName) => {
|
|
353520
353514
|
applyTheme(themeName);
|
|
353521
353515
|
},
|
|
353522
353516
|
[applyTheme]
|
|
353523
353517
|
);
|
|
353524
|
-
const handleThemeSelect = (0,
|
|
353518
|
+
const handleThemeSelect = (0, import_react102.useCallback)(
|
|
353525
353519
|
(themeName, scope) => {
|
|
353526
353520
|
try {
|
|
353527
353521
|
const mergedCustomThemes = {
|
|
@@ -353561,19 +353555,19 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
|
|
|
353561
353555
|
|
|
353562
353556
|
// packages/cli/src/ui/auth/useAuth.ts
|
|
353563
353557
|
init_esbuild_shims();
|
|
353564
|
-
var
|
|
353558
|
+
var import_react104 = __toESM(require_react(), 1);
|
|
353565
353559
|
|
|
353566
353560
|
// packages/cli/src/ui/hooks/useQwenAuth.ts
|
|
353567
353561
|
init_esbuild_shims();
|
|
353568
|
-
var
|
|
353562
|
+
var import_react103 = __toESM(require_react(), 1);
|
|
353569
353563
|
var useOSAAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
353570
|
-
const [OSAAuthState, setOSAAuthState] = (0,
|
|
353564
|
+
const [OSAAuthState, setOSAAuthState] = (0, import_react103.useState)({
|
|
353571
353565
|
deviceAuth: null,
|
|
353572
353566
|
authStatus: "idle",
|
|
353573
353567
|
authMessage: null
|
|
353574
353568
|
});
|
|
353575
353569
|
const isOSAAuth = pendingAuthType === AuthType2.OSA_OAUTH;
|
|
353576
|
-
(0,
|
|
353570
|
+
(0, import_react103.useEffect)(() => {
|
|
353577
353571
|
if (!isOSAAuth || !isAuthenticating) {
|
|
353578
353572
|
setOSAAuthState({
|
|
353579
353573
|
deviceAuth: null,
|
|
@@ -353613,7 +353607,7 @@ var useOSAAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
|
353613
353607
|
OSAOAuth2Events.off(OSAOAuth2Event.AuthProgress, handleAuthProgress);
|
|
353614
353608
|
};
|
|
353615
353609
|
}, [isOSAAuth, isAuthenticating]);
|
|
353616
|
-
const cancelOSAAuth = (0,
|
|
353610
|
+
const cancelOSAAuth = (0, import_react103.useCallback)(() => {
|
|
353617
353611
|
OSAOAuth2Events.emit(OSAOAuth2Event.AuthCancel);
|
|
353618
353612
|
setOSAAuthState({
|
|
353619
353613
|
deviceAuth: null,
|
|
@@ -353630,20 +353624,20 @@ var useOSAAuth = /* @__PURE__ */ __name((pendingAuthType, isAuthenticating) => {
|
|
|
353630
353624
|
// packages/cli/src/ui/auth/useAuth.ts
|
|
353631
353625
|
var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
353632
353626
|
const unAuthenticated = settings.merged.security?.auth?.selectedType === void 0;
|
|
353633
|
-
const [authState, setAuthState] = (0,
|
|
353627
|
+
const [authState, setAuthState] = (0, import_react104.useState)(
|
|
353634
353628
|
unAuthenticated ? "updating" /* Updating */ : "unauthenticated" /* Unauthenticated */
|
|
353635
353629
|
);
|
|
353636
|
-
const [authError, setAuthError] = (0,
|
|
353637
|
-
const [isAuthenticating, setIsAuthenticating] = (0,
|
|
353638
|
-
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0,
|
|
353639
|
-
const [pendingAuthType, setPendingAuthType] = (0,
|
|
353630
|
+
const [authError, setAuthError] = (0, import_react104.useState)(null);
|
|
353631
|
+
const [isAuthenticating, setIsAuthenticating] = (0, import_react104.useState)(false);
|
|
353632
|
+
const [isAuthDialogOpen, setIsAuthDialogOpen] = (0, import_react104.useState)(unAuthenticated);
|
|
353633
|
+
const [pendingAuthType, setPendingAuthType] = (0, import_react104.useState)(
|
|
353640
353634
|
void 0
|
|
353641
353635
|
);
|
|
353642
353636
|
const { OSAAuthState, cancelOSAAuth } = useOSAAuth(
|
|
353643
353637
|
pendingAuthType,
|
|
353644
353638
|
isAuthenticating
|
|
353645
353639
|
);
|
|
353646
|
-
const onAuthError = (0,
|
|
353640
|
+
const onAuthError = (0, import_react104.useCallback)(
|
|
353647
353641
|
(error) => {
|
|
353648
353642
|
setAuthError(error);
|
|
353649
353643
|
if (error) {
|
|
@@ -353653,7 +353647,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
353653
353647
|
},
|
|
353654
353648
|
[setAuthError, setAuthState]
|
|
353655
353649
|
);
|
|
353656
|
-
const handleAuthFailure = (0,
|
|
353650
|
+
const handleAuthFailure = (0, import_react104.useCallback)(
|
|
353657
353651
|
(error) => {
|
|
353658
353652
|
setIsAuthenticating(false);
|
|
353659
353653
|
const errorMessage = t2("Failed to authenticate. Message: {{message}}", {
|
|
@@ -353672,7 +353666,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
353672
353666
|
},
|
|
353673
353667
|
[onAuthError, pendingAuthType, config]
|
|
353674
353668
|
);
|
|
353675
|
-
const handleAuthSuccess = (0,
|
|
353669
|
+
const handleAuthSuccess = (0, import_react104.useCallback)(
|
|
353676
353670
|
async (authType, scope, credentials) => {
|
|
353677
353671
|
try {
|
|
353678
353672
|
settings.setValue(scope, "security.auth.selectedType", authType);
|
|
@@ -353719,7 +353713,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
353719
353713
|
},
|
|
353720
353714
|
[settings, handleAuthFailure, config, addItem]
|
|
353721
353715
|
);
|
|
353722
|
-
const performAuth = (0,
|
|
353716
|
+
const performAuth = (0, import_react104.useCallback)(
|
|
353723
353717
|
async (authType, scope, credentials) => {
|
|
353724
353718
|
try {
|
|
353725
353719
|
await config.refreshAuth(authType);
|
|
@@ -353730,7 +353724,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
353730
353724
|
},
|
|
353731
353725
|
[config, handleAuthSuccess, handleAuthFailure]
|
|
353732
353726
|
);
|
|
353733
|
-
const handleAuthSelect = (0,
|
|
353727
|
+
const handleAuthSelect = (0, import_react104.useCallback)(
|
|
353734
353728
|
async (authType, scope, credentials) => {
|
|
353735
353729
|
if (!authType) {
|
|
353736
353730
|
setIsAuthDialogOpen(false);
|
|
@@ -353756,21 +353750,30 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
353756
353750
|
if (credentials) {
|
|
353757
353751
|
config.updateCredentials({
|
|
353758
353752
|
apiKey: credentials.apiKey,
|
|
353759
|
-
baseUrl: credentials.baseUrl || "https://
|
|
353753
|
+
baseUrl: credentials.baseUrl || "https://osa.dev",
|
|
353760
353754
|
model: credentials.model || "qwen3-coder:480b-cloud"
|
|
353761
353755
|
});
|
|
353762
353756
|
await performAuth(authType, scope, credentials);
|
|
353763
353757
|
}
|
|
353764
353758
|
return;
|
|
353765
353759
|
}
|
|
353760
|
+
if (authType === AuthType2.OLLAMA_LOCAL) {
|
|
353761
|
+
config.updateCredentials({
|
|
353762
|
+
apiKey: "ollama",
|
|
353763
|
+
baseUrl: "http://localhost:11434/v1",
|
|
353764
|
+
model: credentials?.model || "qwen2.5-coder:32b"
|
|
353765
|
+
});
|
|
353766
|
+
await performAuth(authType, scope, credentials);
|
|
353767
|
+
return;
|
|
353768
|
+
}
|
|
353766
353769
|
await performAuth(authType, scope);
|
|
353767
353770
|
},
|
|
353768
353771
|
[config, performAuth]
|
|
353769
353772
|
);
|
|
353770
|
-
const openAuthDialog = (0,
|
|
353773
|
+
const openAuthDialog = (0, import_react104.useCallback)(() => {
|
|
353771
353774
|
setIsAuthDialogOpen(true);
|
|
353772
353775
|
}, []);
|
|
353773
|
-
const cancelAuthentication = (0,
|
|
353776
|
+
const cancelAuthentication = (0, import_react104.useCallback)(() => {
|
|
353774
353777
|
if (isAuthenticating && pendingAuthType === AuthType2.OSA_OAUTH) {
|
|
353775
353778
|
cancelOSAAuth();
|
|
353776
353779
|
}
|
|
@@ -353782,17 +353785,21 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
353782
353785
|
setIsAuthDialogOpen(true);
|
|
353783
353786
|
setAuthError(null);
|
|
353784
353787
|
}, [isAuthenticating, pendingAuthType, cancelOSAAuth, config]);
|
|
353785
|
-
(0,
|
|
353788
|
+
(0, import_react104.useEffect)(() => {
|
|
353786
353789
|
const defaultAuthType = process.env["OSA_DEFAULT_AUTH_TYPE"];
|
|
353787
|
-
|
|
353788
|
-
|
|
353789
|
-
|
|
353790
|
+
const validAuthTypes = [
|
|
353791
|
+
AuthType2.OSA_OAUTH,
|
|
353792
|
+
AuthType2.USE_OPENAI,
|
|
353793
|
+
AuthType2.OLLAMA_CLOUD,
|
|
353794
|
+
AuthType2.OLLAMA_LOCAL
|
|
353795
|
+
];
|
|
353796
|
+
if (defaultAuthType && !validAuthTypes.includes(defaultAuthType)) {
|
|
353790
353797
|
onAuthError(
|
|
353791
353798
|
t2(
|
|
353792
353799
|
'Invalid OSA_DEFAULT_AUTH_TYPE value: "{{value}}". Valid values are: {{validValues}}',
|
|
353793
353800
|
{
|
|
353794
353801
|
value: defaultAuthType,
|
|
353795
|
-
validValues:
|
|
353802
|
+
validValues: validAuthTypes.join(", ")
|
|
353796
353803
|
}
|
|
353797
353804
|
)
|
|
353798
353805
|
);
|
|
@@ -353815,7 +353822,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings, config, addItem) => {
|
|
|
353815
353822
|
|
|
353816
353823
|
// packages/cli/src/ui/hooks/useQuotaAndFallback.ts
|
|
353817
353824
|
init_esbuild_shims();
|
|
353818
|
-
var
|
|
353825
|
+
var import_react105 = __toESM(require_react(), 1);
|
|
353819
353826
|
function useQuotaAndFallback({
|
|
353820
353827
|
config,
|
|
353821
353828
|
historyManager,
|
|
@@ -353823,9 +353830,9 @@ function useQuotaAndFallback({
|
|
|
353823
353830
|
setAuthState,
|
|
353824
353831
|
setModelSwitchedFromQuotaError
|
|
353825
353832
|
}) {
|
|
353826
|
-
const [proQuotaRequest, setProQuotaRequest] = (0,
|
|
353827
|
-
const isDialogPending = (0,
|
|
353828
|
-
(0,
|
|
353833
|
+
const [proQuotaRequest, setProQuotaRequest] = (0, import_react105.useState)(null);
|
|
353834
|
+
const isDialogPending = (0, import_react105.useRef)(false);
|
|
353835
|
+
(0, import_react105.useEffect)(() => {
|
|
353829
353836
|
const fallbackHandler = /* @__PURE__ */ __name(async (failedModel, fallbackModel, error) => {
|
|
353830
353837
|
if (config.isInFallbackMode()) {
|
|
353831
353838
|
return null;
|
|
@@ -353903,7 +353910,7 @@ function useQuotaAndFallback({
|
|
|
353903
353910
|
}, "fallbackHandler");
|
|
353904
353911
|
config.setFallbackModelHandler(fallbackHandler);
|
|
353905
353912
|
}, [config, historyManager, userTier, setModelSwitchedFromQuotaError]);
|
|
353906
|
-
const handleProQuotaChoice = (0,
|
|
353913
|
+
const handleProQuotaChoice = (0, import_react105.useCallback)(
|
|
353907
353914
|
(choice2) => {
|
|
353908
353915
|
if (!proQuotaRequest) return;
|
|
353909
353916
|
const intent = choice2 === "auth" ? "auth" : "retry";
|
|
@@ -353933,13 +353940,13 @@ __name(useQuotaAndFallback, "useQuotaAndFallback");
|
|
|
353933
353940
|
|
|
353934
353941
|
// packages/cli/src/ui/hooks/useEditorSettings.ts
|
|
353935
353942
|
init_esbuild_shims();
|
|
353936
|
-
var
|
|
353943
|
+
var import_react106 = __toESM(require_react(), 1);
|
|
353937
353944
|
var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError, addItem) => {
|
|
353938
|
-
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0,
|
|
353939
|
-
const openEditorDialog = (0,
|
|
353945
|
+
const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react106.useState)(false);
|
|
353946
|
+
const openEditorDialog = (0, import_react106.useCallback)(() => {
|
|
353940
353947
|
setIsEditorDialogOpen(true);
|
|
353941
353948
|
}, []);
|
|
353942
|
-
const handleEditorSelect = (0,
|
|
353949
|
+
const handleEditorSelect = (0, import_react106.useCallback)(
|
|
353943
353950
|
(editorType, scope) => {
|
|
353944
353951
|
if (editorType && (!checkHasEditorType(editorType) || !allowEditorTypeInSandbox(editorType))) {
|
|
353945
353952
|
return;
|
|
@@ -353961,7 +353968,7 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
353961
353968
|
},
|
|
353962
353969
|
[loadedSettings, setEditorError, addItem]
|
|
353963
353970
|
);
|
|
353964
|
-
const exitEditorDialog = (0,
|
|
353971
|
+
const exitEditorDialog = (0, import_react106.useCallback)(() => {
|
|
353965
353972
|
setIsEditorDialogOpen(false);
|
|
353966
353973
|
}, []);
|
|
353967
353974
|
return {
|
|
@@ -353974,13 +353981,13 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
|
|
|
353974
353981
|
|
|
353975
353982
|
// packages/cli/src/ui/hooks/useSettingsCommand.ts
|
|
353976
353983
|
init_esbuild_shims();
|
|
353977
|
-
var
|
|
353984
|
+
var import_react107 = __toESM(require_react(), 1);
|
|
353978
353985
|
function useSettingsCommand() {
|
|
353979
|
-
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0,
|
|
353980
|
-
const openSettingsDialog = (0,
|
|
353986
|
+
const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react107.useState)(false);
|
|
353987
|
+
const openSettingsDialog = (0, import_react107.useCallback)(() => {
|
|
353981
353988
|
setIsSettingsDialogOpen(true);
|
|
353982
353989
|
}, []);
|
|
353983
|
-
const closeSettingsDialog = (0,
|
|
353990
|
+
const closeSettingsDialog = (0, import_react107.useCallback)(() => {
|
|
353984
353991
|
setIsSettingsDialogOpen(false);
|
|
353985
353992
|
}, []);
|
|
353986
353993
|
return {
|
|
@@ -353993,13 +354000,13 @@ __name(useSettingsCommand, "useSettingsCommand");
|
|
|
353993
354000
|
|
|
353994
354001
|
// packages/cli/src/ui/hooks/useModelCommand.ts
|
|
353995
354002
|
init_esbuild_shims();
|
|
353996
|
-
var
|
|
354003
|
+
var import_react108 = __toESM(require_react(), 1);
|
|
353997
354004
|
var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
353998
|
-
const [isModelDialogOpen, setIsModelDialogOpen] = (0,
|
|
353999
|
-
const openModelDialog = (0,
|
|
354005
|
+
const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react108.useState)(false);
|
|
354006
|
+
const openModelDialog = (0, import_react108.useCallback)(() => {
|
|
354000
354007
|
setIsModelDialogOpen(true);
|
|
354001
354008
|
}, []);
|
|
354002
|
-
const closeModelDialog = (0,
|
|
354009
|
+
const closeModelDialog = (0, import_react108.useCallback)(() => {
|
|
354003
354010
|
setIsModelDialogOpen(false);
|
|
354004
354011
|
}, []);
|
|
354005
354012
|
return {
|
|
@@ -354011,13 +354018,13 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
|
354011
354018
|
|
|
354012
354019
|
// packages/cli/src/ui/hooks/useApprovalModeCommand.ts
|
|
354013
354020
|
init_esbuild_shims();
|
|
354014
|
-
var
|
|
354021
|
+
var import_react109 = __toESM(require_react(), 1);
|
|
354015
354022
|
var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) => {
|
|
354016
|
-
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0,
|
|
354017
|
-
const openApprovalModeDialog = (0,
|
|
354023
|
+
const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react109.useState)(false);
|
|
354024
|
+
const openApprovalModeDialog = (0, import_react109.useCallback)(() => {
|
|
354018
354025
|
setIsApprovalModeDialogOpen(true);
|
|
354019
354026
|
}, []);
|
|
354020
|
-
const handleApprovalModeSelect = (0,
|
|
354027
|
+
const handleApprovalModeSelect = (0, import_react109.useCallback)(
|
|
354021
354028
|
(mode, scope) => {
|
|
354022
354029
|
try {
|
|
354023
354030
|
if (!mode) {
|
|
@@ -354043,7 +354050,7 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config) =>
|
|
|
354043
354050
|
|
|
354044
354051
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
354045
354052
|
init_esbuild_shims();
|
|
354046
|
-
var
|
|
354053
|
+
var import_react110 = __toESM(require_react(), 1);
|
|
354047
354054
|
init_node();
|
|
354048
354055
|
import process39 from "node:process";
|
|
354049
354056
|
|
|
@@ -354287,41 +354294,41 @@ var McpPromptLoader = class {
|
|
|
354287
354294
|
// packages/cli/src/ui/hooks/slashCommandProcessor.ts
|
|
354288
354295
|
var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem, clearItems, loadHistory, refreshStatic, toggleVimEnabled, setIsProcessing, setOSAMdFileCount, actions, extensionsUpdateState, isConfigInitialized) => {
|
|
354289
354296
|
const session = useSessionStats();
|
|
354290
|
-
const [commands, setCommands] = (0,
|
|
354291
|
-
const [reloadTrigger, setReloadTrigger] = (0,
|
|
354292
|
-
const reloadCommands = (0,
|
|
354297
|
+
const [commands, setCommands] = (0, import_react110.useState)([]);
|
|
354298
|
+
const [reloadTrigger, setReloadTrigger] = (0, import_react110.useState)(0);
|
|
354299
|
+
const reloadCommands = (0, import_react110.useCallback)(() => {
|
|
354293
354300
|
setReloadTrigger((v) => v + 1);
|
|
354294
354301
|
}, []);
|
|
354295
|
-
const [shellConfirmationRequest, setShellConfirmationRequest] = (0,
|
|
354296
|
-
const [confirmationRequest, setConfirmationRequest] = (0,
|
|
354297
|
-
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0,
|
|
354298
|
-
const [sessionShellAllowlist, setSessionShellAllowlist] = (0,
|
|
354302
|
+
const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react110.useState)(null);
|
|
354303
|
+
const [confirmationRequest, setConfirmationRequest] = (0, import_react110.useState)(null);
|
|
354304
|
+
const [quitConfirmationRequest, setQuitConfirmationRequest] = (0, import_react110.useState)(null);
|
|
354305
|
+
const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react110.useState)(
|
|
354299
354306
|
/* @__PURE__ */ new Set()
|
|
354300
354307
|
);
|
|
354301
|
-
const gitService = (0,
|
|
354308
|
+
const gitService = (0, import_react110.useMemo)(() => {
|
|
354302
354309
|
if (!config?.getProjectRoot()) {
|
|
354303
354310
|
return;
|
|
354304
354311
|
}
|
|
354305
354312
|
return new GitService(config.getProjectRoot(), config.storage);
|
|
354306
354313
|
}, [config]);
|
|
354307
|
-
const logger6 = (0,
|
|
354314
|
+
const logger6 = (0, import_react110.useMemo)(() => {
|
|
354308
354315
|
const l2 = new Logger(
|
|
354309
354316
|
config?.getSessionId() || "",
|
|
354310
354317
|
config?.storage ?? new Storage(process39.cwd())
|
|
354311
354318
|
);
|
|
354312
354319
|
return l2;
|
|
354313
354320
|
}, [config]);
|
|
354314
|
-
const [pendingItem, setPendingItem] = (0,
|
|
354321
|
+
const [pendingItem, setPendingItem] = (0, import_react110.useState)(
|
|
354315
354322
|
null
|
|
354316
354323
|
);
|
|
354317
|
-
const pendingHistoryItems = (0,
|
|
354324
|
+
const pendingHistoryItems = (0, import_react110.useMemo)(() => {
|
|
354318
354325
|
const items = [];
|
|
354319
354326
|
if (pendingItem != null) {
|
|
354320
354327
|
items.push(pendingItem);
|
|
354321
354328
|
}
|
|
354322
354329
|
return items;
|
|
354323
354330
|
}, [pendingItem]);
|
|
354324
|
-
const addMessage = (0,
|
|
354331
|
+
const addMessage = (0, import_react110.useCallback)(
|
|
354325
354332
|
(message2) => {
|
|
354326
354333
|
let historyItemContent;
|
|
354327
354334
|
if (message2.type === "about" /* ABOUT */) {
|
|
@@ -354377,7 +354384,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
354377
354384
|
},
|
|
354378
354385
|
[addItem]
|
|
354379
354386
|
);
|
|
354380
|
-
const commandContext = (0,
|
|
354387
|
+
const commandContext = (0, import_react110.useMemo)(
|
|
354381
354388
|
() => ({
|
|
354382
354389
|
services: {
|
|
354383
354390
|
config,
|
|
@@ -354430,7 +354437,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
354430
354437
|
extensionsUpdateState
|
|
354431
354438
|
]
|
|
354432
354439
|
);
|
|
354433
|
-
(0,
|
|
354440
|
+
(0, import_react110.useEffect)(() => {
|
|
354434
354441
|
if (!config) {
|
|
354435
354442
|
return;
|
|
354436
354443
|
}
|
|
@@ -354448,7 +354455,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
354448
354455
|
})();
|
|
354449
354456
|
};
|
|
354450
354457
|
}, [config, reloadCommands]);
|
|
354451
|
-
(0,
|
|
354458
|
+
(0, import_react110.useEffect)(() => {
|
|
354452
354459
|
const controller = new AbortController();
|
|
354453
354460
|
const load = /* @__PURE__ */ __name(async () => {
|
|
354454
354461
|
const loaders = [
|
|
@@ -354467,7 +354474,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
354467
354474
|
controller.abort();
|
|
354468
354475
|
};
|
|
354469
354476
|
}, [config, reloadTrigger, isConfigInitialized]);
|
|
354470
|
-
const handleSlashCommand2 = (0,
|
|
354477
|
+
const handleSlashCommand2 = (0, import_react110.useCallback)(
|
|
354471
354478
|
async (rawQuery, oneTimeShellAllowlist, overwriteConfirmed) => {
|
|
354472
354479
|
if (typeof rawQuery !== "string") {
|
|
354473
354480
|
return false;
|
|
@@ -354776,7 +354783,7 @@ ${commandToExecute.subCommands.map((sc) => ` - ${sc.name}: ${sc.description ||
|
|
|
354776
354783
|
|
|
354777
354784
|
// packages/cli/src/ui/hooks/useConsoleMessages.ts
|
|
354778
354785
|
init_esbuild_shims();
|
|
354779
|
-
var
|
|
354786
|
+
var import_react111 = __toESM(require_react(), 1);
|
|
354780
354787
|
function consoleMessagesReducer(state, action) {
|
|
354781
354788
|
switch (action.type) {
|
|
354782
354789
|
case "ADD_MESSAGES": {
|
|
@@ -354802,11 +354809,11 @@ function consoleMessagesReducer(state, action) {
|
|
|
354802
354809
|
}
|
|
354803
354810
|
__name(consoleMessagesReducer, "consoleMessagesReducer");
|
|
354804
354811
|
function useConsoleMessages() {
|
|
354805
|
-
const [consoleMessages, dispatch] = (0,
|
|
354806
|
-
const messageQueueRef = (0,
|
|
354807
|
-
const timeoutRef = (0,
|
|
354808
|
-
const [, startTransition] = (0,
|
|
354809
|
-
const processQueue = (0,
|
|
354812
|
+
const [consoleMessages, dispatch] = (0, import_react111.useReducer)(consoleMessagesReducer, []);
|
|
354813
|
+
const messageQueueRef = (0, import_react111.useRef)([]);
|
|
354814
|
+
const timeoutRef = (0, import_react111.useRef)(null);
|
|
354815
|
+
const [, startTransition] = (0, import_react111.useTransition)();
|
|
354816
|
+
const processQueue = (0, import_react111.useCallback)(() => {
|
|
354810
354817
|
if (messageQueueRef.current.length > 0) {
|
|
354811
354818
|
const messagesToProcess = messageQueueRef.current;
|
|
354812
354819
|
messageQueueRef.current = [];
|
|
@@ -354816,7 +354823,7 @@ function useConsoleMessages() {
|
|
|
354816
354823
|
}
|
|
354817
354824
|
timeoutRef.current = null;
|
|
354818
354825
|
}, []);
|
|
354819
|
-
const handleNewMessage = (0,
|
|
354826
|
+
const handleNewMessage = (0, import_react111.useCallback)(
|
|
354820
354827
|
(message2) => {
|
|
354821
354828
|
messageQueueRef.current.push(message2);
|
|
354822
354829
|
if (!timeoutRef.current) {
|
|
@@ -354825,7 +354832,7 @@ function useConsoleMessages() {
|
|
|
354825
354832
|
},
|
|
354826
354833
|
[processQueue]
|
|
354827
354834
|
);
|
|
354828
|
-
const clearConsoleMessages = (0,
|
|
354835
|
+
const clearConsoleMessages = (0, import_react111.useCallback)(() => {
|
|
354829
354836
|
if (timeoutRef.current) {
|
|
354830
354837
|
clearTimeout(timeoutRef.current);
|
|
354831
354838
|
timeoutRef.current = null;
|
|
@@ -354835,7 +354842,7 @@ function useConsoleMessages() {
|
|
|
354835
354842
|
dispatch({ type: "CLEAR" });
|
|
354836
354843
|
});
|
|
354837
354844
|
}, []);
|
|
354838
|
-
(0,
|
|
354845
|
+
(0, import_react111.useEffect)(
|
|
354839
354846
|
() => () => {
|
|
354840
354847
|
if (timeoutRef.current) {
|
|
354841
354848
|
clearTimeout(timeoutRef.current);
|
|
@@ -354865,10 +354872,10 @@ __name(computeWindowTitle, "computeWindowTitle");
|
|
|
354865
354872
|
|
|
354866
354873
|
// packages/cli/src/ui/hooks/useLogger.ts
|
|
354867
354874
|
init_esbuild_shims();
|
|
354868
|
-
var
|
|
354875
|
+
var import_react112 = __toESM(require_react(), 1);
|
|
354869
354876
|
var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
354870
|
-
const [logger6, setLogger] = (0,
|
|
354871
|
-
(0,
|
|
354877
|
+
const [logger6, setLogger] = (0, import_react112.useState)(null);
|
|
354878
|
+
(0, import_react112.useEffect)(() => {
|
|
354872
354879
|
const newLogger = new Logger(sessionId, storage);
|
|
354873
354880
|
newLogger.initialize().then(() => {
|
|
354874
354881
|
setLogger(newLogger);
|
|
@@ -354880,12 +354887,12 @@ var useLogger = /* @__PURE__ */ __name((storage) => {
|
|
|
354880
354887
|
|
|
354881
354888
|
// packages/cli/src/ui/hooks/useGeminiStream.ts
|
|
354882
354889
|
init_esbuild_shims();
|
|
354883
|
-
var
|
|
354890
|
+
var import_react117 = __toESM(require_react(), 1);
|
|
354884
354891
|
init_node();
|
|
354885
354892
|
|
|
354886
354893
|
// packages/cli/src/ui/hooks/shellCommandProcessor.ts
|
|
354887
354894
|
init_esbuild_shims();
|
|
354888
|
-
var
|
|
354895
|
+
var import_react113 = __toESM(require_react(), 1);
|
|
354889
354896
|
init_node();
|
|
354890
354897
|
import crypto17 from "node:crypto";
|
|
354891
354898
|
import path98 from "node:path";
|
|
@@ -354914,8 +354921,8 @@ ${modelContent}
|
|
|
354914
354921
|
}
|
|
354915
354922
|
__name(addShellCommandToOSAHistory, "addShellCommandToOSAHistory");
|
|
354916
354923
|
var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config, OSAClient2, setShellInputFocused, terminalWidth, terminalHeight) => {
|
|
354917
|
-
const [activeShellPtyId, setActiveShellPtyId] = (0,
|
|
354918
|
-
const handleShellCommand = (0,
|
|
354924
|
+
const [activeShellPtyId, setActiveShellPtyId] = (0, import_react113.useState)(null);
|
|
354925
|
+
const handleShellCommand = (0, import_react113.useCallback)(
|
|
354919
354926
|
(rawQuery, abortSignal) => {
|
|
354920
354927
|
if (typeof rawQuery !== "string" || rawQuery.trim() === "") {
|
|
354921
354928
|
return false;
|
|
@@ -355164,7 +355171,7 @@ ${finalOutput}`;
|
|
|
355164
355171
|
// packages/cli/src/ui/hooks/useVisionAutoSwitch.ts
|
|
355165
355172
|
init_esbuild_shims();
|
|
355166
355173
|
init_node();
|
|
355167
|
-
var
|
|
355174
|
+
var import_react114 = __toESM(require_react(), 1);
|
|
355168
355175
|
function hasImageParts(parts) {
|
|
355169
355176
|
if (typeof parts === "string") {
|
|
355170
355177
|
return false;
|
|
@@ -355253,8 +355260,8 @@ function processVisionSwitchOutcome(outcome) {
|
|
|
355253
355260
|
}
|
|
355254
355261
|
__name(processVisionSwitchOutcome, "processVisionSwitchOutcome");
|
|
355255
355262
|
function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true, onVisionSwitchRequired) {
|
|
355256
|
-
const originalModelRef = (0,
|
|
355257
|
-
const handleVisionSwitch = (0,
|
|
355263
|
+
const originalModelRef = (0, import_react114.useRef)(null);
|
|
355264
|
+
const handleVisionSwitch = (0, import_react114.useCallback)(
|
|
355258
355265
|
async (query, userMessageTimestamp, isContinuation) => {
|
|
355259
355266
|
if (isContinuation || !onVisionSwitchRequired) {
|
|
355260
355267
|
return { shouldProceed: true };
|
|
@@ -355355,7 +355362,7 @@ function useVisionAutoSwitch(config, addItem, visionModelPreviewEnabled = true,
|
|
|
355355
355362
|
},
|
|
355356
355363
|
[config, addItem, visionModelPreviewEnabled, onVisionSwitchRequired]
|
|
355357
355364
|
);
|
|
355358
|
-
const restoreOriginalModel = (0,
|
|
355365
|
+
const restoreOriginalModel = (0, import_react114.useCallback)(async () => {
|
|
355359
355366
|
if (originalModelRef.current) {
|
|
355360
355367
|
await config.setModel(originalModelRef.current, {
|
|
355361
355368
|
reason: "vision_auto_switch",
|
|
@@ -355432,11 +355439,11 @@ var findLastSafeSplitPoint = /* @__PURE__ */ __name((content) => {
|
|
|
355432
355439
|
|
|
355433
355440
|
// packages/cli/src/ui/hooks/useStateAndRef.ts
|
|
355434
355441
|
init_esbuild_shims();
|
|
355435
|
-
var
|
|
355442
|
+
var import_react115 = __toESM(require_react(), 1);
|
|
355436
355443
|
var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
355437
|
-
const [state, setState] =
|
|
355438
|
-
const ref =
|
|
355439
|
-
const setStateInternal =
|
|
355444
|
+
const [state, setState] = import_react115.default.useState(initialValue);
|
|
355445
|
+
const ref = import_react115.default.useRef(initialValue);
|
|
355446
|
+
const setStateInternal = import_react115.default.useCallback(
|
|
355440
355447
|
(newStateOrCallback) => {
|
|
355441
355448
|
let newValue;
|
|
355442
355449
|
if (typeof newStateOrCallback === "function") {
|
|
@@ -355454,10 +355461,10 @@ var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
|
|
|
355454
355461
|
|
|
355455
355462
|
// packages/cli/src/ui/hooks/useReactToolScheduler.ts
|
|
355456
355463
|
init_esbuild_shims();
|
|
355457
|
-
var
|
|
355464
|
+
var import_react116 = __toESM(require_react(), 1);
|
|
355458
355465
|
function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorClose) {
|
|
355459
|
-
const [toolCallsForDisplay, setToolCallsForDisplay] = (0,
|
|
355460
|
-
const outputUpdateHandler = (0,
|
|
355466
|
+
const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react116.useState)([]);
|
|
355467
|
+
const outputUpdateHandler = (0, import_react116.useCallback)(
|
|
355461
355468
|
(toolCallId, outputChunk) => {
|
|
355462
355469
|
setToolCallsForDisplay(
|
|
355463
355470
|
(prevCalls) => prevCalls.map((tc) => {
|
|
@@ -355471,13 +355478,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
355471
355478
|
},
|
|
355472
355479
|
[]
|
|
355473
355480
|
);
|
|
355474
|
-
const allToolCallsCompleteHandler = (0,
|
|
355481
|
+
const allToolCallsCompleteHandler = (0, import_react116.useCallback)(
|
|
355475
355482
|
async (completedToolCalls) => {
|
|
355476
355483
|
await onComplete(completedToolCalls);
|
|
355477
355484
|
},
|
|
355478
355485
|
[onComplete]
|
|
355479
355486
|
);
|
|
355480
|
-
const toolCallsUpdateHandler = (0,
|
|
355487
|
+
const toolCallsUpdateHandler = (0, import_react116.useCallback)(
|
|
355481
355488
|
(updatedCoreToolCalls) => {
|
|
355482
355489
|
setToolCallsForDisplay(
|
|
355483
355490
|
(prevTrackedCalls) => updatedCoreToolCalls.map((coreTc) => {
|
|
@@ -355504,7 +355511,7 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
355504
355511
|
},
|
|
355505
355512
|
[setToolCallsForDisplay]
|
|
355506
355513
|
);
|
|
355507
|
-
const scheduler = (0,
|
|
355514
|
+
const scheduler = (0, import_react116.useMemo)(
|
|
355508
355515
|
() => new CoreToolScheduler({
|
|
355509
355516
|
outputUpdateHandler,
|
|
355510
355517
|
onAllToolCallsComplete: allToolCallsCompleteHandler,
|
|
@@ -355523,13 +355530,13 @@ function useReactToolScheduler(onComplete, config, getPreferredEditor, onEditorC
|
|
|
355523
355530
|
onEditorClose
|
|
355524
355531
|
]
|
|
355525
355532
|
);
|
|
355526
|
-
const schedule = (0,
|
|
355533
|
+
const schedule = (0, import_react116.useCallback)(
|
|
355527
355534
|
(request4, signal) => {
|
|
355528
355535
|
void scheduler.schedule(request4, signal);
|
|
355529
355536
|
},
|
|
355530
355537
|
[scheduler]
|
|
355531
355538
|
);
|
|
355532
|
-
const markToolsAsSubmitted = (0,
|
|
355539
|
+
const markToolsAsSubmitted = (0, import_react116.useCallback)(
|
|
355533
355540
|
(callIdsToMark) => {
|
|
355534
355541
|
setToolCallsForDisplay(
|
|
355535
355542
|
(prevCalls) => prevCalls.map(
|
|
@@ -355669,18 +355676,18 @@ function showCitations(settings) {
|
|
|
355669
355676
|
}
|
|
355670
355677
|
__name(showCitations, "showCitations");
|
|
355671
355678
|
var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config, settings, onDebugMessage, handleSlashCommand2, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError, onEditorClose, onCancelSubmit, visionModelPreviewEnabled, setShellInputFocused, terminalWidth, terminalHeight, onVisionSwitchRequired, isShellFocused) => {
|
|
355672
|
-
const [initError, setInitError] = (0,
|
|
355673
|
-
const abortControllerRef = (0,
|
|
355674
|
-
const turnCancelledRef = (0,
|
|
355675
|
-
const isSubmittingQueryRef = (0,
|
|
355676
|
-
const [isResponding, setIsResponding] = (0,
|
|
355677
|
-
const [thought, setThought] = (0,
|
|
355679
|
+
const [initError, setInitError] = (0, import_react117.useState)(null);
|
|
355680
|
+
const abortControllerRef = (0, import_react117.useRef)(null);
|
|
355681
|
+
const turnCancelledRef = (0, import_react117.useRef)(false);
|
|
355682
|
+
const isSubmittingQueryRef = (0, import_react117.useRef)(false);
|
|
355683
|
+
const [isResponding, setIsResponding] = (0, import_react117.useState)(false);
|
|
355684
|
+
const [thought, setThought] = (0, import_react117.useState)(null);
|
|
355678
355685
|
const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
|
|
355679
|
-
const processedMemoryToolsRef = (0,
|
|
355686
|
+
const processedMemoryToolsRef = (0, import_react117.useRef)(/* @__PURE__ */ new Set());
|
|
355680
355687
|
const { startNewPrompt, getPromptCount } = useSessionStats();
|
|
355681
355688
|
const storage = config.storage;
|
|
355682
355689
|
const logger6 = useLogger(storage);
|
|
355683
|
-
const gitService = (0,
|
|
355690
|
+
const gitService = (0, import_react117.useMemo)(() => {
|
|
355684
355691
|
if (!config.getProjectRoot()) {
|
|
355685
355692
|
return;
|
|
355686
355693
|
}
|
|
@@ -355704,11 +355711,11 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355704
355711
|
getPreferredEditor,
|
|
355705
355712
|
onEditorClose
|
|
355706
355713
|
);
|
|
355707
|
-
const pendingToolCallGroupDisplay = (0,
|
|
355714
|
+
const pendingToolCallGroupDisplay = (0, import_react117.useMemo)(
|
|
355708
355715
|
() => toolCalls.length ? mapToDisplay(toolCalls) : void 0,
|
|
355709
355716
|
[toolCalls]
|
|
355710
355717
|
);
|
|
355711
|
-
const activeToolPtyId = (0,
|
|
355718
|
+
const activeToolPtyId = (0, import_react117.useMemo)(() => {
|
|
355712
355719
|
const executingShellTool = toolCalls?.find(
|
|
355713
355720
|
(tc) => tc.status === "executing" && tc.request.name === "run_shell_command"
|
|
355714
355721
|
);
|
|
@@ -355717,12 +355724,12 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355717
355724
|
}
|
|
355718
355725
|
return void 0;
|
|
355719
355726
|
}, [toolCalls]);
|
|
355720
|
-
const loopDetectedRef = (0,
|
|
355727
|
+
const loopDetectedRef = (0, import_react117.useRef)(false);
|
|
355721
355728
|
const [
|
|
355722
355729
|
loopDetectionConfirmationRequest,
|
|
355723
355730
|
setLoopDetectionConfirmationRequest
|
|
355724
|
-
] = (0,
|
|
355725
|
-
const onExec = (0,
|
|
355731
|
+
] = (0, import_react117.useState)(null);
|
|
355732
|
+
const onExec = (0, import_react117.useCallback)(async (done) => {
|
|
355726
355733
|
setIsResponding(true);
|
|
355727
355734
|
await done;
|
|
355728
355735
|
setIsResponding(false);
|
|
@@ -355745,12 +355752,12 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355745
355752
|
onVisionSwitchRequired
|
|
355746
355753
|
);
|
|
355747
355754
|
const activePtyId = activeShellPtyId || activeToolPtyId;
|
|
355748
|
-
(0,
|
|
355755
|
+
(0, import_react117.useEffect)(() => {
|
|
355749
355756
|
if (!activePtyId) {
|
|
355750
355757
|
setShellInputFocused(false);
|
|
355751
355758
|
}
|
|
355752
355759
|
}, [activePtyId, setShellInputFocused]);
|
|
355753
|
-
const streamingState = (0,
|
|
355760
|
+
const streamingState = (0, import_react117.useMemo)(() => {
|
|
355754
355761
|
if (toolCalls.some((tc) => tc.status === "awaiting_approval")) {
|
|
355755
355762
|
return "waiting_for_confirmation" /* WaitingForConfirmation */;
|
|
355756
355763
|
}
|
|
@@ -355761,7 +355768,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355761
355768
|
}
|
|
355762
355769
|
return "idle" /* Idle */;
|
|
355763
355770
|
}, [isResponding, toolCalls]);
|
|
355764
|
-
(0,
|
|
355771
|
+
(0, import_react117.useEffect)(() => {
|
|
355765
355772
|
if (config.getApprovalMode() === ApprovalMode.YOLO && streamingState === "idle" /* Idle */) {
|
|
355766
355773
|
const lastUserMessageIndex = history.findLastIndex(
|
|
355767
355774
|
(item) => item.type === "user" /* USER */
|
|
@@ -355775,7 +355782,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355775
355782
|
}
|
|
355776
355783
|
}
|
|
355777
355784
|
}, [streamingState, config, history]);
|
|
355778
|
-
const cancelOngoingRequest = (0,
|
|
355785
|
+
const cancelOngoingRequest = (0, import_react117.useCallback)(() => {
|
|
355779
355786
|
if (streamingState !== "responding" /* Responding */) {
|
|
355780
355787
|
return;
|
|
355781
355788
|
}
|
|
@@ -355824,7 +355831,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355824
355831
|
},
|
|
355825
355832
|
{ isActive: streamingState === "responding" /* Responding */ }
|
|
355826
355833
|
);
|
|
355827
|
-
const prepareQueryForOSA = (0,
|
|
355834
|
+
const prepareQueryForOSA = (0, import_react117.useCallback)(
|
|
355828
355835
|
async (query, userMessageTimestamp, abortSignal, prompt_id) => {
|
|
355829
355836
|
if (turnCancelledRef.current) {
|
|
355830
355837
|
return { queryToSend: null, shouldProceed: false };
|
|
@@ -355919,7 +355926,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355919
355926
|
scheduleToolCalls
|
|
355920
355927
|
]
|
|
355921
355928
|
);
|
|
355922
|
-
const handleContentEvent = (0,
|
|
355929
|
+
const handleContentEvent = (0, import_react117.useCallback)(
|
|
355923
355930
|
(eventValue, currentOSAMessageBuffer, userMessageTimestamp) => {
|
|
355924
355931
|
if (turnCancelledRef.current) {
|
|
355925
355932
|
return "";
|
|
@@ -355955,7 +355962,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355955
355962
|
},
|
|
355956
355963
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem]
|
|
355957
355964
|
);
|
|
355958
|
-
const handleUserCancelledEvent = (0,
|
|
355965
|
+
const handleUserCancelledEvent = (0, import_react117.useCallback)(
|
|
355959
355966
|
(userMessageTimestamp) => {
|
|
355960
355967
|
if (turnCancelledRef.current) {
|
|
355961
355968
|
return;
|
|
@@ -355984,7 +355991,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
355984
355991
|
},
|
|
355985
355992
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, setThought]
|
|
355986
355993
|
);
|
|
355987
|
-
const handleErrorEvent = (0,
|
|
355994
|
+
const handleErrorEvent = (0, import_react117.useCallback)(
|
|
355988
355995
|
(eventValue, userMessageTimestamp) => {
|
|
355989
355996
|
if (pendingHistoryItemRef.current) {
|
|
355990
355997
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -356007,7 +356014,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356007
356014
|
},
|
|
356008
356015
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, config, setThought]
|
|
356009
356016
|
);
|
|
356010
|
-
const handleCitationEvent = (0,
|
|
356017
|
+
const handleCitationEvent = (0, import_react117.useCallback)(
|
|
356011
356018
|
(text, userMessageTimestamp) => {
|
|
356012
356019
|
if (!showCitations(settings)) {
|
|
356013
356020
|
return;
|
|
@@ -356020,7 +356027,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356020
356027
|
},
|
|
356021
356028
|
[addItem, pendingHistoryItemRef, setPendingHistoryItem, settings]
|
|
356022
356029
|
);
|
|
356023
|
-
const handleFinishedEvent = (0,
|
|
356030
|
+
const handleFinishedEvent = (0, import_react117.useCallback)(
|
|
356024
356031
|
(event, userMessageTimestamp) => {
|
|
356025
356032
|
const finishReason = event.value.reason;
|
|
356026
356033
|
if (!finishReason) {
|
|
@@ -356054,7 +356061,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356054
356061
|
},
|
|
356055
356062
|
[addItem]
|
|
356056
356063
|
);
|
|
356057
|
-
const handleChatCompressionEvent = (0,
|
|
356064
|
+
const handleChatCompressionEvent = (0, import_react117.useCallback)(
|
|
356058
356065
|
(eventValue, userMessageTimestamp) => {
|
|
356059
356066
|
if (pendingHistoryItemRef.current) {
|
|
356060
356067
|
addItem(pendingHistoryItemRef.current, userMessageTimestamp);
|
|
@@ -356070,7 +356077,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356070
356077
|
},
|
|
356071
356078
|
[addItem, config, pendingHistoryItemRef, setPendingHistoryItem]
|
|
356072
356079
|
);
|
|
356073
|
-
const handleMaxSessionTurnsEvent = (0,
|
|
356080
|
+
const handleMaxSessionTurnsEvent = (0, import_react117.useCallback)(
|
|
356074
356081
|
() => addItem(
|
|
356075
356082
|
{
|
|
356076
356083
|
type: "info",
|
|
@@ -356080,7 +356087,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356080
356087
|
),
|
|
356081
356088
|
[addItem, config]
|
|
356082
356089
|
);
|
|
356083
|
-
const handleSessionTokenLimitExceededEvent = (0,
|
|
356090
|
+
const handleSessionTokenLimitExceededEvent = (0, import_react117.useCallback)(
|
|
356084
356091
|
(value) => addItem(
|
|
356085
356092
|
{
|
|
356086
356093
|
type: "error",
|
|
@@ -356095,7 +356102,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356095
356102
|
),
|
|
356096
356103
|
[addItem]
|
|
356097
356104
|
);
|
|
356098
|
-
const handleLoopDetectionConfirmation = (0,
|
|
356105
|
+
const handleLoopDetectionConfirmation = (0, import_react117.useCallback)(
|
|
356099
356106
|
(result) => {
|
|
356100
356107
|
setLoopDetectionConfirmationRequest(null);
|
|
356101
356108
|
if (result.userSelection === "disable") {
|
|
@@ -356119,12 +356126,12 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356119
356126
|
},
|
|
356120
356127
|
[config, addItem]
|
|
356121
356128
|
);
|
|
356122
|
-
const handleLoopDetectedEvent = (0,
|
|
356129
|
+
const handleLoopDetectedEvent = (0, import_react117.useCallback)(() => {
|
|
356123
356130
|
setLoopDetectionConfirmationRequest({
|
|
356124
356131
|
onComplete: handleLoopDetectionConfirmation
|
|
356125
356132
|
});
|
|
356126
356133
|
}, [handleLoopDetectionConfirmation]);
|
|
356127
|
-
const processOSAStreamEvents = (0,
|
|
356134
|
+
const processOSAStreamEvents = (0, import_react117.useCallback)(
|
|
356128
356135
|
async (stream2, userMessageTimestamp, signal) => {
|
|
356129
356136
|
let OSAMessageBuffer = "";
|
|
356130
356137
|
const toolCallRequests = [];
|
|
@@ -356198,7 +356205,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356198
356205
|
handleCitationEvent
|
|
356199
356206
|
]
|
|
356200
356207
|
);
|
|
356201
|
-
const submitQuery = (0,
|
|
356208
|
+
const submitQuery = (0, import_react117.useCallback)(
|
|
356202
356209
|
async (query, options2, prompt_id) => {
|
|
356203
356210
|
if (isSubmittingQueryRef.current && !options2?.isContinuation) {
|
|
356204
356211
|
return;
|
|
@@ -356331,7 +356338,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356331
356338
|
restoreOriginalModel
|
|
356332
356339
|
]
|
|
356333
356340
|
);
|
|
356334
|
-
const handleApprovalModeChange = (0,
|
|
356341
|
+
const handleApprovalModeChange = (0, import_react117.useCallback)(
|
|
356335
356342
|
async (newApprovalMode) => {
|
|
356336
356343
|
if (newApprovalMode === ApprovalMode.YOLO || newApprovalMode === ApprovalMode.AUTO_EDIT) {
|
|
356337
356344
|
let awaitingApprovalCalls = toolCalls.filter(
|
|
@@ -356360,7 +356367,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356360
356367
|
},
|
|
356361
356368
|
[toolCalls]
|
|
356362
356369
|
);
|
|
356363
|
-
const handleCompletedTools = (0,
|
|
356370
|
+
const handleCompletedTools = (0, import_react117.useCallback)(
|
|
356364
356371
|
async (completedToolCallsFromScheduler) => {
|
|
356365
356372
|
if (isResponding) {
|
|
356366
356373
|
return;
|
|
@@ -356445,13 +356452,13 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356445
356452
|
modelSwitchedFromQuotaError
|
|
356446
356453
|
]
|
|
356447
356454
|
);
|
|
356448
|
-
const pendingHistoryItems = (0,
|
|
356455
|
+
const pendingHistoryItems = (0, import_react117.useMemo)(
|
|
356449
356456
|
() => [pendingHistoryItem, pendingToolCallGroupDisplay].filter(
|
|
356450
356457
|
(i) => i !== void 0 && i !== null
|
|
356451
356458
|
),
|
|
356452
356459
|
[pendingHistoryItem, pendingToolCallGroupDisplay]
|
|
356453
356460
|
);
|
|
356454
|
-
(0,
|
|
356461
|
+
(0, import_react117.useEffect)(() => {
|
|
356455
356462
|
const saveRestorableToolCalls = /* @__PURE__ */ __name(async () => {
|
|
356456
356463
|
if (!config.getCheckpointingEnabled()) {
|
|
356457
356464
|
return;
|
|
@@ -356570,7 +356577,7 @@ var useOSAStream = /* @__PURE__ */ __name((OSAClient2, history, addItem, config,
|
|
|
356570
356577
|
|
|
356571
356578
|
// packages/cli/src/ui/hooks/vim.ts
|
|
356572
356579
|
init_esbuild_shims();
|
|
356573
|
-
var
|
|
356580
|
+
var import_react118 = __toESM(require_react(), 1);
|
|
356574
356581
|
var DIGIT_MULTIPLIER = 10;
|
|
356575
356582
|
var DEFAULT_COUNT = 1;
|
|
356576
356583
|
var DIGIT_1_TO_9 = /^[1-9]$/;
|
|
@@ -356633,22 +356640,22 @@ var vimReducer = /* @__PURE__ */ __name((state, action) => {
|
|
|
356633
356640
|
}, "vimReducer");
|
|
356634
356641
|
function useVim(buffer, onSubmit) {
|
|
356635
356642
|
const { vimEnabled, vimMode, setVimMode } = useVimMode();
|
|
356636
|
-
const [state, dispatch] = (0,
|
|
356637
|
-
(0,
|
|
356643
|
+
const [state, dispatch] = (0, import_react118.useReducer)(vimReducer, initialVimState);
|
|
356644
|
+
(0, import_react118.useEffect)(() => {
|
|
356638
356645
|
dispatch({ type: "SET_MODE", mode: vimMode });
|
|
356639
356646
|
}, [vimMode]);
|
|
356640
|
-
const updateMode = (0,
|
|
356647
|
+
const updateMode = (0, import_react118.useCallback)(
|
|
356641
356648
|
(mode) => {
|
|
356642
356649
|
setVimMode(mode);
|
|
356643
356650
|
dispatch({ type: "SET_MODE", mode });
|
|
356644
356651
|
},
|
|
356645
356652
|
[setVimMode]
|
|
356646
356653
|
);
|
|
356647
|
-
const getCurrentCount = (0,
|
|
356654
|
+
const getCurrentCount = (0, import_react118.useCallback)(
|
|
356648
356655
|
() => state.count || DEFAULT_COUNT,
|
|
356649
356656
|
[state.count]
|
|
356650
356657
|
);
|
|
356651
|
-
const executeCommand = (0,
|
|
356658
|
+
const executeCommand = (0, import_react118.useCallback)(
|
|
356652
356659
|
(cmdType, count) => {
|
|
356653
356660
|
switch (cmdType) {
|
|
356654
356661
|
case CMD_TYPES.DELETE_WORD_FORWARD: {
|
|
@@ -356724,7 +356731,7 @@ function useVim(buffer, onSubmit) {
|
|
|
356724
356731
|
},
|
|
356725
356732
|
[buffer, updateMode]
|
|
356726
356733
|
);
|
|
356727
|
-
const handleInsertModeInput = (0,
|
|
356734
|
+
const handleInsertModeInput = (0, import_react118.useCallback)(
|
|
356728
356735
|
(normalizedKey) => {
|
|
356729
356736
|
if (normalizedKey.name === "escape") {
|
|
356730
356737
|
buffer.vimEscapeInsertMode();
|
|
@@ -356755,7 +356762,7 @@ function useVim(buffer, onSubmit) {
|
|
|
356755
356762
|
},
|
|
356756
356763
|
[buffer, dispatch, updateMode, onSubmit]
|
|
356757
356764
|
);
|
|
356758
|
-
const normalizeKey = (0,
|
|
356765
|
+
const normalizeKey = (0, import_react118.useCallback)(
|
|
356759
356766
|
(key) => ({
|
|
356760
356767
|
name: key.name || "",
|
|
356761
356768
|
sequence: key.sequence || "",
|
|
@@ -356766,7 +356773,7 @@ function useVim(buffer, onSubmit) {
|
|
|
356766
356773
|
}),
|
|
356767
356774
|
[]
|
|
356768
356775
|
);
|
|
356769
|
-
const handleChangeMovement = (0,
|
|
356776
|
+
const handleChangeMovement = (0, import_react118.useCallback)(
|
|
356770
356777
|
(movement) => {
|
|
356771
356778
|
const count = getCurrentCount();
|
|
356772
356779
|
dispatch({ type: "CLEAR_COUNT" });
|
|
@@ -356787,7 +356794,7 @@ function useVim(buffer, onSubmit) {
|
|
|
356787
356794
|
},
|
|
356788
356795
|
[getCurrentCount, dispatch, buffer, updateMode]
|
|
356789
356796
|
);
|
|
356790
|
-
const handleOperatorMotion = (0,
|
|
356797
|
+
const handleOperatorMotion = (0, import_react118.useCallback)(
|
|
356791
356798
|
(operator2, motion) => {
|
|
356792
356799
|
const count = getCurrentCount();
|
|
356793
356800
|
const commandMap = {
|
|
@@ -356814,7 +356821,7 @@ function useVim(buffer, onSubmit) {
|
|
|
356814
356821
|
},
|
|
356815
356822
|
[getCurrentCount, executeCommand, dispatch]
|
|
356816
356823
|
);
|
|
356817
|
-
const handleInput = (0,
|
|
356824
|
+
const handleInput = (0, import_react118.useCallback)(
|
|
356818
356825
|
(key) => {
|
|
356819
356826
|
if (!vimEnabled) {
|
|
356820
356827
|
return false;
|
|
@@ -357114,14 +357121,14 @@ __name(useVim, "useVim");
|
|
|
357114
357121
|
|
|
357115
357122
|
// packages/cli/src/ui/hooks/useBracketedPaste.ts
|
|
357116
357123
|
init_esbuild_shims();
|
|
357117
|
-
var
|
|
357124
|
+
var import_react119 = __toESM(require_react(), 1);
|
|
357118
357125
|
var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
|
|
357119
357126
|
var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|
|
357120
357127
|
var useBracketedPaste = /* @__PURE__ */ __name(() => {
|
|
357121
357128
|
const cleanup = /* @__PURE__ */ __name(() => {
|
|
357122
357129
|
process.stdout.write(DISABLE_BRACKETED_PASTE);
|
|
357123
357130
|
}, "cleanup");
|
|
357124
|
-
(0,
|
|
357131
|
+
(0, import_react119.useEffect)(() => {
|
|
357125
357132
|
process.stdout.write(ENABLE_BRACKETED_PASTE);
|
|
357126
357133
|
process.on("exit", cleanup);
|
|
357127
357134
|
process.on("SIGINT", cleanup);
|
|
@@ -357140,13 +357147,13 @@ init_esbuild_shims();
|
|
|
357140
357147
|
|
|
357141
357148
|
// packages/cli/src/ui/hooks/useTimer.ts
|
|
357142
357149
|
init_esbuild_shims();
|
|
357143
|
-
var
|
|
357150
|
+
var import_react120 = __toESM(require_react(), 1);
|
|
357144
357151
|
var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
357145
|
-
const [elapsedTime, setElapsedTime] = (0,
|
|
357146
|
-
const timerRef = (0,
|
|
357147
|
-
const prevResetKeyRef = (0,
|
|
357148
|
-
const prevIsActiveRef = (0,
|
|
357149
|
-
(0,
|
|
357152
|
+
const [elapsedTime, setElapsedTime] = (0, import_react120.useState)(0);
|
|
357153
|
+
const timerRef = (0, import_react120.useRef)(null);
|
|
357154
|
+
const prevResetKeyRef = (0, import_react120.useRef)(resetKey);
|
|
357155
|
+
const prevIsActiveRef = (0, import_react120.useRef)(isActive);
|
|
357156
|
+
(0, import_react120.useEffect)(() => {
|
|
357150
357157
|
let shouldResetTime = false;
|
|
357151
357158
|
if (prevResetKeyRef.current !== resetKey) {
|
|
357152
357159
|
shouldResetTime = true;
|
|
@@ -357184,7 +357191,7 @@ var useTimer = /* @__PURE__ */ __name((isActive, resetKey) => {
|
|
|
357184
357191
|
|
|
357185
357192
|
// packages/cli/src/ui/hooks/usePhraseCycler.ts
|
|
357186
357193
|
init_esbuild_shims();
|
|
357187
|
-
var
|
|
357194
|
+
var import_react121 = __toESM(require_react(), 1);
|
|
357188
357195
|
var WITTY_LOADING_PHRASES = [
|
|
357189
357196
|
"I'm Feeling Lucky",
|
|
357190
357197
|
"Shipping awesomeness... ",
|
|
@@ -357318,15 +357325,15 @@ var WITTY_LOADING_PHRASES = [
|
|
|
357318
357325
|
];
|
|
357319
357326
|
var PHRASE_CHANGE_INTERVAL_MS = 15e3;
|
|
357320
357327
|
var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
|
|
357321
|
-
const loadingPhrases = (0,
|
|
357328
|
+
const loadingPhrases = (0, import_react121.useMemo)(
|
|
357322
357329
|
() => customPhrases && customPhrases.length > 0 ? customPhrases : WITTY_LOADING_PHRASES.map((phrase) => t2(phrase)),
|
|
357323
357330
|
[customPhrases]
|
|
357324
357331
|
);
|
|
357325
|
-
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0,
|
|
357332
|
+
const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react121.useState)(
|
|
357326
357333
|
loadingPhrases[0]
|
|
357327
357334
|
);
|
|
357328
|
-
const phraseIntervalRef = (0,
|
|
357329
|
-
(0,
|
|
357335
|
+
const phraseIntervalRef = (0, import_react121.useRef)(null);
|
|
357336
|
+
(0, import_react121.useEffect)(() => {
|
|
357330
357337
|
if (isWaiting) {
|
|
357331
357338
|
setCurrentLoadingPhrase(t2("Waiting for user confirmation..."));
|
|
357332
357339
|
if (phraseIntervalRef.current) {
|
|
@@ -357363,9 +357370,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
|
|
|
357363
357370
|
}, "usePhraseCycler");
|
|
357364
357371
|
|
|
357365
357372
|
// packages/cli/src/ui/hooks/useLoadingIndicator.ts
|
|
357366
|
-
var
|
|
357373
|
+
var import_react122 = __toESM(require_react(), 1);
|
|
357367
357374
|
var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases) => {
|
|
357368
|
-
const [timerResetKey, setTimerResetKey] = (0,
|
|
357375
|
+
const [timerResetKey, setTimerResetKey] = (0, import_react122.useState)(0);
|
|
357369
357376
|
const isTimerActive = streamingState === "responding" /* Responding */;
|
|
357370
357377
|
const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
|
|
357371
357378
|
const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
|
|
@@ -357375,9 +357382,9 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
357375
357382
|
isWaiting,
|
|
357376
357383
|
customWittyPhrases
|
|
357377
357384
|
);
|
|
357378
|
-
const [retainedElapsedTime, setRetainedElapsedTime] = (0,
|
|
357379
|
-
const prevStreamingStateRef = (0,
|
|
357380
|
-
(0,
|
|
357385
|
+
const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react122.useState)(0);
|
|
357386
|
+
const prevStreamingStateRef = (0, import_react122.useRef)(null);
|
|
357387
|
+
(0, import_react122.useEffect)(() => {
|
|
357381
357388
|
if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
|
|
357382
357389
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
357383
357390
|
setRetainedElapsedTime(0);
|
|
@@ -357397,20 +357404,20 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
357397
357404
|
|
|
357398
357405
|
// packages/cli/src/ui/hooks/useFolderTrust.ts
|
|
357399
357406
|
init_esbuild_shims();
|
|
357400
|
-
var
|
|
357407
|
+
var import_react123 = __toESM(require_react(), 1);
|
|
357401
357408
|
import * as process40 from "node:process";
|
|
357402
357409
|
var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
|
|
357403
|
-
const [isTrusted, setIsTrusted] = (0,
|
|
357404
|
-
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0,
|
|
357405
|
-
const [isRestarting, setIsRestarting] = (0,
|
|
357410
|
+
const [isTrusted, setIsTrusted] = (0, import_react123.useState)(void 0);
|
|
357411
|
+
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react123.useState)(false);
|
|
357412
|
+
const [isRestarting, setIsRestarting] = (0, import_react123.useState)(false);
|
|
357406
357413
|
const folderTrust = settings.merged.security?.folderTrust?.enabled;
|
|
357407
|
-
(0,
|
|
357414
|
+
(0, import_react123.useEffect)(() => {
|
|
357408
357415
|
const { isTrusted: trusted } = isWorkspaceTrusted(settings.merged);
|
|
357409
357416
|
setIsTrusted(trusted);
|
|
357410
357417
|
setIsFolderTrustDialogOpen(trusted === void 0);
|
|
357411
357418
|
onTrustChange(trusted);
|
|
357412
357419
|
}, [folderTrust, onTrustChange, settings.merged]);
|
|
357413
|
-
const handleFolderTrustSelect = (0,
|
|
357420
|
+
const handleFolderTrustSelect = (0, import_react123.useCallback)(
|
|
357414
357421
|
(choice2) => {
|
|
357415
357422
|
const trustedFolders = loadTrustedFolders();
|
|
357416
357423
|
const cwd7 = process40.cwd();
|
|
@@ -360543,27 +360550,27 @@ __name(setUpdateHandler, "setUpdateHandler");
|
|
|
360543
360550
|
|
|
360544
360551
|
// packages/cli/src/ui/hooks/useMessageQueue.ts
|
|
360545
360552
|
init_esbuild_shims();
|
|
360546
|
-
var
|
|
360553
|
+
var import_react124 = __toESM(require_react(), 1);
|
|
360547
360554
|
function useMessageQueue({
|
|
360548
360555
|
isConfigInitialized,
|
|
360549
360556
|
streamingState,
|
|
360550
360557
|
submitQuery
|
|
360551
360558
|
}) {
|
|
360552
|
-
const [messageQueue, setMessageQueue] = (0,
|
|
360553
|
-
const addMessage = (0,
|
|
360559
|
+
const [messageQueue, setMessageQueue] = (0, import_react124.useState)([]);
|
|
360560
|
+
const addMessage = (0, import_react124.useCallback)((message2) => {
|
|
360554
360561
|
const trimmedMessage = message2.trim();
|
|
360555
360562
|
if (trimmedMessage.length > 0) {
|
|
360556
360563
|
setMessageQueue((prev) => [...prev, trimmedMessage]);
|
|
360557
360564
|
}
|
|
360558
360565
|
}, []);
|
|
360559
|
-
const clearQueue = (0,
|
|
360566
|
+
const clearQueue = (0, import_react124.useCallback)(() => {
|
|
360560
360567
|
setMessageQueue([]);
|
|
360561
360568
|
}, []);
|
|
360562
|
-
const getQueuedMessagesText = (0,
|
|
360569
|
+
const getQueuedMessagesText = (0, import_react124.useCallback)(() => {
|
|
360563
360570
|
if (messageQueue.length === 0) return "";
|
|
360564
360571
|
return messageQueue.join("\n\n");
|
|
360565
360572
|
}, [messageQueue]);
|
|
360566
|
-
(0,
|
|
360573
|
+
(0, import_react124.useEffect)(() => {
|
|
360567
360574
|
if (isConfigInitialized && streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
|
|
360568
360575
|
const combinedMessage = messageQueue.join("\n\n");
|
|
360569
360576
|
setMessageQueue([]);
|
|
@@ -360581,15 +360588,15 @@ __name(useMessageQueue, "useMessageQueue");
|
|
|
360581
360588
|
|
|
360582
360589
|
// packages/cli/src/ui/hooks/useAutoAcceptIndicator.ts
|
|
360583
360590
|
init_esbuild_shims();
|
|
360584
|
-
var
|
|
360591
|
+
var import_react125 = __toESM(require_react(), 1);
|
|
360585
360592
|
function useAutoAcceptIndicator({
|
|
360586
360593
|
config,
|
|
360587
360594
|
addItem,
|
|
360588
360595
|
onApprovalModeChange
|
|
360589
360596
|
}) {
|
|
360590
360597
|
const currentConfigValue = config.getApprovalMode();
|
|
360591
|
-
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0,
|
|
360592
|
-
(0,
|
|
360598
|
+
const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react125.useState)(currentConfigValue);
|
|
360599
|
+
(0, import_react125.useEffect)(() => {
|
|
360593
360600
|
setShowAutoAcceptIndicator(currentConfigValue);
|
|
360594
360601
|
}, [currentConfigValue]);
|
|
360595
360602
|
useKeypress(
|
|
@@ -360622,14 +360629,14 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
|
|
|
360622
360629
|
|
|
360623
360630
|
// packages/cli/src/ui/hooks/useWorkspaceMigration.ts
|
|
360624
360631
|
init_esbuild_shims();
|
|
360625
|
-
var
|
|
360632
|
+
var import_react126 = __toESM(require_react(), 1);
|
|
360626
360633
|
import process50 from "node:process";
|
|
360627
360634
|
function useWorkspaceMigration(settings) {
|
|
360628
|
-
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0,
|
|
360629
|
-
const [workspaceExtensions, setWorkspaceExtensions] = (0,
|
|
360635
|
+
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0, import_react126.useState)(false);
|
|
360636
|
+
const [workspaceExtensions, setWorkspaceExtensions] = (0, import_react126.useState)(
|
|
360630
360637
|
[]
|
|
360631
360638
|
);
|
|
360632
|
-
(0,
|
|
360639
|
+
(0, import_react126.useEffect)(() => {
|
|
360633
360640
|
if (!(settings.merged.experimental?.extensionManagement ?? true)) {
|
|
360634
360641
|
return;
|
|
360635
360642
|
}
|
|
@@ -360671,13 +360678,13 @@ __name(useWorkspaceMigration, "useWorkspaceMigration");
|
|
|
360671
360678
|
|
|
360672
360679
|
// packages/cli/src/ui/hooks/useGitBranchName.ts
|
|
360673
360680
|
init_esbuild_shims();
|
|
360674
|
-
var
|
|
360681
|
+
var import_react127 = __toESM(require_react(), 1);
|
|
360675
360682
|
import fs94 from "node:fs";
|
|
360676
360683
|
import fsPromises7 from "node:fs/promises";
|
|
360677
360684
|
import path109 from "node:path";
|
|
360678
360685
|
function useGitBranchName(cwd7) {
|
|
360679
|
-
const [branchName, setBranchName] = (0,
|
|
360680
|
-
const fetchBranchName = (0,
|
|
360686
|
+
const [branchName, setBranchName] = (0, import_react127.useState)(void 0);
|
|
360687
|
+
const fetchBranchName = (0, import_react127.useCallback)(async () => {
|
|
360681
360688
|
try {
|
|
360682
360689
|
if (!isCommandAvailable("git").available) {
|
|
360683
360690
|
return;
|
|
@@ -360702,7 +360709,7 @@ function useGitBranchName(cwd7) {
|
|
|
360702
360709
|
setBranchName(void 0);
|
|
360703
360710
|
}
|
|
360704
360711
|
}, [cwd7, setBranchName]);
|
|
360705
|
-
(0,
|
|
360712
|
+
(0, import_react127.useEffect)(() => {
|
|
360706
360713
|
fetchBranchName();
|
|
360707
360714
|
const gitLogsHeadPath = path109.join(cwd7, ".git", "logs", "HEAD");
|
|
360708
360715
|
let watcher;
|
|
@@ -360728,7 +360735,7 @@ __name(useGitBranchName, "useGitBranchName");
|
|
|
360728
360735
|
|
|
360729
360736
|
// packages/cli/src/ui/hooks/useExtensionUpdates.ts
|
|
360730
360737
|
init_esbuild_shims();
|
|
360731
|
-
var
|
|
360738
|
+
var import_react128 = __toESM(require_react(), 1);
|
|
360732
360739
|
function confirmationRequestsReducer(state, action) {
|
|
360733
360740
|
switch (action.type) {
|
|
360734
360741
|
case "add":
|
|
@@ -360742,15 +360749,15 @@ function confirmationRequestsReducer(state, action) {
|
|
|
360742
360749
|
}
|
|
360743
360750
|
__name(confirmationRequestsReducer, "confirmationRequestsReducer");
|
|
360744
360751
|
var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) => {
|
|
360745
|
-
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0,
|
|
360752
|
+
const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react128.useReducer)(
|
|
360746
360753
|
extensionUpdatesReducer,
|
|
360747
360754
|
initialExtensionUpdatesState
|
|
360748
360755
|
);
|
|
360749
360756
|
const [
|
|
360750
360757
|
confirmUpdateExtensionRequests,
|
|
360751
360758
|
dispatchConfirmUpdateExtensionRequests
|
|
360752
|
-
] = (0,
|
|
360753
|
-
const addConfirmUpdateExtensionRequest = (0,
|
|
360759
|
+
] = (0, import_react128.useReducer)(confirmationRequestsReducer, []);
|
|
360760
|
+
const addConfirmUpdateExtensionRequest = (0, import_react128.useCallback)(
|
|
360754
360761
|
(original) => {
|
|
360755
360762
|
const wrappedRequest = {
|
|
360756
360763
|
prompt: original.prompt,
|
|
@@ -360769,7 +360776,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
360769
360776
|
},
|
|
360770
360777
|
[dispatchConfirmUpdateExtensionRequests]
|
|
360771
360778
|
);
|
|
360772
|
-
(0,
|
|
360779
|
+
(0, import_react128.useEffect)(() => {
|
|
360773
360780
|
(async () => {
|
|
360774
360781
|
await checkForAllExtensionUpdates(
|
|
360775
360782
|
extensions,
|
|
@@ -360777,7 +360784,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
360777
360784
|
);
|
|
360778
360785
|
})();
|
|
360779
360786
|
}, [extensions, extensions.length, dispatchExtensionStateUpdate]);
|
|
360780
|
-
(0,
|
|
360787
|
+
(0, import_react128.useEffect)(() => {
|
|
360781
360788
|
if (extensionsUpdateState.batchChecksInProgress > 0) {
|
|
360782
360789
|
return;
|
|
360783
360790
|
}
|
|
@@ -360842,7 +360849,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
360842
360849
|
addItem,
|
|
360843
360850
|
cwd7
|
|
360844
360851
|
]);
|
|
360845
|
-
const extensionsUpdateStateComputed = (0,
|
|
360852
|
+
const extensionsUpdateStateComputed = (0, import_react128.useMemo)(() => {
|
|
360846
360853
|
const result = /* @__PURE__ */ new Map();
|
|
360847
360854
|
for (const [
|
|
360848
360855
|
key,
|
|
@@ -360863,13 +360870,13 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensions, addItem, cwd7) =>
|
|
|
360863
360870
|
|
|
360864
360871
|
// packages/cli/src/ui/hooks/useQuitConfirmation.ts
|
|
360865
360872
|
init_esbuild_shims();
|
|
360866
|
-
var
|
|
360873
|
+
var import_react129 = __toESM(require_react(), 1);
|
|
360867
360874
|
var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
360868
|
-
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0,
|
|
360869
|
-
const showQuitConfirmation = (0,
|
|
360875
|
+
const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = (0, import_react129.useState)(false);
|
|
360876
|
+
const showQuitConfirmation = (0, import_react129.useCallback)(() => {
|
|
360870
360877
|
setIsQuitConfirmationOpen(true);
|
|
360871
360878
|
}, []);
|
|
360872
|
-
const handleQuitConfirmationSelect = (0,
|
|
360879
|
+
const handleQuitConfirmationSelect = (0, import_react129.useCallback)((choice2) => {
|
|
360873
360880
|
setIsQuitConfirmationOpen(false);
|
|
360874
360881
|
if (choice2 === "cancel" /* CANCEL */) {
|
|
360875
360882
|
return { shouldQuit: false, action: "cancel" };
|
|
@@ -360891,14 +360898,14 @@ var useQuitConfirmation = /* @__PURE__ */ __name(() => {
|
|
|
360891
360898
|
|
|
360892
360899
|
// packages/cli/src/ui/hooks/useWelcomeBack.ts
|
|
360893
360900
|
init_esbuild_shims();
|
|
360894
|
-
var
|
|
360901
|
+
var import_react130 = __toESM(require_react(), 1);
|
|
360895
360902
|
function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
360896
|
-
const [welcomeBackInfo, setWelcomeBackInfo] = (0,
|
|
360897
|
-
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0,
|
|
360898
|
-
const [welcomeBackChoice, setWelcomeBackChoice] = (0,
|
|
360899
|
-
const [shouldFillInput, setShouldFillInput] = (0,
|
|
360900
|
-
const [inputFillText, setInputFillText] = (0,
|
|
360901
|
-
const checkWelcomeBack = (0,
|
|
360903
|
+
const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react130.useState)(null);
|
|
360904
|
+
const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react130.useState)(false);
|
|
360905
|
+
const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react130.useState)(null);
|
|
360906
|
+
const [shouldFillInput, setShouldFillInput] = (0, import_react130.useState)(false);
|
|
360907
|
+
const [inputFillText, setInputFillText] = (0, import_react130.useState)(null);
|
|
360908
|
+
const checkWelcomeBack = (0, import_react130.useCallback)(async () => {
|
|
360902
360909
|
if (settings.ui?.enableWelcomeBack === false) {
|
|
360903
360910
|
return;
|
|
360904
360911
|
}
|
|
@@ -360912,7 +360919,7 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
360912
360919
|
console.debug("Welcome back check failed:", error);
|
|
360913
360920
|
}
|
|
360914
360921
|
}, [settings.ui?.enableWelcomeBack]);
|
|
360915
|
-
const handleWelcomeBackSelection = (0,
|
|
360922
|
+
const handleWelcomeBackSelection = (0, import_react130.useCallback)(
|
|
360916
360923
|
(choice2) => {
|
|
360917
360924
|
setWelcomeBackChoice(choice2);
|
|
360918
360925
|
setShowWelcomeBackDialog(false);
|
|
@@ -360924,21 +360931,21 @@ function useWelcomeBack(config, submitQuery, buffer, settings) {
|
|
|
360924
360931
|
},
|
|
360925
360932
|
[welcomeBackInfo]
|
|
360926
360933
|
);
|
|
360927
|
-
const handleWelcomeBackClose = (0,
|
|
360934
|
+
const handleWelcomeBackClose = (0, import_react130.useCallback)(() => {
|
|
360928
360935
|
setWelcomeBackChoice("restart");
|
|
360929
360936
|
setShowWelcomeBackDialog(false);
|
|
360930
360937
|
}, []);
|
|
360931
|
-
const clearInputFill = (0,
|
|
360938
|
+
const clearInputFill = (0, import_react130.useCallback)(() => {
|
|
360932
360939
|
setShouldFillInput(false);
|
|
360933
360940
|
setInputFillText(null);
|
|
360934
360941
|
}, []);
|
|
360935
|
-
(0,
|
|
360942
|
+
(0, import_react130.useEffect)(() => {
|
|
360936
360943
|
if (shouldFillInput && inputFillText) {
|
|
360937
360944
|
buffer.setText(inputFillText);
|
|
360938
360945
|
clearInputFill();
|
|
360939
360946
|
}
|
|
360940
360947
|
}, [shouldFillInput, inputFillText, buffer, clearInputFill]);
|
|
360941
|
-
(0,
|
|
360948
|
+
(0, import_react130.useEffect)(() => {
|
|
360942
360949
|
checkWelcomeBack();
|
|
360943
360950
|
}, [checkWelcomeBack]);
|
|
360944
360951
|
return {
|
|
@@ -360959,9 +360966,9 @@ __name(useWelcomeBack, "useWelcomeBack");
|
|
|
360959
360966
|
|
|
360960
360967
|
// packages/cli/src/ui/hooks/useDialogClose.ts
|
|
360961
360968
|
init_esbuild_shims();
|
|
360962
|
-
var
|
|
360969
|
+
var import_react131 = __toESM(require_react(), 1);
|
|
360963
360970
|
function useDialogClose(options2) {
|
|
360964
|
-
const closeAnyOpenDialog = (0,
|
|
360971
|
+
const closeAnyOpenDialog = (0, import_react131.useCallback)(() => {
|
|
360965
360972
|
if (options2.isThemeDialogOpen) {
|
|
360966
360973
|
options2.handleThemeSelect(void 0, "User" /* User */);
|
|
360967
360974
|
return true;
|
|
@@ -360993,14 +361000,14 @@ __name(useDialogClose, "useDialogClose");
|
|
|
360993
361000
|
|
|
360994
361001
|
// packages/cli/src/ui/hooks/useInitializationAuthError.ts
|
|
360995
361002
|
init_esbuild_shims();
|
|
360996
|
-
var
|
|
361003
|
+
var import_react132 = __toESM(require_react(), 1);
|
|
360997
361004
|
var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError) => {
|
|
360998
|
-
const hasHandled = (0,
|
|
360999
|
-
const authErrorRef = (0,
|
|
361000
|
-
const onAuthErrorRef = (0,
|
|
361005
|
+
const hasHandled = (0, import_react132.useRef)(false);
|
|
361006
|
+
const authErrorRef = (0, import_react132.useRef)(authError);
|
|
361007
|
+
const onAuthErrorRef = (0, import_react132.useRef)(onAuthError);
|
|
361001
361008
|
authErrorRef.current = authError;
|
|
361002
361009
|
onAuthErrorRef.current = onAuthError;
|
|
361003
|
-
(0,
|
|
361010
|
+
(0, import_react132.useEffect)(() => {
|
|
361004
361011
|
if (hasHandled.current) {
|
|
361005
361012
|
return;
|
|
361006
361013
|
}
|
|
@@ -361013,13 +361020,13 @@ var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError)
|
|
|
361013
361020
|
|
|
361014
361021
|
// packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
|
|
361015
361022
|
init_esbuild_shims();
|
|
361016
|
-
var
|
|
361023
|
+
var import_react133 = __toESM(require_react(), 1);
|
|
361017
361024
|
function useSubagentCreateDialog() {
|
|
361018
|
-
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0,
|
|
361019
|
-
const openSubagentCreateDialog = (0,
|
|
361025
|
+
const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react133.useState)(false);
|
|
361026
|
+
const openSubagentCreateDialog = (0, import_react133.useCallback)(() => {
|
|
361020
361027
|
setIsSubagentCreateDialogOpen(true);
|
|
361021
361028
|
}, []);
|
|
361022
|
-
const closeSubagentCreateDialog = (0,
|
|
361029
|
+
const closeSubagentCreateDialog = (0, import_react133.useCallback)(() => {
|
|
361023
361030
|
setIsSubagentCreateDialogOpen(false);
|
|
361024
361031
|
}, []);
|
|
361025
361032
|
return {
|
|
@@ -361032,13 +361039,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
|
|
|
361032
361039
|
|
|
361033
361040
|
// packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
|
|
361034
361041
|
init_esbuild_shims();
|
|
361035
|
-
var
|
|
361042
|
+
var import_react134 = __toESM(require_react(), 1);
|
|
361036
361043
|
var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
361037
|
-
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0,
|
|
361038
|
-
const openAgentsManagerDialog = (0,
|
|
361044
|
+
const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react134.useState)(false);
|
|
361045
|
+
const openAgentsManagerDialog = (0, import_react134.useCallback)(() => {
|
|
361039
361046
|
setIsAgentsManagerDialogOpen(true);
|
|
361040
361047
|
}, []);
|
|
361041
|
-
const closeAgentsManagerDialog = (0,
|
|
361048
|
+
const closeAgentsManagerDialog = (0, import_react134.useCallback)(() => {
|
|
361042
361049
|
setIsAgentsManagerDialogOpen(false);
|
|
361043
361050
|
}, []);
|
|
361044
361051
|
return {
|
|
@@ -361050,7 +361057,7 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
|
|
|
361050
361057
|
|
|
361051
361058
|
// packages/cli/src/ui/hooks/useAttentionNotifications.ts
|
|
361052
361059
|
init_esbuild_shims();
|
|
361053
|
-
var
|
|
361060
|
+
var import_react135 = __toESM(require_react(), 1);
|
|
361054
361061
|
|
|
361055
361062
|
// packages/cli/src/utils/attentionNotification.ts
|
|
361056
361063
|
init_esbuild_shims();
|
|
@@ -361078,9 +361085,9 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
361078
361085
|
streamingState,
|
|
361079
361086
|
elapsedTime
|
|
361080
361087
|
}) => {
|
|
361081
|
-
const awaitingNotificationSentRef = (0,
|
|
361082
|
-
const respondingElapsedRef = (0,
|
|
361083
|
-
(0,
|
|
361088
|
+
const awaitingNotificationSentRef = (0, import_react135.useRef)(false);
|
|
361089
|
+
const respondingElapsedRef = (0, import_react135.useRef)(0);
|
|
361090
|
+
(0, import_react135.useEffect)(() => {
|
|
361084
361091
|
if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current) {
|
|
361085
361092
|
notifyTerminalAttention("tool_approval" /* ToolApproval */);
|
|
361086
361093
|
awaitingNotificationSentRef.current = true;
|
|
@@ -361089,7 +361096,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
|
361089
361096
|
awaitingNotificationSentRef.current = false;
|
|
361090
361097
|
}
|
|
361091
361098
|
}, [isFocused, streamingState]);
|
|
361092
|
-
(0,
|
|
361099
|
+
(0, import_react135.useEffect)(() => {
|
|
361093
361100
|
if (streamingState === "responding" /* Responding */) {
|
|
361094
361101
|
respondingElapsedRef.current = elapsedTime;
|
|
361095
361102
|
return;
|
|
@@ -361125,25 +361132,25 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361125
361132
|
const { settings, config, initializationResult } = props;
|
|
361126
361133
|
const historyManager = useHistory();
|
|
361127
361134
|
useMemoryMonitor(historyManager);
|
|
361128
|
-
const [corgiMode, setCorgiMode] = (0,
|
|
361129
|
-
const [debugMessage, setDebugMessage] = (0,
|
|
361130
|
-
const [quittingMessages, setQuittingMessages] = (0,
|
|
361131
|
-
const [themeError, setThemeError] = (0,
|
|
361135
|
+
const [corgiMode, setCorgiMode] = (0, import_react136.useState)(false);
|
|
361136
|
+
const [debugMessage, setDebugMessage] = (0, import_react136.useState)("");
|
|
361137
|
+
const [quittingMessages, setQuittingMessages] = (0, import_react136.useState)(null);
|
|
361138
|
+
const [themeError, setThemeError] = (0, import_react136.useState)(
|
|
361132
361139
|
initializationResult.themeError
|
|
361133
361140
|
);
|
|
361134
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
361135
|
-
const [embeddedShellFocused, setEmbeddedShellFocused] = (0,
|
|
361136
|
-
const [OSAMdFileCount, setOSAMdFileCount] = (0,
|
|
361141
|
+
const [isProcessing, setIsProcessing] = (0, import_react136.useState)(false);
|
|
361142
|
+
const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react136.useState)(false);
|
|
361143
|
+
const [OSAMdFileCount, setOSAMdFileCount] = (0, import_react136.useState)(
|
|
361137
361144
|
initializationResult.OSAMdFileCount
|
|
361138
361145
|
);
|
|
361139
|
-
const [shellModeActive, setShellModeActive] = (0,
|
|
361140
|
-
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0,
|
|
361141
|
-
const [historyRemountKey, setHistoryRemountKey] = (0,
|
|
361142
|
-
const [updateInfo, setUpdateInfo] = (0,
|
|
361143
|
-
const [isTrustedFolder, setIsTrustedFolder] = (0,
|
|
361146
|
+
const [shellModeActive, setShellModeActive] = (0, import_react136.useState)(false);
|
|
361147
|
+
const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react136.useState)(false);
|
|
361148
|
+
const [historyRemountKey, setHistoryRemountKey] = (0, import_react136.useState)(0);
|
|
361149
|
+
const [updateInfo, setUpdateInfo] = (0, import_react136.useState)(null);
|
|
361150
|
+
const [isTrustedFolder, setIsTrustedFolder] = (0, import_react136.useState)(
|
|
361144
361151
|
config.isTrustedFolder()
|
|
361145
361152
|
);
|
|
361146
|
-
const [systemPromptPreset, setSystemPromptPreset] = (0,
|
|
361153
|
+
const [systemPromptPreset, setSystemPromptPreset] = (0, import_react136.useState)(
|
|
361147
361154
|
null
|
|
361148
361155
|
);
|
|
361149
361156
|
const extensions = config.getExtensions();
|
|
@@ -361158,38 +361165,38 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361158
361165
|
historyManager.addItem,
|
|
361159
361166
|
config.getWorkingDir()
|
|
361160
361167
|
);
|
|
361161
|
-
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0,
|
|
361162
|
-
const openPermissionsDialog = (0,
|
|
361168
|
+
const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react136.useState)(false);
|
|
361169
|
+
const openPermissionsDialog = (0, import_react136.useCallback)(
|
|
361163
361170
|
() => setPermissionsDialogOpen(true),
|
|
361164
361171
|
[]
|
|
361165
361172
|
);
|
|
361166
|
-
const closePermissionsDialog = (0,
|
|
361173
|
+
const closePermissionsDialog = (0, import_react136.useCallback)(
|
|
361167
361174
|
() => setPermissionsDialogOpen(false),
|
|
361168
361175
|
[]
|
|
361169
361176
|
);
|
|
361170
|
-
const getEffectiveModel2 = (0,
|
|
361177
|
+
const getEffectiveModel2 = (0, import_react136.useCallback)(() => {
|
|
361171
361178
|
if (config.isInFallbackMode()) {
|
|
361172
361179
|
return DEFAULT_OSA_FLASH_MODEL;
|
|
361173
361180
|
}
|
|
361174
361181
|
return config.getModel();
|
|
361175
361182
|
}, [config]);
|
|
361176
|
-
const [currentModel, setCurrentModel] = (0,
|
|
361177
|
-
const [userTier] = (0,
|
|
361178
|
-
const [isConfigInitialized, setConfigInitialized] = (0,
|
|
361183
|
+
const [currentModel, setCurrentModel] = (0, import_react136.useState)(getEffectiveModel2());
|
|
361184
|
+
const [userTier] = (0, import_react136.useState)(void 0);
|
|
361185
|
+
const [isConfigInitialized, setConfigInitialized] = (0, import_react136.useState)(false);
|
|
361179
361186
|
const logger6 = useLogger(config.storage);
|
|
361180
|
-
const [userMessages, setUserMessages] = (0,
|
|
361187
|
+
const [userMessages, setUserMessages] = (0, import_react136.useState)([]);
|
|
361181
361188
|
const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
|
|
361182
361189
|
const { stdin, setRawMode } = use_stdin_default();
|
|
361183
361190
|
const { stdout } = use_stdout_default();
|
|
361184
361191
|
const { stats: sessionStats } = useSessionStats();
|
|
361185
361192
|
const branchName = useGitBranchName(config.getTargetDir());
|
|
361186
|
-
const mainControlsRef = (0,
|
|
361187
|
-
const originalTitleRef = (0,
|
|
361193
|
+
const mainControlsRef = (0, import_react136.useRef)(null);
|
|
361194
|
+
const originalTitleRef = (0, import_react136.useRef)(
|
|
361188
361195
|
computeWindowTitle(basename14(config.getTargetDir()))
|
|
361189
361196
|
);
|
|
361190
|
-
const lastTitleRef = (0,
|
|
361197
|
+
const lastTitleRef = (0, import_react136.useRef)(null);
|
|
361191
361198
|
const staticExtraHeight = 3;
|
|
361192
|
-
(0,
|
|
361199
|
+
(0, import_react136.useEffect)(() => {
|
|
361193
361200
|
(async () => {
|
|
361194
361201
|
await config.initialize();
|
|
361195
361202
|
setConfigInitialized(true);
|
|
@@ -361199,11 +361206,11 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361199
361206
|
await ideClient.disconnect();
|
|
361200
361207
|
});
|
|
361201
361208
|
}, [config]);
|
|
361202
|
-
(0,
|
|
361209
|
+
(0, import_react136.useEffect)(
|
|
361203
361210
|
() => setUpdateHandler(historyManager.addItem, setUpdateInfo),
|
|
361204
361211
|
[historyManager.addItem]
|
|
361205
361212
|
);
|
|
361206
|
-
(0,
|
|
361213
|
+
(0, import_react136.useEffect)(() => {
|
|
361207
361214
|
const checkModelChange = /* @__PURE__ */ __name(() => {
|
|
361208
361215
|
const effectiveModel = getEffectiveModel2();
|
|
361209
361216
|
if (effectiveModel !== currentModel) {
|
|
@@ -361219,7 +361226,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361219
361226
|
handleNewMessage,
|
|
361220
361227
|
clearConsoleMessages: clearConsoleMessagesState
|
|
361221
361228
|
} = useConsoleMessages();
|
|
361222
|
-
(0,
|
|
361229
|
+
(0, import_react136.useEffect)(() => {
|
|
361223
361230
|
const consolePatcher = new ConsolePatcher({
|
|
361224
361231
|
onNewMessage: handleNewMessage,
|
|
361225
361232
|
debugMode: config.getDebugMode()
|
|
@@ -361227,13 +361234,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361227
361234
|
consolePatcher.patch();
|
|
361228
361235
|
registerCleanup(consolePatcher.cleanup);
|
|
361229
361236
|
}, [handleNewMessage, config]);
|
|
361230
|
-
const { inputWidth, suggestionsWidth } = (0,
|
|
361237
|
+
const { inputWidth, suggestionsWidth } = (0, import_react136.useMemo)(() => {
|
|
361231
361238
|
const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
|
|
361232
361239
|
return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
|
|
361233
361240
|
}, [terminalWidth]);
|
|
361234
361241
|
const mainAreaWidth = Math.floor(terminalWidth * 0.9);
|
|
361235
361242
|
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
|
|
361236
|
-
const isValidPath = (0,
|
|
361243
|
+
const isValidPath = (0, import_react136.useCallback)((filePath) => {
|
|
361237
361244
|
try {
|
|
361238
361245
|
return fs95.existsSync(filePath) && fs95.statSync(filePath).isFile();
|
|
361239
361246
|
} catch (_e) {
|
|
@@ -361248,7 +361255,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361248
361255
|
isValidPath,
|
|
361249
361256
|
shellModeActive
|
|
361250
361257
|
});
|
|
361251
|
-
(0,
|
|
361258
|
+
(0, import_react136.useEffect)(() => {
|
|
361252
361259
|
const fetchUserMessages = /* @__PURE__ */ __name(async () => {
|
|
361253
361260
|
const pastMessagesRaw = await logger6?.getPreviousUserMessages() || [];
|
|
361254
361261
|
const currentSessionUserMessages = historyManager.history.filter(
|
|
@@ -361271,7 +361278,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361271
361278
|
}, "fetchUserMessages");
|
|
361272
361279
|
fetchUserMessages();
|
|
361273
361280
|
}, [historyManager.history, logger6]);
|
|
361274
|
-
const refreshStatic = (0,
|
|
361281
|
+
const refreshStatic = (0, import_react136.useCallback)(() => {
|
|
361275
361282
|
stdout.write(base_exports.clearTerminal);
|
|
361276
361283
|
setHistoryRemountKey((prev) => prev + 1);
|
|
361277
361284
|
}, [setHistoryRemountKey, stdout]);
|
|
@@ -361311,7 +361318,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361311
361318
|
setModelSwitchedFromQuotaError
|
|
361312
361319
|
});
|
|
361313
361320
|
useInitializationAuthError(initializationResult.authError, onAuthError);
|
|
361314
|
-
(0,
|
|
361321
|
+
(0, import_react136.useEffect)(() => {
|
|
361315
361322
|
if (settings.merged.security?.auth?.enforcedType && settings.merged.security?.auth.selectedType && settings.merged.security?.auth.enforcedType !== settings.merged.security?.auth.selectedType) {
|
|
361316
361323
|
onAuthError(
|
|
361317
361324
|
t2(
|
|
@@ -361324,19 +361331,21 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361324
361331
|
);
|
|
361325
361332
|
} else if (settings.merged.security?.auth?.selectedType && !settings.merged.security?.auth?.useExternal) {
|
|
361326
361333
|
const error = validateAuthMethod(
|
|
361327
|
-
settings.merged.security.auth.selectedType
|
|
361334
|
+
settings.merged.security.auth.selectedType,
|
|
361335
|
+
settings.merged
|
|
361328
361336
|
);
|
|
361329
361337
|
if (error) {
|
|
361330
361338
|
onAuthError(error);
|
|
361331
361339
|
}
|
|
361332
361340
|
}
|
|
361333
361341
|
}, [
|
|
361342
|
+
settings.merged,
|
|
361334
361343
|
settings.merged.security?.auth?.selectedType,
|
|
361335
361344
|
settings.merged.security?.auth?.enforcedType,
|
|
361336
361345
|
settings.merged.security?.auth?.useExternal,
|
|
361337
361346
|
onAuthError
|
|
361338
361347
|
]);
|
|
361339
|
-
const [editorError, setEditorError] = (0,
|
|
361348
|
+
const [editorError, setEditorError] = (0, import_react136.useState)(null);
|
|
361340
361349
|
const {
|
|
361341
361350
|
isEditorDialogOpen,
|
|
361342
361351
|
openEditorDialog,
|
|
@@ -361363,9 +361372,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361363
361372
|
openAgentsManagerDialog,
|
|
361364
361373
|
closeAgentsManagerDialog
|
|
361365
361374
|
} = useAgentsManagerDialog();
|
|
361366
|
-
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0,
|
|
361367
|
-
const [visionSwitchResolver, setVisionSwitchResolver] = (0,
|
|
361368
|
-
const slashCommandActions = (0,
|
|
361375
|
+
const [isVisionSwitchDialogOpen, setIsVisionSwitchDialogOpen] = (0, import_react136.useState)(false);
|
|
361376
|
+
const [visionSwitchResolver, setVisionSwitchResolver] = (0, import_react136.useState)(null);
|
|
361377
|
+
const slashCommandActions = (0, import_react136.useMemo)(
|
|
361369
361378
|
() => ({
|
|
361370
361379
|
openAuthDialog,
|
|
361371
361380
|
openThemeDialog,
|
|
@@ -361430,14 +361439,14 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361430
361439
|
extensionsUpdateStateInternal,
|
|
361431
361440
|
isConfigInitialized
|
|
361432
361441
|
);
|
|
361433
|
-
const handleVisionSwitchRequired = (0,
|
|
361442
|
+
const handleVisionSwitchRequired = (0, import_react136.useCallback)(
|
|
361434
361443
|
async (_query) => new Promise((resolve25, reject) => {
|
|
361435
361444
|
setVisionSwitchResolver({ resolve: resolve25, reject });
|
|
361436
361445
|
setIsVisionSwitchDialogOpen(true);
|
|
361437
361446
|
}),
|
|
361438
361447
|
[]
|
|
361439
361448
|
);
|
|
361440
|
-
const handleVisionSwitchSelect = (0,
|
|
361449
|
+
const handleVisionSwitchSelect = (0, import_react136.useCallback)(
|
|
361441
361450
|
(outcome) => {
|
|
361442
361451
|
setIsVisionSwitchDialogOpen(false);
|
|
361443
361452
|
if (visionSwitchResolver) {
|
|
@@ -361448,10 +361457,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361448
361457
|
},
|
|
361449
361458
|
[visionSwitchResolver]
|
|
361450
361459
|
);
|
|
361451
|
-
const onDebugMessage = (0,
|
|
361460
|
+
const onDebugMessage = (0, import_react136.useCallback)((message2) => {
|
|
361452
361461
|
console.debug(message2);
|
|
361453
361462
|
}, []);
|
|
361454
|
-
const performMemoryRefresh = (0,
|
|
361463
|
+
const performMemoryRefresh = (0, import_react136.useCallback)(async () => {
|
|
361455
361464
|
historyManager.addItem(
|
|
361456
361465
|
{
|
|
361457
361466
|
type: "info" /* INFO */,
|
|
@@ -361502,7 +361511,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361502
361511
|
console.error("Error refreshing memory:", error);
|
|
361503
361512
|
}
|
|
361504
361513
|
}, [config, historyManager, settings.merged]);
|
|
361505
|
-
const cancelHandlerRef = (0,
|
|
361514
|
+
const cancelHandlerRef = (0, import_react136.useRef)(() => {
|
|
361506
361515
|
});
|
|
361507
361516
|
const {
|
|
361508
361517
|
streamingState,
|
|
@@ -361549,7 +361558,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361549
361558
|
streamingState,
|
|
361550
361559
|
submitQuery
|
|
361551
361560
|
});
|
|
361552
|
-
const handleFinalSubmit = (0,
|
|
361561
|
+
const handleFinalSubmit = (0, import_react136.useCallback)(
|
|
361553
361562
|
(submittedValue) => {
|
|
361554
361563
|
addMessage(submittedValue);
|
|
361555
361564
|
},
|
|
@@ -361562,7 +361571,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
361562
361571
|
handleWelcomeBackSelection,
|
|
361563
361572
|
handleWelcomeBackClose
|
|
361564
361573
|
} = useWelcomeBack(config, handleFinalSubmit, buffer, settings.merged);
|
|
361565
|
-
cancelHandlerRef.current = (0,
|
|
361574
|
+
cancelHandlerRef.current = (0, import_react136.useCallback)(() => {
|
|
361566
361575
|
const pendingHistoryItems2 = [
|
|
361567
361576
|
...pendingSlashCommandHistoryItems,
|
|
361568
361577
|
...pendingOSAHistoryItems
|
|
@@ -361591,7 +361600,7 @@ ${queuedText}` : queuedText;
|
|
|
361591
361600
|
pendingSlashCommandHistoryItems,
|
|
361592
361601
|
pendingOSAHistoryItems
|
|
361593
361602
|
]);
|
|
361594
|
-
const handleClearScreen = (0,
|
|
361603
|
+
const handleClearScreen = (0, import_react136.useCallback)(() => {
|
|
361595
361604
|
historyManager.clearItems();
|
|
361596
361605
|
clearConsoleMessagesState();
|
|
361597
361606
|
console.clear();
|
|
@@ -361599,8 +361608,8 @@ ${queuedText}` : queuedText;
|
|
|
361599
361608
|
}, [historyManager, clearConsoleMessagesState, refreshStatic]);
|
|
361600
361609
|
const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
|
|
361601
361610
|
const isInputActive = !initError && !isProcessing && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */) && !proQuotaRequest;
|
|
361602
|
-
const [controlsHeight, setControlsHeight] = (0,
|
|
361603
|
-
(0,
|
|
361611
|
+
const [controlsHeight, setControlsHeight] = (0, import_react136.useState)(0);
|
|
361612
|
+
(0, import_react136.useLayoutEffect)(() => {
|
|
361604
361613
|
if (mainControlsRef.current) {
|
|
361605
361614
|
const fullFooterMeasurement = measure_element_default(mainControlsRef.current);
|
|
361606
361615
|
if (fullFooterMeasurement.height > 0) {
|
|
@@ -361623,14 +361632,14 @@ ${queuedText}` : queuedText;
|
|
|
361623
361632
|
});
|
|
361624
361633
|
const isFocused = useFocus();
|
|
361625
361634
|
useBracketedPaste();
|
|
361626
|
-
const contextFileNames = (0,
|
|
361635
|
+
const contextFileNames = (0, import_react136.useMemo)(() => {
|
|
361627
361636
|
const fromSettings = settings.merged.context?.fileName;
|
|
361628
361637
|
return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllOSAMdFilenames();
|
|
361629
361638
|
}, [settings.merged.context?.fileName]);
|
|
361630
|
-
const initialPrompt = (0,
|
|
361631
|
-
const initialPromptSubmitted = (0,
|
|
361639
|
+
const initialPrompt = (0, import_react136.useMemo)(() => config.getQuestion(), [config]);
|
|
361640
|
+
const initialPromptSubmitted = (0, import_react136.useRef)(false);
|
|
361632
361641
|
const OSAClient2 = config.getOSAClient();
|
|
361633
|
-
(0,
|
|
361642
|
+
(0, import_react136.useEffect)(() => {
|
|
361634
361643
|
if (activePtyId) {
|
|
361635
361644
|
ShellExecutionService.resizePty(
|
|
361636
361645
|
activePtyId,
|
|
@@ -361639,7 +361648,7 @@ ${queuedText}` : queuedText;
|
|
|
361639
361648
|
);
|
|
361640
361649
|
}
|
|
361641
361650
|
}, [terminalWidth, availableTerminalHeight, activePtyId]);
|
|
361642
|
-
(0,
|
|
361651
|
+
(0, import_react136.useEffect)(() => {
|
|
361643
361652
|
if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && !isVisionSwitchDialogOpen && welcomeBackChoice !== "restart" && OSAClient2?.isInitialized?.()) {
|
|
361644
361653
|
handleFinalSubmit(initialPrompt);
|
|
361645
361654
|
initialPromptSubmitted.current = true;
|
|
@@ -361657,9 +361666,9 @@ ${queuedText}` : queuedText;
|
|
|
361657
361666
|
welcomeBackChoice,
|
|
361658
361667
|
OSAClient2
|
|
361659
361668
|
]);
|
|
361660
|
-
const [idePromptAnswered, setIdePromptAnswered] = (0,
|
|
361661
|
-
const [currentIDE, setCurrentIDE] = (0,
|
|
361662
|
-
(0,
|
|
361669
|
+
const [idePromptAnswered, setIdePromptAnswered] = (0, import_react136.useState)(false);
|
|
361670
|
+
const [currentIDE, setCurrentIDE] = (0, import_react136.useState)(null);
|
|
361671
|
+
(0, import_react136.useEffect)(() => {
|
|
361663
361672
|
const getIde = /* @__PURE__ */ __name(async () => {
|
|
361664
361673
|
const ideClient = await IdeClient.getInstance();
|
|
361665
361674
|
const currentIde = ideClient.getCurrentIde();
|
|
@@ -361670,28 +361679,28 @@ ${queuedText}` : queuedText;
|
|
|
361670
361679
|
const shouldShowIdePrompt = Boolean(
|
|
361671
361680
|
currentIDE && !config.getIdeMode() && !settings.merged.ide?.hasSeenNudge && !idePromptAnswered
|
|
361672
361681
|
);
|
|
361673
|
-
const [showErrorDetails, setShowErrorDetails] = (0,
|
|
361674
|
-
const [showToolDescriptions, setShowToolDescriptions] = (0,
|
|
361675
|
-
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0,
|
|
361676
|
-
const ctrlCTimerRef = (0,
|
|
361677
|
-
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0,
|
|
361678
|
-
const ctrlDTimerRef = (0,
|
|
361679
|
-
const [constrainHeight, setConstrainHeight] = (0,
|
|
361680
|
-
const [ideContextState, setIdeContextState] = (0,
|
|
361681
|
-
const [showEscapePrompt, setShowEscapePrompt] = (0,
|
|
361682
|
-
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0,
|
|
361682
|
+
const [showErrorDetails, setShowErrorDetails] = (0, import_react136.useState)(false);
|
|
361683
|
+
const [showToolDescriptions, setShowToolDescriptions] = (0, import_react136.useState)(false);
|
|
361684
|
+
const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react136.useState)(false);
|
|
361685
|
+
const ctrlCTimerRef = (0, import_react136.useRef)(null);
|
|
361686
|
+
const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react136.useState)(false);
|
|
361687
|
+
const ctrlDTimerRef = (0, import_react136.useRef)(null);
|
|
361688
|
+
const [constrainHeight, setConstrainHeight] = (0, import_react136.useState)(true);
|
|
361689
|
+
const [ideContextState, setIdeContextState] = (0, import_react136.useState)();
|
|
361690
|
+
const [showEscapePrompt, setShowEscapePrompt] = (0, import_react136.useState)(false);
|
|
361691
|
+
const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react136.useState)(false);
|
|
361683
361692
|
const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings, setIsTrustedFolder);
|
|
361684
361693
|
const {
|
|
361685
361694
|
needsRestart: ideNeedsRestart,
|
|
361686
361695
|
restartReason: ideTrustRestartReason
|
|
361687
361696
|
} = useIdeTrustListener();
|
|
361688
|
-
const isInitialMount = (0,
|
|
361689
|
-
(0,
|
|
361697
|
+
const isInitialMount = (0, import_react136.useRef)(true);
|
|
361698
|
+
(0, import_react136.useEffect)(() => {
|
|
361690
361699
|
if (ideNeedsRestart) {
|
|
361691
361700
|
setShowIdeRestartPrompt(true);
|
|
361692
361701
|
}
|
|
361693
361702
|
}, [ideNeedsRestart]);
|
|
361694
|
-
(0,
|
|
361703
|
+
(0, import_react136.useEffect)(() => {
|
|
361695
361704
|
if (isInitialMount.current) {
|
|
361696
361705
|
isInitialMount.current = false;
|
|
361697
361706
|
return;
|
|
@@ -361703,12 +361712,12 @@ ${queuedText}` : queuedText;
|
|
|
361703
361712
|
clearTimeout(handler);
|
|
361704
361713
|
};
|
|
361705
361714
|
}, [terminalWidth, refreshStatic]);
|
|
361706
|
-
(0,
|
|
361715
|
+
(0, import_react136.useEffect)(() => {
|
|
361707
361716
|
const unsubscribe = ideContextStore.subscribe(setIdeContextState);
|
|
361708
361717
|
setIdeContextState(ideContextStore.get());
|
|
361709
361718
|
return unsubscribe;
|
|
361710
361719
|
}, []);
|
|
361711
|
-
(0,
|
|
361720
|
+
(0, import_react136.useEffect)(() => {
|
|
361712
361721
|
const openDebugConsole = /* @__PURE__ */ __name(() => {
|
|
361713
361722
|
setShowErrorDetails(true);
|
|
361714
361723
|
setConstrainHeight(false);
|
|
@@ -361727,10 +361736,10 @@ ${queuedText}` : queuedText;
|
|
|
361727
361736
|
appEvents.off("log-error" /* LogError */, logErrorHandler);
|
|
361728
361737
|
};
|
|
361729
361738
|
}, [handleNewMessage]);
|
|
361730
|
-
const handleEscapePromptChange = (0,
|
|
361739
|
+
const handleEscapePromptChange = (0, import_react136.useCallback)((showPrompt) => {
|
|
361731
361740
|
setShowEscapePrompt(showPrompt);
|
|
361732
361741
|
}, []);
|
|
361733
|
-
const handleIdePromptComplete = (0,
|
|
361742
|
+
const handleIdePromptComplete = (0, import_react136.useCallback)(
|
|
361734
361743
|
(result) => {
|
|
361735
361744
|
if (result.userSelection === "yes") {
|
|
361736
361745
|
handleSlashCommand2("/ide install");
|
|
@@ -361768,7 +361777,7 @@ ${queuedText}` : queuedText;
|
|
|
361768
361777
|
handleWelcomeBackClose,
|
|
361769
361778
|
quitConfirmationRequest
|
|
361770
361779
|
});
|
|
361771
|
-
const handleExit = (0,
|
|
361780
|
+
const handleExit = (0, import_react136.useCallback)(
|
|
361772
361781
|
(pressedOnce, setPressedOnce, timerRef) => {
|
|
361773
361782
|
if (pressedOnce) {
|
|
361774
361783
|
if (timerRef.current) {
|
|
@@ -361811,7 +361820,7 @@ ${queuedText}` : queuedText;
|
|
|
361811
361820
|
buffer
|
|
361812
361821
|
]
|
|
361813
361822
|
);
|
|
361814
|
-
const handleGlobalKeypress = (0,
|
|
361823
|
+
const handleGlobalKeypress = (0, import_react136.useCallback)(
|
|
361815
361824
|
(key) => {
|
|
361816
361825
|
if (settings.merged.general?.debugKeystrokeLogging) {
|
|
361817
361826
|
console.log("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
@@ -361884,7 +361893,7 @@ ${queuedText}` : queuedText;
|
|
|
361884
361893
|
]
|
|
361885
361894
|
);
|
|
361886
361895
|
useKeypress(handleGlobalKeypress, { isActive: true });
|
|
361887
|
-
(0,
|
|
361896
|
+
(0, import_react136.useEffect)(() => {
|
|
361888
361897
|
if (!settings.merged.ui?.showStatusInTitle || settings.merged.ui?.hideWindowTitle)
|
|
361889
361898
|
return;
|
|
361890
361899
|
let title;
|
|
@@ -361906,23 +361915,23 @@ ${queuedText}` : queuedText;
|
|
|
361906
361915
|
settings.merged.ui?.hideWindowTitle,
|
|
361907
361916
|
stdout
|
|
361908
361917
|
]);
|
|
361909
|
-
const filteredConsoleMessages = (0,
|
|
361918
|
+
const filteredConsoleMessages = (0, import_react136.useMemo)(() => {
|
|
361910
361919
|
if (config.getDebugMode()) {
|
|
361911
361920
|
return consoleMessages;
|
|
361912
361921
|
}
|
|
361913
361922
|
return consoleMessages.filter((msg) => msg.type !== "debug");
|
|
361914
361923
|
}, [consoleMessages, config]);
|
|
361915
|
-
const errorCount = (0,
|
|
361924
|
+
const errorCount = (0, import_react136.useMemo)(
|
|
361916
361925
|
() => filteredConsoleMessages.filter((msg) => msg.type === "error").reduce((total, msg) => total + msg.count, 0),
|
|
361917
361926
|
[filteredConsoleMessages]
|
|
361918
361927
|
);
|
|
361919
361928
|
const nightly = props.version.includes("nightly");
|
|
361920
361929
|
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;
|
|
361921
|
-
const pendingHistoryItems = (0,
|
|
361930
|
+
const pendingHistoryItems = (0, import_react136.useMemo)(
|
|
361922
361931
|
() => [...pendingSlashCommandHistoryItems, ...pendingOSAHistoryItems],
|
|
361923
361932
|
[pendingSlashCommandHistoryItems, pendingOSAHistoryItems]
|
|
361924
361933
|
);
|
|
361925
|
-
const uiState = (0,
|
|
361934
|
+
const uiState = (0, import_react136.useMemo)(
|
|
361926
361935
|
() => ({
|
|
361927
361936
|
history: historyManager.history,
|
|
361928
361937
|
historyManager,
|
|
@@ -362113,7 +362122,7 @@ ${queuedText}` : queuedText;
|
|
|
362113
362122
|
isAgentsManagerDialogOpen
|
|
362114
362123
|
]
|
|
362115
362124
|
);
|
|
362116
|
-
const uiActions = (0,
|
|
362125
|
+
const uiActions = (0, import_react136.useMemo)(
|
|
362117
362126
|
() => ({
|
|
362118
362127
|
handleThemeSelect,
|
|
362119
362128
|
handleThemeHighlight,
|
|
@@ -362195,9 +362204,9 @@ ${queuedText}` : queuedText;
|
|
|
362195
362204
|
|
|
362196
362205
|
// packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
|
|
362197
362206
|
init_esbuild_shims();
|
|
362198
|
-
var
|
|
362207
|
+
var import_react137 = __toESM(require_react(), 1);
|
|
362199
362208
|
function useKittyKeyboardProtocol() {
|
|
362200
|
-
const [status] = (0,
|
|
362209
|
+
const [status] = (0, import_react137.useState)({
|
|
362201
362210
|
supported: isKittyProtocolSupported(),
|
|
362202
362211
|
enabled: isKittyProtocolEnabled(),
|
|
362203
362212
|
checking: false
|
|
@@ -364939,7 +364948,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
364939
364948
|
) });
|
|
364940
364949
|
}, "AppWrapper");
|
|
364941
364950
|
const instance = render_default(
|
|
364942
|
-
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
364951
|
+
process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(import_react138.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(AppWrapper, {}),
|
|
364943
364952
|
{
|
|
364944
364953
|
exitOnCtrlC: false,
|
|
364945
364954
|
isScreenReaderEnabled: config.getScreenReader()
|