kimiflare 0.53.0 → 0.54.1
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 +541 -438
- package/dist/index.js.map +1 -1
- package/dist/sdk/index.d.ts +3 -0
- package/dist/sdk/index.js +37 -12
- package/dist/sdk/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -456,28 +456,34 @@ function isCloudQuotaExhaustedError(err) {
|
|
|
456
456
|
function humanizeCloudflareError(err) {
|
|
457
457
|
const { code, httpStatus, message: message2 } = err;
|
|
458
458
|
if (code === 3040) {
|
|
459
|
-
return "Cloudflare Workers AI is at capacity.
|
|
459
|
+
return "Cloudflare Workers AI is at capacity (code: 3040). Please wait a moment and try again.";
|
|
460
460
|
}
|
|
461
461
|
if (httpStatus === 429) {
|
|
462
|
-
|
|
462
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
463
|
+
return `Rate limit hit${codeStr}. Please wait a moment and try again.`;
|
|
463
464
|
}
|
|
464
465
|
if (httpStatus === 403 || code === 1e4) {
|
|
465
|
-
|
|
466
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
467
|
+
return `Authentication failed${codeStr}. Check that your Cloudflare API token has the 'Workers AI' permission.
|
|
468
|
+
Get a new token: https://dash.cloudflare.com/profile/api-tokens`;
|
|
466
469
|
}
|
|
467
470
|
if (httpStatus === 401) {
|
|
468
|
-
|
|
471
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
472
|
+
return `Authentication required${codeStr}. Please check your API token or run \`kimiflare auth cloud\` if using cloud mode.`;
|
|
469
473
|
}
|
|
470
474
|
if (httpStatus === 400) {
|
|
475
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
471
476
|
if (message2.includes("invalid escaped character")) {
|
|
472
|
-
return
|
|
477
|
+
return `API rejected request${codeStr} (invalid JSON in conversation history). Run /clear to reset if it persists.`;
|
|
473
478
|
}
|
|
474
479
|
if (message2.includes("Invalid model ID")) {
|
|
475
480
|
return message2;
|
|
476
481
|
}
|
|
477
|
-
return
|
|
482
|
+
return `Bad request${codeStr}. The conversation may be too long or contain invalid characters. Run /compact or /clear.`;
|
|
478
483
|
}
|
|
479
484
|
if (httpStatus && httpStatus >= 500) {
|
|
480
|
-
|
|
485
|
+
const codeStr = code !== void 0 ? ` (code: ${code})` : "";
|
|
486
|
+
return `Cloudflare servers are experiencing issues${codeStr}. Please wait a moment and try again.`;
|
|
481
487
|
}
|
|
482
488
|
return message2.replace(/\{[\s\S]*?\}/g, "(see logs for details)");
|
|
483
489
|
}
|
|
@@ -589,6 +595,7 @@ function cleanErrorMessage(msg) {
|
|
|
589
595
|
function isRetryable(err, attempt) {
|
|
590
596
|
if (attempt >= MAX_ATTEMPTS - 1) return false;
|
|
591
597
|
if (err.code !== void 0 && RETRYABLE_CODES.has(err.code)) return true;
|
|
598
|
+
if (err.httpStatus === 429) return true;
|
|
592
599
|
if (err.httpStatus !== void 0 && err.httpStatus >= 500 && err.httpStatus < 600) return true;
|
|
593
600
|
if (err.message.includes("Internal server error")) return true;
|
|
594
601
|
return false;
|
|
@@ -653,7 +660,10 @@ async function* runKimi(opts2) {
|
|
|
653
660
|
const msg = cleanErrorMessage(rawMsg);
|
|
654
661
|
const apiErr = new KimiApiError(`kimiflare: ${msg}`, err?.code, res.status);
|
|
655
662
|
if (isRetryable(apiErr, attempt)) {
|
|
656
|
-
const
|
|
663
|
+
const isRateLimit = apiErr.httpStatus === 429;
|
|
664
|
+
const baseDelay = isRateLimit ? 2e3 : 500;
|
|
665
|
+
const delay = baseDelay * 2 ** attempt + Math.random() * 250;
|
|
666
|
+
logger.warn("runKimi:retrying", { requestId, attempt, code: apiErr.code, httpStatus: apiErr.httpStatus, delay });
|
|
657
667
|
await sleep(delay, opts2.signal);
|
|
658
668
|
continue;
|
|
659
669
|
}
|
|
@@ -1948,24 +1958,40 @@ ${jsCode}
|
|
|
1948
1958
|
}
|
|
1949
1959
|
return { output: logs.join("\n"), logs, toolCalls, warnings };
|
|
1950
1960
|
}
|
|
1961
|
+
function buildFallbackWarning(errMessage) {
|
|
1962
|
+
let reason;
|
|
1963
|
+
let fix;
|
|
1964
|
+
if (errMessage.includes("Cannot find module") || errMessage.includes("isolated-vm")) {
|
|
1965
|
+
reason = "The optional dependency `isolated-vm` is not installed.";
|
|
1966
|
+
fix = "Run `npm install isolated-vm` in your project (or `npm install -g isolated-vm` if KimiFlare is installed globally).";
|
|
1967
|
+
} else if (errMessage.includes("bindings") || errMessage.includes(".node")) {
|
|
1968
|
+
reason = "The `isolated-vm` native bindings are incompatible with this Node version or architecture.";
|
|
1969
|
+
fix = "Try `npm rebuild isolated-vm`, or switch to Node 22 LTS if you're on Apple Silicon.";
|
|
1970
|
+
} else {
|
|
1971
|
+
reason = "The secure sandbox (`isolated-vm`) could not be loaded.";
|
|
1972
|
+
fix = "Ensure build tools are installed, then run `npm install isolated-vm`.";
|
|
1973
|
+
}
|
|
1974
|
+
return `Code Mode is using the built-in Node.js sandbox. Tool execution works normally, but without memory limits or full process isolation. ${reason} ${fix}`;
|
|
1975
|
+
}
|
|
1951
1976
|
async function runInSandbox(opts2) {
|
|
1952
1977
|
try {
|
|
1953
1978
|
return await runWithIsolatedVm(opts2);
|
|
1954
1979
|
} catch (err) {
|
|
1955
1980
|
const message2 = err instanceof Error ? err.message : String(err);
|
|
1956
|
-
if (message2.includes("isolated-vm") || message2.includes("Cannot find module") || message2.includes("bindings")) {
|
|
1957
|
-
const result2 = await runWithNodeVm(opts2);
|
|
1958
|
-
return { ...result2, warnings: [ISOLATED_VM_FALLBACK_WARNING, ...result2.warnings ?? []] };
|
|
1959
|
-
}
|
|
1960
1981
|
const result = await runWithNodeVm(opts2);
|
|
1961
|
-
|
|
1982
|
+
if (!fallbackWarningShown) {
|
|
1983
|
+
fallbackWarningShown = true;
|
|
1984
|
+
const warning = buildFallbackWarning(message2);
|
|
1985
|
+
return { ...result, warnings: [warning, ...result.warnings ?? []] };
|
|
1986
|
+
}
|
|
1987
|
+
return result;
|
|
1962
1988
|
}
|
|
1963
1989
|
}
|
|
1964
|
-
var
|
|
1990
|
+
var fallbackWarningShown;
|
|
1965
1991
|
var init_sandbox = __esm({
|
|
1966
1992
|
"src/code-mode/sandbox.ts"() {
|
|
1967
1993
|
"use strict";
|
|
1968
|
-
|
|
1994
|
+
fallbackWarningShown = false;
|
|
1969
1995
|
}
|
|
1970
1996
|
});
|
|
1971
1997
|
|
|
@@ -2774,13 +2800,15 @@ Use console.log() to return results. Only console.log output will be sent back t
|
|
|
2774
2800
|
toolResults.push(toolResult);
|
|
2775
2801
|
opts2.callbacks.onToolResult?.(toolResult);
|
|
2776
2802
|
}
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2803
|
+
if (sandboxResult.warnings && sandboxResult.warnings.length > 0) {
|
|
2804
|
+
for (const w of sandboxResult.warnings) {
|
|
2805
|
+
opts2.callbacks.onWarning?.(w);
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
let resultContent = sandboxResult.error ? `Error: ${sandboxResult.error}
|
|
2781
2809
|
|
|
2782
2810
|
Output:
|
|
2783
|
-
${sandboxResult.output}` :
|
|
2811
|
+
${sandboxResult.output}` : sandboxResult.output;
|
|
2784
2812
|
if (resultContent.length > MAX_TOOL_CONTENT_CHARS) {
|
|
2785
2813
|
resultContent = resultContent.slice(0, MAX_TOOL_CONTENT_CHARS) + `
|
|
2786
2814
|
|
|
@@ -9164,6 +9192,9 @@ var init_session = __esm({
|
|
|
9164
9192
|
onTasks: (tasks) => {
|
|
9165
9193
|
this.emit({ type: "tasks.update", tasks });
|
|
9166
9194
|
},
|
|
9195
|
+
onWarning: (msg) => {
|
|
9196
|
+
this.emit({ type: "warning", message: msg });
|
|
9197
|
+
},
|
|
9167
9198
|
askPermission: async (req) => {
|
|
9168
9199
|
if (mode === "auto") return "allow";
|
|
9169
9200
|
if (mode === "plan") {
|
|
@@ -10550,11 +10581,35 @@ var init_cloud_quota_message = __esm({
|
|
|
10550
10581
|
}
|
|
10551
10582
|
});
|
|
10552
10583
|
|
|
10584
|
+
// src/ui/api-error-message.tsx
|
|
10585
|
+
import { Box as Box5, Text as Text5 } from "ink";
|
|
10586
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
10587
|
+
function ApiErrorMessage({ httpStatus, code, message: message2 }) {
|
|
10588
|
+
const theme = useTheme();
|
|
10589
|
+
const parts = [];
|
|
10590
|
+
if (httpStatus !== void 0) parts.push(`HTTP ${httpStatus}`);
|
|
10591
|
+
if (code !== void 0) parts.push(`code: ${code}`);
|
|
10592
|
+
const meta = parts.join(" \xB7 ");
|
|
10593
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: theme.error, paddingX: 1, marginY: 1, children: [
|
|
10594
|
+
/* @__PURE__ */ jsxs5(Text5, { bold: true, color: theme.error, children: [
|
|
10595
|
+
"\u26A0 ",
|
|
10596
|
+
message2
|
|
10597
|
+
] }),
|
|
10598
|
+
meta && /* @__PURE__ */ jsx6(Text5, { color: theme.muted?.color ?? theme.info.color, dimColor: theme.muted?.dim ?? true, children: meta })
|
|
10599
|
+
] });
|
|
10600
|
+
}
|
|
10601
|
+
var init_api_error_message = __esm({
|
|
10602
|
+
"src/ui/api-error-message.tsx"() {
|
|
10603
|
+
"use strict";
|
|
10604
|
+
init_theme_context();
|
|
10605
|
+
}
|
|
10606
|
+
});
|
|
10607
|
+
|
|
10553
10608
|
// src/ui/chat.tsx
|
|
10554
10609
|
import React4 from "react";
|
|
10555
|
-
import { Box as
|
|
10610
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
10556
10611
|
import Spinner2 from "ink-spinner";
|
|
10557
|
-
import { jsx as
|
|
10612
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
10558
10613
|
function toolSignature(name, args) {
|
|
10559
10614
|
return `${name}:${args}`;
|
|
10560
10615
|
}
|
|
@@ -10567,6 +10622,7 @@ var init_chat = __esm({
|
|
|
10567
10622
|
init_theme_context();
|
|
10568
10623
|
init_narrator();
|
|
10569
10624
|
init_cloud_quota_message();
|
|
10625
|
+
init_api_error_message();
|
|
10570
10626
|
ChatView = React4.memo(function ChatView2({ events, showReasoning, verbose, intentTier }) {
|
|
10571
10627
|
const theme = useTheme();
|
|
10572
10628
|
const toolCounts = /* @__PURE__ */ new Map();
|
|
@@ -10580,12 +10636,12 @@ var init_chat = __esm({
|
|
|
10580
10636
|
for (const [sig, count] of toolCounts) {
|
|
10581
10637
|
if (count >= 3) repeatedSigs.add(sig);
|
|
10582
10638
|
}
|
|
10583
|
-
return /* @__PURE__ */
|
|
10639
|
+
return /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: events.map((e, i) => {
|
|
10584
10640
|
const prev = events[i - 1];
|
|
10585
10641
|
const showSeparator = !!(e.kind === "user" && prev && (prev.kind === "assistant" || prev.kind === "tool"));
|
|
10586
|
-
return /* @__PURE__ */
|
|
10587
|
-
showSeparator && /* @__PURE__ */
|
|
10588
|
-
/* @__PURE__ */
|
|
10642
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
10643
|
+
showSeparator && /* @__PURE__ */ jsx7(Box6, { marginY: 1, children: /* @__PURE__ */ jsx7(Text6, { color: theme.info.color, children: "\u2500".repeat(40) }) }),
|
|
10644
|
+
/* @__PURE__ */ jsx7(EventView, { evt: e, showReasoning, verbose, repeatedSigs, intentTier })
|
|
10589
10645
|
] }, e.key);
|
|
10590
10646
|
}) });
|
|
10591
10647
|
});
|
|
@@ -10600,61 +10656,61 @@ var init_chat = __esm({
|
|
|
10600
10656
|
if (evt.kind === "user") {
|
|
10601
10657
|
if (evt.queued) {
|
|
10602
10658
|
const mutedColor = theme.muted?.color ?? theme.info.color;
|
|
10603
|
-
return /* @__PURE__ */
|
|
10604
|
-
/* @__PURE__ */
|
|
10659
|
+
return /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", children: /* @__PURE__ */ jsxs6(Box6, { children: [
|
|
10660
|
+
/* @__PURE__ */ jsxs6(Text6, { italic: true, color: mutedColor, children: [
|
|
10605
10661
|
"\xB7\xB7\xB7",
|
|
10606
10662
|
" "
|
|
10607
10663
|
] }),
|
|
10608
|
-
/* @__PURE__ */
|
|
10609
|
-
/* @__PURE__ */
|
|
10664
|
+
/* @__PURE__ */ jsx7(Text6, { italic: true, color: mutedColor, children: evt.text }),
|
|
10665
|
+
/* @__PURE__ */ jsxs6(Text6, { italic: true, color: mutedColor, children: [
|
|
10610
10666
|
" ",
|
|
10611
10667
|
"(queued)"
|
|
10612
10668
|
] })
|
|
10613
10669
|
] }) });
|
|
10614
10670
|
}
|
|
10615
|
-
return /* @__PURE__ */
|
|
10616
|
-
/* @__PURE__ */
|
|
10617
|
-
/* @__PURE__ */
|
|
10671
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
10672
|
+
/* @__PURE__ */ jsxs6(Box6, { children: [
|
|
10673
|
+
/* @__PURE__ */ jsxs6(Text6, { bold: true, color: theme.user, children: [
|
|
10618
10674
|
"\u203A",
|
|
10619
10675
|
" "
|
|
10620
10676
|
] }),
|
|
10621
|
-
/* @__PURE__ */
|
|
10677
|
+
/* @__PURE__ */ jsx7(Text6, { bold: true, children: evt.text })
|
|
10622
10678
|
] }),
|
|
10623
|
-
evt.images && evt.images.length > 0 && /* @__PURE__ */
|
|
10679
|
+
evt.images && evt.images.length > 0 && /* @__PURE__ */ jsx7(Box6, { paddingLeft: 2, children: /* @__PURE__ */ jsxs6(Text6, { color: theme.info.color, children: [
|
|
10624
10680
|
"\u{1F5BC}\uFE0F ",
|
|
10625
10681
|
evt.images.join(", ")
|
|
10626
10682
|
] }) })
|
|
10627
10683
|
] });
|
|
10628
10684
|
}
|
|
10629
10685
|
if (evt.kind === "assistant") {
|
|
10630
|
-
return /* @__PURE__ */
|
|
10631
|
-
showReasoning && evt.reasoning ? /* @__PURE__ */
|
|
10686
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingLeft: 2, children: [
|
|
10687
|
+
showReasoning && evt.reasoning ? /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", marginBottom: 1, children: /* @__PURE__ */ jsxs6(Text6, { color: theme.reasoning.color, children: [
|
|
10632
10688
|
"thinking\u2026",
|
|
10633
10689
|
" ",
|
|
10634
10690
|
evt.reasoning.length > 400 ? evt.reasoning.slice(0, 400) + "\u2026" : evt.reasoning
|
|
10635
10691
|
] }) }) : null,
|
|
10636
|
-
evt.text ? /* @__PURE__ */
|
|
10637
|
-
evt.streaming && /* @__PURE__ */
|
|
10692
|
+
evt.text ? /* @__PURE__ */ jsx7(MD, { text: evt.text }) : null,
|
|
10693
|
+
evt.streaming && /* @__PURE__ */ jsx7(Text6, { color: theme.spinner, children: /* @__PURE__ */ jsx7(Spinner2, { type: "dots" }) })
|
|
10638
10694
|
] });
|
|
10639
10695
|
}
|
|
10640
10696
|
if (evt.kind === "tool") {
|
|
10641
10697
|
const isRepeated = repeatedSigs?.has(toolSignature(evt.name, evt.args)) ?? false;
|
|
10642
|
-
return /* @__PURE__ */
|
|
10698
|
+
return /* @__PURE__ */ jsx7(ToolView, { evt, verbose, isRepeated, intentTier });
|
|
10643
10699
|
}
|
|
10644
10700
|
if (evt.kind === "info") {
|
|
10645
|
-
return /* @__PURE__ */
|
|
10701
|
+
return /* @__PURE__ */ jsxs6(Text6, { color: theme.info.color, children: [
|
|
10646
10702
|
"\xB7 ",
|
|
10647
10703
|
humanizeInfo(evt.text, intentTier)
|
|
10648
10704
|
] });
|
|
10649
10705
|
}
|
|
10650
10706
|
if (evt.kind === "memory") {
|
|
10651
|
-
return /* @__PURE__ */
|
|
10707
|
+
return /* @__PURE__ */ jsxs6(Text6, { color: theme.info.color, children: [
|
|
10652
10708
|
"\u25C8 ",
|
|
10653
10709
|
humanizeMemory(evt.text, intentTier)
|
|
10654
10710
|
] });
|
|
10655
10711
|
}
|
|
10656
10712
|
if (evt.kind === "cloud_quota_exhausted") {
|
|
10657
|
-
return /* @__PURE__ */
|
|
10713
|
+
return /* @__PURE__ */ jsx7(
|
|
10658
10714
|
CloudQuotaMessage,
|
|
10659
10715
|
{
|
|
10660
10716
|
used: evt.used,
|
|
@@ -10673,9 +10729,19 @@ var init_chat = __esm({
|
|
|
10673
10729
|
}
|
|
10674
10730
|
const metaText = humanizeMeta(metaParts, intentTier ?? evt.intentTier);
|
|
10675
10731
|
if (!metaText) return null;
|
|
10676
|
-
return /* @__PURE__ */
|
|
10732
|
+
return /* @__PURE__ */ jsx7(Text6, { color: theme.info.color, dimColor: true, children: metaText });
|
|
10677
10733
|
}
|
|
10678
|
-
|
|
10734
|
+
if (evt.kind === "api_error") {
|
|
10735
|
+
return /* @__PURE__ */ jsx7(
|
|
10736
|
+
ApiErrorMessage,
|
|
10737
|
+
{
|
|
10738
|
+
httpStatus: evt.httpStatus,
|
|
10739
|
+
code: evt.code,
|
|
10740
|
+
message: evt.message
|
|
10741
|
+
}
|
|
10742
|
+
);
|
|
10743
|
+
}
|
|
10744
|
+
return /* @__PURE__ */ jsxs6(Text6, { color: theme.error, children: [
|
|
10679
10745
|
"! ",
|
|
10680
10746
|
evt.text
|
|
10681
10747
|
] });
|
|
@@ -10685,9 +10751,9 @@ var init_chat = __esm({
|
|
|
10685
10751
|
|
|
10686
10752
|
// src/ui/status.tsx
|
|
10687
10753
|
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
10688
|
-
import { Box as
|
|
10754
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
10689
10755
|
import Spinner3 from "ink-spinner";
|
|
10690
|
-
import { jsx as
|
|
10756
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
10691
10757
|
function StatusBar({ usage, sessionUsage, thinking, turnStartedAt, mode, contextLimit, gatewayMeta, codeMode, cloudMode, cloudBudget, skillsActive, memoryRecalled, phase, currentTool, lastActivityAt, kimiMdStale, gitBranch, intentTier }) {
|
|
10692
10758
|
const theme = useTheme();
|
|
10693
10759
|
const [now2, setNow] = useState2(Date.now());
|
|
@@ -10715,31 +10781,32 @@ function StatusBar({ usage, sessionUsage, thinking, turnStartedAt, mode, context
|
|
|
10715
10781
|
const idleLabel = idleMs > 3e4 ? ` (idle ${formatElapsed2(Math.floor(idleMs / 1e3))})` : "";
|
|
10716
10782
|
const thinkingText = metaParts.length > 0 ? `${phaseLabel}${elapsed ? ` \xB7 ${elapsed}` : ""}${idleLabel} \xB7 ${metaParts.join(" \xB7 ")}` : `${phaseLabel}${elapsed ? ` \xB7 ${elapsed}` : ""}${idleLabel}`;
|
|
10717
10783
|
const readyText = idleParts.length > 0 ? `${idleParts.join(" \xB7 ")} \xB7 ready` : "ready";
|
|
10718
|
-
return /* @__PURE__ */
|
|
10719
|
-
/* @__PURE__ */
|
|
10720
|
-
/* @__PURE__ */
|
|
10784
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
10785
|
+
/* @__PURE__ */ jsxs7(Box7, { children: [
|
|
10786
|
+
/* @__PURE__ */ jsxs7(Text7, { color: modeColor, bold: true, children: [
|
|
10721
10787
|
"[",
|
|
10722
10788
|
mode,
|
|
10723
10789
|
"]"
|
|
10724
10790
|
] }),
|
|
10725
|
-
/* @__PURE__ */
|
|
10726
|
-
thinking ? /* @__PURE__ */
|
|
10727
|
-
/* @__PURE__ */
|
|
10791
|
+
/* @__PURE__ */ jsx8(Text7, { children: " " }),
|
|
10792
|
+
thinking ? /* @__PURE__ */ jsxs7(Text7, { color: theme.spinner, children: [
|
|
10793
|
+
/* @__PURE__ */ jsx8(Spinner3, { type: "dots2" }),
|
|
10728
10794
|
" ",
|
|
10729
10795
|
thinkingText
|
|
10730
|
-
] }) : /* @__PURE__ */
|
|
10796
|
+
] }) : /* @__PURE__ */ jsx8(Text7, { color: theme.info.color, children: readyText })
|
|
10731
10797
|
] }),
|
|
10732
|
-
usage && /* @__PURE__ */
|
|
10733
|
-
/* @__PURE__ */
|
|
10734
|
-
warn ? /* @__PURE__ */
|
|
10798
|
+
usage && /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
10799
|
+
/* @__PURE__ */ jsx8(Text7, { color: theme.info.color, children: buildRightParts(usage, contextLimit, sessionUsage, gatewayMeta, cloudMode, cloudBudget).join(" \xB7 ") }),
|
|
10800
|
+
warn ? /* @__PURE__ */ jsxs7(Text7, { color: theme.warn, bold: true, children: [
|
|
10735
10801
|
" \xB7 ",
|
|
10736
10802
|
"/compact recommended"
|
|
10737
10803
|
] }) : null,
|
|
10738
|
-
kimiMdStale ? /* @__PURE__ */
|
|
10804
|
+
kimiMdStale ? /* @__PURE__ */ jsxs7(Text7, { color: theme.warn, bold: true, children: [
|
|
10739
10805
|
" \xB7 ",
|
|
10740
10806
|
"\u26A0 KIMI.md stale \xB7 run /init"
|
|
10741
10807
|
] }) : null
|
|
10742
|
-
] })
|
|
10808
|
+
] }),
|
|
10809
|
+
!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" }) })
|
|
10743
10810
|
] });
|
|
10744
10811
|
}
|
|
10745
10812
|
function buildRightParts(usage, contextLimit, sessionUsage, gatewayMeta, cloudMode, cloudBudget) {
|
|
@@ -11320,8 +11387,8 @@ var init_source = __esm({
|
|
|
11320
11387
|
|
|
11321
11388
|
// src/ui/text-input.tsx
|
|
11322
11389
|
import { useState as useState3, useEffect as useEffect3, useRef } from "react";
|
|
11323
|
-
import { Text as
|
|
11324
|
-
import { jsx as
|
|
11390
|
+
import { Text as Text8, useInput } from "ink";
|
|
11391
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
11325
11392
|
function shouldTreatAsPaste(input) {
|
|
11326
11393
|
if (input.length >= PASTE_CHAR_THRESHOLD) return true;
|
|
11327
11394
|
const newlines = (input.match(/\n/g) ?? []).length;
|
|
@@ -11542,7 +11609,7 @@ function CustomTextInput({
|
|
|
11542
11609
|
} else if (cursorOffset === displayValue.length) {
|
|
11543
11610
|
renderedValue += source_default.inverse(" ");
|
|
11544
11611
|
}
|
|
11545
|
-
return /* @__PURE__ */
|
|
11612
|
+
return /* @__PURE__ */ jsx9(Text8, { children: renderedValue });
|
|
11546
11613
|
}
|
|
11547
11614
|
function findPasteTokenEndingAt(value, pos, pastes) {
|
|
11548
11615
|
if (pos <= 0 || value[pos - 1] !== "\u2998") return -1;
|
|
@@ -11565,9 +11632,9 @@ var init_text_input = __esm({
|
|
|
11565
11632
|
|
|
11566
11633
|
// src/ui/permission.tsx
|
|
11567
11634
|
import { useState as useState4, useCallback } from "react";
|
|
11568
|
-
import { Box as
|
|
11635
|
+
import { Box as Box8, Text as Text9, useInput as useInput2 } from "ink";
|
|
11569
11636
|
import { platform as platform2 } from "os";
|
|
11570
|
-
import { jsx as
|
|
11637
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
11571
11638
|
function formatSelection(label, shortcut) {
|
|
11572
11639
|
return `${label} [${MOD_KEY}+${shortcut}]`;
|
|
11573
11640
|
}
|
|
@@ -11655,10 +11722,10 @@ function PermissionModal({ tool, args, onDecide, onFeedback }) {
|
|
|
11655
11722
|
{ isActive: !feedbackActive }
|
|
11656
11723
|
);
|
|
11657
11724
|
if (showHelp) {
|
|
11658
|
-
return /* @__PURE__ */
|
|
11659
|
-
/* @__PURE__ */
|
|
11660
|
-
/* @__PURE__ */
|
|
11661
|
-
/* @__PURE__ */
|
|
11725
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: theme.permission, paddingX: 1, children: [
|
|
11726
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.permission, bold: true, children: "Permission modal \u2014 keyboard shortcuts" }),
|
|
11727
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "\u2191 / \u2193 or j / k \u2014 navigate options" }),
|
|
11728
|
+
/* @__PURE__ */ jsxs8(Text9, { color: theme.info.color, children: [
|
|
11662
11729
|
MOD_KEY,
|
|
11663
11730
|
"+1 / ",
|
|
11664
11731
|
MOD_KEY,
|
|
@@ -11666,31 +11733,31 @@ function PermissionModal({ tool, args, onDecide, onFeedback }) {
|
|
|
11666
11733
|
MOD_KEY,
|
|
11667
11734
|
"+3 \u2014 select option directly"
|
|
11668
11735
|
] }),
|
|
11669
|
-
/* @__PURE__ */
|
|
11670
|
-
/* @__PURE__ */
|
|
11671
|
-
/* @__PURE__ */
|
|
11672
|
-
/* @__PURE__ */
|
|
11673
|
-
/* @__PURE__ */
|
|
11674
|
-
/* @__PURE__ */
|
|
11675
|
-
/* @__PURE__ */
|
|
11736
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "Enter \u2014 confirm selection" }),
|
|
11737
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "Esc \u2014 deny and close" }),
|
|
11738
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "? \u2014 toggle this help" }),
|
|
11739
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: "When feedback input is open:" }),
|
|
11740
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: " Enter \u2014 submit feedback and deny" }),
|
|
11741
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, children: " Esc \u2014 deny without feedback" }),
|
|
11742
|
+
/* @__PURE__ */ jsx10(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text9, { color: theme.accent, children: "Press any key to close" }) })
|
|
11676
11743
|
] });
|
|
11677
11744
|
}
|
|
11678
|
-
return /* @__PURE__ */
|
|
11679
|
-
/* @__PURE__ */
|
|
11680
|
-
/* @__PURE__ */
|
|
11745
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: theme.permission, paddingX: 1, children: [
|
|
11746
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.permission, bold: true, children: "Permission requested" }),
|
|
11747
|
+
/* @__PURE__ */ jsxs8(Text9, { children: [
|
|
11681
11748
|
"tool: ",
|
|
11682
|
-
/* @__PURE__ */
|
|
11749
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.tool, children: tool.name })
|
|
11683
11750
|
] }),
|
|
11684
|
-
render2?.title ? /* @__PURE__ */
|
|
11751
|
+
render2?.title ? /* @__PURE__ */ jsxs8(Text9, { children: [
|
|
11685
11752
|
"action: ",
|
|
11686
11753
|
render2.title
|
|
11687
11754
|
] }) : null,
|
|
11688
|
-
render2?.diff ? /* @__PURE__ */
|
|
11755
|
+
render2?.diff ? /* @__PURE__ */ jsx10(Box8, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx10(DiffView, { ...render2.diff }) }) : /* @__PURE__ */ jsxs8(Text9, { color: theme.info.color, children: [
|
|
11689
11756
|
"args: ",
|
|
11690
11757
|
JSON.stringify(args)
|
|
11691
11758
|
] }),
|
|
11692
|
-
/* @__PURE__ */
|
|
11693
|
-
|
|
11759
|
+
/* @__PURE__ */ jsx10(Box8, { marginTop: 1, flexDirection: "column", children: OPTIONS.map((opt, i) => /* @__PURE__ */ jsxs8(
|
|
11760
|
+
Text9,
|
|
11694
11761
|
{
|
|
11695
11762
|
color: i === selectedIndex ? theme.accent : void 0,
|
|
11696
11763
|
bold: i === selectedIndex,
|
|
@@ -11701,10 +11768,10 @@ function PermissionModal({ tool, args, onDecide, onFeedback }) {
|
|
|
11701
11768
|
},
|
|
11702
11769
|
opt.value
|
|
11703
11770
|
)) }),
|
|
11704
|
-
feedbackActive && /* @__PURE__ */
|
|
11705
|
-
/* @__PURE__ */
|
|
11706
|
-
/* @__PURE__ */
|
|
11707
|
-
/* @__PURE__ */
|
|
11771
|
+
feedbackActive && /* @__PURE__ */ jsxs8(Box8, { marginTop: 1, flexDirection: "column", children: [
|
|
11772
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.palette.error, children: "Tell me what to do instead" }),
|
|
11773
|
+
/* @__PURE__ */ jsx10(Text9, { color: theme.info.color, dimColor: true, children: "Press Esc to deny without feedback" }),
|
|
11774
|
+
/* @__PURE__ */ jsx10(
|
|
11708
11775
|
CustomTextInput,
|
|
11709
11776
|
{
|
|
11710
11777
|
value: feedbackValue,
|
|
@@ -11734,27 +11801,27 @@ var init_permission = __esm({
|
|
|
11734
11801
|
});
|
|
11735
11802
|
|
|
11736
11803
|
// src/ui/limit-modal.tsx
|
|
11737
|
-
import { Box as
|
|
11804
|
+
import { Box as Box9, Text as Text10 } from "ink";
|
|
11738
11805
|
import SelectInput from "ink-select-input";
|
|
11739
|
-
import { jsx as
|
|
11806
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
11740
11807
|
function LimitModal({ limit, onDecide }) {
|
|
11741
11808
|
const theme = useTheme();
|
|
11742
11809
|
const items = [
|
|
11743
11810
|
{ label: "Continue", value: "continue" },
|
|
11744
11811
|
{ label: "Stop", value: "stop" }
|
|
11745
11812
|
];
|
|
11746
|
-
return /* @__PURE__ */
|
|
11747
|
-
/* @__PURE__ */
|
|
11813
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", borderStyle: "round", borderColor: theme.error, paddingX: 1, children: [
|
|
11814
|
+
/* @__PURE__ */ jsxs9(Text10, { color: theme.error, bold: true, children: [
|
|
11748
11815
|
"Tool-call limit reached (",
|
|
11749
11816
|
limit,
|
|
11750
11817
|
")"
|
|
11751
11818
|
] }),
|
|
11752
|
-
/* @__PURE__ */
|
|
11819
|
+
/* @__PURE__ */ jsxs9(Text10, { dimColor: true, children: [
|
|
11753
11820
|
"This session has made ",
|
|
11754
11821
|
limit,
|
|
11755
11822
|
" tool calls. What would you like to do?"
|
|
11756
11823
|
] }),
|
|
11757
|
-
/* @__PURE__ */
|
|
11824
|
+
/* @__PURE__ */ jsx11(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx11(
|
|
11758
11825
|
SelectInput,
|
|
11759
11826
|
{
|
|
11760
11827
|
items,
|
|
@@ -11841,9 +11908,9 @@ var init_fuzzy = __esm({
|
|
|
11841
11908
|
|
|
11842
11909
|
// src/ui/resume-picker.tsx
|
|
11843
11910
|
import { useState as useState5 } from "react";
|
|
11844
|
-
import { Box as
|
|
11911
|
+
import { Box as Box10, Text as Text11, useInput as useInput3 } from "ink";
|
|
11845
11912
|
import SelectInput2 from "ink-select-input";
|
|
11846
|
-
import { jsx as
|
|
11913
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
11847
11914
|
function ResumePicker({ sessions, onPick }) {
|
|
11848
11915
|
const theme = useTheme();
|
|
11849
11916
|
const [page, setPage] = useState5(0);
|
|
@@ -11884,10 +11951,10 @@ function ResumePicker({ sessions, onPick }) {
|
|
|
11884
11951
|
}
|
|
11885
11952
|
});
|
|
11886
11953
|
if (sessions.length === 0) {
|
|
11887
|
-
return /* @__PURE__ */
|
|
11888
|
-
/* @__PURE__ */
|
|
11889
|
-
/* @__PURE__ */
|
|
11890
|
-
/* @__PURE__ */
|
|
11954
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
11955
|
+
/* @__PURE__ */ jsx12(Text11, { color: theme.accent, bold: true, children: "Resume a session" }),
|
|
11956
|
+
/* @__PURE__ */ jsx12(Text11, { color: theme.info.color, children: "No saved sessions yet. Press Enter to dismiss." }),
|
|
11957
|
+
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(
|
|
11891
11958
|
SelectInput2,
|
|
11892
11959
|
{
|
|
11893
11960
|
items: [{ label: "(back)", value: "__cancel__" }],
|
|
@@ -11900,9 +11967,9 @@ function ResumePicker({ sessions, onPick }) {
|
|
|
11900
11967
|
label: `${formatDate(s.updatedAt)} \xB7 ${s.messageCount} msgs \xB7 ${s.title ?? s.firstPrompt}`,
|
|
11901
11968
|
value: s.id
|
|
11902
11969
|
}));
|
|
11903
|
-
return /* @__PURE__ */
|
|
11904
|
-
/* @__PURE__ */
|
|
11905
|
-
/* @__PURE__ */
|
|
11970
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
11971
|
+
/* @__PURE__ */ jsx12(Text11, { color: theme.accent, bold: true, children: "Resume a session" }),
|
|
11972
|
+
/* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
|
|
11906
11973
|
query ? `Search: ${query}\u258C` : "Type to search\u2026",
|
|
11907
11974
|
" \xB7 Page ",
|
|
11908
11975
|
safePage + 1,
|
|
@@ -11912,7 +11979,7 @@ function ResumePicker({ sessions, onPick }) {
|
|
|
11912
11979
|
filtered.length,
|
|
11913
11980
|
" total)"
|
|
11914
11981
|
] }),
|
|
11915
|
-
/* @__PURE__ */
|
|
11982
|
+
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(
|
|
11916
11983
|
SelectInput2,
|
|
11917
11984
|
{
|
|
11918
11985
|
items,
|
|
@@ -11927,7 +11994,7 @@ function ResumePicker({ sessions, onPick }) {
|
|
|
11927
11994
|
}
|
|
11928
11995
|
}
|
|
11929
11996
|
) }),
|
|
11930
|
-
/* @__PURE__ */
|
|
11997
|
+
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
|
|
11931
11998
|
safePage > 0 ? "\u2190 prev " : "",
|
|
11932
11999
|
safePage < totalPages - 1 ? "\u2192 next " : "",
|
|
11933
12000
|
"q: cancel"
|
|
@@ -11959,9 +12026,9 @@ var init_resume_picker = __esm({
|
|
|
11959
12026
|
|
|
11960
12027
|
// src/ui/checkpoint-picker.tsx
|
|
11961
12028
|
import { useState as useState6 } from "react";
|
|
11962
|
-
import { Box as
|
|
12029
|
+
import { Box as Box11, Text as Text12, useInput as useInput4 } from "ink";
|
|
11963
12030
|
import SelectInput3 from "ink-select-input";
|
|
11964
|
-
import { jsx as
|
|
12031
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
11965
12032
|
function CheckpointPicker({ session, checkpoints, onPick }) {
|
|
11966
12033
|
const theme = useTheme();
|
|
11967
12034
|
const [selectedIndex, setSelectedIndex] = useState6(0);
|
|
@@ -11981,16 +12048,16 @@ function CheckpointPicker({ session, checkpoints, onPick }) {
|
|
|
11981
12048
|
value: cp.id
|
|
11982
12049
|
}))
|
|
11983
12050
|
];
|
|
11984
|
-
return /* @__PURE__ */
|
|
11985
|
-
/* @__PURE__ */
|
|
11986
|
-
/* @__PURE__ */
|
|
12051
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12052
|
+
/* @__PURE__ */ jsx13(Text12, { color: theme.accent, bold: true, children: session.firstPrompt.slice(0, 50) }),
|
|
12053
|
+
/* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
|
|
11987
12054
|
session.messageCount,
|
|
11988
12055
|
" turns \xB7 ",
|
|
11989
12056
|
checkpoints.length,
|
|
11990
12057
|
" checkpoint",
|
|
11991
12058
|
checkpoints.length === 1 ? "" : "s"
|
|
11992
12059
|
] }),
|
|
11993
|
-
/* @__PURE__ */
|
|
12060
|
+
/* @__PURE__ */ jsx13(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx13(
|
|
11994
12061
|
SelectInput3,
|
|
11995
12062
|
{
|
|
11996
12063
|
items,
|
|
@@ -12008,7 +12075,7 @@ function CheckpointPicker({ session, checkpoints, onPick }) {
|
|
|
12008
12075
|
}
|
|
12009
12076
|
}
|
|
12010
12077
|
) }),
|
|
12011
|
-
/* @__PURE__ */
|
|
12078
|
+
/* @__PURE__ */ jsx13(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text12, { color: theme.info.color, children: "q: cancel / go back" }) })
|
|
12012
12079
|
] });
|
|
12013
12080
|
}
|
|
12014
12081
|
function formatDate2(iso) {
|
|
@@ -12033,9 +12100,9 @@ var init_checkpoint_picker = __esm({
|
|
|
12033
12100
|
|
|
12034
12101
|
// src/ui/task-list.tsx
|
|
12035
12102
|
import { useEffect as useEffect4, useRef as useRef2, useState as useState7 } from "react";
|
|
12036
|
-
import { Box as
|
|
12103
|
+
import { Box as Box12, Text as Text13 } from "ink";
|
|
12037
12104
|
import Spinner4 from "ink-spinner";
|
|
12038
|
-
import { jsx as
|
|
12105
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
12039
12106
|
function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
12040
12107
|
const theme = useTheme();
|
|
12041
12108
|
const [now2, setNow] = useState7(Date.now());
|
|
@@ -12073,18 +12140,18 @@ function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
|
12073
12140
|
const headerStats = [elapsed, tokensDelta > 0 ? `\u2191 ${formatTokens3(tokensDelta)} tokens` : null].filter(Boolean).join(" \xB7 ");
|
|
12074
12141
|
const visibleTasks = tasks.slice(0, MAX_VISIBLE);
|
|
12075
12142
|
const hiddenPending = Math.max(0, tasks.length - visibleTasks.length);
|
|
12076
|
-
return /* @__PURE__ */
|
|
12077
|
-
/* @__PURE__ */
|
|
12078
|
-
/* @__PURE__ */
|
|
12079
|
-
headerStats && /* @__PURE__ */
|
|
12143
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", marginBottom: 1, children: [
|
|
12144
|
+
/* @__PURE__ */ jsxs12(Box12, { children: [
|
|
12145
|
+
/* @__PURE__ */ jsx14(Text13, { color: celebrating ? theme.palette.success : allDone ? "green" : theme.accent, bold: true, children: celebrating ? `\u2728 ${header}` : header }),
|
|
12146
|
+
headerStats && /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
12080
12147
|
" ",
|
|
12081
12148
|
"(",
|
|
12082
12149
|
headerStats,
|
|
12083
12150
|
")"
|
|
12084
12151
|
] })
|
|
12085
12152
|
] }),
|
|
12086
|
-
visibleTasks.map((t) => /* @__PURE__ */
|
|
12087
|
-
hiddenPending > 0 && /* @__PURE__ */
|
|
12153
|
+
visibleTasks.map((t) => /* @__PURE__ */ jsx14(TaskRow, { task: t }, t.id)),
|
|
12154
|
+
hiddenPending > 0 && /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
12088
12155
|
" ",
|
|
12089
12156
|
"\u2026 +",
|
|
12090
12157
|
hiddenPending,
|
|
@@ -12095,21 +12162,21 @@ function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
|
12095
12162
|
function TaskRow({ task }) {
|
|
12096
12163
|
const theme = useTheme();
|
|
12097
12164
|
if (task.status === "completed") {
|
|
12098
|
-
return /* @__PURE__ */
|
|
12165
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
12099
12166
|
" ",
|
|
12100
12167
|
"\u2713 ",
|
|
12101
|
-
/* @__PURE__ */
|
|
12168
|
+
/* @__PURE__ */ jsx14(Text13, { strikethrough: true, children: task.title })
|
|
12102
12169
|
] });
|
|
12103
12170
|
}
|
|
12104
12171
|
if (task.status === "in_progress") {
|
|
12105
|
-
return /* @__PURE__ */
|
|
12172
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, bold: true, children: [
|
|
12106
12173
|
" ",
|
|
12107
|
-
/* @__PURE__ */
|
|
12174
|
+
/* @__PURE__ */ jsx14(Spinner4, { type: "line" }),
|
|
12108
12175
|
" ",
|
|
12109
12176
|
task.title
|
|
12110
12177
|
] });
|
|
12111
12178
|
}
|
|
12112
|
-
return /* @__PURE__ */
|
|
12179
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
12113
12180
|
" ",
|
|
12114
12181
|
"\u2610 ",
|
|
12115
12182
|
task.title
|
|
@@ -12137,12 +12204,12 @@ var init_task_list = __esm({
|
|
|
12137
12204
|
|
|
12138
12205
|
// src/ui/onboarding.tsx
|
|
12139
12206
|
import { useState as useState8, useEffect as useEffect5, useCallback as useCallback2 } from "react";
|
|
12140
|
-
import { Box as
|
|
12207
|
+
import { Box as Box13, Text as Text14, useInput as useInput5 } from "ink";
|
|
12141
12208
|
import SelectInput4 from "ink-select-input";
|
|
12142
12209
|
import Spinner5 from "ink-spinner";
|
|
12143
12210
|
import { exec } from "child_process";
|
|
12144
12211
|
import { promisify as promisify2 } from "util";
|
|
12145
|
-
import { Fragment, jsx as
|
|
12212
|
+
import { Fragment, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
12146
12213
|
function openBrowser(url) {
|
|
12147
12214
|
const platform4 = process.platform;
|
|
12148
12215
|
const cmd = platform4 === "darwin" ? `open "${url}"` : platform4 === "win32" ? `start "" "${url}"` : `xdg-open "${url}"`;
|
|
@@ -12298,24 +12365,24 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12298
12365
|
const byokSteps = ["accountId", "apiToken", "model", "confirm"];
|
|
12299
12366
|
const stepIndex = step === "mode" ? 1 : step === "cloudAuth" ? 2 : byokSteps.indexOf(step) + 2;
|
|
12300
12367
|
const totalSteps = mode === "cloud" ? 2 : byokSteps.length + 1;
|
|
12301
|
-
return /* @__PURE__ */
|
|
12302
|
-
/* @__PURE__ */
|
|
12303
|
-
/* @__PURE__ */
|
|
12304
|
-
/* @__PURE__ */
|
|
12368
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingY: 1, children: [
|
|
12369
|
+
/* @__PURE__ */ jsxs13(Box13, { marginBottom: 1, children: [
|
|
12370
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, color: theme.palette.primary, children: "kimiflare" }),
|
|
12371
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12305
12372
|
" ",
|
|
12306
12373
|
"Terminal coding agent"
|
|
12307
12374
|
] })
|
|
12308
12375
|
] }),
|
|
12309
|
-
/* @__PURE__ */
|
|
12376
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12310
12377
|
"Step ",
|
|
12311
12378
|
stepIndex,
|
|
12312
12379
|
" of ",
|
|
12313
12380
|
totalSteps
|
|
12314
12381
|
] }),
|
|
12315
|
-
/* @__PURE__ */
|
|
12316
|
-
step === "mode" && /* @__PURE__ */
|
|
12317
|
-
/* @__PURE__ */
|
|
12318
|
-
/* @__PURE__ */
|
|
12382
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
12383
|
+
step === "mode" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12384
|
+
/* @__PURE__ */ jsx15(Text14, { children: "How do you want to connect?" }),
|
|
12385
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
12319
12386
|
SelectInput4,
|
|
12320
12387
|
{
|
|
12321
12388
|
items: [
|
|
@@ -12326,19 +12393,19 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12326
12393
|
}
|
|
12327
12394
|
) })
|
|
12328
12395
|
] }),
|
|
12329
|
-
step === "cloudAuth" && cloudAuth?.phase === "ready" && /* @__PURE__ */
|
|
12330
|
-
/* @__PURE__ */
|
|
12331
|
-
/* @__PURE__ */
|
|
12332
|
-
/* @__PURE__ */
|
|
12333
|
-
/* @__PURE__ */
|
|
12396
|
+
step === "cloudAuth" && cloudAuth?.phase === "ready" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12397
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Authenticating with Kimiflare Cloud..." }),
|
|
12398
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
12399
|
+
/* @__PURE__ */ jsx15(Text14, { children: "1. Open this URL in your browser:" }),
|
|
12400
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: cloudAuth.codes.authUrl })
|
|
12334
12401
|
] }),
|
|
12335
|
-
/* @__PURE__ */
|
|
12336
|
-
/* @__PURE__ */
|
|
12337
|
-
/* @__PURE__ */
|
|
12402
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12403
|
+
/* @__PURE__ */ jsx15(Text14, { children: "2. " }),
|
|
12404
|
+
/* @__PURE__ */ jsx15(Text14, { bold: true, children: "[Press Enter to open browser]" })
|
|
12338
12405
|
] }),
|
|
12339
|
-
/* @__PURE__ */
|
|
12340
|
-
/* @__PURE__ */
|
|
12341
|
-
/* @__PURE__ */
|
|
12406
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12407
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12408
|
+
/* @__PURE__ */ jsx15(
|
|
12342
12409
|
CustomTextInput,
|
|
12343
12410
|
{
|
|
12344
12411
|
value: "",
|
|
@@ -12349,28 +12416,28 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12349
12416
|
)
|
|
12350
12417
|
] })
|
|
12351
12418
|
] }),
|
|
12352
|
-
step === "cloudAuth" && cloudAuth?.phase === "polling" && /* @__PURE__ */
|
|
12353
|
-
/* @__PURE__ */
|
|
12354
|
-
/* @__PURE__ */
|
|
12419
|
+
step === "cloudAuth" && cloudAuth?.phase === "polling" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12420
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
12421
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.spinner, children: /* @__PURE__ */ jsx15(Spinner5, { type: "dots" }) }),
|
|
12355
12422
|
" ",
|
|
12356
12423
|
"Waiting for authentication..."
|
|
12357
12424
|
] }),
|
|
12358
|
-
/* @__PURE__ */
|
|
12425
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12359
12426
|
"Expires in ",
|
|
12360
12427
|
formatRemaining(POLL_TIMEOUT_MS - (Date.now() - cloudAuth.startTime))
|
|
12361
12428
|
] }),
|
|
12362
|
-
/* @__PURE__ */
|
|
12429
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12363
12430
|
"URL: ",
|
|
12364
12431
|
cloudAuth.codes.authUrl
|
|
12365
12432
|
] })
|
|
12366
12433
|
] }),
|
|
12367
|
-
step === "cloudAuth" && cloudAuth?.phase === "success" && /* @__PURE__ */
|
|
12368
|
-
/* @__PURE__ */
|
|
12369
|
-
/* @__PURE__ */
|
|
12370
|
-
/* @__PURE__ */
|
|
12434
|
+
step === "cloudAuth" && cloudAuth?.phase === "success" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12435
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.success, children: "Authenticated!" }),
|
|
12436
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
12437
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
12371
12438
|
"Token budget:",
|
|
12372
12439
|
" ",
|
|
12373
|
-
/* @__PURE__ */
|
|
12440
|
+
/* @__PURE__ */ jsxs13(Text14, { bold: true, children: [
|
|
12374
12441
|
cloudAuth.usage.remaining.toLocaleString(),
|
|
12375
12442
|
" /",
|
|
12376
12443
|
" ",
|
|
@@ -12379,15 +12446,15 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12379
12446
|
" ",
|
|
12380
12447
|
"remaining"
|
|
12381
12448
|
] }),
|
|
12382
|
-
/* @__PURE__ */
|
|
12449
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12383
12450
|
"Grant expires: ",
|
|
12384
12451
|
cloudAuth.usage.expires_at
|
|
12385
12452
|
] })
|
|
12386
12453
|
] }),
|
|
12387
|
-
/* @__PURE__ */
|
|
12388
|
-
/* @__PURE__ */
|
|
12389
|
-
/* @__PURE__ */
|
|
12390
|
-
/* @__PURE__ */
|
|
12454
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text14, { children: "[Press Enter to continue]" }) }),
|
|
12455
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12456
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12457
|
+
/* @__PURE__ */ jsx15(
|
|
12391
12458
|
CustomTextInput,
|
|
12392
12459
|
{
|
|
12393
12460
|
value: "",
|
|
@@ -12398,10 +12465,10 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12398
12465
|
)
|
|
12399
12466
|
] })
|
|
12400
12467
|
] }),
|
|
12401
|
-
step === "cloudAuth" && cloudAuth?.phase === "error" && /* @__PURE__ */
|
|
12402
|
-
/* @__PURE__ */
|
|
12403
|
-
/* @__PURE__ */
|
|
12404
|
-
/* @__PURE__ */
|
|
12468
|
+
step === "cloudAuth" && cloudAuth?.phase === "error" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12469
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.error, children: "Authentication failed" }),
|
|
12470
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: cloudAuth.message }),
|
|
12471
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
12405
12472
|
SelectInput4,
|
|
12406
12473
|
{
|
|
12407
12474
|
items: [
|
|
@@ -12417,11 +12484,11 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12417
12484
|
}
|
|
12418
12485
|
) })
|
|
12419
12486
|
] }),
|
|
12420
|
-
step === "accountId" && /* @__PURE__ */
|
|
12421
|
-
/* @__PURE__ */
|
|
12422
|
-
/* @__PURE__ */
|
|
12423
|
-
/* @__PURE__ */
|
|
12424
|
-
/* @__PURE__ */
|
|
12487
|
+
step === "accountId" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12488
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Enter your Cloudflare Account ID" }),
|
|
12489
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12490
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12491
|
+
/* @__PURE__ */ jsx15(
|
|
12425
12492
|
CustomTextInput,
|
|
12426
12493
|
{
|
|
12427
12494
|
value: accountId,
|
|
@@ -12431,12 +12498,12 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12431
12498
|
)
|
|
12432
12499
|
] })
|
|
12433
12500
|
] }),
|
|
12434
|
-
step === "apiToken" && /* @__PURE__ */
|
|
12435
|
-
/* @__PURE__ */
|
|
12436
|
-
/* @__PURE__ */
|
|
12437
|
-
/* @__PURE__ */
|
|
12438
|
-
/* @__PURE__ */
|
|
12439
|
-
/* @__PURE__ */
|
|
12501
|
+
step === "apiToken" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12502
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Enter your Cloudflare API Token" }),
|
|
12503
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Create one at https://dash.cloudflare.com/profile/api-tokens" }),
|
|
12504
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12505
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12506
|
+
/* @__PURE__ */ jsx15(
|
|
12440
12507
|
CustomTextInput,
|
|
12441
12508
|
{
|
|
12442
12509
|
value: apiToken,
|
|
@@ -12447,15 +12514,15 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12447
12514
|
)
|
|
12448
12515
|
] })
|
|
12449
12516
|
] }),
|
|
12450
|
-
step === "model" && /* @__PURE__ */
|
|
12451
|
-
/* @__PURE__ */
|
|
12452
|
-
/* @__PURE__ */
|
|
12517
|
+
step === "model" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12518
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Model ID (press Enter for default)" }),
|
|
12519
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12453
12520
|
"default: ",
|
|
12454
12521
|
DEFAULT_MODEL
|
|
12455
12522
|
] }),
|
|
12456
|
-
/* @__PURE__ */
|
|
12457
|
-
/* @__PURE__ */
|
|
12458
|
-
/* @__PURE__ */
|
|
12523
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12524
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12525
|
+
/* @__PURE__ */ jsx15(
|
|
12459
12526
|
CustomTextInput,
|
|
12460
12527
|
{
|
|
12461
12528
|
value: model,
|
|
@@ -12465,10 +12532,10 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12465
12532
|
)
|
|
12466
12533
|
] })
|
|
12467
12534
|
] }),
|
|
12468
|
-
step === "confirm" && /* @__PURE__ */
|
|
12469
|
-
/* @__PURE__ */
|
|
12470
|
-
/* @__PURE__ */
|
|
12471
|
-
|
|
12535
|
+
step === "confirm" && /* @__PURE__ */ jsxs13(Fragment, { children: [
|
|
12536
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Ready to save configuration" }),
|
|
12537
|
+
/* @__PURE__ */ jsxs13(
|
|
12538
|
+
Box13,
|
|
12472
12539
|
{
|
|
12473
12540
|
flexDirection: "column",
|
|
12474
12541
|
marginTop: 1,
|
|
@@ -12477,25 +12544,25 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12477
12544
|
borderColor: theme.info.color,
|
|
12478
12545
|
paddingX: 1,
|
|
12479
12546
|
children: [
|
|
12480
|
-
/* @__PURE__ */
|
|
12547
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12481
12548
|
"Account ID: ",
|
|
12482
12549
|
accountId
|
|
12483
12550
|
] }),
|
|
12484
|
-
/* @__PURE__ */
|
|
12551
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12485
12552
|
"API Token: ",
|
|
12486
12553
|
"\u2022".repeat(apiToken.length)
|
|
12487
12554
|
] }),
|
|
12488
|
-
/* @__PURE__ */
|
|
12555
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
12489
12556
|
"Model: ",
|
|
12490
12557
|
model
|
|
12491
12558
|
] })
|
|
12492
12559
|
]
|
|
12493
12560
|
}
|
|
12494
12561
|
),
|
|
12495
|
-
/* @__PURE__ */
|
|
12496
|
-
/* @__PURE__ */
|
|
12497
|
-
/* @__PURE__ */
|
|
12498
|
-
/* @__PURE__ */
|
|
12562
|
+
/* @__PURE__ */ jsx15(Text14, { children: "Press Enter to confirm, or Ctrl+C to cancel" }),
|
|
12563
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
12564
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.palette.primary, children: "\u203A " }),
|
|
12565
|
+
/* @__PURE__ */ jsx15(
|
|
12499
12566
|
CustomTextInput,
|
|
12500
12567
|
{
|
|
12501
12568
|
value: "",
|
|
@@ -12506,7 +12573,7 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12506
12573
|
)
|
|
12507
12574
|
] })
|
|
12508
12575
|
] }),
|
|
12509
|
-
savedPath && /* @__PURE__ */
|
|
12576
|
+
savedPath && /* @__PURE__ */ jsxs13(Text14, { color: theme.palette.success, children: [
|
|
12510
12577
|
"Config saved to ",
|
|
12511
12578
|
savedPath
|
|
12512
12579
|
] })
|
|
@@ -12564,8 +12631,8 @@ var init_greetings = __esm({
|
|
|
12564
12631
|
});
|
|
12565
12632
|
|
|
12566
12633
|
// src/ui/welcome.tsx
|
|
12567
|
-
import { Box as
|
|
12568
|
-
import { jsx as
|
|
12634
|
+
import { Box as Box14, Text as Text15 } from "ink";
|
|
12635
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
12569
12636
|
function Welcome() {
|
|
12570
12637
|
const theme = useTheme();
|
|
12571
12638
|
const now2 = /* @__PURE__ */ new Date();
|
|
@@ -12573,9 +12640,9 @@ function Welcome() {
|
|
|
12573
12640
|
hour: now2.getHours(),
|
|
12574
12641
|
day: now2.getDay()
|
|
12575
12642
|
});
|
|
12576
|
-
return /* @__PURE__ */
|
|
12577
|
-
/* @__PURE__ */
|
|
12578
|
-
/* @__PURE__ */
|
|
12643
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", marginBottom: 1, children: [
|
|
12644
|
+
/* @__PURE__ */ jsx16(Box14, { marginBottom: 1, children: /* @__PURE__ */ jsx16(Text15, { bold: true, color: theme.accent, children: headline }) }),
|
|
12645
|
+
/* @__PURE__ */ jsx16(Box14, { flexDirection: "column", children: /* @__PURE__ */ jsx16(Text15, { color: theme.info.color, dimColor: true, children: "Type / for commands" }) })
|
|
12579
12646
|
] });
|
|
12580
12647
|
}
|
|
12581
12648
|
var init_welcome = __esm({
|
|
@@ -12683,9 +12750,9 @@ var init_worker_client = __esm({
|
|
|
12683
12750
|
|
|
12684
12751
|
// src/ui/remote-dashboard.tsx
|
|
12685
12752
|
import { useEffect as useEffect6, useState as useState9 } from "react";
|
|
12686
|
-
import { Box as
|
|
12753
|
+
import { Box as Box15, Text as Text16, useInput as useInput6 } from "ink";
|
|
12687
12754
|
import SelectInput5 from "ink-select-input";
|
|
12688
|
-
import { jsx as
|
|
12755
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
12689
12756
|
function RemoteDashboard({ onSelect, onCancel }) {
|
|
12690
12757
|
const theme = useTheme();
|
|
12691
12758
|
const [sessions, setSessions] = useState9([]);
|
|
@@ -12741,30 +12808,30 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
12741
12808
|
value: s.sessionId
|
|
12742
12809
|
}));
|
|
12743
12810
|
if (loading) {
|
|
12744
|
-
return /* @__PURE__ */
|
|
12811
|
+
return /* @__PURE__ */ jsx17(Box15, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.accent, children: "Loading remote sessions..." }) });
|
|
12745
12812
|
}
|
|
12746
12813
|
if (error) {
|
|
12747
|
-
return /* @__PURE__ */
|
|
12748
|
-
/* @__PURE__ */
|
|
12814
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
12815
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.error, children: [
|
|
12749
12816
|
"Error: ",
|
|
12750
12817
|
error
|
|
12751
12818
|
] }),
|
|
12752
|
-
/* @__PURE__ */
|
|
12819
|
+
/* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "Press R to retry, Esc to close" })
|
|
12753
12820
|
] });
|
|
12754
12821
|
}
|
|
12755
12822
|
if (sessions.length === 0) {
|
|
12756
|
-
return /* @__PURE__ */
|
|
12757
|
-
/* @__PURE__ */
|
|
12758
|
-
/* @__PURE__ */
|
|
12759
|
-
/* @__PURE__ */
|
|
12823
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
12824
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.accent, children: "No remote sessions yet." }),
|
|
12825
|
+
/* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "Type /remote <prompt> to start one." }),
|
|
12826
|
+
/* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "Press Esc to close" })
|
|
12760
12827
|
] });
|
|
12761
12828
|
}
|
|
12762
|
-
return /* @__PURE__ */
|
|
12763
|
-
/* @__PURE__ */
|
|
12829
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
12830
|
+
/* @__PURE__ */ jsxs15(Text16, { bold: true, color: theme.accent, children: [
|
|
12764
12831
|
"Recent remote tasks ",
|
|
12765
12832
|
refreshing ? "(refreshing...)" : ""
|
|
12766
12833
|
] }),
|
|
12767
|
-
/* @__PURE__ */
|
|
12834
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(
|
|
12768
12835
|
SelectInput5,
|
|
12769
12836
|
{
|
|
12770
12837
|
items,
|
|
@@ -12774,7 +12841,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
12774
12841
|
}
|
|
12775
12842
|
}
|
|
12776
12843
|
) }),
|
|
12777
|
-
/* @__PURE__ */
|
|
12844
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter select \u2022 R refresh \u2022 Esc close" }) })
|
|
12778
12845
|
] });
|
|
12779
12846
|
}
|
|
12780
12847
|
function formatSessionLine(s) {
|
|
@@ -12827,50 +12894,50 @@ function RemoteSessionDetail({
|
|
|
12827
12894
|
}
|
|
12828
12895
|
}
|
|
12829
12896
|
const isRunning = session.status === "running" || session.status === "pending";
|
|
12830
|
-
return /* @__PURE__ */
|
|
12831
|
-
/* @__PURE__ */
|
|
12832
|
-
/* @__PURE__ */
|
|
12833
|
-
/* @__PURE__ */
|
|
12897
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", padding: 1, children: [
|
|
12898
|
+
/* @__PURE__ */ jsx17(Text16, { bold: true, color: theme.accent, children: "Remote Session" }),
|
|
12899
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
|
|
12900
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12834
12901
|
"ID: ",
|
|
12835
12902
|
session.sessionId
|
|
12836
12903
|
] }),
|
|
12837
|
-
/* @__PURE__ */
|
|
12904
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12838
12905
|
"Repo: ",
|
|
12839
12906
|
session.repo
|
|
12840
12907
|
] }),
|
|
12841
|
-
/* @__PURE__ */
|
|
12908
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12842
12909
|
"Status: ",
|
|
12843
12910
|
session.status
|
|
12844
12911
|
] }),
|
|
12845
|
-
/* @__PURE__ */
|
|
12912
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12846
12913
|
"Prompt: ",
|
|
12847
12914
|
session.prompt
|
|
12848
12915
|
] }),
|
|
12849
|
-
session.prUrl && /* @__PURE__ */
|
|
12916
|
+
session.prUrl && /* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12850
12917
|
"PR: ",
|
|
12851
12918
|
session.prUrl
|
|
12852
12919
|
] }),
|
|
12853
|
-
session.errorMessage && /* @__PURE__ */
|
|
12920
|
+
session.errorMessage && /* @__PURE__ */ jsxs15(Text16, { color: theme.error, children: [
|
|
12854
12921
|
"Error: ",
|
|
12855
12922
|
session.errorMessage
|
|
12856
12923
|
] }),
|
|
12857
|
-
session.tokensUsed !== void 0 && /* @__PURE__ */
|
|
12924
|
+
session.tokensUsed !== void 0 && /* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12858
12925
|
"Tokens: ",
|
|
12859
12926
|
formatTokens4(session.tokensUsed),
|
|
12860
12927
|
session.tokensBudget ? ` / ${formatTokens4(session.tokensBudget)}` : ""
|
|
12861
12928
|
] }),
|
|
12862
|
-
/* @__PURE__ */
|
|
12929
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12863
12930
|
"Created: ",
|
|
12864
12931
|
new Date(session.createdAt).toLocaleString()
|
|
12865
12932
|
] }),
|
|
12866
|
-
session.finishedAt && /* @__PURE__ */
|
|
12933
|
+
session.finishedAt && /* @__PURE__ */ jsxs15(Text16, { children: [
|
|
12867
12934
|
"Finished: ",
|
|
12868
12935
|
new Date(session.finishedAt).toLocaleString()
|
|
12869
12936
|
] })
|
|
12870
12937
|
] }),
|
|
12871
|
-
/* @__PURE__ */
|
|
12872
|
-
isRunning && onCancel && /* @__PURE__ */
|
|
12873
|
-
/* @__PURE__ */
|
|
12938
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "row", gap: 2, children: [
|
|
12939
|
+
isRunning && onCancel && /* @__PURE__ */ jsx17(Text16, { color: theme.error, children: cancelling ? "Cancelling..." : "[C] Cancel session" }),
|
|
12940
|
+
/* @__PURE__ */ jsx17(Text16, { dimColor: true, children: "Esc back" })
|
|
12874
12941
|
] })
|
|
12875
12942
|
] });
|
|
12876
12943
|
}
|
|
@@ -13705,9 +13772,9 @@ var init_save = __esm({
|
|
|
13705
13772
|
|
|
13706
13773
|
// src/ui/command-wizard.tsx
|
|
13707
13774
|
import { useState as useState10 } from "react";
|
|
13708
|
-
import { Box as
|
|
13775
|
+
import { Box as Box16, Text as Text17, useInput as useInput7, useWindowSize } from "ink";
|
|
13709
13776
|
import SelectInput6 from "ink-select-input";
|
|
13710
|
-
import { Fragment as Fragment2, jsx as
|
|
13777
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
13711
13778
|
function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onSave }) {
|
|
13712
13779
|
const theme = useTheme();
|
|
13713
13780
|
const [step, setStep] = useState10("name");
|
|
@@ -13831,8 +13898,8 @@ ${template}`;
|
|
|
13831
13898
|
const renderStep = () => {
|
|
13832
13899
|
switch (step) {
|
|
13833
13900
|
case "name":
|
|
13834
|
-
return /* @__PURE__ */
|
|
13835
|
-
/* @__PURE__ */
|
|
13901
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
13902
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13836
13903
|
mode === "create" ? "Create" : "Edit",
|
|
13837
13904
|
" custom command \u2014 Name (",
|
|
13838
13905
|
stepIndex,
|
|
@@ -13840,8 +13907,8 @@ ${template}`;
|
|
|
13840
13907
|
totalSteps,
|
|
13841
13908
|
")"
|
|
13842
13909
|
] }),
|
|
13843
|
-
error && /* @__PURE__ */
|
|
13844
|
-
/* @__PURE__ */
|
|
13910
|
+
error && /* @__PURE__ */ jsx18(Text17, { color: theme.error, children: error }),
|
|
13911
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13845
13912
|
CustomTextInput,
|
|
13846
13913
|
{
|
|
13847
13914
|
value: name,
|
|
@@ -13850,11 +13917,11 @@ ${template}`;
|
|
|
13850
13917
|
focus: true
|
|
13851
13918
|
}
|
|
13852
13919
|
) }),
|
|
13853
|
-
/* @__PURE__ */
|
|
13920
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "letters, numbers, _ - / only; must start with a letter" })
|
|
13854
13921
|
] });
|
|
13855
13922
|
case "description":
|
|
13856
|
-
return /* @__PURE__ */
|
|
13857
|
-
/* @__PURE__ */
|
|
13923
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
13924
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13858
13925
|
mode === "create" ? "Create" : "Edit",
|
|
13859
13926
|
" custom command \u2014 Description (",
|
|
13860
13927
|
stepIndex,
|
|
@@ -13862,7 +13929,7 @@ ${template}`;
|
|
|
13862
13929
|
totalSteps,
|
|
13863
13930
|
")"
|
|
13864
13931
|
] }),
|
|
13865
|
-
/* @__PURE__ */
|
|
13932
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13866
13933
|
CustomTextInput,
|
|
13867
13934
|
{
|
|
13868
13935
|
value: description,
|
|
@@ -13871,49 +13938,49 @@ ${template}`;
|
|
|
13871
13938
|
focus: true
|
|
13872
13939
|
}
|
|
13873
13940
|
) }),
|
|
13874
|
-
/* @__PURE__ */
|
|
13941
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Press Enter to skip" })
|
|
13875
13942
|
] });
|
|
13876
13943
|
case "template": {
|
|
13877
|
-
const guide = /* @__PURE__ */
|
|
13878
|
-
/* @__PURE__ */
|
|
13879
|
-
/* @__PURE__ */
|
|
13880
|
-
/* @__PURE__ */
|
|
13944
|
+
const guide = /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", paddingLeft: 1, children: [
|
|
13945
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "What is this?" }),
|
|
13946
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "A prompt template \u2014 instructions to the AI." }),
|
|
13947
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13881
13948
|
"When you type /",
|
|
13882
13949
|
name || "yourcommand",
|
|
13883
13950
|
" later, this gets sent to the model."
|
|
13884
13951
|
] }),
|
|
13885
|
-
/* @__PURE__ */
|
|
13886
|
-
/* @__PURE__ */
|
|
13887
|
-
/* @__PURE__ */
|
|
13952
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
13953
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Variables" }),
|
|
13954
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13888
13955
|
" ",
|
|
13889
13956
|
"$1, $2 ... \u2192 arguments you type"
|
|
13890
13957
|
] }),
|
|
13891
|
-
/* @__PURE__ */
|
|
13958
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13892
13959
|
" ",
|
|
13893
13960
|
"$ARGUMENTS \u2192 everything after the command"
|
|
13894
13961
|
] })
|
|
13895
13962
|
] }),
|
|
13896
|
-
/* @__PURE__ */
|
|
13897
|
-
/* @__PURE__ */
|
|
13898
|
-
/* @__PURE__ */
|
|
13963
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
13964
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Dynamic inlines" }),
|
|
13965
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13899
13966
|
" ",
|
|
13900
13967
|
"!`git diff` \u2192 shell output inlined"
|
|
13901
13968
|
] }),
|
|
13902
|
-
/* @__PURE__ */
|
|
13969
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
13903
13970
|
" ",
|
|
13904
13971
|
"@README.md \u2192 file contents inlined"
|
|
13905
13972
|
] })
|
|
13906
13973
|
] }),
|
|
13907
|
-
/* @__PURE__ */
|
|
13908
|
-
/* @__PURE__ */
|
|
13909
|
-
/* @__PURE__ */
|
|
13910
|
-
/* @__PURE__ */
|
|
13911
|
-
/* @__PURE__ */
|
|
13974
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
13975
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Example" }),
|
|
13976
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Review this PR diff:" }),
|
|
13977
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "!`git diff main...HEAD`" }),
|
|
13978
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Focus on: $1" })
|
|
13912
13979
|
] })
|
|
13913
13980
|
] });
|
|
13914
|
-
const inputArea = /* @__PURE__ */
|
|
13915
|
-
error && /* @__PURE__ */
|
|
13916
|
-
/* @__PURE__ */
|
|
13981
|
+
const inputArea = /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", flexGrow: 1, children: [
|
|
13982
|
+
error && /* @__PURE__ */ jsx18(Text17, { color: theme.error, children: error }),
|
|
13983
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13917
13984
|
CustomTextInput,
|
|
13918
13985
|
{
|
|
13919
13986
|
value: template,
|
|
@@ -13923,13 +13990,13 @@ ${template}`;
|
|
|
13923
13990
|
enablePaste: true
|
|
13924
13991
|
}
|
|
13925
13992
|
) }),
|
|
13926
|
-
columns < 100 && /* @__PURE__ */
|
|
13927
|
-
/* @__PURE__ */
|
|
13928
|
-
/* @__PURE__ */
|
|
13993
|
+
columns < 100 && /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
13994
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Paste multi-line templates with Ctrl+V." }),
|
|
13995
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Variables: $1 $2 ... $ARGUMENTS Shell: !`cmd` File: @path" })
|
|
13929
13996
|
] })
|
|
13930
13997
|
] });
|
|
13931
|
-
return /* @__PURE__ */
|
|
13932
|
-
/* @__PURE__ */
|
|
13998
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
13999
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13933
14000
|
mode === "create" ? "Create" : "Edit",
|
|
13934
14001
|
" custom command \u2014 Template (",
|
|
13935
14002
|
stepIndex,
|
|
@@ -13937,10 +14004,10 @@ ${template}`;
|
|
|
13937
14004
|
totalSteps,
|
|
13938
14005
|
")"
|
|
13939
14006
|
] }),
|
|
13940
|
-
columns >= 100 ? /* @__PURE__ */
|
|
13941
|
-
/* @__PURE__ */
|
|
13942
|
-
/* @__PURE__ */
|
|
13943
|
-
] }) : /* @__PURE__ */
|
|
14007
|
+
columns >= 100 ? /* @__PURE__ */ jsxs16(Box16, { flexDirection: "row", marginTop: 1, children: [
|
|
14008
|
+
/* @__PURE__ */ jsx18(Box16, { flexDirection: "column", width: "50%", children: inputArea }),
|
|
14009
|
+
/* @__PURE__ */ jsx18(Box16, { flexDirection: "column", width: "50%", children: guide })
|
|
14010
|
+
] }) : /* @__PURE__ */ jsx18(Box16, { flexDirection: "column", marginTop: 1, children: inputArea })
|
|
13944
14011
|
] });
|
|
13945
14012
|
}
|
|
13946
14013
|
case "advanced": {
|
|
@@ -13949,8 +14016,8 @@ ${template}`;
|
|
|
13949
14016
|
{ label: "Skip", value: "skip", key: "skip" },
|
|
13950
14017
|
{ label: "\u2190 Cancel", value: "cancel", key: "cancel" }
|
|
13951
14018
|
];
|
|
13952
|
-
return /* @__PURE__ */
|
|
13953
|
-
/* @__PURE__ */
|
|
14019
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14020
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13954
14021
|
mode === "create" ? "Create" : "Edit",
|
|
13955
14022
|
" custom command \u2014 Options (",
|
|
13956
14023
|
stepIndex,
|
|
@@ -13958,7 +14025,7 @@ ${template}`;
|
|
|
13958
14025
|
totalSteps,
|
|
13959
14026
|
")"
|
|
13960
14027
|
] }),
|
|
13961
|
-
/* @__PURE__ */
|
|
14028
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13962
14029
|
SelectInput6,
|
|
13963
14030
|
{
|
|
13964
14031
|
items,
|
|
@@ -13978,16 +14045,16 @@ ${template}`;
|
|
|
13978
14045
|
{ label: cmdMode === "auto" ? "auto \xB7 current" : "auto", value: "auto", key: "auto" },
|
|
13979
14046
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
13980
14047
|
];
|
|
13981
|
-
return /* @__PURE__ */
|
|
13982
|
-
/* @__PURE__ */
|
|
14048
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14049
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
13983
14050
|
"Mode override (",
|
|
13984
14051
|
stepIndex,
|
|
13985
14052
|
"/",
|
|
13986
14053
|
totalSteps,
|
|
13987
14054
|
")"
|
|
13988
14055
|
] }),
|
|
13989
|
-
/* @__PURE__ */
|
|
13990
|
-
/* @__PURE__ */
|
|
14056
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Saved to file but not yet enforced at runtime" }),
|
|
14057
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13991
14058
|
SelectInput6,
|
|
13992
14059
|
{
|
|
13993
14060
|
items,
|
|
@@ -14007,15 +14074,15 @@ ${template}`;
|
|
|
14007
14074
|
{ label: cmdEffort === "high" ? "high \xB7 current" : "high", value: "high", key: "high" },
|
|
14008
14075
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14009
14076
|
];
|
|
14010
|
-
return /* @__PURE__ */
|
|
14011
|
-
/* @__PURE__ */
|
|
14077
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14078
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14012
14079
|
"Reasoning effort (",
|
|
14013
14080
|
stepIndex,
|
|
14014
14081
|
"/",
|
|
14015
14082
|
totalSteps,
|
|
14016
14083
|
")"
|
|
14017
14084
|
] }),
|
|
14018
|
-
/* @__PURE__ */
|
|
14085
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14019
14086
|
SelectInput6,
|
|
14020
14087
|
{
|
|
14021
14088
|
items,
|
|
@@ -14028,15 +14095,15 @@ ${template}`;
|
|
|
14028
14095
|
] });
|
|
14029
14096
|
}
|
|
14030
14097
|
case "model":
|
|
14031
|
-
return /* @__PURE__ */
|
|
14032
|
-
/* @__PURE__ */
|
|
14098
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14099
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14033
14100
|
"Model override (",
|
|
14034
14101
|
stepIndex,
|
|
14035
14102
|
"/",
|
|
14036
14103
|
totalSteps,
|
|
14037
14104
|
")"
|
|
14038
14105
|
] }),
|
|
14039
|
-
/* @__PURE__ */
|
|
14106
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14040
14107
|
CustomTextInput,
|
|
14041
14108
|
{
|
|
14042
14109
|
value: cmdModel ?? "",
|
|
@@ -14045,7 +14112,7 @@ ${template}`;
|
|
|
14045
14112
|
focus: true
|
|
14046
14113
|
}
|
|
14047
14114
|
) }),
|
|
14048
|
-
/* @__PURE__ */
|
|
14115
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Press Enter to skip" })
|
|
14049
14116
|
] });
|
|
14050
14117
|
case "location": {
|
|
14051
14118
|
const items = [
|
|
@@ -14053,15 +14120,15 @@ ${template}`;
|
|
|
14053
14120
|
{ label: source === "global" ? "Global \xB7 current" : "Global", value: "global", key: "global" },
|
|
14054
14121
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14055
14122
|
];
|
|
14056
|
-
return /* @__PURE__ */
|
|
14057
|
-
/* @__PURE__ */
|
|
14123
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14124
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14058
14125
|
"Save location (",
|
|
14059
14126
|
stepIndex,
|
|
14060
14127
|
"/",
|
|
14061
14128
|
totalSteps,
|
|
14062
14129
|
")"
|
|
14063
14130
|
] }),
|
|
14064
|
-
/* @__PURE__ */
|
|
14131
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14065
14132
|
SelectInput6,
|
|
14066
14133
|
{
|
|
14067
14134
|
items,
|
|
@@ -14071,7 +14138,7 @@ ${template}`;
|
|
|
14071
14138
|
}
|
|
14072
14139
|
}
|
|
14073
14140
|
) }),
|
|
14074
|
-
/* @__PURE__ */
|
|
14141
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "Project: .kimiflare/commands/ Global: ~/.config/kimiflare/commands/" })
|
|
14075
14142
|
] });
|
|
14076
14143
|
}
|
|
14077
14144
|
case "confirm": {
|
|
@@ -14079,8 +14146,8 @@ ${template}`;
|
|
|
14079
14146
|
{ label: "Save", value: "save", key: "save" },
|
|
14080
14147
|
{ label: "Cancel", value: "cancel", key: "cancel" }
|
|
14081
14148
|
];
|
|
14082
|
-
return /* @__PURE__ */
|
|
14083
|
-
/* @__PURE__ */
|
|
14149
|
+
return /* @__PURE__ */ jsxs16(Fragment2, { children: [
|
|
14150
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
14084
14151
|
mode === "create" ? "Create" : "Edit",
|
|
14085
14152
|
" custom command \u2014 Confirm (",
|
|
14086
14153
|
stepIndex,
|
|
@@ -14088,13 +14155,13 @@ ${template}`;
|
|
|
14088
14155
|
totalSteps,
|
|
14089
14156
|
")"
|
|
14090
14157
|
] }),
|
|
14091
|
-
/* @__PURE__ */
|
|
14158
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
14092
14159
|
source === "project" ? ".kimiflare/commands/" : "~/.config/kimiflare/commands/",
|
|
14093
14160
|
name,
|
|
14094
14161
|
".md"
|
|
14095
14162
|
] }),
|
|
14096
|
-
/* @__PURE__ */
|
|
14097
|
-
/* @__PURE__ */
|
|
14163
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, flexDirection: "column", children: previewContent().split("\n").map((line, i) => /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: line || " " }, i)) }),
|
|
14164
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
14098
14165
|
SelectInput6,
|
|
14099
14166
|
{
|
|
14100
14167
|
items,
|
|
@@ -14105,7 +14172,7 @@ ${template}`;
|
|
|
14105
14172
|
}
|
|
14106
14173
|
}
|
|
14107
14174
|
};
|
|
14108
|
-
return /* @__PURE__ */
|
|
14175
|
+
return /* @__PURE__ */ jsx18(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: renderStep() });
|
|
14109
14176
|
}
|
|
14110
14177
|
var NAME_RE;
|
|
14111
14178
|
var init_command_wizard = __esm({
|
|
@@ -14550,9 +14617,9 @@ var init_context_generator = __esm({
|
|
|
14550
14617
|
});
|
|
14551
14618
|
|
|
14552
14619
|
// src/ui/command-picker.tsx
|
|
14553
|
-
import { Box as
|
|
14620
|
+
import { Box as Box17, Text as Text18 } from "ink";
|
|
14554
14621
|
import SelectInput7 from "ink-select-input";
|
|
14555
|
-
import { jsx as
|
|
14622
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
14556
14623
|
function CommandPicker({ commands, title, onPick }) {
|
|
14557
14624
|
const theme = useTheme();
|
|
14558
14625
|
const items = commands.map((cmd) => ({
|
|
@@ -14561,10 +14628,10 @@ function CommandPicker({ commands, title, onPick }) {
|
|
|
14561
14628
|
key: cmd.name
|
|
14562
14629
|
}));
|
|
14563
14630
|
items.push({ label: "\u2190 Cancel", value: null, key: "__cancel__" });
|
|
14564
|
-
return /* @__PURE__ */
|
|
14565
|
-
/* @__PURE__ */
|
|
14566
|
-
/* @__PURE__ */
|
|
14567
|
-
/* @__PURE__ */
|
|
14631
|
+
return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14632
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.accent, bold: true, children: title }),
|
|
14633
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
14634
|
+
/* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
|
|
14568
14635
|
SelectInput7,
|
|
14569
14636
|
{
|
|
14570
14637
|
items,
|
|
@@ -14587,8 +14654,8 @@ var init_command_picker = __esm({
|
|
|
14587
14654
|
});
|
|
14588
14655
|
|
|
14589
14656
|
// src/ui/command-list.tsx
|
|
14590
|
-
import { Box as
|
|
14591
|
-
import { jsx as
|
|
14657
|
+
import { Box as Box18, Text as Text19, useInput as useInput8 } from "ink";
|
|
14658
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
14592
14659
|
function CommandList({ commands, onDone }) {
|
|
14593
14660
|
const theme = useTheme();
|
|
14594
14661
|
useInput8((_input, key) => {
|
|
@@ -14596,55 +14663,55 @@ function CommandList({ commands, onDone }) {
|
|
|
14596
14663
|
onDone();
|
|
14597
14664
|
}
|
|
14598
14665
|
});
|
|
14599
|
-
return /* @__PURE__ */
|
|
14600
|
-
/* @__PURE__ */
|
|
14601
|
-
/* @__PURE__ */
|
|
14602
|
-
/* @__PURE__ */
|
|
14603
|
-
commands.length === 0 && /* @__PURE__ */
|
|
14604
|
-
commands.map((cmd) => /* @__PURE__ */
|
|
14605
|
-
/* @__PURE__ */
|
|
14666
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14667
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.accent, bold: true, children: "Custom commands" }),
|
|
14668
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, dimColor: false, children: "Esc to close." }),
|
|
14669
|
+
/* @__PURE__ */ jsxs18(Box18, { marginTop: 1, flexDirection: "column", children: [
|
|
14670
|
+
commands.length === 0 && /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "No custom commands found." }),
|
|
14671
|
+
commands.map((cmd) => /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", marginBottom: 1, children: [
|
|
14672
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14606
14673
|
"/",
|
|
14607
14674
|
cmd.name
|
|
14608
14675
|
] }),
|
|
14609
|
-
/* @__PURE__ */
|
|
14676
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14610
14677
|
" ",
|
|
14611
14678
|
"source: ",
|
|
14612
14679
|
cmd.source
|
|
14613
14680
|
] }),
|
|
14614
|
-
/* @__PURE__ */
|
|
14681
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14615
14682
|
" ",
|
|
14616
14683
|
"path: ",
|
|
14617
14684
|
cmd.filepath
|
|
14618
14685
|
] }),
|
|
14619
|
-
cmd.description && /* @__PURE__ */
|
|
14686
|
+
cmd.description && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14620
14687
|
" ",
|
|
14621
14688
|
"desc: ",
|
|
14622
14689
|
cmd.description
|
|
14623
14690
|
] }),
|
|
14624
|
-
cmd.mode && /* @__PURE__ */
|
|
14691
|
+
cmd.mode && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14625
14692
|
" ",
|
|
14626
14693
|
"mode: ",
|
|
14627
14694
|
cmd.mode
|
|
14628
14695
|
] }),
|
|
14629
|
-
cmd.effort && /* @__PURE__ */
|
|
14696
|
+
cmd.effort && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14630
14697
|
" ",
|
|
14631
14698
|
"effort: ",
|
|
14632
14699
|
cmd.effort
|
|
14633
14700
|
] }),
|
|
14634
|
-
cmd.model && /* @__PURE__ */
|
|
14701
|
+
cmd.model && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14635
14702
|
" ",
|
|
14636
14703
|
"model: ",
|
|
14637
14704
|
cmd.model
|
|
14638
14705
|
] }),
|
|
14639
|
-
/* @__PURE__ */
|
|
14706
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14640
14707
|
" ",
|
|
14641
14708
|
"template:"
|
|
14642
14709
|
] }),
|
|
14643
|
-
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */
|
|
14710
|
+
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14644
14711
|
" ",
|
|
14645
14712
|
line || " "
|
|
14646
14713
|
] }, i)),
|
|
14647
|
-
cmd.template.split("\n").length > 5 && /* @__PURE__ */
|
|
14714
|
+
cmd.template.split("\n").length > 5 && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14648
14715
|
" ",
|
|
14649
14716
|
"..."
|
|
14650
14717
|
] })
|
|
@@ -14661,10 +14728,10 @@ var init_command_list = __esm({
|
|
|
14661
14728
|
|
|
14662
14729
|
// src/ui/lsp-wizard.tsx
|
|
14663
14730
|
import { useState as useState11 } from "react";
|
|
14664
|
-
import { Box as
|
|
14731
|
+
import { Box as Box19, Text as Text20 } from "ink";
|
|
14665
14732
|
import SelectInput8 from "ink-select-input";
|
|
14666
14733
|
import { spawn as spawn3 } from "child_process";
|
|
14667
|
-
import { jsx as
|
|
14734
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
14668
14735
|
function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
14669
14736
|
const theme = useTheme();
|
|
14670
14737
|
const [page, setPage] = useState11("main");
|
|
@@ -14775,10 +14842,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14775
14842
|
{ label: "(close)", value: "__close__", key: "__close__" }
|
|
14776
14843
|
];
|
|
14777
14844
|
if (page === "main") {
|
|
14778
|
-
return /* @__PURE__ */
|
|
14779
|
-
/* @__PURE__ */
|
|
14780
|
-
/* @__PURE__ */
|
|
14781
|
-
/* @__PURE__ */
|
|
14845
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14846
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "LSP Servers" }),
|
|
14847
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
14848
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14782
14849
|
SelectInput8,
|
|
14783
14850
|
{
|
|
14784
14851
|
items: mainItems,
|
|
@@ -14806,10 +14873,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14806
14873
|
}),
|
|
14807
14874
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14808
14875
|
];
|
|
14809
|
-
return /* @__PURE__ */
|
|
14810
|
-
/* @__PURE__ */
|
|
14811
|
-
/* @__PURE__ */
|
|
14812
|
-
/* @__PURE__ */
|
|
14876
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14877
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Add LSP Server" }),
|
|
14878
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Select a language server to configure." }),
|
|
14879
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14813
14880
|
SelectInput8,
|
|
14814
14881
|
{
|
|
14815
14882
|
items,
|
|
@@ -14837,18 +14904,18 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14837
14904
|
{ label: isSuccess ? "Save to config \u2713" : "Save anyway", value: "save", key: "save" },
|
|
14838
14905
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14839
14906
|
];
|
|
14840
|
-
return /* @__PURE__ */
|
|
14841
|
-
/* @__PURE__ */
|
|
14907
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14908
|
+
/* @__PURE__ */ jsxs19(Text20, { color: theme.accent, bold: true, children: [
|
|
14842
14909
|
"Install ",
|
|
14843
14910
|
selectedPreset.name
|
|
14844
14911
|
] }),
|
|
14845
|
-
/* @__PURE__ */
|
|
14846
|
-
/* @__PURE__ */
|
|
14847
|
-
/* @__PURE__ */
|
|
14848
|
-
/* @__PURE__ */
|
|
14912
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: selectedPreset.installHint }),
|
|
14913
|
+
/* @__PURE__ */ jsxs19(Box19, { marginTop: 1, flexDirection: "column", children: [
|
|
14914
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Command:" }),
|
|
14915
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, children: selectedPreset.installCommand || "(none required)" })
|
|
14849
14916
|
] }),
|
|
14850
|
-
installState.output && /* @__PURE__ */
|
|
14851
|
-
/* @__PURE__ */
|
|
14917
|
+
installState.output && /* @__PURE__ */ jsx21(Box19, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx21(Text20, { color: isSuccess ? theme.accent : theme.error, children: installState.output.slice(-500) }) }),
|
|
14918
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14852
14919
|
SelectInput8,
|
|
14853
14920
|
{
|
|
14854
14921
|
items,
|
|
@@ -14866,16 +14933,16 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14866
14933
|
}
|
|
14867
14934
|
}
|
|
14868
14935
|
) }),
|
|
14869
|
-
isSuccess && /* @__PURE__ */
|
|
14936
|
+
isSuccess && /* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(Text20, { color: theme.accent, children: "Server saved. Run /lsp reload to start it." }) })
|
|
14870
14937
|
] });
|
|
14871
14938
|
}
|
|
14872
14939
|
if (page === "custom-name") {
|
|
14873
|
-
return /* @__PURE__ */
|
|
14874
|
-
/* @__PURE__ */
|
|
14875
|
-
/* @__PURE__ */
|
|
14876
|
-
/* @__PURE__ */
|
|
14877
|
-
/* @__PURE__ */
|
|
14878
|
-
/* @__PURE__ */
|
|
14940
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14941
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Name" }),
|
|
14942
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Enter a name for this server (e.g., my-server)." }),
|
|
14943
|
+
/* @__PURE__ */ jsxs19(Box19, { marginTop: 1, children: [
|
|
14944
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, children: "\u203A " }),
|
|
14945
|
+
/* @__PURE__ */ jsx21(
|
|
14879
14946
|
CustomTextInput,
|
|
14880
14947
|
{
|
|
14881
14948
|
value: customName,
|
|
@@ -14889,7 +14956,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14889
14956
|
}
|
|
14890
14957
|
)
|
|
14891
14958
|
] }),
|
|
14892
|
-
/* @__PURE__ */
|
|
14959
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14893
14960
|
SelectInput8,
|
|
14894
14961
|
{
|
|
14895
14962
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -14899,12 +14966,12 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14899
14966
|
] });
|
|
14900
14967
|
}
|
|
14901
14968
|
if (page === "custom-command") {
|
|
14902
|
-
return /* @__PURE__ */
|
|
14903
|
-
/* @__PURE__ */
|
|
14904
|
-
/* @__PURE__ */
|
|
14905
|
-
/* @__PURE__ */
|
|
14906
|
-
/* @__PURE__ */
|
|
14907
|
-
/* @__PURE__ */
|
|
14969
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14970
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Command" }),
|
|
14971
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Enter the command to start the server (space-separated)." }),
|
|
14972
|
+
/* @__PURE__ */ jsxs19(Box19, { marginTop: 1, children: [
|
|
14973
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, children: "\u203A " }),
|
|
14974
|
+
/* @__PURE__ */ jsx21(
|
|
14908
14975
|
CustomTextInput,
|
|
14909
14976
|
{
|
|
14910
14977
|
value: customCommand,
|
|
@@ -14918,7 +14985,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14918
14985
|
}
|
|
14919
14986
|
)
|
|
14920
14987
|
] }),
|
|
14921
|
-
/* @__PURE__ */
|
|
14988
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14922
14989
|
SelectInput8,
|
|
14923
14990
|
{
|
|
14924
14991
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -14942,10 +15009,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14942
15009
|
},
|
|
14943
15010
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14944
15011
|
];
|
|
14945
|
-
return /* @__PURE__ */
|
|
14946
|
-
/* @__PURE__ */
|
|
14947
|
-
/* @__PURE__ */
|
|
14948
|
-
/* @__PURE__ */
|
|
15012
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15013
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Save LSP Config" }),
|
|
15014
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Where should this server configuration be saved?" }),
|
|
15015
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14949
15016
|
SelectInput8,
|
|
14950
15017
|
{
|
|
14951
15018
|
items,
|
|
@@ -14964,10 +15031,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14964
15031
|
if (page === "edit") {
|
|
14965
15032
|
const keys = Object.keys(servers);
|
|
14966
15033
|
if (keys.length === 0) {
|
|
14967
|
-
return /* @__PURE__ */
|
|
14968
|
-
/* @__PURE__ */
|
|
14969
|
-
/* @__PURE__ */
|
|
14970
|
-
/* @__PURE__ */
|
|
15034
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15035
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
15036
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No servers configured." }),
|
|
15037
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14971
15038
|
SelectInput8,
|
|
14972
15039
|
{
|
|
14973
15040
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -14988,10 +15055,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
14988
15055
|
}),
|
|
14989
15056
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14990
15057
|
];
|
|
14991
|
-
return /* @__PURE__ */
|
|
14992
|
-
/* @__PURE__ */
|
|
14993
|
-
/* @__PURE__ */
|
|
14994
|
-
/* @__PURE__ */
|
|
15058
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15059
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
15060
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Select a server to toggle enabled/disabled." }),
|
|
15061
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
14995
15062
|
SelectInput8,
|
|
14996
15063
|
{
|
|
14997
15064
|
items,
|
|
@@ -15009,10 +15076,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15009
15076
|
if (page === "delete") {
|
|
15010
15077
|
const keys = Object.keys(servers);
|
|
15011
15078
|
if (keys.length === 0) {
|
|
15012
|
-
return /* @__PURE__ */
|
|
15013
|
-
/* @__PURE__ */
|
|
15014
|
-
/* @__PURE__ */
|
|
15015
|
-
/* @__PURE__ */
|
|
15079
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15080
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
15081
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No servers configured." }),
|
|
15082
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15016
15083
|
SelectInput8,
|
|
15017
15084
|
{
|
|
15018
15085
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -15029,10 +15096,10 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15029
15096
|
})),
|
|
15030
15097
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
15031
15098
|
];
|
|
15032
|
-
return /* @__PURE__ */
|
|
15033
|
-
/* @__PURE__ */
|
|
15034
|
-
/* @__PURE__ */
|
|
15035
|
-
/* @__PURE__ */
|
|
15099
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15100
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
15101
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Select a server to remove from config." }),
|
|
15102
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15036
15103
|
SelectInput8,
|
|
15037
15104
|
{
|
|
15038
15105
|
items,
|
|
@@ -15049,14 +15116,14 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15049
15116
|
}
|
|
15050
15117
|
if (page === "list") {
|
|
15051
15118
|
const keys = Object.keys(servers);
|
|
15052
|
-
return /* @__PURE__ */
|
|
15053
|
-
/* @__PURE__ */
|
|
15054
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
15119
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15120
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: "Configured LSP Servers" }),
|
|
15121
|
+
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) => {
|
|
15055
15122
|
const s = servers[k];
|
|
15056
15123
|
const status = s.enabled !== false ? "enabled" : "disabled";
|
|
15057
|
-
return /* @__PURE__ */
|
|
15124
|
+
return /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: ` ${k.padEnd(16)} ${status} ${s.command.join(" ")}` }, k);
|
|
15058
15125
|
}) }),
|
|
15059
|
-
/* @__PURE__ */
|
|
15126
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15060
15127
|
SelectInput8,
|
|
15061
15128
|
{
|
|
15062
15129
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
@@ -15183,9 +15250,9 @@ var init_lsp_wizard = __esm({
|
|
|
15183
15250
|
});
|
|
15184
15251
|
|
|
15185
15252
|
// src/ui/theme-picker.tsx
|
|
15186
|
-
import { Box as
|
|
15253
|
+
import { Box as Box20, Text as Text21 } from "ink";
|
|
15187
15254
|
import SelectInput9 from "ink-select-input";
|
|
15188
|
-
import { jsx as
|
|
15255
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
15189
15256
|
function PaletteSwatches({ palette }) {
|
|
15190
15257
|
const colors = [
|
|
15191
15258
|
palette.primary,
|
|
@@ -15193,7 +15260,7 @@ function PaletteSwatches({ palette }) {
|
|
|
15193
15260
|
palette.success,
|
|
15194
15261
|
palette.error
|
|
15195
15262
|
];
|
|
15196
|
-
return /* @__PURE__ */
|
|
15263
|
+
return /* @__PURE__ */ jsx22(Box20, { children: colors.map((c, i) => /* @__PURE__ */ jsx22(Text21, { color: c, children: "\u2588" }, i)) });
|
|
15197
15264
|
}
|
|
15198
15265
|
function ThemePicker({ themes, onPick }) {
|
|
15199
15266
|
const current = useTheme();
|
|
@@ -15201,9 +15268,9 @@ function ThemePicker({ themes, onPick }) {
|
|
|
15201
15268
|
...themes.map((t) => ({ label: t.label, value: t.name })),
|
|
15202
15269
|
{ label: "< Back", value: "__back__" }
|
|
15203
15270
|
];
|
|
15204
|
-
return /* @__PURE__ */
|
|
15205
|
-
/* @__PURE__ */
|
|
15206
|
-
/* @__PURE__ */
|
|
15271
|
+
return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", borderStyle: "round", borderColor: current.accent, paddingX: 1, children: [
|
|
15272
|
+
/* @__PURE__ */ jsx22(Text21, { color: current.accent, bold: true, children: "Pick a theme (restart to apply)" }),
|
|
15273
|
+
/* @__PURE__ */ jsx22(Box20, { marginTop: 1, children: /* @__PURE__ */ jsx22(
|
|
15207
15274
|
SelectInput9,
|
|
15208
15275
|
{
|
|
15209
15276
|
items,
|
|
@@ -15218,9 +15285,9 @@ function ThemePicker({ themes, onPick }) {
|
|
|
15218
15285
|
itemComponent: ({ label, isSelected }) => {
|
|
15219
15286
|
const t = themes.find((x) => x.label === label);
|
|
15220
15287
|
const color = t?.accent ?? current.accent;
|
|
15221
|
-
return /* @__PURE__ */
|
|
15222
|
-
/* @__PURE__ */
|
|
15223
|
-
t && /* @__PURE__ */
|
|
15288
|
+
return /* @__PURE__ */ jsxs20(Box20, { children: [
|
|
15289
|
+
/* @__PURE__ */ jsx22(Text21, { color, bold: isSelected, dimColor: !isSelected, children: label }),
|
|
15290
|
+
t && /* @__PURE__ */ jsx22(Box20, { marginLeft: 1, children: /* @__PURE__ */ jsx22(PaletteSwatches, { palette: t.palette }) })
|
|
15224
15291
|
] });
|
|
15225
15292
|
}
|
|
15226
15293
|
}
|
|
@@ -16407,8 +16474,8 @@ var init_lsp_nudge = __esm({
|
|
|
16407
16474
|
});
|
|
16408
16475
|
|
|
16409
16476
|
// src/ui/file-picker.tsx
|
|
16410
|
-
import { Box as
|
|
16411
|
-
import { jsx as
|
|
16477
|
+
import { Box as Box21, Text as Text22 } from "ink";
|
|
16478
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
16412
16479
|
function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
16413
16480
|
const theme = useTheme();
|
|
16414
16481
|
let startIndex = 0;
|
|
@@ -16420,12 +16487,12 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
|
16420
16487
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT;
|
|
16421
16488
|
const recentInVisible = visible.filter((item) => recentFiles?.has(item.name)).length;
|
|
16422
16489
|
const hasRecentSection = recentInVisible > 0;
|
|
16423
|
-
return /* @__PURE__ */
|
|
16424
|
-
/* @__PURE__ */
|
|
16425
|
-
/* @__PURE__ */
|
|
16426
|
-
/* @__PURE__ */
|
|
16427
|
-
visible.length === 0 && /* @__PURE__ */
|
|
16428
|
-
hasMoreAbove && /* @__PURE__ */
|
|
16490
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
16491
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: query ? `Files matching "${query}"` : "Mention a file" }),
|
|
16492
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: true, children: "\u2191\u2193 navigate \xB7 Enter pick \xB7 Esc cancel" }),
|
|
16493
|
+
/* @__PURE__ */ jsxs21(Box21, { marginTop: 1, flexDirection: "column", children: [
|
|
16494
|
+
visible.length === 0 && /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "No matches" }),
|
|
16495
|
+
hasMoreAbove && /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, dimColor: true, children: [
|
|
16429
16496
|
"\u2026 ",
|
|
16430
16497
|
startIndex,
|
|
16431
16498
|
" more above"
|
|
@@ -16437,28 +16504,28 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
|
16437
16504
|
const label = item.isDirectory ? `${item.name}/` : item.name;
|
|
16438
16505
|
const isFirstRecent = isRecent && (i === 0 || !recentFiles?.has(visible[i - 1]?.name ?? ""));
|
|
16439
16506
|
const isFirstNonRecentAfterRecent = !isRecent && (i > 0 && recentFiles?.has(visible[i - 1]?.name ?? ""));
|
|
16440
|
-
return /* @__PURE__ */
|
|
16441
|
-
hasRecentSection && isFirstRecent && /* @__PURE__ */
|
|
16507
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", children: [
|
|
16508
|
+
hasRecentSection && isFirstRecent && /* @__PURE__ */ jsxs21(Text22, { color: theme.palette.success, bold: true, children: [
|
|
16442
16509
|
" ",
|
|
16443
16510
|
"Recent"
|
|
16444
16511
|
] }),
|
|
16445
|
-
hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */
|
|
16512
|
+
hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, dimColor: true, children: [
|
|
16446
16513
|
" ",
|
|
16447
16514
|
"All files"
|
|
16448
16515
|
] }),
|
|
16449
|
-
/* @__PURE__ */
|
|
16516
|
+
/* @__PURE__ */ jsxs21(Text22, { color: isSelected ? theme.accent : isRecent ? theme.palette.success : void 0, bold: isSelected || isRecent, children: [
|
|
16450
16517
|
isSelected ? "\u203A " : isRecent ? "\u2192 " : " ",
|
|
16451
16518
|
isRecent ? "\u21BB " : "",
|
|
16452
16519
|
label
|
|
16453
16520
|
] })
|
|
16454
16521
|
] }, item.name);
|
|
16455
16522
|
}),
|
|
16456
|
-
hasMoreBelow && /* @__PURE__ */
|
|
16523
|
+
hasMoreBelow && /* @__PURE__ */ jsxs21(Text22, { color: theme.info.color, dimColor: true, children: [
|
|
16457
16524
|
"\u2026 ",
|
|
16458
16525
|
items.length - (startIndex + VISIBLE_LIMIT),
|
|
16459
16526
|
" more below"
|
|
16460
16527
|
] }),
|
|
16461
|
-
hasRecentSection && /* @__PURE__ */
|
|
16528
|
+
hasRecentSection && /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: true, children: "\u21BB = recently used" }) })
|
|
16462
16529
|
] })
|
|
16463
16530
|
] });
|
|
16464
16531
|
}
|
|
@@ -16472,8 +16539,8 @@ var init_file_picker = __esm({
|
|
|
16472
16539
|
});
|
|
16473
16540
|
|
|
16474
16541
|
// src/ui/slash-picker.tsx
|
|
16475
|
-
import { Box as
|
|
16476
|
-
import { jsx as
|
|
16542
|
+
import { Box as Box22, Text as Text23 } from "ink";
|
|
16543
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
16477
16544
|
function sourceBadge(source) {
|
|
16478
16545
|
if (source === "builtin") return "";
|
|
16479
16546
|
if (source === "project") return "project";
|
|
@@ -16493,12 +16560,12 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
16493
16560
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT2;
|
|
16494
16561
|
const longestLabel = visible.reduce((m, it) => Math.max(m, commandLabel(it).length), 0);
|
|
16495
16562
|
const nameColWidth = Math.max(NAME_COL_MIN_WIDTH, longestLabel + NAME_DESC_GAP);
|
|
16496
|
-
return /* @__PURE__ */
|
|
16497
|
-
/* @__PURE__ */
|
|
16498
|
-
/* @__PURE__ */
|
|
16499
|
-
/* @__PURE__ */
|
|
16500
|
-
visible.length === 0 && /* @__PURE__ */
|
|
16501
|
-
hasMoreAbove && /* @__PURE__ */
|
|
16563
|
+
return /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
16564
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: query ? `Commands matching "/${query}"` : "Slash commands" }),
|
|
16565
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
16566
|
+
/* @__PURE__ */ jsxs22(Box22, { marginTop: 1, flexDirection: "column", children: [
|
|
16567
|
+
visible.length === 0 && /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "No matches" }),
|
|
16568
|
+
hasMoreAbove && /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
16502
16569
|
"\u2026 ",
|
|
16503
16570
|
startIndex,
|
|
16504
16571
|
" more above"
|
|
@@ -16508,16 +16575,16 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
16508
16575
|
const isSelected = actualIndex === selectedIndex;
|
|
16509
16576
|
const nameCol = commandLabel(item).padEnd(nameColWidth);
|
|
16510
16577
|
const badge = sourceBadge(item.source);
|
|
16511
|
-
return /* @__PURE__ */
|
|
16578
|
+
return /* @__PURE__ */ jsxs22(Text23, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: [
|
|
16512
16579
|
isSelected ? "\u203A " : " ",
|
|
16513
16580
|
nameCol,
|
|
16514
|
-
/* @__PURE__ */
|
|
16581
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
16515
16582
|
item.description,
|
|
16516
16583
|
badge && ` [${badge}]`
|
|
16517
16584
|
] })
|
|
16518
16585
|
] }, item.name);
|
|
16519
16586
|
}),
|
|
16520
|
-
hasMoreBelow && /* @__PURE__ */
|
|
16587
|
+
hasMoreBelow && /* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
16521
16588
|
"\u2026 ",
|
|
16522
16589
|
items.length - (startIndex + VISIBLE_LIMIT2),
|
|
16523
16590
|
" more below"
|
|
@@ -16628,7 +16695,7 @@ __export(app_exports, {
|
|
|
16628
16695
|
shouldOpenSlashPicker: () => shouldOpenSlashPicker
|
|
16629
16696
|
});
|
|
16630
16697
|
import React15, { useState as useState12, useRef as useRef3, useEffect as useEffect7, useCallback as useCallback3 } from "react";
|
|
16631
|
-
import { Box as
|
|
16698
|
+
import { Box as Box23, Text as Text24, useApp, useInput as useInput9, render } from "ink";
|
|
16632
16699
|
import SelectInput10 from "ink-select-input";
|
|
16633
16700
|
import { existsSync as existsSync4, statSync as statSync4 } from "fs";
|
|
16634
16701
|
import { join as join27 } from "path";
|
|
@@ -16638,7 +16705,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
16638
16705
|
import { platform as platform3 } from "os";
|
|
16639
16706
|
import fg4 from "fast-glob";
|
|
16640
16707
|
import { readFileSync as readFileSync3 } from "fs";
|
|
16641
|
-
import { jsx as
|
|
16708
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
16642
16709
|
function buildFilePickerIgnoreList(cwd) {
|
|
16643
16710
|
const hardcoded = [
|
|
16644
16711
|
// Dependencies
|
|
@@ -18113,6 +18180,16 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18113
18180
|
const isDenied = typeof r.content === "string" && r.content.startsWith("Permission denied");
|
|
18114
18181
|
updateTool(r.tool_call_id, { status: isDenied ? "rejected" : r.ok ? "done" : "error", result: r.content });
|
|
18115
18182
|
},
|
|
18183
|
+
onWarning: (msg) => {
|
|
18184
|
+
setEvents((e) => [
|
|
18185
|
+
...e,
|
|
18186
|
+
{
|
|
18187
|
+
kind: "info",
|
|
18188
|
+
key: mkKey(),
|
|
18189
|
+
text: msg
|
|
18190
|
+
}
|
|
18191
|
+
]);
|
|
18192
|
+
},
|
|
18116
18193
|
onUsage: (u) => {
|
|
18117
18194
|
usageRef.current = u;
|
|
18118
18195
|
setUsage(u);
|
|
@@ -18252,6 +18329,17 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18252
18329
|
...es,
|
|
18253
18330
|
{ kind: "error", key: mkKey(), text: "The agent got stuck repeating the same actions. Here's what we know so far." }
|
|
18254
18331
|
]);
|
|
18332
|
+
} else if (e instanceof KimiApiError && (e.httpStatus === 429 || e.code === 3040 || e.httpStatus !== void 0 && e.httpStatus >= 500)) {
|
|
18333
|
+
setEvents((es) => [
|
|
18334
|
+
...es,
|
|
18335
|
+
{
|
|
18336
|
+
kind: "api_error",
|
|
18337
|
+
key: mkKey(),
|
|
18338
|
+
httpStatus: e.httpStatus,
|
|
18339
|
+
code: e.code,
|
|
18340
|
+
message: humanizeCloudflareError(e)
|
|
18341
|
+
}
|
|
18342
|
+
]);
|
|
18255
18343
|
} else {
|
|
18256
18344
|
const displayText = e instanceof KimiApiError ? humanizeCloudflareError(e) : `init failed: ${e.message}`;
|
|
18257
18345
|
setEvents((es) => [
|
|
@@ -19810,6 +19898,17 @@ ${lines.join("\n")}` }]);
|
|
|
19810
19898
|
...es,
|
|
19811
19899
|
{ kind: "cloud_quota_exhausted", key: mkKey(), used, limit, expiresAt }
|
|
19812
19900
|
]);
|
|
19901
|
+
} else if (e instanceof KimiApiError && (e.httpStatus === 429 || e.code === 3040 || e.httpStatus !== void 0 && e.httpStatus >= 500)) {
|
|
19902
|
+
setEvents((es) => [
|
|
19903
|
+
...es,
|
|
19904
|
+
{
|
|
19905
|
+
kind: "api_error",
|
|
19906
|
+
key: mkKey(),
|
|
19907
|
+
httpStatus: e.httpStatus,
|
|
19908
|
+
code: e.code,
|
|
19909
|
+
message: humanizeCloudflareError(e)
|
|
19910
|
+
}
|
|
19911
|
+
]);
|
|
19813
19912
|
} else {
|
|
19814
19913
|
const displayText2 = e instanceof KimiApiError ? humanizeCloudflareError(e) : e.message ?? String(e);
|
|
19815
19914
|
setEvents((es) => [
|
|
@@ -19869,7 +19968,7 @@ ${lines.join("\n")}` }]);
|
|
|
19869
19968
|
}
|
|
19870
19969
|
}, [usage]);
|
|
19871
19970
|
if (!cfg) {
|
|
19872
|
-
return /* @__PURE__ */
|
|
19971
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(
|
|
19873
19972
|
Onboarding,
|
|
19874
19973
|
{
|
|
19875
19974
|
onCancel: () => exit(),
|
|
@@ -19901,7 +20000,7 @@ ${lines.join("\n")}` }]);
|
|
|
19901
20000
|
) });
|
|
19902
20001
|
}
|
|
19903
20002
|
if (checkpointSession !== null) {
|
|
19904
|
-
return /* @__PURE__ */
|
|
20003
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
19905
20004
|
CheckpointPicker,
|
|
19906
20005
|
{
|
|
19907
20006
|
session: checkpointSession,
|
|
@@ -19911,10 +20010,10 @@ ${lines.join("\n")}` }]);
|
|
|
19911
20010
|
) }) });
|
|
19912
20011
|
}
|
|
19913
20012
|
if (resumeSessions !== null) {
|
|
19914
|
-
return /* @__PURE__ */
|
|
20013
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(ResumePicker, { sessions: resumeSessions, onPick: handleResumePick }) }) });
|
|
19915
20014
|
}
|
|
19916
20015
|
if (showRemoteDashboard) {
|
|
19917
|
-
return /* @__PURE__ */
|
|
20016
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: selectedRemoteSession ? /* @__PURE__ */ jsx25(
|
|
19918
20017
|
RemoteSessionDetail,
|
|
19919
20018
|
{
|
|
19920
20019
|
session: selectedRemoteSession,
|
|
@@ -19937,7 +20036,7 @@ ${lines.join("\n")}` }]);
|
|
|
19937
20036
|
setShowRemoteDashboard(false);
|
|
19938
20037
|
}
|
|
19939
20038
|
}
|
|
19940
|
-
) : /* @__PURE__ */
|
|
20039
|
+
) : /* @__PURE__ */ jsx25(
|
|
19941
20040
|
RemoteDashboard,
|
|
19942
20041
|
{
|
|
19943
20042
|
onSelect: (session) => setSelectedRemoteSession(session),
|
|
@@ -19946,7 +20045,7 @@ ${lines.join("\n")}` }]);
|
|
|
19946
20045
|
) }) });
|
|
19947
20046
|
}
|
|
19948
20047
|
if (showLspWizard) {
|
|
19949
|
-
return /* @__PURE__ */
|
|
20048
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
19950
20049
|
LspWizard,
|
|
19951
20050
|
{
|
|
19952
20051
|
servers: cfg?.lspServers ?? {},
|
|
@@ -19983,7 +20082,7 @@ ${lines.join("\n")}` }]);
|
|
|
19983
20082
|
) }) });
|
|
19984
20083
|
}
|
|
19985
20084
|
if (commandWizard) {
|
|
19986
|
-
return /* @__PURE__ */
|
|
20085
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
19987
20086
|
CommandWizard,
|
|
19988
20087
|
{
|
|
19989
20088
|
mode: commandWizard.mode,
|
|
@@ -19996,7 +20095,7 @@ ${lines.join("\n")}` }]);
|
|
|
19996
20095
|
) }) });
|
|
19997
20096
|
}
|
|
19998
20097
|
if (commandPicker) {
|
|
19999
|
-
return /* @__PURE__ */
|
|
20098
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
20000
20099
|
CommandPicker,
|
|
20001
20100
|
{
|
|
20002
20101
|
commands: customCommandsRef.current,
|
|
@@ -20014,14 +20113,14 @@ ${lines.join("\n")}` }]);
|
|
|
20014
20113
|
) }) });
|
|
20015
20114
|
}
|
|
20016
20115
|
if (commandToDelete) {
|
|
20017
|
-
return /* @__PURE__ */
|
|
20018
|
-
/* @__PURE__ */
|
|
20116
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
20117
|
+
/* @__PURE__ */ jsxs23(Text24, { color: theme.accent, bold: true, children: [
|
|
20019
20118
|
"Delete /",
|
|
20020
20119
|
commandToDelete.name,
|
|
20021
20120
|
"?"
|
|
20022
20121
|
] }),
|
|
20023
|
-
/* @__PURE__ */
|
|
20024
|
-
/* @__PURE__ */
|
|
20122
|
+
/* @__PURE__ */ jsx25(Text24, { color: theme.info.color, children: commandToDelete.filepath }),
|
|
20123
|
+
/* @__PURE__ */ jsx25(Box23, { marginTop: 1, children: /* @__PURE__ */ jsx25(
|
|
20025
20124
|
SelectInput10,
|
|
20026
20125
|
{
|
|
20027
20126
|
items: [
|
|
@@ -20040,7 +20139,7 @@ ${lines.join("\n")}` }]);
|
|
|
20040
20139
|
] }) });
|
|
20041
20140
|
}
|
|
20042
20141
|
if (showCommandList) {
|
|
20043
|
-
return /* @__PURE__ */
|
|
20142
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(
|
|
20044
20143
|
CommandList,
|
|
20045
20144
|
{
|
|
20046
20145
|
commands: customCommandsRef.current,
|
|
@@ -20049,12 +20148,12 @@ ${lines.join("\n")}` }]);
|
|
|
20049
20148
|
) }) });
|
|
20050
20149
|
}
|
|
20051
20150
|
if (showThemePicker) {
|
|
20052
|
-
return /* @__PURE__ */
|
|
20151
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsx25(Box23, { flexDirection: "column", children: /* @__PURE__ */ jsx25(ThemePicker, { themes: themeList(), onPick: handleThemePick }) }) });
|
|
20053
20152
|
}
|
|
20054
20153
|
const hasConversation = events.some((e) => e.kind === "user" || e.kind === "assistant");
|
|
20055
|
-
return /* @__PURE__ */
|
|
20056
|
-
!hasConversation && events.length === 0 ? /* @__PURE__ */
|
|
20057
|
-
perm ? /* @__PURE__ */
|
|
20154
|
+
return /* @__PURE__ */ jsx25(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", children: [
|
|
20155
|
+
!hasConversation && events.length === 0 ? /* @__PURE__ */ jsx25(Welcome, {}) : /* @__PURE__ */ jsx25(ChatView, { events, showReasoning, verbose, intentTier: intentTier ?? void 0 }),
|
|
20156
|
+
perm ? /* @__PURE__ */ jsx25(
|
|
20058
20157
|
PermissionModal,
|
|
20059
20158
|
{
|
|
20060
20159
|
tool: perm.tool,
|
|
@@ -20068,7 +20167,7 @@ ${lines.join("\n")}` }]);
|
|
|
20068
20167
|
submitRef.current(text);
|
|
20069
20168
|
}
|
|
20070
20169
|
}
|
|
20071
|
-
) : limitModal ? /* @__PURE__ */
|
|
20170
|
+
) : limitModal ? /* @__PURE__ */ jsx25(
|
|
20072
20171
|
LimitModal,
|
|
20073
20172
|
{
|
|
20074
20173
|
limit: limitModal.limit,
|
|
@@ -20078,8 +20177,8 @@ ${lines.join("\n")}` }]);
|
|
|
20078
20177
|
setLimitModal(null);
|
|
20079
20178
|
}
|
|
20080
20179
|
}
|
|
20081
|
-
) : /* @__PURE__ */
|
|
20082
|
-
tasks.length > 0 && /* @__PURE__ */
|
|
20180
|
+
) : /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", marginTop: 1, children: [
|
|
20181
|
+
tasks.length > 0 && /* @__PURE__ */ jsx25(
|
|
20083
20182
|
TaskList,
|
|
20084
20183
|
{
|
|
20085
20184
|
tasks,
|
|
@@ -20087,11 +20186,11 @@ ${lines.join("\n")}` }]);
|
|
|
20087
20186
|
tokensDelta: Math.max(0, (usage?.prompt_tokens ?? 0) - tasksStartTokens)
|
|
20088
20187
|
}
|
|
20089
20188
|
),
|
|
20090
|
-
queue.length > 0 && /* @__PURE__ */
|
|
20189
|
+
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: [
|
|
20091
20190
|
"\u23F3 ",
|
|
20092
20191
|
q.display
|
|
20093
20192
|
] }, `queue_${i}`)) }),
|
|
20094
|
-
/* @__PURE__ */
|
|
20193
|
+
/* @__PURE__ */ jsx25(
|
|
20095
20194
|
StatusBar,
|
|
20096
20195
|
{
|
|
20097
20196
|
usage,
|
|
@@ -20114,7 +20213,7 @@ ${lines.join("\n")}` }]);
|
|
|
20114
20213
|
intentTier: intentTier ?? void 0
|
|
20115
20214
|
}
|
|
20116
20215
|
),
|
|
20117
|
-
activePicker?.kind === "file" && /* @__PURE__ */
|
|
20216
|
+
activePicker?.kind === "file" && /* @__PURE__ */ jsx25(
|
|
20118
20217
|
FilePicker,
|
|
20119
20218
|
{
|
|
20120
20219
|
items: filteredFileItems,
|
|
@@ -20123,7 +20222,7 @@ ${lines.join("\n")}` }]);
|
|
|
20123
20222
|
recentFiles: new Set(recentFilesRef.current.keys())
|
|
20124
20223
|
}
|
|
20125
20224
|
),
|
|
20126
|
-
activePicker?.kind === "slash" && /* @__PURE__ */
|
|
20225
|
+
activePicker?.kind === "slash" && /* @__PURE__ */ jsx25(
|
|
20127
20226
|
SlashPicker,
|
|
20128
20227
|
{
|
|
20129
20228
|
items: filteredSlashItems,
|
|
@@ -20131,9 +20230,9 @@ ${lines.join("\n")}` }]);
|
|
|
20131
20230
|
query: pickerQuery ?? ""
|
|
20132
20231
|
}
|
|
20133
20232
|
),
|
|
20134
|
-
/* @__PURE__ */
|
|
20135
|
-
/* @__PURE__ */
|
|
20136
|
-
/* @__PURE__ */
|
|
20233
|
+
/* @__PURE__ */ jsxs23(Box23, { marginTop: 1, children: [
|
|
20234
|
+
/* @__PURE__ */ jsx25(Text24, { color: theme.prompt ?? theme.accent, children: "\u203A " }),
|
|
20235
|
+
/* @__PURE__ */ jsx25(
|
|
20137
20236
|
CustomTextInput,
|
|
20138
20237
|
{
|
|
20139
20238
|
value: input,
|
|
@@ -20190,7 +20289,7 @@ ${lines.join("\n")}` }]);
|
|
|
20190
20289
|
}
|
|
20191
20290
|
async function renderApp(cfg, updateResult, lspScope = "global", lspProjectPath = null, cloudToken, cloudDeviceId) {
|
|
20192
20291
|
const instance = render(
|
|
20193
|
-
/* @__PURE__ */
|
|
20292
|
+
/* @__PURE__ */ jsx25(
|
|
20194
20293
|
App,
|
|
20195
20294
|
{
|
|
20196
20295
|
initialCfg: cfg,
|
|
@@ -20622,6 +20721,10 @@ async function runPrintMode(opts2) {
|
|
|
20622
20721
|
onToolResult: (result) => {
|
|
20623
20722
|
const snippet = result.content.length > 400 ? result.content.slice(0, 400) + "..." : result.content;
|
|
20624
20723
|
process.stderr.write(`\x1B[2m[result: ${snippet.replace(/\n/g, " \u23CE ")}]\x1B[0m
|
|
20724
|
+
`);
|
|
20725
|
+
},
|
|
20726
|
+
onWarning: (msg) => {
|
|
20727
|
+
process.stderr.write(`\x1B[33mkimiflare: ${msg}\x1B[0m
|
|
20625
20728
|
`);
|
|
20626
20729
|
},
|
|
20627
20730
|
askPermission: async ({ tool, args }) => {
|