kimiflare 0.54.0 → 0.55.0
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/index.js +590 -454
- package/dist/index.js.map +1 -1
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/index.js +60 -22
- package/dist/sdk/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -126,6 +126,7 @@ async function loadConfig() {
|
|
|
126
126
|
const envCostAttribution = readBooleanEnv("KIMI_COST_ATTRIBUTION");
|
|
127
127
|
const envFilePicker = readBooleanEnv("KIMIFLARE_FILE_PICKER");
|
|
128
128
|
const envCloudMode = readBooleanEnv("KIMIFLARE_CLOUD");
|
|
129
|
+
const envShell = process.env.KIMIFLARE_SHELL;
|
|
129
130
|
if (envCloudMode) {
|
|
130
131
|
return {
|
|
131
132
|
accountId: "",
|
|
@@ -147,7 +148,8 @@ async function loadConfig() {
|
|
|
147
148
|
plumbingModel: envPlumbingModel,
|
|
148
149
|
codeMode: envCodeMode,
|
|
149
150
|
costAttribution: envCostAttribution ?? false,
|
|
150
|
-
filePicker: envFilePicker ?? true
|
|
151
|
+
filePicker: envFilePicker ?? true,
|
|
152
|
+
shell: envShell
|
|
151
153
|
};
|
|
152
154
|
}
|
|
153
155
|
if (envAccount && envToken) {
|
|
@@ -176,7 +178,8 @@ async function loadConfig() {
|
|
|
176
178
|
memoryExtractionModel: envMemoryExtractionModel,
|
|
177
179
|
codeMode: envCodeMode ?? true,
|
|
178
180
|
costAttribution: envCostAttribution ?? true,
|
|
179
|
-
filePicker: envFilePicker ?? true
|
|
181
|
+
filePicker: envFilePicker ?? true,
|
|
182
|
+
shell: envShell
|
|
180
183
|
};
|
|
181
184
|
}
|
|
182
185
|
try {
|
|
@@ -205,7 +208,8 @@ async function loadConfig() {
|
|
|
205
208
|
codeMode: envCodeMode ?? parsed.codeMode,
|
|
206
209
|
costAttribution: envCostAttribution ?? parsed.costAttribution ?? false,
|
|
207
210
|
filePicker: envFilePicker ?? parsed.filePicker ?? true,
|
|
208
|
-
theme: parsed.theme
|
|
211
|
+
theme: parsed.theme,
|
|
212
|
+
shell: envShell ?? parsed.shell
|
|
209
213
|
};
|
|
210
214
|
}
|
|
211
215
|
if (parsed.accountId && parsed.apiToken) {
|
|
@@ -237,7 +241,8 @@ async function loadConfig() {
|
|
|
237
241
|
costAttribution: envCostAttribution ?? parsed.costAttribution ?? true,
|
|
238
242
|
filePicker: envFilePicker ?? parsed.filePicker ?? true,
|
|
239
243
|
cloudMode: envCloudMode ?? parsed.cloudMode,
|
|
240
|
-
theme: parsed.theme
|
|
244
|
+
theme: parsed.theme,
|
|
245
|
+
shell: envShell ?? parsed.shell
|
|
241
246
|
};
|
|
242
247
|
}
|
|
243
248
|
} catch {
|
|
@@ -456,28 +461,34 @@ function isCloudQuotaExhaustedError(err) {
|
|
|
456
461
|
function humanizeCloudflareError(err) {
|
|
457
462
|
const { code, httpStatus, message: message2 } = err;
|
|
458
463
|
if (code === 3040) {
|
|
459
|
-
return "Cloudflare Workers AI is at capacity.
|
|
464
|
+
return "Cloudflare Workers AI is at capacity (code: 3040). Please wait a moment and try again.";
|
|
460
465
|
}
|
|
461
466
|
if (httpStatus === 429) {
|
|
462
|
-
|
|
467
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
468
|
+
return `Rate limit hit${codeStr}. Please wait a moment and try again.`;
|
|
463
469
|
}
|
|
464
470
|
if (httpStatus === 403 || code === 1e4) {
|
|
465
|
-
|
|
471
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
472
|
+
return `Authentication failed${codeStr}. Check that your Cloudflare API token has the 'Workers AI' permission.
|
|
473
|
+
Get a new token: https://dash.cloudflare.com/profile/api-tokens`;
|
|
466
474
|
}
|
|
467
475
|
if (httpStatus === 401) {
|
|
468
|
-
|
|
476
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
477
|
+
return `Authentication required${codeStr}. Please check your API token or run \`kimiflare auth cloud\` if using cloud mode.`;
|
|
469
478
|
}
|
|
470
479
|
if (httpStatus === 400) {
|
|
480
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
471
481
|
if (message2.includes("invalid escaped character")) {
|
|
472
|
-
return
|
|
482
|
+
return `API rejected request${codeStr} (invalid JSON in conversation history). Run /clear to reset if it persists.`;
|
|
473
483
|
}
|
|
474
484
|
if (message2.includes("Invalid model ID")) {
|
|
475
485
|
return message2;
|
|
476
486
|
}
|
|
477
|
-
return
|
|
487
|
+
return `Bad request${codeStr}. The conversation may be too long or contain invalid characters. Run /compact or /clear.`;
|
|
478
488
|
}
|
|
479
489
|
if (httpStatus && httpStatus >= 500) {
|
|
480
|
-
|
|
490
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
491
|
+
return `Cloudflare servers are experiencing issues${codeStr}. Please wait a moment and try again.`;
|
|
481
492
|
}
|
|
482
493
|
return message2.replace(/\{[\s\S]*?\}/g, "(see logs for details)");
|
|
483
494
|
}
|
|
@@ -589,6 +600,7 @@ function cleanErrorMessage(msg) {
|
|
|
589
600
|
function isRetryable(err, attempt) {
|
|
590
601
|
if (attempt >= MAX_ATTEMPTS - 1) return false;
|
|
591
602
|
if (err.code !== void 0 && RETRYABLE_CODES.has(err.code)) return true;
|
|
603
|
+
if (err.httpStatus === 429) return true;
|
|
592
604
|
if (err.httpStatus !== void 0 && err.httpStatus >= 500 && err.httpStatus < 600) return true;
|
|
593
605
|
if (err.message.includes("Internal server error")) return true;
|
|
594
606
|
return false;
|
|
@@ -653,7 +665,10 @@ async function* runKimi(opts2) {
|
|
|
653
665
|
const msg = cleanErrorMessage(rawMsg);
|
|
654
666
|
const apiErr = new KimiApiError(`kimiflare: ${msg}`, err?.code, res.status);
|
|
655
667
|
if (isRetryable(apiErr, attempt)) {
|
|
656
|
-
const
|
|
668
|
+
const isRateLimit = apiErr.httpStatus === 429;
|
|
669
|
+
const baseDelay = isRateLimit ? 2e3 : 500;
|
|
670
|
+
const delay = baseDelay * 2 ** attempt + Math.random() * 250;
|
|
671
|
+
logger.warn("runKimi:retrying", { requestId, attempt, code: apiErr.code, httpStatus: apiErr.httpStatus, delay });
|
|
657
672
|
await sleep(delay, opts2.signal);
|
|
658
673
|
continue;
|
|
659
674
|
}
|
|
@@ -1571,8 +1586,8 @@ var require_node_gyp_build = __commonJS({
|
|
|
1571
1586
|
var abi = process.versions.modules;
|
|
1572
1587
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
1573
1588
|
var arch = process.env.npm_config_arch || os2.arch();
|
|
1574
|
-
var
|
|
1575
|
-
var libc = process.env.LIBC || (isAlpine(
|
|
1589
|
+
var platform5 = process.env.npm_config_platform || os2.platform();
|
|
1590
|
+
var libc = process.env.LIBC || (isAlpine(platform5) ? "musl" : "glibc");
|
|
1576
1591
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
1577
1592
|
var uv = (process.versions.uv || "").split(".")[0];
|
|
1578
1593
|
module.exports = load;
|
|
@@ -1597,7 +1612,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
1597
1612
|
var nearby = resolve3(path.dirname(process.execPath));
|
|
1598
1613
|
if (nearby) return nearby;
|
|
1599
1614
|
var target = [
|
|
1600
|
-
"platform=" +
|
|
1615
|
+
"platform=" + platform5,
|
|
1601
1616
|
"arch=" + arch,
|
|
1602
1617
|
"runtime=" + runtime,
|
|
1603
1618
|
"abi=" + abi,
|
|
@@ -1612,7 +1627,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
1612
1627
|
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
1613
1628
|
function resolve3(dir2) {
|
|
1614
1629
|
var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
|
|
1615
|
-
var tuple = tuples.filter(matchTuple(
|
|
1630
|
+
var tuple = tuples.filter(matchTuple(platform5, arch)).sort(compareTuples)[0];
|
|
1616
1631
|
if (!tuple) return;
|
|
1617
1632
|
var prebuilds = path.join(dir2, "prebuilds", tuple.name);
|
|
1618
1633
|
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
@@ -1638,17 +1653,17 @@ var require_node_gyp_build = __commonJS({
|
|
|
1638
1653
|
function parseTuple(name) {
|
|
1639
1654
|
var arr = name.split("-");
|
|
1640
1655
|
if (arr.length !== 2) return;
|
|
1641
|
-
var
|
|
1656
|
+
var platform6 = arr[0];
|
|
1642
1657
|
var architectures = arr[1].split("+");
|
|
1643
|
-
if (!
|
|
1658
|
+
if (!platform6) return;
|
|
1644
1659
|
if (!architectures.length) return;
|
|
1645
1660
|
if (!architectures.every(Boolean)) return;
|
|
1646
|
-
return { name, platform:
|
|
1661
|
+
return { name, platform: platform6, architectures };
|
|
1647
1662
|
}
|
|
1648
|
-
function matchTuple(
|
|
1663
|
+
function matchTuple(platform6, arch2) {
|
|
1649
1664
|
return function(tuple) {
|
|
1650
1665
|
if (tuple == null) return false;
|
|
1651
|
-
if (tuple.platform !==
|
|
1666
|
+
if (tuple.platform !== platform6) return false;
|
|
1652
1667
|
return tuple.architectures.includes(arch2);
|
|
1653
1668
|
};
|
|
1654
1669
|
}
|
|
@@ -1716,8 +1731,8 @@ var require_node_gyp_build = __commonJS({
|
|
|
1716
1731
|
if (process.env.ELECTRON_RUN_AS_NODE) return true;
|
|
1717
1732
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
1718
1733
|
}
|
|
1719
|
-
function isAlpine(
|
|
1720
|
-
return
|
|
1734
|
+
function isAlpine(platform6) {
|
|
1735
|
+
return platform6 === "linux" && fs.existsSync("/etc/alpine-release");
|
|
1721
1736
|
}
|
|
1722
1737
|
load.parseTags = parseTags;
|
|
1723
1738
|
load.matchTags = matchTags;
|
|
@@ -2826,7 +2841,7 @@ ${sandboxResult.output}` : sandboxResult.output;
|
|
|
2826
2841
|
const result = await opts2.executor.run(
|
|
2827
2842
|
{ id: tc.id, name: tc.function.name, arguments: tc.function.arguments },
|
|
2828
2843
|
opts2.callbacks.askPermission,
|
|
2829
|
-
{ cwd: opts2.cwd, signal: opts2.signal, onTasks: opts2.callbacks.onTasks, coauthor: opts2.coauthor, memoryManager: opts2.memoryManager, sessionId: opts2.sessionId, githubToken: opts2.githubToken },
|
|
2844
|
+
{ cwd: opts2.cwd, signal: opts2.signal, onTasks: opts2.callbacks.onTasks, coauthor: opts2.coauthor, memoryManager: opts2.memoryManager, sessionId: opts2.sessionId, githubToken: opts2.githubToken, shell: opts2.shell },
|
|
2830
2845
|
opts2.onFileChange
|
|
2831
2846
|
);
|
|
2832
2847
|
let content2 = result.content;
|
|
@@ -3463,8 +3478,36 @@ var init_edit = __esm({
|
|
|
3463
3478
|
|
|
3464
3479
|
// src/tools/bash.ts
|
|
3465
3480
|
import { spawn } from "child_process";
|
|
3466
|
-
import { tmpdir } from "os";
|
|
3481
|
+
import { tmpdir, platform as platform2 } from "os";
|
|
3467
3482
|
import { join as join8 } from "path";
|
|
3483
|
+
function getShellCommand(override) {
|
|
3484
|
+
const raw = override?.trim();
|
|
3485
|
+
if (raw && raw !== "auto") {
|
|
3486
|
+
const lower = raw.toLowerCase();
|
|
3487
|
+
if (lower === "bash") {
|
|
3488
|
+
return { shell: "bash", args: ["-lc"], isPosix: true };
|
|
3489
|
+
}
|
|
3490
|
+
if (lower === "cmd") {
|
|
3491
|
+
return { shell: process.env.COMSPEC || "cmd.exe", args: ["/c"], isPosix: false };
|
|
3492
|
+
}
|
|
3493
|
+
if (lower === "powershell") {
|
|
3494
|
+
return { shell: "powershell", args: ["-Command"], isPosix: false };
|
|
3495
|
+
}
|
|
3496
|
+
const base = lower.replace(/\\/g, "/").split("/").pop() || "";
|
|
3497
|
+
if (base.includes("cmd")) {
|
|
3498
|
+
return { shell: raw, args: ["/c"], isPosix: false };
|
|
3499
|
+
}
|
|
3500
|
+
if (base.includes("powershell") || base.includes("pwsh")) {
|
|
3501
|
+
return { shell: raw, args: ["-Command"], isPosix: false };
|
|
3502
|
+
}
|
|
3503
|
+
return { shell: raw, args: ["-lc"], isPosix: true };
|
|
3504
|
+
}
|
|
3505
|
+
const isWindows = platform2() === "win32";
|
|
3506
|
+
if (isWindows) {
|
|
3507
|
+
return { shell: process.env.COMSPEC || "cmd.exe", args: ["/c"], isPosix: false };
|
|
3508
|
+
}
|
|
3509
|
+
return { shell: "bash", args: ["-lc"], isPosix: true };
|
|
3510
|
+
}
|
|
3468
3511
|
function formatBashTitle(raw) {
|
|
3469
3512
|
let cmd = (raw ?? "").trim();
|
|
3470
3513
|
const m = cmd.match(/^cd\s+([^\s&;]+)\s*(?:&&|;)\s*(.*)$/);
|
|
@@ -3502,10 +3545,11 @@ function injectCoauthor(command, coauthor) {
|
|
|
3502
3545
|
}
|
|
3503
3546
|
function runBash(args, ctx) {
|
|
3504
3547
|
const timeout = Math.min(Math.max(1e3, args.timeout_ms ?? DEFAULT_TIMEOUT), MAX_TIMEOUT);
|
|
3505
|
-
const
|
|
3548
|
+
const { shell, args: shellArgs, isPosix } = getShellCommand(ctx.shell);
|
|
3549
|
+
const command = isPosix ? injectCoauthor(args.command, ctx.coauthor) : args.command;
|
|
3506
3550
|
return new Promise((resolve3, reject) => {
|
|
3507
|
-
logger.debug("bash:spawn", { command: args.command.slice(0, 200), cwd: ctx.cwd });
|
|
3508
|
-
const child = spawn(
|
|
3551
|
+
logger.debug("bash:spawn", { command: args.command.slice(0, 200), cwd: ctx.cwd, shell });
|
|
3552
|
+
const child = spawn(shell, [...shellArgs, command], {
|
|
3509
3553
|
cwd: ctx.cwd,
|
|
3510
3554
|
env: {
|
|
3511
3555
|
...process.env,
|
|
@@ -3573,7 +3617,7 @@ var init_bash = __esm({
|
|
|
3573
3617
|
MAX_TIMEOUT = 6e5;
|
|
3574
3618
|
bashTool = {
|
|
3575
3619
|
name: "bash",
|
|
3576
|
-
description: "Run a shell command
|
|
3620
|
+
description: "Run a shell command. On Unix the default shell is bash; on Windows it falls back to cmd.exe. Prompts the user for permission before executing. stdout and stderr are captured and combined. Large outputs are reduced to a compact summary by default; use expand_artifact to retrieve the full log.",
|
|
3577
3621
|
parameters: {
|
|
3578
3622
|
type: "object",
|
|
3579
3623
|
properties: {
|
|
@@ -10571,11 +10615,35 @@ var init_cloud_quota_message = __esm({
|
|
|
10571
10615
|
}
|
|
10572
10616
|
});
|
|
10573
10617
|
|
|
10618
|
+
// src/ui/api-error-message.tsx
|
|
10619
|
+
import { Box as Box5, Text as Text5 } from "ink";
|
|
10620
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
10621
|
+
function ApiErrorMessage({ httpStatus, code, message: message2 }) {
|
|
10622
|
+
const theme = useTheme();
|
|
10623
|
+
const parts = [];
|
|
10624
|
+
if (httpStatus !== void 0) parts.push(`HTTP ${httpStatus}`);
|
|
10625
|
+
if (code !== void 0) parts.push(`code: ${code}`);
|
|
10626
|
+
const meta = parts.join(" \xB7 ");
|
|
10627
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: theme.error, paddingX: 1, marginY: 1, children: [
|
|
10628
|
+
/* @__PURE__ */ jsxs5(Text5, { bold: true, color: theme.error, children: [
|
|
10629
|
+
"\u26A0 ",
|
|
10630
|
+
message2
|
|
10631
|
+
] }),
|
|
10632
|
+
meta && /* @__PURE__ */ jsx6(Text5, { color: theme.muted?.color ?? theme.info.color, dimColor: theme.muted?.dim ?? true, children: meta })
|
|
10633
|
+
] });
|
|
10634
|
+
}
|
|
10635
|
+
var init_api_error_message = __esm({
|
|
10636
|
+
"src/ui/api-error-message.tsx"() {
|
|
10637
|
+
"use strict";
|
|
10638
|
+
init_theme_context();
|
|
10639
|
+
}
|
|
10640
|
+
});
|
|
10641
|
+
|
|
10574
10642
|
// src/ui/chat.tsx
|
|
10575
10643
|
import React4 from "react";
|
|
10576
|
-
import { Box as
|
|
10644
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
10577
10645
|
import Spinner2 from "ink-spinner";
|
|
10578
|
-
import { jsx as
|
|
10646
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
10579
10647
|
function toolSignature(name, args) {
|
|
10580
10648
|
return `${name}:${args}`;
|
|
10581
10649
|
}
|
|
@@ -10588,6 +10656,7 @@ var init_chat = __esm({
|
|
|
10588
10656
|
init_theme_context();
|
|
10589
10657
|
init_narrator();
|
|
10590
10658
|
init_cloud_quota_message();
|
|
10659
|
+
init_api_error_message();
|
|
10591
10660
|
ChatView = React4.memo(function ChatView2({ events, showReasoning, verbose, intentTier }) {
|
|
10592
10661
|
const theme = useTheme();
|
|
10593
10662
|
const toolCounts = /* @__PURE__ */ new Map();
|
|
@@ -10601,12 +10670,12 @@ var init_chat = __esm({
|
|
|
10601
10670
|
for (const [sig, count] of toolCounts) {
|
|
10602
10671
|
if (count >= 3) repeatedSigs.add(sig);
|
|
10603
10672
|
}
|
|
10604
|
-
return /* @__PURE__ */
|
|
10673
|
+
return /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: events.map((e, i) => {
|
|
10605
10674
|
const prev = events[i - 1];
|
|
10606
10675
|
const showSeparator = !!(e.kind === "user" && prev && (prev.kind === "assistant" || prev.kind === "tool"));
|
|
10607
|
-
return /* @__PURE__ */
|
|
10608
|
-
showSeparator && /* @__PURE__ */
|
|
10609
|
-
/* @__PURE__ */
|
|
10676
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
10677
|
+
showSeparator && /* @__PURE__ */ jsx7(Box6, { marginY: 1, children: /* @__PURE__ */ jsx7(Text6, { color: theme.info.color, children: "\u2500".repeat(40) }) }),
|
|
10678
|
+
/* @__PURE__ */ jsx7(EventView, { evt: e, showReasoning, verbose, repeatedSigs, intentTier })
|
|
10610
10679
|
] }, e.key);
|
|
10611
10680
|
}) });
|
|
10612
10681
|
});
|
|
@@ -10621,61 +10690,61 @@ var init_chat = __esm({
|
|
|
10621
10690
|
if (evt.kind === "user") {
|
|
10622
10691
|
if (evt.queued) {
|
|
10623
10692
|
const mutedColor = theme.muted?.color ?? theme.info.color;
|
|
10624
|
-
return /* @__PURE__ */
|
|
10625
|
-
/* @__PURE__ */
|
|
10693
|
+
return /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
10694
|
+
/* @__PURE__ */ jsxs6(Text6, { italic: true, color: mutedColor, children: [
|
|
10626
10695
|
"\xB7\xB7\xB7",
|
|
10627
10696
|
" "
|
|
10628
10697
|
] }),
|
|
10629
|
-
/* @__PURE__ */
|
|
10630
|
-
/* @__PURE__ */
|
|
10698
|
+
/* @__PURE__ */ jsx7(Text6, { italic: true, color: mutedColor, children: evt.text }),
|
|
10699
|
+
/* @__PURE__ */ jsxs6(Text6, { italic: true, color: mutedColor, children: [
|
|
10631
10700
|
" ",
|
|
10632
10701
|
"(queued)"
|
|
10633
10702
|
] })
|
|
10634
10703
|
] }) });
|
|
10635
10704
|
}
|
|
10636
|
-
return /* @__PURE__ */
|
|
10637
|
-
/* @__PURE__ */
|
|
10638
|
-
/* @__PURE__ */
|
|
10705
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
10706
|
+
/* @__PURE__ */ jsxs6(Box6, { children: [
|
|
10707
|
+
/* @__PURE__ */ jsxs6(Text6, { bold: true, color: theme.user, children: [
|
|
10639
10708
|
"\u203A",
|
|
10640
10709
|
" "
|
|
10641
10710
|
] }),
|
|
10642
|
-
/* @__PURE__ */
|
|
10711
|
+
/* @__PURE__ */ jsx7(Text6, { bold: true, children: evt.text })
|
|
10643
10712
|
] }),
|
|
10644
|
-
evt.images && evt.images.length > 0 && /* @__PURE__ */
|
|
10713
|
+
evt.images && evt.images.length > 0 && /* @__PURE__ */ jsx7(Box6, { paddingLeft: 2, children: /* @__PURE__ */ jsxs6(Text6, { color: theme.info.color, children: [
|
|
10645
10714
|
"\u{1F5BC}\uFE0F ",
|
|
10646
10715
|
evt.images.join(", ")
|
|
10647
10716
|
] }) })
|
|
10648
10717
|
] });
|
|
10649
10718
|
}
|
|
10650
10719
|
if (evt.kind === "assistant") {
|
|
10651
|
-
return /* @__PURE__ */
|
|
10652
|
-
showReasoning && evt.reasoning ? /* @__PURE__ */
|
|
10720
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingLeft: 2, children: [
|
|
10721
|
+
showReasoning && evt.reasoning ? /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs6(Text6, { color: theme.reasoning.color, children: [
|
|
10653
10722
|
"thinking\u2026",
|
|
10654
10723
|
" ",
|
|
10655
10724
|
evt.reasoning.length > 400 ? evt.reasoning.slice(0, 400) + "\u2026" : evt.reasoning
|
|
10656
10725
|
] }) }) : null,
|
|
10657
|
-
evt.text ? /* @__PURE__ */
|
|
10658
|
-
evt.streaming && /* @__PURE__ */
|
|
10726
|
+
evt.text ? /* @__PURE__ */ jsx7(MD, { text: evt.text }) : null,
|
|
10727
|
+
evt.streaming && /* @__PURE__ */ jsx7(Text6, { color: theme.spinner, children: /* @__PURE__ */ jsx7(Spinner2, { type: "dots" }) })
|
|
10659
10728
|
] });
|
|
10660
10729
|
}
|
|
10661
10730
|
if (evt.kind === "tool") {
|
|
10662
10731
|
const isRepeated = repeatedSigs?.has(toolSignature(evt.name, evt.args)) ?? false;
|
|
10663
|
-
return /* @__PURE__ */
|
|
10732
|
+
return /* @__PURE__ */ jsx7(ToolView, { evt, verbose, isRepeated, intentTier });
|
|
10664
10733
|
}
|
|
10665
10734
|
if (evt.kind === "info") {
|
|
10666
|
-
return /* @__PURE__ */
|
|
10735
|
+
return /* @__PURE__ */ jsxs6(Text6, { color: theme.info.color, children: [
|
|
10667
10736
|
"\xB7 ",
|
|
10668
10737
|
humanizeInfo(evt.text, intentTier)
|
|
10669
10738
|
] });
|
|
10670
10739
|
}
|
|
10671
10740
|
if (evt.kind === "memory") {
|
|
10672
|
-
return /* @__PURE__ */
|
|
10741
|
+
return /* @__PURE__ */ jsxs6(Text6, { color: theme.info.color, children: [
|
|
10673
10742
|
"\u25C8 ",
|
|
10674
10743
|
humanizeMemory(evt.text, intentTier)
|
|
10675
10744
|
] });
|
|
10676
10745
|
}
|
|
10677
10746
|
if (evt.kind === "cloud_quota_exhausted") {
|
|
10678
|
-
return /* @__PURE__ */
|
|
10747
|
+
return /* @__PURE__ */ jsx7(
|
|
10679
10748
|
CloudQuotaMessage,
|
|
10680
10749
|
{
|
|
10681
10750
|
used: evt.used,
|
|
@@ -10694,9 +10763,19 @@ var init_chat = __esm({
|
|
|
10694
10763
|
}
|
|
10695
10764
|
const metaText = humanizeMeta(metaParts, intentTier ?? evt.intentTier);
|
|
10696
10765
|
if (!metaText) return null;
|
|
10697
|
-
return /* @__PURE__ */
|
|
10766
|
+
return /* @__PURE__ */ jsx7(Text6, { color: theme.info.color, dimColor: true, children: metaText });
|
|
10767
|
+
}
|
|
10768
|
+
if (evt.kind === "api_error") {
|
|
10769
|
+
return /* @__PURE__ */ jsx7(
|
|
10770
|
+
ApiErrorMessage,
|
|
10771
|
+
{
|
|
10772
|
+
httpStatus: evt.httpStatus,
|
|
10773
|
+
code: evt.code,
|
|
10774
|
+
message: evt.message
|
|
10775
|
+
}
|
|
10776
|
+
);
|
|
10698
10777
|
}
|
|
10699
|
-
return /* @__PURE__ */
|
|
10778
|
+
return /* @__PURE__ */ jsxs6(Text6, { color: theme.error, children: [
|
|
10700
10779
|
"! ",
|
|
10701
10780
|
evt.text
|
|
10702
10781
|
] });
|
|
@@ -10706,9 +10785,9 @@ var init_chat = __esm({
|
|
|
10706
10785
|
|
|
10707
10786
|
// src/ui/status.tsx
|
|
10708
10787
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
10709
|
-
import { Box as
|
|
10788
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
10710
10789
|
import Spinner3 from "ink-spinner";
|
|
10711
|
-
import { jsx as
|
|
10790
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
10712
10791
|
function StatusBar({ usage, sessionUsage, thinking, turnStartedAt, mode, contextLimit, gatewayMeta, codeMode, cloudMode, cloudBudget, skillsActive, memoryRecalled, phase, currentTool, lastActivityAt, kimiMdStale, gitBranch, intentTier }) {
|
|
10713
10792
|
const theme = useTheme();
|
|
10714
10793
|
const [now2, setNow] = useState2(Date.now());
|
|
@@ -10736,32 +10815,32 @@ function StatusBar({ usage, sessionUsage, thinking, turnStartedAt, mode, context
|
|
|
10736
10815
|
const idleLabel = idleMs > 3e4 ? ` (idle ${formatElapsed2(Math.floor(idleMs / 1e3))})` : "";
|
|
10737
10816
|
const thinkingText = metaParts.length > 0 ? `${phaseLabel}${elapsed ? ` \xB7 ${elapsed}` : ""}${idleLabel} \xB7 ${metaParts.join(" \xB7 ")}` : `${phaseLabel}${elapsed ? ` \xB7 ${elapsed}` : ""}${idleLabel}`;
|
|
10738
10817
|
const readyText = idleParts.length > 0 ? `${idleParts.join(" \xB7 ")} \xB7 ready` : "ready";
|
|
10739
|
-
return /* @__PURE__ */
|
|
10740
|
-
/* @__PURE__ */
|
|
10741
|
-
/* @__PURE__ */
|
|
10818
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
10819
|
+
/* @__PURE__ */ jsxs7(Box7, { children: [
|
|
10820
|
+
/* @__PURE__ */ jsxs7(Text7, { color: modeColor, bold: true, children: [
|
|
10742
10821
|
"[",
|
|
10743
10822
|
mode,
|
|
10744
10823
|
"]"
|
|
10745
10824
|
] }),
|
|
10746
|
-
/* @__PURE__ */
|
|
10747
|
-
thinking ? /* @__PURE__ */
|
|
10748
|
-
/* @__PURE__ */
|
|
10825
|
+
/* @__PURE__ */ jsx8(Text7, { children: " " }),
|
|
10826
|
+
thinking ? /* @__PURE__ */ jsxs7(Text7, { color: theme.spinner, children: [
|
|
10827
|
+
/* @__PURE__ */ jsx8(Spinner3, { type: "dots2" }),
|
|
10749
10828
|
" ",
|
|
10750
10829
|
thinkingText
|
|
10751
|
-
] }) : /* @__PURE__ */
|
|
10830
|
+
] }) : /* @__PURE__ */ jsx8(Text7, { color: theme.info.color, children: readyText })
|
|
10752
10831
|
] }),
|
|
10753
|
-
usage && /* @__PURE__ */
|
|
10754
|
-
/* @__PURE__ */
|
|
10755
|
-
warn ? /* @__PURE__ */
|
|
10832
|
+
usage && /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
10833
|
+
/* @__PURE__ */ jsx8(Text7, { color: theme.info.color, children: buildRightParts(usage, contextLimit, sessionUsage, gatewayMeta, cloudMode, cloudBudget).join(" \xB7 ") }),
|
|
10834
|
+
warn ? /* @__PURE__ */ jsxs7(Text7, { color: theme.warn, bold: true, children: [
|
|
10756
10835
|
" \xB7 ",
|
|
10757
10836
|
"/compact recommended"
|
|
10758
10837
|
] }) : null,
|
|
10759
|
-
kimiMdStale ? /* @__PURE__ */
|
|
10838
|
+
kimiMdStale ? /* @__PURE__ */ jsxs7(Text7, { color: theme.warn, bold: true, children: [
|
|
10760
10839
|
" \xB7 ",
|
|
10761
10840
|
"\u26A0 KIMI.md stale \xB7 run /init"
|
|
10762
10841
|
] }) : null
|
|
10763
10842
|
] }),
|
|
10764
|
-
!thinking && /* @__PURE__ */
|
|
10843
|
+
!thinking && /* @__PURE__ */ jsx8(Box7, { children: /* @__PURE__ */ jsx8(Text7, { color: theme.muted?.color ?? theme.info.color, dimColor: theme.muted?.dim, children: "tip: shift+tab cycles mode" }) })
|
|
10765
10844
|
] });
|
|
10766
10845
|
}
|
|
10767
10846
|
function buildRightParts(usage, contextLimit, sessionUsage, gatewayMeta, cloudMode, cloudBudget) {
|
|
@@ -11342,8 +11421,8 @@ var init_source = __esm({
|
|
|
11342
11421
|
|
|
11343
11422
|
// src/ui/text-input.tsx
|
|
11344
11423
|
import { useState as useState3, useEffect as useEffect3, useRef } from "react";
|
|
11345
|
-
import { Text as
|
|
11346
|
-
import { jsx as
|
|
11424
|
+
import { Text as Text8, useInput } from "ink";
|
|
11425
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
11347
11426
|
function shouldTreatAsPaste(input) {
|
|
11348
11427
|
if (input.length >= PASTE_CHAR_THRESHOLD) return true;
|
|
11349
11428
|
const newlines = (input.match(/\n/g) ?? []).length;
|
|
@@ -11564,7 +11643,7 @@ function CustomTextInput({
|
|
|
11564
11643
|
} else if (cursorOffset === displayValue.length) {
|
|
11565
11644
|
renderedValue += source_default.inverse(" ");
|
|
11566
11645
|
}
|
|
11567
|
-
return /* @__PURE__ */
|
|
11646
|
+
return /* @__PURE__ */ jsx9(Text8, { children: renderedValue });
|
|
11568
11647
|
}
|
|
11569
11648
|
function findPasteTokenEndingAt(value, pos, pastes) {
|
|
11570
11649
|
if (pos <= 0 || value[pos - 1] !== "\u2998") return -1;
|
|
@@ -11587,9 +11666,9 @@ var init_text_input = __esm({
|
|
|
11587
11666
|
|
|
11588
11667
|
// src/ui/permission.tsx
|
|
11589
11668
|
import { useState as useState4, useCallback } from "react";
|
|
11590
|
-
import { Box as
|
|
11591
|
-
import { platform as
|
|
11592
|
-
import { jsx as
|
|
11669
|
+
import { Box as Box8, Text as Text9, useInput as useInput2 } from "ink";
|
|
11670
|
+
import { platform as platform3 } from "os";
|
|
11671
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
11593
11672
|
function formatSelection(label, shortcut) {
|
|
11594
11673
|
return `${label} [${MOD_KEY}+${shortcut}]`;
|
|
11595
11674
|
}
|
|
@@ -11677,10 +11756,10 @@ function PermissionModal({ tool, args, onDecide, onFeedback }) {
|
|
|
11677
11756
|
{ isActive: !feedbackActive }
|
|
11678
11757
|
);
|
|
11679
11758
|
if (showHelp) {
|
|
11680
|
-
return /* @__PURE__ */
|
|
11681
|
-
/* @__PURE__ */
|
|
11682
|
-
/* @__PURE__ */
|
|
11683
|
-
/* @__PURE__ */
|
|
11759
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: theme.permission, paddingX: 1, children: [
|
|
11760
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.permission, bold: true, children: "Permission modal \u2014 keyboard shortcuts" }),
|
|
11761
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "\u2191 / \u2193 or j / k \u2014 navigate options" }),
|
|
11762
|
+
/* @__PURE__ */ jsxs8(Text9, { color: theme.info.color, children: [
|
|
11684
11763
|
MOD_KEY,
|
|
11685
11764
|
"+1 / ",
|
|
11686
11765
|
MOD_KEY,
|
|
@@ -11688,31 +11767,31 @@ function PermissionModal({ tool, args, onDecide, onFeedback }) {
|
|
|
11688
11767
|
MOD_KEY,
|
|
11689
11768
|
"+3 \u2014 select option directly"
|
|
11690
11769
|
] }),
|
|
11691
|
-
/* @__PURE__ */
|
|
11692
|
-
/* @__PURE__ */
|
|
11693
|
-
/* @__PURE__ */
|
|
11694
|
-
/* @__PURE__ */
|
|
11695
|
-
/* @__PURE__ */
|
|
11696
|
-
/* @__PURE__ */
|
|
11697
|
-
/* @__PURE__ */
|
|
11770
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "Enter \u2014 confirm selection" }),
|
|
11771
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "Esc \u2014 deny and close" }),
|
|
11772
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "? \u2014 toggle this help" }),
|
|
11773
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "When feedback input is open:" }),
|
|
11774
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: " Enter \u2014 submit feedback and deny" }),
|
|
11775
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: " Esc \u2014 deny without feedback" }),
|
|
11776
|
+
/* @__PURE__ */ jsx10(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text9, { color: theme.accent, children: "Press any key to close" }) })
|
|
11698
11777
|
] });
|
|
11699
11778
|
}
|
|
11700
|
-
return /* @__PURE__ */
|
|
11701
|
-
/* @__PURE__ */
|
|
11702
|
-
/* @__PURE__ */
|
|
11779
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: theme.permission, paddingX: 1, children: [
|
|
11780
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.permission, bold: true, children: "Permission requested" }),
|
|
11781
|
+
/* @__PURE__ */ jsxs8(Text9, { children: [
|
|
11703
11782
|
"tool: ",
|
|
11704
|
-
/* @__PURE__ */
|
|
11783
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.tool, children: tool.name })
|
|
11705
11784
|
] }),
|
|
11706
|
-
render2?.title ? /* @__PURE__ */
|
|
11785
|
+
render2?.title ? /* @__PURE__ */ jsxs8(Text9, { children: [
|
|
11707
11786
|
"action: ",
|
|
11708
11787
|
render2.title
|
|
11709
11788
|
] }) : null,
|
|
11710
|
-
render2?.diff ? /* @__PURE__ */
|
|
11789
|
+
render2?.diff ? /* @__PURE__ */ jsx10(Box8, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx10(DiffView, { ...render2.diff }) }) : /* @__PURE__ */ jsxs8(Text9, { color: theme.info.color, children: [
|
|
11711
11790
|
"args: ",
|
|
11712
11791
|
JSON.stringify(args)
|
|
11713
11792
|
] }),
|
|
11714
|
-
/* @__PURE__ */
|
|
11715
|
-
|
|
11793
|
+
/* @__PURE__ */ jsx10(Box8, { marginTop: 1, flexDirection: "column", children: OPTIONS.map((opt, i) => /* @__PURE__ */ jsxs8(
|
|
11794
|
+
Text9,
|
|
11716
11795
|
{
|
|
11717
11796
|
color: i === selectedIndex ? theme.accent : void 0,
|
|
11718
11797
|
bold: i === selectedIndex,
|
|
@@ -11723,10 +11802,10 @@ function PermissionModal({ tool, args, onDecide, onFeedback }) {
|
|
|
11723
11802
|
},
|
|
11724
11803
|
opt.value
|
|
11725
11804
|
)) }),
|
|
11726
|
-
feedbackActive && /* @__PURE__ */
|
|
11727
|
-
/* @__PURE__ */
|
|
11728
|
-
/* @__PURE__ */
|
|
11729
|
-
/* @__PURE__ */
|
|
11805
|
+
feedbackActive && /* @__PURE__ */ jsxs8(Box8, { marginTop: 1, flexDirection: "column", children: [
|
|
11806
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.palette.error, children: "Tell me what to do instead" }),
|
|
11807
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, dimColor: true, children: "Press Esc to deny without feedback" }),
|
|
11808
|
+
/* @__PURE__ */ jsx10(
|
|
11730
11809
|
CustomTextInput,
|
|
11731
11810
|
{
|
|
11732
11811
|
value: feedbackValue,
|
|
@@ -11751,32 +11830,32 @@ var init_permission = __esm({
|
|
|
11751
11830
|
{ value: "allow_session", label: "Allow for this session", key: 2 },
|
|
11752
11831
|
{ value: "deny", label: "Something else", key: 3 }
|
|
11753
11832
|
];
|
|
11754
|
-
MOD_KEY =
|
|
11833
|
+
MOD_KEY = platform3() === "darwin" ? "\u2325" : "Alt";
|
|
11755
11834
|
}
|
|
11756
11835
|
});
|
|
11757
11836
|
|
|
11758
11837
|
// src/ui/limit-modal.tsx
|
|
11759
|
-
import { Box as
|
|
11838
|
+
import { Box as Box9, Text as Text10 } from "ink";
|
|
11760
11839
|
import SelectInput from "ink-select-input";
|
|
11761
|
-
import { jsx as
|
|
11840
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
11762
11841
|
function LimitModal({ limit, onDecide }) {
|
|
11763
11842
|
const theme = useTheme();
|
|
11764
11843
|
const items = [
|
|
11765
11844
|
{ label: "Continue", value: "continue" },
|
|
11766
11845
|
{ label: "Stop", value: "stop" }
|
|
11767
11846
|
];
|
|
11768
|
-
return /* @__PURE__ */
|
|
11769
|
-
/* @__PURE__ */
|
|
11847
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", borderStyle: "round", borderColor: theme.error, paddingX: 1, children: [
|
|
11848
|
+
/* @__PURE__ */ jsxs9(Text10, { color: theme.error, bold: true, children: [
|
|
11770
11849
|
"Tool-call limit reached (",
|
|
11771
11850
|
limit,
|
|
11772
11851
|
")"
|
|
11773
11852
|
] }),
|
|
11774
|
-
/* @__PURE__ */
|
|
11853
|
+
/* @__PURE__ */ jsxs9(Text10, { dimColor: true, children: [
|
|
11775
11854
|
"This session has made ",
|
|
11776
11855
|
limit,
|
|
11777
11856
|
" tool calls. What would you like to do?"
|
|
11778
11857
|
] }),
|
|
11779
|
-
/* @__PURE__ */
|
|
11858
|
+
/* @__PURE__ */ jsx11(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx11(
|
|
11780
11859
|
SelectInput,
|
|
11781
11860
|
{
|
|
11782
11861
|
items,
|
|
@@ -11863,9 +11942,9 @@ var init_fuzzy = __esm({
|
|
|
11863
11942
|
|
|
11864
11943
|
// src/ui/resume-picker.tsx
|
|
11865
11944
|
import { useState as useState5 } from "react";
|
|
11866
|
-
import { Box as
|
|
11945
|
+
import { Box as Box10, Text as Text11, useInput as useInput3 } from "ink";
|
|
11867
11946
|
import SelectInput2 from "ink-select-input";
|
|
11868
|
-
import { jsx as
|
|
11947
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
11869
11948
|
function ResumePicker({ sessions, onPick }) {
|
|
11870
11949
|
const theme = useTheme();
|
|
11871
11950
|
const [page, setPage] = useState5(0);
|
|
@@ -11906,10 +11985,10 @@ function ResumePicker({ sessions, onPick }) {
|
|
|
11906
11985
|
}
|
|
11907
11986
|
});
|
|
11908
11987
|
if (sessions.length === 0) {
|
|
11909
|
-
return /* @__PURE__ */
|
|
11910
|
-
/* @__PURE__ */
|
|
11911
|
-
/* @__PURE__ */
|
|
11912
|
-
/* @__PURE__ */
|
|
11988
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
11989
|
+
/* @__PURE__ */ jsx12(Text11, { color: theme.accent, bold: true, children: "Resume a session" }),
|
|
11990
|
+
/* @__PURE__ */ jsx12(Text11, { color: theme.info.color, children: "No saved sessions yet. Press Enter to dismiss." }),
|
|
11991
|
+
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(
|
|
11913
11992
|
SelectInput2,
|
|
11914
11993
|
{
|
|
11915
11994
|
items: [{ label: "(back)", value: "__cancel__" }],
|
|
@@ -11922,9 +12001,9 @@ function ResumePicker({ sessions, onPick }) {
|
|
|
11922
12001
|
label: `${formatDate(s.updatedAt)} \xB7 ${s.messageCount} msgs \xB7 ${s.title ?? s.firstPrompt}`,
|
|
11923
12002
|
value: s.id
|
|
11924
12003
|
}));
|
|
11925
|
-
return /* @__PURE__ */
|
|
11926
|
-
/* @__PURE__ */
|
|
11927
|
-
/* @__PURE__ */
|
|
12004
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12005
|
+
/* @__PURE__ */ jsx12(Text11, { color: theme.accent, bold: true, children: "Resume a session" }),
|
|
12006
|
+
/* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
|
|
11928
12007
|
query ? `Search: ${query}\u258C` : "Type to search\u2026",
|
|
11929
12008
|
" \xB7 Page ",
|
|
11930
12009
|
safePage + 1,
|
|
@@ -11934,7 +12013,7 @@ function ResumePicker({ sessions, onPick }) {
|
|
|
11934
12013
|
filtered.length,
|
|
11935
12014
|
" total)"
|
|
11936
12015
|
] }),
|
|
11937
|
-
/* @__PURE__ */
|
|
12016
|
+
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(
|
|
11938
12017
|
SelectInput2,
|
|
11939
12018
|
{
|
|
11940
12019
|
items,
|
|
@@ -11949,7 +12028,7 @@ function ResumePicker({ sessions, onPick }) {
|
|
|
11949
12028
|
}
|
|
11950
12029
|
}
|
|
11951
12030
|
) }),
|
|
11952
|
-
/* @__PURE__ */
|
|
12031
|
+
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
|
|
11953
12032
|
safePage > 0 ? "\u2190 prev " : "",
|
|
11954
12033
|
safePage < totalPages - 1 ? "\u2192 next " : "",
|
|
11955
12034
|
"q: cancel"
|
|
@@ -11981,9 +12060,9 @@ var init_resume_picker = __esm({
|
|
|
11981
12060
|
|
|
11982
12061
|
// src/ui/checkpoint-picker.tsx
|
|
11983
12062
|
import { useState as useState6 } from "react";
|
|
11984
|
-
import { Box as
|
|
12063
|
+
import { Box as Box11, Text as Text12, useInput as useInput4 } from "ink";
|
|
11985
12064
|
import SelectInput3 from "ink-select-input";
|
|
11986
|
-
import { jsx as
|
|
12065
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
11987
12066
|
function CheckpointPicker({ session, checkpoints, onPick }) {
|
|
11988
12067
|
const theme = useTheme();
|
|
11989
12068
|
const [selectedIndex, setSelectedIndex] = useState6(0);
|
|
@@ -12003,16 +12082,16 @@ function CheckpointPicker({ session, checkpoints, onPick }) {
|
|
|
12003
12082
|
value: cp.id
|
|
12004
12083
|
}))
|
|
12005
12084
|
];
|
|
12006
|
-
return /* @__PURE__ */
|
|
12007
|
-
/* @__PURE__ */
|
|
12008
|
-
/* @__PURE__ */
|
|
12085
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12086
|
+
/* @__PURE__ */ jsx13(Text12, { color: theme.accent, bold: true, children: session.firstPrompt.slice(0, 50) }),
|
|
12087
|
+
/* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
|
|
12009
12088
|
session.messageCount,
|
|
12010
12089
|
" turns \xB7 ",
|
|
12011
12090
|
checkpoints.length,
|
|
12012
12091
|
" checkpoint",
|
|
12013
12092
|
checkpoints.length === 1 ? "" : "s"
|
|
12014
12093
|
] }),
|
|
12015
|
-
/* @__PURE__ */
|
|
12094
|
+
/* @__PURE__ */ jsx13(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx13(
|
|
12016
12095
|
SelectInput3,
|
|
12017
12096
|
{
|
|
12018
12097
|
items,
|
|
@@ -12030,7 +12109,7 @@ function CheckpointPicker({ session, checkpoints, onPick }) {
|
|
|
12030
12109
|
}
|
|
12031
12110
|
}
|
|
12032
12111
|
) }),
|
|
12033
|
-
/* @__PURE__ */
|
|
12112
|
+
/* @__PURE__ */ jsx13(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text12, { color: theme.info.color, children: "q: cancel / go back" }) })
|
|
12034
12113
|
] });
|
|
12035
12114
|
}
|
|
12036
12115
|
function formatDate2(iso) {
|
|
@@ -12055,9 +12134,9 @@ var init_checkpoint_picker = __esm({
|
|
|
12055
12134
|
|
|
12056
12135
|
// src/ui/task-list.tsx
|
|
12057
12136
|
import { useEffect as useEffect4, useRef as useRef2, useState as useState7 } from "react";
|
|
12058
|
-
import { Box as
|
|
12137
|
+
import { Box as Box12, Text as Text13 } from "ink";
|
|
12059
12138
|
import Spinner4 from "ink-spinner";
|
|
12060
|
-
import { jsx as
|
|
12139
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
12061
12140
|
function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
12062
12141
|
const theme = useTheme();
|
|
12063
12142
|
const [now2, setNow] = useState7(Date.now());
|
|
@@ -12095,18 +12174,18 @@ function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
|
12095
12174
|
const headerStats = [elapsed, tokensDelta > 0 ? `\u2191 ${formatTokens3(tokensDelta)} tokens` : null].filter(Boolean).join(" \xB7 ");
|
|
12096
12175
|
const visibleTasks = tasks.slice(0, MAX_VISIBLE);
|
|
12097
12176
|
const hiddenPending = Math.max(0, tasks.length - visibleTasks.length);
|
|
12098
|
-
return /* @__PURE__ */
|
|
12099
|
-
/* @__PURE__ */
|
|
12100
|
-
/* @__PURE__ */
|
|
12101
|
-
headerStats && /* @__PURE__ */
|
|
12177
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", marginBottom: 1, children: [
|
|
12178
|
+
/* @__PURE__ */ jsxs12(Box12, { children: [
|
|
12179
|
+
/* @__PURE__ */ jsx14(Text13, { color: celebrating ? theme.palette.success : allDone ? "green" : theme.accent, bold: true, children: celebrating ? `\u2728 ${header}` : header }),
|
|
12180
|
+
headerStats && /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
12102
12181
|
" ",
|
|
12103
12182
|
"(",
|
|
12104
12183
|
headerStats,
|
|
12105
12184
|
")"
|
|
12106
12185
|
] })
|
|
12107
12186
|
] }),
|
|
12108
|
-
visibleTasks.map((t) => /* @__PURE__ */
|
|
12109
|
-
hiddenPending > 0 && /* @__PURE__ */
|
|
12187
|
+
visibleTasks.map((t) => /* @__PURE__ */ jsx14(TaskRow, { task: t }, t.id)),
|
|
12188
|
+
hiddenPending > 0 && /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
12110
12189
|
" ",
|
|
12111
12190
|
"\u2026 +",
|
|
12112
12191
|
hiddenPending,
|
|
@@ -12117,21 +12196,21 @@ function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
|
12117
12196
|
function TaskRow({ task }) {
|
|
12118
12197
|
const theme = useTheme();
|
|
12119
12198
|
if (task.status === "completed") {
|
|
12120
|
-
return /* @__PURE__ */
|
|
12199
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
12121
12200
|
" ",
|
|
12122
12201
|
"\u2713 ",
|
|
12123
|
-
/* @__PURE__ */
|
|
12202
|
+
/* @__PURE__ */ jsx14(Text13, { strikethrough: true, children: task.title })
|
|
12124
12203
|
] });
|
|
12125
12204
|
}
|
|
12126
12205
|
if (task.status === "in_progress") {
|
|
12127
|
-
return /* @__PURE__ */
|
|
12206
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, bold: true, children: [
|
|
12128
12207
|
" ",
|
|
12129
|
-
/* @__PURE__ */
|
|
12208
|
+
/* @__PURE__ */ jsx14(Spinner4, { type: "line" }),
|
|
12130
12209
|
" ",
|
|
12131
12210
|
task.title
|
|
12132
12211
|
] });
|
|
12133
12212
|
}
|
|
12134
|
-
return /* @__PURE__ */
|
|
12213
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
12135
12214
|
" ",
|
|
12136
12215
|
"\u2610 ",
|
|
12137
12216
|
task.title
|
|
@@ -12159,15 +12238,15 @@ var init_task_list = __esm({
|
|
|
12159
12238
|
|
|
12160
12239
|
// src/ui/onboarding.tsx
|
|
12161
12240
|
import { useState as useState8, useEffect as useEffect5, useCallback as useCallback2 } from "react";
|
|
12162
|
-
import { Box as
|
|
12241
|
+
import { Box as Box13, Text as Text14, useInput as useInput5 } from "ink";
|
|
12163
12242
|
import SelectInput4 from "ink-select-input";
|
|
12164
12243
|
import Spinner5 from "ink-spinner";
|
|
12165
12244
|
import { exec } from "child_process";
|
|
12166
12245
|
import { promisify as promisify2 } from "util";
|
|
12167
|
-
import { Fragment, jsx as
|
|
12246
|
+
import { Fragment, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
12168
12247
|
function openBrowser(url) {
|
|
12169
|
-
const
|
|
12170
|
-
const cmd =
|
|
12248
|
+
const platform5 = process.platform;
|
|
12249
|
+
const cmd = platform5 === "darwin" ? `open "${url}"` : platform5 === "win32" ? `start "" "${url}"` : `xdg-open "${url}"`;
|
|
12171
12250
|
exec(cmd, (err) => {
|
|
12172
12251
|
if (err) {
|
|
12173
12252
|
}
|
|
@@ -12320,24 +12399,24 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12320
12399
|
const byokSteps = ["accountId", "apiToken", "model", "confirm"];
|
|
12321
12400
|
const stepIndex = step === "mode" ? 1 : step === "cloudAuth" ? 2 : byokSteps.indexOf(step) + 2;
|
|
12322
12401
|
const totalSteps = mode === "cloud" ? 2 : byokSteps.length + 1;
|
|
12323
|
-
return /* @__PURE__ */
|
|
12324
|
-
/* @__PURE__ */
|
|
12325
|
-
/* @__PURE__ */
|
|
12326
|
-
/* @__PURE__ */
|
|
12402
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingY: 1, children: [
|
|
12403
|
+
/* @__PURE__ */ jsxs13(Box13, { marginBottom: 1, children: [
|
|
12404
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: theme.palette.primary, children: "kimiflare" }),
|
|
12405
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12327
12406
|
" ",
|
|
12328
12407
|
"Terminal coding agent"
|
|
12329
12408
|
] })
|
|
12330
12409
|
] }),
|
|
12331
|
-
/* @__PURE__ */
|
|
12410
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12332
12411
|
"Step ",
|
|
12333
12412
|
stepIndex,
|
|
12334
12413
|
" of ",
|
|
12335
12414
|
totalSteps
|
|
12336
12415
|
] }),
|
|
12337
|
-
/* @__PURE__ */
|
|
12338
|
-
step === "mode" && /* @__PURE__ */
|
|
12339
|
-
/* @__PURE__ */
|
|
12340
|
-
/* @__PURE__ */
|
|
12416
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
12417
|
+
step === "mode" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12418
|
+
/* @__PURE__ */ jsx15(Text14, { children: "How do you want to connect?" }),
|
|
12419
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
12341
12420
|
SelectInput4,
|
|
12342
12421
|
{
|
|
12343
12422
|
items: [
|
|
@@ -12348,19 +12427,19 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12348
12427
|
}
|
|
12349
12428
|
) })
|
|
12350
12429
|
] }),
|
|
12351
|
-
step === "cloudAuth" && cloudAuth?.phase === "ready" && /* @__PURE__ */
|
|
12352
|
-
/* @__PURE__ */
|
|
12353
|
-
/* @__PURE__ */
|
|
12354
|
-
/* @__PURE__ */
|
|
12355
|
-
/* @__PURE__ */
|
|
12430
|
+
step === "cloudAuth" && cloudAuth?.phase === "ready" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12431
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Authenticating with Kimiflare Cloud..." }),
|
|
12432
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
12433
|
+
/* @__PURE__ */ jsx15(Text14, { children: "1. Open this URL in your browser:" }),
|
|
12434
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: cloudAuth.codes.authUrl })
|
|
12356
12435
|
] }),
|
|
12357
|
-
/* @__PURE__ */
|
|
12358
|
-
/* @__PURE__ */
|
|
12359
|
-
/* @__PURE__ */
|
|
12436
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12437
|
+
/* @__PURE__ */ jsx15(Text14, { children: "2. " }),
|
|
12438
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "[Press Enter to open browser]" })
|
|
12360
12439
|
] }),
|
|
12361
|
-
/* @__PURE__ */
|
|
12362
|
-
/* @__PURE__ */
|
|
12363
|
-
/* @__PURE__ */
|
|
12440
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12441
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12442
|
+
/* @__PURE__ */ jsx15(
|
|
12364
12443
|
CustomTextInput,
|
|
12365
12444
|
{
|
|
12366
12445
|
value: "",
|
|
@@ -12371,28 +12450,28 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12371
12450
|
)
|
|
12372
12451
|
] })
|
|
12373
12452
|
] }),
|
|
12374
|
-
step === "cloudAuth" && cloudAuth?.phase === "polling" && /* @__PURE__ */
|
|
12375
|
-
/* @__PURE__ */
|
|
12376
|
-
/* @__PURE__ */
|
|
12453
|
+
step === "cloudAuth" && cloudAuth?.phase === "polling" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12454
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
12455
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.spinner, children: /* @__PURE__ */ jsx15(Spinner5, { type: "dots" }) }),
|
|
12377
12456
|
" ",
|
|
12378
12457
|
"Waiting for authentication..."
|
|
12379
12458
|
] }),
|
|
12380
|
-
/* @__PURE__ */
|
|
12459
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12381
12460
|
"Expires in ",
|
|
12382
12461
|
formatRemaining(POLL_TIMEOUT_MS - (Date.now() - cloudAuth.startTime))
|
|
12383
12462
|
] }),
|
|
12384
|
-
/* @__PURE__ */
|
|
12463
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12385
12464
|
"URL: ",
|
|
12386
12465
|
cloudAuth.codes.authUrl
|
|
12387
12466
|
] })
|
|
12388
12467
|
] }),
|
|
12389
|
-
step === "cloudAuth" && cloudAuth?.phase === "success" && /* @__PURE__ */
|
|
12390
|
-
/* @__PURE__ */
|
|
12391
|
-
/* @__PURE__ */
|
|
12392
|
-
/* @__PURE__ */
|
|
12468
|
+
step === "cloudAuth" && cloudAuth?.phase === "success" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12469
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.success, children: "Authenticated!" }),
|
|
12470
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
12471
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
12393
12472
|
"Token budget:",
|
|
12394
12473
|
" ",
|
|
12395
|
-
/* @__PURE__ */
|
|
12474
|
+
/* @__PURE__ */ jsxs13(Text14, { bold: true, children: [
|
|
12396
12475
|
cloudAuth.usage.remaining.toLocaleString(),
|
|
12397
12476
|
" /",
|
|
12398
12477
|
" ",
|
|
@@ -12401,15 +12480,15 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12401
12480
|
" ",
|
|
12402
12481
|
"remaining"
|
|
12403
12482
|
] }),
|
|
12404
|
-
/* @__PURE__ */
|
|
12483
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12405
12484
|
"Grant expires: ",
|
|
12406
12485
|
cloudAuth.usage.expires_at
|
|
12407
12486
|
] })
|
|
12408
12487
|
] }),
|
|
12409
|
-
/* @__PURE__ */
|
|
12410
|
-
/* @__PURE__ */
|
|
12411
|
-
/* @__PURE__ */
|
|
12412
|
-
/* @__PURE__ */
|
|
12488
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text14, { children: "[Press Enter to continue]" }) }),
|
|
12489
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12490
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12491
|
+
/* @__PURE__ */ jsx15(
|
|
12413
12492
|
CustomTextInput,
|
|
12414
12493
|
{
|
|
12415
12494
|
value: "",
|
|
@@ -12420,10 +12499,10 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12420
12499
|
)
|
|
12421
12500
|
] })
|
|
12422
12501
|
] }),
|
|
12423
|
-
step === "cloudAuth" && cloudAuth?.phase === "error" && /* @__PURE__ */
|
|
12424
|
-
/* @__PURE__ */
|
|
12425
|
-
/* @__PURE__ */
|
|
12426
|
-
/* @__PURE__ */
|
|
12502
|
+
step === "cloudAuth" && cloudAuth?.phase === "error" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12503
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.error, children: "Authentication failed" }),
|
|
12504
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: cloudAuth.message }),
|
|
12505
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
12427
12506
|
SelectInput4,
|
|
12428
12507
|
{
|
|
12429
12508
|
items: [
|
|
@@ -12439,11 +12518,11 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12439
12518
|
}
|
|
12440
12519
|
) })
|
|
12441
12520
|
] }),
|
|
12442
|
-
step === "accountId" && /* @__PURE__ */
|
|
12443
|
-
/* @__PURE__ */
|
|
12444
|
-
/* @__PURE__ */
|
|
12445
|
-
/* @__PURE__ */
|
|
12446
|
-
/* @__PURE__ */
|
|
12521
|
+
step === "accountId" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12522
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Enter your Cloudflare Account ID" }),
|
|
12523
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12524
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12525
|
+
/* @__PURE__ */ jsx15(
|
|
12447
12526
|
CustomTextInput,
|
|
12448
12527
|
{
|
|
12449
12528
|
value: accountId,
|
|
@@ -12453,12 +12532,12 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12453
12532
|
)
|
|
12454
12533
|
] })
|
|
12455
12534
|
] }),
|
|
12456
|
-
step === "apiToken" && /* @__PURE__ */
|
|
12457
|
-
/* @__PURE__ */
|
|
12458
|
-
/* @__PURE__ */
|
|
12459
|
-
/* @__PURE__ */
|
|
12460
|
-
/* @__PURE__ */
|
|
12461
|
-
/* @__PURE__ */
|
|
12535
|
+
step === "apiToken" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12536
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Enter your Cloudflare API Token" }),
|
|
12537
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Create one at https://dash.cloudflare.com/profile/api-tokens" }),
|
|
12538
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12539
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12540
|
+
/* @__PURE__ */ jsx15(
|
|
12462
12541
|
CustomTextInput,
|
|
12463
12542
|
{
|
|
12464
12543
|
value: apiToken,
|
|
@@ -12469,15 +12548,15 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12469
12548
|
)
|
|
12470
12549
|
] })
|
|
12471
12550
|
] }),
|
|
12472
|
-
step === "model" && /* @__PURE__ */
|
|
12473
|
-
/* @__PURE__ */
|
|
12474
|
-
/* @__PURE__ */
|
|
12551
|
+
step === "model" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12552
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Model ID (press Enter for default)" }),
|
|
12553
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12475
12554
|
"default: ",
|
|
12476
12555
|
DEFAULT_MODEL
|
|
12477
12556
|
] }),
|
|
12478
|
-
/* @__PURE__ */
|
|
12479
|
-
/* @__PURE__ */
|
|
12480
|
-
/* @__PURE__ */
|
|
12557
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12558
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12559
|
+
/* @__PURE__ */ jsx15(
|
|
12481
12560
|
CustomTextInput,
|
|
12482
12561
|
{
|
|
12483
12562
|
value: model,
|
|
@@ -12487,10 +12566,10 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12487
12566
|
)
|
|
12488
12567
|
] })
|
|
12489
12568
|
] }),
|
|
12490
|
-
step === "confirm" && /* @__PURE__ */
|
|
12491
|
-
/* @__PURE__ */
|
|
12492
|
-
/* @__PURE__ */
|
|
12493
|
-
|
|
12569
|
+
step === "confirm" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12570
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Ready to save configuration" }),
|
|
12571
|
+
/* @__PURE__ */ jsxs13(
|
|
12572
|
+
Box13,
|
|
12494
12573
|
{
|
|
12495
12574
|
flexDirection: "column",
|
|
12496
12575
|
marginTop: 1,
|
|
@@ -12499,25 +12578,25 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12499
12578
|
borderColor: theme.info.color,
|
|
12500
12579
|
paddingX: 1,
|
|
12501
12580
|
children: [
|
|
12502
|
-
/* @__PURE__ */
|
|
12581
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12503
12582
|
"Account ID: ",
|
|
12504
12583
|
accountId
|
|
12505
12584
|
] }),
|
|
12506
|
-
/* @__PURE__ */
|
|
12585
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12507
12586
|
"API Token: ",
|
|
12508
12587
|
"\u2022".repeat(apiToken.length)
|
|
12509
12588
|
] }),
|
|
12510
|
-
/* @__PURE__ */
|
|
12589
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12511
12590
|
"Model: ",
|
|
12512
12591
|
model
|
|
12513
12592
|
] })
|
|
12514
12593
|
]
|
|
12515
12594
|
}
|
|
12516
12595
|
),
|
|
12517
|
-
/* @__PURE__ */
|
|
12518
|
-
/* @__PURE__ */
|
|
12519
|
-
/* @__PURE__ */
|
|
12520
|
-
/* @__PURE__ */
|
|
12596
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Press Enter to confirm, or Ctrl+C to cancel" }),
|
|
12597
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12598
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12599
|
+
/* @__PURE__ */ jsx15(
|
|
12521
12600
|
CustomTextInput,
|
|
12522
12601
|
{
|
|
12523
12602
|
value: "",
|
|
@@ -12528,7 +12607,7 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12528
12607
|
)
|
|
12529
12608
|
] })
|
|
12530
12609
|
] }),
|
|
12531
|
-
savedPath && /* @__PURE__ */
|
|
12610
|
+
savedPath && /* @__PURE__ */ jsxs13(Text14, { color: theme.palette.success, children: [
|
|
12532
12611
|
"Config saved to ",
|
|
12533
12612
|
savedPath
|
|
12534
12613
|
] })
|
|
@@ -12586,8 +12665,8 @@ var init_greetings = __esm({
|
|
|
12586
12665
|
});
|
|
12587
12666
|
|
|
12588
12667
|
// src/ui/welcome.tsx
|
|
12589
|
-
import { Box as
|
|
12590
|
-
import { jsx as
|
|
12668
|
+
import { Box as Box14, Text as Text15 } from "ink";
|
|
12669
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
12591
12670
|
function Welcome() {
|
|
12592
12671
|
const theme = useTheme();
|
|
12593
12672
|
const now2 = /* @__PURE__ */ new Date();
|
|
@@ -12595,9 +12674,9 @@ function Welcome() {
|
|
|
12595
12674
|
hour: now2.getHours(),
|
|
12596
12675
|
day: now2.getDay()
|
|
12597
12676
|
});
|
|
12598
|
-
return /* @__PURE__ */
|
|
12599
|
-
/* @__PURE__ */
|
|
12600
|
-
/* @__PURE__ */
|
|
12677
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", marginBottom: 1, children: [
|
|
12678
|
+
/* @__PURE__ */ jsx16(Box14, { marginBottom: 1, children: /* @__PURE__ */ jsx16(Text15, { bold: true, color: theme.accent, children: headline }) }),
|
|
12679
|
+
/* @__PURE__ */ jsx16(Box14, { flexDirection: "column", children: /* @__PURE__ */ jsx16(Text15, { color: theme.info.color, dimColor: true, children: "Type / for commands" }) })
|
|
12601
12680
|
] });
|
|
12602
12681
|
}
|
|
12603
12682
|
var init_welcome = __esm({
|
|
@@ -12705,9 +12784,9 @@ var init_worker_client = __esm({
|
|
|
12705
12784
|
|
|
12706
12785
|
// src/ui/remote-dashboard.tsx
|
|
12707
12786
|
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
12708
|
-
import { Box as
|
|
12787
|
+
import { Box as Box15, Text as Text16, useInput as useInput6 } from "ink";
|
|
12709
12788
|
import SelectInput5 from "ink-select-input";
|
|
12710
|
-
import { jsx as
|
|
12789
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
12711
12790
|
function RemoteDashboard({ onSelect, onCancel }) {
|
|
12712
12791
|
const theme = useTheme();
|
|
12713
12792
|
const [sessions, setSessions] = useState9([]);
|
|
@@ -12763,30 +12842,30 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
12763
12842
|
value: s.sessionId
|
|
12764
12843
|
}));
|
|
12765
12844
|
if (loading) {
|
|
12766
|
-
return /* @__PURE__ */
|
|
12845
|
+
return /* @__PURE__ */ jsx17(Box15, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.accent, children: "Loading remote sessions..." }) });
|
|
12767
12846
|
}
|
|
12768
12847
|
if (error) {
|
|
12769
|
-
return /* @__PURE__ */
|
|
12770
|
-
/* @__PURE__ */
|
|
12848
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
12849
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.error, children: [
|
|
12771
12850
|
"Error: ",
|
|
12772
12851
|
error
|
|
12773
12852
|
] }),
|
|
12774
|
-
/* @__PURE__ */
|
|
12853
|
+
/* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "Press R to retry, Esc to close" })
|
|
12775
12854
|
] });
|
|
12776
12855
|
}
|
|
12777
12856
|
if (sessions.length === 0) {
|
|
12778
|
-
return /* @__PURE__ */
|
|
12779
|
-
/* @__PURE__ */
|
|
12780
|
-
/* @__PURE__ */
|
|
12781
|
-
/* @__PURE__ */
|
|
12857
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
12858
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.accent, children: "No remote sessions yet." }),
|
|
12859
|
+
/* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "Type /remote <prompt> to start one." }),
|
|
12860
|
+
/* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "Press Esc to close" })
|
|
12782
12861
|
] });
|
|
12783
12862
|
}
|
|
12784
|
-
return /* @__PURE__ */
|
|
12785
|
-
/* @__PURE__ */
|
|
12863
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
12864
|
+
/* @__PURE__ */ jsxs15(Text16, { bold: true, color: theme.accent, children: [
|
|
12786
12865
|
"Recent remote tasks ",
|
|
12787
12866
|
refreshing ? "(refreshing...)" : ""
|
|
12788
12867
|
] }),
|
|
12789
|
-
/* @__PURE__ */
|
|
12868
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(
|
|
12790
12869
|
SelectInput5,
|
|
12791
12870
|
{
|
|
12792
12871
|
items,
|
|
@@ -12796,7 +12875,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
12796
12875
|
}
|
|
12797
12876
|
}
|
|
12798
12877
|
) }),
|
|
12799
|
-
/* @__PURE__ */
|
|
12878
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter select \u2022 R refresh \u2022 Esc close" }) })
|
|
12800
12879
|
] });
|
|
12801
12880
|
}
|
|
12802
12881
|
function formatSessionLine(s) {
|
|
@@ -12849,50 +12928,50 @@ function RemoteSessionDetail({
|
|
|
12849
12928
|
}
|
|
12850
12929
|
}
|
|
12851
12930
|
const isRunning = session.status === "running" || session.status === "pending";
|
|
12852
|
-
return /* @__PURE__ */
|
|
12853
|
-
/* @__PURE__ */
|
|
12854
|
-
/* @__PURE__ */
|
|
12855
|
-
/* @__PURE__ */
|
|
12931
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
12932
|
+
/* @__PURE__ */ jsx17(Text16, { bold: true, color: theme.accent, children: "Remote Session" }),
|
|
12933
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
|
|
12934
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12856
12935
|
"ID: ",
|
|
12857
12936
|
session.sessionId
|
|
12858
12937
|
] }),
|
|
12859
|
-
/* @__PURE__ */
|
|
12938
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12860
12939
|
"Repo: ",
|
|
12861
12940
|
session.repo
|
|
12862
12941
|
] }),
|
|
12863
|
-
/* @__PURE__ */
|
|
12942
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12864
12943
|
"Status: ",
|
|
12865
12944
|
session.status
|
|
12866
12945
|
] }),
|
|
12867
|
-
/* @__PURE__ */
|
|
12946
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12868
12947
|
"Prompt: ",
|
|
12869
12948
|
session.prompt
|
|
12870
12949
|
] }),
|
|
12871
|
-
session.prUrl && /* @__PURE__ */
|
|
12950
|
+
session.prUrl && /* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12872
12951
|
"PR: ",
|
|
12873
12952
|
session.prUrl
|
|
12874
12953
|
] }),
|
|
12875
|
-
session.errorMessage && /* @__PURE__ */
|
|
12954
|
+
session.errorMessage && /* @__PURE__ */ jsxs15(Text16, { color: theme.error, children: [
|
|
12876
12955
|
"Error: ",
|
|
12877
12956
|
session.errorMessage
|
|
12878
12957
|
] }),
|
|
12879
|
-
session.tokensUsed !== void 0 && /* @__PURE__ */
|
|
12958
|
+
session.tokensUsed !== void 0 && /* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12880
12959
|
"Tokens: ",
|
|
12881
12960
|
formatTokens4(session.tokensUsed),
|
|
12882
12961
|
session.tokensBudget ? ` / ${formatTokens4(session.tokensBudget)}` : ""
|
|
12883
12962
|
] }),
|
|
12884
|
-
/* @__PURE__ */
|
|
12963
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12885
12964
|
"Created: ",
|
|
12886
12965
|
new Date(session.createdAt).toLocaleString()
|
|
12887
12966
|
] }),
|
|
12888
|
-
session.finishedAt && /* @__PURE__ */
|
|
12967
|
+
session.finishedAt && /* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12889
12968
|
"Finished: ",
|
|
12890
12969
|
new Date(session.finishedAt).toLocaleString()
|
|
12891
12970
|
] })
|
|
12892
12971
|
] }),
|
|
12893
|
-
/* @__PURE__ */
|
|
12894
|
-
isRunning && onCancel && /* @__PURE__ */
|
|
12895
|
-
/* @__PURE__ */
|
|
12972
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "row", gap: 2, children: [
|
|
12973
|
+
isRunning && onCancel && /* @__PURE__ */ jsx17(Text16, { color: theme.error, children: cancelling ? "Cancelling..." : "[C] Cancel session" }),
|
|
12974
|
+
/* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "Esc back" })
|
|
12896
12975
|
] })
|
|
12897
12976
|
] });
|
|
12898
12977
|
}
|
|
@@ -13687,6 +13766,7 @@ var init_builtins = __esm({
|
|
|
13687
13766
|
{ name: "remote", argHint: "<prompt>", description: "Run a remote session on Cloudflare", source: "builtin" },
|
|
13688
13767
|
{ name: "update", description: "Check for updates", source: "builtin" },
|
|
13689
13768
|
{ name: "hello", description: "Send a voice note to the creator", source: "builtin" },
|
|
13769
|
+
{ name: "shell", argHint: "[auto|bash|cmd|powershell|<path>]", description: "Show or set shell for bash tool", source: "builtin" },
|
|
13690
13770
|
{ name: "logout", description: "Clear stored credentials", source: "builtin" },
|
|
13691
13771
|
{ name: "exit", description: "Exit kimiflare", source: "builtin" },
|
|
13692
13772
|
{ name: "quit", description: "Alias for /exit", source: "builtin" }
|
|
@@ -13727,9 +13807,9 @@ var init_save = __esm({
|
|
|
13727
13807
|
|
|
13728
13808
|
// src/ui/command-wizard.tsx
|
|
13729
13809
|
import { useState as useState10 } from "react";
|
|
13730
|
-
import { Box as
|
|
13810
|
+
import { Box as Box16, Text as Text17, useInput as useInput7, useWindowSize } from "ink";
|
|
13731
13811
|
import SelectInput6 from "ink-select-input";
|
|
13732
|
-
import { Fragment as Fragment2, jsx as
|
|
13812
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
13733
13813
|
function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onSave }) {
|
|
13734
13814
|
const theme = useTheme();
|
|
13735
13815
|
const [step, setStep] = useState10("name");
|
|
@@ -13853,8 +13933,8 @@ ${template}`;
|
|
|
13853
13933
|
const renderStep = () => {
|
|
13854
13934
|
switch (step) {
|
|
13855
13935
|
case "name":
|
|
13856
|
-
return /* @__PURE__ */
|
|
13857
|
-
/* @__PURE__ */
|
|
13936
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
13937
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13858
13938
|
mode === "create" ? "Create" : "Edit",
|
|
13859
13939
|
" custom command \u2014 Name (",
|
|
13860
13940
|
stepIndex,
|
|
@@ -13862,8 +13942,8 @@ ${template}`;
|
|
|
13862
13942
|
totalSteps,
|
|
13863
13943
|
")"
|
|
13864
13944
|
] }),
|
|
13865
|
-
error && /* @__PURE__ */
|
|
13866
|
-
/* @__PURE__ */
|
|
13945
|
+
error && /* @__PURE__ */ jsx18(Text17, { color: theme.error, children: error }),
|
|
13946
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13867
13947
|
CustomTextInput,
|
|
13868
13948
|
{
|
|
13869
13949
|
value: name,
|
|
@@ -13872,11 +13952,11 @@ ${template}`;
|
|
|
13872
13952
|
focus: true
|
|
13873
13953
|
}
|
|
13874
13954
|
) }),
|
|
13875
|
-
/* @__PURE__ */
|
|
13955
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "letters, numbers, _ - / only; must start with a letter" })
|
|
13876
13956
|
] });
|
|
13877
13957
|
case "description":
|
|
13878
|
-
return /* @__PURE__ */
|
|
13879
|
-
/* @__PURE__ */
|
|
13958
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
13959
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13880
13960
|
mode === "create" ? "Create" : "Edit",
|
|
13881
13961
|
" custom command \u2014 Description (",
|
|
13882
13962
|
stepIndex,
|
|
@@ -13884,7 +13964,7 @@ ${template}`;
|
|
|
13884
13964
|
totalSteps,
|
|
13885
13965
|
")"
|
|
13886
13966
|
] }),
|
|
13887
|
-
/* @__PURE__ */
|
|
13967
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13888
13968
|
CustomTextInput,
|
|
13889
13969
|
{
|
|
13890
13970
|
value: description,
|
|
@@ -13893,49 +13973,49 @@ ${template}`;
|
|
|
13893
13973
|
focus: true
|
|
13894
13974
|
}
|
|
13895
13975
|
) }),
|
|
13896
|
-
/* @__PURE__ */
|
|
13976
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Press Enter to skip" })
|
|
13897
13977
|
] });
|
|
13898
13978
|
case "template": {
|
|
13899
|
-
const guide = /* @__PURE__ */
|
|
13900
|
-
/* @__PURE__ */
|
|
13901
|
-
/* @__PURE__ */
|
|
13902
|
-
/* @__PURE__ */
|
|
13979
|
+
const guide = /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", paddingLeft: 1, children: [
|
|
13980
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "What is this?" }),
|
|
13981
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "A prompt template \u2014 instructions to the AI." }),
|
|
13982
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13903
13983
|
"When you type /",
|
|
13904
13984
|
name || "yourcommand",
|
|
13905
13985
|
" later, this gets sent to the model."
|
|
13906
13986
|
] }),
|
|
13907
|
-
/* @__PURE__ */
|
|
13908
|
-
/* @__PURE__ */
|
|
13909
|
-
/* @__PURE__ */
|
|
13987
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
13988
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Variables" }),
|
|
13989
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13910
13990
|
" ",
|
|
13911
13991
|
"$1, $2 ... \u2192 arguments you type"
|
|
13912
13992
|
] }),
|
|
13913
|
-
/* @__PURE__ */
|
|
13993
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13914
13994
|
" ",
|
|
13915
13995
|
"$ARGUMENTS \u2192 everything after the command"
|
|
13916
13996
|
] })
|
|
13917
13997
|
] }),
|
|
13918
|
-
/* @__PURE__ */
|
|
13919
|
-
/* @__PURE__ */
|
|
13920
|
-
/* @__PURE__ */
|
|
13998
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
13999
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Dynamic inlines" }),
|
|
14000
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13921
14001
|
" ",
|
|
13922
14002
|
"!`git diff` \u2192 shell output inlined"
|
|
13923
14003
|
] }),
|
|
13924
|
-
/* @__PURE__ */
|
|
14004
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13925
14005
|
" ",
|
|
13926
14006
|
"@README.md \u2192 file contents inlined"
|
|
13927
14007
|
] })
|
|
13928
14008
|
] }),
|
|
13929
|
-
/* @__PURE__ */
|
|
13930
|
-
/* @__PURE__ */
|
|
13931
|
-
/* @__PURE__ */
|
|
13932
|
-
/* @__PURE__ */
|
|
13933
|
-
/* @__PURE__ */
|
|
14009
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
14010
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Example" }),
|
|
14011
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Review this PR diff:" }),
|
|
14012
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "!`git diff main...HEAD`" }),
|
|
14013
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Focus on: $1" })
|
|
13934
14014
|
] })
|
|
13935
14015
|
] });
|
|
13936
|
-
const inputArea = /* @__PURE__ */
|
|
13937
|
-
error && /* @__PURE__ */
|
|
13938
|
-
/* @__PURE__ */
|
|
14016
|
+
const inputArea = /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", flexGrow: 1, children: [
|
|
14017
|
+
error && /* @__PURE__ */ jsx18(Text17, { color: theme.error, children: error }),
|
|
14018
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13939
14019
|
CustomTextInput,
|
|
13940
14020
|
{
|
|
13941
14021
|
value: template,
|
|
@@ -13945,13 +14025,13 @@ ${template}`;
|
|
|
13945
14025
|
enablePaste: true
|
|
13946
14026
|
}
|
|
13947
14027
|
) }),
|
|
13948
|
-
columns < 100 && /* @__PURE__ */
|
|
13949
|
-
/* @__PURE__ */
|
|
13950
|
-
/* @__PURE__ */
|
|
14028
|
+
columns < 100 && /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14029
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Paste multi-line templates with Ctrl+V." }),
|
|
14030
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Variables: $1 $2 ... $ARGUMENTS Shell: !`cmd` File: @path" })
|
|
13951
14031
|
] })
|
|
13952
14032
|
] });
|
|
13953
|
-
return /* @__PURE__ */
|
|
13954
|
-
/* @__PURE__ */
|
|
14033
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14034
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13955
14035
|
mode === "create" ? "Create" : "Edit",
|
|
13956
14036
|
" custom command \u2014 Template (",
|
|
13957
14037
|
stepIndex,
|
|
@@ -13959,10 +14039,10 @@ ${template}`;
|
|
|
13959
14039
|
totalSteps,
|
|
13960
14040
|
")"
|
|
13961
14041
|
] }),
|
|
13962
|
-
columns >= 100 ? /* @__PURE__ */
|
|
13963
|
-
/* @__PURE__ */
|
|
13964
|
-
/* @__PURE__ */
|
|
13965
|
-
] }) : /* @__PURE__ */
|
|
14042
|
+
columns >= 100 ? /* @__PURE__ */ jsxs16(Box16, { flexDirection: "row", marginTop: 1, children: [
|
|
14043
|
+
/* @__PURE__ */ jsx18(Box16, { flexDirection: "column", width: "50%", children: inputArea }),
|
|
14044
|
+
/* @__PURE__ */ jsx18(Box16, { flexDirection: "column", width: "50%", children: guide })
|
|
14045
|
+
] }) : /* @__PURE__ */ jsx18(Box16, { flexDirection: "column", marginTop: 1, children: inputArea })
|
|
13966
14046
|
] });
|
|
13967
14047
|
}
|
|
13968
14048
|
case "advanced": {
|
|
@@ -13971,8 +14051,8 @@ ${template}`;
|
|
|
13971
14051
|
{ label: "Skip", value: "skip", key: "skip" },
|
|
13972
14052
|
{ label: "\u2190 Cancel", value: "cancel", key: "cancel" }
|
|
13973
14053
|
];
|
|
13974
|
-
return /* @__PURE__ */
|
|
13975
|
-
/* @__PURE__ */
|
|
14054
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14055
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13976
14056
|
mode === "create" ? "Create" : "Edit",
|
|
13977
14057
|
" custom command \u2014 Options (",
|
|
13978
14058
|
stepIndex,
|
|
@@ -13980,7 +14060,7 @@ ${template}`;
|
|
|
13980
14060
|
totalSteps,
|
|
13981
14061
|
")"
|
|
13982
14062
|
] }),
|
|
13983
|
-
/* @__PURE__ */
|
|
14063
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13984
14064
|
SelectInput6,
|
|
13985
14065
|
{
|
|
13986
14066
|
items,
|
|
@@ -14000,16 +14080,16 @@ ${template}`;
|
|
|
14000
14080
|
{ label: cmdMode === "auto" ? "auto \xB7 current" : "auto", value: "auto", key: "auto" },
|
|
14001
14081
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14002
14082
|
];
|
|
14003
|
-
return /* @__PURE__ */
|
|
14004
|
-
/* @__PURE__ */
|
|
14083
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14084
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14005
14085
|
"Mode override (",
|
|
14006
14086
|
stepIndex,
|
|
14007
14087
|
"/",
|
|
14008
14088
|
totalSteps,
|
|
14009
14089
|
")"
|
|
14010
14090
|
] }),
|
|
14011
|
-
/* @__PURE__ */
|
|
14012
|
-
/* @__PURE__ */
|
|
14091
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Saved to file but not yet enforced at runtime" }),
|
|
14092
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14013
14093
|
SelectInput6,
|
|
14014
14094
|
{
|
|
14015
14095
|
items,
|
|
@@ -14029,15 +14109,15 @@ ${template}`;
|
|
|
14029
14109
|
{ label: cmdEffort === "high" ? "high \xB7 current" : "high", value: "high", key: "high" },
|
|
14030
14110
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14031
14111
|
];
|
|
14032
|
-
return /* @__PURE__ */
|
|
14033
|
-
/* @__PURE__ */
|
|
14112
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14113
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14034
14114
|
"Reasoning effort (",
|
|
14035
14115
|
stepIndex,
|
|
14036
14116
|
"/",
|
|
14037
14117
|
totalSteps,
|
|
14038
14118
|
")"
|
|
14039
14119
|
] }),
|
|
14040
|
-
/* @__PURE__ */
|
|
14120
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14041
14121
|
SelectInput6,
|
|
14042
14122
|
{
|
|
14043
14123
|
items,
|
|
@@ -14050,15 +14130,15 @@ ${template}`;
|
|
|
14050
14130
|
] });
|
|
14051
14131
|
}
|
|
14052
14132
|
case "model":
|
|
14053
|
-
return /* @__PURE__ */
|
|
14054
|
-
/* @__PURE__ */
|
|
14133
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14134
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14055
14135
|
"Model override (",
|
|
14056
14136
|
stepIndex,
|
|
14057
14137
|
"/",
|
|
14058
14138
|
totalSteps,
|
|
14059
14139
|
")"
|
|
14060
14140
|
] }),
|
|
14061
|
-
/* @__PURE__ */
|
|
14141
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14062
14142
|
CustomTextInput,
|
|
14063
14143
|
{
|
|
14064
14144
|
value: cmdModel ?? "",
|
|
@@ -14067,7 +14147,7 @@ ${template}`;
|
|
|
14067
14147
|
focus: true
|
|
14068
14148
|
}
|
|
14069
14149
|
) }),
|
|
14070
|
-
/* @__PURE__ */
|
|
14150
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Press Enter to skip" })
|
|
14071
14151
|
] });
|
|
14072
14152
|
case "location": {
|
|
14073
14153
|
const items = [
|
|
@@ -14075,15 +14155,15 @@ ${template}`;
|
|
|
14075
14155
|
{ label: source === "global" ? "Global \xB7 current" : "Global", value: "global", key: "global" },
|
|
14076
14156
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14077
14157
|
];
|
|
14078
|
-
return /* @__PURE__ */
|
|
14079
|
-
/* @__PURE__ */
|
|
14158
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14159
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14080
14160
|
"Save location (",
|
|
14081
14161
|
stepIndex,
|
|
14082
14162
|
"/",
|
|
14083
14163
|
totalSteps,
|
|
14084
14164
|
")"
|
|
14085
14165
|
] }),
|
|
14086
|
-
/* @__PURE__ */
|
|
14166
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14087
14167
|
SelectInput6,
|
|
14088
14168
|
{
|
|
14089
14169
|
items,
|
|
@@ -14093,7 +14173,7 @@ ${template}`;
|
|
|
14093
14173
|
}
|
|
14094
14174
|
}
|
|
14095
14175
|
) }),
|
|
14096
|
-
/* @__PURE__ */
|
|
14176
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Project: .kimiflare/commands/ Global: ~/.config/kimiflare/commands/" })
|
|
14097
14177
|
] });
|
|
14098
14178
|
}
|
|
14099
14179
|
case "confirm": {
|
|
@@ -14101,8 +14181,8 @@ ${template}`;
|
|
|
14101
14181
|
{ label: "Save", value: "save", key: "save" },
|
|
14102
14182
|
{ label: "Cancel", value: "cancel", key: "cancel" }
|
|
14103
14183
|
];
|
|
14104
|
-
return /* @__PURE__ */
|
|
14105
|
-
/* @__PURE__ */
|
|
14184
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14185
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14106
14186
|
mode === "create" ? "Create" : "Edit",
|
|
14107
14187
|
" custom command \u2014 Confirm (",
|
|
14108
14188
|
stepIndex,
|
|
@@ -14110,13 +14190,13 @@ ${template}`;
|
|
|
14110
14190
|
totalSteps,
|
|
14111
14191
|
")"
|
|
14112
14192
|
] }),
|
|
14113
|
-
/* @__PURE__ */
|
|
14193
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
14114
14194
|
source === "project" ? ".kimiflare/commands/" : "~/.config/kimiflare/commands/",
|
|
14115
14195
|
name,
|
|
14116
14196
|
".md"
|
|
14117
14197
|
] }),
|
|
14118
|
-
/* @__PURE__ */
|
|
14119
|
-
/* @__PURE__ */
|
|
14198
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, flexDirection: "column", children: previewContent().split("\n").map((line, i) => /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: line || " " }, i)) }),
|
|
14199
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14120
14200
|
SelectInput6,
|
|
14121
14201
|
{
|
|
14122
14202
|
items,
|
|
@@ -14127,7 +14207,7 @@ ${template}`;
|
|
|
14127
14207
|
}
|
|
14128
14208
|
}
|
|
14129
14209
|
};
|
|
14130
|
-
return /* @__PURE__ */
|
|
14210
|
+
return /* @__PURE__ */ jsx18(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: renderStep() });
|
|
14131
14211
|
}
|
|
14132
14212
|
var NAME_RE;
|
|
14133
14213
|
var init_command_wizard = __esm({
|
|
@@ -14572,9 +14652,9 @@ var init_context_generator = __esm({
|
|
|
14572
14652
|
});
|
|
14573
14653
|
|
|
14574
14654
|
// src/ui/command-picker.tsx
|
|
14575
|
-
import { Box as
|
|
14655
|
+
import { Box as Box17, Text as Text18 } from "ink";
|
|
14576
14656
|
import SelectInput7 from "ink-select-input";
|
|
14577
|
-
import { jsx as
|
|
14657
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
14578
14658
|
function CommandPicker({ commands, title, onPick }) {
|
|
14579
14659
|
const theme = useTheme();
|
|
14580
14660
|
const items = commands.map((cmd) => ({
|
|
@@ -14583,10 +14663,10 @@ function CommandPicker({ commands, title, onPick }) {
|
|
|
14583
14663
|
key: cmd.name
|
|
14584
14664
|
}));
|
|
14585
14665
|
items.push({ label: "\u2190 Cancel", value: null, key: "__cancel__" });
|
|
14586
|
-
return /* @__PURE__ */
|
|
14587
|
-
/* @__PURE__ */
|
|
14588
|
-
/* @__PURE__ */
|
|
14589
|
-
/* @__PURE__ */
|
|
14666
|
+
return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14667
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.accent, bold: true, children: title }),
|
|
14668
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
14669
|
+
/* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
|
|
14590
14670
|
SelectInput7,
|
|
14591
14671
|
{
|
|
14592
14672
|
items,
|
|
@@ -14609,8 +14689,8 @@ var init_command_picker = __esm({
|
|
|
14609
14689
|
});
|
|
14610
14690
|
|
|
14611
14691
|
// src/ui/command-list.tsx
|
|
14612
|
-
import { Box as
|
|
14613
|
-
import { jsx as
|
|
14692
|
+
import { Box as Box18, Text as Text19, useInput as useInput8 } from "ink";
|
|
14693
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
14614
14694
|
function CommandList({ commands, onDone }) {
|
|
14615
14695
|
const theme = useTheme();
|
|
14616
14696
|
useInput8((_input, key) => {
|
|
@@ -14618,55 +14698,55 @@ function CommandList({ commands, onDone }) {
|
|
|
14618
14698
|
onDone();
|
|
14619
14699
|
}
|
|
14620
14700
|
});
|
|
14621
|
-
return /* @__PURE__ */
|
|
14622
|
-
/* @__PURE__ */
|
|
14623
|
-
/* @__PURE__ */
|
|
14624
|
-
/* @__PURE__ */
|
|
14625
|
-
commands.length === 0 && /* @__PURE__ */
|
|
14626
|
-
commands.map((cmd) => /* @__PURE__ */
|
|
14627
|
-
/* @__PURE__ */
|
|
14701
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14702
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.accent, bold: true, children: "Custom commands" }),
|
|
14703
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, dimColor: false, children: "Esc to close." }),
|
|
14704
|
+
/* @__PURE__ */ jsxs18(Box18, { marginTop: 1, flexDirection: "column", children: [
|
|
14705
|
+
commands.length === 0 && /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "No custom commands found." }),
|
|
14706
|
+
commands.map((cmd) => /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", marginBottom: 1, children: [
|
|
14707
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14628
14708
|
"/",
|
|
14629
14709
|
cmd.name
|
|
14630
14710
|
] }),
|
|
14631
|
-
/* @__PURE__ */
|
|
14711
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14632
14712
|
" ",
|
|
14633
14713
|
"source: ",
|
|
14634
14714
|
cmd.source
|
|
14635
14715
|
] }),
|
|
14636
|
-
/* @__PURE__ */
|
|
14716
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14637
14717
|
" ",
|
|
14638
14718
|
"path: ",
|
|
14639
14719
|
cmd.filepath
|
|
14640
14720
|
] }),
|
|
14641
|
-
cmd.description && /* @__PURE__ */
|
|
14721
|
+
cmd.description && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14642
14722
|
" ",
|
|
14643
14723
|
"desc: ",
|
|
14644
14724
|
cmd.description
|
|
14645
14725
|
] }),
|
|
14646
|
-
cmd.mode && /* @__PURE__ */
|
|
14726
|
+
cmd.mode && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14647
14727
|
" ",
|
|
14648
14728
|
"mode: ",
|
|
14649
14729
|
cmd.mode
|
|
14650
14730
|
] }),
|
|
14651
|
-
cmd.effort && /* @__PURE__ */
|
|
14731
|
+
cmd.effort && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14652
14732
|
" ",
|
|
14653
14733
|
"effort: ",
|
|
14654
14734
|
cmd.effort
|
|
14655
14735
|
] }),
|
|
14656
|
-
cmd.model && /* @__PURE__ */
|
|
14736
|
+
cmd.model && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14657
14737
|
" ",
|
|
14658
14738
|
"model: ",
|
|
14659
14739
|
cmd.model
|
|
14660
14740
|
] }),
|
|
14661
|
-
/* @__PURE__ */
|
|
14741
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14662
14742
|
" ",
|
|
14663
14743
|
"template:"
|
|
14664
14744
|
] }),
|
|
14665
|
-
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */
|
|
14745
|
+
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14666
14746
|
" ",
|
|
14667
14747
|
line || " "
|
|
14668
14748
|
] }, i)),
|
|
14669
|
-
cmd.template.split("\n").length > 5 && /* @__PURE__ */
|
|
14749
|
+
cmd.template.split("\n").length > 5 && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14670
14750
|
" ",
|
|
14671
14751
|
"..."
|
|
14672
14752
|
] })
|
|
@@ -14683,10 +14763,10 @@ var init_command_list = __esm({
|
|
|
14683
14763
|
|
|
14684
14764
|
// src/ui/lsp-wizard.tsx
|
|
14685
14765
|
import { useState as useState11 } from "react";
|
|
14686
|
-
import { Box as
|
|
14766
|
+
import { Box as Box19, Text as Text20 } from "ink";
|
|
14687
14767
|
import SelectInput8 from "ink-select-input";
|
|
14688
14768
|
import { spawn as spawn3 } from "child_process";
|
|
14689
|
-
import { jsx as
|
|
14769
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
14690
14770
|
function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
14691
14771
|
const theme = useTheme();
|
|
14692
14772
|
const [page, setPage] = useState11("main");
|
|
@@ -14698,7 +14778,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14698
14778
|
const [pendingEnabled, setPendingEnabled] = useState11(true);
|
|
14699
14779
|
const runInstall = (command) => {
|
|
14700
14780
|
setInstallState({ status: "running", output: "Installing..." });
|
|
14701
|
-
const
|
|
14781
|
+
const { shell, args } = getShellCommand();
|
|
14782
|
+
const child = spawn3(shell, [...args, command], {
|
|
14702
14783
|
env: process.env
|
|
14703
14784
|
});
|
|
14704
14785
|
let stdout = "";
|
|
@@ -14797,10 +14878,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14797
14878
|
{ label: "(close)", value: "__close__", key: "__close__" }
|
|
14798
14879
|
];
|
|
14799
14880
|
if (page === "main") {
|
|
14800
|
-
return /* @__PURE__ */
|
|
14801
|
-
/* @__PURE__ */
|
|
14802
|
-
/* @__PURE__ */
|
|
14803
|
-
/* @__PURE__ */
|
|
14881
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14882
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "LSP Servers" }),
|
|
14883
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
14884
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14804
14885
|
SelectInput8,
|
|
14805
14886
|
{
|
|
14806
14887
|
items: mainItems,
|
|
@@ -14828,10 +14909,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14828
14909
|
}),
|
|
14829
14910
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14830
14911
|
];
|
|
14831
|
-
return /* @__PURE__ */
|
|
14832
|
-
/* @__PURE__ */
|
|
14833
|
-
/* @__PURE__ */
|
|
14834
|
-
/* @__PURE__ */
|
|
14912
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14913
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Add LSP Server" }),
|
|
14914
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Select a language server to configure." }),
|
|
14915
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14835
14916
|
SelectInput8,
|
|
14836
14917
|
{
|
|
14837
14918
|
items,
|
|
@@ -14859,18 +14940,18 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14859
14940
|
{ label: isSuccess ? "Save to config \u2713" : "Save anyway", value: "save", key: "save" },
|
|
14860
14941
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14861
14942
|
];
|
|
14862
|
-
return /* @__PURE__ */
|
|
14863
|
-
/* @__PURE__ */
|
|
14943
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14944
|
+
/* @__PURE__ */ jsxs19(Text20, { color: theme.accent, bold: true, children: [
|
|
14864
14945
|
"Install ",
|
|
14865
14946
|
selectedPreset.name
|
|
14866
14947
|
] }),
|
|
14867
|
-
/* @__PURE__ */
|
|
14868
|
-
/* @__PURE__ */
|
|
14869
|
-
/* @__PURE__ */
|
|
14870
|
-
/* @__PURE__ */
|
|
14948
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: selectedPreset.installHint }),
|
|
14949
|
+
/* @__PURE__ */ jsxs19(Box19, { marginTop: 1, flexDirection: "column", children: [
|
|
14950
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Command:" }),
|
|
14951
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, children: selectedPreset.installCommand || "(none required)" })
|
|
14871
14952
|
] }),
|
|
14872
|
-
installState.output && /* @__PURE__ */
|
|
14873
|
-
/* @__PURE__ */
|
|
14953
|
+
installState.output && /* @__PURE__ */ jsx21(Box19, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx21(Text20, { color: isSuccess ? theme.accent : theme.error, children: installState.output.slice(-500) }) }),
|
|
14954
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14874
14955
|
SelectInput8,
|
|
14875
14956
|
{
|
|
14876
14957
|
items,
|
|
@@ -14888,16 +14969,16 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14888
14969
|
}
|
|
14889
14970
|
}
|
|
14890
14971
|
) }),
|
|
14891
|
-
isSuccess && /* @__PURE__ */
|
|
14972
|
+
isSuccess && /* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(Text20, { color: theme.accent, children: "Server saved. Run /lsp reload to start it." }) })
|
|
14892
14973
|
] });
|
|
14893
14974
|
}
|
|
14894
14975
|
if (page === "custom-name") {
|
|
14895
|
-
return /* @__PURE__ */
|
|
14896
|
-
/* @__PURE__ */
|
|
14897
|
-
/* @__PURE__ */
|
|
14898
|
-
/* @__PURE__ */
|
|
14899
|
-
/* @__PURE__ */
|
|
14900
|
-
/* @__PURE__ */
|
|
14976
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14977
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Name" }),
|
|
14978
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Enter a name for this server (e.g., my-server)." }),
|
|
14979
|
+
/* @__PURE__ */ jsxs19(Box19, { marginTop: 1, children: [
|
|
14980
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, children: "\u203A " }),
|
|
14981
|
+
/* @__PURE__ */ jsx21(
|
|
14901
14982
|
CustomTextInput,
|
|
14902
14983
|
{
|
|
14903
14984
|
value: customName,
|
|
@@ -14911,7 +14992,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14911
14992
|
}
|
|
14912
14993
|
)
|
|
14913
14994
|
] }),
|
|
14914
|
-
/* @__PURE__ */
|
|
14995
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14915
14996
|
SelectInput8,
|
|
14916
14997
|
{
|
|
14917
14998
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -14921,12 +15002,12 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14921
15002
|
] });
|
|
14922
15003
|
}
|
|
14923
15004
|
if (page === "custom-command") {
|
|
14924
|
-
return /* @__PURE__ */
|
|
14925
|
-
/* @__PURE__ */
|
|
14926
|
-
/* @__PURE__ */
|
|
14927
|
-
/* @__PURE__ */
|
|
14928
|
-
/* @__PURE__ */
|
|
14929
|
-
/* @__PURE__ */
|
|
15005
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15006
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Command" }),
|
|
15007
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Enter the command to start the server (space-separated)." }),
|
|
15008
|
+
/* @__PURE__ */ jsxs19(Box19, { marginTop: 1, children: [
|
|
15009
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, children: "\u203A " }),
|
|
15010
|
+
/* @__PURE__ */ jsx21(
|
|
14930
15011
|
CustomTextInput,
|
|
14931
15012
|
{
|
|
14932
15013
|
value: customCommand,
|
|
@@ -14940,7 +15021,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14940
15021
|
}
|
|
14941
15022
|
)
|
|
14942
15023
|
] }),
|
|
14943
|
-
/* @__PURE__ */
|
|
15024
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14944
15025
|
SelectInput8,
|
|
14945
15026
|
{
|
|
14946
15027
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -14964,10 +15045,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14964
15045
|
},
|
|
14965
15046
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14966
15047
|
];
|
|
14967
|
-
return /* @__PURE__ */
|
|
14968
|
-
/* @__PURE__ */
|
|
14969
|
-
/* @__PURE__ */
|
|
14970
|
-
/* @__PURE__ */
|
|
15048
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15049
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Save LSP Config" }),
|
|
15050
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Where should this server configuration be saved?" }),
|
|
15051
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14971
15052
|
SelectInput8,
|
|
14972
15053
|
{
|
|
14973
15054
|
items,
|
|
@@ -14986,10 +15067,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14986
15067
|
if (page === "edit") {
|
|
14987
15068
|
const keys = Object.keys(servers);
|
|
14988
15069
|
if (keys.length === 0) {
|
|
14989
|
-
return /* @__PURE__ */
|
|
14990
|
-
/* @__PURE__ */
|
|
14991
|
-
/* @__PURE__ */
|
|
14992
|
-
/* @__PURE__ */
|
|
15070
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15071
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
15072
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No servers configured." }),
|
|
15073
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14993
15074
|
SelectInput8,
|
|
14994
15075
|
{
|
|
14995
15076
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -15010,10 +15091,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15010
15091
|
}),
|
|
15011
15092
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
15012
15093
|
];
|
|
15013
|
-
return /* @__PURE__ */
|
|
15014
|
-
/* @__PURE__ */
|
|
15015
|
-
/* @__PURE__ */
|
|
15016
|
-
/* @__PURE__ */
|
|
15094
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15095
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
15096
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Select a server to toggle enabled/disabled." }),
|
|
15097
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15017
15098
|
SelectInput8,
|
|
15018
15099
|
{
|
|
15019
15100
|
items,
|
|
@@ -15031,10 +15112,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15031
15112
|
if (page === "delete") {
|
|
15032
15113
|
const keys = Object.keys(servers);
|
|
15033
15114
|
if (keys.length === 0) {
|
|
15034
|
-
return /* @__PURE__ */
|
|
15035
|
-
/* @__PURE__ */
|
|
15036
|
-
/* @__PURE__ */
|
|
15037
|
-
/* @__PURE__ */
|
|
15115
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15116
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
15117
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No servers configured." }),
|
|
15118
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15038
15119
|
SelectInput8,
|
|
15039
15120
|
{
|
|
15040
15121
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -15051,10 +15132,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15051
15132
|
})),
|
|
15052
15133
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
15053
15134
|
];
|
|
15054
|
-
return /* @__PURE__ */
|
|
15055
|
-
/* @__PURE__ */
|
|
15056
|
-
/* @__PURE__ */
|
|
15057
|
-
/* @__PURE__ */
|
|
15135
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15136
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
15137
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Select a server to remove from config." }),
|
|
15138
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15058
15139
|
SelectInput8,
|
|
15059
15140
|
{
|
|
15060
15141
|
items,
|
|
@@ -15071,14 +15152,14 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15071
15152
|
}
|
|
15072
15153
|
if (page === "list") {
|
|
15073
15154
|
const keys = Object.keys(servers);
|
|
15074
|
-
return /* @__PURE__ */
|
|
15075
|
-
/* @__PURE__ */
|
|
15076
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
15155
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15156
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Configured LSP Servers" }),
|
|
15157
|
+
keys.length === 0 ? /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No servers configured." }) : /* @__PURE__ */ jsx21(Box19, { marginTop: 1, flexDirection: "column", children: keys.map((k) => {
|
|
15077
15158
|
const s = servers[k];
|
|
15078
15159
|
const status = s.enabled !== false ? "enabled" : "disabled";
|
|
15079
|
-
return /* @__PURE__ */
|
|
15160
|
+
return /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: ` ${k.padEnd(16)} ${status} ${s.command.join(" ")}` }, k);
|
|
15080
15161
|
}) }),
|
|
15081
|
-
/* @__PURE__ */
|
|
15162
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15082
15163
|
SelectInput8,
|
|
15083
15164
|
{
|
|
15084
15165
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -15094,6 +15175,7 @@ var init_lsp_wizard = __esm({
|
|
|
15094
15175
|
"src/ui/lsp-wizard.tsx"() {
|
|
15095
15176
|
"use strict";
|
|
15096
15177
|
init_theme_context();
|
|
15178
|
+
init_bash();
|
|
15097
15179
|
init_text_input();
|
|
15098
15180
|
PRESETS = [
|
|
15099
15181
|
{
|
|
@@ -15205,9 +15287,9 @@ var init_lsp_wizard = __esm({
|
|
|
15205
15287
|
});
|
|
15206
15288
|
|
|
15207
15289
|
// src/ui/theme-picker.tsx
|
|
15208
|
-
import { Box as
|
|
15290
|
+
import { Box as Box20, Text as Text21 } from "ink";
|
|
15209
15291
|
import SelectInput9 from "ink-select-input";
|
|
15210
|
-
import { jsx as
|
|
15292
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
15211
15293
|
function PaletteSwatches({ palette }) {
|
|
15212
15294
|
const colors = [
|
|
15213
15295
|
palette.primary,
|
|
@@ -15215,7 +15297,7 @@ function PaletteSwatches({ palette }) {
|
|
|
15215
15297
|
palette.success,
|
|
15216
15298
|
palette.error
|
|
15217
15299
|
];
|
|
15218
|
-
return /* @__PURE__ */
|
|
15300
|
+
return /* @__PURE__ */ jsx22(Box20, { children: colors.map((c, i) => /* @__PURE__ */ jsx22(Text21, { color: c, children: "\u2588" }, i)) });
|
|
15219
15301
|
}
|
|
15220
15302
|
function ThemePicker({ themes, onPick }) {
|
|
15221
15303
|
const current = useTheme();
|
|
@@ -15223,9 +15305,9 @@ function ThemePicker({ themes, onPick }) {
|
|
|
15223
15305
|
...themes.map((t) => ({ label: t.label, value: t.name })),
|
|
15224
15306
|
{ label: "< Back", value: "__back__" }
|
|
15225
15307
|
];
|
|
15226
|
-
return /* @__PURE__ */
|
|
15227
|
-
/* @__PURE__ */
|
|
15228
|
-
/* @__PURE__ */
|
|
15308
|
+
return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", borderStyle: "round", borderColor: current.accent, paddingX: 1, children: [
|
|
15309
|
+
/* @__PURE__ */ jsx22(Text21, { color: current.accent, bold: true, children: "Pick a theme (restart to apply)" }),
|
|
15310
|
+
/* @__PURE__ */ jsx22(Box20, { marginTop: 1, children: /* @__PURE__ */ jsx22(
|
|
15229
15311
|
SelectInput9,
|
|
15230
15312
|
{
|
|
15231
15313
|
items,
|
|
@@ -15240,9 +15322,9 @@ function ThemePicker({ themes, onPick }) {
|
|
|
15240
15322
|
itemComponent: ({ label, isSelected }) => {
|
|
15241
15323
|
const t = themes.find((x) => x.label === label);
|
|
15242
15324
|
const color = t?.accent ?? current.accent;
|
|
15243
|
-
return /* @__PURE__ */
|
|
15244
|
-
/* @__PURE__ */
|
|
15245
|
-
t && /* @__PURE__ */
|
|
15325
|
+
return /* @__PURE__ */ jsxs20(Box20, { children: [
|
|
15326
|
+
/* @__PURE__ */ jsx22(Text21, { color, bold: isSelected, dimColor: !isSelected, children: label }),
|
|
15327
|
+
t && /* @__PURE__ */ jsx22(Box20, { marginLeft: 1, children: /* @__PURE__ */ jsx22(PaletteSwatches, { palette: t.palette }) })
|
|
15246
15328
|
] });
|
|
15247
15329
|
}
|
|
15248
15330
|
}
|
|
@@ -16429,8 +16511,8 @@ var init_lsp_nudge = __esm({
|
|
|
16429
16511
|
});
|
|
16430
16512
|
|
|
16431
16513
|
// src/ui/file-picker.tsx
|
|
16432
|
-
import { Box as
|
|
16433
|
-
import { jsx as
|
|
16514
|
+
import { Box as Box21, Text as Text22 } from "ink";
|
|
16515
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
16434
16516
|
function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
16435
16517
|
const theme = useTheme();
|
|
16436
16518
|
let startIndex = 0;
|
|
@@ -16442,12 +16524,12 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
|
16442
16524
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT;
|
|
16443
16525
|
const recentInVisible = visible.filter((item) => recentFiles?.has(item.name)).length;
|
|
16444
16526
|
const hasRecentSection = recentInVisible > 0;
|
|
16445
|
-
return /* @__PURE__ */
|
|
16446
|
-
/* @__PURE__ */
|
|
16447
|
-
/* @__PURE__ */
|
|
16448
|
-
/* @__PURE__ */
|
|
16449
|
-
visible.length === 0 && /* @__PURE__ */
|
|
16450
|
-
hasMoreAbove && /* @__PURE__ */
|
|
16527
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
16528
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: query ? `Files matching "${query}"` : "Mention a file" }),
|
|
16529
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: true, children: "\u2191\u2193 navigate \xB7 Enter pick \xB7 Esc cancel" }),
|
|
16530
|
+
/* @__PURE__ */ jsxs21(Box21, { marginTop: 1, flexDirection: "column", children: [
|
|
16531
|
+
visible.length === 0 && /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "No matches" }),
|
|
16532
|
+
hasMoreAbove && /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, dimColor: true, children: [
|
|
16451
16533
|
"\u2026 ",
|
|
16452
16534
|
startIndex,
|
|
16453
16535
|
" more above"
|
|
@@ -16459,28 +16541,28 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
|
16459
16541
|
const label = item.isDirectory ? `${item.name}/` : item.name;
|
|
16460
16542
|
const isFirstRecent = isRecent && (i === 0 || !recentFiles?.has(visible[i - 1]?.name ?? ""));
|
|
16461
16543
|
const isFirstNonRecentAfterRecent = !isRecent && (i > 0 && recentFiles?.has(visible[i - 1]?.name ?? ""));
|
|
16462
|
-
return /* @__PURE__ */
|
|
16463
|
-
hasRecentSection && isFirstRecent && /* @__PURE__ */
|
|
16544
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", children: [
|
|
16545
|
+
hasRecentSection && isFirstRecent && /* @__PURE__ */ jsxs21(Text22, { color: theme.palette.success, bold: true, children: [
|
|
16464
16546
|
" ",
|
|
16465
16547
|
"Recent"
|
|
16466
16548
|
] }),
|
|
16467
|
-
hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */
|
|
16549
|
+
hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, dimColor: true, children: [
|
|
16468
16550
|
" ",
|
|
16469
16551
|
"All files"
|
|
16470
16552
|
] }),
|
|
16471
|
-
/* @__PURE__ */
|
|
16553
|
+
/* @__PURE__ */ jsxs21(Text22, { color: isSelected ? theme.accent : isRecent ? theme.palette.success : void 0, bold: isSelected || isRecent, children: [
|
|
16472
16554
|
isSelected ? "\u203A " : isRecent ? "\u2192 " : " ",
|
|
16473
16555
|
isRecent ? "\u21BB " : "",
|
|
16474
16556
|
label
|
|
16475
16557
|
] })
|
|
16476
16558
|
] }, item.name);
|
|
16477
16559
|
}),
|
|
16478
|
-
hasMoreBelow && /* @__PURE__ */
|
|
16560
|
+
hasMoreBelow && /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, dimColor: true, children: [
|
|
16479
16561
|
"\u2026 ",
|
|
16480
16562
|
items.length - (startIndex + VISIBLE_LIMIT),
|
|
16481
16563
|
" more below"
|
|
16482
16564
|
] }),
|
|
16483
|
-
hasRecentSection && /* @__PURE__ */
|
|
16565
|
+
hasRecentSection && /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: true, children: "\u21BB = recently used" }) })
|
|
16484
16566
|
] })
|
|
16485
16567
|
] });
|
|
16486
16568
|
}
|
|
@@ -16494,8 +16576,8 @@ var init_file_picker = __esm({
|
|
|
16494
16576
|
});
|
|
16495
16577
|
|
|
16496
16578
|
// src/ui/slash-picker.tsx
|
|
16497
|
-
import { Box as
|
|
16498
|
-
import { jsx as
|
|
16579
|
+
import { Box as Box22, Text as Text23 } from "ink";
|
|
16580
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
16499
16581
|
function sourceBadge(source) {
|
|
16500
16582
|
if (source === "builtin") return "";
|
|
16501
16583
|
if (source === "project") return "project";
|
|
@@ -16515,12 +16597,12 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
16515
16597
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT2;
|
|
16516
16598
|
const longestLabel = visible.reduce((m, it) => Math.max(m, commandLabel(it).length), 0);
|
|
16517
16599
|
const nameColWidth = Math.max(NAME_COL_MIN_WIDTH, longestLabel + NAME_DESC_GAP);
|
|
16518
|
-
return /* @__PURE__ */
|
|
16519
|
-
/* @__PURE__ */
|
|
16520
|
-
/* @__PURE__ */
|
|
16521
|
-
/* @__PURE__ */
|
|
16522
|
-
visible.length === 0 && /* @__PURE__ */
|
|
16523
|
-
hasMoreAbove && /* @__PURE__ */
|
|
16600
|
+
return /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
16601
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: query ? `Commands matching "/${query}"` : "Slash commands" }),
|
|
16602
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
16603
|
+
/* @__PURE__ */ jsxs22(Box22, { marginTop: 1, flexDirection: "column", children: [
|
|
16604
|
+
visible.length === 0 && /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "No matches" }),
|
|
16605
|
+
hasMoreAbove && /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
16524
16606
|
"\u2026 ",
|
|
16525
16607
|
startIndex,
|
|
16526
16608
|
" more above"
|
|
@@ -16530,16 +16612,16 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
16530
16612
|
const isSelected = actualIndex === selectedIndex;
|
|
16531
16613
|
const nameCol = commandLabel(item).padEnd(nameColWidth);
|
|
16532
16614
|
const badge = sourceBadge(item.source);
|
|
16533
|
-
return /* @__PURE__ */
|
|
16615
|
+
return /* @__PURE__ */ jsxs22(Text23, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: [
|
|
16534
16616
|
isSelected ? "\u203A " : " ",
|
|
16535
16617
|
nameCol,
|
|
16536
|
-
/* @__PURE__ */
|
|
16618
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
16537
16619
|
item.description,
|
|
16538
16620
|
badge && ` [${badge}]`
|
|
16539
16621
|
] })
|
|
16540
16622
|
] }, item.name);
|
|
16541
16623
|
}),
|
|
16542
|
-
hasMoreBelow && /* @__PURE__ */
|
|
16624
|
+
hasMoreBelow && /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
16543
16625
|
"\u2026 ",
|
|
16544
16626
|
items.length - (startIndex + VISIBLE_LIMIT2),
|
|
16545
16627
|
" more below"
|
|
@@ -16650,17 +16732,17 @@ __export(app_exports, {
|
|
|
16650
16732
|
shouldOpenSlashPicker: () => shouldOpenSlashPicker
|
|
16651
16733
|
});
|
|
16652
16734
|
import React15, { useState as useState12, useRef as useRef3, useEffect as useEffect7, useCallback as useCallback3 } from "react";
|
|
16653
|
-
import { Box as
|
|
16735
|
+
import { Box as Box23, Text as Text24, useApp, useInput as useInput9, render } from "ink";
|
|
16654
16736
|
import SelectInput10 from "ink-select-input";
|
|
16655
16737
|
import { existsSync as existsSync4, statSync as statSync4 } from "fs";
|
|
16656
16738
|
import { join as join27 } from "path";
|
|
16657
16739
|
import { unlink as unlink4 } from "fs/promises";
|
|
16658
16740
|
import { execSync as execSync2 } from "child_process";
|
|
16659
16741
|
import { spawn as spawn4 } from "child_process";
|
|
16660
|
-
import { platform as
|
|
16742
|
+
import { platform as platform4 } from "os";
|
|
16661
16743
|
import fg4 from "fast-glob";
|
|
16662
16744
|
import { readFileSync as readFileSync3 } from "fs";
|
|
16663
|
-
import { jsx as
|
|
16745
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
16664
16746
|
function buildFilePickerIgnoreList(cwd) {
|
|
16665
16747
|
const hardcoded = [
|
|
16666
16748
|
// Dependencies
|
|
@@ -16800,7 +16882,7 @@ function gatewayUsageLookupFromConfig(cfg, meta) {
|
|
|
16800
16882
|
};
|
|
16801
16883
|
}
|
|
16802
16884
|
function openBrowser2(url) {
|
|
16803
|
-
const cmd =
|
|
16885
|
+
const cmd = platform4() === "darwin" ? "open" : platform4() === "win32" ? "start" : "xdg-open";
|
|
16804
16886
|
const child = spawn4(cmd, [url], { detached: true, stdio: "ignore" });
|
|
16805
16887
|
child.unref();
|
|
16806
16888
|
}
|
|
@@ -18060,6 +18142,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18060
18142
|
cloudMode: cfg.cloudMode,
|
|
18061
18143
|
cloudToken: cloudToken ?? initialCloudToken,
|
|
18062
18144
|
cloudDeviceId: cloudDeviceId ?? initialCloudDeviceId,
|
|
18145
|
+
shell: cfg.shell,
|
|
18063
18146
|
onIterationEnd,
|
|
18064
18147
|
onFileChange: (path, content) => {
|
|
18065
18148
|
if (content) {
|
|
@@ -18284,6 +18367,17 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18284
18367
|
...es,
|
|
18285
18368
|
{ kind: "error", key: mkKey(), text: "The agent got stuck repeating the same actions. Here's what we know so far." }
|
|
18286
18369
|
]);
|
|
18370
|
+
} else if (e instanceof KimiApiError && (e.httpStatus === 429 || e.code === 3040 || e.httpStatus !== void 0 && e.httpStatus >= 500)) {
|
|
18371
|
+
setEvents((es) => [
|
|
18372
|
+
...es,
|
|
18373
|
+
{
|
|
18374
|
+
kind: "api_error",
|
|
18375
|
+
key: mkKey(),
|
|
18376
|
+
httpStatus: e.httpStatus,
|
|
18377
|
+
code: e.code,
|
|
18378
|
+
message: humanizeCloudflareError(e)
|
|
18379
|
+
}
|
|
18380
|
+
]);
|
|
18287
18381
|
} else {
|
|
18288
18382
|
const displayText = e instanceof KimiApiError ? humanizeCloudflareError(e) : `init failed: ${e.message}`;
|
|
18289
18383
|
setEvents((es) => [
|
|
@@ -18518,6 +18612,36 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18518
18612
|
});
|
|
18519
18613
|
return true;
|
|
18520
18614
|
}
|
|
18615
|
+
if (c === "/shell") {
|
|
18616
|
+
if (!cfg) return true;
|
|
18617
|
+
const valid = ["auto", "bash", "cmd", "powershell"];
|
|
18618
|
+
if (arg === "auto" || arg === "bash" || arg === "cmd" || arg === "powershell") {
|
|
18619
|
+
const next = { ...cfg, shell: arg === "auto" ? void 0 : arg };
|
|
18620
|
+
setCfg(next);
|
|
18621
|
+
void saveConfig(next).catch(() => {
|
|
18622
|
+
});
|
|
18623
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: `shell set to ${arg}` }]);
|
|
18624
|
+
return true;
|
|
18625
|
+
}
|
|
18626
|
+
if (arg) {
|
|
18627
|
+
const next = { ...cfg, shell: arg };
|
|
18628
|
+
setCfg(next);
|
|
18629
|
+
void saveConfig(next).catch(() => {
|
|
18630
|
+
});
|
|
18631
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: `shell set to ${arg}` }]);
|
|
18632
|
+
return true;
|
|
18633
|
+
}
|
|
18634
|
+
const detected = getShellCommand(cfg.shell);
|
|
18635
|
+
setEvents((e) => [
|
|
18636
|
+
...e,
|
|
18637
|
+
{
|
|
18638
|
+
kind: "info",
|
|
18639
|
+
key: mkKey(),
|
|
18640
|
+
text: `shell: ${cfg.shell ?? "auto"} (${detected.shell} ${detected.args.join(" ")})`
|
|
18641
|
+
}
|
|
18642
|
+
]);
|
|
18643
|
+
return true;
|
|
18644
|
+
}
|
|
18521
18645
|
if (c === "/model") {
|
|
18522
18646
|
setEvents((e) => [
|
|
18523
18647
|
...e,
|
|
@@ -19842,6 +19966,17 @@ ${lines.join("\n")}` }]);
|
|
|
19842
19966
|
...es,
|
|
19843
19967
|
{ kind: "cloud_quota_exhausted", key: mkKey(), used, limit, expiresAt }
|
|
19844
19968
|
]);
|
|
19969
|
+
} else if (e instanceof KimiApiError && (e.httpStatus === 429 || e.code === 3040 || e.httpStatus !== void 0 && e.httpStatus >= 500)) {
|
|
19970
|
+
setEvents((es) => [
|
|
19971
|
+
...es,
|
|
19972
|
+
{
|
|
19973
|
+
kind: "api_error",
|
|
19974
|
+
key: mkKey(),
|
|
19975
|
+
httpStatus: e.httpStatus,
|
|
19976
|
+
code: e.code,
|
|
19977
|
+
message: humanizeCloudflareError(e)
|
|
19978
|
+
}
|
|
19979
|
+
]);
|
|
19845
19980
|
} else {
|
|
19846
19981
|
const displayText2 = e instanceof KimiApiError ? humanizeCloudflareError(e) : e.message ?? String(e);
|
|
19847
19982
|
setEvents((es) => [
|
|
@@ -19901,7 +20036,7 @@ ${lines.join("\n")}` }]);
|
|
|
19901
20036
|
}
|
|
19902
20037
|
}, [usage]);
|
|
19903
20038
|
if (!cfg) {
|
|
19904
|
-
return /* @__PURE__ */
|
|
20039
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(
|
|
19905
20040
|
Onboarding,
|
|
19906
20041
|
{
|
|
19907
20042
|
onCancel: () => exit(),
|
|
@@ -19933,7 +20068,7 @@ ${lines.join("\n")}` }]);
|
|
|
19933
20068
|
) });
|
|
19934
20069
|
}
|
|
19935
20070
|
if (checkpointSession !== null) {
|
|
19936
|
-
return /* @__PURE__ */
|
|
20071
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
19937
20072
|
CheckpointPicker,
|
|
19938
20073
|
{
|
|
19939
20074
|
session: checkpointSession,
|
|
@@ -19943,10 +20078,10 @@ ${lines.join("\n")}` }]);
|
|
|
19943
20078
|
) }) });
|
|
19944
20079
|
}
|
|
19945
20080
|
if (resumeSessions !== null) {
|
|
19946
|
-
return /* @__PURE__ */
|
|
20081
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(ResumePicker, { sessions: resumeSessions, onPick: handleResumePick }) }) });
|
|
19947
20082
|
}
|
|
19948
20083
|
if (showRemoteDashboard) {
|
|
19949
|
-
return /* @__PURE__ */
|
|
20084
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: selectedRemoteSession ? /* @__PURE__ */ jsx25(
|
|
19950
20085
|
RemoteSessionDetail,
|
|
19951
20086
|
{
|
|
19952
20087
|
session: selectedRemoteSession,
|
|
@@ -19969,7 +20104,7 @@ ${lines.join("\n")}` }]);
|
|
|
19969
20104
|
setShowRemoteDashboard(false);
|
|
19970
20105
|
}
|
|
19971
20106
|
}
|
|
19972
|
-
) : /* @__PURE__ */
|
|
20107
|
+
) : /* @__PURE__ */ jsx25(
|
|
19973
20108
|
RemoteDashboard,
|
|
19974
20109
|
{
|
|
19975
20110
|
onSelect: (session) => setSelectedRemoteSession(session),
|
|
@@ -19978,7 +20113,7 @@ ${lines.join("\n")}` }]);
|
|
|
19978
20113
|
) }) });
|
|
19979
20114
|
}
|
|
19980
20115
|
if (showLspWizard) {
|
|
19981
|
-
return /* @__PURE__ */
|
|
20116
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
19982
20117
|
LspWizard,
|
|
19983
20118
|
{
|
|
19984
20119
|
servers: cfg?.lspServers ?? {},
|
|
@@ -20015,7 +20150,7 @@ ${lines.join("\n")}` }]);
|
|
|
20015
20150
|
) }) });
|
|
20016
20151
|
}
|
|
20017
20152
|
if (commandWizard) {
|
|
20018
|
-
return /* @__PURE__ */
|
|
20153
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
20019
20154
|
CommandWizard,
|
|
20020
20155
|
{
|
|
20021
20156
|
mode: commandWizard.mode,
|
|
@@ -20028,7 +20163,7 @@ ${lines.join("\n")}` }]);
|
|
|
20028
20163
|
) }) });
|
|
20029
20164
|
}
|
|
20030
20165
|
if (commandPicker) {
|
|
20031
|
-
return /* @__PURE__ */
|
|
20166
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
20032
20167
|
CommandPicker,
|
|
20033
20168
|
{
|
|
20034
20169
|
commands: customCommandsRef.current,
|
|
@@ -20046,14 +20181,14 @@ ${lines.join("\n")}` }]);
|
|
|
20046
20181
|
) }) });
|
|
20047
20182
|
}
|
|
20048
20183
|
if (commandToDelete) {
|
|
20049
|
-
return /* @__PURE__ */
|
|
20050
|
-
/* @__PURE__ */
|
|
20184
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
20185
|
+
/* @__PURE__ */ jsxs23(Text24, { color: theme.accent, bold: true, children: [
|
|
20051
20186
|
"Delete /",
|
|
20052
20187
|
commandToDelete.name,
|
|
20053
20188
|
"?"
|
|
20054
20189
|
] }),
|
|
20055
|
-
/* @__PURE__ */
|
|
20056
|
-
/* @__PURE__ */
|
|
20190
|
+
/* @__PURE__ */ jsx25(Text24, { color: theme.info.color, children: commandToDelete.filepath }),
|
|
20191
|
+
/* @__PURE__ */ jsx25(Box23, { marginTop: 1, children: /* @__PURE__ */ jsx25(
|
|
20057
20192
|
SelectInput10,
|
|
20058
20193
|
{
|
|
20059
20194
|
items: [
|
|
@@ -20072,7 +20207,7 @@ ${lines.join("\n")}` }]);
|
|
|
20072
20207
|
] }) });
|
|
20073
20208
|
}
|
|
20074
20209
|
if (showCommandList) {
|
|
20075
|
-
return /* @__PURE__ */
|
|
20210
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
20076
20211
|
CommandList,
|
|
20077
20212
|
{
|
|
20078
20213
|
commands: customCommandsRef.current,
|
|
@@ -20081,12 +20216,12 @@ ${lines.join("\n")}` }]);
|
|
|
20081
20216
|
) }) });
|
|
20082
20217
|
}
|
|
20083
20218
|
if (showThemePicker) {
|
|
20084
|
-
return /* @__PURE__ */
|
|
20219
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(ThemePicker, { themes: themeList(), onPick: handleThemePick }) }) });
|
|
20085
20220
|
}
|
|
20086
20221
|
const hasConversation = events.some((e) => e.kind === "user" || e.kind === "assistant");
|
|
20087
|
-
return /* @__PURE__ */
|
|
20088
|
-
!hasConversation && events.length === 0 ? /* @__PURE__ */
|
|
20089
|
-
perm ? /* @__PURE__ */
|
|
20222
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", children: [
|
|
20223
|
+
!hasConversation && events.length === 0 ? /* @__PURE__ */ jsx25(Welcome, {}) : /* @__PURE__ */ jsx25(ChatView, { events, showReasoning, verbose, intentTier: intentTier ?? void 0 }),
|
|
20224
|
+
perm ? /* @__PURE__ */ jsx25(
|
|
20090
20225
|
PermissionModal,
|
|
20091
20226
|
{
|
|
20092
20227
|
tool: perm.tool,
|
|
@@ -20100,7 +20235,7 @@ ${lines.join("\n")}` }]);
|
|
|
20100
20235
|
submitRef.current(text);
|
|
20101
20236
|
}
|
|
20102
20237
|
}
|
|
20103
|
-
) : limitModal ? /* @__PURE__ */
|
|
20238
|
+
) : limitModal ? /* @__PURE__ */ jsx25(
|
|
20104
20239
|
LimitModal,
|
|
20105
20240
|
{
|
|
20106
20241
|
limit: limitModal.limit,
|
|
@@ -20110,8 +20245,8 @@ ${lines.join("\n")}` }]);
|
|
|
20110
20245
|
setLimitModal(null);
|
|
20111
20246
|
}
|
|
20112
20247
|
}
|
|
20113
|
-
) : /* @__PURE__ */
|
|
20114
|
-
tasks.length > 0 && /* @__PURE__ */
|
|
20248
|
+
) : /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", marginTop: 1, children: [
|
|
20249
|
+
tasks.length > 0 && /* @__PURE__ */ jsx25(
|
|
20115
20250
|
TaskList,
|
|
20116
20251
|
{
|
|
20117
20252
|
tasks,
|
|
@@ -20119,11 +20254,11 @@ ${lines.join("\n")}` }]);
|
|
|
20119
20254
|
tokensDelta: Math.max(0, (usage?.prompt_tokens ?? 0) - tasksStartTokens)
|
|
20120
20255
|
}
|
|
20121
20256
|
),
|
|
20122
|
-
queue.length > 0 && /* @__PURE__ */
|
|
20257
|
+
queue.length > 0 && /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", marginBottom: 1, children: queue.map((q, i) => /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, dimColor: theme.info.dim, children: [
|
|
20123
20258
|
"\u23F3 ",
|
|
20124
20259
|
q.display
|
|
20125
20260
|
] }, `queue_${i}`)) }),
|
|
20126
|
-
/* @__PURE__ */
|
|
20261
|
+
/* @__PURE__ */ jsx25(
|
|
20127
20262
|
StatusBar,
|
|
20128
20263
|
{
|
|
20129
20264
|
usage,
|
|
@@ -20146,7 +20281,7 @@ ${lines.join("\n")}` }]);
|
|
|
20146
20281
|
intentTier: intentTier ?? void 0
|
|
20147
20282
|
}
|
|
20148
20283
|
),
|
|
20149
|
-
activePicker?.kind === "file" && /* @__PURE__ */
|
|
20284
|
+
activePicker?.kind === "file" && /* @__PURE__ */ jsx25(
|
|
20150
20285
|
FilePicker,
|
|
20151
20286
|
{
|
|
20152
20287
|
items: filteredFileItems,
|
|
@@ -20155,7 +20290,7 @@ ${lines.join("\n")}` }]);
|
|
|
20155
20290
|
recentFiles: new Set(recentFilesRef.current.keys())
|
|
20156
20291
|
}
|
|
20157
20292
|
),
|
|
20158
|
-
activePicker?.kind === "slash" && /* @__PURE__ */
|
|
20293
|
+
activePicker?.kind === "slash" && /* @__PURE__ */ jsx25(
|
|
20159
20294
|
SlashPicker,
|
|
20160
20295
|
{
|
|
20161
20296
|
items: filteredSlashItems,
|
|
@@ -20163,9 +20298,9 @@ ${lines.join("\n")}` }]);
|
|
|
20163
20298
|
query: pickerQuery ?? ""
|
|
20164
20299
|
}
|
|
20165
20300
|
),
|
|
20166
|
-
/* @__PURE__ */
|
|
20167
|
-
/* @__PURE__ */
|
|
20168
|
-
/* @__PURE__ */
|
|
20301
|
+
/* @__PURE__ */ jsxs23(Box23, { marginTop: 1, children: [
|
|
20302
|
+
/* @__PURE__ */ jsx25(Text24, { color: theme.prompt ?? theme.accent, children: "\u203A " }),
|
|
20303
|
+
/* @__PURE__ */ jsx25(
|
|
20169
20304
|
CustomTextInput,
|
|
20170
20305
|
{
|
|
20171
20306
|
value: input,
|
|
@@ -20222,7 +20357,7 @@ ${lines.join("\n")}` }]);
|
|
|
20222
20357
|
}
|
|
20223
20358
|
async function renderApp(cfg, updateResult, lspScope = "global", lspProjectPath = null, cloudToken, cloudDeviceId) {
|
|
20224
20359
|
const instance = render(
|
|
20225
|
-
/* @__PURE__ */
|
|
20360
|
+
/* @__PURE__ */ jsx25(
|
|
20226
20361
|
App,
|
|
20227
20362
|
{
|
|
20228
20363
|
initialCfg: cfg,
|
|
@@ -20250,6 +20385,7 @@ var init_app = __esm({
|
|
|
20250
20385
|
init_artifact_compaction();
|
|
20251
20386
|
init_session_state();
|
|
20252
20387
|
init_executor();
|
|
20388
|
+
init_bash();
|
|
20253
20389
|
init_manager3();
|
|
20254
20390
|
init_manager2();
|
|
20255
20391
|
init_lsp();
|