snow-ai 0.7.14 → 0.7.16
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 +634 -84
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/cli.mjs
CHANGED
|
@@ -46426,6 +46426,40 @@ var init_backend = __esm({
|
|
|
46426
46426
|
}
|
|
46427
46427
|
});
|
|
46428
46428
|
|
|
46429
|
+
// dist/utils/commands/branch.js
|
|
46430
|
+
var branch_exports = {};
|
|
46431
|
+
__export(branch_exports, {
|
|
46432
|
+
default: () => branch_default
|
|
46433
|
+
});
|
|
46434
|
+
var branch_default;
|
|
46435
|
+
var init_branch = __esm({
|
|
46436
|
+
"dist/utils/commands/branch.js"() {
|
|
46437
|
+
"use strict";
|
|
46438
|
+
init_commandExecutor();
|
|
46439
|
+
registerCommand("branch", {
|
|
46440
|
+
execute: (args2) => {
|
|
46441
|
+
const branchName = (args2 == null ? void 0 : args2.trim()) || void 0;
|
|
46442
|
+
return {
|
|
46443
|
+
success: true,
|
|
46444
|
+
action: "forkSession",
|
|
46445
|
+
prompt: branchName
|
|
46446
|
+
};
|
|
46447
|
+
}
|
|
46448
|
+
});
|
|
46449
|
+
registerCommand("fork", {
|
|
46450
|
+
execute: (args2) => {
|
|
46451
|
+
const branchName = (args2 == null ? void 0 : args2.trim()) || void 0;
|
|
46452
|
+
return {
|
|
46453
|
+
success: true,
|
|
46454
|
+
action: "forkSession",
|
|
46455
|
+
prompt: branchName
|
|
46456
|
+
};
|
|
46457
|
+
}
|
|
46458
|
+
});
|
|
46459
|
+
branch_default = {};
|
|
46460
|
+
}
|
|
46461
|
+
});
|
|
46462
|
+
|
|
46429
46463
|
// dist/utils/commands/clear.js
|
|
46430
46464
|
var clear_exports = {};
|
|
46431
46465
|
__export(clear_exports, {
|
|
@@ -53416,7 +53450,24 @@ Notebook is your persistent memory for the codebase. Use it aggressively to reco
|
|
|
53416
53450
|
- If you notice an existing note is outdated or incorrect, fix it immediately \u2014 do NOT leave stale notes
|
|
53417
53451
|
- After refactoring removes the fragile code a note warned about, delete that note
|
|
53418
53452
|
|
|
53419
|
-
**
|
|
53453
|
+
**PARALLEL CALLS RULE:**
|
|
53454
|
+
ALWAYS pair notebook-manage with action tools in same call:
|
|
53455
|
+
- CORRECT: notebook-manage({action:"query"}) + filesystem-read | notebook-manage({action:"add",...}) + filesystem-edit
|
|
53456
|
+
- WRONG: Call notebook-manage alone, wait for result, then act
|
|
53457
|
+
|
|
53458
|
+
**Single tool \u2014 \`notebook-manage\` (required \`action\`):**
|
|
53459
|
+
- **query**: Search by fuzzy file path pattern; optional \`filePathPattern\`, \`topN\`
|
|
53460
|
+
- **list**: All entries for one exact file; required \`filePath\`
|
|
53461
|
+
- **add**: \`filePath\` + \`note\` (string or string[] for batch); records note(s) for a file
|
|
53462
|
+
- **update**: \`notebookId\` + \`note\` (string); updates one entry's content
|
|
53463
|
+
- **delete**: \`notebookId\` (string or string[]); removes entry(s)
|
|
53464
|
+
|
|
53465
|
+
**Examples:**
|
|
53466
|
+
\`\`\`
|
|
53467
|
+
notebook-manage({action:"query", filePathPattern:"auth"}) + filesystem-read("src/auth.ts")
|
|
53468
|
+
notebook-manage({action:"add", filePath:"src/auth.ts", note:["validateInput() MUST be called first","Session token is nullable"]}) + filesystem-edit(...)
|
|
53469
|
+
notebook-manage({action:"delete", notebookId:["id1","id2"]}) + filesystem-edit(...)
|
|
53470
|
+
\`\`\`
|
|
53420
53471
|
|
|
53421
53472
|
**Golden rule:** If you had to think hard to understand something, write it down so the next session doesn't have to.
|
|
53422
53473
|
|
|
@@ -54244,7 +54295,7 @@ async function* createStreamingChatCompletion(options3, abortSignal, onRetry) {
|
|
|
54244
54295
|
}
|
|
54245
54296
|
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
54246
54297
|
yield* withRetryGenerator(async function* () {
|
|
54247
|
-
var _a20, _b14, _c6, _d4, _e2, _f, _g;
|
|
54298
|
+
var _a20, _b14, _c6, _d4, _e2, _f, _g, _h;
|
|
54248
54299
|
const requestBody = {
|
|
54249
54300
|
model: options3.model || config3.advancedModel,
|
|
54250
54301
|
messages: convertToOpenAIMessages(
|
|
@@ -54264,6 +54315,12 @@ async function* createStreamingChatCompletion(options3, abortSignal, onRetry) {
|
|
|
54264
54315
|
tools: options3.tools,
|
|
54265
54316
|
tool_choice: options3.tool_choice
|
|
54266
54317
|
};
|
|
54318
|
+
if (((_a20 = config3.chatThinking) == null ? void 0 : _a20.enabled) && !options3.disableThinking) {
|
|
54319
|
+
requestBody["thinking"] = { type: "enabled" };
|
|
54320
|
+
if (config3.chatThinking.reasoning_effort) {
|
|
54321
|
+
requestBody["reasoning_effort"] = config3.chatThinking.reasoning_effort;
|
|
54322
|
+
}
|
|
54323
|
+
}
|
|
54267
54324
|
const url2 = `${config3.baseUrl}/chat/completions`;
|
|
54268
54325
|
const customHeaders = options3.customHeaders || getCustomHeadersForConfig(config3);
|
|
54269
54326
|
const fetchOptions = addProxyToFetchOptions(url2, {
|
|
@@ -54284,7 +54341,7 @@ async function* createStreamingChatCompletion(options3, abortSignal, onRetry) {
|
|
|
54284
54341
|
const errorMessage = error40 instanceof Error ? error40.message : String(error40);
|
|
54285
54342
|
throw new Error(`OpenAI API fetch failed: ${errorMessage}
|
|
54286
54343
|
URL: ${url2}
|
|
54287
|
-
Model: ${requestBody
|
|
54344
|
+
Model: ${requestBody["model"]}
|
|
54288
54345
|
Error type: ${error40 instanceof TypeError ? "Network/Connection Error" : "Unknown Error"}
|
|
54289
54346
|
Possible causes: Network unavailable, DNS resolution failed, proxy issues, or server unreachable`);
|
|
54290
54347
|
}
|
|
@@ -54310,17 +54367,17 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
54310
54367
|
completion_tokens: usageValue.completion_tokens || 0,
|
|
54311
54368
|
total_tokens: usageValue.total_tokens || 0,
|
|
54312
54369
|
// OpenAI Chat API: cached_tokens in prompt_tokens_details
|
|
54313
|
-
cached_tokens: (
|
|
54370
|
+
cached_tokens: (_b14 = usageValue.prompt_tokens_details) == null ? void 0 : _b14.cached_tokens
|
|
54314
54371
|
};
|
|
54315
54372
|
}
|
|
54316
|
-
const choice = (
|
|
54373
|
+
const choice = (_c6 = chunk2.choices) == null ? void 0 : _c6[0];
|
|
54317
54374
|
if (!choice) {
|
|
54318
54375
|
if (chunk2.usage) {
|
|
54319
54376
|
break;
|
|
54320
54377
|
}
|
|
54321
54378
|
continue;
|
|
54322
54379
|
}
|
|
54323
|
-
const content = (
|
|
54380
|
+
const content = (_d4 = choice.delta) == null ? void 0 : _d4.content;
|
|
54324
54381
|
if (content) {
|
|
54325
54382
|
contentBuffer += content;
|
|
54326
54383
|
yield {
|
|
@@ -54328,7 +54385,7 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
54328
54385
|
content
|
|
54329
54386
|
};
|
|
54330
54387
|
}
|
|
54331
|
-
const reasoningContent = (
|
|
54388
|
+
const reasoningContent = (_e2 = choice.delta) == null ? void 0 : _e2.reasoning_content;
|
|
54332
54389
|
if (reasoningContent) {
|
|
54333
54390
|
reasoningContentBuffer += reasoningContent;
|
|
54334
54391
|
if (!reasoningStarted) {
|
|
@@ -54342,7 +54399,7 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
54342
54399
|
delta: reasoningContent
|
|
54343
54400
|
};
|
|
54344
54401
|
}
|
|
54345
|
-
const deltaToolCalls = (
|
|
54402
|
+
const deltaToolCalls = (_f = choice.delta) == null ? void 0 : _f.tool_calls;
|
|
54346
54403
|
if (deltaToolCalls) {
|
|
54347
54404
|
hasToolCalls = true;
|
|
54348
54405
|
for (const deltaCall of deltaToolCalls) {
|
|
@@ -54361,11 +54418,11 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
54361
54418
|
toolCallsBuffer[index].id = deltaCall.id;
|
|
54362
54419
|
}
|
|
54363
54420
|
let deltaText = "";
|
|
54364
|
-
if ((
|
|
54421
|
+
if ((_g = deltaCall.function) == null ? void 0 : _g.name) {
|
|
54365
54422
|
toolCallsBuffer[index].function.name += deltaCall.function.name;
|
|
54366
54423
|
deltaText += deltaCall.function.name;
|
|
54367
54424
|
}
|
|
54368
|
-
if ((
|
|
54425
|
+
if ((_h = deltaCall.function) == null ? void 0 : _h.arguments) {
|
|
54369
54426
|
toolCallsBuffer[index].function.arguments += deltaCall.function.arguments;
|
|
54370
54427
|
deltaText += deltaCall.function.arguments;
|
|
54371
54428
|
}
|
|
@@ -177952,6 +178009,8 @@ var init_en = __esm({
|
|
|
177952
178009
|
responsesReasoningEffort: "Responses Reasoning Effort:",
|
|
177953
178010
|
responsesVerbosity: "Responses Verbosity:",
|
|
177954
178011
|
responsesFastMode: "Responses Fast Mode (priority):",
|
|
178012
|
+
chatThinkingEnabled: "Chat Thinking (DeepSeek):",
|
|
178013
|
+
chatReasoningEffort: "Chat Reasoning Effort:",
|
|
177955
178014
|
advancedModel: "Advanced Model(Type to search):",
|
|
177956
178015
|
basicModel: "Basic Model(Type to search):",
|
|
177957
178016
|
maxContextTokens: "Max Context Tokens:",
|
|
@@ -178333,6 +178392,7 @@ var init_en = __esm({
|
|
|
178333
178392
|
toolSearch: "Toggle Tool Search (progressive tool loading). Enabled by default to save context",
|
|
178334
178393
|
hybridCompress: "Toggle Hybrid Compress mode (AI summary + smart truncation for /compact and auto-compress)",
|
|
178335
178394
|
team: "Toggle Agent Team mode - orchestrate multiple agents working together in independent Git worktrees",
|
|
178395
|
+
branch: "Fork current conversation into a new branch",
|
|
178336
178396
|
worktree: "Open Git branch management panel for switching, creating and deleting branches",
|
|
178337
178397
|
diff: "Review file changes from a conversation in IDE diff view",
|
|
178338
178398
|
connect: "Connect to a Snow Instance for AI processing",
|
|
@@ -178372,6 +178432,11 @@ var init_en = __esm({
|
|
|
178372
178432
|
unmatchedIDEs: "Found {count} other running IDE(s). However, their workspace/project directories do not match the current cwd.",
|
|
178373
178433
|
connectedTo: "Connected to {label}",
|
|
178374
178434
|
connectFailed: "Failed to connect to IDE: {error}"
|
|
178435
|
+
},
|
|
178436
|
+
branchFork: {
|
|
178437
|
+
noActiveSession: "No active session to fork.",
|
|
178438
|
+
success: "Conversation forked into branch {name}. To return to the original session:\n/resume {originalId}",
|
|
178439
|
+
failed: "Failed to fork session"
|
|
178375
178440
|
}
|
|
178376
178441
|
}
|
|
178377
178442
|
},
|
|
@@ -179573,6 +179638,8 @@ var init_zh = __esm({
|
|
|
179573
179638
|
responsesReasoningEffort: "Responses \u63A8\u7406\u5F3A\u5EA6:",
|
|
179574
179639
|
responsesVerbosity: "Responses \u8F93\u51FA\u8BE6\u7EC6\u5EA6:",
|
|
179575
179640
|
responsesFastMode: "Responses Fast (priority):",
|
|
179641
|
+
chatThinkingEnabled: "\u542F\u7528 Chat \u601D\u8003 (DeepSeek):",
|
|
179642
|
+
chatReasoningEffort: "Chat \u601D\u8003\u5F3A\u5EA6:",
|
|
179576
179643
|
advancedModel: "\u9AD8\u7EA7\u6A21\u578B(\u952E\u5165\u53EF\u641C\u7D22):",
|
|
179577
179644
|
basicModel: "\u57FA\u7840\u6A21\u578B(\u952E\u5165\u53EF\u641C\u7D22):",
|
|
179578
179645
|
maxContextTokens: "\u6700\u5927\u4E0A\u4E0B\u6587\u4EE4\u724C:",
|
|
@@ -179954,6 +180021,7 @@ var init_zh = __esm({
|
|
|
179954
180021
|
toolSearch: "\u5207\u6362\u5DE5\u5177\u641C\u7D22\uFF08\u6E10\u8FDB\u5F0F\u5DE5\u5177\u52A0\u8F7D\uFF09\u3002\u9ED8\u8BA4\u542F\u7528\u4EE5\u8282\u7701\u4E0A\u4E0B\u6587",
|
|
179955
180022
|
hybridCompress: "\u5207\u6362\u6DF7\u5408\u538B\u7F29\u6A21\u5F0F\uFF08AI \u6458\u8981 + \u667A\u80FD\u622A\u65AD\uFF0C\u7528\u4E8E /compact \u548C\u81EA\u52A8\u538B\u7F29\uFF09",
|
|
179956
180023
|
team: "\u5207\u6362 Agent Team \u6A21\u5F0F - \u534F\u8C03\u591A\u4E2A\u4EE3\u7406\u5728\u72EC\u7ACB Git Worktree \u4E2D\u5E76\u884C\u5DE5\u4F5C",
|
|
180024
|
+
branch: "\u5C06\u5F53\u524D\u5BF9\u8BDD\u5206\u53C9\u4E3A\u65B0\u5206\u652F\uFF0C\u53EF\u7528 /resume \u8FD4\u56DE\u539F\u4F1A\u8BDD",
|
|
179957
180025
|
worktree: "\u6253\u5F00 Git \u5206\u652F\u7BA1\u7406\u9762\u677F\uFF0C\u652F\u6301\u5207\u6362\u3001\u65B0\u5EFA\u548C\u5220\u9664\u5206\u652F",
|
|
179958
180026
|
diff: "\u5728 IDE \u4E2D\u67E5\u770B\u5BF9\u8BDD\u7684\u6587\u4EF6\u4FEE\u6539 Diff",
|
|
179959
180027
|
connect: "\u8FDE\u63A5\u5230 Snow Instance \u8FDB\u884C AI \u5904\u7406",
|
|
@@ -179993,6 +180061,11 @@ var init_zh = __esm({
|
|
|
179993
180061
|
unmatchedIDEs: "\u53D1\u73B0 {count} \u4E2A\u5176\u4ED6\u8FD0\u884C\u4E2D\u7684 IDE\uFF0C\u4F46\u5176\u5DE5\u4F5C\u533A/\u9879\u76EE\u76EE\u5F55\u4E0E\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u4E0D\u5339\u914D\u3002",
|
|
179994
180062
|
connectedTo: "\u5DF2\u8FDE\u63A5\u5230 {label}",
|
|
179995
180063
|
connectFailed: "\u8FDE\u63A5 IDE \u5931\u8D25\uFF1A{error}"
|
|
180064
|
+
},
|
|
180065
|
+
branchFork: {
|
|
180066
|
+
noActiveSession: "\u6CA1\u6709\u53EF\u5206\u53C9\u7684\u6D3B\u8DC3\u4F1A\u8BDD\u3002",
|
|
180067
|
+
success: "\u5BF9\u8BDD\u5DF2\u5206\u53C9\u4E3A\u5206\u652F {name}\u3002\u8FD4\u56DE\u539F\u4F1A\u8BDD\u8BF7\u6267\u884C:\n/resume {originalId}",
|
|
180068
|
+
failed: "\u4F1A\u8BDD\u5206\u53C9\u5931\u8D25"
|
|
179996
180069
|
}
|
|
179997
180070
|
}
|
|
179998
180071
|
},
|
|
@@ -181193,6 +181266,8 @@ var init_zh_TW = __esm({
|
|
|
181193
181266
|
responsesReasoningEffort: "Responses \u63A8\u7406\u5F37\u5EA6:",
|
|
181194
181267
|
responsesVerbosity: "Responses \u8F38\u51FA\u8A73\u7D30\u5EA6:",
|
|
181195
181268
|
responsesFastMode: "Responses Fast (priority):",
|
|
181269
|
+
chatThinkingEnabled: "\u555F\u7528 Chat \u601D\u8003 (DeepSeek):",
|
|
181270
|
+
chatReasoningEffort: "Chat \u601D\u8003\u5F37\u5EA6:",
|
|
181196
181271
|
advancedModel: "\u9032\u968E\u6A21\u578B(\u8F38\u5165\u5F8C\u53EF\u4EE5\u641C\u5C0B):",
|
|
181197
181272
|
basicModel: "\u57FA\u790E\u6A21\u578B(\u8F38\u5165\u5F8C\u53EF\u4EE5\u641C\u5C0B):",
|
|
181198
181273
|
maxContextTokens: "\u6700\u5927\u4E0A\u4E0B\u6587\u4EE4\u724C:",
|
|
@@ -181574,6 +181649,7 @@ var init_zh_TW = __esm({
|
|
|
181574
181649
|
toolSearch: "\u5207\u63DB\u5DE5\u5177\u641C\u5C0B\uFF08\u6F38\u9032\u5F0F\u5DE5\u5177\u8F09\u5165\uFF09\u3002\u9810\u8A2D\u555F\u7528\u4EE5\u7BC0\u7701\u4E0A\u4E0B\u6587",
|
|
181575
181650
|
hybridCompress: "\u5207\u63DB\u6DF7\u5408\u58D3\u7E2E\u6A21\u5F0F\uFF08AI \u6458\u8981 + \u667A\u6167\u622A\u65B7\uFF0C\u7528\u65BC /compact \u548C\u81EA\u52D5\u58D3\u7E2E\uFF09",
|
|
181576
181651
|
team: "\u5207\u63DB Agent Team \u6A21\u5F0F - \u5354\u8ABF\u591A\u500B\u4EE3\u7406\u5728\u7368\u7ACB Git Worktree \u4E2D\u4E26\u884C\u5DE5\u4F5C",
|
|
181652
|
+
branch: "\u5C07\u76EE\u524D\u5C0D\u8A71\u5206\u53C9\u70BA\u65B0\u5206\u652F\uFF0C\u53EF\u7528 /resume \u8FD4\u56DE\u539F\u6703\u8A71",
|
|
181577
181653
|
worktree: "\u958B\u555F Git \u5206\u652F\u7BA1\u7406\u9762\u677F\uFF0C\u652F\u63F4\u5207\u63DB\u3001\u65B0\u5EFA\u548C\u522A\u9664\u5206\u652F",
|
|
181578
181654
|
diff: "\u5728 IDE \u4E2D\u67E5\u770B\u5C0D\u8A71\u7684\u6A94\u6848\u4FEE\u6539 Diff",
|
|
181579
181655
|
connect: "\u9023\u63A5\u5230 Snow Instance \u9032\u884C AI \u8655\u7406",
|
|
@@ -181613,6 +181689,11 @@ var init_zh_TW = __esm({
|
|
|
181613
181689
|
unmatchedIDEs: "\u767C\u73FE {count} \u500B\u5176\u4ED6\u57F7\u884C\u4E2D\u7684 IDE\uFF0C\u4F46\u5176\u5DE5\u4F5C\u5340/\u5C08\u6848\u76EE\u9304\u8207\u76EE\u524D\u5DE5\u4F5C\u76EE\u9304\u4E0D\u76F8\u7B26\u3002",
|
|
181614
181690
|
connectedTo: "\u5DF2\u9023\u7DDA\u81F3 {label}",
|
|
181615
181691
|
connectFailed: "\u9023\u7DDA IDE \u5931\u6557\uFF1A{error}"
|
|
181692
|
+
},
|
|
181693
|
+
branchFork: {
|
|
181694
|
+
noActiveSession: "\u6C92\u6709\u53EF\u5206\u53C9\u7684\u6D3B\u8E8D\u6703\u8A71\u3002",
|
|
181695
|
+
success: "\u5C0D\u8A71\u5DF2\u5206\u53C9\u70BA\u5206\u652F {name}\u3002\u8FD4\u56DE\u539F\u6703\u8A71\u8ACB\u57F7\u884C:\n/resume {originalId}",
|
|
181696
|
+
failed: "\u6703\u8A71\u5206\u53C9\u5931\u6557"
|
|
181616
181697
|
}
|
|
181617
181698
|
}
|
|
181618
181699
|
},
|
|
@@ -362981,6 +363062,56 @@ function deleteNotebook(notebookId) {
|
|
|
362981
363062
|
}
|
|
362982
363063
|
return found;
|
|
362983
363064
|
}
|
|
363065
|
+
function addNotebooks(filePath, notes) {
|
|
363066
|
+
const normalizedPath = normalizePath2(filePath);
|
|
363067
|
+
const data = readNotebookData();
|
|
363068
|
+
if (!data[normalizedPath]) {
|
|
363069
|
+
data[normalizedPath] = [];
|
|
363070
|
+
}
|
|
363071
|
+
const entries = [];
|
|
363072
|
+
for (const note of notes) {
|
|
363073
|
+
const now = /* @__PURE__ */ new Date();
|
|
363074
|
+
const localTimeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}T${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}:${String(now.getSeconds()).padStart(2, "0")}.${String(now.getMilliseconds()).padStart(3, "0")}`;
|
|
363075
|
+
const entry = {
|
|
363076
|
+
id: `notebook-${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
363077
|
+
filePath: normalizedPath,
|
|
363078
|
+
note,
|
|
363079
|
+
createdAt: localTimeStr,
|
|
363080
|
+
updatedAt: localTimeStr
|
|
363081
|
+
};
|
|
363082
|
+
data[normalizedPath].unshift(entry);
|
|
363083
|
+
entries.push(entry);
|
|
363084
|
+
}
|
|
363085
|
+
if (data[normalizedPath].length > MAX_ENTRIES_PER_FILE) {
|
|
363086
|
+
data[normalizedPath] = data[normalizedPath].slice(0, MAX_ENTRIES_PER_FILE);
|
|
363087
|
+
}
|
|
363088
|
+
saveNotebookData(data);
|
|
363089
|
+
return entries;
|
|
363090
|
+
}
|
|
363091
|
+
function deleteNotebooks(notebookIds) {
|
|
363092
|
+
var _a20;
|
|
363093
|
+
const data = readNotebookData();
|
|
363094
|
+
const idSet = new Set(notebookIds);
|
|
363095
|
+
const deleted = [];
|
|
363096
|
+
for (const [, entries] of Object.entries(data)) {
|
|
363097
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
363098
|
+
if (idSet.has(entries[i].id)) {
|
|
363099
|
+
deleted.push(entries[i].id);
|
|
363100
|
+
entries.splice(i, 1);
|
|
363101
|
+
idSet.delete(((_a20 = entries[i]) == null ? void 0 : _a20.id) ?? "");
|
|
363102
|
+
}
|
|
363103
|
+
}
|
|
363104
|
+
if (idSet.size === 0)
|
|
363105
|
+
break;
|
|
363106
|
+
}
|
|
363107
|
+
if (deleted.length > 0) {
|
|
363108
|
+
saveNotebookData(data);
|
|
363109
|
+
}
|
|
363110
|
+
return {
|
|
363111
|
+
deleted,
|
|
363112
|
+
notFound: notebookIds.filter((id) => !deleted.includes(id))
|
|
363113
|
+
};
|
|
363114
|
+
}
|
|
362984
363115
|
function getNotebookSnapshotFilePath() {
|
|
362985
363116
|
const projectRoot = process.cwd();
|
|
362986
363117
|
const projectName = path23.basename(projectRoot);
|
|
@@ -440974,6 +441105,7 @@ EXAMPLES:
|
|
|
440974
441105
|
|
|
440975
441106
|
// dist/mcp/notebook.js
|
|
440976
441107
|
async function executeNotebookTool(toolName, args2) {
|
|
441108
|
+
var _a20;
|
|
440977
441109
|
try {
|
|
440978
441110
|
const legacyActionMap = {
|
|
440979
441111
|
"notebook-add": "add",
|
|
@@ -440997,18 +441129,57 @@ async function executeNotebookTool(toolName, args2) {
|
|
|
440997
441129
|
switch (action) {
|
|
440998
441130
|
case "add": {
|
|
440999
441131
|
const { filePath, note } = args2;
|
|
441000
|
-
if (!filePath ||
|
|
441132
|
+
if (!filePath || note === void 0 || note === null) {
|
|
441001
441133
|
return {
|
|
441002
441134
|
content: [
|
|
441003
441135
|
{
|
|
441004
441136
|
type: "text",
|
|
441005
|
-
text:
|
|
441137
|
+
text: 'Error: action=add requires both "filePath" and "note"'
|
|
441006
441138
|
}
|
|
441007
441139
|
],
|
|
441008
441140
|
isError: true
|
|
441009
441141
|
};
|
|
441010
441142
|
}
|
|
441011
|
-
|
|
441143
|
+
let parsedNote = note;
|
|
441144
|
+
if (typeof note === "string") {
|
|
441145
|
+
try {
|
|
441146
|
+
const parsed = JSON.parse(note);
|
|
441147
|
+
if (Array.isArray(parsed)) {
|
|
441148
|
+
parsedNote = parsed;
|
|
441149
|
+
}
|
|
441150
|
+
} catch {
|
|
441151
|
+
}
|
|
441152
|
+
}
|
|
441153
|
+
if (Array.isArray(parsedNote)) {
|
|
441154
|
+
const entries = addNotebooks(filePath, parsedNote);
|
|
441155
|
+
try {
|
|
441156
|
+
const context2 = getConversationContext();
|
|
441157
|
+
if (context2) {
|
|
441158
|
+
for (const entry2 of entries) {
|
|
441159
|
+
recordNotebookAddition(context2.sessionId, context2.messageIndex, entry2.id);
|
|
441160
|
+
}
|
|
441161
|
+
}
|
|
441162
|
+
} catch {
|
|
441163
|
+
}
|
|
441164
|
+
return {
|
|
441165
|
+
content: [
|
|
441166
|
+
{
|
|
441167
|
+
type: "text",
|
|
441168
|
+
text: JSON.stringify({
|
|
441169
|
+
success: true,
|
|
441170
|
+
message: `${entries.length} notebook entries added for: ${((_a20 = entries[0]) == null ? void 0 : _a20.filePath) ?? filePath}`,
|
|
441171
|
+
entries: entries.map((e) => ({
|
|
441172
|
+
id: e.id,
|
|
441173
|
+
filePath: e.filePath,
|
|
441174
|
+
note: e.note,
|
|
441175
|
+
createdAt: e.createdAt
|
|
441176
|
+
}))
|
|
441177
|
+
}, null, 2)
|
|
441178
|
+
}
|
|
441179
|
+
]
|
|
441180
|
+
};
|
|
441181
|
+
}
|
|
441182
|
+
const entry = addNotebook(filePath, parsedNote);
|
|
441012
441183
|
try {
|
|
441013
441184
|
const context2 = getConversationContext();
|
|
441014
441185
|
if (context2) {
|
|
@@ -441072,12 +441243,12 @@ async function executeNotebookTool(toolName, args2) {
|
|
|
441072
441243
|
}
|
|
441073
441244
|
case "update": {
|
|
441074
441245
|
const { notebookId, note } = args2;
|
|
441075
|
-
if (!notebookId || !note) {
|
|
441246
|
+
if (!notebookId || !note || typeof note !== "string") {
|
|
441076
441247
|
return {
|
|
441077
441248
|
content: [
|
|
441078
441249
|
{
|
|
441079
441250
|
type: "text",
|
|
441080
|
-
text:
|
|
441251
|
+
text: 'Error: action=update requires "notebookId" (string) and "note" (string)'
|
|
441081
441252
|
}
|
|
441082
441253
|
],
|
|
441083
441254
|
isError: true
|
|
@@ -441127,47 +441298,60 @@ async function executeNotebookTool(toolName, args2) {
|
|
|
441127
441298
|
}
|
|
441128
441299
|
case "delete": {
|
|
441129
441300
|
const { notebookId } = args2;
|
|
441130
|
-
if (
|
|
441301
|
+
if (notebookId === void 0 || notebookId === null) {
|
|
441131
441302
|
return {
|
|
441132
441303
|
content: [
|
|
441133
441304
|
{
|
|
441134
441305
|
type: "text",
|
|
441135
|
-
text:
|
|
441306
|
+
text: 'Error: action=delete requires "notebookId"'
|
|
441136
441307
|
}
|
|
441137
441308
|
],
|
|
441138
441309
|
isError: true
|
|
441139
441310
|
};
|
|
441140
441311
|
}
|
|
441141
|
-
const
|
|
441142
|
-
const
|
|
441143
|
-
|
|
441312
|
+
const ids = Array.isArray(notebookId) ? notebookId : [notebookId];
|
|
441313
|
+
const entriesToDelete = ids.map((id) => findNotebookById(id)).filter((e) => e !== null);
|
|
441314
|
+
const result2 = ids.length === 1 ? (() => {
|
|
441315
|
+
const deleted = deleteNotebook(ids[0]);
|
|
441316
|
+
return {
|
|
441317
|
+
deleted: deleted ? [ids[0]] : [],
|
|
441318
|
+
notFound: deleted ? [] : [ids[0]]
|
|
441319
|
+
};
|
|
441320
|
+
})() : deleteNotebooks(ids);
|
|
441321
|
+
try {
|
|
441322
|
+
const context2 = getConversationContext();
|
|
441323
|
+
if (context2) {
|
|
441324
|
+
for (const entry of entriesToDelete) {
|
|
441325
|
+
if (result2.deleted.includes(entry.id)) {
|
|
441326
|
+
recordNotebookDeletion(context2.sessionId, context2.messageIndex, entry);
|
|
441327
|
+
}
|
|
441328
|
+
}
|
|
441329
|
+
}
|
|
441330
|
+
} catch {
|
|
441331
|
+
}
|
|
441332
|
+
if (result2.deleted.length === 0) {
|
|
441144
441333
|
return {
|
|
441145
441334
|
content: [
|
|
441146
441335
|
{
|
|
441147
441336
|
type: "text",
|
|
441148
441337
|
text: JSON.stringify({
|
|
441149
441338
|
success: false,
|
|
441150
|
-
message: `Notebook
|
|
441339
|
+
message: `Notebook entries not found: ${result2.notFound.join(", ")}`
|
|
441151
441340
|
}, null, 2)
|
|
441152
441341
|
}
|
|
441153
441342
|
],
|
|
441154
441343
|
isError: true
|
|
441155
441344
|
};
|
|
441156
441345
|
}
|
|
441157
|
-
try {
|
|
441158
|
-
const context2 = getConversationContext();
|
|
441159
|
-
if (context2 && entryToDelete) {
|
|
441160
|
-
recordNotebookDeletion(context2.sessionId, context2.messageIndex, entryToDelete);
|
|
441161
|
-
}
|
|
441162
|
-
} catch {
|
|
441163
|
-
}
|
|
441164
441346
|
return {
|
|
441165
441347
|
content: [
|
|
441166
441348
|
{
|
|
441167
441349
|
type: "text",
|
|
441168
441350
|
text: JSON.stringify({
|
|
441169
441351
|
success: true,
|
|
441170
|
-
message:
|
|
441352
|
+
message: `${result2.deleted.length} notebook entries deleted`,
|
|
441353
|
+
deleted: result2.deleted,
|
|
441354
|
+
...result2.notFound.length > 0 ? { notFound: result2.notFound } : {}
|
|
441171
441355
|
}, null, 2)
|
|
441172
441356
|
}
|
|
441173
441357
|
]
|
|
@@ -441180,7 +441364,7 @@ async function executeNotebookTool(toolName, args2) {
|
|
|
441180
441364
|
content: [
|
|
441181
441365
|
{
|
|
441182
441366
|
type: "text",
|
|
441183
|
-
text:
|
|
441367
|
+
text: 'Error: action=list requires "filePath"'
|
|
441184
441368
|
}
|
|
441185
441369
|
],
|
|
441186
441370
|
isError: true
|
|
@@ -441238,35 +441422,35 @@ var init_notebook = __esm({
|
|
|
441238
441422
|
mcpTools9 = [
|
|
441239
441423
|
{
|
|
441240
441424
|
name: "notebook-manage",
|
|
441241
|
-
description:
|
|
441425
|
+
description: `Unified notebook management tool. Use required field "action" \u2014 one of query | list | add | update | delete.
|
|
441242
441426
|
|
|
441243
|
-
|
|
441427
|
+
PARALLEL CALLS ONLY: MUST pair with other tools (notebook-manage + filesystem-read/terminal-execute/etc).
|
|
441428
|
+
NEVER call notebook-manage alone \u2014 always combine with an action tool in the same turn.
|
|
441244
441429
|
|
|
441245
|
-
|
|
441246
|
-
- query: Search entries by fuzzy file path pattern
|
|
441247
|
-
- list: List all entries for one exact file path
|
|
441248
|
-
- add: Record a
|
|
441249
|
-
- update: Update
|
|
441250
|
-
- delete:
|
|
441430
|
+
ACTIONS:
|
|
441431
|
+
- query: Search entries by fuzzy file path pattern. Optional "filePathPattern" and "topN".
|
|
441432
|
+
- list: List all entries for one exact file path. Required "filePath".
|
|
441433
|
+
- add: Record note(s) for a file. Required "filePath" and "note" (string or string[]). Batch adds share the same filePath.
|
|
441434
|
+
- update: Update note by ID. Required "notebookId" and "note".
|
|
441435
|
+
- delete: Remove note(s) by ID. Required "notebookId" (string or string[]).
|
|
441251
441436
|
|
|
441252
|
-
|
|
441253
|
-
- After fixing bugs
|
|
441254
|
-
-
|
|
441255
|
-
-
|
|
441256
|
-
-
|
|
441437
|
+
BEST PRACTICES:
|
|
441438
|
+
- After fixing non-trivial bugs, record what caused it and why the fix works.
|
|
441439
|
+
- When discovering fragile dependencies or hidden coupling, record immediately.
|
|
441440
|
+
- When an existing note is outdated or incorrect, update/delete it immediately \u2014 do NOT leave stale notes.
|
|
441441
|
+
- Use query before modifying code to recall relevant notes.
|
|
441257
441442
|
|
|
441258
|
-
|
|
441259
|
-
- "
|
|
441260
|
-
- "
|
|
441261
|
-
- "
|
|
441262
|
-
- "Parser expects exact format - adding fields breaks backward compat"`,
|
|
441443
|
+
EXAMPLES:
|
|
441444
|
+
- notebook-manage({action:"query", filePathPattern:"auth"}) + filesystem-read(...)
|
|
441445
|
+
- notebook-manage({action:"add", filePath:"src/auth.ts", note:["validateInput() MUST be called first","Session token is nullable"]}) + filesystem-edit(...)
|
|
441446
|
+
- notebook-manage({action:"delete", notebookId:["id1","id2"]}) + filesystem-edit(...)`,
|
|
441263
441447
|
inputSchema: {
|
|
441264
441448
|
type: "object",
|
|
441265
441449
|
properties: {
|
|
441266
441450
|
action: {
|
|
441267
441451
|
type: "string",
|
|
441268
441452
|
enum: ["query", "list", "add", "update", "delete"],
|
|
441269
|
-
description: "
|
|
441453
|
+
description: "Which operation to run on the notebook."
|
|
441270
441454
|
},
|
|
441271
441455
|
filePath: {
|
|
441272
441456
|
type: "string",
|
|
@@ -441285,12 +441469,32 @@ var init_notebook = __esm({
|
|
|
441285
441469
|
maximum: 50
|
|
441286
441470
|
},
|
|
441287
441471
|
notebookId: {
|
|
441288
|
-
|
|
441289
|
-
|
|
441472
|
+
oneOf: [
|
|
441473
|
+
{
|
|
441474
|
+
type: "string",
|
|
441475
|
+
description: "Single notebook entry ID"
|
|
441476
|
+
},
|
|
441477
|
+
{
|
|
441478
|
+
type: "array",
|
|
441479
|
+
items: { type: "string" },
|
|
441480
|
+
description: "Multiple IDs (same delete applies to all)"
|
|
441481
|
+
}
|
|
441482
|
+
],
|
|
441483
|
+
description: "For action=update or delete: entry id(s) from action=query/list."
|
|
441290
441484
|
},
|
|
441291
441485
|
note: {
|
|
441292
|
-
|
|
441293
|
-
|
|
441486
|
+
oneOf: [
|
|
441487
|
+
{
|
|
441488
|
+
type: "string",
|
|
441489
|
+
description: "For action=add: one note. For action=update: new note content."
|
|
441490
|
+
},
|
|
441491
|
+
{
|
|
441492
|
+
type: "array",
|
|
441493
|
+
items: { type: "string" },
|
|
441494
|
+
description: "For action=add only: batch add multiple notes for the same file."
|
|
441495
|
+
}
|
|
441496
|
+
],
|
|
441497
|
+
description: "For add: required (string or string[]). For update: required string."
|
|
441294
441498
|
}
|
|
441295
441499
|
},
|
|
441296
441500
|
required: ["action"]
|
|
@@ -457620,8 +457824,17 @@ var init_LSPClient = __esm({
|
|
|
457620
457824
|
return Boolean(this.connection && this.isInitialized && this.isProcessAlive && !this.isShuttingDown && stdin && !stdin.destroyed && !stdin.writableEnded);
|
|
457621
457825
|
}
|
|
457622
457826
|
markTransportClosed() {
|
|
457827
|
+
if (!this.isProcessAlive && !this.isInitialized) {
|
|
457828
|
+
return;
|
|
457829
|
+
}
|
|
457623
457830
|
this.isInitialized = false;
|
|
457624
457831
|
this.isProcessAlive = false;
|
|
457832
|
+
if (this.connection) {
|
|
457833
|
+
try {
|
|
457834
|
+
this.connection.dispose();
|
|
457835
|
+
} catch {
|
|
457836
|
+
}
|
|
457837
|
+
}
|
|
457625
457838
|
}
|
|
457626
457839
|
constructor(config3) {
|
|
457627
457840
|
Object.defineProperty(this, "config", {
|
|
@@ -458355,20 +458568,30 @@ var init_LSPManager = __esm({
|
|
|
458355
458568
|
if (!client) {
|
|
458356
458569
|
return null;
|
|
458357
458570
|
}
|
|
458571
|
+
let uri;
|
|
458358
458572
|
try {
|
|
458359
|
-
|
|
458573
|
+
uri = this.pathToUri(filePath);
|
|
458360
458574
|
const content = await this.getDocumentContent(filePath);
|
|
458361
458575
|
if (!content) {
|
|
458362
458576
|
return null;
|
|
458363
458577
|
}
|
|
458364
458578
|
await client.openDocument(uri, content);
|
|
458579
|
+
if (!client.isReady()) {
|
|
458580
|
+
return null;
|
|
458581
|
+
}
|
|
458365
458582
|
const position = { line, character: column };
|
|
458366
458583
|
const locations = await client.gotoDefinition(uri, position);
|
|
458367
|
-
await client.closeDocument(uri);
|
|
458368
458584
|
return locations.length > 0 ? locations[0] : null;
|
|
458369
458585
|
} catch (error40) {
|
|
458370
458586
|
console.debug("LSP findDefinition error:", error40);
|
|
458371
458587
|
return null;
|
|
458588
|
+
} finally {
|
|
458589
|
+
if (uri) {
|
|
458590
|
+
try {
|
|
458591
|
+
await client.closeDocument(uri);
|
|
458592
|
+
} catch {
|
|
458593
|
+
}
|
|
458594
|
+
}
|
|
458372
458595
|
}
|
|
458373
458596
|
}
|
|
458374
458597
|
async findReferences(filePath, line, column, maxResults = 100) {
|
|
@@ -458380,20 +458603,30 @@ var init_LSPManager = __esm({
|
|
|
458380
458603
|
if (!client) {
|
|
458381
458604
|
return [];
|
|
458382
458605
|
}
|
|
458606
|
+
let uri;
|
|
458383
458607
|
try {
|
|
458384
|
-
|
|
458608
|
+
uri = this.pathToUri(filePath);
|
|
458385
458609
|
const content = await this.getDocumentContent(filePath);
|
|
458386
458610
|
if (!content) {
|
|
458387
458611
|
return [];
|
|
458388
458612
|
}
|
|
458389
458613
|
await client.openDocument(uri, content);
|
|
458614
|
+
if (!client.isReady()) {
|
|
458615
|
+
return [];
|
|
458616
|
+
}
|
|
458390
458617
|
const position = { line, character: column };
|
|
458391
458618
|
const locations = await client.findReferences(uri, position, false);
|
|
458392
|
-
await client.closeDocument(uri);
|
|
458393
458619
|
return locations.slice(0, maxResults);
|
|
458394
458620
|
} catch (error40) {
|
|
458395
458621
|
console.debug("LSP findReferences error:", error40);
|
|
458396
458622
|
return [];
|
|
458623
|
+
} finally {
|
|
458624
|
+
if (uri) {
|
|
458625
|
+
try {
|
|
458626
|
+
await client.closeDocument(uri);
|
|
458627
|
+
} catch {
|
|
458628
|
+
}
|
|
458629
|
+
}
|
|
458397
458630
|
}
|
|
458398
458631
|
}
|
|
458399
458632
|
async getDocumentSymbols(filePath) {
|
|
@@ -458405,19 +458638,29 @@ var init_LSPManager = __esm({
|
|
|
458405
458638
|
if (!client) {
|
|
458406
458639
|
return null;
|
|
458407
458640
|
}
|
|
458641
|
+
let uri;
|
|
458408
458642
|
try {
|
|
458409
|
-
|
|
458643
|
+
uri = this.pathToUri(filePath);
|
|
458410
458644
|
const content = await this.getDocumentContent(filePath);
|
|
458411
458645
|
if (!content) {
|
|
458412
458646
|
return null;
|
|
458413
458647
|
}
|
|
458414
458648
|
await client.openDocument(uri, content);
|
|
458649
|
+
if (!client.isReady()) {
|
|
458650
|
+
return null;
|
|
458651
|
+
}
|
|
458415
458652
|
const symbols2 = await client.documentSymbol(uri);
|
|
458416
|
-
await client.closeDocument(uri);
|
|
458417
458653
|
return symbols2;
|
|
458418
458654
|
} catch (error40) {
|
|
458419
458655
|
console.debug("LSP documentSymbol error:", error40);
|
|
458420
458656
|
return null;
|
|
458657
|
+
} finally {
|
|
458658
|
+
if (uri) {
|
|
458659
|
+
try {
|
|
458660
|
+
await client.closeDocument(uri);
|
|
458661
|
+
} catch {
|
|
458662
|
+
}
|
|
458663
|
+
}
|
|
458421
458664
|
}
|
|
458422
458665
|
}
|
|
458423
458666
|
async getHoverInfo(filePath, line, column) {
|
|
@@ -458429,20 +458672,30 @@ var init_LSPManager = __esm({
|
|
|
458429
458672
|
if (!client) {
|
|
458430
458673
|
return null;
|
|
458431
458674
|
}
|
|
458675
|
+
let uri;
|
|
458432
458676
|
try {
|
|
458433
|
-
|
|
458677
|
+
uri = this.pathToUri(filePath);
|
|
458434
458678
|
const content = await this.getDocumentContent(filePath);
|
|
458435
458679
|
if (!content) {
|
|
458436
458680
|
return null;
|
|
458437
458681
|
}
|
|
458438
458682
|
await client.openDocument(uri, content);
|
|
458683
|
+
if (!client.isReady()) {
|
|
458684
|
+
return null;
|
|
458685
|
+
}
|
|
458439
458686
|
const position = { line, character: column };
|
|
458440
458687
|
const hover = await client.hover(uri, position);
|
|
458441
|
-
await client.closeDocument(uri);
|
|
458442
458688
|
return hover;
|
|
458443
458689
|
} catch (error40) {
|
|
458444
458690
|
console.debug("LSP hover error:", error40);
|
|
458445
458691
|
return null;
|
|
458692
|
+
} finally {
|
|
458693
|
+
if (uri) {
|
|
458694
|
+
try {
|
|
458695
|
+
await client.closeDocument(uri);
|
|
458696
|
+
} catch {
|
|
458697
|
+
}
|
|
458698
|
+
}
|
|
458446
458699
|
}
|
|
458447
458700
|
}
|
|
458448
458701
|
async getDocumentContent(filePath) {
|
|
@@ -458577,6 +458830,8 @@ var init_HybridCodeSearchService = __esm({
|
|
|
458577
458830
|
const timeoutMs = contextFile.endsWith(".cs") ? this.csharpLspTimeout : this.lspTimeout;
|
|
458578
458831
|
const timeoutPromise = new Promise((resolve13) => setTimeout(() => resolve13(null), timeoutMs));
|
|
458579
458832
|
const lspPromise = this.lspManager.findDefinition(contextFile, position.line, position.column);
|
|
458833
|
+
lspPromise.catch(() => {
|
|
458834
|
+
});
|
|
458580
458835
|
const location = await Promise.race([lspPromise, timeoutPromise]);
|
|
458581
458836
|
if (!location) {
|
|
458582
458837
|
return null;
|
|
@@ -458598,6 +458853,8 @@ var init_HybridCodeSearchService = __esm({
|
|
|
458598
458853
|
try {
|
|
458599
458854
|
const timeoutPromise = new Promise((resolve13) => setTimeout(() => resolve13(null), this.lspTimeout));
|
|
458600
458855
|
const lspPromise = this.lspManager.getDocumentSymbols(filePath);
|
|
458856
|
+
lspPromise.catch(() => {
|
|
458857
|
+
});
|
|
458601
458858
|
const symbols2 = await Promise.race([lspPromise, timeoutPromise]);
|
|
458602
458859
|
if (symbols2 && symbols2.length > 0) {
|
|
458603
458860
|
return this.convertLSPSymbolsToCodeSymbols(symbols2, filePath);
|
|
@@ -465822,7 +466079,7 @@ function useCommandHandler(options3) {
|
|
|
465822
466079
|
const { stdout } = use_stdout_default();
|
|
465823
466080
|
const { t } = useI18n();
|
|
465824
466081
|
const handleCommandExecution = (0, import_react27.useCallback)(async (commandName, result2) => {
|
|
465825
|
-
var _a20, _b14;
|
|
466082
|
+
var _a20, _b14, _c6, _d4, _e2;
|
|
465826
466083
|
if (commandName === "compact" && result2.success && result2.action === "compact") {
|
|
465827
466084
|
options3.setIsCompressing(true);
|
|
465828
466085
|
options3.setCompressionError(null);
|
|
@@ -466093,6 +466350,60 @@ function useCommandHandler(options3) {
|
|
|
466093
466350
|
commandName
|
|
466094
466351
|
};
|
|
466095
466352
|
options3.setMessages((prev) => [...prev, commandMessage]);
|
|
466353
|
+
} else if (result2.success && result2.action === "forkSession") {
|
|
466354
|
+
const currentSession = sessionManager.getCurrentSession();
|
|
466355
|
+
if (!currentSession) {
|
|
466356
|
+
const errorMessage = {
|
|
466357
|
+
role: "command",
|
|
466358
|
+
content: ((_c6 = t.commandPanel.commandOutput.branchFork) == null ? void 0 : _c6.noActiveSession) || "No active session to fork.",
|
|
466359
|
+
commandName
|
|
466360
|
+
};
|
|
466361
|
+
options3.setMessages((prev) => [...prev, errorMessage]);
|
|
466362
|
+
return;
|
|
466363
|
+
}
|
|
466364
|
+
try {
|
|
466365
|
+
await sessionManager.saveSession(currentSession);
|
|
466366
|
+
const forkedSession = await sessionManager.createNewSession(false, true);
|
|
466367
|
+
const branchName = result2.prompt || void 0;
|
|
466368
|
+
forkedSession.messages = currentSession.messages.map((msg) => ({
|
|
466369
|
+
...msg
|
|
466370
|
+
}));
|
|
466371
|
+
forkedSession.messageCount = currentSession.messageCount;
|
|
466372
|
+
forkedSession.title = branchName ? `${currentSession.title} [${branchName}]` : currentSession.title;
|
|
466373
|
+
forkedSession.summary = currentSession.summary;
|
|
466374
|
+
forkedSession.branchedFrom = currentSession.id;
|
|
466375
|
+
forkedSession.branchName = branchName;
|
|
466376
|
+
forkedSession.updatedAt = Date.now();
|
|
466377
|
+
await sessionManager.saveSession(forkedSession);
|
|
466378
|
+
try {
|
|
466379
|
+
const { getTodoService: getTodoService2 } = await Promise.resolve().then(() => (init_mcpToolsManager(), mcpToolsManager_exports));
|
|
466380
|
+
const todoService2 = getTodoService2();
|
|
466381
|
+
await todoService2.copyTodoList(currentSession.id, forkedSession.id);
|
|
466382
|
+
} catch {
|
|
466383
|
+
}
|
|
466384
|
+
if (options3.onResumeSessionById) {
|
|
466385
|
+
await options3.onResumeSessionById(forkedSession.id);
|
|
466386
|
+
} else {
|
|
466387
|
+
sessionManager.setCurrentSession(forkedSession);
|
|
466388
|
+
}
|
|
466389
|
+
const displayName = branchName ? `"${branchName}"` : forkedSession.id.slice(0, 8);
|
|
466390
|
+
const originalId = currentSession.id;
|
|
466391
|
+
const successContent = (((_d4 = t.commandPanel.commandOutput.branchFork) == null ? void 0 : _d4.success) || "Conversation forked into branch {name}. To return to the original session:\n/resume {originalId}").replace("{name}", displayName).replace("{originalId}", originalId);
|
|
466392
|
+
const commandMessage = {
|
|
466393
|
+
role: "command",
|
|
466394
|
+
content: successContent,
|
|
466395
|
+
commandName
|
|
466396
|
+
};
|
|
466397
|
+
options3.setMessages((prev) => [...prev, commandMessage]);
|
|
466398
|
+
} catch (error40) {
|
|
466399
|
+
const errorMsg = error40 instanceof Error ? error40.message : "Unknown error";
|
|
466400
|
+
const errorMessage = {
|
|
466401
|
+
role: "command",
|
|
466402
|
+
content: `${((_e2 = t.commandPanel.commandOutput.branchFork) == null ? void 0 : _e2.failed) || "Failed to fork session"}: ${errorMsg}`,
|
|
466403
|
+
commandName
|
|
466404
|
+
};
|
|
466405
|
+
options3.setMessages((prev) => [...prev, errorMessage]);
|
|
466406
|
+
}
|
|
466096
466407
|
} else if (result2.success && result2.action === "showNewPromptPanel") {
|
|
466097
466408
|
options3.setShowNewPromptPanel(true);
|
|
466098
466409
|
} else if (result2.success && result2.action === "showSubAgentDepthPanel") {
|
|
@@ -467655,22 +467966,36 @@ function millisecondsToLabel(intervalMs) {
|
|
|
467655
467966
|
}
|
|
467656
467967
|
return `${intervalMs / 1e3}s`;
|
|
467657
467968
|
}
|
|
467969
|
+
function parseDurationString(durationStr) {
|
|
467970
|
+
const pattern = /(\d+)\s*([a-zA-Z]+)/g;
|
|
467971
|
+
let match;
|
|
467972
|
+
let totalMs = 0;
|
|
467973
|
+
while ((match = pattern.exec(durationStr)) !== null) {
|
|
467974
|
+
const value = Number.parseInt(match[1], 10);
|
|
467975
|
+
const unit = match[2];
|
|
467976
|
+
totalMs += unitToMilliseconds(value, unit);
|
|
467977
|
+
}
|
|
467978
|
+
if (totalMs <= 0) {
|
|
467979
|
+
throw new Error("Invalid duration string.");
|
|
467980
|
+
}
|
|
467981
|
+
return totalMs;
|
|
467982
|
+
}
|
|
467658
467983
|
function formatTimestamp(timestamp) {
|
|
467659
467984
|
return new Date(timestamp).toLocaleString();
|
|
467660
467985
|
}
|
|
467661
467986
|
function parseLoopSchedule(rawArgs) {
|
|
467662
467987
|
const args2 = (rawArgs == null ? void 0 : rawArgs.trim()) || "";
|
|
467663
467988
|
if (!args2) {
|
|
467664
|
-
throw new Error("Usage: /loop 5m <prompt> | /loop <prompt> every 2 hours | /loop list | /loop cancel <id> | /loop tasks");
|
|
467989
|
+
throw new Error("Usage: /loop 5m <prompt> | /loop 8h30m <prompt> | /loop <prompt> every 2 hours | /loop list | /loop cancel <id> | /loop tasks");
|
|
467665
467990
|
}
|
|
467666
|
-
if (
|
|
467991
|
+
if (/^(?:\d+\s*[a-zA-Z]+\s*)+\s*$/.test(args2)) {
|
|
467667
467992
|
throw new Error("Loop prompt is required after the interval.");
|
|
467668
467993
|
}
|
|
467669
|
-
const prefixMatch = args2.match(/^(
|
|
467670
|
-
if ((prefixMatch == null ? void 0 : prefixMatch[1]) && prefixMatch[2]
|
|
467671
|
-
const intervalMs =
|
|
467994
|
+
const prefixMatch = args2.match(/^((?:\d+\s*[a-zA-Z]+\s*)+?)\s+([\s\S]+)$/);
|
|
467995
|
+
if ((prefixMatch == null ? void 0 : prefixMatch[1]) && prefixMatch[2]) {
|
|
467996
|
+
const intervalMs = parseDurationString(prefixMatch[1]);
|
|
467672
467997
|
return {
|
|
467673
|
-
prompt: prefixMatch[
|
|
467998
|
+
prompt: prefixMatch[2].trim(),
|
|
467674
467999
|
intervalMs,
|
|
467675
468000
|
intervalLabel: millisecondsToLabel(intervalMs)
|
|
467676
468001
|
};
|
|
@@ -467847,7 +468172,7 @@ var init_loop = __esm({
|
|
|
467847
468172
|
"use strict";
|
|
467848
468173
|
init_commandExecutor();
|
|
467849
468174
|
init_loopManager();
|
|
467850
|
-
LOOP_USAGE = "Usage: /loop 5m <prompt> | /loop <prompt> every 2 hours | /loop list | /loop cancel <id> | /loop tasks";
|
|
468175
|
+
LOOP_USAGE = "Usage: /loop 5m <prompt> | /loop 8h30m <prompt> | /loop <prompt> every 2 hours | /loop list | /loop cancel <id> | /loop tasks";
|
|
467851
468176
|
registerCommand("loop", {
|
|
467852
468177
|
execute: async (args2) => {
|
|
467853
468178
|
const trimmedArgs = args2 == null ? void 0 : args2.trim();
|
|
@@ -469968,6 +470293,7 @@ var init_utils2 = __esm({
|
|
|
469968
470293
|
init_addDir();
|
|
469969
470294
|
init_agent();
|
|
469970
470295
|
init_backend();
|
|
470296
|
+
init_branch();
|
|
469971
470297
|
init_clear();
|
|
469972
470298
|
init_codebase();
|
|
469973
470299
|
init_compact2();
|
|
@@ -476442,7 +476768,8 @@ var init_types5 = __esm({
|
|
|
476442
476768
|
"geminiThinkingLevel",
|
|
476443
476769
|
"responsesReasoningEffort",
|
|
476444
476770
|
"responsesVerbosity",
|
|
476445
|
-
"anthropicSpeed"
|
|
476771
|
+
"anthropicSpeed",
|
|
476772
|
+
"chatReasoningEffort"
|
|
476446
476773
|
];
|
|
476447
476774
|
isSelectField = (field) => SELECT_FIELDS.includes(field);
|
|
476448
476775
|
}
|
|
@@ -476620,6 +476947,8 @@ function useConfigState() {
|
|
|
476620
476947
|
const [responsesVerbosity, setResponsesVerbosity] = (0, import_react66.useState)("medium");
|
|
476621
476948
|
const [responsesFastMode, setResponsesFastMode] = (0, import_react66.useState)(false);
|
|
476622
476949
|
const [anthropicSpeed, setAnthropicSpeed] = (0, import_react66.useState)(void 0);
|
|
476950
|
+
const [chatThinkingEnabled, setChatThinkingEnabled] = (0, import_react66.useState)(false);
|
|
476951
|
+
const [chatReasoningEffort, setChatReasoningEffort] = (0, import_react66.useState)("high");
|
|
476623
476952
|
const [advancedModel, setAdvancedModel] = (0, import_react66.useState)("");
|
|
476624
476953
|
const [basicModel, setBasicModel] = (0, import_react66.useState)("");
|
|
476625
476954
|
const [maxContextTokens, setMaxContextTokens] = (0, import_react66.useState)(4e3);
|
|
@@ -476683,6 +477012,9 @@ function useConfigState() {
|
|
|
476683
477012
|
"responsesReasoningEffort",
|
|
476684
477013
|
"responsesVerbosity",
|
|
476685
477014
|
"responsesFastMode"
|
|
477015
|
+
] : requestMethod === "chat" ? [
|
|
477016
|
+
"chatThinkingEnabled",
|
|
477017
|
+
...chatThinkingEnabled ? ["chatReasoningEffort"] : []
|
|
476686
477018
|
] : [],
|
|
476687
477019
|
"advancedModel",
|
|
476688
477020
|
"basicModel",
|
|
@@ -476730,6 +477062,9 @@ function useConfigState() {
|
|
|
476730
477062
|
if (requestMethod !== "responses" && (currentField === "responsesReasoningEnabled" || currentField === "responsesReasoningEffort" || currentField === "responsesVerbosity" || currentField === "responsesFastMode")) {
|
|
476731
477063
|
setCurrentField("advancedModel");
|
|
476732
477064
|
}
|
|
477065
|
+
if (requestMethod !== "chat" && (currentField === "chatThinkingEnabled" || currentField === "chatReasoningEffort")) {
|
|
477066
|
+
setCurrentField("advancedModel");
|
|
477067
|
+
}
|
|
476733
477068
|
}, [requestMethod, currentField]);
|
|
476734
477069
|
(0, import_react66.useEffect)(() => {
|
|
476735
477070
|
if (!enableAutoCompress && currentField === "autoCompressThreshold") {
|
|
@@ -476748,7 +477083,7 @@ function useConfigState() {
|
|
|
476748
477083
|
supportsXHigh
|
|
476749
477084
|
]);
|
|
476750
477085
|
const loadProfilesAndConfig = () => {
|
|
476751
|
-
var _a20, _b14, _c6, _d4, _e2, _f, _g, _h, _i;
|
|
477086
|
+
var _a20, _b14, _c6, _d4, _e2, _f, _g, _h, _i, _j, _k;
|
|
476752
477087
|
const loadedProfiles = getAllProfiles();
|
|
476753
477088
|
setProfiles(loadedProfiles);
|
|
476754
477089
|
const config3 = getOpenAiConfig();
|
|
@@ -476774,6 +477109,8 @@ function useConfigState() {
|
|
|
476774
477109
|
setResponsesVerbosity(config3.responsesVerbosity || "medium");
|
|
476775
477110
|
setResponsesFastMode(config3.responsesFastMode || false);
|
|
476776
477111
|
setAnthropicSpeed(config3.anthropicSpeed);
|
|
477112
|
+
setChatThinkingEnabled(((_j = config3.chatThinking) == null ? void 0 : _j.enabled) || false);
|
|
477113
|
+
setChatReasoningEffort(((_k = config3.chatThinking) == null ? void 0 : _k.reasoning_effort) || "high");
|
|
476777
477114
|
setAdvancedModel(config3.advancedModel || "");
|
|
476778
477115
|
setBasicModel(config3.basicModel || "");
|
|
476779
477116
|
setMaxContextTokens(config3.maxContextTokens || 4e3);
|
|
@@ -476856,6 +477193,8 @@ function useConfigState() {
|
|
|
476856
477193
|
return responsesReasoningEffort;
|
|
476857
477194
|
if (currentField === "anthropicSpeed")
|
|
476858
477195
|
return anthropicSpeed || "";
|
|
477196
|
+
if (currentField === "chatReasoningEffort")
|
|
477197
|
+
return chatReasoningEffort;
|
|
476859
477198
|
return "";
|
|
476860
477199
|
};
|
|
476861
477200
|
const getSystemPromptNameById = (id) => {
|
|
@@ -476981,6 +477320,7 @@ function useConfigState() {
|
|
|
476981
477320
|
streamingDisplay,
|
|
476982
477321
|
thinking: thinkingEnabled ? thinkingMode === "adaptive" ? { type: "adaptive", effort: thinkingEffort } : { type: "enabled", budget_tokens: thinkingBudgetTokens } : void 0,
|
|
476983
477322
|
anthropicSpeed,
|
|
477323
|
+
chatThinking: chatThinkingEnabled ? { enabled: true, reasoning_effort: chatReasoningEffort } : void 0,
|
|
476984
477324
|
advancedModel,
|
|
476985
477325
|
basicModel,
|
|
476986
477326
|
maxContextTokens,
|
|
@@ -477125,6 +477465,7 @@ function useConfigState() {
|
|
|
477125
477465
|
config3.responsesFastMode = responsesFastMode;
|
|
477126
477466
|
config3.responsesVerbosity = responsesVerbosity;
|
|
477127
477467
|
config3.anthropicSpeed = anthropicSpeed;
|
|
477468
|
+
config3.chatThinking = chatThinkingEnabled ? { enabled: true, reasoning_effort: chatReasoningEffort } : void 0;
|
|
477128
477469
|
await updateOpenAiConfig(config3);
|
|
477129
477470
|
try {
|
|
477130
477471
|
const fullConfig = {
|
|
@@ -477152,6 +477493,7 @@ function useConfigState() {
|
|
|
477152
477493
|
responsesVerbosity,
|
|
477153
477494
|
responsesFastMode,
|
|
477154
477495
|
anthropicSpeed,
|
|
477496
|
+
chatThinking: chatThinkingEnabled ? { enabled: true, reasoning_effort: chatReasoningEffort } : void 0,
|
|
477155
477497
|
advancedModel,
|
|
477156
477498
|
basicModel,
|
|
477157
477499
|
maxContextTokens,
|
|
@@ -477237,6 +477579,10 @@ function useConfigState() {
|
|
|
477237
477579
|
setResponsesFastMode,
|
|
477238
477580
|
anthropicSpeed,
|
|
477239
477581
|
setAnthropicSpeed,
|
|
477582
|
+
chatThinkingEnabled,
|
|
477583
|
+
setChatThinkingEnabled,
|
|
477584
|
+
chatReasoningEffort,
|
|
477585
|
+
setChatReasoningEffort,
|
|
477240
477586
|
// Model settings
|
|
477241
477587
|
advancedModel,
|
|
477242
477588
|
setAdvancedModel,
|
|
@@ -477559,7 +477905,12 @@ function useConfigInput(state, callbacks) {
|
|
|
477559
477905
|
setShowThinking(false);
|
|
477560
477906
|
} else if (currentField === "responsesFastMode") {
|
|
477561
477907
|
setResponsesFastMode(!responsesFastMode);
|
|
477562
|
-
} else if (currentField === "
|
|
477908
|
+
} else if (currentField === "chatThinkingEnabled") {
|
|
477909
|
+
const next = !state.chatThinkingEnabled;
|
|
477910
|
+
state.setChatThinkingEnabled(next);
|
|
477911
|
+
if (!next)
|
|
477912
|
+
setShowThinking(false);
|
|
477913
|
+
} else if (currentField === "anthropicCacheTTL" || currentField === "anthropicSpeed" || currentField === "thinkingMode" || currentField === "thinkingEffort" || currentField === "geminiThinkingLevel" || currentField === "responsesReasoningEffort" || currentField === "responsesVerbosity" || currentField === "chatReasoningEffort") {
|
|
477563
477914
|
setIsEditing(true);
|
|
477564
477915
|
} else if (currentField === "maxContextTokens" || currentField === "maxTokens" || currentField === "streamIdleTimeoutSec" || currentField === "toolResultTokenLimit" || currentField === "thinkingBudgetTokens" || currentField === "autoCompressThreshold") {
|
|
477565
477916
|
setIsEditing(true);
|
|
@@ -477927,6 +478278,8 @@ function ConfigFieldRenderer({ field, state }) {
|
|
|
477927
478278
|
responsesVerbosity,
|
|
477928
478279
|
setResponsesVerbosity,
|
|
477929
478280
|
responsesFastMode,
|
|
478281
|
+
chatThinkingEnabled,
|
|
478282
|
+
chatReasoningEffort,
|
|
477930
478283
|
supportsXHigh,
|
|
477931
478284
|
// Model settings
|
|
477932
478285
|
advancedModel,
|
|
@@ -478529,6 +478882,44 @@ function ConfigFieldRenderer({ field, state }) {
|
|
|
478529
478882
|
)
|
|
478530
478883
|
)
|
|
478531
478884
|
);
|
|
478885
|
+
case "chatThinkingEnabled":
|
|
478886
|
+
return import_react69.default.createElement(
|
|
478887
|
+
Box_default,
|
|
478888
|
+
{ key: field, flexDirection: "column" },
|
|
478889
|
+
import_react69.default.createElement(
|
|
478890
|
+
Text,
|
|
478891
|
+
{ color: activeColor },
|
|
478892
|
+
activeIndicator,
|
|
478893
|
+
t.configScreen.chatThinkingEnabled
|
|
478894
|
+
),
|
|
478895
|
+
import_react69.default.createElement(
|
|
478896
|
+
Box_default,
|
|
478897
|
+
{ marginLeft: 3 },
|
|
478898
|
+
import_react69.default.createElement(
|
|
478899
|
+
Text,
|
|
478900
|
+
{ color: theme14.colors.menuSecondary },
|
|
478901
|
+
chatThinkingEnabled ? t.configScreen.enabled : t.configScreen.disabled,
|
|
478902
|
+
" ",
|
|
478903
|
+
t.configScreen.toggleHint
|
|
478904
|
+
)
|
|
478905
|
+
)
|
|
478906
|
+
);
|
|
478907
|
+
case "chatReasoningEffort":
|
|
478908
|
+
return import_react69.default.createElement(
|
|
478909
|
+
Box_default,
|
|
478910
|
+
{ key: field, flexDirection: "column" },
|
|
478911
|
+
import_react69.default.createElement(
|
|
478912
|
+
Text,
|
|
478913
|
+
{ color: activeColor },
|
|
478914
|
+
activeIndicator,
|
|
478915
|
+
t.configScreen.chatReasoningEffort
|
|
478916
|
+
),
|
|
478917
|
+
!isCurrentlyEditing && import_react69.default.createElement(
|
|
478918
|
+
Box_default,
|
|
478919
|
+
{ marginLeft: 3 },
|
|
478920
|
+
import_react69.default.createElement(Text, { color: theme14.colors.menuSecondary }, chatReasoningEffort.toUpperCase())
|
|
478921
|
+
)
|
|
478922
|
+
);
|
|
478532
478923
|
case "advancedModel":
|
|
478533
478924
|
return import_react69.default.createElement(
|
|
478534
478925
|
Box_default,
|
|
@@ -478653,7 +479044,7 @@ var init_ConfigFieldRenderer = __esm({
|
|
|
478653
479044
|
|
|
478654
479045
|
// dist/ui/pages/configScreen/ConfigSelectPanel.js
|
|
478655
479046
|
function ConfigSelectPanel({ state }) {
|
|
478656
|
-
const { t, theme: theme14, currentField, setIsEditing, requestMethod, setRequestMethod, requestMethodOptions, thinkingMode, setThinkingMode, thinkingEffort, setThinkingEffort, geminiThinkingLevel, setGeminiThinkingLevel, responsesVerbosity, setResponsesVerbosity, anthropicSpeed, setAnthropicSpeed, getCustomHeadersSchemeSelectItems, getCustomHeadersSchemeSelectedValue, applyCustomHeadersSchemeSelectValue } = state;
|
|
479047
|
+
const { t, theme: theme14, currentField, setIsEditing, requestMethod, setRequestMethod, requestMethodOptions, thinkingMode, setThinkingMode, thinkingEffort, setThinkingEffort, geminiThinkingLevel, setGeminiThinkingLevel, responsesVerbosity, setResponsesVerbosity, anthropicSpeed, setAnthropicSpeed, chatReasoningEffort, setChatReasoningEffort, getCustomHeadersSchemeSelectItems, getCustomHeadersSchemeSelectedValue, applyCustomHeadersSchemeSelectValue } = state;
|
|
478657
479048
|
const getFieldLabel = () => {
|
|
478658
479049
|
switch (currentField) {
|
|
478659
479050
|
case "profile":
|
|
@@ -478676,6 +479067,8 @@ function ConfigSelectPanel({ state }) {
|
|
|
478676
479067
|
return t.configScreen.responsesVerbosity.replace(":", "");
|
|
478677
479068
|
case "anthropicSpeed":
|
|
478678
479069
|
return t.configScreen.anthropicSpeed.replace(":", "");
|
|
479070
|
+
case "chatReasoningEffort":
|
|
479071
|
+
return t.configScreen.chatReasoningEffort.replace(":", "");
|
|
478679
479072
|
case "systemPromptId":
|
|
478680
479073
|
return t.configScreen.systemPrompt;
|
|
478681
479074
|
case "customHeadersSchemeId":
|
|
@@ -478752,6 +479145,15 @@ function ConfigSelectPanel({ state }) {
|
|
|
478752
479145
|
setResponsesVerbosity(item.value);
|
|
478753
479146
|
setIsEditing(false);
|
|
478754
479147
|
} }),
|
|
479148
|
+
currentField === "chatReasoningEffort" && import_react70.default.createElement(ScrollableSelectInput, { items: [
|
|
479149
|
+
{ label: "LOW", value: "low" },
|
|
479150
|
+
{ label: "MEDIUM", value: "medium" },
|
|
479151
|
+
{ label: "HIGH", value: "high" },
|
|
479152
|
+
{ label: "MAX", value: "max" }
|
|
479153
|
+
], initialIndex: Math.max(0, ["low", "medium", "high", "max"].indexOf(chatReasoningEffort)), isFocused: true, onSelect: (item) => {
|
|
479154
|
+
setChatReasoningEffort(item.value);
|
|
479155
|
+
setIsEditing(false);
|
|
479156
|
+
} }),
|
|
478755
479157
|
currentField === "anthropicSpeed" && import_react70.default.createElement(ScrollableSelectInput, { items: [
|
|
478756
479158
|
{ label: t.configScreen.anthropicSpeedNotUsed, value: "__NONE__" },
|
|
478757
479159
|
{ label: t.configScreen.anthropicSpeedFast, value: "fast" },
|
|
@@ -562541,6 +562943,10 @@ function useCommandPanel(buffer, isProcessing = false) {
|
|
|
562541
562943
|
const teammates = (0, import_react93.useSyncExternalStore)(subscribeToTeamTracker, getTeamSnapshot);
|
|
562542
562944
|
const hasRunningAgentsOrTeam = subAgents.length > 0 || teammates.length > 0;
|
|
562543
562945
|
const builtInCommands = (0, import_react93.useMemo)(() => [
|
|
562946
|
+
{
|
|
562947
|
+
name: "branch",
|
|
562948
|
+
description: t.commandPanel.commands.branch || "Fork current conversation into a new branch"
|
|
562949
|
+
},
|
|
562544
562950
|
{ name: "help", description: t.commandPanel.commands.help },
|
|
562545
562951
|
{ name: "clear", description: t.commandPanel.commands.clear },
|
|
562546
562952
|
{
|
|
@@ -562813,6 +563219,8 @@ var init_useCommandPanel = __esm({
|
|
|
562813
563219
|
subscribeToTeamTracker = (cb2) => teamTracker.subscribe(cb2);
|
|
562814
563220
|
getTeamSnapshot = () => teamTracker.getRunningTeammates();
|
|
562815
563221
|
COMMAND_ARGS_HINTS = {
|
|
563222
|
+
branch: "[name]",
|
|
563223
|
+
fork: "[name]",
|
|
562816
563224
|
resume: "[sessionId]",
|
|
562817
563225
|
reindex: "[-force]",
|
|
562818
563226
|
codebase: "[on|off|status]",
|
|
@@ -565973,7 +566381,8 @@ ${selfDestruct.suggestion}`,
|
|
|
565973
566381
|
}
|
|
565974
566382
|
const result2 = await executeCommand2(cmd.command, cmd.timeout || 3e4);
|
|
565975
566383
|
results.push(result2);
|
|
565976
|
-
const
|
|
566384
|
+
const successOutput = [result2.stdout, result2.stderr].filter(Boolean).join("\n");
|
|
566385
|
+
const output2 = result2.success ? successOutput || "(no output)" : (() => {
|
|
565977
566386
|
const lines = [];
|
|
565978
566387
|
lines.push("Command execution failed.");
|
|
565979
566388
|
if (typeof result2.exitCode === "number") {
|
|
@@ -570096,7 +570505,7 @@ function TodoTree({ todos }) {
|
|
|
570096
570505
|
setPageIndex((p) => Math.min(p, pageCount - 1));
|
|
570097
570506
|
}, [pageCount]);
|
|
570098
570507
|
use_input_default((_input, key) => {
|
|
570099
|
-
if (!key.tab || pageCount <= 1)
|
|
570508
|
+
if (!key.tab || key.shift || pageCount <= 1)
|
|
570100
570509
|
return;
|
|
570101
570510
|
setPageIndex((p) => (p + 1) % pageCount);
|
|
570102
570511
|
});
|
|
@@ -573961,6 +574370,44 @@ function ToolConfirmation({ toolName, toolArguments, allTools, onConfirm, onHook
|
|
|
573961
574370
|
if (!vscodeConnection.isConnected()) {
|
|
573962
574371
|
return;
|
|
573963
574372
|
}
|
|
574373
|
+
const computeHashlinePreview = (originalContent, operations) => {
|
|
574374
|
+
if (!Array.isArray(operations) || operations.length === 0) {
|
|
574375
|
+
return originalContent;
|
|
574376
|
+
}
|
|
574377
|
+
const mutableLines = originalContent.split("\n");
|
|
574378
|
+
const parsed = operations.map((op2) => {
|
|
574379
|
+
const startMatch = String(op2.startAnchor ?? "").match(/^(\d+):/);
|
|
574380
|
+
const endMatch = String(op2.endAnchor ?? "").match(/^(\d+):/);
|
|
574381
|
+
return {
|
|
574382
|
+
type: op2.type,
|
|
574383
|
+
content: op2.content ?? "",
|
|
574384
|
+
startLine: startMatch ? parseInt(startMatch[1], 10) : 0,
|
|
574385
|
+
endLine: endMatch ? parseInt(endMatch[1], 10) : 0
|
|
574386
|
+
};
|
|
574387
|
+
}).filter((op2) => op2.startLine > 0 && op2.endLine > 0).sort((a, b) => b.startLine - a.startLine);
|
|
574388
|
+
for (const op2 of parsed) {
|
|
574389
|
+
const newLines = op2.content.split("\n");
|
|
574390
|
+
switch (op2.type) {
|
|
574391
|
+
case "replace":
|
|
574392
|
+
mutableLines.splice(op2.startLine - 1, op2.endLine - op2.startLine + 1, ...newLines);
|
|
574393
|
+
break;
|
|
574394
|
+
case "insert_after":
|
|
574395
|
+
mutableLines.splice(op2.startLine, 0, ...newLines);
|
|
574396
|
+
break;
|
|
574397
|
+
case "delete":
|
|
574398
|
+
mutableLines.splice(op2.startLine - 1, op2.endLine - op2.startLine + 1);
|
|
574399
|
+
break;
|
|
574400
|
+
}
|
|
574401
|
+
}
|
|
574402
|
+
return mutableLines.join("\n");
|
|
574403
|
+
};
|
|
574404
|
+
const computeReplaceEditPreview = (originalContent, searchContent, replaceContent) => {
|
|
574405
|
+
const idx = originalContent.indexOf(searchContent);
|
|
574406
|
+
if (idx !== -1) {
|
|
574407
|
+
return originalContent.substring(0, idx) + replaceContent + originalContent.substring(idx + searchContent.length);
|
|
574408
|
+
}
|
|
574409
|
+
return originalContent;
|
|
574410
|
+
};
|
|
573964
574411
|
const showDiffForTool = (name, args2) => {
|
|
573965
574412
|
const promises2 = [];
|
|
573966
574413
|
try {
|
|
@@ -573969,7 +574416,8 @@ function ToolConfirmation({ toolName, toolArguments, allTools, onConfirm, onHook
|
|
|
573969
574416
|
const filePath = typeof parsed.filePath === "string" ? parsed.filePath : null;
|
|
573970
574417
|
if (filePath && fs56.existsSync(filePath)) {
|
|
573971
574418
|
const originalContent = fs56.readFileSync(filePath, "utf-8");
|
|
573972
|
-
|
|
574419
|
+
const newContent = computeHashlinePreview(originalContent, parsed.operations);
|
|
574420
|
+
promises2.push(vscodeConnection.showDiff(filePath, originalContent, newContent, "Hashline Edit").catch(() => {
|
|
573973
574421
|
}));
|
|
573974
574422
|
}
|
|
573975
574423
|
}
|
|
@@ -573977,7 +574425,8 @@ function ToolConfirmation({ toolName, toolArguments, allTools, onConfirm, onHook
|
|
|
573977
574425
|
const filePath = typeof parsed.filePath === "string" ? parsed.filePath : null;
|
|
573978
574426
|
if (filePath && fs56.existsSync(filePath)) {
|
|
573979
574427
|
const originalContent = fs56.readFileSync(filePath, "utf-8");
|
|
573980
|
-
|
|
574428
|
+
const newContent = parsed.searchContent && parsed.replaceContent !== void 0 ? computeReplaceEditPreview(originalContent, parsed.searchContent, parsed.replaceContent) : originalContent;
|
|
574429
|
+
promises2.push(vscodeConnection.showDiff(filePath, originalContent, newContent, "Replace Edit").catch(() => {
|
|
573981
574430
|
}));
|
|
573982
574431
|
}
|
|
573983
574432
|
}
|
|
@@ -577885,8 +578334,11 @@ var init_ModelsPanel = __esm({
|
|
|
577885
578334
|
const [isVerbositySelecting, setIsVerbositySelecting] = (0, import_react156.useState)(false);
|
|
577886
578335
|
const [anthropicSpeed, setAnthropicSpeed] = (0, import_react156.useState)(void 0);
|
|
577887
578336
|
const [isSpeedSelecting, setIsSpeedSelecting] = (0, import_react156.useState)(false);
|
|
578337
|
+
const [chatThinkingEnabled, setChatThinkingEnabled] = (0, import_react156.useState)(false);
|
|
578338
|
+
const [chatReasoningEffort, setChatReasoningEffort] = (0, import_react156.useState)("high");
|
|
578339
|
+
const [isChatEffortSelecting, setIsChatEffortSelecting] = (0, import_react156.useState)(false);
|
|
577888
578340
|
(0, import_react156.useEffect)(() => {
|
|
577889
|
-
var _a20, _b14, _c6, _d4, _e2, _f, _g, _h, _i;
|
|
578341
|
+
var _a20, _b14, _c6, _d4, _e2, _f, _g, _h, _i, _j, _k;
|
|
577890
578342
|
if (!visible) {
|
|
577891
578343
|
return;
|
|
577892
578344
|
}
|
|
@@ -577923,6 +578375,9 @@ var init_ModelsPanel = __esm({
|
|
|
577923
578375
|
setResponsesFastMode(cfg.responsesFastMode || false);
|
|
577924
578376
|
setResponsesVerbosity(cfg.responsesVerbosity || "medium");
|
|
577925
578377
|
setAnthropicSpeed(cfg.anthropicSpeed);
|
|
578378
|
+
setChatThinkingEnabled(((_j = cfg.chatThinking) == null ? void 0 : _j.enabled) || false);
|
|
578379
|
+
setChatReasoningEffort(((_k = cfg.chatThinking) == null ? void 0 : _k.reasoning_effort) || "high");
|
|
578380
|
+
setIsChatEffortSelecting(false);
|
|
577926
578381
|
}, [visible, advancedModel, basicModel]);
|
|
577927
578382
|
(0, import_react156.useEffect)(() => {
|
|
577928
578383
|
if (errorMessage) {
|
|
@@ -578023,12 +578478,16 @@ var init_ModelsPanel = __esm({
|
|
|
578023
578478
|
if (requestMethod === "responses") {
|
|
578024
578479
|
return responsesReasoningEnabled;
|
|
578025
578480
|
}
|
|
578481
|
+
if (requestMethod === "chat") {
|
|
578482
|
+
return chatThinkingEnabled;
|
|
578483
|
+
}
|
|
578026
578484
|
return false;
|
|
578027
578485
|
}, [
|
|
578028
578486
|
requestMethod,
|
|
578029
578487
|
thinkingEnabled,
|
|
578030
578488
|
geminiThinkingEnabled,
|
|
578031
|
-
responsesReasoningEnabled
|
|
578489
|
+
responsesReasoningEnabled,
|
|
578490
|
+
chatThinkingEnabled
|
|
578032
578491
|
]);
|
|
578033
578492
|
const thinkingStrengthValue = (0, import_react156.useMemo)(() => {
|
|
578034
578493
|
if (requestMethod === "anthropic") {
|
|
@@ -578040,6 +578499,9 @@ var init_ModelsPanel = __esm({
|
|
|
578040
578499
|
if (requestMethod === "responses") {
|
|
578041
578500
|
return responsesReasoningEffort;
|
|
578042
578501
|
}
|
|
578502
|
+
if (requestMethod === "chat") {
|
|
578503
|
+
return chatReasoningEffort.toUpperCase();
|
|
578504
|
+
}
|
|
578043
578505
|
return t.modelsPanel.notSupported;
|
|
578044
578506
|
}, [
|
|
578045
578507
|
requestMethod,
|
|
@@ -578048,6 +578510,7 @@ var init_ModelsPanel = __esm({
|
|
|
578048
578510
|
thinkingEffort,
|
|
578049
578511
|
geminiThinkingLevel,
|
|
578050
578512
|
responsesReasoningEffort,
|
|
578513
|
+
chatReasoningEffort,
|
|
578051
578514
|
t
|
|
578052
578515
|
]);
|
|
578053
578516
|
const applyShowThinking = (0, import_react156.useCallback)(async (next) => {
|
|
@@ -578099,6 +578562,10 @@ var init_ModelsPanel = __esm({
|
|
|
578099
578562
|
});
|
|
578100
578563
|
return;
|
|
578101
578564
|
}
|
|
578565
|
+
if (requestMethod === "chat") {
|
|
578566
|
+
void applyChatThinkingEnabled(next);
|
|
578567
|
+
return;
|
|
578568
|
+
}
|
|
578102
578569
|
setErrorMessage(t.modelsPanel.requestMethodNotSupportedForThinking.replace("{requestMethod}", requestMethod));
|
|
578103
578570
|
} catch (err) {
|
|
578104
578571
|
const message = err instanceof Error ? err.message : t.modelsPanel.saveFailed;
|
|
@@ -578188,6 +578655,38 @@ var init_ModelsPanel = __esm({
|
|
|
578188
578655
|
setErrorMessage(message);
|
|
578189
578656
|
}
|
|
578190
578657
|
}, []);
|
|
578658
|
+
const applyChatThinkingEnabled = (0, import_react156.useCallback)(async (next) => {
|
|
578659
|
+
setErrorMessage("");
|
|
578660
|
+
try {
|
|
578661
|
+
if (!next && showThinking) {
|
|
578662
|
+
setShowThinking(false);
|
|
578663
|
+
await updateOpenAiConfig({ showThinking: false });
|
|
578664
|
+
configEvents.emitConfigChange({ type: "showThinking", value: false });
|
|
578665
|
+
}
|
|
578666
|
+
setChatThinkingEnabled(next);
|
|
578667
|
+
await updateOpenAiConfig({
|
|
578668
|
+
chatThinking: next ? { enabled: true, reasoning_effort: chatReasoningEffort } : void 0
|
|
578669
|
+
});
|
|
578670
|
+
} catch (err) {
|
|
578671
|
+
const message = err instanceof Error ? err.message : t.modelsPanel.saveFailed;
|
|
578672
|
+
setErrorMessage(message);
|
|
578673
|
+
}
|
|
578674
|
+
}, [showThinking, chatReasoningEffort]);
|
|
578675
|
+
const applyChatReasoningEffort = (0, import_react156.useCallback)(async (effort) => {
|
|
578676
|
+
setErrorMessage("");
|
|
578677
|
+
try {
|
|
578678
|
+
setChatReasoningEffort(effort);
|
|
578679
|
+
await updateOpenAiConfig({
|
|
578680
|
+
chatThinking: {
|
|
578681
|
+
enabled: chatThinkingEnabled,
|
|
578682
|
+
reasoning_effort: effort
|
|
578683
|
+
}
|
|
578684
|
+
});
|
|
578685
|
+
} catch (err) {
|
|
578686
|
+
const message = err instanceof Error ? err.message : t.modelsPanel.saveFailed;
|
|
578687
|
+
setErrorMessage(message);
|
|
578688
|
+
}
|
|
578689
|
+
}, [chatThinkingEnabled]);
|
|
578191
578690
|
const applyAnthropicSpeed = (0, import_react156.useCallback)(async (next) => {
|
|
578192
578691
|
setErrorMessage("");
|
|
578193
578692
|
try {
|
|
@@ -578219,6 +578718,8 @@ var init_ModelsPanel = __esm({
|
|
|
578219
578718
|
return 4;
|
|
578220
578719
|
if (requestMethod === "gemini")
|
|
578221
578720
|
return 2;
|
|
578721
|
+
if (requestMethod === "chat")
|
|
578722
|
+
return 2;
|
|
578222
578723
|
return 1;
|
|
578223
578724
|
}, [requestMethod]);
|
|
578224
578725
|
const selectedIndex = Math.max(0, currentOptions.findIndex((option) => option.value === currentModel));
|
|
@@ -578253,6 +578754,10 @@ var init_ModelsPanel = __esm({
|
|
|
578253
578754
|
setIsSpeedSelecting(false);
|
|
578254
578755
|
return;
|
|
578255
578756
|
}
|
|
578757
|
+
if (isChatEffortSelecting) {
|
|
578758
|
+
setIsChatEffortSelecting(false);
|
|
578759
|
+
return;
|
|
578760
|
+
}
|
|
578256
578761
|
if (manualInputModeRef.current || manualInputMode) {
|
|
578257
578762
|
manualInputModeRef.current = false;
|
|
578258
578763
|
setManualInputMode(false);
|
|
@@ -578320,7 +578825,7 @@ var init_ModelsPanel = __esm({
|
|
|
578320
578825
|
}
|
|
578321
578826
|
return;
|
|
578322
578827
|
}
|
|
578323
|
-
if (isThinkingModeSelecting || isGeminiLevelSelecting || isThinkingEffortSelecting || isVerbositySelecting || isSpeedSelecting) {
|
|
578828
|
+
if (isThinkingModeSelecting || isGeminiLevelSelecting || isThinkingEffortSelecting || isVerbositySelecting || isSpeedSelecting || isChatEffortSelecting) {
|
|
578324
578829
|
return;
|
|
578325
578830
|
}
|
|
578326
578831
|
if (key.tab) {
|
|
@@ -578348,6 +578853,8 @@ var init_ModelsPanel = __esm({
|
|
|
578348
578853
|
setIsGeminiLevelSelecting(true);
|
|
578349
578854
|
} else if (requestMethod === "responses") {
|
|
578350
578855
|
setIsThinkingEffortSelecting(true);
|
|
578856
|
+
} else if (requestMethod === "chat") {
|
|
578857
|
+
setIsChatEffortSelecting(true);
|
|
578351
578858
|
}
|
|
578352
578859
|
} else if (thinkingFocusIndex === 3) {
|
|
578353
578860
|
if (requestMethod === "anthropic") {
|
|
@@ -578454,7 +578961,7 @@ var init_ModelsPanel = __esm({
|
|
|
578454
578961
|
showThinking ? "[\u2713]" : "[ ]"
|
|
578455
578962
|
)
|
|
578456
578963
|
),
|
|
578457
|
-
(requestMethod === "anthropic" || requestMethod === "gemini" || requestMethod === "responses") && import_react156.default.createElement(
|
|
578964
|
+
(requestMethod === "anthropic" || requestMethod === "gemini" || requestMethod === "responses" || requestMethod === "chat") && import_react156.default.createElement(
|
|
578458
578965
|
Box_default,
|
|
578459
578966
|
null,
|
|
578460
578967
|
import_react156.default.createElement(
|
|
@@ -578486,7 +578993,7 @@ var init_ModelsPanel = __esm({
|
|
|
578486
578993
|
thinkingMode === "tokens" ? t.configScreen.thinkingModeTokens : t.configScreen.thinkingModeAdaptive
|
|
578487
578994
|
)
|
|
578488
578995
|
),
|
|
578489
|
-
(requestMethod === "anthropic" || requestMethod === "gemini" || requestMethod === "responses") && import_react156.default.createElement(
|
|
578996
|
+
(requestMethod === "anthropic" || requestMethod === "gemini" || requestMethod === "responses" || requestMethod === "chat") && import_react156.default.createElement(
|
|
578490
578997
|
Box_default,
|
|
578491
578998
|
null,
|
|
578492
578999
|
import_react156.default.createElement(
|
|
@@ -578647,7 +579154,20 @@ var init_ModelsPanel = __esm({
|
|
|
578647
579154
|
setIsSpeedSelecting(false);
|
|
578648
579155
|
} })
|
|
578649
579156
|
),
|
|
578650
|
-
|
|
579157
|
+
isChatEffortSelecting && import_react156.default.createElement(
|
|
579158
|
+
Box_default,
|
|
579159
|
+
{ marginTop: 1 },
|
|
579160
|
+
import_react156.default.createElement(ScrollableSelectInput, { items: [
|
|
579161
|
+
{ label: "LOW", value: "low" },
|
|
579162
|
+
{ label: "MEDIUM", value: "medium" },
|
|
579163
|
+
{ label: "HIGH", value: "high" },
|
|
579164
|
+
{ label: "MAX", value: "max" }
|
|
579165
|
+
], limit: 6, disableNumberShortcuts: true, initialIndex: Math.max(0, ["low", "medium", "high", "max"].indexOf(chatReasoningEffort)), isFocused: true, onSelect: (item) => {
|
|
579166
|
+
void applyChatReasoningEffort(item.value);
|
|
579167
|
+
setIsChatEffortSelecting(false);
|
|
579168
|
+
} })
|
|
579169
|
+
),
|
|
579170
|
+
!thinkingInputMode && !isThinkingModeSelecting && !isGeminiLevelSelecting && !isThinkingEffortSelecting && !isVerbositySelecting && !isSpeedSelecting && !isChatEffortSelecting && import_react156.default.createElement(
|
|
578651
579171
|
Box_default,
|
|
578652
579172
|
{ marginTop: 1 },
|
|
578653
579173
|
import_react156.default.createElement(Text, { dimColor: true, color: theme14.colors.menuSecondary }, t.modelsPanel.navigationHint)
|
|
@@ -584288,6 +584808,7 @@ function useChatScreenCommands(workingDirectory) {
|
|
|
584288
584808
|
Promise.resolve().then(() => (init_codebase(), codebase_exports)),
|
|
584289
584809
|
Promise.resolve().then(() => (init_addDir(), addDir_exports)),
|
|
584290
584810
|
Promise.resolve().then(() => (init_permissions(), permissions_exports)),
|
|
584811
|
+
Promise.resolve().then(() => (init_branch(), branch_exports)),
|
|
584291
584812
|
Promise.resolve().then(() => (init_backend(), backend_exports)),
|
|
584292
584813
|
Promise.resolve().then(() => (init_loop(), loop_exports)),
|
|
584293
584814
|
Promise.resolve().then(() => (init_models(), models_exports)),
|
|
@@ -585060,6 +585581,13 @@ function ChatScreen({ autoResume, resumeSessionId: resumeSessionId2, enableYolo,
|
|
|
585060
585581
|
setInputDraftContent(null);
|
|
585061
585582
|
}
|
|
585062
585583
|
}, [shouldShowFooter, setInputDraftContent]);
|
|
585584
|
+
const remountKeyRef = (0, import_react179.useRef)(remountKey);
|
|
585585
|
+
(0, import_react179.useEffect)(() => {
|
|
585586
|
+
if (remountKey !== remountKeyRef.current) {
|
|
585587
|
+
remountKeyRef.current = remountKey;
|
|
585588
|
+
setInputDraftContent(null);
|
|
585589
|
+
}
|
|
585590
|
+
}, [remountKey, setInputDraftContent]);
|
|
585063
585591
|
const footerContextUsage = streamingState.contextUsage ? {
|
|
585064
585592
|
inputTokens: streamingState.contextUsage.prompt_tokens,
|
|
585065
585593
|
maxContextTokens: getOpenAiConfig().maxContextTokens || 4e3,
|
|
@@ -601779,7 +602307,7 @@ var require_package3 = __commonJS({
|
|
|
601779
602307
|
"package.json"(exports2, module2) {
|
|
601780
602308
|
module2.exports = {
|
|
601781
602309
|
name: "snow-ai",
|
|
601782
|
-
version: "0.7.
|
|
602310
|
+
version: "0.7.16",
|
|
601783
602311
|
description: "Agentic coding in your terminal",
|
|
601784
602312
|
license: "MIT",
|
|
601785
602313
|
bin: {
|
|
@@ -603281,6 +603809,28 @@ process.emitWarning = function(warning, ...args2) {
|
|
|
603281
603809
|
return;
|
|
603282
603810
|
return originalEmitWarning.apply(process, [warning, ...args2]);
|
|
603283
603811
|
};
|
|
603812
|
+
function isStreamDestroyedError(err) {
|
|
603813
|
+
if (!(err instanceof Error))
|
|
603814
|
+
return false;
|
|
603815
|
+
const code = err.code;
|
|
603816
|
+
if (code === "ERR_STREAM_DESTROYED" || code === "EPIPE")
|
|
603817
|
+
return true;
|
|
603818
|
+
const msg = err.message || "";
|
|
603819
|
+
return msg.includes("stream was destroyed") || msg.includes("ERR_STREAM_DESTROYED") || msg.includes("write after end") || msg.includes("Cannot call write after a stream was destroyed");
|
|
603820
|
+
}
|
|
603821
|
+
process.on("uncaughtException", (err) => {
|
|
603822
|
+
if (isStreamDestroyedError(err)) {
|
|
603823
|
+
return;
|
|
603824
|
+
}
|
|
603825
|
+
console.error("Uncaught Exception:", err);
|
|
603826
|
+
process.exit(1);
|
|
603827
|
+
});
|
|
603828
|
+
process.on("unhandledRejection", (reason) => {
|
|
603829
|
+
if (isStreamDestroyedError(reason)) {
|
|
603830
|
+
return;
|
|
603831
|
+
}
|
|
603832
|
+
console.error("Unhandled Rejection:", reason);
|
|
603833
|
+
});
|
|
603284
603834
|
var args = process.argv.slice(2);
|
|
603285
603835
|
var isQuickCommand = args.some((arg) => arg === "--version" || arg === "-v" || arg === "--help" || arg === "-h" || arg === "--acp" || arg === "--sse" || arg === "--sse-daemon");
|
|
603286
603836
|
if (!isQuickCommand) {
|