kimiflare 0.42.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +881 -685
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1082,7 +1082,8 @@ async function logTurnDebug(ctx) {
|
|
|
1082
1082
|
shadowStrip: ctx.shadowStrip,
|
|
1083
1083
|
durationMs: ctx.durationMs,
|
|
1084
1084
|
intentClassification: ctx.intentClassification,
|
|
1085
|
-
codeMode: ctx.codeMode
|
|
1085
|
+
codeMode: ctx.codeMode,
|
|
1086
|
+
selectedSkills: ctx.selectedSkills?.map((s) => s.name)
|
|
1086
1087
|
});
|
|
1087
1088
|
}
|
|
1088
1089
|
var LOG_VERSION;
|
|
@@ -2316,7 +2317,8 @@ ${sandboxResult.output}` : `${warningPrefix}${sandboxResult.output}`;
|
|
|
2316
2317
|
shadowStrip: shadowStripMetrics,
|
|
2317
2318
|
durationMs: Math.round(performance.now() - turnStart),
|
|
2318
2319
|
intentClassification: opts2.intentClassification,
|
|
2319
|
-
codeMode: opts2.codeMode
|
|
2320
|
+
codeMode: opts2.codeMode,
|
|
2321
|
+
selectedSkills: opts2.selectedSkills
|
|
2320
2322
|
});
|
|
2321
2323
|
}
|
|
2322
2324
|
if (budgetExhausted) {
|
|
@@ -2636,7 +2638,12 @@ ${toolsBlock}`;
|
|
|
2636
2638
|
Project context from ${ctx.name} (${ctx.lineCount} lines, treat as authoritative):
|
|
2637
2639
|
${ctx.content.trim()}` : "";
|
|
2638
2640
|
const modeBlock = opts2.mode ? systemPromptForMode(opts2.mode) : "";
|
|
2639
|
-
|
|
2641
|
+
const skillsBlock = opts2.selectedSkills && opts2.selectedSkills.length > 0 ? `
|
|
2642
|
+
|
|
2643
|
+
Active skills for this turn:
|
|
2644
|
+
${opts2.selectedSkills.map((s) => `--- ${s.name} ---
|
|
2645
|
+
${s.body}`).join("\n\n")}` : "";
|
|
2646
|
+
return env2 + "\n\n" + tools + lspBlock + contextBlock + modeBlock + skillsBlock;
|
|
2640
2647
|
}
|
|
2641
2648
|
function buildSystemPrompt(opts2) {
|
|
2642
2649
|
return buildStaticPrefix(opts2) + "\n\n" + buildSessionPrefix(opts2);
|
|
@@ -5016,8 +5023,8 @@ async function saveCloudCredentials(creds) {
|
|
|
5016
5023
|
}
|
|
5017
5024
|
async function clearCloudCredentials() {
|
|
5018
5025
|
try {
|
|
5019
|
-
const { unlink:
|
|
5020
|
-
await
|
|
5026
|
+
const { unlink: unlink5 } = await import("fs/promises");
|
|
5027
|
+
await unlink5(cloudCredPath());
|
|
5021
5028
|
} catch {
|
|
5022
5029
|
}
|
|
5023
5030
|
}
|
|
@@ -7386,6 +7393,22 @@ var init_chat = __esm({
|
|
|
7386
7393
|
evt.text
|
|
7387
7394
|
] });
|
|
7388
7395
|
}
|
|
7396
|
+
if (evt.kind === "meta") {
|
|
7397
|
+
const parts = [];
|
|
7398
|
+
if (evt.intentTier) {
|
|
7399
|
+
parts.push(
|
|
7400
|
+
evt.intentTier === "light" ? "Quick thought" : evt.intentTier === "medium" ? "Deep dive" : "Heavy lifting"
|
|
7401
|
+
);
|
|
7402
|
+
}
|
|
7403
|
+
if (evt.skillsActive !== void 0 && evt.skillsActive > 0) {
|
|
7404
|
+
parts.push(`${evt.skillsActive} skill${evt.skillsActive === 1 ? "" : "s"} on deck`);
|
|
7405
|
+
}
|
|
7406
|
+
if (evt.memoryRecalled) {
|
|
7407
|
+
parts.push("Memory recalled");
|
|
7408
|
+
}
|
|
7409
|
+
if (parts.length === 0) return null;
|
|
7410
|
+
return /* @__PURE__ */ jsx5(Text4, { color: theme.info.color, dimColor: true, children: parts.join(" \xB7 ") });
|
|
7411
|
+
}
|
|
7389
7412
|
if (evt.kind === "activity") {
|
|
7390
7413
|
return /* @__PURE__ */ jsxs4(Text4, { italic: true, color: theme.info.dim ? theme.info.color : theme.palette.secondary, children: [
|
|
7391
7414
|
"~ ",
|
|
@@ -7423,7 +7446,7 @@ import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
|
7423
7446
|
import { Box as Box5, Text as Text5 } from "ink";
|
|
7424
7447
|
import Spinner3 from "ink-spinner";
|
|
7425
7448
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
7426
|
-
function StatusBar({ model, usage, sessionUsage, thinking, turnStartedAt, mode, effort, contextLimit, hasUpdate, latestVersion, gatewayMeta, codeMode, cloudMode, cloudBudget, phase, currentTool, lastActivityAt, kimiMdStale }) {
|
|
7449
|
+
function StatusBar({ model, usage, sessionUsage, thinking, turnStartedAt, mode, effort, contextLimit, hasUpdate, latestVersion, gatewayMeta, codeMode, cloudMode, cloudBudget, skillsActive, memoryRecalled, phase, currentTool, lastActivityAt, kimiMdStale }) {
|
|
7427
7450
|
const theme = useTheme();
|
|
7428
7451
|
const [now2, setNow] = useState2(Date.now());
|
|
7429
7452
|
const modeColor = mode === "plan" ? theme.modeBadge.plan : mode === "auto" ? theme.modeBadge.auto : theme.modeBadge.edit;
|
|
@@ -7437,6 +7460,13 @@ function StatusBar({ model, usage, sessionUsage, thinking, turnStartedAt, mode,
|
|
|
7437
7460
|
const leftParts = [`${shortModel(model)}`, effort];
|
|
7438
7461
|
if (cloudMode) leftParts.push("CLOUD");
|
|
7439
7462
|
if (codeMode) leftParts.push("CODE");
|
|
7463
|
+
const labelParts = [];
|
|
7464
|
+
if (skillsActive !== void 0 && skillsActive > 0) {
|
|
7465
|
+
labelParts.push(`${skillsActive} skill${skillsActive === 1 ? "" : "s"} on deck`);
|
|
7466
|
+
}
|
|
7467
|
+
if (memoryRecalled) {
|
|
7468
|
+
labelParts.push("Memory recalled");
|
|
7469
|
+
}
|
|
7440
7470
|
const phaseLabel = phase === "generating" ? "generating" : phase === "executing" ? `executing ${currentTool ?? ""}` : phase === "waiting" ? "waiting" : "thinking";
|
|
7441
7471
|
const idleMs = lastActivityAt && thinking ? now2 - lastActivityAt : 0;
|
|
7442
7472
|
const idleLabel = idleMs > 3e4 ? ` (idle ${formatElapsed2(Math.floor(idleMs / 1e3))})` : "";
|
|
@@ -7459,6 +7489,7 @@ function StatusBar({ model, usage, sessionUsage, thinking, turnStartedAt, mode,
|
|
|
7459
7489
|
" \xB7 ready"
|
|
7460
7490
|
] })
|
|
7461
7491
|
] }),
|
|
7492
|
+
labelParts.length > 0 && /* @__PURE__ */ jsx6(Box5, { children: /* @__PURE__ */ jsx6(Text5, { color: theme.info.color, dimColor: true, children: labelParts.join(" \xB7 ") }) }),
|
|
7462
7493
|
usage && /* @__PURE__ */ jsxs5(Box5, { children: [
|
|
7463
7494
|
/* @__PURE__ */ jsx6(Text5, { color: theme.info.color, children: buildRightParts(usage, contextLimit, sessionUsage, gatewayMeta, cloudMode, cloudBudget).join(" \xB7 ") }),
|
|
7464
7495
|
warn ? /* @__PURE__ */ jsxs5(Text5, { color: theme.warn, bold: true, children: [
|
|
@@ -8942,7 +8973,7 @@ var init_onboarding = __esm({
|
|
|
8942
8973
|
// src/ui/welcome.tsx
|
|
8943
8974
|
import { Box as Box11, Text as Text12 } from "ink";
|
|
8944
8975
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
8945
|
-
function Welcome({ accountId }) {
|
|
8976
|
+
function Welcome({ accountId, cloudMode }) {
|
|
8946
8977
|
const theme = useTheme();
|
|
8947
8978
|
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginBottom: 1, children: [
|
|
8948
8979
|
/* @__PURE__ */ jsxs11(Box11, { marginBottom: 1, children: [
|
|
@@ -8952,7 +8983,7 @@ function Welcome({ accountId }) {
|
|
|
8952
8983
|
"Ready when you are."
|
|
8953
8984
|
] })
|
|
8954
8985
|
] }),
|
|
8955
|
-
accountId && /* @__PURE__ */ jsx13(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
|
|
8986
|
+
accountId && !cloudMode && /* @__PURE__ */ jsx13(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
|
|
8956
8987
|
" ",
|
|
8957
8988
|
"Check your Cloudflare billing: https://dash.cloudflare.com/",
|
|
8958
8989
|
accountId,
|
|
@@ -8983,237 +9014,6 @@ var init_welcome = __esm({
|
|
|
8983
9014
|
}
|
|
8984
9015
|
});
|
|
8985
9016
|
|
|
8986
|
-
// src/ui/help-menu.tsx
|
|
8987
|
-
import { useState as useState7 } from "react";
|
|
8988
|
-
import { Box as Box12, Text as Text13, useInput as useInput3 } from "ink";
|
|
8989
|
-
import SelectInput5 from "ink-select-input";
|
|
8990
|
-
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
8991
|
-
function HelpMenu({ customCommands, costAttributionEnabled, cloudMode, onDone, onCommand }) {
|
|
8992
|
-
const theme = useTheme();
|
|
8993
|
-
const [page, setPage] = useState7("main");
|
|
8994
|
-
const customs = customCommands ?? [];
|
|
8995
|
-
useInput3((_input, key) => {
|
|
8996
|
-
if (key.escape) {
|
|
8997
|
-
if (page !== "main") {
|
|
8998
|
-
setPage("main");
|
|
8999
|
-
} else {
|
|
9000
|
-
onDone();
|
|
9001
|
-
}
|
|
9002
|
-
}
|
|
9003
|
-
});
|
|
9004
|
-
const handleSelect = (command) => {
|
|
9005
|
-
onCommand(command);
|
|
9006
|
-
onDone();
|
|
9007
|
-
};
|
|
9008
|
-
const categories = cloudMode ? CATEGORIES.filter((c) => c.key !== "gateway") : CATEGORIES;
|
|
9009
|
-
if (page === "main") {
|
|
9010
|
-
const items2 = categories.map((cat) => ({
|
|
9011
|
-
label: cat.label,
|
|
9012
|
-
value: cat.key,
|
|
9013
|
-
key: cat.key
|
|
9014
|
-
}));
|
|
9015
|
-
if (customs.length > 0) {
|
|
9016
|
-
items2.push({ label: "Run custom commands", value: "custom", key: "custom" });
|
|
9017
|
-
}
|
|
9018
|
-
items2.push({ label: "(close)", value: "__close__", key: "__close__" });
|
|
9019
|
-
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
9020
|
-
/* @__PURE__ */ jsx14(Text13, { color: theme.accent, bold: true, children: "Help" }),
|
|
9021
|
-
/* @__PURE__ */ jsx14(Text13, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
|
|
9022
|
-
/* @__PURE__ */ jsx14(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx14(
|
|
9023
|
-
SelectInput5,
|
|
9024
|
-
{
|
|
9025
|
-
items: items2,
|
|
9026
|
-
onSelect: (item) => {
|
|
9027
|
-
if (item.value === "__close__") {
|
|
9028
|
-
onDone();
|
|
9029
|
-
} else {
|
|
9030
|
-
setPage(item.value);
|
|
9031
|
-
}
|
|
9032
|
-
}
|
|
9033
|
-
}
|
|
9034
|
-
) }),
|
|
9035
|
-
/* @__PURE__ */ jsx14(Box12, { marginTop: 1, flexDirection: "column", children: SINGLE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, dimColor: false, children: ` ${cmd.command.padEnd(20)} ${cmd.description}` }, cmd.command)) }),
|
|
9036
|
-
/* @__PURE__ */ jsx14(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, dimColor: false, children: "keys: ctrl-c interrupt/exit \xB7 ctrl-r toggle reasoning \xB7 ctrl-o verbose \xB7 shift+tab cycle mode \xB7 \u2191/\u2193 history" }) })
|
|
9037
|
-
] });
|
|
9038
|
-
}
|
|
9039
|
-
if (page === "custom") {
|
|
9040
|
-
const items2 = customs.map((c) => ({
|
|
9041
|
-
label: `${`/${c.name}`.padEnd(28)} ${c.description ?? ""}`.trimEnd(),
|
|
9042
|
-
value: `/${c.name}`,
|
|
9043
|
-
key: c.name
|
|
9044
|
-
}));
|
|
9045
|
-
items2.push({ label: "\u2190 Back", value: "__back__", key: "__back__" });
|
|
9046
|
-
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
9047
|
-
/* @__PURE__ */ jsx14(Text13, { color: theme.accent, bold: true, children: "Custom commands" }),
|
|
9048
|
-
/* @__PURE__ */ jsx14(Text13, { color: theme.info.color, dimColor: false, children: customs.length === 0 ? "no custom commands found in .kimiflare/commands/" : "Arrow keys to navigate, Enter to run, Esc to go back." }),
|
|
9049
|
-
/* @__PURE__ */ jsx14(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx14(
|
|
9050
|
-
SelectInput5,
|
|
9051
|
-
{
|
|
9052
|
-
items: items2,
|
|
9053
|
-
onSelect: (item) => {
|
|
9054
|
-
if (item.value === "__back__") {
|
|
9055
|
-
setPage("main");
|
|
9056
|
-
} else {
|
|
9057
|
-
handleSelect(item.value);
|
|
9058
|
-
}
|
|
9059
|
-
}
|
|
9060
|
-
}
|
|
9061
|
-
) })
|
|
9062
|
-
] });
|
|
9063
|
-
}
|
|
9064
|
-
const category = categories.find((c) => c.key === page);
|
|
9065
|
-
const selectable = category.commands.filter((cmd) => cmd.selectable !== false);
|
|
9066
|
-
const staticCmds = category.commands.filter((cmd) => cmd.selectable === false);
|
|
9067
|
-
const items = selectable.map((cmd) => ({
|
|
9068
|
-
label: `${cmd.command.padEnd(28)} ${cmd.description}`,
|
|
9069
|
-
value: cmd.command,
|
|
9070
|
-
key: cmd.command
|
|
9071
|
-
}));
|
|
9072
|
-
items.push({ label: "\u2190 Back", value: "__back__", key: "__back__" });
|
|
9073
|
-
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
9074
|
-
/* @__PURE__ */ jsx14(Text13, { color: theme.accent, bold: true, children: category.label }),
|
|
9075
|
-
/* @__PURE__ */ jsx14(Text13, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to execute, Esc to go back." }),
|
|
9076
|
-
/* @__PURE__ */ jsx14(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx14(
|
|
9077
|
-
SelectInput5,
|
|
9078
|
-
{
|
|
9079
|
-
items,
|
|
9080
|
-
onSelect: (item) => {
|
|
9081
|
-
if (item.value === "__back__") {
|
|
9082
|
-
setPage("main");
|
|
9083
|
-
} else {
|
|
9084
|
-
handleSelect(item.value);
|
|
9085
|
-
}
|
|
9086
|
-
}
|
|
9087
|
-
}
|
|
9088
|
-
) }),
|
|
9089
|
-
staticCmds.length > 0 && /* @__PURE__ */ jsx14(Box12, { marginTop: 1, flexDirection: "column", children: staticCmds.map((cmd) => /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, children: ` ${cmd.command.padEnd(28)} ${cmd.description}` }, cmd.command)) })
|
|
9090
|
-
] });
|
|
9091
|
-
}
|
|
9092
|
-
var CATEGORIES, SINGLE_COMMANDS;
|
|
9093
|
-
var init_help_menu = __esm({
|
|
9094
|
-
"src/ui/help-menu.tsx"() {
|
|
9095
|
-
"use strict";
|
|
9096
|
-
init_theme_context();
|
|
9097
|
-
CATEGORIES = [
|
|
9098
|
-
{
|
|
9099
|
-
key: "mode",
|
|
9100
|
-
label: "Mode",
|
|
9101
|
-
commands: [
|
|
9102
|
-
{ command: "/mode edit", description: "switch to edit mode" },
|
|
9103
|
-
{ command: "/mode plan", description: "switch to plan mode" },
|
|
9104
|
-
{ command: "/mode auto", description: "switch to auto mode" }
|
|
9105
|
-
]
|
|
9106
|
-
},
|
|
9107
|
-
{
|
|
9108
|
-
key: "thinking",
|
|
9109
|
-
label: "Thinking",
|
|
9110
|
-
commands: [
|
|
9111
|
-
{ command: "/thinking low", description: "fast, lower quality" },
|
|
9112
|
-
{ command: "/thinking medium", description: "balanced" },
|
|
9113
|
-
{ command: "/thinking high", description: "slow, higher quality" }
|
|
9114
|
-
]
|
|
9115
|
-
},
|
|
9116
|
-
{
|
|
9117
|
-
key: "session",
|
|
9118
|
-
label: "Session",
|
|
9119
|
-
commands: [
|
|
9120
|
-
{ command: "/resume", description: "pick a past conversation" },
|
|
9121
|
-
{ command: "/compact", description: "summarize old turns to free context" },
|
|
9122
|
-
{ command: "/clear", description: "clear current conversation" }
|
|
9123
|
-
]
|
|
9124
|
-
},
|
|
9125
|
-
{
|
|
9126
|
-
key: "memory",
|
|
9127
|
-
label: "Memory",
|
|
9128
|
-
commands: [
|
|
9129
|
-
{ command: "/memory", description: "show memory stats" },
|
|
9130
|
-
{ command: "/memory on", description: "enable memory" },
|
|
9131
|
-
{ command: "/memory off", description: "disable memory" },
|
|
9132
|
-
{ command: "/memory clear", description: "wipe memories for this repo" },
|
|
9133
|
-
{ command: "/memory search <query>", description: "search stored memories", selectable: false }
|
|
9134
|
-
]
|
|
9135
|
-
},
|
|
9136
|
-
{
|
|
9137
|
-
key: "cost",
|
|
9138
|
-
label: "Cost",
|
|
9139
|
-
commands: [
|
|
9140
|
-
{ command: "/cost", description: "show cost report" },
|
|
9141
|
-
{ command: "/cost on", description: "enable cost attribution by task type" },
|
|
9142
|
-
{ command: "/cost off", description: "disable cost attribution by task type" }
|
|
9143
|
-
]
|
|
9144
|
-
},
|
|
9145
|
-
{
|
|
9146
|
-
key: "mcp",
|
|
9147
|
-
label: "MCP",
|
|
9148
|
-
commands: [
|
|
9149
|
-
{ command: "/mcp list", description: "list connected MCP servers and tools" },
|
|
9150
|
-
{ command: "/mcp reload", description: "reconnect all configured MCP servers" }
|
|
9151
|
-
]
|
|
9152
|
-
},
|
|
9153
|
-
{
|
|
9154
|
-
key: "lsp",
|
|
9155
|
-
label: "LSP",
|
|
9156
|
-
commands: [
|
|
9157
|
-
{ command: "/lsp config", description: "add, edit, or remove language servers" },
|
|
9158
|
-
{ command: "/lsp list", description: "list active LSP servers" },
|
|
9159
|
-
{ command: "/lsp reload", description: "restart all configured LSP servers" },
|
|
9160
|
-
{ command: "/lsp scope", description: "show whether LSP config is project or global" }
|
|
9161
|
-
]
|
|
9162
|
-
},
|
|
9163
|
-
{
|
|
9164
|
-
key: "gateway",
|
|
9165
|
-
label: "Gateway",
|
|
9166
|
-
commands: [
|
|
9167
|
-
{ command: "/gateway", description: "show gateway status" },
|
|
9168
|
-
{ command: "/gateway off", description: "disable AI Gateway (direct Workers AI)" },
|
|
9169
|
-
{ command: "/gateway skip-cache true", description: "enable skip-cache" },
|
|
9170
|
-
{ command: "/gateway skip-cache false", description: "disable skip-cache" },
|
|
9171
|
-
{ command: "/gateway collect-logs true", description: "enable log collection" },
|
|
9172
|
-
{ command: "/gateway collect-logs false", description: "disable log collection" },
|
|
9173
|
-
{ command: "/gateway metadata clear", description: "remove all metadata" },
|
|
9174
|
-
{ command: "/gateway <id>", description: "enable AI Gateway", selectable: false },
|
|
9175
|
-
{ command: "/gateway cache-ttl <seconds>", description: "set cache TTL", selectable: false },
|
|
9176
|
-
{ command: "/gateway metadata <key>=<value>", description: "add metadata", selectable: false }
|
|
9177
|
-
]
|
|
9178
|
-
},
|
|
9179
|
-
{
|
|
9180
|
-
key: "info",
|
|
9181
|
-
label: "Info",
|
|
9182
|
-
commands: [
|
|
9183
|
-
{ command: "/cost", description: "show cost report" },
|
|
9184
|
-
{ command: "/model", description: "show current model" },
|
|
9185
|
-
{ command: "/update", description: "check for updates" },
|
|
9186
|
-
{ command: "/hello", description: "send a voice note to the creator" }
|
|
9187
|
-
]
|
|
9188
|
-
},
|
|
9189
|
-
{
|
|
9190
|
-
key: "commands",
|
|
9191
|
-
label: "Commands",
|
|
9192
|
-
commands: [
|
|
9193
|
-
{ command: "/command create", description: "create a new custom slash command" },
|
|
9194
|
-
{ command: "/command edit", description: "edit an existing custom command" },
|
|
9195
|
-
{ command: "/command delete", description: "delete a custom command" },
|
|
9196
|
-
{ command: "/command list", description: "list all custom commands" }
|
|
9197
|
-
]
|
|
9198
|
-
},
|
|
9199
|
-
{
|
|
9200
|
-
key: "config",
|
|
9201
|
-
label: "Config",
|
|
9202
|
-
commands: [
|
|
9203
|
-
{ command: "/init", description: "scan this repo and write a KIMI.md" },
|
|
9204
|
-
{ command: "/logout", description: "clear credentials" },
|
|
9205
|
-
{ command: "filePicker", description: "enabled by default; disable with KIMIFLARE_FILE_PICKER=0 or filePicker: false in config", selectable: false }
|
|
9206
|
-
]
|
|
9207
|
-
}
|
|
9208
|
-
];
|
|
9209
|
-
SINGLE_COMMANDS = [
|
|
9210
|
-
{ command: "/reasoning", description: "toggle show/hide model reasoning" },
|
|
9211
|
-
{ command: "/help", description: "show this menu" },
|
|
9212
|
-
{ command: "/exit", description: "exit kimiflare" }
|
|
9213
|
-
];
|
|
9214
|
-
}
|
|
9215
|
-
});
|
|
9216
|
-
|
|
9217
9017
|
// src/remote/worker-client.ts
|
|
9218
9018
|
var worker_client_exports = {};
|
|
9219
9019
|
__export(worker_client_exports, {
|
|
@@ -9318,16 +9118,16 @@ var init_tui_deploy = __esm({
|
|
|
9318
9118
|
});
|
|
9319
9119
|
|
|
9320
9120
|
// src/ui/remote-dashboard.tsx
|
|
9321
|
-
import { useEffect as useEffect6, useState as
|
|
9322
|
-
import { Box as
|
|
9323
|
-
import
|
|
9324
|
-
import { jsx as
|
|
9121
|
+
import { useEffect as useEffect6, useState as useState7 } from "react";
|
|
9122
|
+
import { Box as Box12, Text as Text13, useInput as useInput3 } from "ink";
|
|
9123
|
+
import SelectInput5 from "ink-select-input";
|
|
9124
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9325
9125
|
function RemoteDashboard({ onSelect, onCancel }) {
|
|
9326
9126
|
const theme = useTheme();
|
|
9327
|
-
const [sessions, setSessions] =
|
|
9328
|
-
const [loading, setLoading] =
|
|
9329
|
-
const [error, setError] =
|
|
9330
|
-
const [refreshing, setRefreshing] =
|
|
9127
|
+
const [sessions, setSessions] = useState7([]);
|
|
9128
|
+
const [loading, setLoading] = useState7(true);
|
|
9129
|
+
const [error, setError] = useState7(null);
|
|
9130
|
+
const [refreshing, setRefreshing] = useState7(false);
|
|
9331
9131
|
useEffect6(() => {
|
|
9332
9132
|
loadSessions();
|
|
9333
9133
|
}, []);
|
|
@@ -9364,7 +9164,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
9364
9164
|
setRefreshing(false);
|
|
9365
9165
|
}
|
|
9366
9166
|
}
|
|
9367
|
-
|
|
9167
|
+
useInput3((input, key) => {
|
|
9368
9168
|
if (input === "r" || input === "R") {
|
|
9369
9169
|
void loadSessions();
|
|
9370
9170
|
}
|
|
@@ -9377,31 +9177,31 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
9377
9177
|
value: s.sessionId
|
|
9378
9178
|
}));
|
|
9379
9179
|
if (loading) {
|
|
9380
|
-
return /* @__PURE__ */
|
|
9180
|
+
return /* @__PURE__ */ jsx14(Box12, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ jsx14(Text13, { color: theme.accent, children: "Loading remote sessions..." }) });
|
|
9381
9181
|
}
|
|
9382
9182
|
if (error) {
|
|
9383
|
-
return /* @__PURE__ */
|
|
9384
|
-
/* @__PURE__ */
|
|
9183
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", padding: 1, children: [
|
|
9184
|
+
/* @__PURE__ */ jsxs12(Text13, { color: theme.error, children: [
|
|
9385
9185
|
"Error: ",
|
|
9386
9186
|
error
|
|
9387
9187
|
] }),
|
|
9388
|
-
/* @__PURE__ */
|
|
9188
|
+
/* @__PURE__ */ jsx14(Text13, { dimColor: true, children: "Press R to retry, Esc to close" })
|
|
9389
9189
|
] });
|
|
9390
9190
|
}
|
|
9391
9191
|
if (sessions.length === 0) {
|
|
9392
|
-
return /* @__PURE__ */
|
|
9393
|
-
/* @__PURE__ */
|
|
9394
|
-
/* @__PURE__ */
|
|
9395
|
-
/* @__PURE__ */
|
|
9192
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", padding: 1, children: [
|
|
9193
|
+
/* @__PURE__ */ jsx14(Text13, { color: theme.accent, children: "No remote sessions yet." }),
|
|
9194
|
+
/* @__PURE__ */ jsx14(Text13, { dimColor: true, children: "Type /remote <prompt> to start one." }),
|
|
9195
|
+
/* @__PURE__ */ jsx14(Text13, { dimColor: true, children: "Press Esc to close" })
|
|
9396
9196
|
] });
|
|
9397
9197
|
}
|
|
9398
|
-
return /* @__PURE__ */
|
|
9399
|
-
/* @__PURE__ */
|
|
9198
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", padding: 1, children: [
|
|
9199
|
+
/* @__PURE__ */ jsxs12(Text13, { bold: true, color: theme.accent, children: [
|
|
9400
9200
|
"Recent remote tasks ",
|
|
9401
9201
|
refreshing ? "(refreshing...)" : ""
|
|
9402
9202
|
] }),
|
|
9403
|
-
/* @__PURE__ */
|
|
9404
|
-
|
|
9203
|
+
/* @__PURE__ */ jsx14(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx14(
|
|
9204
|
+
SelectInput5,
|
|
9405
9205
|
{
|
|
9406
9206
|
items,
|
|
9407
9207
|
onSelect: (item) => {
|
|
@@ -9410,7 +9210,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
9410
9210
|
}
|
|
9411
9211
|
}
|
|
9412
9212
|
) }),
|
|
9413
|
-
/* @__PURE__ */
|
|
9213
|
+
/* @__PURE__ */ jsx14(Box12, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text13, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter select \u2022 R refresh \u2022 Esc close" }) })
|
|
9414
9214
|
] });
|
|
9415
9215
|
}
|
|
9416
9216
|
function formatSessionLine(s) {
|
|
@@ -9442,8 +9242,8 @@ function RemoteSessionDetail({
|
|
|
9442
9242
|
onCancel
|
|
9443
9243
|
}) {
|
|
9444
9244
|
const theme = useTheme();
|
|
9445
|
-
const [cancelling, setCancelling] =
|
|
9446
|
-
|
|
9245
|
+
const [cancelling, setCancelling] = useState7(false);
|
|
9246
|
+
useInput3((input, key) => {
|
|
9447
9247
|
if (key.escape) {
|
|
9448
9248
|
onBack();
|
|
9449
9249
|
}
|
|
@@ -9463,50 +9263,50 @@ function RemoteSessionDetail({
|
|
|
9463
9263
|
}
|
|
9464
9264
|
}
|
|
9465
9265
|
const isRunning = session.status === "running" || session.status === "pending";
|
|
9466
|
-
return /* @__PURE__ */
|
|
9467
|
-
/* @__PURE__ */
|
|
9468
|
-
/* @__PURE__ */
|
|
9469
|
-
/* @__PURE__ */
|
|
9266
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", padding: 1, children: [
|
|
9267
|
+
/* @__PURE__ */ jsx14(Text13, { bold: true, color: theme.accent, children: "Remote Session" }),
|
|
9268
|
+
/* @__PURE__ */ jsxs12(Box12, { marginTop: 1, flexDirection: "column", children: [
|
|
9269
|
+
/* @__PURE__ */ jsxs12(Text13, { children: [
|
|
9470
9270
|
"ID: ",
|
|
9471
9271
|
session.sessionId
|
|
9472
9272
|
] }),
|
|
9473
|
-
/* @__PURE__ */
|
|
9273
|
+
/* @__PURE__ */ jsxs12(Text13, { children: [
|
|
9474
9274
|
"Repo: ",
|
|
9475
9275
|
session.repo
|
|
9476
9276
|
] }),
|
|
9477
|
-
/* @__PURE__ */
|
|
9277
|
+
/* @__PURE__ */ jsxs12(Text13, { children: [
|
|
9478
9278
|
"Status: ",
|
|
9479
9279
|
session.status
|
|
9480
9280
|
] }),
|
|
9481
|
-
/* @__PURE__ */
|
|
9281
|
+
/* @__PURE__ */ jsxs12(Text13, { children: [
|
|
9482
9282
|
"Prompt: ",
|
|
9483
9283
|
session.prompt
|
|
9484
9284
|
] }),
|
|
9485
|
-
session.prUrl && /* @__PURE__ */
|
|
9285
|
+
session.prUrl && /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
9486
9286
|
"PR: ",
|
|
9487
9287
|
session.prUrl
|
|
9488
9288
|
] }),
|
|
9489
|
-
session.errorMessage && /* @__PURE__ */
|
|
9289
|
+
session.errorMessage && /* @__PURE__ */ jsxs12(Text13, { color: theme.error, children: [
|
|
9490
9290
|
"Error: ",
|
|
9491
9291
|
session.errorMessage
|
|
9492
9292
|
] }),
|
|
9493
|
-
session.tokensUsed !== void 0 && /* @__PURE__ */
|
|
9293
|
+
session.tokensUsed !== void 0 && /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
9494
9294
|
"Tokens: ",
|
|
9495
9295
|
formatTokens3(session.tokensUsed),
|
|
9496
9296
|
session.tokensBudget ? ` / ${formatTokens3(session.tokensBudget)}` : ""
|
|
9497
9297
|
] }),
|
|
9498
|
-
/* @__PURE__ */
|
|
9298
|
+
/* @__PURE__ */ jsxs12(Text13, { children: [
|
|
9499
9299
|
"Created: ",
|
|
9500
9300
|
new Date(session.createdAt).toLocaleString()
|
|
9501
9301
|
] }),
|
|
9502
|
-
session.finishedAt && /* @__PURE__ */
|
|
9302
|
+
session.finishedAt && /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
9503
9303
|
"Finished: ",
|
|
9504
9304
|
new Date(session.finishedAt).toLocaleString()
|
|
9505
9305
|
] })
|
|
9506
9306
|
] }),
|
|
9507
|
-
/* @__PURE__ */
|
|
9508
|
-
isRunning && onCancel && /* @__PURE__ */
|
|
9509
|
-
/* @__PURE__ */
|
|
9307
|
+
/* @__PURE__ */ jsxs12(Box12, { marginTop: 1, flexDirection: "row", gap: 2, children: [
|
|
9308
|
+
isRunning && onCancel && /* @__PURE__ */ jsx14(Text13, { color: theme.error, children: cancelling ? "Cancelling..." : "[C] Cancel session" }),
|
|
9309
|
+
/* @__PURE__ */ jsx14(Text13, { dimColor: true, children: "Esc back" })
|
|
9510
9310
|
] })
|
|
9511
9311
|
] });
|
|
9512
9312
|
}
|
|
@@ -9563,6 +9363,240 @@ var init_classify = __esm({
|
|
|
9563
9363
|
}
|
|
9564
9364
|
});
|
|
9565
9365
|
|
|
9366
|
+
// src/skills/loader.ts
|
|
9367
|
+
import { readFile as readFile12, readdir as readdir3, stat as stat4 } from "fs/promises";
|
|
9368
|
+
import { join as join15, extname } from "path";
|
|
9369
|
+
import matter from "gray-matter";
|
|
9370
|
+
function normalizeManifest(raw, filePath) {
|
|
9371
|
+
const name = typeof raw.name === "string" ? raw.name : "";
|
|
9372
|
+
const description = typeof raw.description === "string" ? raw.description : "";
|
|
9373
|
+
const match = Array.isArray(raw.match) ? raw.match.filter((m) => typeof m === "string") : DEFAULTS.match;
|
|
9374
|
+
const scope = raw.scope === "project" ? "project" : DEFAULTS.scope;
|
|
9375
|
+
const priority = typeof raw.priority === "number" ? raw.priority : DEFAULTS.priority;
|
|
9376
|
+
const enabled = typeof raw.enabled === "boolean" ? raw.enabled : DEFAULTS.enabled;
|
|
9377
|
+
if (!name) {
|
|
9378
|
+
throw new Error(`Skill file missing required 'name' field: ${filePath}`);
|
|
9379
|
+
}
|
|
9380
|
+
return { name, description, match, scope, priority, enabled };
|
|
9381
|
+
}
|
|
9382
|
+
async function loadSkillFile(filePath) {
|
|
9383
|
+
const raw = await readFile12(filePath, "utf-8");
|
|
9384
|
+
const parsed = matter(raw);
|
|
9385
|
+
const manifest = normalizeManifest(parsed.data, filePath);
|
|
9386
|
+
const body = parsed.content.trim();
|
|
9387
|
+
const estimatedTokens = Math.ceil(body.length / 4);
|
|
9388
|
+
return {
|
|
9389
|
+
name: manifest.name,
|
|
9390
|
+
description: manifest.description,
|
|
9391
|
+
match: manifest.match ?? DEFAULTS.match,
|
|
9392
|
+
scope: manifest.scope ?? DEFAULTS.scope,
|
|
9393
|
+
priority: manifest.priority ?? DEFAULTS.priority,
|
|
9394
|
+
enabled: manifest.enabled ?? DEFAULTS.enabled,
|
|
9395
|
+
body,
|
|
9396
|
+
filePath,
|
|
9397
|
+
estimatedTokens
|
|
9398
|
+
};
|
|
9399
|
+
}
|
|
9400
|
+
async function loadSkillsFromDir(dirPath) {
|
|
9401
|
+
try {
|
|
9402
|
+
const entries = await readdir3(dirPath);
|
|
9403
|
+
const files = [];
|
|
9404
|
+
for (const entry of entries) {
|
|
9405
|
+
const full = join15(dirPath, entry);
|
|
9406
|
+
const s = await stat4(full);
|
|
9407
|
+
if (s.isFile() && extname(entry) === ".md") {
|
|
9408
|
+
files.push(full);
|
|
9409
|
+
}
|
|
9410
|
+
}
|
|
9411
|
+
const skills = await Promise.all(files.map(loadSkillFile));
|
|
9412
|
+
skills.sort((a, b) => a.priority - b.priority);
|
|
9413
|
+
return skills;
|
|
9414
|
+
} catch {
|
|
9415
|
+
return [];
|
|
9416
|
+
}
|
|
9417
|
+
}
|
|
9418
|
+
var DEFAULTS;
|
|
9419
|
+
var init_loader = __esm({
|
|
9420
|
+
"src/skills/loader.ts"() {
|
|
9421
|
+
"use strict";
|
|
9422
|
+
DEFAULTS = {
|
|
9423
|
+
scope: "global",
|
|
9424
|
+
priority: 0,
|
|
9425
|
+
enabled: true,
|
|
9426
|
+
match: []
|
|
9427
|
+
};
|
|
9428
|
+
}
|
|
9429
|
+
});
|
|
9430
|
+
|
|
9431
|
+
// src/skills/router.ts
|
|
9432
|
+
import { minimatch } from "minimatch";
|
|
9433
|
+
function matchSkill(skill, prompt, cwd) {
|
|
9434
|
+
if (!skill.enabled) return false;
|
|
9435
|
+
if (skill.match.length === 0) return true;
|
|
9436
|
+
for (const pattern of skill.match) {
|
|
9437
|
+
if (pattern.includes("/") || pattern.includes("*")) {
|
|
9438
|
+
if (minimatch(cwd, pattern) || minimatch(cwd, `**/${pattern}`)) {
|
|
9439
|
+
return true;
|
|
9440
|
+
}
|
|
9441
|
+
}
|
|
9442
|
+
if (prompt.toLowerCase().includes(pattern.toLowerCase())) {
|
|
9443
|
+
return true;
|
|
9444
|
+
}
|
|
9445
|
+
}
|
|
9446
|
+
return false;
|
|
9447
|
+
}
|
|
9448
|
+
function findConflicts(skill, memorySnippets) {
|
|
9449
|
+
const conflicts = [];
|
|
9450
|
+
for (const mem of memorySnippets) {
|
|
9451
|
+
const memLower = mem.toLowerCase();
|
|
9452
|
+
const skillLower = skill.name.toLowerCase();
|
|
9453
|
+
if (memLower.includes(skillLower) || skillLower.includes(memLower)) {
|
|
9454
|
+
conflicts.push({
|
|
9455
|
+
skillName: skill.name,
|
|
9456
|
+
memoryContent: mem.slice(0, 200),
|
|
9457
|
+
memoryId: ""
|
|
9458
|
+
// populated by caller if available
|
|
9459
|
+
});
|
|
9460
|
+
}
|
|
9461
|
+
}
|
|
9462
|
+
return conflicts;
|
|
9463
|
+
}
|
|
9464
|
+
function selectSkills(skills, options) {
|
|
9465
|
+
const tierBudget = TIER_BUDGETS[options.tier];
|
|
9466
|
+
const effectiveBudget = Math.min(tierBudget, options.maxSkillTokens);
|
|
9467
|
+
const matched = skills.filter((s) => matchSkill(s, options.prompt, options.cwd));
|
|
9468
|
+
const selected = [];
|
|
9469
|
+
const dropped = [];
|
|
9470
|
+
const allConflicts = [];
|
|
9471
|
+
let runningTotal = 0;
|
|
9472
|
+
for (const skill of matched) {
|
|
9473
|
+
const conflicts = findConflicts(skill, options.memorySnippets);
|
|
9474
|
+
allConflicts.push(...conflicts);
|
|
9475
|
+
if (runningTotal + skill.estimatedTokens <= effectiveBudget) {
|
|
9476
|
+
selected.push(skill);
|
|
9477
|
+
runningTotal += skill.estimatedTokens;
|
|
9478
|
+
} else {
|
|
9479
|
+
dropped.push(skill);
|
|
9480
|
+
}
|
|
9481
|
+
}
|
|
9482
|
+
const budgetUsed = effectiveBudget > 0 ? Math.round(runningTotal / effectiveBudget * 100) : 0;
|
|
9483
|
+
return {
|
|
9484
|
+
selectedSkills: selected,
|
|
9485
|
+
droppedSkills: dropped,
|
|
9486
|
+
totalSkillTokens: runningTotal,
|
|
9487
|
+
budgetUsed,
|
|
9488
|
+
memoryConflicts: allConflicts
|
|
9489
|
+
};
|
|
9490
|
+
}
|
|
9491
|
+
var TIER_BUDGETS;
|
|
9492
|
+
var init_router = __esm({
|
|
9493
|
+
"src/skills/router.ts"() {
|
|
9494
|
+
"use strict";
|
|
9495
|
+
TIER_BUDGETS = {
|
|
9496
|
+
light: 2e3,
|
|
9497
|
+
medium: 8e3,
|
|
9498
|
+
heavy: 24e3
|
|
9499
|
+
};
|
|
9500
|
+
}
|
|
9501
|
+
});
|
|
9502
|
+
|
|
9503
|
+
// src/skills/index.ts
|
|
9504
|
+
async function routeSkills(skillDir, opts2) {
|
|
9505
|
+
const skills = await loadSkillsFromDir(skillDir);
|
|
9506
|
+
return selectSkills(skills, opts2);
|
|
9507
|
+
}
|
|
9508
|
+
var init_skills = __esm({
|
|
9509
|
+
"src/skills/index.ts"() {
|
|
9510
|
+
"use strict";
|
|
9511
|
+
init_loader();
|
|
9512
|
+
init_router();
|
|
9513
|
+
}
|
|
9514
|
+
});
|
|
9515
|
+
|
|
9516
|
+
// src/skills/manager.ts
|
|
9517
|
+
import { mkdir as mkdir7, writeFile as writeFile8, unlink as unlink2, readFile as readFile13 } from "fs/promises";
|
|
9518
|
+
import { join as join16 } from "path";
|
|
9519
|
+
import matter2 from "gray-matter";
|
|
9520
|
+
function getSkillDirs(cwd) {
|
|
9521
|
+
return {
|
|
9522
|
+
projectDir: join16(cwd, ".kimiflare", "skills"),
|
|
9523
|
+
globalDir: join16(process.env.HOME ?? "", ".config", "kimiflare", "skills")
|
|
9524
|
+
};
|
|
9525
|
+
}
|
|
9526
|
+
async function listAllSkills(cwd) {
|
|
9527
|
+
const dirs = getSkillDirs(cwd);
|
|
9528
|
+
const [project, global] = await Promise.all([
|
|
9529
|
+
loadSkillsFromDir(dirs.projectDir).catch(() => []),
|
|
9530
|
+
loadSkillsFromDir(dirs.globalDir).catch(() => [])
|
|
9531
|
+
]);
|
|
9532
|
+
return { project, global };
|
|
9533
|
+
}
|
|
9534
|
+
async function createSkill(opts2) {
|
|
9535
|
+
const dirs = getSkillDirs(opts2.cwd);
|
|
9536
|
+
const dir = opts2.scope === "project" ? dirs.projectDir : dirs.globalDir;
|
|
9537
|
+
const filepath = join16(dir, `${opts2.name}.md`);
|
|
9538
|
+
const frontmatter = {
|
|
9539
|
+
name: opts2.name,
|
|
9540
|
+
enabled: true,
|
|
9541
|
+
priority: 0
|
|
9542
|
+
};
|
|
9543
|
+
if (opts2.description) frontmatter.description = opts2.description;
|
|
9544
|
+
if (opts2.match && opts2.match.length > 0) frontmatter.match = opts2.match;
|
|
9545
|
+
const yaml = Object.entries(frontmatter).map(([k, v]) => {
|
|
9546
|
+
if (Array.isArray(v)) return `${k}:
|
|
9547
|
+
${v.map((item) => ` - ${item}`).join("\n")}`;
|
|
9548
|
+
return `${k}: ${v}`;
|
|
9549
|
+
}).join("\n");
|
|
9550
|
+
const content = `---
|
|
9551
|
+
${yaml}
|
|
9552
|
+
---
|
|
9553
|
+
|
|
9554
|
+
# ${opts2.name}
|
|
9555
|
+
|
|
9556
|
+
Add your instructions here.
|
|
9557
|
+
`;
|
|
9558
|
+
await mkdir7(dir, { recursive: true });
|
|
9559
|
+
await writeFile8(filepath, content, "utf8");
|
|
9560
|
+
return { filepath };
|
|
9561
|
+
}
|
|
9562
|
+
async function deleteSkill(name, cwd) {
|
|
9563
|
+
const all = await listAllSkills(cwd);
|
|
9564
|
+
const skill = all.project.find((s) => s.name === name) ?? all.global.find((s) => s.name === name);
|
|
9565
|
+
if (!skill) throw new Error(`skill "${name}" not found`);
|
|
9566
|
+
await unlink2(skill.filePath);
|
|
9567
|
+
return { filepath: skill.filePath };
|
|
9568
|
+
}
|
|
9569
|
+
async function setSkillEnabled(name, enabled, cwd) {
|
|
9570
|
+
const all = await listAllSkills(cwd);
|
|
9571
|
+
const skill = all.project.find((s) => s.name === name) ?? all.global.find((s) => s.name === name);
|
|
9572
|
+
if (!skill) throw new Error(`skill "${name}" not found`);
|
|
9573
|
+
const raw = await readFile13(skill.filePath, "utf-8");
|
|
9574
|
+
const parsed = matter2(raw);
|
|
9575
|
+
parsed.data.enabled = enabled;
|
|
9576
|
+
const yaml = Object.entries(parsed.data).map(([k, v]) => {
|
|
9577
|
+
if (Array.isArray(v)) return `${k}:
|
|
9578
|
+
${v.map((item) => ` - ${item}`).join("\n")}`;
|
|
9579
|
+
return `${k}: ${v}`;
|
|
9580
|
+
}).join("\n");
|
|
9581
|
+
const content = `---
|
|
9582
|
+
${yaml}
|
|
9583
|
+
---
|
|
9584
|
+
${parsed.content}`;
|
|
9585
|
+
await writeFile8(skill.filePath, content, "utf8");
|
|
9586
|
+
return { filepath: skill.filePath };
|
|
9587
|
+
}
|
|
9588
|
+
async function findSkillFile(name, cwd) {
|
|
9589
|
+
const all = await listAllSkills(cwd);
|
|
9590
|
+
const skill = all.project.find((s) => s.name === name) ?? all.global.find((s) => s.name === name);
|
|
9591
|
+
return skill?.filePath ?? null;
|
|
9592
|
+
}
|
|
9593
|
+
var init_manager3 = __esm({
|
|
9594
|
+
"src/skills/manager.ts"() {
|
|
9595
|
+
"use strict";
|
|
9596
|
+
init_loader();
|
|
9597
|
+
}
|
|
9598
|
+
});
|
|
9599
|
+
|
|
9566
9600
|
// src/sessions.ts
|
|
9567
9601
|
var sessions_exports = {};
|
|
9568
9602
|
__export(sessions_exports, {
|
|
@@ -9572,12 +9606,12 @@ __export(sessions_exports, {
|
|
|
9572
9606
|
pruneSessions: () => pruneSessions,
|
|
9573
9607
|
saveSession: () => saveSession
|
|
9574
9608
|
});
|
|
9575
|
-
import { readFile as
|
|
9609
|
+
import { readFile as readFile14, writeFile as writeFile9, mkdir as mkdir8, readdir as readdir4, stat as stat5 } from "fs/promises";
|
|
9576
9610
|
import { homedir as homedir10 } from "os";
|
|
9577
|
-
import { join as
|
|
9611
|
+
import { join as join17 } from "path";
|
|
9578
9612
|
function sessionsDir2() {
|
|
9579
|
-
const xdg = process.env.XDG_DATA_HOME ||
|
|
9580
|
-
return
|
|
9613
|
+
const xdg = process.env.XDG_DATA_HOME || join17(homedir10(), ".local", "share");
|
|
9614
|
+
return join17(xdg, "kimiflare", "sessions");
|
|
9581
9615
|
}
|
|
9582
9616
|
function sanitize(text) {
|
|
9583
9617
|
return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
|
|
@@ -9589,9 +9623,9 @@ function makeSessionId(firstPrompt) {
|
|
|
9589
9623
|
}
|
|
9590
9624
|
async function saveSession(file) {
|
|
9591
9625
|
const dir = sessionsDir2();
|
|
9592
|
-
await
|
|
9593
|
-
const path =
|
|
9594
|
-
await
|
|
9626
|
+
await mkdir8(dir, { recursive: true });
|
|
9627
|
+
const path = join17(dir, `${file.id}.json`);
|
|
9628
|
+
await writeFile9(path, JSON.stringify(file, null, 2), "utf8");
|
|
9595
9629
|
return path;
|
|
9596
9630
|
}
|
|
9597
9631
|
async function pruneSessions() {
|
|
@@ -9603,16 +9637,16 @@ async function listSessions(limit = 30, cwd) {
|
|
|
9603
9637
|
const dir = sessionsDir2();
|
|
9604
9638
|
let entries;
|
|
9605
9639
|
try {
|
|
9606
|
-
entries = await
|
|
9640
|
+
entries = await readdir4(dir);
|
|
9607
9641
|
} catch {
|
|
9608
9642
|
return [];
|
|
9609
9643
|
}
|
|
9610
9644
|
const summaries = [];
|
|
9611
9645
|
for (const name of entries) {
|
|
9612
9646
|
if (!name.endsWith(".json")) continue;
|
|
9613
|
-
const path =
|
|
9647
|
+
const path = join17(dir, name);
|
|
9614
9648
|
try {
|
|
9615
|
-
const [s, raw] = await Promise.all([
|
|
9649
|
+
const [s, raw] = await Promise.all([stat5(path), readFile14(path, "utf8")]);
|
|
9616
9650
|
const parsed = JSON.parse(raw);
|
|
9617
9651
|
if (cwd && parsed.cwd !== cwd) continue;
|
|
9618
9652
|
const firstUser = parsed.messages.find((m) => m.role === "user");
|
|
@@ -9632,7 +9666,7 @@ async function listSessions(limit = 30, cwd) {
|
|
|
9632
9666
|
return summaries.slice(0, limit);
|
|
9633
9667
|
}
|
|
9634
9668
|
async function loadSession(filePath) {
|
|
9635
|
-
const raw = await
|
|
9669
|
+
const raw = await readFile14(filePath, "utf8");
|
|
9636
9670
|
return JSON.parse(raw);
|
|
9637
9671
|
}
|
|
9638
9672
|
var init_sessions = __esm({
|
|
@@ -9643,10 +9677,10 @@ var init_sessions = __esm({
|
|
|
9643
9677
|
});
|
|
9644
9678
|
|
|
9645
9679
|
// src/util/image.ts
|
|
9646
|
-
import { readFile as
|
|
9680
|
+
import { readFile as readFile15 } from "fs/promises";
|
|
9647
9681
|
import { basename as basename3 } from "path";
|
|
9648
9682
|
async function encodeImageFile(filePath) {
|
|
9649
|
-
const buf = await
|
|
9683
|
+
const buf = await readFile15(filePath);
|
|
9650
9684
|
if (buf.byteLength > MAX_IMAGE_BYTES) {
|
|
9651
9685
|
throw new Error(
|
|
9652
9686
|
`image too large (${(buf.byteLength / 1024 / 1024).toFixed(1)} MB); max is ${MAX_IMAGE_BYTES / 1024 / 1024} MB`
|
|
@@ -9682,15 +9716,15 @@ var init_image = __esm({
|
|
|
9682
9716
|
});
|
|
9683
9717
|
|
|
9684
9718
|
// src/usage-tracker.ts
|
|
9685
|
-
import { readFile as
|
|
9719
|
+
import { readFile as readFile16, writeFile as writeFile10, mkdir as mkdir9 } from "fs/promises";
|
|
9686
9720
|
import { homedir as homedir11 } from "os";
|
|
9687
|
-
import { join as
|
|
9721
|
+
import { join as join18 } from "path";
|
|
9688
9722
|
function usageDir2() {
|
|
9689
|
-
const xdg = process.env.XDG_DATA_HOME ||
|
|
9690
|
-
return
|
|
9723
|
+
const xdg = process.env.XDG_DATA_HOME || join18(homedir11(), ".local", "share");
|
|
9724
|
+
return join18(xdg, "kimiflare");
|
|
9691
9725
|
}
|
|
9692
9726
|
function usagePath2() {
|
|
9693
|
-
return
|
|
9727
|
+
return join18(usageDir2(), "usage.json");
|
|
9694
9728
|
}
|
|
9695
9729
|
function today2() {
|
|
9696
9730
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
@@ -9701,7 +9735,7 @@ function cutoffDate(daysBack) {
|
|
|
9701
9735
|
}
|
|
9702
9736
|
async function loadLog2() {
|
|
9703
9737
|
try {
|
|
9704
|
-
const raw = await
|
|
9738
|
+
const raw = await readFile16(usagePath2(), "utf8");
|
|
9705
9739
|
const parsed = JSON.parse(raw);
|
|
9706
9740
|
if (parsed.version === LOG_VERSION2) return parsed;
|
|
9707
9741
|
} catch {
|
|
@@ -9709,8 +9743,8 @@ async function loadLog2() {
|
|
|
9709
9743
|
return { version: LOG_VERSION2, days: [], sessions: [] };
|
|
9710
9744
|
}
|
|
9711
9745
|
async function saveLog(log) {
|
|
9712
|
-
await
|
|
9713
|
-
await
|
|
9746
|
+
await mkdir9(usageDir2(), { recursive: true });
|
|
9747
|
+
await writeFile10(usagePath2(), JSON.stringify(log, null, 2), "utf8");
|
|
9714
9748
|
}
|
|
9715
9749
|
function getOrCreateDay(log, date) {
|
|
9716
9750
|
let day = log.days.find((d) => d.date === date);
|
|
@@ -9926,7 +9960,7 @@ __export(db_exports, {
|
|
|
9926
9960
|
updateMemoryEmbedding: () => updateMemoryEmbedding
|
|
9927
9961
|
});
|
|
9928
9962
|
import Database from "better-sqlite3";
|
|
9929
|
-
import { dirname as
|
|
9963
|
+
import { dirname as dirname8 } from "path";
|
|
9930
9964
|
import { mkdirSync, statSync as statSync2 } from "fs";
|
|
9931
9965
|
function initSchema(db) {
|
|
9932
9966
|
db.exec(`
|
|
@@ -10011,7 +10045,7 @@ function openMemoryDb(dbPath) {
|
|
|
10011
10045
|
if (dbInstance) {
|
|
10012
10046
|
dbInstance.close();
|
|
10013
10047
|
}
|
|
10014
|
-
mkdirSync(
|
|
10048
|
+
mkdirSync(dirname8(dbPath), { recursive: true });
|
|
10015
10049
|
dbInstance = new Database(dbPath);
|
|
10016
10050
|
dbInstance.pragma("journal_mode = WAL");
|
|
10017
10051
|
dbInstance.pragma("foreign_keys = ON");
|
|
@@ -10661,7 +10695,7 @@ function pickTopicKey(content, existingKeys) {
|
|
|
10661
10695
|
return normalized;
|
|
10662
10696
|
}
|
|
10663
10697
|
var SECRET_PATTERNS, VERIFY_SYSTEM, HYPOTHETICAL_QUERIES_SYSTEM, MemoryManager;
|
|
10664
|
-
var
|
|
10698
|
+
var init_manager4 = __esm({
|
|
10665
10699
|
"src/memory/manager.ts"() {
|
|
10666
10700
|
"use strict";
|
|
10667
10701
|
init_client();
|
|
@@ -11006,16 +11040,16 @@ Context: This memory was explicitly provided by the user during a conversation.`
|
|
|
11006
11040
|
});
|
|
11007
11041
|
|
|
11008
11042
|
// src/util/state.ts
|
|
11009
|
-
import { readFile as
|
|
11043
|
+
import { readFile as readFile17, writeFile as writeFile11, mkdir as mkdir10 } from "fs/promises";
|
|
11010
11044
|
import { homedir as homedir12 } from "os";
|
|
11011
|
-
import { join as
|
|
11045
|
+
import { join as join20 } from "path";
|
|
11012
11046
|
function statePath() {
|
|
11013
|
-
const xdg = process.env.XDG_CONFIG_HOME ||
|
|
11014
|
-
return
|
|
11047
|
+
const xdg = process.env.XDG_CONFIG_HOME || join20(homedir12(), ".config");
|
|
11048
|
+
return join20(xdg, "kimiflare", "state.json");
|
|
11015
11049
|
}
|
|
11016
11050
|
async function readState() {
|
|
11017
11051
|
try {
|
|
11018
|
-
const raw = await
|
|
11052
|
+
const raw = await readFile17(statePath(), "utf8");
|
|
11019
11053
|
return JSON.parse(raw);
|
|
11020
11054
|
} catch {
|
|
11021
11055
|
return {};
|
|
@@ -11023,8 +11057,8 @@ async function readState() {
|
|
|
11023
11057
|
}
|
|
11024
11058
|
async function writeState(state) {
|
|
11025
11059
|
const path = statePath();
|
|
11026
|
-
await
|
|
11027
|
-
await
|
|
11060
|
+
await mkdir10(join20(path, ".."), { recursive: true });
|
|
11061
|
+
await writeFile11(path, JSON.stringify(state, null, 2) + "\n", "utf8");
|
|
11028
11062
|
}
|
|
11029
11063
|
async function markCreatorMessageSeen(version) {
|
|
11030
11064
|
const state = await readState();
|
|
@@ -11098,14 +11132,14 @@ var init_frontmatter = __esm({
|
|
|
11098
11132
|
// src/commands/loader.ts
|
|
11099
11133
|
import { open, realpath } from "fs/promises";
|
|
11100
11134
|
import { homedir as homedir13 } from "os";
|
|
11101
|
-
import { join as
|
|
11135
|
+
import { join as join21, relative as relative4, sep as sep2 } from "path";
|
|
11102
11136
|
import fg3 from "fast-glob";
|
|
11103
11137
|
function projectCommandsDir(cwd = process.cwd()) {
|
|
11104
|
-
return
|
|
11138
|
+
return join21(cwd, ".kimiflare", "commands");
|
|
11105
11139
|
}
|
|
11106
11140
|
function globalCommandsDir() {
|
|
11107
|
-
const xdg = process.env.XDG_CONFIG_HOME ||
|
|
11108
|
-
return
|
|
11141
|
+
const xdg = process.env.XDG_CONFIG_HOME || join21(homedir13(), ".config");
|
|
11142
|
+
return join21(xdg, "kimiflare", "commands");
|
|
11109
11143
|
}
|
|
11110
11144
|
async function loadCustomCommands(cwd = process.cwd()) {
|
|
11111
11145
|
const warnings = [];
|
|
@@ -11244,7 +11278,7 @@ function filenameToCommandName(file, rootDir) {
|
|
|
11244
11278
|
return parts.join("/");
|
|
11245
11279
|
}
|
|
11246
11280
|
var MAX_COMMAND_FILE_BYTES;
|
|
11247
|
-
var
|
|
11281
|
+
var init_loader2 = __esm({
|
|
11248
11282
|
"src/commands/loader.ts"() {
|
|
11249
11283
|
"use strict";
|
|
11250
11284
|
init_mode();
|
|
@@ -11462,6 +11496,7 @@ var init_builtins = __esm({
|
|
|
11462
11496
|
{ name: "gateway", argHint: "[status|off|<id>|cache-ttl|skip-cache|...]", description: "Manage AI Gateway", source: "builtin" },
|
|
11463
11497
|
{ name: "mcp", argHint: "[list|reload]", description: "Manage MCP servers", source: "builtin" },
|
|
11464
11498
|
{ name: "lsp", argHint: "[config|list|reload|scope]", description: "Manage language servers", source: "builtin" },
|
|
11499
|
+
{ name: "skills", argHint: "[list|add|edit|delete|enable|disable]", description: "Manage skills", source: "builtin" },
|
|
11465
11500
|
{ name: "command", argHint: "[create|edit|delete|list]", description: "Manage custom slash commands", source: "builtin" },
|
|
11466
11501
|
{ name: "resume", description: "Pick a past conversation to resume", source: "builtin" },
|
|
11467
11502
|
{ name: "compact", description: "Summarize old turns to free context", source: "builtin" },
|
|
@@ -11481,8 +11516,8 @@ var init_builtins = __esm({
|
|
|
11481
11516
|
});
|
|
11482
11517
|
|
|
11483
11518
|
// src/commands/save.ts
|
|
11484
|
-
import { mkdir as
|
|
11485
|
-
import { dirname as
|
|
11519
|
+
import { mkdir as mkdir11, writeFile as writeFile12, unlink as unlink3 } from "fs/promises";
|
|
11520
|
+
import { dirname as dirname9 } from "path";
|
|
11486
11521
|
async function saveCustomCommand(opts2) {
|
|
11487
11522
|
const dir = opts2.source === "project" ? projectCommandsDir(opts2.cwd) : globalCommandsDir();
|
|
11488
11523
|
const filepath = `${dir}/${opts2.name}.md`;
|
|
@@ -11493,37 +11528,37 @@ async function saveCustomCommand(opts2) {
|
|
|
11493
11528
|
if (opts2.effort) data.effort = opts2.effort;
|
|
11494
11529
|
const frontmatter = serializeFrontmatter(data);
|
|
11495
11530
|
const content = frontmatter + opts2.template;
|
|
11496
|
-
await
|
|
11497
|
-
await
|
|
11531
|
+
await mkdir11(dirname9(filepath), { recursive: true });
|
|
11532
|
+
await writeFile12(filepath, content, "utf8");
|
|
11498
11533
|
return { filepath };
|
|
11499
11534
|
}
|
|
11500
11535
|
async function deleteCustomCommand(cmd) {
|
|
11501
|
-
await
|
|
11536
|
+
await unlink3(cmd.filepath);
|
|
11502
11537
|
}
|
|
11503
11538
|
var init_save = __esm({
|
|
11504
11539
|
"src/commands/save.ts"() {
|
|
11505
11540
|
"use strict";
|
|
11506
11541
|
init_frontmatter();
|
|
11507
|
-
|
|
11542
|
+
init_loader2();
|
|
11508
11543
|
}
|
|
11509
11544
|
});
|
|
11510
11545
|
|
|
11511
11546
|
// src/ui/command-wizard.tsx
|
|
11512
|
-
import { useState as
|
|
11513
|
-
import { Box as
|
|
11514
|
-
import
|
|
11515
|
-
import { Fragment as Fragment2, jsx as
|
|
11547
|
+
import { useState as useState8 } from "react";
|
|
11548
|
+
import { Box as Box13, Text as Text14, useInput as useInput4, useWindowSize as useWindowSize2 } from "ink";
|
|
11549
|
+
import SelectInput6 from "ink-select-input";
|
|
11550
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
11516
11551
|
function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onSave }) {
|
|
11517
11552
|
const theme = useTheme();
|
|
11518
|
-
const [step, setStep] =
|
|
11519
|
-
const [name, setName] =
|
|
11520
|
-
const [description, setDescription] =
|
|
11521
|
-
const [template, setTemplate] =
|
|
11522
|
-
const [cmdMode, setCmdMode] =
|
|
11523
|
-
const [cmdEffort, setCmdEffort] =
|
|
11524
|
-
const [cmdModel, setCmdModel] =
|
|
11525
|
-
const [source, setSource] =
|
|
11526
|
-
const [error, setError] =
|
|
11553
|
+
const [step, setStep] = useState8("name");
|
|
11554
|
+
const [name, setName] = useState8(initial?.name ?? "");
|
|
11555
|
+
const [description, setDescription] = useState8(initial?.description ?? "");
|
|
11556
|
+
const [template, setTemplate] = useState8(initial?.template ?? "");
|
|
11557
|
+
const [cmdMode, setCmdMode] = useState8(initial?.mode);
|
|
11558
|
+
const [cmdEffort, setCmdEffort] = useState8(initial?.effort);
|
|
11559
|
+
const [cmdModel, setCmdModel] = useState8(initial?.model);
|
|
11560
|
+
const [source, setSource] = useState8(initial?.source ?? "project");
|
|
11561
|
+
const [error, setError] = useState8(null);
|
|
11527
11562
|
const { columns } = useWindowSize2();
|
|
11528
11563
|
const totalSteps = 5;
|
|
11529
11564
|
const stepIndex = step === "name" ? 1 : step === "description" ? 2 : step === "template" ? 3 : step === "advanced" || step === "mode" || step === "effort" || step === "model" ? 4 : step === "location" ? 4 : 5;
|
|
@@ -11536,7 +11571,7 @@ function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onS
|
|
|
11536
11571
|
if (existingNames.includes(trimmed) && !isEditingSelf(trimmed)) return `/${trimmed} already exists`;
|
|
11537
11572
|
return null;
|
|
11538
11573
|
};
|
|
11539
|
-
|
|
11574
|
+
useInput4((_input, key) => {
|
|
11540
11575
|
if (key.escape) {
|
|
11541
11576
|
onDone();
|
|
11542
11577
|
}
|
|
@@ -11636,8 +11671,8 @@ ${template}`;
|
|
|
11636
11671
|
const renderStep = () => {
|
|
11637
11672
|
switch (step) {
|
|
11638
11673
|
case "name":
|
|
11639
|
-
return /* @__PURE__ */
|
|
11640
|
-
/* @__PURE__ */
|
|
11674
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11675
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11641
11676
|
mode === "create" ? "Create" : "Edit",
|
|
11642
11677
|
" custom command \u2014 Name (",
|
|
11643
11678
|
stepIndex,
|
|
@@ -11645,8 +11680,8 @@ ${template}`;
|
|
|
11645
11680
|
totalSteps,
|
|
11646
11681
|
")"
|
|
11647
11682
|
] }),
|
|
11648
|
-
error && /* @__PURE__ */
|
|
11649
|
-
/* @__PURE__ */
|
|
11683
|
+
error && /* @__PURE__ */ jsx15(Text14, { color: theme.error, children: error }),
|
|
11684
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11650
11685
|
CustomTextInput,
|
|
11651
11686
|
{
|
|
11652
11687
|
value: name,
|
|
@@ -11655,11 +11690,11 @@ ${template}`;
|
|
|
11655
11690
|
focus: true
|
|
11656
11691
|
}
|
|
11657
11692
|
) }),
|
|
11658
|
-
/* @__PURE__ */
|
|
11693
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "letters, numbers, _ - / only; must start with a letter" })
|
|
11659
11694
|
] });
|
|
11660
11695
|
case "description":
|
|
11661
|
-
return /* @__PURE__ */
|
|
11662
|
-
/* @__PURE__ */
|
|
11696
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11697
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11663
11698
|
mode === "create" ? "Create" : "Edit",
|
|
11664
11699
|
" custom command \u2014 Description (",
|
|
11665
11700
|
stepIndex,
|
|
@@ -11667,7 +11702,7 @@ ${template}`;
|
|
|
11667
11702
|
totalSteps,
|
|
11668
11703
|
")"
|
|
11669
11704
|
] }),
|
|
11670
|
-
/* @__PURE__ */
|
|
11705
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11671
11706
|
CustomTextInput,
|
|
11672
11707
|
{
|
|
11673
11708
|
value: description,
|
|
@@ -11676,49 +11711,49 @@ ${template}`;
|
|
|
11676
11711
|
focus: true
|
|
11677
11712
|
}
|
|
11678
11713
|
) }),
|
|
11679
|
-
/* @__PURE__ */
|
|
11714
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Press Enter to skip" })
|
|
11680
11715
|
] });
|
|
11681
11716
|
case "template": {
|
|
11682
|
-
const guide = /* @__PURE__ */
|
|
11683
|
-
/* @__PURE__ */
|
|
11684
|
-
/* @__PURE__ */
|
|
11685
|
-
/* @__PURE__ */
|
|
11717
|
+
const guide = /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingLeft: 1, children: [
|
|
11718
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.accent, bold: true, children: "What is this?" }),
|
|
11719
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "A prompt template \u2014 instructions to the AI." }),
|
|
11720
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
11686
11721
|
"When you type /",
|
|
11687
11722
|
name || "yourcommand",
|
|
11688
11723
|
" later, this gets sent to the model."
|
|
11689
11724
|
] }),
|
|
11690
|
-
/* @__PURE__ */
|
|
11691
|
-
/* @__PURE__ */
|
|
11692
|
-
/* @__PURE__ */
|
|
11725
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
11726
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.accent, bold: true, children: "Variables" }),
|
|
11727
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
11693
11728
|
" ",
|
|
11694
11729
|
"$1, $2 ... \u2192 arguments you type"
|
|
11695
11730
|
] }),
|
|
11696
|
-
/* @__PURE__ */
|
|
11731
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
11697
11732
|
" ",
|
|
11698
11733
|
"$ARGUMENTS \u2192 everything after the command"
|
|
11699
11734
|
] })
|
|
11700
11735
|
] }),
|
|
11701
|
-
/* @__PURE__ */
|
|
11702
|
-
/* @__PURE__ */
|
|
11703
|
-
/* @__PURE__ */
|
|
11736
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
11737
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.accent, bold: true, children: "Dynamic inlines" }),
|
|
11738
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
11704
11739
|
" ",
|
|
11705
11740
|
"!`git diff` \u2192 shell output inlined"
|
|
11706
11741
|
] }),
|
|
11707
|
-
/* @__PURE__ */
|
|
11742
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
11708
11743
|
" ",
|
|
11709
11744
|
"@README.md \u2192 file contents inlined"
|
|
11710
11745
|
] })
|
|
11711
11746
|
] }),
|
|
11712
|
-
/* @__PURE__ */
|
|
11713
|
-
/* @__PURE__ */
|
|
11714
|
-
/* @__PURE__ */
|
|
11715
|
-
/* @__PURE__ */
|
|
11716
|
-
/* @__PURE__ */
|
|
11747
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
11748
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.accent, bold: true, children: "Example" }),
|
|
11749
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Review this PR diff:" }),
|
|
11750
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "!`git diff main...HEAD`" }),
|
|
11751
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Focus on: $1" })
|
|
11717
11752
|
] })
|
|
11718
11753
|
] });
|
|
11719
|
-
const inputArea = /* @__PURE__ */
|
|
11720
|
-
error && /* @__PURE__ */
|
|
11721
|
-
/* @__PURE__ */
|
|
11754
|
+
const inputArea = /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", flexGrow: 1, children: [
|
|
11755
|
+
error && /* @__PURE__ */ jsx15(Text14, { color: theme.error, children: error }),
|
|
11756
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11722
11757
|
CustomTextInput,
|
|
11723
11758
|
{
|
|
11724
11759
|
value: template,
|
|
@@ -11728,13 +11763,13 @@ ${template}`;
|
|
|
11728
11763
|
enablePaste: true
|
|
11729
11764
|
}
|
|
11730
11765
|
) }),
|
|
11731
|
-
columns < 100 && /* @__PURE__ */
|
|
11732
|
-
/* @__PURE__ */
|
|
11733
|
-
/* @__PURE__ */
|
|
11766
|
+
columns < 100 && /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11767
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Paste multi-line templates with Ctrl+V." }),
|
|
11768
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Variables: $1 $2 ... $ARGUMENTS Shell: !`cmd` File: @path" })
|
|
11734
11769
|
] })
|
|
11735
11770
|
] });
|
|
11736
|
-
return /* @__PURE__ */
|
|
11737
|
-
/* @__PURE__ */
|
|
11771
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11772
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11738
11773
|
mode === "create" ? "Create" : "Edit",
|
|
11739
11774
|
" custom command \u2014 Template (",
|
|
11740
11775
|
stepIndex,
|
|
@@ -11742,10 +11777,10 @@ ${template}`;
|
|
|
11742
11777
|
totalSteps,
|
|
11743
11778
|
")"
|
|
11744
11779
|
] }),
|
|
11745
|
-
columns >= 100 ? /* @__PURE__ */
|
|
11746
|
-
/* @__PURE__ */
|
|
11747
|
-
/* @__PURE__ */
|
|
11748
|
-
] }) : /* @__PURE__ */
|
|
11780
|
+
columns >= 100 ? /* @__PURE__ */ jsxs13(Box13, { flexDirection: "row", marginTop: 1, children: [
|
|
11781
|
+
/* @__PURE__ */ jsx15(Box13, { flexDirection: "column", width: "50%", children: inputArea }),
|
|
11782
|
+
/* @__PURE__ */ jsx15(Box13, { flexDirection: "column", width: "50%", children: guide })
|
|
11783
|
+
] }) : /* @__PURE__ */ jsx15(Box13, { flexDirection: "column", marginTop: 1, children: inputArea })
|
|
11749
11784
|
] });
|
|
11750
11785
|
}
|
|
11751
11786
|
case "advanced": {
|
|
@@ -11754,8 +11789,8 @@ ${template}`;
|
|
|
11754
11789
|
{ label: "Skip", value: "skip", key: "skip" },
|
|
11755
11790
|
{ label: "\u2190 Cancel", value: "cancel", key: "cancel" }
|
|
11756
11791
|
];
|
|
11757
|
-
return /* @__PURE__ */
|
|
11758
|
-
/* @__PURE__ */
|
|
11792
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11793
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11759
11794
|
mode === "create" ? "Create" : "Edit",
|
|
11760
11795
|
" custom command \u2014 Options (",
|
|
11761
11796
|
stepIndex,
|
|
@@ -11763,8 +11798,8 @@ ${template}`;
|
|
|
11763
11798
|
totalSteps,
|
|
11764
11799
|
")"
|
|
11765
11800
|
] }),
|
|
11766
|
-
/* @__PURE__ */
|
|
11767
|
-
|
|
11801
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11802
|
+
SelectInput6,
|
|
11768
11803
|
{
|
|
11769
11804
|
items,
|
|
11770
11805
|
onSelect: (item) => {
|
|
@@ -11783,17 +11818,17 @@ ${template}`;
|
|
|
11783
11818
|
{ label: cmdMode === "auto" ? "auto \xB7 current" : "auto", value: "auto", key: "auto" },
|
|
11784
11819
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
11785
11820
|
];
|
|
11786
|
-
return /* @__PURE__ */
|
|
11787
|
-
/* @__PURE__ */
|
|
11821
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11822
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11788
11823
|
"Mode override (",
|
|
11789
11824
|
stepIndex,
|
|
11790
11825
|
"/",
|
|
11791
11826
|
totalSteps,
|
|
11792
11827
|
")"
|
|
11793
11828
|
] }),
|
|
11794
|
-
/* @__PURE__ */
|
|
11795
|
-
/* @__PURE__ */
|
|
11796
|
-
|
|
11829
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Saved to file but not yet enforced at runtime" }),
|
|
11830
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11831
|
+
SelectInput6,
|
|
11797
11832
|
{
|
|
11798
11833
|
items,
|
|
11799
11834
|
onSelect: (item) => {
|
|
@@ -11812,16 +11847,16 @@ ${template}`;
|
|
|
11812
11847
|
{ label: cmdEffort === "high" ? "high \xB7 current" : "high", value: "high", key: "high" },
|
|
11813
11848
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
11814
11849
|
];
|
|
11815
|
-
return /* @__PURE__ */
|
|
11816
|
-
/* @__PURE__ */
|
|
11850
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11851
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11817
11852
|
"Reasoning effort (",
|
|
11818
11853
|
stepIndex,
|
|
11819
11854
|
"/",
|
|
11820
11855
|
totalSteps,
|
|
11821
11856
|
")"
|
|
11822
11857
|
] }),
|
|
11823
|
-
/* @__PURE__ */
|
|
11824
|
-
|
|
11858
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11859
|
+
SelectInput6,
|
|
11825
11860
|
{
|
|
11826
11861
|
items,
|
|
11827
11862
|
onSelect: (item) => {
|
|
@@ -11833,15 +11868,15 @@ ${template}`;
|
|
|
11833
11868
|
] });
|
|
11834
11869
|
}
|
|
11835
11870
|
case "model":
|
|
11836
|
-
return /* @__PURE__ */
|
|
11837
|
-
/* @__PURE__ */
|
|
11871
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11872
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11838
11873
|
"Model override (",
|
|
11839
11874
|
stepIndex,
|
|
11840
11875
|
"/",
|
|
11841
11876
|
totalSteps,
|
|
11842
11877
|
")"
|
|
11843
11878
|
] }),
|
|
11844
|
-
/* @__PURE__ */
|
|
11879
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11845
11880
|
CustomTextInput,
|
|
11846
11881
|
{
|
|
11847
11882
|
value: cmdModel ?? "",
|
|
@@ -11850,7 +11885,7 @@ ${template}`;
|
|
|
11850
11885
|
focus: true
|
|
11851
11886
|
}
|
|
11852
11887
|
) }),
|
|
11853
|
-
/* @__PURE__ */
|
|
11888
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Press Enter to skip" })
|
|
11854
11889
|
] });
|
|
11855
11890
|
case "location": {
|
|
11856
11891
|
const items = [
|
|
@@ -11858,16 +11893,16 @@ ${template}`;
|
|
|
11858
11893
|
{ label: source === "global" ? "Global \xB7 current" : "Global", value: "global", key: "global" },
|
|
11859
11894
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
11860
11895
|
];
|
|
11861
|
-
return /* @__PURE__ */
|
|
11862
|
-
/* @__PURE__ */
|
|
11896
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11897
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11863
11898
|
"Save location (",
|
|
11864
11899
|
stepIndex,
|
|
11865
11900
|
"/",
|
|
11866
11901
|
totalSteps,
|
|
11867
11902
|
")"
|
|
11868
11903
|
] }),
|
|
11869
|
-
/* @__PURE__ */
|
|
11870
|
-
|
|
11904
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11905
|
+
SelectInput6,
|
|
11871
11906
|
{
|
|
11872
11907
|
items,
|
|
11873
11908
|
onSelect: (item) => {
|
|
@@ -11876,7 +11911,7 @@ ${template}`;
|
|
|
11876
11911
|
}
|
|
11877
11912
|
}
|
|
11878
11913
|
) }),
|
|
11879
|
-
/* @__PURE__ */
|
|
11914
|
+
/* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: "Project: .kimiflare/commands/ Global: ~/.config/kimiflare/commands/" })
|
|
11880
11915
|
] });
|
|
11881
11916
|
}
|
|
11882
11917
|
case "confirm": {
|
|
@@ -11884,8 +11919,8 @@ ${template}`;
|
|
|
11884
11919
|
{ label: "Save", value: "save", key: "save" },
|
|
11885
11920
|
{ label: "Cancel", value: "cancel", key: "cancel" }
|
|
11886
11921
|
];
|
|
11887
|
-
return /* @__PURE__ */
|
|
11888
|
-
/* @__PURE__ */
|
|
11922
|
+
return /* @__PURE__ */ jsxs13(Fragment2, { children: [
|
|
11923
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
11889
11924
|
mode === "create" ? "Create" : "Edit",
|
|
11890
11925
|
" custom command \u2014 Confirm (",
|
|
11891
11926
|
stepIndex,
|
|
@@ -11893,14 +11928,14 @@ ${template}`;
|
|
|
11893
11928
|
totalSteps,
|
|
11894
11929
|
")"
|
|
11895
11930
|
] }),
|
|
11896
|
-
/* @__PURE__ */
|
|
11931
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
11897
11932
|
source === "project" ? ".kimiflare/commands/" : "~/.config/kimiflare/commands/",
|
|
11898
11933
|
name,
|
|
11899
11934
|
".md"
|
|
11900
11935
|
] }),
|
|
11901
|
-
/* @__PURE__ */
|
|
11902
|
-
/* @__PURE__ */
|
|
11903
|
-
|
|
11936
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, flexDirection: "column", children: previewContent().split("\n").map((line, i) => /* @__PURE__ */ jsx15(Text14, { color: theme.info.color, children: line || " " }, i)) }),
|
|
11937
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(
|
|
11938
|
+
SelectInput6,
|
|
11904
11939
|
{
|
|
11905
11940
|
items,
|
|
11906
11941
|
onSelect: (item) => handleConfirm(item.value)
|
|
@@ -11910,7 +11945,7 @@ ${template}`;
|
|
|
11910
11945
|
}
|
|
11911
11946
|
}
|
|
11912
11947
|
};
|
|
11913
|
-
return /* @__PURE__ */
|
|
11948
|
+
return /* @__PURE__ */ jsx15(Box13, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: renderStep() });
|
|
11914
11949
|
}
|
|
11915
11950
|
var NAME_RE;
|
|
11916
11951
|
var init_command_wizard = __esm({
|
|
@@ -11924,12 +11959,12 @@ var init_command_wizard = __esm({
|
|
|
11924
11959
|
|
|
11925
11960
|
// src/init/context-generator.ts
|
|
11926
11961
|
import { existsSync as existsSync2, statSync as statSync3 } from "fs";
|
|
11927
|
-
import { join as
|
|
11962
|
+
import { join as join22 } from "path";
|
|
11928
11963
|
function detectFlavor(cwd) {
|
|
11929
11964
|
for (const [flavor, signatures] of Object.entries(FLAVOR_SIGNATURES)) {
|
|
11930
11965
|
if (flavor === "generic") continue;
|
|
11931
11966
|
for (const sig of signatures) {
|
|
11932
|
-
const path =
|
|
11967
|
+
const path = join22(cwd, sig);
|
|
11933
11968
|
if (sig.includes("*")) {
|
|
11934
11969
|
try {
|
|
11935
11970
|
const parts = sig.split("*");
|
|
@@ -11950,14 +11985,14 @@ function detectFlavor(cwd) {
|
|
|
11950
11985
|
}
|
|
11951
11986
|
function findFile(cwd, candidates) {
|
|
11952
11987
|
for (const c of candidates) {
|
|
11953
|
-
if (existsSync2(
|
|
11988
|
+
if (existsSync2(join22(cwd, c))) return c;
|
|
11954
11989
|
}
|
|
11955
11990
|
return null;
|
|
11956
11991
|
}
|
|
11957
11992
|
function findSourceRoots(cwd) {
|
|
11958
11993
|
const roots = [];
|
|
11959
11994
|
for (const r of SOURCE_ROOT_CANDIDATES) {
|
|
11960
|
-
const p =
|
|
11995
|
+
const p = join22(cwd, r);
|
|
11961
11996
|
try {
|
|
11962
11997
|
const s = statSync3(p);
|
|
11963
11998
|
if (s.isDirectory()) roots.push(r);
|
|
@@ -11968,9 +12003,9 @@ function findSourceRoots(cwd) {
|
|
|
11968
12003
|
}
|
|
11969
12004
|
function findCiConfig(cwd) {
|
|
11970
12005
|
for (const c of CI_PATHS) {
|
|
11971
|
-
if (existsSync2(
|
|
12006
|
+
if (existsSync2(join22(cwd, c))) {
|
|
11972
12007
|
try {
|
|
11973
|
-
const s = statSync3(
|
|
12008
|
+
const s = statSync3(join22(cwd, c));
|
|
11974
12009
|
return s.isDirectory() ? c : c;
|
|
11975
12010
|
} catch {
|
|
11976
12011
|
}
|
|
@@ -12107,7 +12142,7 @@ function analyzeProject(cwd) {
|
|
|
12107
12142
|
ciConfig: findCiConfig(cwd),
|
|
12108
12143
|
readme: findFile(cwd, ["README.md", "README.rst", "README.txt", "Readme.md"]),
|
|
12109
12144
|
sourceRoots: findSourceRoots(cwd),
|
|
12110
|
-
hasGit: existsSync2(
|
|
12145
|
+
hasGit: existsSync2(join22(cwd, ".git"))
|
|
12111
12146
|
};
|
|
12112
12147
|
}
|
|
12113
12148
|
function bashDiscoveryCommands(profile) {
|
|
@@ -12272,7 +12307,7 @@ Aim for 100\u2013200 lines total. Use markdown tables where they save space.
|
|
|
12272
12307
|
}
|
|
12273
12308
|
function buildInitPrompt(cwd) {
|
|
12274
12309
|
const existingName = ["KIMI.md", "KIMIFLARE.md", "AGENT.md"].find(
|
|
12275
|
-
(n) => existsSync2(
|
|
12310
|
+
(n) => existsSync2(join22(cwd, n))
|
|
12276
12311
|
);
|
|
12277
12312
|
const isRefresh = existingName !== void 0;
|
|
12278
12313
|
const targetFilename = existingName ?? "KIMI.md";
|
|
@@ -12355,9 +12390,9 @@ var init_context_generator = __esm({
|
|
|
12355
12390
|
});
|
|
12356
12391
|
|
|
12357
12392
|
// src/ui/command-picker.tsx
|
|
12358
|
-
import { Box as
|
|
12359
|
-
import
|
|
12360
|
-
import { jsx as
|
|
12393
|
+
import { Box as Box14, Text as Text15 } from "ink";
|
|
12394
|
+
import SelectInput7 from "ink-select-input";
|
|
12395
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
12361
12396
|
function CommandPicker({ commands, title, onPick }) {
|
|
12362
12397
|
const theme = useTheme();
|
|
12363
12398
|
const items = commands.map((cmd) => ({
|
|
@@ -12366,11 +12401,11 @@ function CommandPicker({ commands, title, onPick }) {
|
|
|
12366
12401
|
key: cmd.name
|
|
12367
12402
|
}));
|
|
12368
12403
|
items.push({ label: "\u2190 Cancel", value: null, key: "__cancel__" });
|
|
12369
|
-
return /* @__PURE__ */
|
|
12370
|
-
/* @__PURE__ */
|
|
12371
|
-
/* @__PURE__ */
|
|
12372
|
-
/* @__PURE__ */
|
|
12373
|
-
|
|
12404
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12405
|
+
/* @__PURE__ */ jsx16(Text15, { color: theme.accent, bold: true, children: title }),
|
|
12406
|
+
/* @__PURE__ */ jsx16(Text15, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
12407
|
+
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(
|
|
12408
|
+
SelectInput7,
|
|
12374
12409
|
{
|
|
12375
12410
|
items,
|
|
12376
12411
|
onSelect: (item) => {
|
|
@@ -12392,64 +12427,64 @@ var init_command_picker = __esm({
|
|
|
12392
12427
|
});
|
|
12393
12428
|
|
|
12394
12429
|
// src/ui/command-list.tsx
|
|
12395
|
-
import { Box as
|
|
12396
|
-
import { jsx as
|
|
12430
|
+
import { Box as Box15, Text as Text16, useInput as useInput5 } from "ink";
|
|
12431
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
12397
12432
|
function CommandList({ commands, onDone }) {
|
|
12398
12433
|
const theme = useTheme();
|
|
12399
|
-
|
|
12434
|
+
useInput5((_input, key) => {
|
|
12400
12435
|
if (key.escape) {
|
|
12401
12436
|
onDone();
|
|
12402
12437
|
}
|
|
12403
12438
|
});
|
|
12404
|
-
return /* @__PURE__ */
|
|
12405
|
-
/* @__PURE__ */
|
|
12406
|
-
/* @__PURE__ */
|
|
12407
|
-
/* @__PURE__ */
|
|
12408
|
-
commands.length === 0 && /* @__PURE__ */
|
|
12409
|
-
commands.map((cmd) => /* @__PURE__ */
|
|
12410
|
-
/* @__PURE__ */
|
|
12439
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12440
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.accent, bold: true, children: "Custom commands" }),
|
|
12441
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.info.color, dimColor: false, children: "Esc to close." }),
|
|
12442
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
|
|
12443
|
+
commands.length === 0 && /* @__PURE__ */ jsx17(Text16, { color: theme.info.color, children: "No custom commands found." }),
|
|
12444
|
+
commands.map((cmd) => /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", marginBottom: 1, children: [
|
|
12445
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.accent, bold: true, children: [
|
|
12411
12446
|
"/",
|
|
12412
12447
|
cmd.name
|
|
12413
12448
|
] }),
|
|
12414
|
-
/* @__PURE__ */
|
|
12449
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12415
12450
|
" ",
|
|
12416
12451
|
"source: ",
|
|
12417
12452
|
cmd.source
|
|
12418
12453
|
] }),
|
|
12419
|
-
/* @__PURE__ */
|
|
12454
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12420
12455
|
" ",
|
|
12421
12456
|
"path: ",
|
|
12422
12457
|
cmd.filepath
|
|
12423
12458
|
] }),
|
|
12424
|
-
cmd.description && /* @__PURE__ */
|
|
12459
|
+
cmd.description && /* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12425
12460
|
" ",
|
|
12426
12461
|
"desc: ",
|
|
12427
12462
|
cmd.description
|
|
12428
12463
|
] }),
|
|
12429
|
-
cmd.mode && /* @__PURE__ */
|
|
12464
|
+
cmd.mode && /* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12430
12465
|
" ",
|
|
12431
12466
|
"mode: ",
|
|
12432
12467
|
cmd.mode
|
|
12433
12468
|
] }),
|
|
12434
|
-
cmd.effort && /* @__PURE__ */
|
|
12469
|
+
cmd.effort && /* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12435
12470
|
" ",
|
|
12436
12471
|
"effort: ",
|
|
12437
12472
|
cmd.effort
|
|
12438
12473
|
] }),
|
|
12439
|
-
cmd.model && /* @__PURE__ */
|
|
12474
|
+
cmd.model && /* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12440
12475
|
" ",
|
|
12441
12476
|
"model: ",
|
|
12442
12477
|
cmd.model
|
|
12443
12478
|
] }),
|
|
12444
|
-
/* @__PURE__ */
|
|
12479
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12445
12480
|
" ",
|
|
12446
12481
|
"template:"
|
|
12447
12482
|
] }),
|
|
12448
|
-
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */
|
|
12483
|
+
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12449
12484
|
" ",
|
|
12450
12485
|
line || " "
|
|
12451
12486
|
] }, i)),
|
|
12452
|
-
cmd.template.split("\n").length > 5 && /* @__PURE__ */
|
|
12487
|
+
cmd.template.split("\n").length > 5 && /* @__PURE__ */ jsxs15(Text16, { color: theme.info.color, children: [
|
|
12453
12488
|
" ",
|
|
12454
12489
|
"..."
|
|
12455
12490
|
] })
|
|
@@ -12465,20 +12500,20 @@ var init_command_list = __esm({
|
|
|
12465
12500
|
});
|
|
12466
12501
|
|
|
12467
12502
|
// src/ui/lsp-wizard.tsx
|
|
12468
|
-
import { useState as
|
|
12469
|
-
import { Box as
|
|
12470
|
-
import
|
|
12503
|
+
import { useState as useState9 } from "react";
|
|
12504
|
+
import { Box as Box16, Text as Text17 } from "ink";
|
|
12505
|
+
import SelectInput8 from "ink-select-input";
|
|
12471
12506
|
import { spawn as spawn3 } from "child_process";
|
|
12472
|
-
import { jsx as
|
|
12507
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
12473
12508
|
function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
12474
12509
|
const theme = useTheme();
|
|
12475
|
-
const [page, setPage] =
|
|
12476
|
-
const [selectedPreset, setSelectedPreset] =
|
|
12477
|
-
const [customName, setCustomName] =
|
|
12478
|
-
const [customCommand, setCustomCommand] =
|
|
12479
|
-
const [installState, setInstallState] =
|
|
12480
|
-
const [pendingServers, setPendingServers] =
|
|
12481
|
-
const [pendingEnabled, setPendingEnabled] =
|
|
12510
|
+
const [page, setPage] = useState9("main");
|
|
12511
|
+
const [selectedPreset, setSelectedPreset] = useState9(null);
|
|
12512
|
+
const [customName, setCustomName] = useState9("");
|
|
12513
|
+
const [customCommand, setCustomCommand] = useState9("");
|
|
12514
|
+
const [installState, setInstallState] = useState9({ status: "idle", output: "" });
|
|
12515
|
+
const [pendingServers, setPendingServers] = useState9(null);
|
|
12516
|
+
const [pendingEnabled, setPendingEnabled] = useState9(true);
|
|
12482
12517
|
const runInstall = (command) => {
|
|
12483
12518
|
setInstallState({ status: "running", output: "Installing..." });
|
|
12484
12519
|
const child = spawn3("bash", ["-lc", command], {
|
|
@@ -12580,11 +12615,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12580
12615
|
{ label: "(close)", value: "__close__", key: "__close__" }
|
|
12581
12616
|
];
|
|
12582
12617
|
if (page === "main") {
|
|
12583
|
-
return /* @__PURE__ */
|
|
12584
|
-
/* @__PURE__ */
|
|
12585
|
-
/* @__PURE__ */
|
|
12586
|
-
/* @__PURE__ */
|
|
12587
|
-
|
|
12618
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12619
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "LSP Servers" }),
|
|
12620
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
12621
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12622
|
+
SelectInput8,
|
|
12588
12623
|
{
|
|
12589
12624
|
items: mainItems,
|
|
12590
12625
|
onSelect: (item) => {
|
|
@@ -12611,11 +12646,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12611
12646
|
}),
|
|
12612
12647
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
12613
12648
|
];
|
|
12614
|
-
return /* @__PURE__ */
|
|
12615
|
-
/* @__PURE__ */
|
|
12616
|
-
/* @__PURE__ */
|
|
12617
|
-
/* @__PURE__ */
|
|
12618
|
-
|
|
12649
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12650
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Add LSP Server" }),
|
|
12651
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: "Select a language server to configure." }),
|
|
12652
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12653
|
+
SelectInput8,
|
|
12619
12654
|
{
|
|
12620
12655
|
items,
|
|
12621
12656
|
onSelect: (item) => {
|
|
@@ -12642,19 +12677,19 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12642
12677
|
{ label: isSuccess ? "Save to config \u2713" : "Save anyway", value: "save", key: "save" },
|
|
12643
12678
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
12644
12679
|
];
|
|
12645
|
-
return /* @__PURE__ */
|
|
12646
|
-
/* @__PURE__ */
|
|
12680
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12681
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
12647
12682
|
"Install ",
|
|
12648
12683
|
selectedPreset.name
|
|
12649
12684
|
] }),
|
|
12650
|
-
/* @__PURE__ */
|
|
12651
|
-
/* @__PURE__ */
|
|
12652
|
-
/* @__PURE__ */
|
|
12653
|
-
/* @__PURE__ */
|
|
12685
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: selectedPreset.installHint }),
|
|
12686
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
12687
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: "Command:" }),
|
|
12688
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, children: selectedPreset.installCommand || "(none required)" })
|
|
12654
12689
|
] }),
|
|
12655
|
-
installState.output && /* @__PURE__ */
|
|
12656
|
-
/* @__PURE__ */
|
|
12657
|
-
|
|
12690
|
+
installState.output && /* @__PURE__ */ jsx18(Box16, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx18(Text17, { color: isSuccess ? theme.accent : theme.error, children: installState.output.slice(-500) }) }),
|
|
12691
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12692
|
+
SelectInput8,
|
|
12658
12693
|
{
|
|
12659
12694
|
items,
|
|
12660
12695
|
onSelect: (item) => {
|
|
@@ -12671,16 +12706,16 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12671
12706
|
}
|
|
12672
12707
|
}
|
|
12673
12708
|
) }),
|
|
12674
|
-
isSuccess && /* @__PURE__ */
|
|
12709
|
+
isSuccess && /* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.accent, children: "Server saved. Run /lsp reload to start it." }) })
|
|
12675
12710
|
] });
|
|
12676
12711
|
}
|
|
12677
12712
|
if (page === "custom-name") {
|
|
12678
|
-
return /* @__PURE__ */
|
|
12679
|
-
/* @__PURE__ */
|
|
12680
|
-
/* @__PURE__ */
|
|
12681
|
-
/* @__PURE__ */
|
|
12682
|
-
/* @__PURE__ */
|
|
12683
|
-
/* @__PURE__ */
|
|
12713
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12714
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Name" }),
|
|
12715
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: "Enter a name for this server (e.g., my-server)." }),
|
|
12716
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, children: [
|
|
12717
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, children: "\u203A " }),
|
|
12718
|
+
/* @__PURE__ */ jsx18(
|
|
12684
12719
|
CustomTextInput,
|
|
12685
12720
|
{
|
|
12686
12721
|
value: customName,
|
|
@@ -12694,8 +12729,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12694
12729
|
}
|
|
12695
12730
|
)
|
|
12696
12731
|
] }),
|
|
12697
|
-
/* @__PURE__ */
|
|
12698
|
-
|
|
12732
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12733
|
+
SelectInput8,
|
|
12699
12734
|
{
|
|
12700
12735
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
12701
12736
|
onSelect: () => setPage("add")
|
|
@@ -12704,12 +12739,12 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12704
12739
|
] });
|
|
12705
12740
|
}
|
|
12706
12741
|
if (page === "custom-command") {
|
|
12707
|
-
return /* @__PURE__ */
|
|
12708
|
-
/* @__PURE__ */
|
|
12709
|
-
/* @__PURE__ */
|
|
12710
|
-
/* @__PURE__ */
|
|
12711
|
-
/* @__PURE__ */
|
|
12712
|
-
/* @__PURE__ */
|
|
12742
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12743
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Command" }),
|
|
12744
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: "Enter the command to start the server (space-separated)." }),
|
|
12745
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, children: [
|
|
12746
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, children: "\u203A " }),
|
|
12747
|
+
/* @__PURE__ */ jsx18(
|
|
12713
12748
|
CustomTextInput,
|
|
12714
12749
|
{
|
|
12715
12750
|
value: customCommand,
|
|
@@ -12723,8 +12758,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12723
12758
|
}
|
|
12724
12759
|
)
|
|
12725
12760
|
] }),
|
|
12726
|
-
/* @__PURE__ */
|
|
12727
|
-
|
|
12761
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12762
|
+
SelectInput8,
|
|
12728
12763
|
{
|
|
12729
12764
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
12730
12765
|
onSelect: () => setPage("custom-name")
|
|
@@ -12747,11 +12782,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12747
12782
|
},
|
|
12748
12783
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
12749
12784
|
];
|
|
12750
|
-
return /* @__PURE__ */
|
|
12751
|
-
/* @__PURE__ */
|
|
12752
|
-
/* @__PURE__ */
|
|
12753
|
-
/* @__PURE__ */
|
|
12754
|
-
|
|
12785
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12786
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Save LSP Config" }),
|
|
12787
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: "Where should this server configuration be saved?" }),
|
|
12788
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12789
|
+
SelectInput8,
|
|
12755
12790
|
{
|
|
12756
12791
|
items,
|
|
12757
12792
|
onSelect: (item) => {
|
|
@@ -12769,11 +12804,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12769
12804
|
if (page === "edit") {
|
|
12770
12805
|
const keys = Object.keys(servers);
|
|
12771
12806
|
if (keys.length === 0) {
|
|
12772
|
-
return /* @__PURE__ */
|
|
12773
|
-
/* @__PURE__ */
|
|
12774
|
-
/* @__PURE__ */
|
|
12775
|
-
/* @__PURE__ */
|
|
12776
|
-
|
|
12807
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12808
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
12809
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "No servers configured." }),
|
|
12810
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12811
|
+
SelectInput8,
|
|
12777
12812
|
{
|
|
12778
12813
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
12779
12814
|
onSelect: () => setPage("main")
|
|
@@ -12793,11 +12828,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12793
12828
|
}),
|
|
12794
12829
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
12795
12830
|
];
|
|
12796
|
-
return /* @__PURE__ */
|
|
12797
|
-
/* @__PURE__ */
|
|
12798
|
-
/* @__PURE__ */
|
|
12799
|
-
/* @__PURE__ */
|
|
12800
|
-
|
|
12831
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12832
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
12833
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: "Select a server to toggle enabled/disabled." }),
|
|
12834
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12835
|
+
SelectInput8,
|
|
12801
12836
|
{
|
|
12802
12837
|
items,
|
|
12803
12838
|
onSelect: (item) => {
|
|
@@ -12814,11 +12849,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12814
12849
|
if (page === "delete") {
|
|
12815
12850
|
const keys = Object.keys(servers);
|
|
12816
12851
|
if (keys.length === 0) {
|
|
12817
|
-
return /* @__PURE__ */
|
|
12818
|
-
/* @__PURE__ */
|
|
12819
|
-
/* @__PURE__ */
|
|
12820
|
-
/* @__PURE__ */
|
|
12821
|
-
|
|
12852
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12853
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
12854
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "No servers configured." }),
|
|
12855
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12856
|
+
SelectInput8,
|
|
12822
12857
|
{
|
|
12823
12858
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
12824
12859
|
onSelect: () => setPage("main")
|
|
@@ -12834,11 +12869,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12834
12869
|
})),
|
|
12835
12870
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
12836
12871
|
];
|
|
12837
|
-
return /* @__PURE__ */
|
|
12838
|
-
/* @__PURE__ */
|
|
12839
|
-
/* @__PURE__ */
|
|
12840
|
-
/* @__PURE__ */
|
|
12841
|
-
|
|
12872
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12873
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
12874
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: false, children: "Select a server to remove from config." }),
|
|
12875
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12876
|
+
SelectInput8,
|
|
12842
12877
|
{
|
|
12843
12878
|
items,
|
|
12844
12879
|
onSelect: (item) => {
|
|
@@ -12854,15 +12889,15 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
12854
12889
|
}
|
|
12855
12890
|
if (page === "list") {
|
|
12856
12891
|
const keys = Object.keys(servers);
|
|
12857
|
-
return /* @__PURE__ */
|
|
12858
|
-
/* @__PURE__ */
|
|
12859
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
12892
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
12893
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Configured LSP Servers" }),
|
|
12894
|
+
keys.length === 0 ? /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "No servers configured." }) : /* @__PURE__ */ jsx18(Box16, { marginTop: 1, flexDirection: "column", children: keys.map((k) => {
|
|
12860
12895
|
const s = servers[k];
|
|
12861
12896
|
const status = s.enabled !== false ? "enabled" : "disabled";
|
|
12862
|
-
return /* @__PURE__ */
|
|
12897
|
+
return /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: ` ${k.padEnd(16)} ${status} ${s.command.join(" ")}` }, k);
|
|
12863
12898
|
}) }),
|
|
12864
|
-
/* @__PURE__ */
|
|
12865
|
-
|
|
12899
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
12900
|
+
SelectInput8,
|
|
12866
12901
|
{
|
|
12867
12902
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
12868
12903
|
onSelect: () => setPage("main")
|
|
@@ -12988,9 +13023,9 @@ var init_lsp_wizard = __esm({
|
|
|
12988
13023
|
});
|
|
12989
13024
|
|
|
12990
13025
|
// src/ui/theme-picker.tsx
|
|
12991
|
-
import { Box as
|
|
12992
|
-
import
|
|
12993
|
-
import { jsx as
|
|
13026
|
+
import { Box as Box17, Text as Text18 } from "ink";
|
|
13027
|
+
import SelectInput9 from "ink-select-input";
|
|
13028
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
12994
13029
|
function PaletteSwatches({ palette }) {
|
|
12995
13030
|
const colors = [
|
|
12996
13031
|
palette.primary,
|
|
@@ -12998,7 +13033,7 @@ function PaletteSwatches({ palette }) {
|
|
|
12998
13033
|
palette.success,
|
|
12999
13034
|
palette.error
|
|
13000
13035
|
];
|
|
13001
|
-
return /* @__PURE__ */
|
|
13036
|
+
return /* @__PURE__ */ jsx19(Box17, { children: colors.map((c, i) => /* @__PURE__ */ jsx19(Text18, { color: c, children: "\u2588" }, i)) });
|
|
13002
13037
|
}
|
|
13003
13038
|
function ThemePicker({ themes, onPick }) {
|
|
13004
13039
|
const current = useTheme();
|
|
@@ -13006,10 +13041,10 @@ function ThemePicker({ themes, onPick }) {
|
|
|
13006
13041
|
...themes.map((t) => ({ label: t.label, value: t.name })),
|
|
13007
13042
|
{ label: "< Back", value: "__back__" }
|
|
13008
13043
|
];
|
|
13009
|
-
return /* @__PURE__ */
|
|
13010
|
-
/* @__PURE__ */
|
|
13011
|
-
/* @__PURE__ */
|
|
13012
|
-
|
|
13044
|
+
return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", borderStyle: "round", borderColor: current.accent, paddingX: 1, children: [
|
|
13045
|
+
/* @__PURE__ */ jsx19(Text18, { color: current.accent, bold: true, children: "Pick a theme (restart to apply)" }),
|
|
13046
|
+
/* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
|
|
13047
|
+
SelectInput9,
|
|
13013
13048
|
{
|
|
13014
13049
|
items,
|
|
13015
13050
|
onSelect: (item) => {
|
|
@@ -13023,9 +13058,9 @@ function ThemePicker({ themes, onPick }) {
|
|
|
13023
13058
|
itemComponent: ({ label, isSelected }) => {
|
|
13024
13059
|
const t = themes.find((x) => x.label === label);
|
|
13025
13060
|
const color = t?.accent ?? current.accent;
|
|
13026
|
-
return /* @__PURE__ */
|
|
13027
|
-
/* @__PURE__ */
|
|
13028
|
-
t && /* @__PURE__ */
|
|
13061
|
+
return /* @__PURE__ */ jsxs17(Box17, { children: [
|
|
13062
|
+
/* @__PURE__ */ jsx19(Text18, { color, bold: isSelected, dimColor: !isSelected, children: label }),
|
|
13063
|
+
t && /* @__PURE__ */ jsx19(Box17, { marginLeft: 1, children: /* @__PURE__ */ jsx19(PaletteSwatches, { palette: t.palette }) })
|
|
13029
13064
|
] });
|
|
13030
13065
|
}
|
|
13031
13066
|
}
|
|
@@ -13755,11 +13790,11 @@ var init_wcag = __esm({
|
|
|
13755
13790
|
});
|
|
13756
13791
|
|
|
13757
13792
|
// src/ui/theme-loader.ts
|
|
13758
|
-
import { readFile as
|
|
13759
|
-
import { join as
|
|
13793
|
+
import { readFile as readFile18, readdir as readdir5 } from "fs/promises";
|
|
13794
|
+
import { join as join23 } from "path";
|
|
13760
13795
|
import { homedir as homedir14 } from "os";
|
|
13761
13796
|
function projectThemesDir(cwd = process.cwd()) {
|
|
13762
|
-
return
|
|
13797
|
+
return join23(cwd, ".kimiflare", "themes");
|
|
13763
13798
|
}
|
|
13764
13799
|
function isHexColor(c) {
|
|
13765
13800
|
return /^#[0-9a-fA-F]{6}$/.test(c);
|
|
@@ -13844,15 +13879,15 @@ async function loadThemesFromDir(dir, source) {
|
|
|
13844
13879
|
const errors = [];
|
|
13845
13880
|
let files;
|
|
13846
13881
|
try {
|
|
13847
|
-
files = await
|
|
13882
|
+
files = await readdir5(dir);
|
|
13848
13883
|
} catch {
|
|
13849
13884
|
return { themes, errors };
|
|
13850
13885
|
}
|
|
13851
13886
|
for (const file of files.filter((f) => f.endsWith(".json"))) {
|
|
13852
|
-
const path =
|
|
13887
|
+
const path = join23(dir, file);
|
|
13853
13888
|
let raw;
|
|
13854
13889
|
try {
|
|
13855
|
-
raw = await
|
|
13890
|
+
raw = await readFile18(path, "utf-8");
|
|
13856
13891
|
} catch (e) {
|
|
13857
13892
|
errors.push(`${path}: ${e instanceof Error ? e.message : String(e)}`);
|
|
13858
13893
|
continue;
|
|
@@ -13997,8 +14032,8 @@ var init_theme_loader = __esm({
|
|
|
13997
14032
|
"use strict";
|
|
13998
14033
|
init_wcag();
|
|
13999
14034
|
init_theme();
|
|
14000
|
-
USER_THEMES_DIR =
|
|
14001
|
-
process.env.XDG_CONFIG_HOME ||
|
|
14035
|
+
USER_THEMES_DIR = join23(
|
|
14036
|
+
process.env.XDG_CONFIG_HOME || join23(homedir14(), ".config"),
|
|
14002
14037
|
"kimiflare",
|
|
14003
14038
|
"themes"
|
|
14004
14039
|
);
|
|
@@ -14055,8 +14090,8 @@ var init_lsp_nudge = __esm({
|
|
|
14055
14090
|
});
|
|
14056
14091
|
|
|
14057
14092
|
// src/ui/file-picker.tsx
|
|
14058
|
-
import { Box as
|
|
14059
|
-
import { jsx as
|
|
14093
|
+
import { Box as Box18, Text as Text19 } from "ink";
|
|
14094
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
14060
14095
|
function FilePicker({ items, selectedIndex, query }) {
|
|
14061
14096
|
const theme = useTheme();
|
|
14062
14097
|
let startIndex = 0;
|
|
@@ -14066,12 +14101,12 @@ function FilePicker({ items, selectedIndex, query }) {
|
|
|
14066
14101
|
const visible = items.slice(startIndex, startIndex + VISIBLE_LIMIT);
|
|
14067
14102
|
const hasMoreAbove = startIndex > 0;
|
|
14068
14103
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT;
|
|
14069
|
-
return /* @__PURE__ */
|
|
14070
|
-
/* @__PURE__ */
|
|
14071
|
-
/* @__PURE__ */
|
|
14072
|
-
/* @__PURE__ */
|
|
14073
|
-
visible.length === 0 && /* @__PURE__ */
|
|
14074
|
-
hasMoreAbove && /* @__PURE__ */
|
|
14104
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14105
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.accent, bold: true, children: query ? `Files matching "${query}"` : "Mention a file" }),
|
|
14106
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
14107
|
+
/* @__PURE__ */ jsxs18(Box18, { marginTop: 1, flexDirection: "column", children: [
|
|
14108
|
+
visible.length === 0 && /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "No matches" }),
|
|
14109
|
+
hasMoreAbove && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14075
14110
|
"\u2026 ",
|
|
14076
14111
|
startIndex,
|
|
14077
14112
|
" more above"
|
|
@@ -14080,12 +14115,12 @@ function FilePicker({ items, selectedIndex, query }) {
|
|
|
14080
14115
|
const actualIndex = startIndex + i;
|
|
14081
14116
|
const isSelected = actualIndex === selectedIndex;
|
|
14082
14117
|
const label = item.isDirectory ? `${item.name}/` : item.name;
|
|
14083
|
-
return /* @__PURE__ */
|
|
14118
|
+
return /* @__PURE__ */ jsxs18(Text19, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: [
|
|
14084
14119
|
isSelected ? "\u203A " : " ",
|
|
14085
14120
|
label
|
|
14086
14121
|
] }, item.name);
|
|
14087
14122
|
}),
|
|
14088
|
-
hasMoreBelow && /* @__PURE__ */
|
|
14123
|
+
hasMoreBelow && /* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14089
14124
|
"\u2026 ",
|
|
14090
14125
|
items.length - (startIndex + VISIBLE_LIMIT),
|
|
14091
14126
|
" more below"
|
|
@@ -14103,8 +14138,8 @@ var init_file_picker = __esm({
|
|
|
14103
14138
|
});
|
|
14104
14139
|
|
|
14105
14140
|
// src/ui/slash-picker.tsx
|
|
14106
|
-
import { Box as
|
|
14107
|
-
import { jsx as
|
|
14141
|
+
import { Box as Box19, Text as Text20 } from "ink";
|
|
14142
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
14108
14143
|
function sourceBadge(source) {
|
|
14109
14144
|
if (source === "builtin") return "";
|
|
14110
14145
|
if (source === "project") return "project";
|
|
@@ -14124,12 +14159,12 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
14124
14159
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT2;
|
|
14125
14160
|
const longestLabel = visible.reduce((m, it) => Math.max(m, commandLabel(it).length), 0);
|
|
14126
14161
|
const nameColWidth = Math.max(NAME_COL_MIN_WIDTH, longestLabel + NAME_DESC_GAP);
|
|
14127
|
-
return /* @__PURE__ */
|
|
14128
|
-
/* @__PURE__ */
|
|
14129
|
-
/* @__PURE__ */
|
|
14130
|
-
/* @__PURE__ */
|
|
14131
|
-
visible.length === 0 && /* @__PURE__ */
|
|
14132
|
-
hasMoreAbove && /* @__PURE__ */
|
|
14162
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
14163
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: query ? `Commands matching "/${query}"` : "Slash commands" }),
|
|
14164
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
14165
|
+
/* @__PURE__ */ jsxs19(Box19, { marginTop: 1, flexDirection: "column", children: [
|
|
14166
|
+
visible.length === 0 && /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No matches" }),
|
|
14167
|
+
hasMoreAbove && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, children: [
|
|
14133
14168
|
"\u2026 ",
|
|
14134
14169
|
startIndex,
|
|
14135
14170
|
" more above"
|
|
@@ -14139,16 +14174,16 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
14139
14174
|
const isSelected = actualIndex === selectedIndex;
|
|
14140
14175
|
const nameCol = commandLabel(item).padEnd(nameColWidth);
|
|
14141
14176
|
const badge = sourceBadge(item.source);
|
|
14142
|
-
return /* @__PURE__ */
|
|
14177
|
+
return /* @__PURE__ */ jsxs19(Text20, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: [
|
|
14143
14178
|
isSelected ? "\u203A " : " ",
|
|
14144
14179
|
nameCol,
|
|
14145
|
-
/* @__PURE__ */
|
|
14180
|
+
/* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, children: [
|
|
14146
14181
|
item.description,
|
|
14147
14182
|
badge && ` [${badge}]`
|
|
14148
14183
|
] })
|
|
14149
14184
|
] }, item.name);
|
|
14150
14185
|
}),
|
|
14151
|
-
hasMoreBelow && /* @__PURE__ */
|
|
14186
|
+
hasMoreBelow && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, children: [
|
|
14152
14187
|
"\u2026 ",
|
|
14153
14188
|
items.length - (startIndex + VISIBLE_LIMIT2),
|
|
14154
14189
|
" more below"
|
|
@@ -14228,15 +14263,15 @@ var tui_report_exports = {};
|
|
|
14228
14263
|
__export(tui_report_exports, {
|
|
14229
14264
|
getCategoryReportText: () => getCategoryReportText
|
|
14230
14265
|
});
|
|
14231
|
-
import { readFile as
|
|
14232
|
-
import { join as
|
|
14266
|
+
import { readFile as readFile19 } from "fs/promises";
|
|
14267
|
+
import { join as join24 } from "path";
|
|
14233
14268
|
import { homedir as homedir15 } from "os";
|
|
14234
14269
|
function usageDir3() {
|
|
14235
|
-
const xdg = process.env.XDG_DATA_HOME ||
|
|
14236
|
-
return
|
|
14270
|
+
const xdg = process.env.XDG_DATA_HOME || join24(homedir15(), ".local", "share");
|
|
14271
|
+
return join24(xdg, "kimiflare");
|
|
14237
14272
|
}
|
|
14238
14273
|
function usagePath3() {
|
|
14239
|
-
return
|
|
14274
|
+
return join24(usageDir3(), "usage.json");
|
|
14240
14275
|
}
|
|
14241
14276
|
function today3() {
|
|
14242
14277
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
@@ -14248,7 +14283,7 @@ function daysAgo2(n) {
|
|
|
14248
14283
|
}
|
|
14249
14284
|
async function loadLog3() {
|
|
14250
14285
|
try {
|
|
14251
|
-
const raw = await
|
|
14286
|
+
const raw = await readFile19(usagePath3(), "utf8");
|
|
14252
14287
|
return JSON.parse(raw);
|
|
14253
14288
|
} catch {
|
|
14254
14289
|
return { version: 1, days: [], sessions: [] };
|
|
@@ -14314,18 +14349,18 @@ __export(app_exports, {
|
|
|
14314
14349
|
shouldOpenMentionPicker: () => shouldOpenMentionPicker,
|
|
14315
14350
|
shouldOpenSlashPicker: () => shouldOpenSlashPicker
|
|
14316
14351
|
});
|
|
14317
|
-
import
|
|
14318
|
-
import { Box as
|
|
14319
|
-
import
|
|
14352
|
+
import React13, { useState as useState10, useRef as useRef3, useEffect as useEffect7, useCallback as useCallback2 } from "react";
|
|
14353
|
+
import { Box as Box20, Text as Text21, useApp, useInput as useInput6, render } from "ink";
|
|
14354
|
+
import SelectInput10 from "ink-select-input";
|
|
14320
14355
|
import { existsSync as existsSync3, statSync as statSync4 } from "fs";
|
|
14321
|
-
import { join as
|
|
14322
|
-
import { unlink as
|
|
14356
|
+
import { join as join25 } from "path";
|
|
14357
|
+
import { unlink as unlink4 } from "fs/promises";
|
|
14323
14358
|
import { execSync as execSync2 } from "child_process";
|
|
14324
14359
|
import { spawn as spawn4 } from "child_process";
|
|
14325
14360
|
import { platform as platform2 } from "os";
|
|
14326
14361
|
import fg4 from "fast-glob";
|
|
14327
14362
|
import { readFileSync as readFileSync3 } from "fs";
|
|
14328
|
-
import { jsx as
|
|
14363
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
14329
14364
|
function buildFilePickerIgnoreList(cwd) {
|
|
14330
14365
|
const hardcoded = [
|
|
14331
14366
|
// Dependencies
|
|
@@ -14396,7 +14431,7 @@ function buildFilePickerIgnoreList(cwd) {
|
|
|
14396
14431
|
];
|
|
14397
14432
|
const gitignorePatterns = [];
|
|
14398
14433
|
try {
|
|
14399
|
-
const gitignorePath =
|
|
14434
|
+
const gitignorePath = join25(cwd, ".gitignore");
|
|
14400
14435
|
const stats = statSync4(gitignorePath);
|
|
14401
14436
|
if (stats.size > MAX_GITIGNORE_SIZE) {
|
|
14402
14437
|
return hardcoded;
|
|
@@ -14554,12 +14589,12 @@ function App({
|
|
|
14554
14589
|
initialCloudDeviceId
|
|
14555
14590
|
}) {
|
|
14556
14591
|
const { exit } = useApp();
|
|
14557
|
-
const [cfg, setCfg] =
|
|
14558
|
-
const [lspScope, setLspScope] =
|
|
14559
|
-
const [lspProjectPath, setLspProjectPath] =
|
|
14560
|
-
const [cloudToken, setCloudToken] =
|
|
14561
|
-
const [cloudDeviceId, setCloudDeviceId] =
|
|
14562
|
-
const [events, setRawEvents] =
|
|
14592
|
+
const [cfg, setCfg] = useState10(initialCfg);
|
|
14593
|
+
const [lspScope, setLspScope] = useState10(initialLspScope);
|
|
14594
|
+
const [lspProjectPath, setLspProjectPath] = useState10(initialLspProjectPath);
|
|
14595
|
+
const [cloudToken, setCloudToken] = useState10(initialCloudToken);
|
|
14596
|
+
const [cloudDeviceId, setCloudDeviceId] = useState10(initialCloudDeviceId);
|
|
14597
|
+
const [events, setRawEvents] = useState10([]);
|
|
14563
14598
|
const setEvents = useCallback2(
|
|
14564
14599
|
(updater) => {
|
|
14565
14600
|
setRawEvents((prev) => {
|
|
@@ -14569,47 +14604,51 @@ function App({
|
|
|
14569
14604
|
},
|
|
14570
14605
|
[]
|
|
14571
14606
|
);
|
|
14572
|
-
const [input, setInput] =
|
|
14573
|
-
const [busy, setBusy] =
|
|
14574
|
-
const [usage, setUsage] =
|
|
14575
|
-
const [sessionUsage, setSessionUsage] =
|
|
14576
|
-
const [gatewayMeta, setGatewayMeta] =
|
|
14577
|
-
const [cloudBudget, setCloudBudget] =
|
|
14578
|
-
const [showReasoning, setShowReasoning] =
|
|
14579
|
-
const [perm, setPerm] =
|
|
14580
|
-
const [limitModal, setLimitModal] =
|
|
14581
|
-
const [queue, setQueue] =
|
|
14582
|
-
const [history, setHistory] =
|
|
14583
|
-
const [historyIndex, setHistoryIndex] =
|
|
14584
|
-
const [draftInput, setDraftInput] =
|
|
14585
|
-
const [mode, setMode] =
|
|
14586
|
-
const [codeMode, setCodeMode] =
|
|
14607
|
+
const [input, setInput] = useState10("");
|
|
14608
|
+
const [busy, setBusy] = useState10(false);
|
|
14609
|
+
const [usage, setUsage] = useState10(null);
|
|
14610
|
+
const [sessionUsage, setSessionUsage] = useState10(null);
|
|
14611
|
+
const [gatewayMeta, setGatewayMeta] = useState10(null);
|
|
14612
|
+
const [cloudBudget, setCloudBudget] = useState10(null);
|
|
14613
|
+
const [showReasoning, setShowReasoning] = useState10(false);
|
|
14614
|
+
const [perm, setPerm] = useState10(null);
|
|
14615
|
+
const [limitModal, setLimitModal] = useState10(null);
|
|
14616
|
+
const [queue, setQueue] = useState10([]);
|
|
14617
|
+
const [history, setHistory] = useState10([]);
|
|
14618
|
+
const [historyIndex, setHistoryIndex] = useState10(-1);
|
|
14619
|
+
const [draftInput, setDraftInput] = useState10("");
|
|
14620
|
+
const [mode, setMode] = useState10("edit");
|
|
14621
|
+
const [codeMode, setCodeMode] = useState10(false);
|
|
14587
14622
|
const filePickerEnabled = initialCfg?.filePicker ?? true;
|
|
14588
|
-
const [effort, setEffort] =
|
|
14623
|
+
const [effort, setEffort] = useState10(
|
|
14589
14624
|
initialCfg?.reasoningEffort ?? DEFAULT_REASONING_EFFORT
|
|
14590
14625
|
);
|
|
14591
|
-
const [resumeSessions, setResumeSessions] =
|
|
14592
|
-
const [
|
|
14593
|
-
const [
|
|
14594
|
-
const [
|
|
14595
|
-
const [
|
|
14596
|
-
const [
|
|
14597
|
-
const [
|
|
14598
|
-
const [
|
|
14599
|
-
const [
|
|
14600
|
-
const [
|
|
14601
|
-
const [
|
|
14602
|
-
const [
|
|
14603
|
-
const [
|
|
14604
|
-
const [
|
|
14605
|
-
const [
|
|
14606
|
-
const [
|
|
14607
|
-
const [
|
|
14608
|
-
const [
|
|
14609
|
-
const [
|
|
14610
|
-
const [
|
|
14611
|
-
const [
|
|
14612
|
-
const [
|
|
14626
|
+
const [resumeSessions, setResumeSessions] = useState10(null);
|
|
14627
|
+
const [commandWizard, setCommandWizard] = useState10(null);
|
|
14628
|
+
const [commandPicker, setCommandPicker] = useState10(null);
|
|
14629
|
+
const [commandToDelete, setCommandToDelete] = useState10(null);
|
|
14630
|
+
const [showCommandList, setShowCommandList] = useState10(false);
|
|
14631
|
+
const [showLspWizard, setShowLspWizard] = useState10(false);
|
|
14632
|
+
const [showRemoteDashboard, setShowRemoteDashboard] = useState10(false);
|
|
14633
|
+
const [selectedRemoteSession, setSelectedRemoteSession] = useState10(null);
|
|
14634
|
+
const [tasks, setTasks] = useState10([]);
|
|
14635
|
+
const [tasksStartedAt, setTasksStartedAt] = useState10(null);
|
|
14636
|
+
const [tasksStartTokens, setTasksStartTokens] = useState10(0);
|
|
14637
|
+
const [turnStartedAt, setTurnStartedAt] = useState10(null);
|
|
14638
|
+
const [turnPhase, setTurnPhase] = useState10("waiting");
|
|
14639
|
+
const [currentToolName, setCurrentToolName] = useState10(null);
|
|
14640
|
+
const [lastActivityAt, setLastActivityAt] = useState10(null);
|
|
14641
|
+
const [verbose, setVerbose] = useState10(false);
|
|
14642
|
+
const [hasUpdate, setHasUpdate] = useState10(initialUpdateResult?.hasUpdate ?? false);
|
|
14643
|
+
const [latestVersion, setLatestVersion] = useState10(initialUpdateResult?.latestVersion ?? null);
|
|
14644
|
+
const [theme, setTheme] = useState10(resolveTheme(initialCfg?.theme));
|
|
14645
|
+
const [showThemePicker, setShowThemePicker] = useState10(false);
|
|
14646
|
+
const [originalTheme, setOriginalTheme] = useState10(null);
|
|
14647
|
+
const [skillsActive, setSkillsActive] = useState10(0);
|
|
14648
|
+
const [memoryRecalled, setMemoryRecalled] = useState10(false);
|
|
14649
|
+
const [intentTier, setIntentTier] = useState10(null);
|
|
14650
|
+
const skillsDirRef = useRef3(join25(process.cwd(), ".kimiflare", "skills"));
|
|
14651
|
+
const [kimiMdStale, setKimiMdStale] = useState10(false);
|
|
14613
14652
|
useEffect7(() => {
|
|
14614
14653
|
let cancelled = false;
|
|
14615
14654
|
loadAndMergeThemes().then(({ errors, wcagWarnings }) => {
|
|
@@ -14649,11 +14688,11 @@ ${wcagWarnings.join("\n")}` }
|
|
|
14649
14688
|
cancelled = true;
|
|
14650
14689
|
};
|
|
14651
14690
|
}, [cfg?.cloudMode, initialCloudToken]);
|
|
14652
|
-
const [cursorOffset, setCursorOffset] =
|
|
14653
|
-
const [activePicker, setActivePicker] =
|
|
14654
|
-
const [filePickerItems, setFilePickerItems] =
|
|
14691
|
+
const [cursorOffset, setCursorOffset] = useState10(0);
|
|
14692
|
+
const [activePicker, setActivePicker] = useState10(null);
|
|
14693
|
+
const [filePickerItems, setFilePickerItems] = useState10([]);
|
|
14655
14694
|
const filePickerLoadedRef = useRef3(false);
|
|
14656
|
-
const [customCommandsVersion, setCustomCommandsVersion] =
|
|
14695
|
+
const [customCommandsVersion, setCustomCommandsVersion] = useState10(0);
|
|
14657
14696
|
const cacheStableRef = useRef3(initialCfg?.cacheStablePrompts !== false);
|
|
14658
14697
|
const messagesRef = useRef3(
|
|
14659
14698
|
makePrefixMessages(cacheStableRef.current, cfg?.model ?? DEFAULT_MODEL, "edit", ALL_TOOLS)
|
|
@@ -14700,15 +14739,15 @@ ${wcagWarnings.join("\n")}` }
|
|
|
14700
14739
|
}, [busy]);
|
|
14701
14740
|
const pickerAnchor = activePicker?.anchor ?? null;
|
|
14702
14741
|
const pickerKind = activePicker?.kind ?? null;
|
|
14703
|
-
const pickerQuery =
|
|
14742
|
+
const pickerQuery = React13.useMemo(() => {
|
|
14704
14743
|
if (pickerAnchor === null) return null;
|
|
14705
14744
|
return input.slice(pickerAnchor + 1, cursorOffset);
|
|
14706
14745
|
}, [input, cursorOffset, pickerAnchor]);
|
|
14707
|
-
const filteredFileItems =
|
|
14746
|
+
const filteredFileItems = React13.useMemo(() => {
|
|
14708
14747
|
if (pickerKind !== "file" || pickerQuery === null) return [];
|
|
14709
14748
|
return filterPickerItems(filePickerItems, pickerQuery);
|
|
14710
14749
|
}, [pickerKind, filePickerItems, pickerQuery]);
|
|
14711
|
-
const allSlashCommands =
|
|
14750
|
+
const allSlashCommands = React13.useMemo(() => {
|
|
14712
14751
|
const customs = customCommandsRef.current.filter((c) => !BUILTIN_COMMAND_NAMES.has(c.name.toLowerCase())).map((c) => ({
|
|
14713
14752
|
name: c.name,
|
|
14714
14753
|
description: c.description ?? "",
|
|
@@ -14716,7 +14755,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
14716
14755
|
}));
|
|
14717
14756
|
return [...BUILTIN_COMMANDS, ...customs];
|
|
14718
14757
|
}, [customCommandsVersion]);
|
|
14719
|
-
const filteredSlashItems =
|
|
14758
|
+
const filteredSlashItems = React13.useMemo(() => {
|
|
14720
14759
|
if (pickerKind !== "slash" || pickerQuery === null) return [];
|
|
14721
14760
|
return fuzzyFilter(allSlashCommands, pickerQuery, (c) => c.name).slice(0, 50);
|
|
14722
14761
|
}, [pickerKind, allSlashCommands, pickerQuery]);
|
|
@@ -14829,12 +14868,11 @@ ${wcagWarnings.join("\n")}` }
|
|
|
14829
14868
|
setActivePicker(null);
|
|
14830
14869
|
}, [cursorOffset]);
|
|
14831
14870
|
useEffect7(() => {
|
|
14832
|
-
const modalActive =
|
|
14871
|
+
const modalActive = commandWizard !== null || commandPicker !== null || commandToDelete !== null || showCommandList || showLspWizard || resumeSessions !== null || perm !== null || limitModal !== null;
|
|
14833
14872
|
if (modalActive && activePicker !== null) {
|
|
14834
14873
|
setActivePicker(null);
|
|
14835
14874
|
}
|
|
14836
14875
|
}, [
|
|
14837
|
-
showHelpMenu,
|
|
14838
14876
|
commandWizard,
|
|
14839
14877
|
commandPicker,
|
|
14840
14878
|
commandToDelete,
|
|
@@ -14871,7 +14909,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
14871
14909
|
}
|
|
14872
14910
|
});
|
|
14873
14911
|
if (cfg.memoryEnabled) {
|
|
14874
|
-
const dbPath = cfg.memoryDbPath ??
|
|
14912
|
+
const dbPath = cfg.memoryDbPath ?? join25(process.cwd(), ".kimiflare", "memory.db");
|
|
14875
14913
|
const manager = new MemoryManager({
|
|
14876
14914
|
dbPath,
|
|
14877
14915
|
accountId: cfg.accountId,
|
|
@@ -14920,7 +14958,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
14920
14958
|
} catch {
|
|
14921
14959
|
}
|
|
14922
14960
|
})();
|
|
14923
|
-
if (existsSync3(
|
|
14961
|
+
if (existsSync3(join25(cwd, "KIMI.md"))) {
|
|
14924
14962
|
const lastRefresh = manager.getLastKimiMdRefreshTime(cwd);
|
|
14925
14963
|
const driftCount = manager.countHighSignalMemoriesSince(cwd, lastRefresh);
|
|
14926
14964
|
if (driftCount >= 5) {
|
|
@@ -15323,7 +15361,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
15323
15361
|
},
|
|
15324
15362
|
[cfg]
|
|
15325
15363
|
);
|
|
15326
|
-
|
|
15364
|
+
useInput6((inputChar, key) => {
|
|
15327
15365
|
if (key.ctrl && inputChar === "c") {
|
|
15328
15366
|
const hadPerm = permResolveRef.current !== null;
|
|
15329
15367
|
const hadLimit = limitResolveRef.current !== null;
|
|
@@ -15347,7 +15385,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
15347
15385
|
return;
|
|
15348
15386
|
}
|
|
15349
15387
|
if (key.escape) {
|
|
15350
|
-
const modalOpen = perm !== null || limitModal !== null ||
|
|
15388
|
+
const modalOpen = perm !== null || limitModal !== null || showLspWizard || showCommandList || commandWizard !== null || commandToDelete !== null || resumeSessions !== null || showThemePicker;
|
|
15351
15389
|
if (!modalOpen && busyRef.current && activeControllerRef.current) {
|
|
15352
15390
|
if (permResolveRef.current) {
|
|
15353
15391
|
permResolveRef.current("deny");
|
|
@@ -15594,7 +15632,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
15594
15632
|
lspManagerRef.current.notifyChange(path, content);
|
|
15595
15633
|
} else {
|
|
15596
15634
|
void import("fs/promises").then(
|
|
15597
|
-
({ readFile:
|
|
15635
|
+
({ readFile: readFile20 }) => readFile20(path, "utf8").then((c) => lspManagerRef.current.notifyChange(path, c)).catch(() => {
|
|
15598
15636
|
})
|
|
15599
15637
|
);
|
|
15600
15638
|
}
|
|
@@ -15714,7 +15752,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
15714
15752
|
}
|
|
15715
15753
|
}
|
|
15716
15754
|
});
|
|
15717
|
-
if (existsSync3(
|
|
15755
|
+
if (existsSync3(join25(cwd, "KIMI.md"))) {
|
|
15718
15756
|
if (cacheStableRef.current) {
|
|
15719
15757
|
messagesRef.current[1] = {
|
|
15720
15758
|
role: "system",
|
|
@@ -16154,6 +16192,118 @@ use: /thinking low | medium | high`
|
|
|
16154
16192
|
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "mode: edit" }]);
|
|
16155
16193
|
return true;
|
|
16156
16194
|
}
|
|
16195
|
+
if (c === "/skills") {
|
|
16196
|
+
const sub = rest[0]?.toLowerCase() ?? "";
|
|
16197
|
+
const subRest = rest.slice(1).join(" ").trim();
|
|
16198
|
+
if (sub === "list" || sub === "") {
|
|
16199
|
+
void listAllSkills(process.cwd()).then((all) => {
|
|
16200
|
+
const lines = [];
|
|
16201
|
+
if (all.project.length > 0) {
|
|
16202
|
+
lines.push("project skills:");
|
|
16203
|
+
for (const s of all.project) {
|
|
16204
|
+
const status = s.enabled ? "\u2713" : "\u2717";
|
|
16205
|
+
lines.push(` ${status} ${s.name} \u2014 ${s.description || "no description"} (${s.estimatedTokens} tokens)`);
|
|
16206
|
+
}
|
|
16207
|
+
}
|
|
16208
|
+
if (all.global.length > 0) {
|
|
16209
|
+
lines.push("global skills:");
|
|
16210
|
+
for (const s of all.global) {
|
|
16211
|
+
const status = s.enabled ? "\u2713" : "\u2717";
|
|
16212
|
+
lines.push(` ${status} ${s.name} \u2014 ${s.description || "no description"} (${s.estimatedTokens} tokens)`);
|
|
16213
|
+
}
|
|
16214
|
+
}
|
|
16215
|
+
if (lines.length === 0) {
|
|
16216
|
+
lines.push("no skills found. create one with /skills add <name>");
|
|
16217
|
+
}
|
|
16218
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: lines.join("\n") }]);
|
|
16219
|
+
}).catch((err) => {
|
|
16220
|
+
setEvents((e) => [...e, { kind: "error", key: mkKey(), text: `failed to list skills: ${err.message}` }]);
|
|
16221
|
+
});
|
|
16222
|
+
return true;
|
|
16223
|
+
}
|
|
16224
|
+
if (sub === "add") {
|
|
16225
|
+
const name = subRest.trim();
|
|
16226
|
+
if (!name) {
|
|
16227
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "usage: /skills add <name>" }]);
|
|
16228
|
+
return true;
|
|
16229
|
+
}
|
|
16230
|
+
void createSkill({ name, scope: "project", cwd: process.cwd() }).then((result) => {
|
|
16231
|
+
setEvents((e) => [
|
|
16232
|
+
...e,
|
|
16233
|
+
{ kind: "info", key: mkKey(), text: `created skill '${name}' \u2192 ${result.filepath}` },
|
|
16234
|
+
{ kind: "info", key: mkKey(), text: `edit the file to add your instructions` }
|
|
16235
|
+
]);
|
|
16236
|
+
}).catch((err) => {
|
|
16237
|
+
setEvents((e) => [...e, { kind: "error", key: mkKey(), text: `failed to create skill: ${err.message}` }]);
|
|
16238
|
+
});
|
|
16239
|
+
return true;
|
|
16240
|
+
}
|
|
16241
|
+
if (sub === "edit") {
|
|
16242
|
+
const name = subRest.trim();
|
|
16243
|
+
if (!name) {
|
|
16244
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "usage: /skills edit <name>" }]);
|
|
16245
|
+
return true;
|
|
16246
|
+
}
|
|
16247
|
+
void findSkillFile(name, process.cwd()).then((filepath) => {
|
|
16248
|
+
if (!filepath) {
|
|
16249
|
+
setEvents((e) => [...e, { kind: "error", key: mkKey(), text: `skill '${name}' not found` }]);
|
|
16250
|
+
return;
|
|
16251
|
+
}
|
|
16252
|
+
setEvents((e) => [
|
|
16253
|
+
...e,
|
|
16254
|
+
{ kind: "info", key: mkKey(), text: `skill '${name}' \u2192 ${filepath}` },
|
|
16255
|
+
{ kind: "info", key: mkKey(), text: `open it in your editor to make changes` }
|
|
16256
|
+
]);
|
|
16257
|
+
}).catch((err) => {
|
|
16258
|
+
setEvents((e) => [...e, { kind: "error", key: mkKey(), text: `failed to find skill: ${err.message}` }]);
|
|
16259
|
+
});
|
|
16260
|
+
return true;
|
|
16261
|
+
}
|
|
16262
|
+
if (sub === "delete") {
|
|
16263
|
+
const name = subRest.trim();
|
|
16264
|
+
if (!name) {
|
|
16265
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "usage: /skills delete <name>" }]);
|
|
16266
|
+
return true;
|
|
16267
|
+
}
|
|
16268
|
+
void deleteSkill(name, process.cwd()).then((result) => {
|
|
16269
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: `deleted skill '${name}' (${result.filepath})` }]);
|
|
16270
|
+
}).catch((err) => {
|
|
16271
|
+
setEvents((e) => [...e, { kind: "error", key: mkKey(), text: `failed to delete skill: ${err.message}` }]);
|
|
16272
|
+
});
|
|
16273
|
+
return true;
|
|
16274
|
+
}
|
|
16275
|
+
if (sub === "enable") {
|
|
16276
|
+
const name = subRest.trim();
|
|
16277
|
+
if (!name) {
|
|
16278
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "usage: /skills enable <name>" }]);
|
|
16279
|
+
return true;
|
|
16280
|
+
}
|
|
16281
|
+
void setSkillEnabled(name, true, process.cwd()).then((result) => {
|
|
16282
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: `enabled skill '${name}' (${result.filepath})` }]);
|
|
16283
|
+
}).catch((err) => {
|
|
16284
|
+
setEvents((e) => [...e, { kind: "error", key: mkKey(), text: `failed to enable skill: ${err.message}` }]);
|
|
16285
|
+
});
|
|
16286
|
+
return true;
|
|
16287
|
+
}
|
|
16288
|
+
if (sub === "disable") {
|
|
16289
|
+
const name = subRest.trim();
|
|
16290
|
+
if (!name) {
|
|
16291
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "usage: /skills disable <name>" }]);
|
|
16292
|
+
return true;
|
|
16293
|
+
}
|
|
16294
|
+
void setSkillEnabled(name, false, process.cwd()).then((result) => {
|
|
16295
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: `disabled skill '${name}' (${result.filepath})` }]);
|
|
16296
|
+
}).catch((err) => {
|
|
16297
|
+
setEvents((e) => [...e, { kind: "error", key: mkKey(), text: `failed to disable skill: ${err.message}` }]);
|
|
16298
|
+
});
|
|
16299
|
+
return true;
|
|
16300
|
+
}
|
|
16301
|
+
setEvents((e) => [
|
|
16302
|
+
...e,
|
|
16303
|
+
{ kind: "info", key: mkKey(), text: "usage: /skills list | add <name> | edit <name> | delete <name> | enable <name> | disable <name>" }
|
|
16304
|
+
]);
|
|
16305
|
+
return true;
|
|
16306
|
+
}
|
|
16157
16307
|
if (c === "/memory") {
|
|
16158
16308
|
if (!cfg) return true;
|
|
16159
16309
|
if (arg === "on") {
|
|
@@ -16358,7 +16508,7 @@ ${lines.join("\n")}` }]);
|
|
|
16358
16508
|
return true;
|
|
16359
16509
|
}
|
|
16360
16510
|
if (c === "/logout") {
|
|
16361
|
-
|
|
16511
|
+
unlink4(configPath()).catch(() => {
|
|
16362
16512
|
});
|
|
16363
16513
|
setEvents((e) => [
|
|
16364
16514
|
...e,
|
|
@@ -16556,23 +16706,27 @@ ${lines.join("\n")}` }]);
|
|
|
16556
16706
|
return true;
|
|
16557
16707
|
}
|
|
16558
16708
|
if (c === "/help") {
|
|
16559
|
-
|
|
16709
|
+
const lines = [
|
|
16710
|
+
"commands:",
|
|
16711
|
+
" /mode edit|plan|auto switch agent mode",
|
|
16712
|
+
" /thinking low|medium|high set reasoning effort",
|
|
16713
|
+
" /skills list|add|edit|... manage skills",
|
|
16714
|
+
" /memory on|off|clear manage memory",
|
|
16715
|
+
" /cost show cost report",
|
|
16716
|
+
" /compact summarize old turns",
|
|
16717
|
+
" /resume pick a past session",
|
|
16718
|
+
" /clear clear conversation",
|
|
16719
|
+
" /init scan repo and write KIMI.md",
|
|
16720
|
+
" /update check for updates",
|
|
16721
|
+
" /exit exit kimiflare"
|
|
16722
|
+
];
|
|
16723
|
+
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: lines.join("\n") }]);
|
|
16560
16724
|
return true;
|
|
16561
16725
|
}
|
|
16562
16726
|
return false;
|
|
16563
16727
|
},
|
|
16564
16728
|
[cfg, exit, usage, effort, theme, mode, openResumePicker, runCompact, runInit, initMcp, setCfg, setShowRemoteDashboard, setSelectedRemoteSession]
|
|
16565
16729
|
);
|
|
16566
|
-
const handleHelpCommand = useCallback2(
|
|
16567
|
-
(command) => {
|
|
16568
|
-
setShowHelpMenu(false);
|
|
16569
|
-
const executed = handleSlash(command);
|
|
16570
|
-
if (!executed) {
|
|
16571
|
-
setEvents((e) => [...e, { kind: "error", key: mkKey(), text: `unknown command: ${command}` }]);
|
|
16572
|
-
}
|
|
16573
|
-
},
|
|
16574
|
-
[handleSlash]
|
|
16575
|
-
);
|
|
16576
16730
|
const handleCommandSave = useCallback2(
|
|
16577
16731
|
async (opts2) => {
|
|
16578
16732
|
setCommandWizard(null);
|
|
@@ -16701,7 +16855,7 @@ ${lines.join("\n")}` }]);
|
|
|
16701
16855
|
}
|
|
16702
16856
|
}
|
|
16703
16857
|
turnCounterRef.current += 1;
|
|
16704
|
-
if (turnCounterRef.current % 15 === 0 && existsSync3(
|
|
16858
|
+
if (turnCounterRef.current % 15 === 0 && existsSync3(join25(process.cwd(), "KIMI.md")) && !kimiMdStale) {
|
|
16705
16859
|
setEvents((e) => [
|
|
16706
16860
|
...e,
|
|
16707
16861
|
{ kind: "info", key: mkKey(), text: "Tip: Rerunning /init occasionally helps KimiFlare stay accurate as your project evolves." }
|
|
@@ -16712,6 +16866,22 @@ ${lines.join("\n")}` }]);
|
|
|
16712
16866
|
setGatewayMeta(null);
|
|
16713
16867
|
setTurnStartedAt(Date.now());
|
|
16714
16868
|
const classification = classifyIntent(trimmed);
|
|
16869
|
+
setIntentTier(classification.tier);
|
|
16870
|
+
let skillResult;
|
|
16871
|
+
try {
|
|
16872
|
+
skillResult = await routeSkills(skillsDirRef.current, {
|
|
16873
|
+
cwd: process.cwd(),
|
|
16874
|
+
prompt: trimmed,
|
|
16875
|
+
memorySnippets: [],
|
|
16876
|
+
// TODO: wire memory snippets when available
|
|
16877
|
+
tier: classification.tier,
|
|
16878
|
+
maxSkillTokens: CONTEXT_LIMIT - 1e4
|
|
16879
|
+
// leave headroom
|
|
16880
|
+
});
|
|
16881
|
+
setSkillsActive(skillResult.selectedSkills.length);
|
|
16882
|
+
} catch {
|
|
16883
|
+
setSkillsActive(0);
|
|
16884
|
+
}
|
|
16715
16885
|
const effortForTier = {
|
|
16716
16886
|
light: "low",
|
|
16717
16887
|
medium: "medium",
|
|
@@ -16720,6 +16890,40 @@ ${lines.join("\n")}` }]);
|
|
|
16720
16890
|
const turnReasoningEffort = overrideEffort ?? effortForTier[classification.tier] ?? effortRef.current;
|
|
16721
16891
|
const effectiveCodeMode = classification.tier === "heavy";
|
|
16722
16892
|
setCodeMode(effectiveCodeMode);
|
|
16893
|
+
const selectedSkills = skillResult?.selectedSkills.map((s) => ({ name: s.name, body: s.body }));
|
|
16894
|
+
if (cacheStableRef.current) {
|
|
16895
|
+
messagesRef.current[1] = {
|
|
16896
|
+
role: "system",
|
|
16897
|
+
content: buildSessionPrefix({
|
|
16898
|
+
cwd: process.cwd(),
|
|
16899
|
+
tools: [...ALL_TOOLS, ...mcpToolsRef.current, ...lspToolsRef.current],
|
|
16900
|
+
model: cfg.model,
|
|
16901
|
+
mode: modeRef.current,
|
|
16902
|
+
selectedSkills
|
|
16903
|
+
})
|
|
16904
|
+
};
|
|
16905
|
+
} else {
|
|
16906
|
+
messagesRef.current[0] = {
|
|
16907
|
+
role: "system",
|
|
16908
|
+
content: buildSystemPrompt({
|
|
16909
|
+
cwd: process.cwd(),
|
|
16910
|
+
tools: [...ALL_TOOLS, ...mcpToolsRef.current, ...lspToolsRef.current],
|
|
16911
|
+
model: cfg.model,
|
|
16912
|
+
mode: modeRef.current,
|
|
16913
|
+
selectedSkills
|
|
16914
|
+
})
|
|
16915
|
+
};
|
|
16916
|
+
}
|
|
16917
|
+
setEvents((e) => [
|
|
16918
|
+
...e,
|
|
16919
|
+
{
|
|
16920
|
+
kind: "meta",
|
|
16921
|
+
key: mkKey(),
|
|
16922
|
+
intentTier: classification.tier,
|
|
16923
|
+
skillsActive: skillResult?.selectedSkills.length ?? 0,
|
|
16924
|
+
memoryRecalled: false
|
|
16925
|
+
}
|
|
16926
|
+
]);
|
|
16723
16927
|
const triageActivity = narrativizeInfo("", { tier: classification.tier, codeMode: effectiveCodeMode });
|
|
16724
16928
|
if (triageActivity) {
|
|
16725
16929
|
setEvents((e) => [...e, { kind: "activity", key: mkKey(), text: triageActivity.text, feature: triageActivity.feature }]);
|
|
@@ -16892,12 +17096,13 @@ ${lines.join("\n")}` }]);
|
|
|
16892
17096
|
cloudDeviceId: cloudDeviceId ?? initialCloudDeviceId,
|
|
16893
17097
|
onIterationEnd,
|
|
16894
17098
|
intentClassification: classification,
|
|
17099
|
+
selectedSkills,
|
|
16895
17100
|
onFileChange: (path, content2) => {
|
|
16896
17101
|
if (content2) {
|
|
16897
17102
|
lspManagerRef.current.notifyChange(path, content2);
|
|
16898
17103
|
} else {
|
|
16899
17104
|
void import("fs/promises").then(
|
|
16900
|
-
({ readFile:
|
|
17105
|
+
({ readFile: readFile20 }) => readFile20(path, "utf8").then((c) => lspManagerRef.current.notifyChange(path, c)).catch(() => {
|
|
16901
17106
|
})
|
|
16902
17107
|
);
|
|
16903
17108
|
}
|
|
@@ -17091,7 +17296,7 @@ ${lines.join("\n")}` }]);
|
|
|
17091
17296
|
}
|
|
17092
17297
|
}, [usage]);
|
|
17093
17298
|
if (!cfg) {
|
|
17094
|
-
return /* @__PURE__ */
|
|
17299
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsx22(
|
|
17095
17300
|
Onboarding,
|
|
17096
17301
|
{
|
|
17097
17302
|
onCancel: () => exit(),
|
|
@@ -17123,10 +17328,10 @@ ${lines.join("\n")}` }]);
|
|
|
17123
17328
|
) });
|
|
17124
17329
|
}
|
|
17125
17330
|
if (resumeSessions !== null) {
|
|
17126
|
-
return /* @__PURE__ */
|
|
17331
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsx22(Box20, { flexDirection: "column", children: /* @__PURE__ */ jsx22(ResumePicker, { sessions: resumeSessions, onPick: handleResumePick }) }) });
|
|
17127
17332
|
}
|
|
17128
17333
|
if (showRemoteDashboard) {
|
|
17129
|
-
return /* @__PURE__ */
|
|
17334
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsx22(Box20, { flexDirection: "column", children: selectedRemoteSession ? /* @__PURE__ */ jsx22(
|
|
17130
17335
|
RemoteSessionDetail,
|
|
17131
17336
|
{
|
|
17132
17337
|
session: selectedRemoteSession,
|
|
@@ -17149,7 +17354,7 @@ ${lines.join("\n")}` }]);
|
|
|
17149
17354
|
setShowRemoteDashboard(false);
|
|
17150
17355
|
}
|
|
17151
17356
|
}
|
|
17152
|
-
) : /* @__PURE__ */
|
|
17357
|
+
) : /* @__PURE__ */ jsx22(
|
|
17153
17358
|
RemoteDashboard,
|
|
17154
17359
|
{
|
|
17155
17360
|
onSelect: (session) => setSelectedRemoteSession(session),
|
|
@@ -17157,25 +17362,13 @@ ${lines.join("\n")}` }]);
|
|
|
17157
17362
|
}
|
|
17158
17363
|
) }) });
|
|
17159
17364
|
}
|
|
17160
|
-
if (showHelpMenu) {
|
|
17161
|
-
return /* @__PURE__ */ jsx23(ThemeProvider, { theme, children: /* @__PURE__ */ jsx23(Box21, { flexDirection: "column", children: /* @__PURE__ */ jsx23(
|
|
17162
|
-
HelpMenu,
|
|
17163
|
-
{
|
|
17164
|
-
customCommands: customCommandsRef.current.filter((c) => !BUILTIN_COMMAND_NAMES.has(c.name.toLowerCase())).map((c) => ({ name: c.name, description: c.description })),
|
|
17165
|
-
costAttributionEnabled: cfg?.costAttribution,
|
|
17166
|
-
cloudMode: cfg?.cloudMode,
|
|
17167
|
-
onDone: () => setShowHelpMenu(false),
|
|
17168
|
-
onCommand: handleHelpCommand
|
|
17169
|
-
}
|
|
17170
|
-
) }) });
|
|
17171
|
-
}
|
|
17172
17365
|
if (showLspWizard) {
|
|
17173
|
-
return /* @__PURE__ */
|
|
17366
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsx22(Box20, { flexDirection: "column", children: /* @__PURE__ */ jsx22(
|
|
17174
17367
|
LspWizard,
|
|
17175
17368
|
{
|
|
17176
17369
|
servers: cfg?.lspServers ?? {},
|
|
17177
17370
|
currentScope: lspScope,
|
|
17178
|
-
hasProjectDir: existsSync3(
|
|
17371
|
+
hasProjectDir: existsSync3(join25(process.cwd(), ".kimiflare")),
|
|
17179
17372
|
onDone: () => setShowLspWizard(false),
|
|
17180
17373
|
onSave: (servers, enabled, scope) => {
|
|
17181
17374
|
setCfg((c) => c ? { ...c, lspEnabled: enabled, lspServers: servers } : c);
|
|
@@ -17207,7 +17400,7 @@ ${lines.join("\n")}` }]);
|
|
|
17207
17400
|
) }) });
|
|
17208
17401
|
}
|
|
17209
17402
|
if (commandWizard) {
|
|
17210
|
-
return /* @__PURE__ */
|
|
17403
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsx22(Box20, { flexDirection: "column", children: /* @__PURE__ */ jsx22(
|
|
17211
17404
|
CommandWizard,
|
|
17212
17405
|
{
|
|
17213
17406
|
mode: commandWizard.mode,
|
|
@@ -17220,7 +17413,7 @@ ${lines.join("\n")}` }]);
|
|
|
17220
17413
|
) }) });
|
|
17221
17414
|
}
|
|
17222
17415
|
if (commandPicker) {
|
|
17223
|
-
return /* @__PURE__ */
|
|
17416
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsx22(Box20, { flexDirection: "column", children: /* @__PURE__ */ jsx22(
|
|
17224
17417
|
CommandPicker,
|
|
17225
17418
|
{
|
|
17226
17419
|
commands: customCommandsRef.current,
|
|
@@ -17238,15 +17431,15 @@ ${lines.join("\n")}` }]);
|
|
|
17238
17431
|
) }) });
|
|
17239
17432
|
}
|
|
17240
17433
|
if (commandToDelete) {
|
|
17241
|
-
return /* @__PURE__ */
|
|
17242
|
-
/* @__PURE__ */
|
|
17434
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
17435
|
+
/* @__PURE__ */ jsxs20(Text21, { color: theme.accent, bold: true, children: [
|
|
17243
17436
|
"Delete /",
|
|
17244
17437
|
commandToDelete.name,
|
|
17245
17438
|
"?"
|
|
17246
17439
|
] }),
|
|
17247
|
-
/* @__PURE__ */
|
|
17248
|
-
/* @__PURE__ */
|
|
17249
|
-
|
|
17440
|
+
/* @__PURE__ */ jsx22(Text21, { color: theme.info.color, children: commandToDelete.filepath }),
|
|
17441
|
+
/* @__PURE__ */ jsx22(Box20, { marginTop: 1, children: /* @__PURE__ */ jsx22(
|
|
17442
|
+
SelectInput10,
|
|
17250
17443
|
{
|
|
17251
17444
|
items: [
|
|
17252
17445
|
{ label: "Yes, delete", value: "yes", key: "yes" },
|
|
@@ -17264,7 +17457,7 @@ ${lines.join("\n")}` }]);
|
|
|
17264
17457
|
] }) });
|
|
17265
17458
|
}
|
|
17266
17459
|
if (showCommandList) {
|
|
17267
|
-
return /* @__PURE__ */
|
|
17460
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsx22(Box20, { flexDirection: "column", children: /* @__PURE__ */ jsx22(
|
|
17268
17461
|
CommandList,
|
|
17269
17462
|
{
|
|
17270
17463
|
commands: customCommandsRef.current,
|
|
@@ -17273,12 +17466,12 @@ ${lines.join("\n")}` }]);
|
|
|
17273
17466
|
) }) });
|
|
17274
17467
|
}
|
|
17275
17468
|
if (showThemePicker) {
|
|
17276
|
-
return /* @__PURE__ */
|
|
17469
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsx22(Box20, { flexDirection: "column", children: /* @__PURE__ */ jsx22(ThemePicker, { themes: themeList(), onPick: handleThemePick }) }) });
|
|
17277
17470
|
}
|
|
17278
17471
|
const hasConversation = events.some((e) => e.kind === "user" || e.kind === "assistant");
|
|
17279
|
-
return /* @__PURE__ */
|
|
17280
|
-
!hasConversation && events.length === 0 ? /* @__PURE__ */
|
|
17281
|
-
perm ? /* @__PURE__ */
|
|
17472
|
+
return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", children: [
|
|
17473
|
+
!hasConversation && events.length === 0 ? /* @__PURE__ */ jsx22(Welcome, { accountId: cfg.accountId, cloudMode: cfg.cloudMode }) : /* @__PURE__ */ jsx22(ChatView, { events, showReasoning, verbose, suppressTools: mode === "plan" }),
|
|
17474
|
+
perm ? /* @__PURE__ */ jsx22(
|
|
17282
17475
|
PermissionModal,
|
|
17283
17476
|
{
|
|
17284
17477
|
tool: perm.tool,
|
|
@@ -17289,7 +17482,7 @@ ${lines.join("\n")}` }]);
|
|
|
17289
17482
|
setPerm(null);
|
|
17290
17483
|
}
|
|
17291
17484
|
}
|
|
17292
|
-
) : limitModal ? /* @__PURE__ */
|
|
17485
|
+
) : limitModal ? /* @__PURE__ */ jsx22(
|
|
17293
17486
|
LimitModal,
|
|
17294
17487
|
{
|
|
17295
17488
|
limit: limitModal.limit,
|
|
@@ -17299,8 +17492,8 @@ ${lines.join("\n")}` }]);
|
|
|
17299
17492
|
setLimitModal(null);
|
|
17300
17493
|
}
|
|
17301
17494
|
}
|
|
17302
|
-
) : /* @__PURE__ */
|
|
17303
|
-
tasks.length > 0 && /* @__PURE__ */
|
|
17495
|
+
) : /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", marginTop: 1, children: [
|
|
17496
|
+
tasks.length > 0 && /* @__PURE__ */ jsx22(
|
|
17304
17497
|
TaskList,
|
|
17305
17498
|
{
|
|
17306
17499
|
tasks,
|
|
@@ -17308,11 +17501,11 @@ ${lines.join("\n")}` }]);
|
|
|
17308
17501
|
tokensDelta: Math.max(0, (usage?.prompt_tokens ?? 0) - tasksStartTokens)
|
|
17309
17502
|
}
|
|
17310
17503
|
),
|
|
17311
|
-
queue.length > 0 && /* @__PURE__ */
|
|
17504
|
+
queue.length > 0 && /* @__PURE__ */ jsx22(Box20, { flexDirection: "column", marginBottom: 1, children: queue.map((q, i) => /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
17312
17505
|
"\u23F3 ",
|
|
17313
17506
|
q.display
|
|
17314
17507
|
] }, `queue_${i}`)) }),
|
|
17315
|
-
/* @__PURE__ */
|
|
17508
|
+
/* @__PURE__ */ jsx22(
|
|
17316
17509
|
StatusBar,
|
|
17317
17510
|
{
|
|
17318
17511
|
model: cfg.model,
|
|
@@ -17329,13 +17522,15 @@ ${lines.join("\n")}` }]);
|
|
|
17329
17522
|
codeMode,
|
|
17330
17523
|
cloudMode: cfg.cloudMode,
|
|
17331
17524
|
cloudBudget,
|
|
17525
|
+
skillsActive,
|
|
17526
|
+
memoryRecalled,
|
|
17332
17527
|
phase: turnPhase,
|
|
17333
17528
|
currentTool: currentToolName,
|
|
17334
17529
|
lastActivityAt,
|
|
17335
17530
|
kimiMdStale
|
|
17336
17531
|
}
|
|
17337
17532
|
),
|
|
17338
|
-
activePicker?.kind === "file" && /* @__PURE__ */
|
|
17533
|
+
activePicker?.kind === "file" && /* @__PURE__ */ jsx22(
|
|
17339
17534
|
FilePicker,
|
|
17340
17535
|
{
|
|
17341
17536
|
items: filteredFileItems,
|
|
@@ -17343,7 +17538,7 @@ ${lines.join("\n")}` }]);
|
|
|
17343
17538
|
query: pickerQuery ?? ""
|
|
17344
17539
|
}
|
|
17345
17540
|
),
|
|
17346
|
-
activePicker?.kind === "slash" && /* @__PURE__ */
|
|
17541
|
+
activePicker?.kind === "slash" && /* @__PURE__ */ jsx22(
|
|
17347
17542
|
SlashPicker,
|
|
17348
17543
|
{
|
|
17349
17544
|
items: filteredSlashItems,
|
|
@@ -17351,9 +17546,9 @@ ${lines.join("\n")}` }]);
|
|
|
17351
17546
|
query: pickerQuery ?? ""
|
|
17352
17547
|
}
|
|
17353
17548
|
),
|
|
17354
|
-
/* @__PURE__ */
|
|
17355
|
-
/* @__PURE__ */
|
|
17356
|
-
/* @__PURE__ */
|
|
17549
|
+
/* @__PURE__ */ jsxs20(Box20, { marginTop: 1, children: [
|
|
17550
|
+
/* @__PURE__ */ jsx22(Text21, { color: "#d699b6", children: "\u203A " }),
|
|
17551
|
+
/* @__PURE__ */ jsx22(
|
|
17357
17552
|
CustomTextInput,
|
|
17358
17553
|
{
|
|
17359
17554
|
value: input,
|
|
@@ -17410,7 +17605,7 @@ ${lines.join("\n")}` }]);
|
|
|
17410
17605
|
}
|
|
17411
17606
|
async function renderApp(cfg, updateResult, lspScope = "global", lspProjectPath = null, cloudToken, cloudDeviceId) {
|
|
17412
17607
|
const instance = render(
|
|
17413
|
-
/* @__PURE__ */
|
|
17608
|
+
/* @__PURE__ */ jsx22(
|
|
17414
17609
|
App,
|
|
17415
17610
|
{
|
|
17416
17611
|
initialCfg: cfg,
|
|
@@ -17453,7 +17648,6 @@ var init_app = __esm({
|
|
|
17453
17648
|
init_update_check();
|
|
17454
17649
|
init_onboarding();
|
|
17455
17650
|
init_welcome();
|
|
17456
|
-
init_help_menu();
|
|
17457
17651
|
init_config();
|
|
17458
17652
|
init_worker_client();
|
|
17459
17653
|
init_session_store();
|
|
@@ -17462,14 +17656,16 @@ var init_app = __esm({
|
|
|
17462
17656
|
init_remote_dashboard();
|
|
17463
17657
|
init_mode();
|
|
17464
17658
|
init_classify();
|
|
17659
|
+
init_skills();
|
|
17660
|
+
init_manager3();
|
|
17465
17661
|
init_sessions();
|
|
17466
17662
|
init_image();
|
|
17467
17663
|
init_usage_tracker();
|
|
17468
|
-
|
|
17664
|
+
init_manager4();
|
|
17469
17665
|
init_storage_limits();
|
|
17470
17666
|
init_state();
|
|
17471
17667
|
init_version();
|
|
17472
|
-
|
|
17668
|
+
init_loader2();
|
|
17473
17669
|
init_renderer2();
|
|
17474
17670
|
init_builtins();
|
|
17475
17671
|
init_save();
|