snow-ai 0.6.41 → 0.6.42
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 +192 -26
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/cli.mjs
CHANGED
|
@@ -46302,6 +46302,22 @@ var init_compact = __esm({
|
|
|
46302
46302
|
}
|
|
46303
46303
|
});
|
|
46304
46304
|
|
|
46305
|
+
// dist/utils/commands/copyLast.js
|
|
46306
|
+
var init_copyLast = __esm({
|
|
46307
|
+
"dist/utils/commands/copyLast.js"() {
|
|
46308
|
+
"use strict";
|
|
46309
|
+
init_commandExecutor();
|
|
46310
|
+
registerCommand("copy-last", {
|
|
46311
|
+
execute: () => {
|
|
46312
|
+
return {
|
|
46313
|
+
success: true,
|
|
46314
|
+
action: "copyLastMessage"
|
|
46315
|
+
};
|
|
46316
|
+
}
|
|
46317
|
+
});
|
|
46318
|
+
}
|
|
46319
|
+
});
|
|
46320
|
+
|
|
46305
46321
|
// dist/utils/commands/custom.js
|
|
46306
46322
|
var custom_exports = {};
|
|
46307
46323
|
__export(custom_exports, {
|
|
@@ -71646,7 +71662,7 @@ async function* createStreamingChatCompletion(options3, abortSignal, onRetry) {
|
|
|
71646
71662
|
}
|
|
71647
71663
|
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
71648
71664
|
yield* withRetryGenerator(async function* () {
|
|
71649
|
-
var _a21, _b14, _c6, _d4, _e2, _f;
|
|
71665
|
+
var _a21, _b14, _c6, _d4, _e2, _f, _g;
|
|
71650
71666
|
const requestBody = {
|
|
71651
71667
|
model: options3.model || config3.advancedModel,
|
|
71652
71668
|
messages: convertToOpenAIMessages(
|
|
@@ -71714,11 +71730,14 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
71714
71730
|
cached_tokens: (_a21 = usageValue.prompt_tokens_details) == null ? void 0 : _a21.cached_tokens
|
|
71715
71731
|
};
|
|
71716
71732
|
}
|
|
71717
|
-
const choice = chunk2.choices[0];
|
|
71733
|
+
const choice = (_b14 = chunk2.choices) == null ? void 0 : _b14[0];
|
|
71718
71734
|
if (!choice) {
|
|
71735
|
+
if (chunk2.usage) {
|
|
71736
|
+
break;
|
|
71737
|
+
}
|
|
71719
71738
|
continue;
|
|
71720
71739
|
}
|
|
71721
|
-
const content = (
|
|
71740
|
+
const content = (_c6 = choice.delta) == null ? void 0 : _c6.content;
|
|
71722
71741
|
if (content) {
|
|
71723
71742
|
contentBuffer += content;
|
|
71724
71743
|
yield {
|
|
@@ -71726,7 +71745,7 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
71726
71745
|
content
|
|
71727
71746
|
};
|
|
71728
71747
|
}
|
|
71729
|
-
const reasoningContent = (
|
|
71748
|
+
const reasoningContent = (_d4 = choice.delta) == null ? void 0 : _d4.reasoning_content;
|
|
71730
71749
|
if (reasoningContent) {
|
|
71731
71750
|
reasoningContentBuffer += reasoningContent;
|
|
71732
71751
|
if (!reasoningStarted) {
|
|
@@ -71740,7 +71759,7 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
71740
71759
|
delta: reasoningContent
|
|
71741
71760
|
};
|
|
71742
71761
|
}
|
|
71743
|
-
const deltaToolCalls = (
|
|
71762
|
+
const deltaToolCalls = (_e2 = choice.delta) == null ? void 0 : _e2.tool_calls;
|
|
71744
71763
|
if (deltaToolCalls) {
|
|
71745
71764
|
hasToolCalls = true;
|
|
71746
71765
|
for (const deltaCall of deltaToolCalls) {
|
|
@@ -71759,11 +71778,11 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
71759
71778
|
toolCallsBuffer[index].id = deltaCall.id;
|
|
71760
71779
|
}
|
|
71761
71780
|
let deltaText = "";
|
|
71762
|
-
if ((
|
|
71781
|
+
if ((_f = deltaCall.function) == null ? void 0 : _f.name) {
|
|
71763
71782
|
toolCallsBuffer[index].function.name += deltaCall.function.name;
|
|
71764
71783
|
deltaText += deltaCall.function.name;
|
|
71765
71784
|
}
|
|
71766
|
-
if ((
|
|
71785
|
+
if ((_g = deltaCall.function) == null ? void 0 : _g.arguments) {
|
|
71767
71786
|
toolCallsBuffer[index].function.arguments += deltaCall.function.arguments;
|
|
71768
71787
|
deltaText += deltaCall.function.arguments;
|
|
71769
71788
|
}
|
|
@@ -71776,7 +71795,7 @@ Possible causes: Network unavailable, DNS resolution failed, proxy issues, or se
|
|
|
71776
71795
|
}
|
|
71777
71796
|
}
|
|
71778
71797
|
if (choice.finish_reason) {
|
|
71779
|
-
|
|
71798
|
+
continue;
|
|
71780
71799
|
}
|
|
71781
71800
|
}
|
|
71782
71801
|
if (hasToolCalls) {
|
|
@@ -75458,7 +75477,15 @@ function convertToAnthropicMessages(messages, includeBuiltinSystemPrompt = true,
|
|
|
75458
75477
|
const customSystemPrompts = customSystemPromptOverride;
|
|
75459
75478
|
let systemContents;
|
|
75460
75479
|
const anthropicMessages = [];
|
|
75480
|
+
const toolResults = [];
|
|
75461
75481
|
for (const msg of messages) {
|
|
75482
|
+
if (msg.role !== "tool" && toolResults.length > 0) {
|
|
75483
|
+
anthropicMessages.push({
|
|
75484
|
+
role: "user",
|
|
75485
|
+
content: [...toolResults]
|
|
75486
|
+
});
|
|
75487
|
+
toolResults.length = 0;
|
|
75488
|
+
}
|
|
75462
75489
|
if (msg.role === "system") {
|
|
75463
75490
|
systemContents = [msg.content];
|
|
75464
75491
|
continue;
|
|
@@ -75496,15 +75523,10 @@ function convertToAnthropicMessages(messages, includeBuiltinSystemPrompt = true,
|
|
|
75496
75523
|
} else {
|
|
75497
75524
|
toolResultContent = msg.content;
|
|
75498
75525
|
}
|
|
75499
|
-
|
|
75500
|
-
|
|
75501
|
-
|
|
75502
|
-
|
|
75503
|
-
type: "tool_result",
|
|
75504
|
-
tool_use_id: msg.tool_call_id,
|
|
75505
|
-
content: toolResultContent
|
|
75506
|
-
}
|
|
75507
|
-
]
|
|
75526
|
+
toolResults.push({
|
|
75527
|
+
type: "tool_result",
|
|
75528
|
+
tool_use_id: msg.tool_call_id,
|
|
75529
|
+
content: toolResultContent
|
|
75508
75530
|
});
|
|
75509
75531
|
continue;
|
|
75510
75532
|
}
|
|
@@ -75588,6 +75610,13 @@ function convertToAnthropicMessages(messages, includeBuiltinSystemPrompt = true,
|
|
|
75588
75610
|
}
|
|
75589
75611
|
}
|
|
75590
75612
|
}
|
|
75613
|
+
if (toolResults.length > 0) {
|
|
75614
|
+
anthropicMessages.push({
|
|
75615
|
+
role: "user",
|
|
75616
|
+
content: [...toolResults]
|
|
75617
|
+
});
|
|
75618
|
+
toolResults.length = 0;
|
|
75619
|
+
}
|
|
75591
75620
|
if (customSystemPrompts && customSystemPrompts.length > 0) {
|
|
75592
75621
|
systemContents = customSystemPrompts;
|
|
75593
75622
|
if (includeBuiltinSystemPrompt) {
|
|
@@ -77954,6 +77983,7 @@ var init_utils = __esm({
|
|
|
77954
77983
|
init_agent();
|
|
77955
77984
|
init_clear();
|
|
77956
77985
|
init_compact();
|
|
77986
|
+
init_copyLast();
|
|
77957
77987
|
init_custom();
|
|
77958
77988
|
init_diff2();
|
|
77959
77989
|
init_export();
|
|
@@ -81466,7 +81496,7 @@ var init_en = __esm({
|
|
|
81466
81496
|
manualInputSubtitle: "Enter model name manually",
|
|
81467
81497
|
manualInputHint: "Press Enter to confirm, Esc to cancel",
|
|
81468
81498
|
loadingError: "\u26A0 Failed to load models from API",
|
|
81469
|
-
requestMethodChat: "Chat Completions - Modern chat API (
|
|
81499
|
+
requestMethodChat: "Chat Completions - Modern chat API (DeepSeek)",
|
|
81470
81500
|
requestMethodResponses: "Responses - New responses API (2025, with built-in tools)",
|
|
81471
81501
|
requestMethodGemini: "Gemini - Google Gemini API",
|
|
81472
81502
|
requestMethodAnthropic: "Anthropic - Claude API",
|
|
@@ -81722,6 +81752,7 @@ var init_en = __esm({
|
|
|
81722
81752
|
commands: {
|
|
81723
81753
|
help: "Show keyboard shortcuts and help information",
|
|
81724
81754
|
clear: "Clear chat context and conversation history",
|
|
81755
|
+
copyLast: "Copy last AI message to clipboard",
|
|
81725
81756
|
resume: "Resume a conversation",
|
|
81726
81757
|
mcp: "Show Model Context Protocol services and tools",
|
|
81727
81758
|
yolo: "Toggle unattended mode (auto-approve all tools)",
|
|
@@ -81750,6 +81781,13 @@ var init_en = __esm({
|
|
|
81750
81781
|
worktree: "Open Git branch management panel for switching, creating and deleting branches",
|
|
81751
81782
|
diff: "Review file changes from a conversation in IDE diff view",
|
|
81752
81783
|
quit: "Exit the application"
|
|
81784
|
+
},
|
|
81785
|
+
copyLastFeedback: {
|
|
81786
|
+
noAssistantMessage: "No AI assistant message found to copy.",
|
|
81787
|
+
emptyAssistantMessage: "The last AI assistant message has no content to copy.",
|
|
81788
|
+
copySuccess: "\u2713 Last AI message copied to clipboard",
|
|
81789
|
+
copyFailedPrefix: "\u2717 Failed to copy to clipboard",
|
|
81790
|
+
unknownError: "Unknown error"
|
|
81753
81791
|
}
|
|
81754
81792
|
},
|
|
81755
81793
|
permissionsPanel: {
|
|
@@ -82741,7 +82779,7 @@ var init_zh = __esm({
|
|
|
82741
82779
|
manualInputSubtitle: "\u624B\u52A8\u8F93\u5165\u6A21\u578B\u540D\u79F0",
|
|
82742
82780
|
manualInputHint: "\u6309 Enter \u786E\u8BA4,Esc \u53D6\u6D88",
|
|
82743
82781
|
loadingError: "\u26A0 \u65E0\u6CD5\u4ECE API \u52A0\u8F7D\u6A21\u578B",
|
|
82744
|
-
requestMethodChat: "Chat Completions - \u73B0\u4EE3\u804A\u5929 API (
|
|
82782
|
+
requestMethodChat: "Chat Completions - \u73B0\u4EE3\u804A\u5929 API (DeepSeek)",
|
|
82745
82783
|
requestMethodResponses: "Responses - \u65B0 Responses API (2025, \u5185\u7F6E\u5DE5\u5177)",
|
|
82746
82784
|
requestMethodGemini: "Gemini - Google Gemini API",
|
|
82747
82785
|
requestMethodAnthropic: "Anthropic - Claude API",
|
|
@@ -82997,6 +83035,7 @@ var init_zh = __esm({
|
|
|
82997
83035
|
commands: {
|
|
82998
83036
|
help: "\u663E\u793A\u5FEB\u6377\u952E\u548C\u5E2E\u52A9\u4FE1\u606F",
|
|
82999
83037
|
clear: "\u6E05\u7A7A\u804A\u5929\u4E0A\u4E0B\u6587\u548C\u5BF9\u8BDD\u5386\u53F2",
|
|
83038
|
+
copyLast: "\u590D\u5236\u6700\u540E\u4E00\u6761AI\u56DE\u590D\u5230\u526A\u8D34\u677F",
|
|
83000
83039
|
resume: "\u6062\u590D\u5BF9\u8BDD",
|
|
83001
83040
|
mcp: "\u663E\u793A\u6A21\u578B\u4E0A\u4E0B\u6587\u534F\u8BAE\u670D\u52A1\u548C\u5DE5\u5177",
|
|
83002
83041
|
yolo: "\u5207\u6362\u65E0\u4EBA\u503C\u5B88\u6A21\u5F0F(\u81EA\u52A8\u6279\u51C6\u6240\u6709\u5DE5\u5177)",
|
|
@@ -83025,6 +83064,13 @@ var init_zh = __esm({
|
|
|
83025
83064
|
profiles: "\u6253\u5F00\u914D\u7F6E\u6587\u4EF6\u5207\u6362\u9762\u677F",
|
|
83026
83065
|
models: "\u6253\u5F00\u6A21\u578B\u5207\u6362\u9762\u677F",
|
|
83027
83066
|
quit: "\u9000\u51FA\u5E94\u7528\u7A0B\u5E8F"
|
|
83067
|
+
},
|
|
83068
|
+
copyLastFeedback: {
|
|
83069
|
+
noAssistantMessage: "\u672A\u627E\u5230\u53EF\u590D\u5236\u7684 AI \u52A9\u624B\u6D88\u606F\u3002",
|
|
83070
|
+
emptyAssistantMessage: "\u6700\u540E\u4E00\u6761 AI \u52A9\u624B\u6D88\u606F\u6CA1\u6709\u53EF\u590D\u5236\u7684\u5185\u5BB9\u3002",
|
|
83071
|
+
copySuccess: "\u2713 \u5DF2\u590D\u5236\u6700\u540E\u4E00\u6761 AI \u6D88\u606F\u5230\u526A\u8D34\u677F",
|
|
83072
|
+
copyFailedPrefix: "\u2717 \u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25",
|
|
83073
|
+
unknownError: "\u672A\u77E5\u9519\u8BEF"
|
|
83028
83074
|
}
|
|
83029
83075
|
},
|
|
83030
83076
|
permissionsPanel: {
|
|
@@ -84015,7 +84061,7 @@ var init_zh_TW = __esm({
|
|
|
84015
84061
|
manualInputSubtitle: "\u624B\u52D5\u8F38\u5165\u6A21\u578B\u540D\u7A31",
|
|
84016
84062
|
manualInputHint: "\u6309 Enter \u78BA\u8A8D,Esc \u53D6\u6D88",
|
|
84017
84063
|
loadingError: "\u26A0 \u7121\u6CD5\u5F9E API \u8F09\u5165\u6A21\u578B",
|
|
84018
|
-
requestMethodChat: "Chat Completions - \u73FE\u4EE3\u804A\u5929 API (
|
|
84064
|
+
requestMethodChat: "Chat Completions - \u73FE\u4EE3\u804A\u5929 API (DeepSeek)",
|
|
84019
84065
|
requestMethodResponses: "Responses - \u65B0 Responses API (2025, \u5167\u5EFA\u5DE5\u5177)",
|
|
84020
84066
|
requestMethodGemini: "Gemini - Google Gemini API",
|
|
84021
84067
|
requestMethodAnthropic: "Anthropic - Claude API",
|
|
@@ -84271,6 +84317,7 @@ var init_zh_TW = __esm({
|
|
|
84271
84317
|
commands: {
|
|
84272
84318
|
help: "\u986F\u793A\u5FEB\u6377\u9375\u548C\u8AAA\u660E\u8CC7\u8A0A",
|
|
84273
84319
|
clear: "\u6E05\u7A7A\u804A\u5929\u4E0A\u4E0B\u6587\u548C\u5C0D\u8A71\u6B77\u53F2",
|
|
84320
|
+
copyLast: "\u8907\u88FD\u6700\u5F8C\u4E00\u689DAI\u56DE\u8986\u5230\u526A\u8CBC\u7C3F",
|
|
84274
84321
|
resume: "\u6062\u5FA9\u5C0D\u8A71",
|
|
84275
84322
|
mcp: "\u986F\u793A\u6A21\u578B\u4E0A\u4E0B\u6587\u5354\u5B9A\u670D\u52D9\u548C\u5DE5\u5177",
|
|
84276
84323
|
yolo: "\u5207\u63DB\u7121\u4EBA\u503C\u5B88\u6A21\u5F0F(\u81EA\u52D5\u6279\u51C6\u6240\u6709\u5DE5\u5177)",
|
|
@@ -84299,6 +84346,13 @@ var init_zh_TW = __esm({
|
|
|
84299
84346
|
profiles: "\u958B\u555F\u8A2D\u5B9A\u6A94\u5207\u63DB\u9762\u677F",
|
|
84300
84347
|
models: "\u958B\u555F\u6A21\u578B\u5207\u63DB\u9762\u677F",
|
|
84301
84348
|
quit: "\u9000\u51FA\u61C9\u7528\u7A0B\u5F0F"
|
|
84349
|
+
},
|
|
84350
|
+
copyLastFeedback: {
|
|
84351
|
+
noAssistantMessage: "\u672A\u627E\u5230\u53EF\u8907\u88FD\u7684 AI \u52A9\u624B\u8A0A\u606F\u3002",
|
|
84352
|
+
emptyAssistantMessage: "\u6700\u5F8C\u4E00\u689D AI \u52A9\u624B\u8A0A\u606F\u6C92\u6709\u53EF\u8907\u88FD\u7684\u5167\u5BB9\u3002",
|
|
84353
|
+
copySuccess: "\u2713 \u5DF2\u8907\u88FD\u6700\u5F8C\u4E00\u689D AI \u8A0A\u606F\u5230\u526A\u8CBC\u7C3F",
|
|
84354
|
+
copyFailedPrefix: "\u2717 \u8907\u88FD\u5230\u526A\u8CBC\u7C3F\u5931\u6557",
|
|
84355
|
+
unknownError: "\u672A\u77E5\u932F\u8AA4"
|
|
84302
84356
|
}
|
|
84303
84357
|
},
|
|
84304
84358
|
permissionsPanel: {
|
|
@@ -554353,6 +554407,10 @@ function useCommandPanel(buffer, isProcessing = false) {
|
|
|
554353
554407
|
const builtInCommands = (0, import_react86.useMemo)(() => [
|
|
554354
554408
|
{ name: "help", description: t.commandPanel.commands.help },
|
|
554355
554409
|
{ name: "clear", description: t.commandPanel.commands.clear },
|
|
554410
|
+
{
|
|
554411
|
+
name: "copy-last",
|
|
554412
|
+
description: t.commandPanel.commands.copyLast || "Copy last AI message to clipboard"
|
|
554413
|
+
},
|
|
554356
554414
|
{ name: "resume", description: t.commandPanel.commands.resume },
|
|
554357
554415
|
{ name: "mcp", description: t.commandPanel.commands.mcp },
|
|
554358
554416
|
{ name: "yolo", description: t.commandPanel.commands.yolo },
|
|
@@ -568717,6 +568775,65 @@ var init_chatExporter = __esm({
|
|
|
568717
568775
|
}
|
|
568718
568776
|
});
|
|
568719
568777
|
|
|
568778
|
+
// dist/utils/core/clipboard.js
|
|
568779
|
+
import { execSync as execSync7 } from "child_process";
|
|
568780
|
+
async function copyToClipboard(content) {
|
|
568781
|
+
return new Promise((resolve12, reject2) => {
|
|
568782
|
+
try {
|
|
568783
|
+
const base64Content = Buffer.from(content, "utf-8").toString("base64");
|
|
568784
|
+
if (process.platform === "win32") {
|
|
568785
|
+
execSync7(`powershell -NoProfile -Command "[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${base64Content}')) | Set-Clipboard"`, { encoding: "utf-8" });
|
|
568786
|
+
resolve12();
|
|
568787
|
+
} else if (process.platform === "darwin") {
|
|
568788
|
+
execSync7(`echo "${base64Content}" | base64 -d | pbcopy`, {
|
|
568789
|
+
encoding: "utf-8"
|
|
568790
|
+
});
|
|
568791
|
+
resolve12();
|
|
568792
|
+
} else {
|
|
568793
|
+
try {
|
|
568794
|
+
execSync7(`echo "${base64Content}" | base64 -d | xclip -selection clipboard`, { encoding: "utf-8" });
|
|
568795
|
+
resolve12();
|
|
568796
|
+
} catch {
|
|
568797
|
+
try {
|
|
568798
|
+
execSync7(`echo "${base64Content}" | base64 -d | xsel --clipboard --input`, { encoding: "utf-8" });
|
|
568799
|
+
resolve12();
|
|
568800
|
+
} catch {
|
|
568801
|
+
return;
|
|
568802
|
+
}
|
|
568803
|
+
}
|
|
568804
|
+
}
|
|
568805
|
+
} catch (error) {
|
|
568806
|
+
if (!(error instanceof Error)) {
|
|
568807
|
+
reject2(new Error("Failed to copy to clipboard: Unknown error"));
|
|
568808
|
+
return;
|
|
568809
|
+
}
|
|
568810
|
+
const errorMsg = error.message;
|
|
568811
|
+
if (errorMsg.includes("command not found") || errorMsg.includes("not found") || errorMsg.includes("spawn ENOENT") || /spawn.*not found/.test(errorMsg)) {
|
|
568812
|
+
let toolName = "clipboard tool";
|
|
568813
|
+
if (process.platform === "win32") {
|
|
568814
|
+
toolName = "PowerShell";
|
|
568815
|
+
} else if (process.platform === "darwin") {
|
|
568816
|
+
toolName = "pbcopy";
|
|
568817
|
+
} else {
|
|
568818
|
+
toolName = "xclip/xsel";
|
|
568819
|
+
}
|
|
568820
|
+
reject2(new Error(`Clipboard tool not found: ${toolName} is not available. Please install ${toolName}.`));
|
|
568821
|
+
return;
|
|
568822
|
+
}
|
|
568823
|
+
if (errorMsg.includes("EACCES") || errorMsg.includes("EPERM") || errorMsg.includes("Access denied") || errorMsg.includes("permission denied") || errorMsg.includes("Permission denied")) {
|
|
568824
|
+
reject2(new Error("Permission denied: Cannot access clipboard. Please check your permissions."));
|
|
568825
|
+
return;
|
|
568826
|
+
}
|
|
568827
|
+
reject2(new Error(`Failed to copy to clipboard: ${errorMsg}`));
|
|
568828
|
+
}
|
|
568829
|
+
});
|
|
568830
|
+
}
|
|
568831
|
+
var init_clipboard = __esm({
|
|
568832
|
+
"dist/utils/core/clipboard.js"() {
|
|
568833
|
+
"use strict";
|
|
568834
|
+
}
|
|
568835
|
+
});
|
|
568836
|
+
|
|
568720
568837
|
// dist/hooks/conversation/useCommandHandler.js
|
|
568721
568838
|
async function executeContextCompression(sessionId) {
|
|
568722
568839
|
try {
|
|
@@ -568865,6 +568982,7 @@ ${msg.content}`;
|
|
|
568865
568982
|
}
|
|
568866
568983
|
function useCommandHandler(options3) {
|
|
568867
568984
|
const { stdout } = use_stdout_default();
|
|
568985
|
+
const { t } = useI18n();
|
|
568868
568986
|
const handleCommandExecution = (0, import_react137.useCallback)(async (commandName, result2) => {
|
|
568869
568987
|
if (commandName === "compact" && result2.success && result2.action === "compact") {
|
|
568870
568988
|
options3.setIsCompressing(true);
|
|
@@ -569314,6 +569432,52 @@ ${filePath}`,
|
|
|
569314
569432
|
options3.setMessages((prev) => [...prev, errorMessage]);
|
|
569315
569433
|
}
|
|
569316
569434
|
}
|
|
569435
|
+
} else if (result2.success && result2.action === "copyLastMessage") {
|
|
569436
|
+
try {
|
|
569437
|
+
const messages = options3.messages;
|
|
569438
|
+
let lastAssistantMessage;
|
|
569439
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
569440
|
+
const msg = messages[i];
|
|
569441
|
+
if (msg && msg.role === "assistant" && !msg.subAgentInternal) {
|
|
569442
|
+
lastAssistantMessage = msg;
|
|
569443
|
+
break;
|
|
569444
|
+
}
|
|
569445
|
+
}
|
|
569446
|
+
if (!lastAssistantMessage) {
|
|
569447
|
+
const errorMessage = {
|
|
569448
|
+
role: "command",
|
|
569449
|
+
content: t.commandPanel.copyLastFeedback.noAssistantMessage,
|
|
569450
|
+
commandName
|
|
569451
|
+
};
|
|
569452
|
+
options3.setMessages((prev) => [...prev, errorMessage]);
|
|
569453
|
+
return;
|
|
569454
|
+
}
|
|
569455
|
+
const contentToCopy = lastAssistantMessage.content || "";
|
|
569456
|
+
if (!contentToCopy) {
|
|
569457
|
+
const errorMessage = {
|
|
569458
|
+
role: "command",
|
|
569459
|
+
content: t.commandPanel.copyLastFeedback.emptyAssistantMessage,
|
|
569460
|
+
commandName
|
|
569461
|
+
};
|
|
569462
|
+
options3.setMessages((prev) => [...prev, errorMessage]);
|
|
569463
|
+
return;
|
|
569464
|
+
}
|
|
569465
|
+
await copyToClipboard(contentToCopy);
|
|
569466
|
+
const successMessage = {
|
|
569467
|
+
role: "command",
|
|
569468
|
+
content: t.commandPanel.copyLastFeedback.copySuccess,
|
|
569469
|
+
commandName
|
|
569470
|
+
};
|
|
569471
|
+
options3.setMessages((prev) => [...prev, successMessage]);
|
|
569472
|
+
} catch (error) {
|
|
569473
|
+
const errorMsg = error instanceof Error ? error.message : t.commandPanel.copyLastFeedback.unknownError;
|
|
569474
|
+
const errorMessage = {
|
|
569475
|
+
role: "command",
|
|
569476
|
+
content: `${t.commandPanel.copyLastFeedback.copyFailedPrefix}: ${errorMsg}`,
|
|
569477
|
+
commandName
|
|
569478
|
+
};
|
|
569479
|
+
options3.setMessages((prev) => [...prev, errorMessage]);
|
|
569480
|
+
}
|
|
569317
569481
|
} else if (result2.success && result2.action === "toggleCodebase") {
|
|
569318
569482
|
if (options3.onToggleCodebase) {
|
|
569319
569483
|
try {
|
|
@@ -569336,7 +569500,7 @@ ${filePath}`,
|
|
|
569336
569500
|
};
|
|
569337
569501
|
options3.setMessages((prev) => [...prev, commandMessage]);
|
|
569338
569502
|
}
|
|
569339
|
-
}, [stdout, options3]);
|
|
569503
|
+
}, [stdout, options3, t]);
|
|
569340
569504
|
return { handleCommandExecution };
|
|
569341
569505
|
}
|
|
569342
569506
|
var import_react137;
|
|
@@ -569352,6 +569516,8 @@ var init_useCommandHandler = __esm({
|
|
|
569352
569516
|
init_terminal();
|
|
569353
569517
|
init_fileDialog();
|
|
569354
569518
|
init_chatExporter();
|
|
569519
|
+
init_clipboard();
|
|
569520
|
+
init_i18n();
|
|
569355
569521
|
}
|
|
569356
569522
|
});
|
|
569357
569523
|
|
|
@@ -578204,14 +578370,14 @@ var MCPConfigScreen_exports = {};
|
|
|
578204
578370
|
__export(MCPConfigScreen_exports, {
|
|
578205
578371
|
default: () => MCPConfigScreen
|
|
578206
578372
|
});
|
|
578207
|
-
import { spawn as spawn11, execSync as
|
|
578373
|
+
import { spawn as spawn11, execSync as execSync8 } from "child_process";
|
|
578208
578374
|
import { writeFileSync as writeFileSync14, readFileSync as readFileSync22, existsSync as existsSync26 } from "fs";
|
|
578209
578375
|
import { join as join31 } from "path";
|
|
578210
578376
|
import { homedir as homedir18, platform as platform5 } from "os";
|
|
578211
578377
|
function checkCommandExists3(command) {
|
|
578212
578378
|
if (platform5() === "win32") {
|
|
578213
578379
|
try {
|
|
578214
|
-
|
|
578380
|
+
execSync8(`where ${command}`, {
|
|
578215
578381
|
stdio: "ignore",
|
|
578216
578382
|
windowsHide: true
|
|
578217
578383
|
});
|
|
@@ -578223,7 +578389,7 @@ function checkCommandExists3(command) {
|
|
|
578223
578389
|
const shells = ["/bin/sh", "/bin/bash", "/bin/zsh"];
|
|
578224
578390
|
for (const shell of shells) {
|
|
578225
578391
|
try {
|
|
578226
|
-
|
|
578392
|
+
execSync8(`command -v ${command}`, {
|
|
578227
578393
|
stdio: "ignore",
|
|
578228
578394
|
shell,
|
|
578229
578395
|
env: process.env
|
|
@@ -578811,7 +578977,7 @@ __export(sseDaemon_exports, {
|
|
|
578811
578977
|
startDaemon: () => startDaemon,
|
|
578812
578978
|
stopDaemon: () => stopDaemon
|
|
578813
578979
|
});
|
|
578814
|
-
import { spawn as spawn12, execSync as
|
|
578980
|
+
import { spawn as spawn12, execSync as execSync9 } from "child_process";
|
|
578815
578981
|
import { existsSync as existsSync27, readFileSync as readFileSync23, writeFileSync as writeFileSync15, unlinkSync as unlinkSync4, readdirSync as readdirSync4, mkdirSync as mkdirSync13 } from "fs";
|
|
578816
578982
|
import { join as join32 } from "path";
|
|
578817
578983
|
import { homedir as homedir19 } from "os";
|
|
@@ -578983,7 +579149,7 @@ function killProcess(pid, pidFile) {
|
|
|
578983
579149
|
try {
|
|
578984
579150
|
if (process.platform === "win32") {
|
|
578985
579151
|
try {
|
|
578986
|
-
|
|
579152
|
+
execSync9(`taskkill /PID ${pid} /T /F`, { stdio: "ignore" });
|
|
578987
579153
|
console.log(t.daemonStopped);
|
|
578988
579154
|
} catch (error) {
|
|
578989
579155
|
try {
|
package/bundle/package.json
CHANGED