snow-ai 0.6.8 → 0.6.10
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/bundle/cli.mjs +230 -374
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/cli.mjs
CHANGED
|
@@ -1475,9 +1475,9 @@ var require_react_development = __commonJS({
|
|
|
1475
1475
|
var dispatcher = resolveDispatcher();
|
|
1476
1476
|
return dispatcher.useId();
|
|
1477
1477
|
}
|
|
1478
|
-
function useSyncExternalStore(
|
|
1478
|
+
function useSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot) {
|
|
1479
1479
|
var dispatcher = resolveDispatcher();
|
|
1480
|
-
return dispatcher.useSyncExternalStore(
|
|
1480
|
+
return dispatcher.useSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot);
|
|
1481
1481
|
}
|
|
1482
1482
|
var disabledDepth = 0;
|
|
1483
1483
|
var prevLog;
|
|
@@ -2765,8 +2765,8 @@ var require_signal_exit = __commonJS({
|
|
|
2765
2765
|
if (!processOk(global.process)) {
|
|
2766
2766
|
return;
|
|
2767
2767
|
}
|
|
2768
|
-
var
|
|
2769
|
-
if (
|
|
2768
|
+
var listeners2 = process20.listeners(sig);
|
|
2769
|
+
if (listeners2.length === emitter.count) {
|
|
2770
2770
|
unload();
|
|
2771
2771
|
emit("exit", null, sig);
|
|
2772
2772
|
emit("afterexit", null, sig);
|
|
@@ -15071,17 +15071,17 @@ var require_react_reconciler_development = __commonJS({
|
|
|
15071
15071
|
}
|
|
15072
15072
|
return [newState, dispatch];
|
|
15073
15073
|
}
|
|
15074
|
-
function mountMutableSource(source2, getSnapshot,
|
|
15074
|
+
function mountMutableSource(source2, getSnapshot, subscribe2) {
|
|
15075
15075
|
{
|
|
15076
15076
|
return void 0;
|
|
15077
15077
|
}
|
|
15078
15078
|
}
|
|
15079
|
-
function updateMutableSource(source2, getSnapshot,
|
|
15079
|
+
function updateMutableSource(source2, getSnapshot, subscribe2) {
|
|
15080
15080
|
{
|
|
15081
15081
|
return void 0;
|
|
15082
15082
|
}
|
|
15083
15083
|
}
|
|
15084
|
-
function mountSyncExternalStore(
|
|
15084
|
+
function mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot) {
|
|
15085
15085
|
var fiber = currentlyRenderingFiber$1;
|
|
15086
15086
|
var hook = mountWorkInProgressHook();
|
|
15087
15087
|
var nextSnapshot;
|
|
@@ -15124,12 +15124,12 @@ var require_react_reconciler_development = __commonJS({
|
|
|
15124
15124
|
getSnapshot
|
|
15125
15125
|
};
|
|
15126
15126
|
hook.queue = inst;
|
|
15127
|
-
mountEffect(subscribeToStore.bind(null, fiber, inst,
|
|
15127
|
+
mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe2), [subscribe2]);
|
|
15128
15128
|
fiber.flags |= Passive;
|
|
15129
15129
|
pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), void 0, null);
|
|
15130
15130
|
return nextSnapshot;
|
|
15131
15131
|
}
|
|
15132
|
-
function updateSyncExternalStore(
|
|
15132
|
+
function updateSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot) {
|
|
15133
15133
|
var fiber = currentlyRenderingFiber$1;
|
|
15134
15134
|
var hook = updateWorkInProgressHook();
|
|
15135
15135
|
var nextSnapshot = getSnapshot();
|
|
@@ -15149,7 +15149,7 @@ var require_react_reconciler_development = __commonJS({
|
|
|
15149
15149
|
markWorkInProgressReceivedUpdate();
|
|
15150
15150
|
}
|
|
15151
15151
|
var inst = hook.queue;
|
|
15152
|
-
updateEffect(subscribeToStore.bind(null, fiber, inst,
|
|
15152
|
+
updateEffect(subscribeToStore.bind(null, fiber, inst, subscribe2), [subscribe2]);
|
|
15153
15153
|
if (inst.getSnapshot !== getSnapshot || snapshotChanged || // Check if the susbcribe function changed. We can save some memory by
|
|
15154
15154
|
// checking whether we scheduled a subscription effect above.
|
|
15155
15155
|
workInProgressHook !== null && workInProgressHook.memoizedState.tag & HasEffect) {
|
|
@@ -15192,13 +15192,13 @@ var require_react_reconciler_development = __commonJS({
|
|
|
15192
15192
|
forceStoreRerender(fiber);
|
|
15193
15193
|
}
|
|
15194
15194
|
}
|
|
15195
|
-
function subscribeToStore(fiber, inst,
|
|
15195
|
+
function subscribeToStore(fiber, inst, subscribe2) {
|
|
15196
15196
|
var handleStoreChange = function() {
|
|
15197
15197
|
if (checkIfSnapshotChanged(inst)) {
|
|
15198
15198
|
forceStoreRerender(fiber);
|
|
15199
15199
|
}
|
|
15200
15200
|
};
|
|
15201
|
-
return
|
|
15201
|
+
return subscribe2(handleStoreChange);
|
|
15202
15202
|
}
|
|
15203
15203
|
function checkIfSnapshotChanged(inst) {
|
|
15204
15204
|
var latestGetSnapshot = inst.getSnapshot;
|
|
@@ -15779,15 +15779,15 @@ var require_react_reconciler_development = __commonJS({
|
|
|
15779
15779
|
mountHookTypesDev();
|
|
15780
15780
|
return mountTransition();
|
|
15781
15781
|
},
|
|
15782
|
-
useMutableSource: function(source2, getSnapshot,
|
|
15782
|
+
useMutableSource: function(source2, getSnapshot, subscribe2) {
|
|
15783
15783
|
currentHookNameInDev = "useMutableSource";
|
|
15784
15784
|
mountHookTypesDev();
|
|
15785
15785
|
return mountMutableSource();
|
|
15786
15786
|
},
|
|
15787
|
-
useSyncExternalStore: function(
|
|
15787
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
|
|
15788
15788
|
currentHookNameInDev = "useSyncExternalStore";
|
|
15789
15789
|
mountHookTypesDev();
|
|
15790
|
-
return mountSyncExternalStore(
|
|
15790
|
+
return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot);
|
|
15791
15791
|
},
|
|
15792
15792
|
useId: function() {
|
|
15793
15793
|
currentHookNameInDev = "useId";
|
|
@@ -15883,15 +15883,15 @@ var require_react_reconciler_development = __commonJS({
|
|
|
15883
15883
|
updateHookTypesDev();
|
|
15884
15884
|
return mountTransition();
|
|
15885
15885
|
},
|
|
15886
|
-
useMutableSource: function(source2, getSnapshot,
|
|
15886
|
+
useMutableSource: function(source2, getSnapshot, subscribe2) {
|
|
15887
15887
|
currentHookNameInDev = "useMutableSource";
|
|
15888
15888
|
updateHookTypesDev();
|
|
15889
15889
|
return mountMutableSource();
|
|
15890
15890
|
},
|
|
15891
|
-
useSyncExternalStore: function(
|
|
15891
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
|
|
15892
15892
|
currentHookNameInDev = "useSyncExternalStore";
|
|
15893
15893
|
updateHookTypesDev();
|
|
15894
|
-
return mountSyncExternalStore(
|
|
15894
|
+
return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot);
|
|
15895
15895
|
},
|
|
15896
15896
|
useId: function() {
|
|
15897
15897
|
currentHookNameInDev = "useId";
|
|
@@ -15987,15 +15987,15 @@ var require_react_reconciler_development = __commonJS({
|
|
|
15987
15987
|
updateHookTypesDev();
|
|
15988
15988
|
return updateTransition();
|
|
15989
15989
|
},
|
|
15990
|
-
useMutableSource: function(source2, getSnapshot,
|
|
15990
|
+
useMutableSource: function(source2, getSnapshot, subscribe2) {
|
|
15991
15991
|
currentHookNameInDev = "useMutableSource";
|
|
15992
15992
|
updateHookTypesDev();
|
|
15993
15993
|
return updateMutableSource();
|
|
15994
15994
|
},
|
|
15995
|
-
useSyncExternalStore: function(
|
|
15995
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
|
|
15996
15996
|
currentHookNameInDev = "useSyncExternalStore";
|
|
15997
15997
|
updateHookTypesDev();
|
|
15998
|
-
return updateSyncExternalStore(
|
|
15998
|
+
return updateSyncExternalStore(subscribe2, getSnapshot);
|
|
15999
15999
|
},
|
|
16000
16000
|
useId: function() {
|
|
16001
16001
|
currentHookNameInDev = "useId";
|
|
@@ -16091,15 +16091,15 @@ var require_react_reconciler_development = __commonJS({
|
|
|
16091
16091
|
updateHookTypesDev();
|
|
16092
16092
|
return rerenderTransition();
|
|
16093
16093
|
},
|
|
16094
|
-
useMutableSource: function(source2, getSnapshot,
|
|
16094
|
+
useMutableSource: function(source2, getSnapshot, subscribe2) {
|
|
16095
16095
|
currentHookNameInDev = "useMutableSource";
|
|
16096
16096
|
updateHookTypesDev();
|
|
16097
16097
|
return updateMutableSource();
|
|
16098
16098
|
},
|
|
16099
|
-
useSyncExternalStore: function(
|
|
16099
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
|
|
16100
16100
|
currentHookNameInDev = "useSyncExternalStore";
|
|
16101
16101
|
updateHookTypesDev();
|
|
16102
|
-
return updateSyncExternalStore(
|
|
16102
|
+
return updateSyncExternalStore(subscribe2, getSnapshot);
|
|
16103
16103
|
},
|
|
16104
16104
|
useId: function() {
|
|
16105
16105
|
currentHookNameInDev = "useId";
|
|
@@ -16209,17 +16209,17 @@ var require_react_reconciler_development = __commonJS({
|
|
|
16209
16209
|
mountHookTypesDev();
|
|
16210
16210
|
return mountTransition();
|
|
16211
16211
|
},
|
|
16212
|
-
useMutableSource: function(source2, getSnapshot,
|
|
16212
|
+
useMutableSource: function(source2, getSnapshot, subscribe2) {
|
|
16213
16213
|
currentHookNameInDev = "useMutableSource";
|
|
16214
16214
|
warnInvalidHookAccess();
|
|
16215
16215
|
mountHookTypesDev();
|
|
16216
16216
|
return mountMutableSource();
|
|
16217
16217
|
},
|
|
16218
|
-
useSyncExternalStore: function(
|
|
16218
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
|
|
16219
16219
|
currentHookNameInDev = "useSyncExternalStore";
|
|
16220
16220
|
warnInvalidHookAccess();
|
|
16221
16221
|
mountHookTypesDev();
|
|
16222
|
-
return mountSyncExternalStore(
|
|
16222
|
+
return mountSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot);
|
|
16223
16223
|
},
|
|
16224
16224
|
useId: function() {
|
|
16225
16225
|
currentHookNameInDev = "useId";
|
|
@@ -16330,17 +16330,17 @@ var require_react_reconciler_development = __commonJS({
|
|
|
16330
16330
|
updateHookTypesDev();
|
|
16331
16331
|
return updateTransition();
|
|
16332
16332
|
},
|
|
16333
|
-
useMutableSource: function(source2, getSnapshot,
|
|
16333
|
+
useMutableSource: function(source2, getSnapshot, subscribe2) {
|
|
16334
16334
|
currentHookNameInDev = "useMutableSource";
|
|
16335
16335
|
warnInvalidHookAccess();
|
|
16336
16336
|
updateHookTypesDev();
|
|
16337
16337
|
return updateMutableSource();
|
|
16338
16338
|
},
|
|
16339
|
-
useSyncExternalStore: function(
|
|
16339
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
|
|
16340
16340
|
currentHookNameInDev = "useSyncExternalStore";
|
|
16341
16341
|
warnInvalidHookAccess();
|
|
16342
16342
|
updateHookTypesDev();
|
|
16343
|
-
return updateSyncExternalStore(
|
|
16343
|
+
return updateSyncExternalStore(subscribe2, getSnapshot);
|
|
16344
16344
|
},
|
|
16345
16345
|
useId: function() {
|
|
16346
16346
|
currentHookNameInDev = "useId";
|
|
@@ -16451,17 +16451,17 @@ var require_react_reconciler_development = __commonJS({
|
|
|
16451
16451
|
updateHookTypesDev();
|
|
16452
16452
|
return rerenderTransition();
|
|
16453
16453
|
},
|
|
16454
|
-
useMutableSource: function(source2, getSnapshot,
|
|
16454
|
+
useMutableSource: function(source2, getSnapshot, subscribe2) {
|
|
16455
16455
|
currentHookNameInDev = "useMutableSource";
|
|
16456
16456
|
warnInvalidHookAccess();
|
|
16457
16457
|
updateHookTypesDev();
|
|
16458
16458
|
return updateMutableSource();
|
|
16459
16459
|
},
|
|
16460
|
-
useSyncExternalStore: function(
|
|
16460
|
+
useSyncExternalStore: function(subscribe2, getSnapshot, getServerSnapshot) {
|
|
16461
16461
|
currentHookNameInDev = "useSyncExternalStore";
|
|
16462
16462
|
warnInvalidHookAccess();
|
|
16463
16463
|
updateHookTypesDev();
|
|
16464
|
-
return updateSyncExternalStore(
|
|
16464
|
+
return updateSyncExternalStore(subscribe2, getSnapshot);
|
|
16465
16465
|
},
|
|
16466
16466
|
useId: function() {
|
|
16467
16467
|
currentHookNameInDev = "useId";
|
|
@@ -49724,8 +49724,8 @@ var require_util = __commonJS({
|
|
|
49724
49724
|
} : null;
|
|
49725
49725
|
}
|
|
49726
49726
|
function addListener(obj2, name, listener) {
|
|
49727
|
-
const
|
|
49728
|
-
|
|
49727
|
+
const listeners2 = obj2[kListeners] ??= [];
|
|
49728
|
+
listeners2.push([name, listener]);
|
|
49729
49729
|
obj2.on(name, listener);
|
|
49730
49730
|
return obj2;
|
|
49731
49731
|
}
|
|
@@ -71093,7 +71093,7 @@ var init_version = __esm({
|
|
|
71093
71093
|
// dist/api/chat.js
|
|
71094
71094
|
function convertToOpenAIMessages(messages, includeBuiltinSystemPrompt = true, customSystemPromptOverride, planMode = false, vulnerabilityHuntingMode = false) {
|
|
71095
71095
|
var _a21;
|
|
71096
|
-
const customSystemPrompt = customSystemPromptOverride
|
|
71096
|
+
const customSystemPrompt = customSystemPromptOverride;
|
|
71097
71097
|
let result2 = messages.map((msg) => {
|
|
71098
71098
|
if (msg.role === "user" && msg.images && msg.images.length > 0) {
|
|
71099
71099
|
const contentParts = [];
|
|
@@ -71283,6 +71283,7 @@ async function* createStreamingChatCompletion(options3, abortSignal, onRetry) {
|
|
|
71283
71283
|
customSystemPromptContent = customPrompt.content;
|
|
71284
71284
|
}
|
|
71285
71285
|
}
|
|
71286
|
+
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
71286
71287
|
yield* withRetryGenerator(async function* () {
|
|
71287
71288
|
var _a21, _b14, _c6, _d4, _e2, _f;
|
|
71288
71289
|
const requestBody = {
|
|
@@ -71304,7 +71305,7 @@ async function* createStreamingChatCompletion(options3, abortSignal, onRetry) {
|
|
|
71304
71305
|
tool_choice: options3.tool_choice
|
|
71305
71306
|
};
|
|
71306
71307
|
const url = `${config3.baseUrl}/chat/completions`;
|
|
71307
|
-
const customHeaders = options3.customHeaders ||
|
|
71308
|
+
const customHeaders = options3.customHeaders || getCustomHeadersForConfig(config3);
|
|
71308
71309
|
const fetchOptions = addProxyToFetchOptions(url, {
|
|
71309
71310
|
method: "POST",
|
|
71310
71311
|
headers: {
|
|
@@ -71511,7 +71512,7 @@ function getResponsesReasoningConfig() {
|
|
|
71511
71512
|
function resetOpenAIClient2() {
|
|
71512
71513
|
}
|
|
71513
71514
|
function convertToResponseInput(messages, includeBuiltinSystemPrompt = true, customSystemPromptOverride, planMode = false, vulnerabilityHuntingMode = false) {
|
|
71514
|
-
const customSystemPrompt = customSystemPromptOverride
|
|
71515
|
+
const customSystemPrompt = customSystemPromptOverride;
|
|
71515
71516
|
const result2 = [];
|
|
71516
71517
|
for (const msg of messages) {
|
|
71517
71518
|
if (!msg)
|
|
@@ -71695,6 +71696,7 @@ async function* createStreamingResponse(options3, abortSignal, onRetry) {
|
|
|
71695
71696
|
customSystemPromptContent = customPrompt.content;
|
|
71696
71697
|
}
|
|
71697
71698
|
}
|
|
71699
|
+
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
71698
71700
|
const { input: requestInput, systemInstructions } = convertToResponseInput(
|
|
71699
71701
|
options3.messages,
|
|
71700
71702
|
options3.includeBuiltinSystemPrompt !== false,
|
|
@@ -71722,7 +71724,7 @@ async function* createStreamingResponse(options3, abortSignal, onRetry) {
|
|
|
71722
71724
|
prompt_cache_key: options3.prompt_cache_key
|
|
71723
71725
|
};
|
|
71724
71726
|
const url = `${config3.baseUrl}/responses`;
|
|
71725
|
-
const customHeaders = options3.customHeaders ||
|
|
71727
|
+
const customHeaders = options3.customHeaders || getCustomHeadersForConfig(config3);
|
|
71726
71728
|
const fetchOptions = addProxyToFetchOptions(url, {
|
|
71727
71729
|
method: "POST",
|
|
71728
71730
|
headers: {
|
|
@@ -71934,7 +71936,7 @@ function convertToolsToGemini(tools) {
|
|
|
71934
71936
|
}
|
|
71935
71937
|
function convertToGeminiMessages(messages, includeBuiltinSystemPrompt = true, customSystemPromptOverride, planMode = false, vulnerabilityHuntingMode = false) {
|
|
71936
71938
|
var _a21;
|
|
71937
|
-
const customSystemPrompt = customSystemPromptOverride
|
|
71939
|
+
const customSystemPrompt = customSystemPromptOverride;
|
|
71938
71940
|
let systemInstruction;
|
|
71939
71941
|
const contents = [];
|
|
71940
71942
|
const toolCallIdToFunctionName = /* @__PURE__ */ new Map();
|
|
@@ -72118,6 +72120,7 @@ async function* createStreamingGeminiCompletion(options3, abortSignal, onRetry)
|
|
|
72118
72120
|
customSystemPromptContent = customPrompt.content;
|
|
72119
72121
|
}
|
|
72120
72122
|
}
|
|
72123
|
+
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
72121
72124
|
yield* withRetryGenerator(async function* () {
|
|
72122
72125
|
var _a21;
|
|
72123
72126
|
const { systemInstruction, contents } = convertToGeminiMessages(
|
|
@@ -72147,7 +72150,7 @@ async function* createStreamingGeminiCompletion(options3, abortSignal, onRetry)
|
|
|
72147
72150
|
const modelName = effectiveModel.startsWith("models/") ? effectiveModel : `models/${effectiveModel}`;
|
|
72148
72151
|
const baseUrl = config3.baseUrl && config3.baseUrl !== "https://api.openai.com/v1" ? config3.baseUrl : "https://generativelanguage.googleapis.com/v1beta";
|
|
72149
72152
|
const url = `${baseUrl}/${modelName}:streamGenerateContent?key=${config3.apiKey}&alt=sse`;
|
|
72150
|
-
const customHeaders = options3.customHeaders ||
|
|
72153
|
+
const customHeaders = options3.customHeaders || getCustomHeadersForConfig(config3);
|
|
72151
72154
|
const fetchOptions = addProxyToFetchOptions(url, {
|
|
72152
72155
|
method: "POST",
|
|
72153
72156
|
headers: {
|
|
@@ -74421,7 +74424,9 @@ __export(apiConfig_exports, {
|
|
|
74421
74424
|
clearConfigCache: () => clearConfigCache,
|
|
74422
74425
|
getCustomHeaders: () => getCustomHeaders,
|
|
74423
74426
|
getCustomHeadersConfig: () => getCustomHeadersConfig,
|
|
74427
|
+
getCustomHeadersForConfig: () => getCustomHeadersForConfig,
|
|
74424
74428
|
getCustomSystemPrompt: () => getCustomSystemPrompt,
|
|
74429
|
+
getCustomSystemPromptForConfig: () => getCustomSystemPromptForConfig,
|
|
74425
74430
|
getMCPConfig: () => getMCPConfig,
|
|
74426
74431
|
getOpenAiConfig: () => getOpenAiConfig,
|
|
74427
74432
|
getSystemPromptConfig: () => getSystemPromptConfig,
|
|
@@ -74696,7 +74701,10 @@ function saveSystemPromptConfig(config3) {
|
|
|
74696
74701
|
}
|
|
74697
74702
|
}
|
|
74698
74703
|
function getCustomSystemPrompt() {
|
|
74699
|
-
|
|
74704
|
+
return getCustomSystemPromptForConfig(getOpenAiConfig());
|
|
74705
|
+
}
|
|
74706
|
+
function getCustomSystemPromptForConfig(apiConfig) {
|
|
74707
|
+
const { systemPromptId } = apiConfig;
|
|
74700
74708
|
const config3 = getSystemPromptConfig();
|
|
74701
74709
|
if (!config3) {
|
|
74702
74710
|
return void 0;
|
|
@@ -74715,8 +74723,11 @@ function getCustomSystemPrompt() {
|
|
|
74715
74723
|
return activePrompt == null ? void 0 : activePrompt.content;
|
|
74716
74724
|
}
|
|
74717
74725
|
function getCustomHeaders() {
|
|
74726
|
+
return getCustomHeadersForConfig(getOpenAiConfig());
|
|
74727
|
+
}
|
|
74728
|
+
function getCustomHeadersForConfig(apiConfig) {
|
|
74718
74729
|
ensureConfigDirectory2();
|
|
74719
|
-
const { customHeadersSchemeId } =
|
|
74730
|
+
const { customHeadersSchemeId } = apiConfig;
|
|
74720
74731
|
const config3 = getCustomHeadersConfig();
|
|
74721
74732
|
if (!config3) {
|
|
74722
74733
|
return {};
|
|
@@ -74909,7 +74920,7 @@ function convertToolsToAnthropic(tools) {
|
|
|
74909
74920
|
}
|
|
74910
74921
|
function convertToAnthropicMessages(messages, includeBuiltinSystemPrompt = true, customSystemPromptOverride, cacheTTL = "5m", disableThinking = false, planMode = false, vulnerabilityHuntingMode = false) {
|
|
74911
74922
|
var _a21;
|
|
74912
|
-
const customSystemPrompt = customSystemPromptOverride
|
|
74923
|
+
const customSystemPrompt = customSystemPromptOverride;
|
|
74913
74924
|
let systemContent;
|
|
74914
74925
|
const anthropicMessages = [];
|
|
74915
74926
|
for (const msg of messages) {
|
|
@@ -75159,6 +75170,7 @@ async function* createStreamingAnthropicCompletion(options3, abortSignal, onRetr
|
|
|
75159
75170
|
customSystemPromptContent = customPrompt.content;
|
|
75160
75171
|
}
|
|
75161
75172
|
}
|
|
75173
|
+
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
75162
75174
|
const { system, messages } = convertToAnthropicMessages(
|
|
75163
75175
|
options3.messages,
|
|
75164
75176
|
options3.includeBuiltinSystemPrompt !== false,
|
|
@@ -75196,7 +75208,7 @@ async function* createStreamingAnthropicCompletion(options3, abortSignal, onRetr
|
|
|
75196
75208
|
requestBody.thinking = config3.thinking;
|
|
75197
75209
|
requestBody.temperature = 1;
|
|
75198
75210
|
}
|
|
75199
|
-
const customHeaders = options3.customHeaders ||
|
|
75211
|
+
const customHeaders = options3.customHeaders || getCustomHeadersForConfig(config3);
|
|
75200
75212
|
const headers = {
|
|
75201
75213
|
"Content-Type": "application/json",
|
|
75202
75214
|
"x-api-key": config3.apiKey,
|
|
@@ -84011,30 +84023,47 @@ var init_useGlobalNavigation = __esm({
|
|
|
84011
84023
|
});
|
|
84012
84024
|
|
|
84013
84025
|
// dist/hooks/ui/useTerminalSize.js
|
|
84014
|
-
function
|
|
84015
|
-
|
|
84026
|
+
function handleResize() {
|
|
84027
|
+
currentSize = {
|
|
84016
84028
|
columns: process.stdout.columns || 80,
|
|
84017
84029
|
rows: process.stdout.rows || 20
|
|
84018
|
-
}
|
|
84019
|
-
|
|
84020
|
-
|
|
84021
|
-
|
|
84022
|
-
|
|
84023
|
-
|
|
84024
|
-
|
|
84030
|
+
};
|
|
84031
|
+
listeners.forEach((listener) => listener(currentSize));
|
|
84032
|
+
}
|
|
84033
|
+
function subscribe(listener) {
|
|
84034
|
+
listeners.add(listener);
|
|
84035
|
+
if (!isListening) {
|
|
84036
|
+
isListening = true;
|
|
84037
|
+
process.stdout.on("resize", handleResize);
|
|
84038
|
+
}
|
|
84039
|
+
return () => {
|
|
84040
|
+
listeners.delete(listener);
|
|
84041
|
+
if (listeners.size === 0 && isListening) {
|
|
84042
|
+
isListening = false;
|
|
84043
|
+
process.stdout.off("resize", handleResize);
|
|
84025
84044
|
}
|
|
84026
|
-
|
|
84027
|
-
|
|
84028
|
-
|
|
84029
|
-
|
|
84045
|
+
};
|
|
84046
|
+
}
|
|
84047
|
+
function useTerminalSize() {
|
|
84048
|
+
const [size2, setSize] = (0, import_react56.useState)(currentSize);
|
|
84049
|
+
(0, import_react56.useEffect)(() => {
|
|
84050
|
+
setSize(currentSize);
|
|
84051
|
+
const unsubscribe = subscribe(setSize);
|
|
84052
|
+
return unsubscribe;
|
|
84030
84053
|
}, []);
|
|
84031
84054
|
return size2;
|
|
84032
84055
|
}
|
|
84033
|
-
var import_react56;
|
|
84056
|
+
var import_react56, listeners, isListening, currentSize;
|
|
84034
84057
|
var init_useTerminalSize = __esm({
|
|
84035
84058
|
"dist/hooks/ui/useTerminalSize.js"() {
|
|
84036
84059
|
"use strict";
|
|
84037
84060
|
import_react56 = __toESM(require_react(), 1);
|
|
84061
|
+
listeners = /* @__PURE__ */ new Set();
|
|
84062
|
+
isListening = false;
|
|
84063
|
+
currentSize = {
|
|
84064
|
+
columns: process.stdout.columns || 80,
|
|
84065
|
+
rows: process.stdout.rows || 20
|
|
84066
|
+
};
|
|
84038
84067
|
}
|
|
84039
84068
|
});
|
|
84040
84069
|
|
|
@@ -350813,9 +350842,33 @@ var init_hashBasedSnapshot = __esm({
|
|
|
350813
350842
|
writable: true,
|
|
350814
350843
|
value: void 0
|
|
350815
350844
|
});
|
|
350845
|
+
Object.defineProperty(this, "fileLocks", {
|
|
350846
|
+
enumerable: true,
|
|
350847
|
+
configurable: true,
|
|
350848
|
+
writable: true,
|
|
350849
|
+
value: /* @__PURE__ */ new Map()
|
|
350850
|
+
});
|
|
350816
350851
|
const projectId = getProjectId();
|
|
350817
350852
|
this.snapshotsDir = path18.join(os8.homedir(), ".snow", "snapshots", projectId);
|
|
350818
350853
|
}
|
|
350854
|
+
/**
|
|
350855
|
+
* Acquire a lock for a specific file path
|
|
350856
|
+
* Ensures sequential access to prevent race conditions
|
|
350857
|
+
*/
|
|
350858
|
+
async acquireLock(filePath) {
|
|
350859
|
+
while (this.fileLocks.has(filePath)) {
|
|
350860
|
+
await this.fileLocks.get(filePath);
|
|
350861
|
+
}
|
|
350862
|
+
let releaseLock;
|
|
350863
|
+
const lockPromise = new Promise((resolve12) => {
|
|
350864
|
+
releaseLock = resolve12;
|
|
350865
|
+
});
|
|
350866
|
+
this.fileLocks.set(filePath, lockPromise);
|
|
350867
|
+
return () => {
|
|
350868
|
+
this.fileLocks.delete(filePath);
|
|
350869
|
+
releaseLock();
|
|
350870
|
+
};
|
|
350871
|
+
}
|
|
350819
350872
|
/**
|
|
350820
350873
|
* Ensure snapshots directory exists
|
|
350821
350874
|
*/
|
|
@@ -350838,10 +350891,11 @@ var init_hashBasedSnapshot = __esm({
|
|
|
350838
350891
|
* @param originalContent Original file content (undefined for new files)
|
|
350839
350892
|
*/
|
|
350840
350893
|
async backupFile(sessionId, messageIndex, filePath, workspaceRoot, existed, originalContent) {
|
|
350894
|
+
const snapshotPath = this.getSnapshotPath(sessionId, messageIndex);
|
|
350895
|
+
const releaseLock = await this.acquireLock(snapshotPath);
|
|
350841
350896
|
try {
|
|
350842
350897
|
logger.info(`[Snapshot] backupFile called: sessionId=${sessionId}, messageIndex=${messageIndex}, filePath=${filePath}, existed=${existed}`);
|
|
350843
350898
|
await this.ensureSnapshotsDir();
|
|
350844
|
-
const snapshotPath = this.getSnapshotPath(sessionId, messageIndex);
|
|
350845
350899
|
logger.info(`[Snapshot] snapshotPath=${snapshotPath}`);
|
|
350846
350900
|
const relativePath = path18.isAbsolute(filePath) ? path18.relative(workspaceRoot, filePath) : filePath;
|
|
350847
350901
|
const backup = {
|
|
@@ -350871,6 +350925,8 @@ var init_hashBasedSnapshot = __esm({
|
|
|
350871
350925
|
}
|
|
350872
350926
|
} catch (error) {
|
|
350873
350927
|
logger.warn(`[Snapshot] Failed to backup file ${filePath}:`, error);
|
|
350928
|
+
} finally {
|
|
350929
|
+
releaseLock();
|
|
350874
350930
|
}
|
|
350875
350931
|
}
|
|
350876
350932
|
/**
|
|
@@ -350880,8 +350936,9 @@ var init_hashBasedSnapshot = __esm({
|
|
|
350880
350936
|
* @param filePath File path to remove from backup
|
|
350881
350937
|
*/
|
|
350882
350938
|
async removeFileBackup(sessionId, messageIndex, filePath, workspaceRoot) {
|
|
350939
|
+
const snapshotPath = this.getSnapshotPath(sessionId, messageIndex);
|
|
350940
|
+
const releaseLock = await this.acquireLock(snapshotPath);
|
|
350883
350941
|
try {
|
|
350884
|
-
const snapshotPath = this.getSnapshotPath(sessionId, messageIndex);
|
|
350885
350942
|
try {
|
|
350886
350943
|
const content = await fs16.readFile(snapshotPath, "utf-8");
|
|
350887
350944
|
const metadata = JSON.parse(content);
|
|
@@ -350901,6 +350958,8 @@ var init_hashBasedSnapshot = __esm({
|
|
|
350901
350958
|
}
|
|
350902
350959
|
} catch (error) {
|
|
350903
350960
|
logger.warn(`[Snapshot] Failed to remove file backup ${filePath}:`, error);
|
|
350961
|
+
} finally {
|
|
350962
|
+
releaseLock();
|
|
350904
350963
|
}
|
|
350905
350964
|
}
|
|
350906
350965
|
/**
|
|
@@ -351897,6 +351956,8 @@ ${diffMsg}
|
|
|
351897
351956
|
Matched: lines ${startLine}-${endLine} (occurrence ${occurrence}/${matches.length})
|
|
351898
351957
|
Result: ${replaceLines.length} new lines` + (smartBoundaries.extended ? `
|
|
351899
351958
|
\u{1F4CD} Context auto-extended to show complete code block (lines ${contextStart}-${finalContextEnd})` : ""),
|
|
351959
|
+
filePath,
|
|
351960
|
+
// Include file path for DiffViewer display on Resume/re-render
|
|
351900
351961
|
oldContent,
|
|
351901
351962
|
newContent: newContextContent,
|
|
351902
351963
|
replacedContent,
|
|
@@ -352108,6 +352169,8 @@ ${formattedDiagnostics}`;
|
|
|
352108
352169
|
Replaced: lines ${adjustedStartLine}-${adjustedEndLine} (${linesToModify} lines)
|
|
352109
352170
|
Result: ${newContentLines.length} new lines` + (smartBoundaries.extended ? `
|
|
352110
352171
|
\u{1F4CD} Context auto-extended to show complete code block (lines ${contextStart}-${finalContextEnd})` : ""),
|
|
352172
|
+
filePath,
|
|
352173
|
+
// Include file path for DiffViewer display on Resume/re-render
|
|
352111
352174
|
oldContent,
|
|
352112
352175
|
newContent: finalContextContent,
|
|
352113
352176
|
replacedLines: replacedContent,
|
|
@@ -356820,9 +356883,9 @@ var init_rxjs = __esm({
|
|
|
356820
356883
|
return typeof Symbol === "function" && Symbol.observable || "@@observable";
|
|
356821
356884
|
})();
|
|
356822
356885
|
Observable = (function() {
|
|
356823
|
-
function Observable2(
|
|
356824
|
-
if (
|
|
356825
|
-
this._subscribe =
|
|
356886
|
+
function Observable2(subscribe2) {
|
|
356887
|
+
if (subscribe2) {
|
|
356888
|
+
this._subscribe = subscribe2;
|
|
356826
356889
|
}
|
|
356827
356890
|
}
|
|
356828
356891
|
Observable2.prototype.lift = function(operator) {
|
|
@@ -356894,8 +356957,8 @@ var init_rxjs = __esm({
|
|
|
356894
356957
|
});
|
|
356895
356958
|
});
|
|
356896
356959
|
};
|
|
356897
|
-
Observable2.create = function(
|
|
356898
|
-
return new Observable2(
|
|
356960
|
+
Observable2.create = function(subscribe2) {
|
|
356961
|
+
return new Observable2(subscribe2);
|
|
356899
356962
|
};
|
|
356900
356963
|
return Observable2;
|
|
356901
356964
|
})();
|
|
@@ -385844,7 +385907,7 @@ var require_NetworkStorage = __commonJS({
|
|
|
385844
385907
|
}
|
|
385845
385908
|
onCdpTargetCreated(cdpTarget) {
|
|
385846
385909
|
const cdpClient = cdpTarget.cdpClient;
|
|
385847
|
-
const
|
|
385910
|
+
const listeners2 = [
|
|
385848
385911
|
[
|
|
385849
385912
|
"Network.requestWillBeSent",
|
|
385850
385913
|
(params) => {
|
|
@@ -385937,7 +386000,7 @@ var require_NetworkStorage = __commonJS({
|
|
|
385937
386000
|
}
|
|
385938
386001
|
]
|
|
385939
386002
|
];
|
|
385940
|
-
for (const [event, listener] of
|
|
386003
|
+
for (const [event, listener] of listeners2) {
|
|
385941
386004
|
cdpClient.on(event, listener);
|
|
385942
386005
|
}
|
|
385943
386006
|
}
|
|
@@ -423785,22 +423848,22 @@ function launch(opts) {
|
|
|
423785
423848
|
return new Process(opts);
|
|
423786
423849
|
}
|
|
423787
423850
|
function subscribeToProcessEvent(event, handler) {
|
|
423788
|
-
const
|
|
423789
|
-
if (
|
|
423851
|
+
const listeners2 = processListeners.get(event) || [];
|
|
423852
|
+
if (listeners2.length === 0) {
|
|
423790
423853
|
process.on(event, dispatchers[event]);
|
|
423791
423854
|
}
|
|
423792
|
-
|
|
423793
|
-
processListeners.set(event,
|
|
423855
|
+
listeners2.push(handler);
|
|
423856
|
+
processListeners.set(event, listeners2);
|
|
423794
423857
|
}
|
|
423795
423858
|
function unsubscribeFromProcessEvent(event, handler) {
|
|
423796
|
-
const
|
|
423797
|
-
const existingListenerIdx =
|
|
423859
|
+
const listeners2 = processListeners.get(event) || [];
|
|
423860
|
+
const existingListenerIdx = listeners2.indexOf(handler);
|
|
423798
423861
|
if (existingListenerIdx === -1) {
|
|
423799
423862
|
return;
|
|
423800
423863
|
}
|
|
423801
|
-
|
|
423802
|
-
processListeners.set(event,
|
|
423803
|
-
if (
|
|
423864
|
+
listeners2.splice(existingListenerIdx, 1);
|
|
423865
|
+
processListeners.set(event, listeners2);
|
|
423866
|
+
if (listeners2.length === 0) {
|
|
423804
423867
|
process.off(event, dispatchers[event]);
|
|
423805
423868
|
}
|
|
423806
423869
|
}
|
|
@@ -433524,34 +433587,26 @@ ${agent.role}`;
|
|
|
433524
433587
|
tools: allowedTools,
|
|
433525
433588
|
sessionId: currentSession == null ? void 0 : currentSession.id,
|
|
433526
433589
|
//disableThinking: true, // Sub-agents 不使用 Extended Thinking
|
|
433527
|
-
configProfile: agent.configProfile
|
|
433528
|
-
customSystemPromptId: agent.customSystemPrompt,
|
|
433529
|
-
customHeaders: agent.customHeaders
|
|
433590
|
+
configProfile: agent.configProfile
|
|
433530
433591
|
}, abortSignal) : config3.requestMethod === "gemini" ? createStreamingGeminiCompletion({
|
|
433531
433592
|
model,
|
|
433532
433593
|
messages,
|
|
433533
433594
|
temperature: 0,
|
|
433534
433595
|
tools: allowedTools,
|
|
433535
|
-
configProfile: agent.configProfile
|
|
433536
|
-
customSystemPromptId: agent.customSystemPrompt,
|
|
433537
|
-
customHeaders: agent.customHeaders
|
|
433596
|
+
configProfile: agent.configProfile
|
|
433538
433597
|
}, abortSignal) : config3.requestMethod === "responses" ? createStreamingResponse({
|
|
433539
433598
|
model,
|
|
433540
433599
|
messages,
|
|
433541
433600
|
temperature: 0,
|
|
433542
433601
|
tools: allowedTools,
|
|
433543
433602
|
prompt_cache_key: currentSession == null ? void 0 : currentSession.id,
|
|
433544
|
-
configProfile: agent.configProfile
|
|
433545
|
-
customSystemPromptId: agent.customSystemPrompt,
|
|
433546
|
-
customHeaders: agent.customHeaders
|
|
433603
|
+
configProfile: agent.configProfile
|
|
433547
433604
|
}, abortSignal) : createStreamingChatCompletion({
|
|
433548
433605
|
model,
|
|
433549
433606
|
messages,
|
|
433550
433607
|
temperature: 0,
|
|
433551
433608
|
tools: allowedTools,
|
|
433552
|
-
configProfile: agent.configProfile
|
|
433553
|
-
customSystemPromptId: agent.customSystemPrompt,
|
|
433554
|
-
customHeaders: agent.customHeaders
|
|
433609
|
+
configProfile: agent.configProfile
|
|
433555
433610
|
}, abortSignal);
|
|
433556
433611
|
let currentContent = "";
|
|
433557
433612
|
let toolCalls = [];
|
|
@@ -438287,14 +438342,14 @@ var require_linkedMap = __commonJS({
|
|
|
438287
438342
|
return;
|
|
438288
438343
|
}
|
|
438289
438344
|
let current = this._head;
|
|
438290
|
-
let
|
|
438291
|
-
while (current &&
|
|
438345
|
+
let currentSize2 = this.size;
|
|
438346
|
+
while (current && currentSize2 > newSize) {
|
|
438292
438347
|
this._map.delete(current.key);
|
|
438293
438348
|
current = current.next;
|
|
438294
|
-
|
|
438349
|
+
currentSize2--;
|
|
438295
438350
|
}
|
|
438296
438351
|
this._head = current;
|
|
438297
|
-
this._size =
|
|
438352
|
+
this._size = currentSize2;
|
|
438298
438353
|
if (current) {
|
|
438299
438354
|
current.previous = void 0;
|
|
438300
438355
|
}
|
|
@@ -439590,7 +439645,7 @@ var require_connection2 = __commonJS({
|
|
|
439590
439645
|
function cancelUndispatched(_message) {
|
|
439591
439646
|
return void 0;
|
|
439592
439647
|
}
|
|
439593
|
-
function
|
|
439648
|
+
function isListening2() {
|
|
439594
439649
|
return state === ConnectionState.Listening;
|
|
439595
439650
|
}
|
|
439596
439651
|
function isClosed() {
|
|
@@ -440079,12 +440134,12 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
440079
440134
|
}
|
|
440080
440135
|
}
|
|
440081
440136
|
function throwIfListening() {
|
|
440082
|
-
if (
|
|
440137
|
+
if (isListening2()) {
|
|
440083
440138
|
throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening");
|
|
440084
440139
|
}
|
|
440085
440140
|
}
|
|
440086
440141
|
function throwIfNotListening() {
|
|
440087
|
-
if (!
|
|
440142
|
+
if (!isListening2()) {
|
|
440088
440143
|
throw new Error("Call listen() first.");
|
|
440089
440144
|
}
|
|
440090
440145
|
}
|
|
@@ -443300,12 +443355,8 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443300
443355
|
const [loadError, setLoadError] = (0, import_react66.useState)(null);
|
|
443301
443356
|
const isEditMode = !!agentId;
|
|
443302
443357
|
const [isBuiltinAgent, setIsBuiltinAgent] = (0, import_react66.useState)(false);
|
|
443303
|
-
const [selectedSystemPromptIndex, setSelectedSystemPromptIndex] = (0, import_react66.useState)(0);
|
|
443304
443358
|
const [selectedConfigProfileIndex, setSelectedConfigProfileIndex] = (0, import_react66.useState)(0);
|
|
443305
|
-
const [selectedCustomHeadersIndex, setSelectedCustomHeadersIndex] = (0, import_react66.useState)(0);
|
|
443306
|
-
const [confirmedSystemPromptIndex, setConfirmedSystemPromptIndex] = (0, import_react66.useState)(-1);
|
|
443307
443359
|
const [confirmedConfigProfileIndex, setConfirmedConfigProfileIndex] = (0, import_react66.useState)(-1);
|
|
443308
|
-
const [confirmedCustomHeadersIndex, setConfirmedCustomHeadersIndex] = (0, import_react66.useState)(-1);
|
|
443309
443360
|
const toolCategories = [
|
|
443310
443361
|
{
|
|
443311
443362
|
name: t.subAgentConfig.filesystemTools,
|
|
@@ -443355,27 +443406,13 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443355
443406
|
tools: ["skill-execute"]
|
|
443356
443407
|
}
|
|
443357
443408
|
];
|
|
443358
|
-
const availableSystemPrompts = (0, import_react66.useMemo)(() => {
|
|
443359
|
-
const config3 = getSystemPromptConfig();
|
|
443360
|
-
if (!config3 || !config3.prompts)
|
|
443361
|
-
return [];
|
|
443362
|
-
return config3.prompts.map((p) => ({ name: p.name, id: p.id }));
|
|
443363
|
-
}, []);
|
|
443364
443409
|
const availableProfiles = (0, import_react66.useMemo)(() => {
|
|
443365
443410
|
const profiles = getAllProfiles();
|
|
443366
443411
|
return profiles.map((p) => p.name);
|
|
443367
443412
|
}, []);
|
|
443368
|
-
const availableCustomHeaders = (0, import_react66.useMemo)(() => {
|
|
443369
|
-
const config3 = getCustomHeadersConfig();
|
|
443370
|
-
if (!config3 || !config3.schemes)
|
|
443371
|
-
return [];
|
|
443372
|
-
return config3.schemes.map((s) => s.name);
|
|
443373
|
-
}, []);
|
|
443374
443413
|
(0, import_react66.useEffect)(() => {
|
|
443375
443414
|
if (!agentId) {
|
|
443376
443415
|
const activeProfile = getActiveProfileName();
|
|
443377
|
-
const systemPromptConfig = getSystemPromptConfig();
|
|
443378
|
-
const customHeadersConfig = getCustomHeadersConfig();
|
|
443379
443416
|
if (activeProfile && availableProfiles.length > 0) {
|
|
443380
443417
|
const profileIndex = availableProfiles.findIndex((p) => p === activeProfile);
|
|
443381
443418
|
if (profileIndex >= 0) {
|
|
@@ -443383,103 +443420,39 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443383
443420
|
setConfirmedConfigProfileIndex(profileIndex);
|
|
443384
443421
|
}
|
|
443385
443422
|
}
|
|
443386
|
-
if ((systemPromptConfig == null ? void 0 : systemPromptConfig.active) && availableSystemPrompts.length > 0) {
|
|
443387
|
-
const promptIndex = availableSystemPrompts.findIndex((p) => p.id === systemPromptConfig.active);
|
|
443388
|
-
if (promptIndex >= 0) {
|
|
443389
|
-
setSelectedSystemPromptIndex(promptIndex);
|
|
443390
|
-
setConfirmedSystemPromptIndex(promptIndex);
|
|
443391
|
-
}
|
|
443392
|
-
}
|
|
443393
|
-
if ((customHeadersConfig == null ? void 0 : customHeadersConfig.active) && availableCustomHeaders.length > 0) {
|
|
443394
|
-
const activeScheme = customHeadersConfig.schemes.find((s) => s.id === customHeadersConfig.active);
|
|
443395
|
-
if (activeScheme) {
|
|
443396
|
-
const headerIndex = availableCustomHeaders.findIndex((h) => h === activeScheme.name);
|
|
443397
|
-
if (headerIndex >= 0) {
|
|
443398
|
-
setSelectedCustomHeadersIndex(headerIndex);
|
|
443399
|
-
setConfirmedCustomHeadersIndex(headerIndex);
|
|
443400
|
-
}
|
|
443401
|
-
}
|
|
443402
|
-
}
|
|
443403
443423
|
}
|
|
443404
|
-
}, [
|
|
443405
|
-
availableSystemPrompts,
|
|
443406
|
-
availableProfiles,
|
|
443407
|
-
availableCustomHeaders,
|
|
443408
|
-
agentId
|
|
443409
|
-
]);
|
|
443424
|
+
}, [availableProfiles, agentId]);
|
|
443410
443425
|
(0, import_react66.useEffect)(() => {
|
|
443411
|
-
|
|
443412
|
-
|
|
443413
|
-
|
|
443414
|
-
|
|
443415
|
-
|
|
443416
|
-
|
|
443417
|
-
|
|
443418
|
-
|
|
443419
|
-
|
|
443420
|
-
|
|
443421
|
-
|
|
443422
|
-
|
|
443423
|
-
|
|
443424
|
-
|
|
443425
|
-
|
|
443426
|
-
|
|
443427
|
-
|
|
443428
|
-
|
|
443429
|
-
|
|
443430
|
-
|
|
443431
|
-
|
|
443432
|
-
|
|
443433
|
-
|
|
443434
|
-
|
|
443435
|
-
|
|
443436
|
-
|
|
443437
|
-
setConfirmedConfigProfileIndex(profileIndex);
|
|
443438
|
-
}
|
|
443439
|
-
}
|
|
443440
|
-
}
|
|
443441
|
-
if (agent.customSystemPrompt) {
|
|
443442
|
-
const promptIndex = availableSystemPrompts.findIndex((p) => p.id === agent.customSystemPrompt);
|
|
443443
|
-
if (promptIndex >= 0) {
|
|
443444
|
-
setSelectedSystemPromptIndex(promptIndex);
|
|
443445
|
-
setConfirmedSystemPromptIndex(promptIndex);
|
|
443446
|
-
}
|
|
443447
|
-
} else if (agent.builtin) {
|
|
443448
|
-
const systemPromptConfig = getSystemPromptConfig();
|
|
443449
|
-
if ((systemPromptConfig == null ? void 0 : systemPromptConfig.active) && availableSystemPrompts.length > 0) {
|
|
443450
|
-
const promptIndex = availableSystemPrompts.findIndex((p) => p.id === systemPromptConfig.active);
|
|
443451
|
-
if (promptIndex >= 0) {
|
|
443452
|
-
setSelectedSystemPromptIndex(promptIndex);
|
|
443453
|
-
setConfirmedSystemPromptIndex(promptIndex);
|
|
443454
|
-
}
|
|
443455
|
-
}
|
|
443456
|
-
}
|
|
443457
|
-
if (agent.customHeaders) {
|
|
443458
|
-
const headersConfig = getCustomHeadersConfig();
|
|
443459
|
-
const headerName = (_a21 = headersConfig == null ? void 0 : headersConfig.schemes.find((s) => JSON.stringify(s.headers) === JSON.stringify(agent.customHeaders))) == null ? void 0 : _a21.name;
|
|
443460
|
-
if (headerName) {
|
|
443461
|
-
const headerIndex = availableCustomHeaders.findIndex((h) => h === headerName);
|
|
443462
|
-
if (headerIndex >= 0) {
|
|
443463
|
-
setSelectedCustomHeadersIndex(headerIndex);
|
|
443464
|
-
setConfirmedCustomHeadersIndex(headerIndex);
|
|
443465
|
-
}
|
|
443466
|
-
}
|
|
443467
|
-
} else if (agent.builtin) {
|
|
443468
|
-
const customHeadersConfig = getCustomHeadersConfig();
|
|
443469
|
-
if ((customHeadersConfig == null ? void 0 : customHeadersConfig.active) && availableCustomHeaders.length > 0) {
|
|
443470
|
-
const activeScheme = customHeadersConfig.schemes.find((s) => s.id === customHeadersConfig.active);
|
|
443471
|
-
if (activeScheme) {
|
|
443472
|
-
const headerIndex = availableCustomHeaders.findIndex((h) => h === activeScheme.name);
|
|
443473
|
-
if (headerIndex >= 0) {
|
|
443474
|
-
setSelectedCustomHeadersIndex(headerIndex);
|
|
443475
|
-
setConfirmedCustomHeadersIndex(headerIndex);
|
|
443476
|
-
}
|
|
443477
|
-
}
|
|
443478
|
-
}
|
|
443426
|
+
if (!agentId) {
|
|
443427
|
+
return;
|
|
443428
|
+
}
|
|
443429
|
+
const agent = getSubAgent(agentId);
|
|
443430
|
+
if (!agent) {
|
|
443431
|
+
return;
|
|
443432
|
+
}
|
|
443433
|
+
const isBuiltin = ["agent_explore", "agent_plan", "agent_general"].includes(agentId);
|
|
443434
|
+
setIsBuiltinAgent(isBuiltin);
|
|
443435
|
+
setAgentName(agent.name);
|
|
443436
|
+
setDescription(agent.description);
|
|
443437
|
+
setRole(agent.role || "");
|
|
443438
|
+
setSelectedTools(new Set(agent.tools || []));
|
|
443439
|
+
if (agent.configProfile) {
|
|
443440
|
+
const profileIndex = availableProfiles.findIndex((p) => p === agent.configProfile);
|
|
443441
|
+
if (profileIndex >= 0) {
|
|
443442
|
+
setSelectedConfigProfileIndex(profileIndex);
|
|
443443
|
+
setConfirmedConfigProfileIndex(profileIndex);
|
|
443444
|
+
}
|
|
443445
|
+
} else if (agent.builtin) {
|
|
443446
|
+
const activeProfile = getActiveProfileName();
|
|
443447
|
+
if (activeProfile && availableProfiles.length > 0) {
|
|
443448
|
+
const profileIndex = availableProfiles.findIndex((p) => p === activeProfile);
|
|
443449
|
+
if (profileIndex >= 0) {
|
|
443450
|
+
setSelectedConfigProfileIndex(profileIndex);
|
|
443451
|
+
setConfirmedConfigProfileIndex(profileIndex);
|
|
443479
443452
|
}
|
|
443480
443453
|
}
|
|
443481
443454
|
}
|
|
443482
|
-
}, [agentId]);
|
|
443455
|
+
}, [agentId, availableProfiles]);
|
|
443483
443456
|
(0, import_react66.useEffect)(() => {
|
|
443484
443457
|
const loadMCPServices = async () => {
|
|
443485
443458
|
try {
|
|
@@ -443549,7 +443522,6 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443549
443522
|
allToolCategories
|
|
443550
443523
|
]);
|
|
443551
443524
|
const handleSave = (0, import_react66.useCallback)(() => {
|
|
443552
|
-
var _a21;
|
|
443553
443525
|
setSaveError(null);
|
|
443554
443526
|
const errors = validateSubAgent({
|
|
443555
443527
|
name: agentName,
|
|
@@ -443562,28 +443534,16 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443562
443534
|
}
|
|
443563
443535
|
try {
|
|
443564
443536
|
const selectedProfile = confirmedConfigProfileIndex >= 0 ? availableProfiles[confirmedConfigProfileIndex] : void 0;
|
|
443565
|
-
let customHeadersObj;
|
|
443566
|
-
if (confirmedCustomHeadersIndex >= 0) {
|
|
443567
|
-
const selectedHeader = availableCustomHeaders[confirmedCustomHeadersIndex];
|
|
443568
|
-
if (selectedHeader) {
|
|
443569
|
-
const headersConfig = getCustomHeadersConfig();
|
|
443570
|
-
const scheme = headersConfig == null ? void 0 : headersConfig.schemes.find((s) => s.name === selectedHeader);
|
|
443571
|
-
customHeadersObj = scheme == null ? void 0 : scheme.headers;
|
|
443572
|
-
}
|
|
443573
|
-
}
|
|
443574
|
-
const systemPromptId = confirmedSystemPromptIndex >= 0 ? (_a21 = availableSystemPrompts[confirmedSystemPromptIndex]) == null ? void 0 : _a21.id : void 0;
|
|
443575
443537
|
if (isEditMode && agentId) {
|
|
443576
443538
|
updateSubAgent(agentId, {
|
|
443577
443539
|
name: agentName,
|
|
443578
443540
|
description,
|
|
443579
443541
|
role: role || void 0,
|
|
443580
443542
|
tools: Array.from(selectedTools),
|
|
443581
|
-
configProfile: selectedProfile || void 0
|
|
443582
|
-
customSystemPrompt: systemPromptId,
|
|
443583
|
-
customHeaders: customHeadersObj
|
|
443543
|
+
configProfile: selectedProfile || void 0
|
|
443584
443544
|
});
|
|
443585
443545
|
} else {
|
|
443586
|
-
createSubAgent(agentName, description, Array.from(selectedTools), role || void 0, selectedProfile || void 0
|
|
443546
|
+
createSubAgent(agentName, description, Array.from(selectedTools), role || void 0, selectedProfile || void 0);
|
|
443587
443547
|
}
|
|
443588
443548
|
setShowSuccess(true);
|
|
443589
443549
|
setTimeout(() => {
|
|
@@ -443598,13 +443558,8 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443598
443558
|
description,
|
|
443599
443559
|
role,
|
|
443600
443560
|
selectedTools,
|
|
443601
|
-
confirmedSystemPromptIndex,
|
|
443602
443561
|
confirmedConfigProfileIndex,
|
|
443603
|
-
confirmedCustomHeadersIndex,
|
|
443604
|
-
availableSystemPrompts,
|
|
443605
443562
|
availableProfiles,
|
|
443606
|
-
availableCustomHeaders,
|
|
443607
|
-
onSave,
|
|
443608
443563
|
isEditMode,
|
|
443609
443564
|
agentId,
|
|
443610
443565
|
t
|
|
@@ -443626,8 +443581,6 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443626
443581
|
"description",
|
|
443627
443582
|
"role",
|
|
443628
443583
|
"configProfile",
|
|
443629
|
-
"customSystemPrompt",
|
|
443630
|
-
"customHeaders",
|
|
443631
443584
|
"tools"
|
|
443632
443585
|
];
|
|
443633
443586
|
const currentFieldIndex = mainFields.indexOf(currentField);
|
|
@@ -443639,20 +443592,6 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443639
443592
|
setSelectedConfigProfileIndex((prev) => prev - 1);
|
|
443640
443593
|
}
|
|
443641
443594
|
return;
|
|
443642
|
-
} else if (currentField === "customSystemPrompt") {
|
|
443643
|
-
if (availableSystemPrompts.length === 0 || selectedSystemPromptIndex === 0) {
|
|
443644
|
-
setCurrentField("configProfile");
|
|
443645
|
-
} else {
|
|
443646
|
-
setSelectedSystemPromptIndex((prev) => prev - 1);
|
|
443647
|
-
}
|
|
443648
|
-
return;
|
|
443649
|
-
} else if (currentField === "customHeaders") {
|
|
443650
|
-
if (availableCustomHeaders.length === 0 || selectedCustomHeadersIndex === 0) {
|
|
443651
|
-
setCurrentField("customSystemPrompt");
|
|
443652
|
-
} else {
|
|
443653
|
-
setSelectedCustomHeadersIndex((prev) => prev - 1);
|
|
443654
|
-
}
|
|
443655
|
-
return;
|
|
443656
443595
|
} else if (currentField === "tools") {
|
|
443657
443596
|
if (selectedToolIndex > 0) {
|
|
443658
443597
|
setSelectedToolIndex((prev) => prev - 1);
|
|
@@ -443661,7 +443600,7 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443661
443600
|
setSelectedCategoryIndex((prev) => prev - 1);
|
|
443662
443601
|
setSelectedToolIndex(prevCategory ? prevCategory.tools.length - 1 : 0);
|
|
443663
443602
|
} else {
|
|
443664
|
-
setCurrentField("
|
|
443603
|
+
setCurrentField("configProfile");
|
|
443665
443604
|
}
|
|
443666
443605
|
return;
|
|
443667
443606
|
} else {
|
|
@@ -443673,28 +443612,15 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443673
443612
|
if (key.downArrow) {
|
|
443674
443613
|
if (currentField === "configProfile") {
|
|
443675
443614
|
if (availableProfiles.length === 0 || selectedConfigProfileIndex >= availableProfiles.length - 1) {
|
|
443676
|
-
setCurrentField("customSystemPrompt");
|
|
443677
|
-
} else {
|
|
443678
|
-
setSelectedConfigProfileIndex((prev) => prev + 1);
|
|
443679
|
-
}
|
|
443680
|
-
return;
|
|
443681
|
-
} else if (currentField === "customSystemPrompt") {
|
|
443682
|
-
if (availableSystemPrompts.length === 0 || selectedSystemPromptIndex >= availableSystemPrompts.length - 1) {
|
|
443683
|
-
setCurrentField("customHeaders");
|
|
443684
|
-
} else {
|
|
443685
|
-
setSelectedSystemPromptIndex((prev) => prev + 1);
|
|
443686
|
-
}
|
|
443687
|
-
return;
|
|
443688
|
-
} else if (currentField === "customHeaders") {
|
|
443689
|
-
if (availableCustomHeaders.length === 0 || selectedCustomHeadersIndex >= availableCustomHeaders.length - 1) {
|
|
443690
443615
|
setCurrentField("tools");
|
|
443691
443616
|
setSelectedCategoryIndex(0);
|
|
443692
443617
|
setSelectedToolIndex(0);
|
|
443693
443618
|
} else {
|
|
443694
|
-
|
|
443619
|
+
setSelectedConfigProfileIndex((prev) => prev + 1);
|
|
443695
443620
|
}
|
|
443696
443621
|
return;
|
|
443697
|
-
}
|
|
443622
|
+
}
|
|
443623
|
+
if (currentField === "tools") {
|
|
443698
443624
|
const currentCategory = allToolCategories[selectedCategoryIndex];
|
|
443699
443625
|
if (!currentCategory)
|
|
443700
443626
|
return;
|
|
@@ -443707,25 +443633,18 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
443707
443633
|
setCurrentField("name");
|
|
443708
443634
|
}
|
|
443709
443635
|
return;
|
|
443710
|
-
} else {
|
|
443711
|
-
const nextIndex = currentFieldIndex < mainFields.length - 1 ? currentFieldIndex + 1 : 0;
|
|
443712
|
-
setCurrentField(mainFields[nextIndex]);
|
|
443713
|
-
return;
|
|
443714
443636
|
}
|
|
443637
|
+
const nextIndex = currentFieldIndex < mainFields.length - 1 ? currentFieldIndex + 1 : 0;
|
|
443638
|
+
setCurrentField(mainFields[nextIndex]);
|
|
443639
|
+
return;
|
|
443715
443640
|
}
|
|
443716
443641
|
if (currentField === "role" && input2 === " ") {
|
|
443717
443642
|
setRoleExpanded((prev) => !prev);
|
|
443718
443643
|
return;
|
|
443719
443644
|
}
|
|
443720
|
-
if (currentField === "configProfile"
|
|
443645
|
+
if (currentField === "configProfile") {
|
|
443721
443646
|
if (input2 === " ") {
|
|
443722
|
-
|
|
443723
|
-
setConfirmedConfigProfileIndex((prev) => prev === selectedConfigProfileIndex ? -1 : selectedConfigProfileIndex);
|
|
443724
|
-
} else if (currentField === "customSystemPrompt") {
|
|
443725
|
-
setConfirmedSystemPromptIndex((prev) => prev === selectedSystemPromptIndex ? -1 : selectedSystemPromptIndex);
|
|
443726
|
-
} else if (currentField === "customHeaders") {
|
|
443727
|
-
setConfirmedCustomHeadersIndex((prev) => prev === selectedCustomHeadersIndex ? -1 : selectedCustomHeadersIndex);
|
|
443728
|
-
}
|
|
443647
|
+
setConfirmedConfigProfileIndex((prev) => prev === selectedConfigProfileIndex ? -1 : selectedConfigProfileIndex);
|
|
443729
443648
|
return;
|
|
443730
443649
|
}
|
|
443731
443650
|
}
|
|
@@ -444042,34 +443961,6 @@ function SubAgentConfigScreen({ onBack, onSave, inlineMode = false, agentId }) {
|
|
|
444042
443961
|
"profile"
|
|
444043
443962
|
))
|
|
444044
443963
|
),
|
|
444045
|
-
import_react66.default.createElement(
|
|
444046
|
-
Box_default,
|
|
444047
|
-
{ flexDirection: "column" },
|
|
444048
|
-
import_react66.default.createElement(Text, { bold: true, color: theme14.colors.menuInfo }, t.subAgentConfig.customSystemPrompt),
|
|
444049
|
-
import_react66.default.createElement(Box_default, { marginLeft: 2 }, renderScrollableList(
|
|
444050
|
-
availableSystemPrompts,
|
|
444051
|
-
selectedSystemPromptIndex,
|
|
444052
|
-
confirmedSystemPromptIndex,
|
|
444053
|
-
// 确认选中的项
|
|
444054
|
-
currentField === "customSystemPrompt",
|
|
444055
|
-
5,
|
|
444056
|
-
"prompt"
|
|
444057
|
-
))
|
|
444058
|
-
),
|
|
444059
|
-
import_react66.default.createElement(
|
|
444060
|
-
Box_default,
|
|
444061
|
-
{ flexDirection: "column" },
|
|
444062
|
-
import_react66.default.createElement(Text, { bold: true, color: theme14.colors.menuInfo }, t.subAgentConfig.customHeaders),
|
|
444063
|
-
import_react66.default.createElement(Box_default, { marginLeft: 2 }, renderScrollableList(
|
|
444064
|
-
availableCustomHeaders,
|
|
444065
|
-
selectedCustomHeadersIndex,
|
|
444066
|
-
confirmedCustomHeadersIndex,
|
|
444067
|
-
// 确认选中的项
|
|
444068
|
-
currentField === "customHeaders",
|
|
444069
|
-
5,
|
|
444070
|
-
"header"
|
|
444071
|
-
))
|
|
444072
|
-
),
|
|
444073
443964
|
renderToolSelection(),
|
|
444074
443965
|
import_react66.default.createElement(
|
|
444075
443966
|
Box_default,
|
|
@@ -444090,7 +443981,6 @@ var init_SubAgentConfigScreen = __esm({
|
|
|
444090
443981
|
init_mcpToolsManager();
|
|
444091
443982
|
init_subAgentConfig();
|
|
444092
443983
|
init_configManager();
|
|
444093
|
-
init_apiConfig();
|
|
444094
443984
|
init_i18n();
|
|
444095
443985
|
init_ThemeContext();
|
|
444096
443986
|
focusEventTokenRegex2 = /(?:\x1b)?\[[0-9;]*[IO]/g;
|
|
@@ -446774,17 +446664,12 @@ function DiffViewer({ oldContent = "", newContent, filename, completeOldContent,
|
|
|
446774
446664
|
return import_react73.default.createElement(
|
|
446775
446665
|
Box_default,
|
|
446776
446666
|
{ flexDirection: "column" },
|
|
446777
|
-
import_react73.default.createElement(
|
|
446778
|
-
|
|
446779
|
-
|
|
446780
|
-
import_react73.default.createElement(Text, { bold: true, color: "
|
|
446781
|
-
|
|
446782
|
-
|
|
446783
|
-
{ color: "cyan" },
|
|
446784
|
-
" ",
|
|
446785
|
-
filename
|
|
446786
|
-
)
|
|
446787
|
-
),
|
|
446667
|
+
import_react73.default.createElement(Box_default, { marginBottom: 1 }, filename ? import_react73.default.createElement(
|
|
446668
|
+
import_react73.default.Fragment,
|
|
446669
|
+
null,
|
|
446670
|
+
import_react73.default.createElement(Text, { bold: true, color: "cyan" }, filename),
|
|
446671
|
+
import_react73.default.createElement(Text, { color: "green" }, " (new)")
|
|
446672
|
+
) : import_react73.default.createElement(Text, { bold: true, color: "green" }, "New File")),
|
|
446788
446673
|
import_react73.default.createElement(Box_default, { flexDirection: "column" }, allLines.map((line, index) => import_react73.default.createElement(
|
|
446789
446674
|
Text,
|
|
446790
446675
|
{ key: index, color: "white", backgroundColor: theme14.colors.diffAdded },
|
|
@@ -446881,20 +446766,13 @@ function DiffViewer({ oldContent = "", newContent, filename, completeOldContent,
|
|
|
446881
446766
|
}
|
|
446882
446767
|
return computedHunks;
|
|
446883
446768
|
}, [diffOldContent, diffNewContent, startLineNumber]);
|
|
446884
|
-
const
|
|
446885
|
-
|
|
446886
|
-
if (cleanContent.length <= maxWidth) {
|
|
446887
|
-
return cleanContent.padEnd(maxWidth, " ");
|
|
446888
|
-
}
|
|
446889
|
-
return cleanContent.slice(0, maxWidth - 1) + "~";
|
|
446769
|
+
const cleanContent = (content) => {
|
|
446770
|
+
return content.replace(/[\r\n]/g, "");
|
|
446890
446771
|
};
|
|
446891
446772
|
const renderSideBySide = (hunk, hunkIndex) => {
|
|
446892
446773
|
const separatorWidth = 3;
|
|
446893
446774
|
const lineNumWidth = 4;
|
|
446894
|
-
const signWidth = 1;
|
|
446895
|
-
const paddingWidth = 2;
|
|
446896
446775
|
const panelWidth = Math.floor((columns - separatorWidth) / 2);
|
|
446897
|
-
const contentWidth = panelWidth - lineNumWidth - signWidth - paddingWidth;
|
|
446898
446776
|
const pairedLines = [];
|
|
446899
446777
|
let leftIdx = 0;
|
|
446900
446778
|
let rightIdx = 0;
|
|
@@ -446965,8 +446843,8 @@ function DiffViewer({ oldContent = "", newContent, filename, completeOldContent,
|
|
|
446965
446843
|
const rightLineNum = pair.right.lineNum ? String(pair.right.lineNum).padStart(lineNumWidth, " ") : "".padStart(lineNumWidth, " ");
|
|
446966
446844
|
const leftSign = pair.left.type === "removed" ? "-" : pair.left.type === "unchanged" ? " " : " ";
|
|
446967
446845
|
const rightSign = pair.right.type === "added" ? "+" : pair.right.type === "unchanged" ? " " : " ";
|
|
446968
|
-
const leftContent =
|
|
446969
|
-
const rightContent =
|
|
446846
|
+
const leftContent = cleanContent(pair.left.content);
|
|
446847
|
+
const rightContent = cleanContent(pair.right.content);
|
|
446970
446848
|
return {
|
|
446971
446849
|
idx: idx2,
|
|
446972
446850
|
leftLineNum,
|
|
@@ -447110,13 +446988,12 @@ function DiffViewer({ oldContent = "", newContent, filename, completeOldContent,
|
|
|
447110
446988
|
import_react73.default.createElement(
|
|
447111
446989
|
Box_default,
|
|
447112
446990
|
{ marginBottom: 1 },
|
|
447113
|
-
import_react73.default.createElement(
|
|
447114
|
-
|
|
447115
|
-
|
|
447116
|
-
{ color: "cyan" },
|
|
447117
|
-
" "
|
|
447118
|
-
|
|
447119
|
-
),
|
|
446991
|
+
filename ? import_react73.default.createElement(
|
|
446992
|
+
import_react73.default.Fragment,
|
|
446993
|
+
null,
|
|
446994
|
+
import_react73.default.createElement(Text, { bold: true, color: "cyan" }, filename),
|
|
446995
|
+
import_react73.default.createElement(Text, { color: "yellow" }, " (modified)")
|
|
446996
|
+
) : import_react73.default.createElement(Text, { bold: true, color: "yellow" }, "File Modified"),
|
|
447120
446997
|
useSideBySide && import_react73.default.createElement(Text, { dimColor: true }, " (side-by-side)")
|
|
447121
446998
|
),
|
|
447122
446999
|
import_react73.default.createElement(
|
|
@@ -542301,7 +542178,12 @@ var init_FileList = __esm({
|
|
|
542301
542178
|
filteredFiles.map((file, index) => import_react94.default.createElement(
|
|
542302
542179
|
Box_default,
|
|
542303
542180
|
{ key: `${file.path}-${file.lineNumber || 0}`, flexDirection: "column" },
|
|
542304
|
-
import_react94.default.createElement(
|
|
542181
|
+
import_react94.default.createElement(
|
|
542182
|
+
Text,
|
|
542183
|
+
{ backgroundColor: index === displaySelectedIndex ? theme14.colors.menuSelected : void 0, color: index === displaySelectedIndex ? theme14.colors.menuNormal : file.isDirectory ? theme14.colors.warning : "white" },
|
|
542184
|
+
index === displaySelectedIndex ? "\u276F " : " ",
|
|
542185
|
+
searchMode === "content" && file.lineNumber !== void 0 ? `${file.path}:${file.lineNumber}` : file.isDirectory ? "\u25C7 " + file.path : "\u25C6 " + file.path
|
|
542186
|
+
),
|
|
542305
542187
|
searchMode === "content" && file.lineContent && import_react94.default.createElement(
|
|
542306
542188
|
Text,
|
|
542307
542189
|
{ backgroundColor: index === displaySelectedIndex ? theme14.colors.menuSelected : void 0, color: index === displaySelectedIndex ? theme14.colors.menuSecondary : theme14.colors.menuSecondary, dimColor: true },
|
|
@@ -545548,9 +545430,9 @@ function ShimmerText({ text: text3 }) {
|
|
|
545548
545430
|
const char = text3[i];
|
|
545549
545431
|
const distance = Math.abs(i - frame);
|
|
545550
545432
|
if (distance <= 1) {
|
|
545551
|
-
output2 += source_default.hex("#00FFFF")(char);
|
|
545433
|
+
output2 += source_default.bold.hex("#00FFFF")(char);
|
|
545552
545434
|
} else {
|
|
545553
|
-
output2 += source_default.hex("#1ACEB0")(char);
|
|
545435
|
+
output2 += source_default.bold.hex("#1ACEB0")(char);
|
|
545554
545436
|
}
|
|
545555
545437
|
}
|
|
545556
545438
|
return import_react113.default.createElement(Text, null, output2);
|
|
@@ -545678,13 +545560,7 @@ function LoadingIndicator({ isStreaming, isStopping, isSaving, hasPendingToolCon
|
|
|
545678
545560
|
return import_react115.default.createElement(
|
|
545679
545561
|
Box_default,
|
|
545680
545562
|
{ marginBottom: 1, paddingX: 1, width: terminalWidth },
|
|
545681
|
-
import_react115.default.createElement(Text, { color: [
|
|
545682
|
-
theme14.colors.menuInfo,
|
|
545683
|
-
theme14.colors.success,
|
|
545684
|
-
theme14.colors.menuSelected,
|
|
545685
|
-
theme14.colors.menuInfo,
|
|
545686
|
-
theme14.colors.menuSecondary
|
|
545687
|
-
][animationFrame], bold: true }, "\u2746"),
|
|
545563
|
+
import_react115.default.createElement(Text, { color: ["#00FFFF", "#1ACEB0"][animationFrame % 2], bold: true }, "\u2746"),
|
|
545688
545564
|
import_react115.default.createElement(Box_default, { marginLeft: 1, marginBottom: 1, flexDirection: "column" }, isStopping ? import_react115.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true }, t.chatScreen.statusStopping) : isStreaming ? import_react115.default.createElement(import_react115.default.Fragment, null, retryStatus && retryStatus.isRetrying ? import_react115.default.createElement(
|
|
545689
545565
|
Box_default,
|
|
545690
545566
|
{ flexDirection: "column" },
|
|
@@ -545698,9 +545574,8 @@ function LoadingIndicator({ isStreaming, isStopping, isSaving, hasPendingToolCon
|
|
|
545698
545574
|
) : import_react115.default.createElement(Text, { color: "yellow", dimColor: true }, t.chatScreen.retryResending.replace("{current}", String(retryStatus.attempt)).replace("{max}", "5"))
|
|
545699
545575
|
) : (codebaseSearchStatus == null ? void 0 : codebaseSearchStatus.isSearching) ? import_react115.default.createElement(CodebaseSearchStatus, { status: codebaseSearchStatus }) : codebaseSearchStatus && !codebaseSearchStatus.isSearching ? import_react115.default.createElement(CodebaseSearchStatus, { status: codebaseSearchStatus }) : import_react115.default.createElement(
|
|
545700
545576
|
Text,
|
|
545701
|
-
{ color: theme14.colors.menuSecondary, dimColor: true },
|
|
545577
|
+
{ color: theme14.colors.menuSecondary, dimColor: true, bold: true },
|
|
545702
545578
|
import_react115.default.createElement(ShimmerText, { text: isReasoning ? t.chatScreen.statusDeepThinking : streamTokenCount > 0 ? t.chatScreen.statusWriting : t.chatScreen.statusThinking }),
|
|
545703
|
-
" ",
|
|
545704
545579
|
"(",
|
|
545705
545580
|
currentModel && import_react115.default.createElement(
|
|
545706
545581
|
import_react115.default.Fragment,
|
|
@@ -551370,7 +551245,7 @@ async function handleConversationWithTools(options3) {
|
|
|
551370
551245
|
arguments: {
|
|
551371
551246
|
oldContent: resultData.oldContent,
|
|
551372
551247
|
newContent: resultData.newContent,
|
|
551373
|
-
filename: resultData.path || resultData.filename,
|
|
551248
|
+
filename: resultData.filePath || resultData.path || resultData.filename,
|
|
551374
551249
|
completeOldContent: resultData.completeOldContent,
|
|
551375
551250
|
completeNewContent: resultData.completeNewContent,
|
|
551376
551251
|
contextStartLine: resultData.contextStartLine
|
|
@@ -552057,7 +551932,7 @@ function convertSessionMessagesToUI(sessionMessages) {
|
|
|
552057
551932
|
arguments: {
|
|
552058
551933
|
oldContent: resultData.oldContent,
|
|
552059
551934
|
newContent: resultData.newContent,
|
|
552060
|
-
filename: resultData.path || resultData.filename,
|
|
551935
|
+
filename: resultData.filePath || resultData.path || resultData.filename,
|
|
552061
551936
|
completeOldContent: resultData.completeOldContent,
|
|
552062
551937
|
completeNewContent: resultData.completeNewContent,
|
|
552063
551938
|
contextStartLine: resultData.contextStartLine
|
|
@@ -552187,13 +552062,14 @@ function convertSessionMessagesToUI(sessionMessages) {
|
|
|
552187
552062
|
editDiffData = {
|
|
552188
552063
|
oldContent: resultData.oldContent,
|
|
552189
552064
|
newContent: resultData.newContent,
|
|
552190
|
-
filename: toolArgs.filePath,
|
|
552065
|
+
filename: resultData.filePath || toolArgs.filePath,
|
|
552191
552066
|
completeOldContent: resultData.completeOldContent,
|
|
552192
552067
|
completeNewContent: resultData.completeNewContent,
|
|
552193
552068
|
contextStartLine: resultData.contextStartLine
|
|
552194
552069
|
};
|
|
552195
552070
|
toolArgs.oldContent = resultData.oldContent;
|
|
552196
552071
|
toolArgs.newContent = resultData.newContent;
|
|
552072
|
+
toolArgs.filename = resultData.filePath || toolArgs.filePath;
|
|
552197
552073
|
toolArgs.completeOldContent = resultData.completeOldContent;
|
|
552198
552074
|
toolArgs.completeNewContent = resultData.completeNewContent;
|
|
552199
552075
|
toolArgs.contextStartLine = resultData.contextStartLine;
|
|
@@ -555691,18 +555567,18 @@ ${errorMsg}`,
|
|
|
555691
555567
|
if (!currentSession)
|
|
555692
555568
|
return;
|
|
555693
555569
|
if (selectedIndex === 0 && currentSession.compressedFrom !== void 0 && currentSession.compressedFrom !== null) {
|
|
555694
|
-
let
|
|
555570
|
+
let totalFileCount = 0;
|
|
555695
555571
|
for (const [index, count] of snapshotState.snapshotFileCount.entries()) {
|
|
555696
555572
|
if (index >= selectedIndex) {
|
|
555697
|
-
|
|
555573
|
+
totalFileCount += count;
|
|
555698
555574
|
}
|
|
555699
555575
|
}
|
|
555700
|
-
if (
|
|
555701
|
-
const
|
|
555576
|
+
if (totalFileCount > 0) {
|
|
555577
|
+
const filePaths2 = await hashBasedSnapshotManager.getFilesToRollback(currentSession.id, selectedIndex);
|
|
555702
555578
|
snapshotState.setPendingRollback({
|
|
555703
555579
|
messageIndex: selectedIndex,
|
|
555704
|
-
fileCount:
|
|
555705
|
-
filePaths,
|
|
555580
|
+
fileCount: filePaths2.length,
|
|
555581
|
+
filePaths: filePaths2,
|
|
555706
555582
|
message: cleanIDEContext(message),
|
|
555707
555583
|
images,
|
|
555708
555584
|
crossSessionRollback: true,
|
|
@@ -555734,14 +555610,8 @@ ${errorMsg}`,
|
|
|
555734
555610
|
console.error("Failed to switch to original session:", error);
|
|
555735
555611
|
}
|
|
555736
555612
|
}
|
|
555737
|
-
|
|
555738
|
-
|
|
555739
|
-
if (index >= selectedIndex) {
|
|
555740
|
-
totalFileCount += count;
|
|
555741
|
-
}
|
|
555742
|
-
}
|
|
555743
|
-
if (totalFileCount > 0) {
|
|
555744
|
-
const filePaths = await hashBasedSnapshotManager.getFilesToRollback(currentSession.id, selectedIndex);
|
|
555613
|
+
const filePaths = await hashBasedSnapshotManager.getFilesToRollback(currentSession.id, selectedIndex);
|
|
555614
|
+
if (filePaths.length > 0) {
|
|
555745
555615
|
snapshotState.setPendingRollback({
|
|
555746
555616
|
messageIndex: selectedIndex,
|
|
555747
555617
|
fileCount: filePaths.length,
|
|
@@ -556272,8 +556142,8 @@ function useStreamingState() {
|
|
|
556272
556142
|
if (!isStreaming)
|
|
556273
556143
|
return;
|
|
556274
556144
|
const interval = setInterval(() => {
|
|
556275
|
-
setAnimationFrame((prev) => (prev + 1) %
|
|
556276
|
-
},
|
|
556145
|
+
setAnimationFrame((prev) => (prev + 1) % 2);
|
|
556146
|
+
}, 500);
|
|
556277
556147
|
return () => {
|
|
556278
556148
|
clearInterval(interval);
|
|
556279
556149
|
setAnimationFrame(0);
|
|
@@ -556940,20 +556810,6 @@ function ChatScreen({ autoResume, enableYolo }) {
|
|
|
556940
556810
|
}
|
|
556941
556811
|
});
|
|
556942
556812
|
setWatcherEnabled(true);
|
|
556943
|
-
setCodebaseIndexing(true);
|
|
556944
|
-
agent.start((progressData) => {
|
|
556945
|
-
setCodebaseProgress({
|
|
556946
|
-
totalFiles: progressData.totalFiles,
|
|
556947
|
-
processedFiles: progressData.processedFiles,
|
|
556948
|
-
totalChunks: progressData.totalChunks,
|
|
556949
|
-
currentFile: progressData.currentFile,
|
|
556950
|
-
status: progressData.status,
|
|
556951
|
-
error: progressData.error
|
|
556952
|
-
});
|
|
556953
|
-
if (progressData.status === "completed" || progressData.status === "error") {
|
|
556954
|
-
setCodebaseIndexing(false);
|
|
556955
|
-
}
|
|
556956
|
-
});
|
|
556957
556813
|
return;
|
|
556958
556814
|
}
|
|
556959
556815
|
const wasWatcherEnabled = await agent.isWatcherEnabled();
|
package/bundle/package.json
CHANGED