kcode-cli 1.3.19 → 1.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +146 -32
- package/dist/cli.js.map +3 -3
- package/dist/web/assets/dialog-XMzptB8h.js +1 -0
- package/dist/web/assets/dialog-fork-D6v09HNl.js +1 -0
- package/dist/web/assets/dialog-manage-models-Bm6CtoIz.js +2 -0
- package/dist/web/assets/dialog-model-config-gyTP8r4J.js +2 -0
- package/dist/web/assets/dialog-select-file-Dknr4kkI.js +1 -0
- package/dist/web/assets/dialog-select-mcp-Cu7sZ2gM.js +1 -0
- package/dist/web/assets/{ghostty-web-BcHj2Azi.js → ghostty-web-CQPt5osq.js} +1 -1
- package/dist/web/assets/home-DAGgJkXQ.js +1 -0
- package/dist/web/assets/{index-ZtG0ehHM.js → index-0V_fi__s.js} +103 -103
- package/dist/web/assets/{index-SW1-heh1.css → index-eOIcRPgw.css} +1 -1
- package/dist/web/assets/session-C8MftpUd.js +71 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/datetime-D2JCa3fE.js +0 -1
- package/dist/web/assets/dialog-ChUDEDFM.js +0 -1
- package/dist/web/assets/dialog-fork-inuujukQ.js +0 -1
- package/dist/web/assets/dialog-manage-models-Da1j6ge0.js +0 -2
- package/dist/web/assets/dialog-model-config-Cb0RJYRC.js +0 -2
- package/dist/web/assets/dialog-select-file-BMB_32aJ.js +0 -1
- package/dist/web/assets/dialog-select-mcp-BjQv9uCE.js +0 -1
- package/dist/web/assets/home-Bu-XaUcM.js +0 -1
- package/dist/web/assets/session-s1rW9No2.js +0 -71
package/dist/cli.js
CHANGED
|
@@ -121556,41 +121556,71 @@ import { execFile as execFile4 } from "node:child_process";
|
|
|
121556
121556
|
function quoteAppleScript(value) {
|
|
121557
121557
|
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
121558
121558
|
}
|
|
121559
|
-
function
|
|
121559
|
+
function createWindowsPickerScript(title, strategy) {
|
|
121560
121560
|
const description = JSON.stringify(title?.trim() || "Select a project");
|
|
121561
|
-
|
|
121561
|
+
if (strategy === "owner") {
|
|
121562
|
+
return [
|
|
121563
|
+
"Add-Type -AssemblyName System.Windows.Forms",
|
|
121564
|
+
"$owner = $null",
|
|
121565
|
+
"$dialog = $null",
|
|
121566
|
+
"$result = @{ status = 'cancelled' }",
|
|
121567
|
+
"try {",
|
|
121568
|
+
" $owner = New-Object System.Windows.Forms.Form",
|
|
121569
|
+
" $owner.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual",
|
|
121570
|
+
" $owner.Left = -32000",
|
|
121571
|
+
" $owner.Top = -32000",
|
|
121572
|
+
" $owner.Width = 1",
|
|
121573
|
+
" $owner.Height = 1",
|
|
121574
|
+
" $owner.ShowInTaskbar = $false",
|
|
121575
|
+
" $owner.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedToolWindow",
|
|
121576
|
+
" $owner.Opacity = 0",
|
|
121577
|
+
" $owner.TopMost = $true",
|
|
121578
|
+
" $null = $owner.Show()",
|
|
121579
|
+
" $owner.Activate()",
|
|
121580
|
+
" $dialog = New-Object System.Windows.Forms.FolderBrowserDialog",
|
|
121581
|
+
` $dialog.Description = ${description}`,
|
|
121582
|
+
" $dialog.ShowNewFolderButton = $false",
|
|
121583
|
+
" $status = $dialog.ShowDialog($owner)",
|
|
121584
|
+
" if ($status -eq [System.Windows.Forms.DialogResult]::OK) {",
|
|
121585
|
+
" $result = @{ status = 'selected'; path = $dialog.SelectedPath }",
|
|
121586
|
+
" }",
|
|
121587
|
+
"} finally {",
|
|
121588
|
+
" if ($dialog) { $dialog.Dispose() }",
|
|
121589
|
+
" if ($owner) { $owner.Close(); $owner.Dispose() }",
|
|
121590
|
+
"}",
|
|
121591
|
+
"[Console]::Out.Write(($result | ConvertTo-Json -Compress))"
|
|
121592
|
+
].join("\n");
|
|
121593
|
+
}
|
|
121594
|
+
return [
|
|
121562
121595
|
"Add-Type -AssemblyName System.Windows.Forms",
|
|
121563
|
-
"$owner = New-Object System.Windows.Forms.Form",
|
|
121564
|
-
"$owner.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual",
|
|
121565
|
-
"$owner.Left = -32000",
|
|
121566
|
-
"$owner.Top = -32000",
|
|
121567
|
-
"$owner.Width = 1",
|
|
121568
|
-
"$owner.Height = 1",
|
|
121569
|
-
"$owner.ShowInTaskbar = $false",
|
|
121570
|
-
"$owner.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedToolWindow",
|
|
121571
|
-
"$owner.Opacity = 0",
|
|
121572
|
-
"$owner.TopMost = $true",
|
|
121573
|
-
"$null = $owner.Show()",
|
|
121574
|
-
"$owner.Activate()",
|
|
121575
121596
|
"$dialog = $null",
|
|
121597
|
+
"$result = @{ status = 'cancelled' }",
|
|
121576
121598
|
"try {",
|
|
121577
121599
|
" $dialog = New-Object System.Windows.Forms.FolderBrowserDialog",
|
|
121578
121600
|
` $dialog.Description = ${description}`,
|
|
121579
121601
|
" $dialog.ShowNewFolderButton = $false",
|
|
121580
|
-
"
|
|
121581
|
-
"
|
|
121602
|
+
" $status = $dialog.ShowDialog()",
|
|
121603
|
+
" if ($status -eq [System.Windows.Forms.DialogResult]::OK) {",
|
|
121604
|
+
" $result = @{ status = 'selected'; path = $dialog.SelectedPath }",
|
|
121582
121605
|
" }",
|
|
121583
121606
|
"} finally {",
|
|
121584
121607
|
" if ($dialog) { $dialog.Dispose() }",
|
|
121585
|
-
"
|
|
121586
|
-
"
|
|
121587
|
-
"}"
|
|
121608
|
+
"}",
|
|
121609
|
+
"[Console]::Out.Write(($result | ConvertTo-Json -Compress))"
|
|
121588
121610
|
].join("\n");
|
|
121611
|
+
}
|
|
121612
|
+
function createWindowsPickerCommand(title, strategy) {
|
|
121613
|
+
const script = createWindowsPickerScript(title, strategy);
|
|
121589
121614
|
return {
|
|
121590
121615
|
file: "powershell.exe",
|
|
121591
|
-
args: ["-NoLogo", "-NoProfile", "-NonInteractive", "-STA", "-Command", script]
|
|
121616
|
+
args: ["-NoLogo", "-NoProfile", "-NonInteractive", "-STA", "-Command", script],
|
|
121617
|
+
strategy,
|
|
121618
|
+
title
|
|
121592
121619
|
};
|
|
121593
121620
|
}
|
|
121621
|
+
function createWindowsDirectoryPickerCommand(title) {
|
|
121622
|
+
return createWindowsPickerCommand(title, "owner");
|
|
121623
|
+
}
|
|
121594
121624
|
function createMacDirectoryPickerCommand(title) {
|
|
121595
121625
|
const prompt2 = quoteAppleScript(title?.trim() || "Select a project");
|
|
121596
121626
|
return {
|
|
@@ -121651,6 +121681,55 @@ function unexpectedFailure(command3, error2) {
|
|
|
121651
121681
|
`Failed to open directory picker via ${command3.file}${detail ? `: ${detail}` : ""}`
|
|
121652
121682
|
);
|
|
121653
121683
|
}
|
|
121684
|
+
function invalidWindowsPickerResult(command3, detail) {
|
|
121685
|
+
return new DirectoryPickerExecutionError(
|
|
121686
|
+
`Failed to open directory picker via ${command3.file}: invalid ${command3.strategy} picker result (${detail})`
|
|
121687
|
+
);
|
|
121688
|
+
}
|
|
121689
|
+
function parseWindowsPickerResult(result) {
|
|
121690
|
+
const raw2 = result.stdout.trim();
|
|
121691
|
+
if (!raw2) {
|
|
121692
|
+
return {
|
|
121693
|
+
kind: "invalid",
|
|
121694
|
+
detail: "empty stdout"
|
|
121695
|
+
};
|
|
121696
|
+
}
|
|
121697
|
+
try {
|
|
121698
|
+
const parsed = JSON.parse(raw2);
|
|
121699
|
+
if (parsed?.status === "selected" && typeof parsed.path === "string" && parsed.path.trim()) {
|
|
121700
|
+
return {
|
|
121701
|
+
kind: "selected",
|
|
121702
|
+
path: parsed.path
|
|
121703
|
+
};
|
|
121704
|
+
}
|
|
121705
|
+
if (parsed?.status === "cancelled") {
|
|
121706
|
+
return {
|
|
121707
|
+
kind: "cancelled"
|
|
121708
|
+
};
|
|
121709
|
+
}
|
|
121710
|
+
return {
|
|
121711
|
+
kind: "invalid",
|
|
121712
|
+
detail: `unexpected payload ${raw2}`
|
|
121713
|
+
};
|
|
121714
|
+
} catch (error2) {
|
|
121715
|
+
const reason = error2 instanceof Error ? error2.message : String(error2);
|
|
121716
|
+
return {
|
|
121717
|
+
kind: "invalid",
|
|
121718
|
+
detail: `invalid JSON (${reason})`
|
|
121719
|
+
};
|
|
121720
|
+
}
|
|
121721
|
+
}
|
|
121722
|
+
function logWindowsPickerResult(command3, result, parsed, startedAt) {
|
|
121723
|
+
debugLogger61.debug("Windows directory picker completed", {
|
|
121724
|
+
strategy: command3.strategy,
|
|
121725
|
+
elapsedMs: Date.now() - startedAt,
|
|
121726
|
+
stderr: result.stderr.trim() || void 0,
|
|
121727
|
+
stdout: result.stdout.trim() || void 0,
|
|
121728
|
+
outcome: parsed.kind,
|
|
121729
|
+
path: parsed.kind === "selected" ? parsed.path : void 0,
|
|
121730
|
+
detail: parsed.kind === "invalid" ? parsed.detail : void 0
|
|
121731
|
+
});
|
|
121732
|
+
}
|
|
121654
121733
|
async function runLinuxDirectoryPicker(options2, deps) {
|
|
121655
121734
|
if (isMissingDisplay(deps.env)) {
|
|
121656
121735
|
throw new DirectoryPickerUnsupportedError("Directory picker is unavailable because no graphical display is active");
|
|
@@ -121676,13 +121755,50 @@ async function runLinuxDirectoryPicker(options2, deps) {
|
|
|
121676
121755
|
}
|
|
121677
121756
|
throw new DirectoryPickerUnsupportedError("Directory picker is unavailable on this Linux environment");
|
|
121678
121757
|
}
|
|
121758
|
+
async function runWindowsPickerCommand(command3, deps) {
|
|
121759
|
+
const startedAt = Date.now();
|
|
121760
|
+
try {
|
|
121761
|
+
const result = await deps.run(command3);
|
|
121762
|
+
const parsed = parseWindowsPickerResult(result);
|
|
121763
|
+
logWindowsPickerResult(command3, result, parsed, startedAt);
|
|
121764
|
+
return parsed;
|
|
121765
|
+
} catch (error2) {
|
|
121766
|
+
debugLogger61.error("Windows directory picker failed", {
|
|
121767
|
+
strategy: command3.strategy,
|
|
121768
|
+
elapsedMs: Date.now() - startedAt,
|
|
121769
|
+
error: error2
|
|
121770
|
+
});
|
|
121771
|
+
throw unexpectedFailure(command3, error2);
|
|
121772
|
+
}
|
|
121773
|
+
}
|
|
121679
121774
|
async function runWindowsDirectoryPicker(command3, deps) {
|
|
121680
121775
|
if (activeWindowsPicker) {
|
|
121776
|
+
debugLogger61.debug("Windows directory picker request dropped because another picker is active");
|
|
121681
121777
|
return null;
|
|
121682
121778
|
}
|
|
121683
|
-
const
|
|
121684
|
-
|
|
121685
|
-
|
|
121779
|
+
const ownerCommand = command3;
|
|
121780
|
+
const task = (async () => {
|
|
121781
|
+
const initialCommand = ownerCommand.strategy === "owner" ? ownerCommand : createWindowsPickerCommand(ownerCommand.title, "owner");
|
|
121782
|
+
const plainCommand = createWindowsPickerCommand(initialCommand.title, "plain");
|
|
121783
|
+
const ownerResult = await runWindowsPickerCommand(initialCommand, deps);
|
|
121784
|
+
if (ownerResult.kind === "selected") {
|
|
121785
|
+
return normalizePickedPath(ownerResult.path, deps.platform);
|
|
121786
|
+
}
|
|
121787
|
+
if (ownerResult.kind === "cancelled") {
|
|
121788
|
+
return null;
|
|
121789
|
+
}
|
|
121790
|
+
debugLogger61.warn("Windows directory picker owner strategy returned an invalid result, retrying plain dialog", {
|
|
121791
|
+
detail: ownerResult.detail
|
|
121792
|
+
});
|
|
121793
|
+
const plainResult = await runWindowsPickerCommand(plainCommand, deps);
|
|
121794
|
+
if (plainResult.kind === "selected") {
|
|
121795
|
+
return normalizePickedPath(plainResult.path, deps.platform);
|
|
121796
|
+
}
|
|
121797
|
+
if (plainResult.kind === "cancelled") {
|
|
121798
|
+
return null;
|
|
121799
|
+
}
|
|
121800
|
+
throw invalidWindowsPickerResult(plainCommand, plainResult.detail);
|
|
121801
|
+
})();
|
|
121686
121802
|
const guarded = task.finally(() => {
|
|
121687
121803
|
if (activeWindowsPicker === guarded) {
|
|
121688
121804
|
activeWindowsPicker = void 0;
|
|
@@ -121719,10 +121835,12 @@ async function pickDirectory(options2 = {}, deps = {}) {
|
|
|
121719
121835
|
}
|
|
121720
121836
|
throw new DirectoryPickerUnsupportedError(`Directory picker is unavailable on platform ${platform3}`);
|
|
121721
121837
|
}
|
|
121722
|
-
var activeWindowsPicker, DirectoryPickerUnsupportedError, DirectoryPickerExecutionError;
|
|
121838
|
+
var activeWindowsPicker, debugLogger61, DirectoryPickerUnsupportedError, DirectoryPickerExecutionError;
|
|
121723
121839
|
var init_picker = __esm({
|
|
121724
121840
|
"../../apps/server/src/services/picker.ts"() {
|
|
121725
121841
|
"use strict";
|
|
121842
|
+
init_debug();
|
|
121843
|
+
debugLogger61 = createDebugLogger("PICKER");
|
|
121726
121844
|
DirectoryPickerUnsupportedError = class extends Error {
|
|
121727
121845
|
constructor(message2) {
|
|
121728
121846
|
super(message2);
|
|
@@ -122515,9 +122633,9 @@ function parseCliArgs(argv) {
|
|
|
122515
122633
|
port
|
|
122516
122634
|
};
|
|
122517
122635
|
}
|
|
122518
|
-
function resolveCliArgs(parsed, env = process.env) {
|
|
122636
|
+
function resolveCliArgs(parsed, env = process.env, cwd2 = process.cwd()) {
|
|
122519
122637
|
return {
|
|
122520
|
-
directory: parsed.directory ?? readStringEnv(env.KCODE_DIRECTORY),
|
|
122638
|
+
directory: parsed.directory ?? readStringEnv(env.KCODE_DIRECTORY) ?? cwd2,
|
|
122521
122639
|
hostname: parsed.hostname ?? readStringEnv(env.KCODE_SERVER_HOST) ?? DEFAULT_HOSTNAME,
|
|
122522
122640
|
logLevel: parsed.logLevel,
|
|
122523
122641
|
mode: parsed.mode,
|
|
@@ -122535,7 +122653,7 @@ function formatHelp() {
|
|
|
122535
122653
|
"Options:",
|
|
122536
122654
|
" --hostname <host> Bind address (default: 127.0.0.1)",
|
|
122537
122655
|
" --port <port> Bind port (default: 4096)",
|
|
122538
|
-
" --directory <path>
|
|
122656
|
+
" --directory <path> Override project directory (default: current working directory)",
|
|
122539
122657
|
" --log-level <level> Accepted for SDK compatibility",
|
|
122540
122658
|
" -h, --help Show this message"
|
|
122541
122659
|
].join("\n");
|
|
@@ -122567,11 +122685,7 @@ function resolveRuntimeRoot() {
|
|
|
122567
122685
|
function applyEnvironment(input) {
|
|
122568
122686
|
process8.env.KCODE_SERVER_HOST = input.hostname;
|
|
122569
122687
|
process8.env.KCODE_SERVER_PORT = String(input.port);
|
|
122570
|
-
|
|
122571
|
-
process8.env.KCODE_DIRECTORY = input.directory;
|
|
122572
|
-
} else {
|
|
122573
|
-
delete process8.env.KCODE_DIRECTORY;
|
|
122574
|
-
}
|
|
122688
|
+
process8.env.KCODE_DIRECTORY = input.directory;
|
|
122575
122689
|
}
|
|
122576
122690
|
async function loadRuntime() {
|
|
122577
122691
|
return await Promise.resolve().then(() => (init_server_runtime(), server_runtime_exports));
|