kimiflare 0.82.1 → 0.83.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 +1254 -995
- package/dist/index.js.map +1 -1
- package/dist/sdk/index.d.ts +5 -0
- package/dist/sdk/index.js +88 -5
- package/dist/sdk/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3595,7 +3595,7 @@ How to work:
|
|
|
3595
3595
|
- Prefer calling tools over guessing. Read files before editing them. Use \`glob\` and \`grep\` to explore code before assuming structure.
|
|
3596
3596
|
- Before any mutating tool call (write, edit, bash), state in one short sentence what you're about to do, then call the tool. The user will be asked to approve each mutating call.
|
|
3597
3597
|
- When the user asks for a change, make the change. Do not paste code in chat that you could apply with \`edit\` or \`write\`.
|
|
3598
|
-
-
|
|
3598
|
+
- When working through a multi-step task list, you MUST call \`tasks_set\` **immediately before starting each new step** and **immediately after completing each step**. Do not execute mutating tools (\`write\`, \`edit\`, \`bash\`) without updating task progress first. Skip \`tasks_set\` for trivial single-step requests.
|
|
3599
3599
|
- Keep responses terse. The user sees tool calls and their results inline \u2014 do not re-summarize them unless asked.
|
|
3600
3600
|
- If a tool returns an error, read it carefully and adjust; do not retry the same call blindly.
|
|
3601
3601
|
- Read as much of a file as needed rather than guessing; your context window is large enough to absorb whole files.
|
|
@@ -3877,6 +3877,16 @@ Use console.log() to return results. Only console.log output will be sent back t
|
|
|
3877
3877
|
let iter = 0;
|
|
3878
3878
|
let budgetExhausted = false;
|
|
3879
3879
|
let loopExhausted = false;
|
|
3880
|
+
let currentTasks = [];
|
|
3881
|
+
let mutatingToolsSinceLastTasksSet = 0;
|
|
3882
|
+
const MUTATING_TOOLS2 = /* @__PURE__ */ new Set(["write", "edit", "bash"]);
|
|
3883
|
+
const AUTO_ADVANCE_THRESHOLD = 3;
|
|
3884
|
+
const originalOnTasks = opts2.callbacks.onTasks;
|
|
3885
|
+
const wrappedOnTasks = (tasks) => {
|
|
3886
|
+
currentTasks = tasks;
|
|
3887
|
+
mutatingToolsSinceLastTasksSet = 0;
|
|
3888
|
+
originalOnTasks?.(tasks);
|
|
3889
|
+
};
|
|
3880
3890
|
while (true) {
|
|
3881
3891
|
if (budgetExhausted) {
|
|
3882
3892
|
opts2.messages.push({
|
|
@@ -4092,7 +4102,7 @@ Use console.log() to return results. Only console.log output will be sent back t
|
|
|
4092
4102
|
return;
|
|
4093
4103
|
}
|
|
4094
4104
|
let blockedCount = 0;
|
|
4095
|
-
for (const tc of toolCalls) {
|
|
4105
|
+
for (const [i, tc] of toolCalls.entries()) {
|
|
4096
4106
|
if (opts2.signal.aborted) throw new DOMException("aborted", "AbortError");
|
|
4097
4107
|
const loopSignature = `${tc.function.name}:${stableStringify(tc.function.arguments)}`;
|
|
4098
4108
|
const loopCount = recentToolCalls.filter((s) => s === loopSignature).length;
|
|
@@ -4200,7 +4210,7 @@ Use console.log() to return results. Only console.log output will be sent back t
|
|
|
4200
4210
|
tools: opts2.tools,
|
|
4201
4211
|
executor: opts2.executor,
|
|
4202
4212
|
askPermission: opts2.callbacks.askPermission,
|
|
4203
|
-
ctx: { cwd: opts2.cwd, signal: opts2.signal, onTasks: opts2.callbacks.
|
|
4213
|
+
ctx: { cwd: opts2.cwd, signal: opts2.signal, onTasks: wrappedOnTasks, onPlanOptions: opts2.callbacks.onPlanOptions, coauthor: opts2.coauthor, memoryManager: opts2.memoryManager, sessionId: opts2.sessionId, githubToken: opts2.githubToken },
|
|
4204
4214
|
timeoutMs: 3e4,
|
|
4205
4215
|
memoryLimitMB: 128
|
|
4206
4216
|
});
|
|
@@ -4260,7 +4270,8 @@ ${sandboxResult.output}` : sandboxResult.output;
|
|
|
4260
4270
|
{
|
|
4261
4271
|
cwd: opts2.cwd,
|
|
4262
4272
|
signal: opts2.signal,
|
|
4263
|
-
onTasks:
|
|
4273
|
+
onTasks: wrappedOnTasks,
|
|
4274
|
+
onPlanOptions: opts2.callbacks.onPlanOptions,
|
|
4264
4275
|
coauthor: opts2.coauthor,
|
|
4265
4276
|
memoryManager: opts2.memoryManager,
|
|
4266
4277
|
sessionId: opts2.sessionId,
|
|
@@ -4397,6 +4408,24 @@ ${sandboxResult.output}` : sandboxResult.output;
|
|
|
4397
4408
|
recentToolCalls.push(loopSignature);
|
|
4398
4409
|
if (recentToolCalls.length > LOOP_WINDOW) recentToolCalls.shift();
|
|
4399
4410
|
}
|
|
4411
|
+
if (MUTATING_TOOLS2.has(tc.function.name)) {
|
|
4412
|
+
mutatingToolsSinceLastTasksSet++;
|
|
4413
|
+
const hasTasksSetComing = toolCalls.slice(i + 1).some((t) => t.function.name === "tasks_set");
|
|
4414
|
+
if (!hasTasksSetComing && mutatingToolsSinceLastTasksSet >= AUTO_ADVANCE_THRESHOLD) {
|
|
4415
|
+
const inProgressIdx = currentTasks.findIndex((t) => t.status === "in_progress");
|
|
4416
|
+
const nextPendingIdx = currentTasks.findIndex((t) => t.status === "pending");
|
|
4417
|
+
if (inProgressIdx !== -1 && nextPendingIdx !== -1) {
|
|
4418
|
+
const updated = currentTasks.map((t, idx) => {
|
|
4419
|
+
if (idx === inProgressIdx) return { ...t, status: "completed" };
|
|
4420
|
+
if (idx === nextPendingIdx) return { ...t, status: "in_progress" };
|
|
4421
|
+
return t;
|
|
4422
|
+
});
|
|
4423
|
+
currentTasks = updated;
|
|
4424
|
+
mutatingToolsSinceLastTasksSet = 0;
|
|
4425
|
+
wrappedOnTasks(updated);
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4400
4429
|
}
|
|
4401
4430
|
if (blockedCount === toolCalls.length && toolCalls.length > 0) {
|
|
4402
4431
|
loopExhausted = true;
|
|
@@ -6264,6 +6293,65 @@ var init_spawn_worker = __esm({
|
|
|
6264
6293
|
}
|
|
6265
6294
|
});
|
|
6266
6295
|
|
|
6296
|
+
// src/tools/plan-options.ts
|
|
6297
|
+
function validatePlanOptions(input) {
|
|
6298
|
+
if (!Array.isArray(input)) throw new Error("options must be an array");
|
|
6299
|
+
return input.map((item, i) => {
|
|
6300
|
+
if (!item || typeof item !== "object") throw new Error(`options[${i}] must be an object`);
|
|
6301
|
+
const rec = item;
|
|
6302
|
+
const label = typeof rec.label === "string" ? rec.label.trim() : "";
|
|
6303
|
+
if (!label) throw new Error(`options[${i}].label is required`);
|
|
6304
|
+
const plan = typeof rec.plan === "string" ? rec.plan.trim() : "";
|
|
6305
|
+
if (!plan) throw new Error(`options[${i}].plan is required`);
|
|
6306
|
+
return { label, plan };
|
|
6307
|
+
});
|
|
6308
|
+
}
|
|
6309
|
+
var presentPlanOptionsTool;
|
|
6310
|
+
var init_plan_options = __esm({
|
|
6311
|
+
"src/tools/plan-options.ts"() {
|
|
6312
|
+
"use strict";
|
|
6313
|
+
presentPlanOptionsTool = {
|
|
6314
|
+
name: "present_plan_options",
|
|
6315
|
+
description: [
|
|
6316
|
+
"Present a list of plan options to the user and let them pick one.",
|
|
6317
|
+
"Use this when you have multiple viable approaches and want the user to choose",
|
|
6318
|
+
"which plan to pursue. Each option needs a short label and the full plan text.",
|
|
6319
|
+
"After the user selects an option, the session resets and starts fresh with the chosen plan."
|
|
6320
|
+
].join(" "),
|
|
6321
|
+
parameters: {
|
|
6322
|
+
type: "object",
|
|
6323
|
+
properties: {
|
|
6324
|
+
options: {
|
|
6325
|
+
type: "array",
|
|
6326
|
+
description: "The list of plan options to present to the user.",
|
|
6327
|
+
items: {
|
|
6328
|
+
type: "object",
|
|
6329
|
+
properties: {
|
|
6330
|
+
label: {
|
|
6331
|
+
type: "string",
|
|
6332
|
+
description: "Short human-readable label for this option (shown in the picker)."
|
|
6333
|
+
},
|
|
6334
|
+
plan: {
|
|
6335
|
+
type: "string",
|
|
6336
|
+
description: "The full plan text that will seed the new session if this option is chosen."
|
|
6337
|
+
}
|
|
6338
|
+
},
|
|
6339
|
+
required: ["label", "plan"]
|
|
6340
|
+
}
|
|
6341
|
+
}
|
|
6342
|
+
},
|
|
6343
|
+
required: ["options"]
|
|
6344
|
+
},
|
|
6345
|
+
needsPermission: false,
|
|
6346
|
+
run: async (args, ctx) => {
|
|
6347
|
+
const options = validatePlanOptions(args.options);
|
|
6348
|
+
ctx.onPlanOptions?.(options);
|
|
6349
|
+
return `Presented ${options.length} plan option(s) to the user.`;
|
|
6350
|
+
}
|
|
6351
|
+
};
|
|
6352
|
+
}
|
|
6353
|
+
});
|
|
6354
|
+
|
|
6267
6355
|
// src/tools/artifact-store.ts
|
|
6268
6356
|
var ToolArtifactStore;
|
|
6269
6357
|
var init_artifact_store = __esm({
|
|
@@ -6892,6 +6980,7 @@ var init_executor = __esm({
|
|
|
6892
6980
|
init_tasks();
|
|
6893
6981
|
init_memory();
|
|
6894
6982
|
init_spawn_worker();
|
|
6983
|
+
init_plan_options();
|
|
6895
6984
|
init_artifact_store();
|
|
6896
6985
|
init_reducer();
|
|
6897
6986
|
init_expand_artifact();
|
|
@@ -6912,7 +7001,8 @@ var init_executor = __esm({
|
|
|
6912
7001
|
memoryRememberTool,
|
|
6913
7002
|
memoryRecallTool,
|
|
6914
7003
|
memoryForgetTool,
|
|
6915
|
-
spawnWorkerTool
|
|
7004
|
+
spawnWorkerTool,
|
|
7005
|
+
presentPlanOptionsTool
|
|
6916
7006
|
];
|
|
6917
7007
|
HOOK_RESULT_CONTENT_CAP_BYTES = 4 * 1024;
|
|
6918
7008
|
ToolExecutor = class {
|
|
@@ -10764,7 +10854,7 @@ async function getCostReport(sessionId) {
|
|
|
10764
10854
|
promptTokens: rawSession.promptTokens,
|
|
10765
10855
|
completionTokens: rawSession.completionTokens,
|
|
10766
10856
|
cachedTokens: rawSession.cachedTokens,
|
|
10767
|
-
cost: rawSession.cost,
|
|
10857
|
+
cost: rawSession.cost + (rawSession.baselineCost ?? 0),
|
|
10768
10858
|
gatewayRequests: rawSession.gatewayRequests,
|
|
10769
10859
|
gatewayCachedRequests: rawSession.gatewayCachedRequests,
|
|
10770
10860
|
gatewayCost: rawSession.gatewayCost,
|
|
@@ -10808,6 +10898,16 @@ async function getCostReport(sessionId) {
|
|
|
10808
10898
|
}
|
|
10809
10899
|
return { session, today: todayUsage, month: monthUsage, allTime };
|
|
10810
10900
|
}
|
|
10901
|
+
async function carryOverSessionBaseline(fromSessionId, toSessionId) {
|
|
10902
|
+
await withLock(async () => {
|
|
10903
|
+
const log2 = pruneUsageLog(await loadLog2());
|
|
10904
|
+
const fromSession = log2.sessions.find((s) => s.id === fromSessionId);
|
|
10905
|
+
const baseline = fromSession ? Math.max(0, fromSession.cost + (fromSession.baselineCost ?? 0)) : 0;
|
|
10906
|
+
const toSession = getOrCreateSession(log2, toSessionId, today2());
|
|
10907
|
+
toSession.baselineCost = baseline;
|
|
10908
|
+
await saveLog(log2);
|
|
10909
|
+
});
|
|
10910
|
+
}
|
|
10811
10911
|
function hasPendingReconcile(session) {
|
|
10812
10912
|
if (!session.turns) return false;
|
|
10813
10913
|
return session.turns.some(
|
|
@@ -16631,6 +16731,7 @@ ${err instanceof Error ? err.message : err}`);
|
|
|
16631
16731
|
let streamCounter = 0;
|
|
16632
16732
|
let currentStreamId = null;
|
|
16633
16733
|
const repeatedToolSignatures = /* @__PURE__ */ new Map();
|
|
16734
|
+
const planOptionsRef = { current: null };
|
|
16634
16735
|
async function runTurn(text) {
|
|
16635
16736
|
kimiLog({ dir: "turn", phase: "start", text_preview: text.slice(0, 80) });
|
|
16636
16737
|
const before = recentMentions.size;
|
|
@@ -16783,6 +16884,9 @@ Executor opened PR: ${prUrl}` : plan });
|
|
|
16783
16884
|
cam.send("BackgroundTaskUpdate", { task_id: t.id, label: t.title, state });
|
|
16784
16885
|
}
|
|
16785
16886
|
},
|
|
16887
|
+
onPlanOptions: (options) => {
|
|
16888
|
+
planOptionsRef.current = options;
|
|
16889
|
+
},
|
|
16786
16890
|
onSkillsSelected: (result) => {
|
|
16787
16891
|
const n = result?.selected?.length ?? 0;
|
|
16788
16892
|
if (n > 0) {
|
|
@@ -16924,6 +17028,47 @@ Executor opened PR: ${prUrl}` : plan });
|
|
|
16924
17028
|
setPhase("idle");
|
|
16925
17029
|
cam.send("StatusUpdate", { segments: { elapsed: "" } });
|
|
16926
17030
|
kimiLog({ dir: "turn", phase: "end" });
|
|
17031
|
+
if (planOptionsRef.current && !currentController?.signal.aborted) {
|
|
17032
|
+
const options = planOptionsRef.current;
|
|
17033
|
+
planOptionsRef.current = null;
|
|
17034
|
+
const pick3 = await selectList(cam, {
|
|
17035
|
+
id: `plan-options-${Date.now()}`,
|
|
17036
|
+
prompt: "Choose a plan to start fresh with",
|
|
17037
|
+
options: [
|
|
17038
|
+
...options.map((o, i) => ({
|
|
17039
|
+
value: String(i),
|
|
17040
|
+
label: o.label
|
|
17041
|
+
})),
|
|
17042
|
+
{ value: "__chat__", label: "Chat about this" }
|
|
17043
|
+
],
|
|
17044
|
+
allow_cancel: true
|
|
17045
|
+
});
|
|
17046
|
+
if (pick3.cancelled || pick3.value === null) {
|
|
17047
|
+
} else if (pick3.value === "__chat__") {
|
|
17048
|
+
} else {
|
|
17049
|
+
const selected = options[Number(pick3.value)];
|
|
17050
|
+
if (selected) {
|
|
17051
|
+
const systemMessages = messages.filter((m) => m.role === "system");
|
|
17052
|
+
messages.length = 0;
|
|
17053
|
+
messages.push(...systemMessages);
|
|
17054
|
+
sessionCostUsd = 0;
|
|
17055
|
+
promptTokens = 0;
|
|
17056
|
+
cachedTokens = 0;
|
|
17057
|
+
completionTokens = 0;
|
|
17058
|
+
cam.send("TranscriptCleared", {});
|
|
17059
|
+
cam.send("StatusUpdate", {
|
|
17060
|
+
segments: { tokens: "in 0", cost: "$0.00", elapsed: "" }
|
|
17061
|
+
});
|
|
17062
|
+
messages.push({ role: "user", content: selected.plan });
|
|
17063
|
+
cam.send("UserMessageCreated", { text: selected.plan });
|
|
17064
|
+
cam.send("ShowToast", {
|
|
17065
|
+
text: `Starting fresh with plan: ${selected.label}`,
|
|
17066
|
+
kind: "success",
|
|
17067
|
+
ttl_ms: 3e3
|
|
17068
|
+
});
|
|
17069
|
+
}
|
|
17070
|
+
}
|
|
17071
|
+
}
|
|
16927
17072
|
}
|
|
16928
17073
|
}
|
|
16929
17074
|
async function nextFollowUp() {
|
|
@@ -21360,15 +21505,80 @@ var init_checkpoint_picker = __esm({
|
|
|
21360
21505
|
}
|
|
21361
21506
|
});
|
|
21362
21507
|
|
|
21508
|
+
// src/ui/plan-options-picker.tsx
|
|
21509
|
+
import { useState as useState8 } from "react";
|
|
21510
|
+
import { Box as Box10, Text as Text11, useInput as useInput5 } from "ink";
|
|
21511
|
+
import SelectInput3 from "ink-select-input";
|
|
21512
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
21513
|
+
function PlanOptionsPicker({ options, onPick }) {
|
|
21514
|
+
const theme = useTheme();
|
|
21515
|
+
const [selectedIndex, setSelectedIndex] = useState8(0);
|
|
21516
|
+
useInput5((input, key) => {
|
|
21517
|
+
if (input === "q" || key.escape) {
|
|
21518
|
+
onPick(null);
|
|
21519
|
+
return;
|
|
21520
|
+
}
|
|
21521
|
+
});
|
|
21522
|
+
const items = [
|
|
21523
|
+
...options.map((opt, i) => ({
|
|
21524
|
+
label: `${i + 1}. ${opt.label}`,
|
|
21525
|
+
value: String(i)
|
|
21526
|
+
})),
|
|
21527
|
+
{
|
|
21528
|
+
label: "Chat about this",
|
|
21529
|
+
value: "__chat__"
|
|
21530
|
+
}
|
|
21531
|
+
];
|
|
21532
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
21533
|
+
/* @__PURE__ */ jsx12(Text11, { color: theme.accent, bold: true, children: "Choose a plan to start fresh with" }),
|
|
21534
|
+
/* @__PURE__ */ jsxs10(Text11, { color: theme.info.color, children: [
|
|
21535
|
+
options.length,
|
|
21536
|
+
" option",
|
|
21537
|
+
options.length === 1 ? "" : "s",
|
|
21538
|
+
" available"
|
|
21539
|
+
] }),
|
|
21540
|
+
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(
|
|
21541
|
+
SelectInput3,
|
|
21542
|
+
{
|
|
21543
|
+
items,
|
|
21544
|
+
initialIndex: selectedIndex,
|
|
21545
|
+
onHighlight: (item) => {
|
|
21546
|
+
const idx = items.findIndex((i) => i.value === item.value);
|
|
21547
|
+
if (idx >= 0) setSelectedIndex(idx);
|
|
21548
|
+
},
|
|
21549
|
+
onSelect: (item) => {
|
|
21550
|
+
if (item.value === "__chat__") {
|
|
21551
|
+
onPick(null);
|
|
21552
|
+
return;
|
|
21553
|
+
}
|
|
21554
|
+
const opt = options[Number(item.value)];
|
|
21555
|
+
if (opt) {
|
|
21556
|
+
onPick(opt);
|
|
21557
|
+
} else {
|
|
21558
|
+
onPick(null);
|
|
21559
|
+
}
|
|
21560
|
+
}
|
|
21561
|
+
}
|
|
21562
|
+
) }),
|
|
21563
|
+
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text11, { color: theme.info.color, children: "q / Esc: cancel" }) })
|
|
21564
|
+
] });
|
|
21565
|
+
}
|
|
21566
|
+
var init_plan_options_picker = __esm({
|
|
21567
|
+
"src/ui/plan-options-picker.tsx"() {
|
|
21568
|
+
"use strict";
|
|
21569
|
+
init_theme_context();
|
|
21570
|
+
}
|
|
21571
|
+
});
|
|
21572
|
+
|
|
21363
21573
|
// src/ui/task-list.tsx
|
|
21364
|
-
import { useEffect as useEffect4, useRef as useRef3, useState as
|
|
21365
|
-
import { Box as
|
|
21574
|
+
import { useEffect as useEffect4, useRef as useRef3, useState as useState9 } from "react";
|
|
21575
|
+
import { Box as Box11, Text as Text12 } from "ink";
|
|
21366
21576
|
import Spinner4 from "ink-spinner";
|
|
21367
|
-
import { jsx as
|
|
21577
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
21368
21578
|
function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
21369
21579
|
const theme = useTheme();
|
|
21370
|
-
const [now2, setNow] =
|
|
21371
|
-
const [celebrating, setCelebrating] =
|
|
21580
|
+
const [now2, setNow] = useState9(Date.now());
|
|
21581
|
+
const [celebrating, setCelebrating] = useState9(false);
|
|
21372
21582
|
const tasksRef = useRef3(tasks);
|
|
21373
21583
|
const prevAllDoneRef = useRef3(false);
|
|
21374
21584
|
tasksRef.current = tasks;
|
|
@@ -21402,18 +21612,18 @@ function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
|
21402
21612
|
const headerStats = [elapsed, tokensDelta > 0 ? `\u2191 ${formatTokens(tokensDelta)} tokens` : null].filter(Boolean).join(" \xB7 ");
|
|
21403
21613
|
const visibleTasks = tasks.slice(0, MAX_VISIBLE);
|
|
21404
21614
|
const hiddenPending = Math.max(0, tasks.length - visibleTasks.length);
|
|
21405
|
-
return /* @__PURE__ */
|
|
21406
|
-
/* @__PURE__ */
|
|
21407
|
-
/* @__PURE__ */
|
|
21408
|
-
headerStats && /* @__PURE__ */
|
|
21615
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", marginBottom: 1, children: [
|
|
21616
|
+
/* @__PURE__ */ jsxs11(Box11, { children: [
|
|
21617
|
+
/* @__PURE__ */ jsx13(Text12, { color: celebrating ? theme.palette.success : allDone ? "green" : theme.accent, bold: true, children: celebrating ? `\u2728 ${header}` : header }),
|
|
21618
|
+
headerStats && /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
|
|
21409
21619
|
" ",
|
|
21410
21620
|
"(",
|
|
21411
21621
|
headerStats,
|
|
21412
21622
|
")"
|
|
21413
21623
|
] })
|
|
21414
21624
|
] }),
|
|
21415
|
-
visibleTasks.map((t) => /* @__PURE__ */
|
|
21416
|
-
hiddenPending > 0 && /* @__PURE__ */
|
|
21625
|
+
visibleTasks.map((t) => /* @__PURE__ */ jsx13(TaskRow, { task: t }, t.id)),
|
|
21626
|
+
hiddenPending > 0 && /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
|
|
21417
21627
|
" ",
|
|
21418
21628
|
"\u2026 +",
|
|
21419
21629
|
hiddenPending,
|
|
@@ -21424,21 +21634,21 @@ function TaskList({ tasks, startedAt, tokensDelta }) {
|
|
|
21424
21634
|
function TaskRow({ task }) {
|
|
21425
21635
|
const theme = useTheme();
|
|
21426
21636
|
if (task.status === "completed") {
|
|
21427
|
-
return /* @__PURE__ */
|
|
21637
|
+
return /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
|
|
21428
21638
|
" ",
|
|
21429
21639
|
"\u2713 ",
|
|
21430
|
-
/* @__PURE__ */
|
|
21640
|
+
/* @__PURE__ */ jsx13(Text12, { strikethrough: true, children: task.title })
|
|
21431
21641
|
] });
|
|
21432
21642
|
}
|
|
21433
21643
|
if (task.status === "in_progress") {
|
|
21434
|
-
return /* @__PURE__ */
|
|
21644
|
+
return /* @__PURE__ */ jsxs11(Text12, { color: theme.accent, bold: true, children: [
|
|
21435
21645
|
" ",
|
|
21436
|
-
/* @__PURE__ */
|
|
21646
|
+
/* @__PURE__ */ jsx13(Spinner4, { type: "line" }),
|
|
21437
21647
|
" ",
|
|
21438
21648
|
task.title
|
|
21439
21649
|
] });
|
|
21440
21650
|
}
|
|
21441
|
-
return /* @__PURE__ */
|
|
21651
|
+
return /* @__PURE__ */ jsxs11(Text12, { color: theme.info.color, children: [
|
|
21442
21652
|
" ",
|
|
21443
21653
|
"\u2610 ",
|
|
21444
21654
|
task.title
|
|
@@ -21465,10 +21675,10 @@ var init_task_list = __esm({
|
|
|
21465
21675
|
});
|
|
21466
21676
|
|
|
21467
21677
|
// src/ui/worker-list.tsx
|
|
21468
|
-
import { useEffect as useEffect5, useState as
|
|
21469
|
-
import { Box as
|
|
21678
|
+
import { useEffect as useEffect5, useState as useState10 } from "react";
|
|
21679
|
+
import { Box as Box12, Text as Text13 } from "ink";
|
|
21470
21680
|
import Spinner5 from "ink-spinner";
|
|
21471
|
-
import { jsx as
|
|
21681
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
21472
21682
|
function WorkerList({ workers, isSynthesizing, narration }) {
|
|
21473
21683
|
const theme = useTheme();
|
|
21474
21684
|
if (workers.length === 0 && !narration) return null;
|
|
@@ -21478,12 +21688,12 @@ function WorkerList({ workers, isSynthesizing, narration }) {
|
|
|
21478
21688
|
const budgetExhausted = workers.filter((w) => w.status === "budget_exhausted").length;
|
|
21479
21689
|
const pending = workers.filter((w) => w.status === "pending").length;
|
|
21480
21690
|
const showSynthesis = isSynthesizing && running === 0;
|
|
21481
|
-
return /* @__PURE__ */
|
|
21482
|
-
narration && /* @__PURE__ */
|
|
21691
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", marginBottom: 1, children: [
|
|
21692
|
+
narration && /* @__PURE__ */ jsx14(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, italic: true, children: narration.split("\n").map((line, i) => /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
21483
21693
|
line,
|
|
21484
21694
|
"\n"
|
|
21485
21695
|
] }, `narration-${i}`)) }) }),
|
|
21486
|
-
/* @__PURE__ */
|
|
21696
|
+
/* @__PURE__ */ jsx14(Box12, { children: /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, bold: true, children: [
|
|
21487
21697
|
"Workers: ",
|
|
21488
21698
|
pending > 0 ? `${pending} todo \xB7 ` : "",
|
|
21489
21699
|
running > 0 ? `${running} ongoing \xB7 ` : "",
|
|
@@ -21496,7 +21706,7 @@ function WorkerList({ workers, isSynthesizing, narration }) {
|
|
|
21496
21706
|
if (!anyPreRead) return null;
|
|
21497
21707
|
const fileCount = anyPreRead.preReadFiles.length;
|
|
21498
21708
|
const chars = anyPreRead.preReadChars ?? 0;
|
|
21499
|
-
return /* @__PURE__ */
|
|
21709
|
+
return /* @__PURE__ */ jsx14(Box12, { marginLeft: 2, children: /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
21500
21710
|
"\u{1F4E6} Shared cache: ",
|
|
21501
21711
|
fileCount,
|
|
21502
21712
|
" file",
|
|
@@ -21506,18 +21716,18 @@ function WorkerList({ workers, isSynthesizing, narration }) {
|
|
|
21506
21716
|
" chars)"
|
|
21507
21717
|
] }) });
|
|
21508
21718
|
})(),
|
|
21509
|
-
workers.map((w) => /* @__PURE__ */
|
|
21510
|
-
showSynthesis && /* @__PURE__ */
|
|
21511
|
-
/* @__PURE__ */
|
|
21719
|
+
workers.map((w) => /* @__PURE__ */ jsx14(WorkerRow, { worker: w }, w.id)),
|
|
21720
|
+
showSynthesis && /* @__PURE__ */ jsx14(Box12, { marginLeft: 2, children: /* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, children: [
|
|
21721
|
+
/* @__PURE__ */ jsx14(Spinner5, { type: "dots" }),
|
|
21512
21722
|
" ",
|
|
21513
|
-
/* @__PURE__ */
|
|
21723
|
+
/* @__PURE__ */ jsx14(Text13, { bold: true, children: "[coordinator]" }),
|
|
21514
21724
|
" Synthesizing findings\u2026"
|
|
21515
21725
|
] }) })
|
|
21516
21726
|
] });
|
|
21517
21727
|
}
|
|
21518
21728
|
function WorkerRow({ worker }) {
|
|
21519
21729
|
const theme = useTheme();
|
|
21520
|
-
const [now2, setNow] =
|
|
21730
|
+
const [now2, setNow] = useState10(Date.now());
|
|
21521
21731
|
useEffect5(() => {
|
|
21522
21732
|
if (worker.status !== "running") return;
|
|
21523
21733
|
const id = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -21525,22 +21735,22 @@ function WorkerRow({ worker }) {
|
|
|
21525
21735
|
}, [worker.status]);
|
|
21526
21736
|
const elapsed = formatElapsed6(now2 - worker.startedAt);
|
|
21527
21737
|
const modeLabel2 = worker.mode === "plan" ? "research" : "executor";
|
|
21528
|
-
const statusIcon = worker.status === "pending" ? /* @__PURE__ */
|
|
21738
|
+
const statusIcon = worker.status === "pending" ? /* @__PURE__ */ jsx14(Text13, { color: theme.muted?.color ?? theme.info.color, children: "\u2610" }) : worker.status === "running" ? /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, children: /* @__PURE__ */ jsx14(Spinner5, { type: "line" }) }) : worker.status === "completed" ? /* @__PURE__ */ jsx14(Text13, { color: theme.palette.success, children: "\u2611" }) : worker.status === "budget_exhausted" ? /* @__PURE__ */ jsx14(Text13, { color: theme.info.color, children: "\u26A0" }) : /* @__PURE__ */ jsx14(Text13, { color: theme.palette.error, children: "\u2612" });
|
|
21529
21739
|
const statusLabel = worker.status === "pending" ? "todo" : worker.status === "running" ? "ongoing" : worker.status === "completed" ? "done" : worker.status === "budget_exhausted" ? "budget hit" : "failed";
|
|
21530
21740
|
const isDone = worker.status === "completed" || worker.status === "failed" || worker.status === "budget_exhausted";
|
|
21531
21741
|
const hasSteps = worker.steps && worker.steps.length > 0;
|
|
21532
|
-
return /* @__PURE__ */
|
|
21533
|
-
/* @__PURE__ */
|
|
21742
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", marginLeft: 2, children: [
|
|
21743
|
+
/* @__PURE__ */ jsx14(Box12, { children: /* @__PURE__ */ jsxs12(Text13, { children: [
|
|
21534
21744
|
statusIcon,
|
|
21535
21745
|
" ",
|
|
21536
|
-
/* @__PURE__ */
|
|
21746
|
+
/* @__PURE__ */ jsxs12(Text13, { color: theme.info.color, bold: true, children: [
|
|
21537
21747
|
"[",
|
|
21538
21748
|
modeLabel2,
|
|
21539
21749
|
"]"
|
|
21540
21750
|
] }),
|
|
21541
21751
|
" ",
|
|
21542
|
-
/* @__PURE__ */
|
|
21543
|
-
|
|
21752
|
+
/* @__PURE__ */ jsx14(
|
|
21753
|
+
Text13,
|
|
21544
21754
|
{
|
|
21545
21755
|
color: isDone ? theme.muted?.color ?? theme.info.color : theme.info.color,
|
|
21546
21756
|
italic: worker.status === "pending",
|
|
@@ -21548,48 +21758,48 @@ function WorkerRow({ worker }) {
|
|
|
21548
21758
|
children: worker.task.slice(0, 60)
|
|
21549
21759
|
}
|
|
21550
21760
|
),
|
|
21551
|
-
worker.status === "running" ? /* @__PURE__ */
|
|
21761
|
+
worker.status === "running" ? /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, children: [
|
|
21552
21762
|
" \xB7 ",
|
|
21553
21763
|
elapsed
|
|
21554
|
-
] }) : /* @__PURE__ */
|
|
21764
|
+
] }) : /* @__PURE__ */ jsxs12(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
|
|
21555
21765
|
" ",
|
|
21556
21766
|
"\xB7 ",
|
|
21557
21767
|
statusLabel
|
|
21558
21768
|
] }),
|
|
21559
|
-
worker.error ? /* @__PURE__ */
|
|
21769
|
+
worker.error ? /* @__PURE__ */ jsxs12(Text13, { color: theme.palette.error, children: [
|
|
21560
21770
|
" \xB7 ",
|
|
21561
21771
|
worker.error.slice(0, 60)
|
|
21562
21772
|
] }) : null
|
|
21563
21773
|
] }) }),
|
|
21564
|
-
hasSteps && /* @__PURE__ */
|
|
21565
|
-
worker.logs.length > 0 && /* @__PURE__ */
|
|
21566
|
-
isDone && worker.result?.phases && worker.result.phases.length > 0 && /* @__PURE__ */
|
|
21774
|
+
hasSteps && /* @__PURE__ */ jsx14(Box12, { flexDirection: "column", marginLeft: 4, children: worker.steps.map((step, i) => /* @__PURE__ */ jsx14(StepRow, { step, theme }, `${worker.id}-step-${i}`)) }),
|
|
21775
|
+
worker.logs.length > 0 && /* @__PURE__ */ jsx14(Box12, { flexDirection: "column", marginLeft: 4, children: worker.logs.slice(-3).map((line, i) => /* @__PURE__ */ jsx14(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: line.slice(0, 120) }, `${worker.id}-log-${i}`)) }),
|
|
21776
|
+
isDone && worker.result?.phases && worker.result.phases.length > 0 && /* @__PURE__ */ jsx14(Box12, { marginLeft: 4, children: /* @__PURE__ */ jsx14(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: worker.result.phases.map((p) => `${p.name}: ${formatElapsed6(p.ms)}`).join(" \xB7 ") }) })
|
|
21567
21777
|
] });
|
|
21568
21778
|
}
|
|
21569
21779
|
function StepRow({ step, theme }) {
|
|
21570
21780
|
if (step.status === "completed") {
|
|
21571
|
-
return /* @__PURE__ */
|
|
21781
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.palette.success, children: [
|
|
21572
21782
|
" ",
|
|
21573
21783
|
"\u2713 ",
|
|
21574
|
-
/* @__PURE__ */
|
|
21784
|
+
/* @__PURE__ */ jsx14(Text13, { strikethrough: true, children: step.label })
|
|
21575
21785
|
] });
|
|
21576
21786
|
}
|
|
21577
21787
|
if (step.status === "active") {
|
|
21578
|
-
return /* @__PURE__ */
|
|
21788
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.accent, bold: true, children: [
|
|
21579
21789
|
" ",
|
|
21580
|
-
/* @__PURE__ */
|
|
21790
|
+
/* @__PURE__ */ jsx14(Spinner5, { type: "line" }),
|
|
21581
21791
|
" ",
|
|
21582
21792
|
step.label
|
|
21583
21793
|
] });
|
|
21584
21794
|
}
|
|
21585
21795
|
if (step.status === "failed") {
|
|
21586
|
-
return /* @__PURE__ */
|
|
21796
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.palette.error, children: [
|
|
21587
21797
|
" ",
|
|
21588
21798
|
"\u2612 ",
|
|
21589
21799
|
step.label
|
|
21590
21800
|
] });
|
|
21591
21801
|
}
|
|
21592
|
-
return /* @__PURE__ */
|
|
21802
|
+
return /* @__PURE__ */ jsxs12(Text13, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
|
|
21593
21803
|
" ",
|
|
21594
21804
|
"\u2610 ",
|
|
21595
21805
|
step.label
|
|
@@ -21610,9 +21820,9 @@ var init_worker_list = __esm({
|
|
|
21610
21820
|
});
|
|
21611
21821
|
|
|
21612
21822
|
// src/ui/model-picker.tsx
|
|
21613
|
-
import { useEffect as useEffect6, useMemo as useMemo2, useState as
|
|
21614
|
-
import { Box as
|
|
21615
|
-
import { jsx as
|
|
21823
|
+
import { useEffect as useEffect6, useMemo as useMemo2, useState as useState11 } from "react";
|
|
21824
|
+
import { Box as Box13, Text as Text14, useInput as useInput6 } from "ink";
|
|
21825
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
21616
21826
|
function formatContext(n) {
|
|
21617
21827
|
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
21618
21828
|
if (n >= 1e3) return `${Math.round(n / 1e3)}k`;
|
|
@@ -21696,9 +21906,9 @@ function buildRowsFlat(opts2) {
|
|
|
21696
21906
|
}
|
|
21697
21907
|
function ModelPicker({ current, onPick }) {
|
|
21698
21908
|
const theme = useTheme();
|
|
21699
|
-
const [query, setQuery] =
|
|
21700
|
-
const [page, setPage] =
|
|
21701
|
-
const [selectedIndex, setSelectedIndex] =
|
|
21909
|
+
const [query, setQuery] = useState11("");
|
|
21910
|
+
const [page, setPage] = useState11(0);
|
|
21911
|
+
const [selectedIndex, setSelectedIndex] = useState11(0);
|
|
21702
21912
|
const allModels = useMemo2(() => listModels(), []);
|
|
21703
21913
|
const filtered = useMemo2(() => {
|
|
21704
21914
|
if (!query.trim()) return allModels;
|
|
@@ -21742,7 +21952,7 @@ function ModelPicker({ current, onPick }) {
|
|
|
21742
21952
|
useEffect6(() => {
|
|
21743
21953
|
setSelectedIndex(Math.max(0, firstSelectable));
|
|
21744
21954
|
}, [firstSelectable]);
|
|
21745
|
-
|
|
21955
|
+
useInput6((input, key) => {
|
|
21746
21956
|
if (key.escape || input === "q") {
|
|
21747
21957
|
onPick(null);
|
|
21748
21958
|
return;
|
|
@@ -21793,20 +22003,20 @@ function ModelPicker({ current, onPick }) {
|
|
|
21793
22003
|
const headerIdCell = padRight("", maxIdRender + 2);
|
|
21794
22004
|
const headerCtxCell = padRight("context", ctxColWidth);
|
|
21795
22005
|
const headerLine = `${headerIdCell} ${headerCtxCell} in / out / cached`;
|
|
21796
|
-
return /* @__PURE__ */
|
|
21797
|
-
/* @__PURE__ */
|
|
22006
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
22007
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.accent, bold: true, children: [
|
|
21798
22008
|
"Pick a model \xB7 current: ",
|
|
21799
22009
|
current
|
|
21800
22010
|
] }),
|
|
21801
|
-
/* @__PURE__ */
|
|
22011
|
+
/* @__PURE__ */ jsxs13(Text14, { color: theme.info.color, children: [
|
|
21802
22012
|
query ? `Search: ${query}\u258C` : "Type to search\u2026",
|
|
21803
22013
|
totalPages > 1 ? ` \xB7 Page ${safePage + 1} of ${totalPages}` : "",
|
|
21804
22014
|
` \xB7 ${modelRows.length} model${modelRows.length === 1 ? "" : "s"}`
|
|
21805
22015
|
] }),
|
|
21806
|
-
/* @__PURE__ */
|
|
21807
|
-
/* @__PURE__ */
|
|
22016
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx15(Text14, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: headerLine }) }),
|
|
22017
|
+
/* @__PURE__ */ jsx15(Box13, { flexDirection: "column", children: pageRows.map((row, i) => {
|
|
21808
22018
|
if (row.kind === "header") {
|
|
21809
|
-
return /* @__PURE__ */
|
|
22019
|
+
return /* @__PURE__ */ jsx15(Box13, { children: /* @__PURE__ */ jsx15(Text14, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: row.label }) }, row.key);
|
|
21810
22020
|
}
|
|
21811
22021
|
const isSelected = i === selectedIndex;
|
|
21812
22022
|
const id = truncateMiddle(row.displayId, maxIdRender);
|
|
@@ -21814,12 +22024,12 @@ function ModelPicker({ current, onPick }) {
|
|
|
21814
22024
|
const idCell = padRight(`${marker}${id}`, maxIdRender + 2);
|
|
21815
22025
|
const ctxCell = padRight(row.context, ctxColWidth);
|
|
21816
22026
|
const label = `${idCell} ${ctxCell} ${row.price}`;
|
|
21817
|
-
return /* @__PURE__ */
|
|
22027
|
+
return /* @__PURE__ */ jsx15(Box13, { children: /* @__PURE__ */ jsxs13(Text14, { color: isSelected ? theme.accent : theme.info.color, bold: isSelected, children: [
|
|
21818
22028
|
isSelected ? "\u203A " : " ",
|
|
21819
22029
|
label
|
|
21820
22030
|
] }) }, row.model.id);
|
|
21821
22031
|
}) }),
|
|
21822
|
-
/* @__PURE__ */
|
|
22032
|
+
/* @__PURE__ */ jsx15(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text14, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
|
|
21823
22033
|
safePage > 0 ? "\u2190 prev " : "",
|
|
21824
22034
|
safePage < totalPages - 1 ? "\u2192 next " : "",
|
|
21825
22035
|
"\u25CF current \xB7 type to search \xB7 Enter pick \xB7 Esc cancel"
|
|
@@ -21853,21 +22063,21 @@ var init_model_picker = __esm({
|
|
|
21853
22063
|
});
|
|
21854
22064
|
|
|
21855
22065
|
// src/ui/billing-chooser.tsx
|
|
21856
|
-
import { Box as
|
|
21857
|
-
import
|
|
21858
|
-
import { jsx as
|
|
22066
|
+
import { Box as Box14, Text as Text15, useInput as useInput7 } from "ink";
|
|
22067
|
+
import SelectInput4 from "ink-select-input";
|
|
22068
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
21859
22069
|
function BillingChooser({ model, onPick }) {
|
|
21860
22070
|
const theme = useTheme();
|
|
21861
22071
|
const name = PROVIDER_NAME[model.provider];
|
|
21862
|
-
|
|
22072
|
+
useInput7((_input, key) => {
|
|
21863
22073
|
if (key.escape) onPick(null);
|
|
21864
22074
|
});
|
|
21865
22075
|
const items = [
|
|
21866
22076
|
{ label: `Use Cloudflare credits \xB7 no extra key`, value: "unified" },
|
|
21867
22077
|
{ label: `Use my own ${name} API key`, value: "byok" }
|
|
21868
22078
|
];
|
|
21869
|
-
return /* @__PURE__ */
|
|
21870
|
-
|
|
22079
|
+
return /* @__PURE__ */ jsxs14(
|
|
22080
|
+
Box14,
|
|
21871
22081
|
{
|
|
21872
22082
|
flexDirection: "column",
|
|
21873
22083
|
borderStyle: "round",
|
|
@@ -21875,17 +22085,17 @@ function BillingChooser({ model, onPick }) {
|
|
|
21875
22085
|
paddingX: 2,
|
|
21876
22086
|
paddingY: 1,
|
|
21877
22087
|
children: [
|
|
21878
|
-
/* @__PURE__ */
|
|
22088
|
+
/* @__PURE__ */ jsxs14(Text15, { color: theme.accent, bold: true, children: [
|
|
21879
22089
|
"Pay for ",
|
|
21880
22090
|
name
|
|
21881
22091
|
] }),
|
|
21882
|
-
/* @__PURE__ */
|
|
22092
|
+
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsxs14(Text15, { children: [
|
|
21883
22093
|
"You picked ",
|
|
21884
|
-
/* @__PURE__ */
|
|
22094
|
+
/* @__PURE__ */ jsx16(Text15, { bold: true, children: model.id }),
|
|
21885
22095
|
". How would you like to pay for it?"
|
|
21886
22096
|
] }) }),
|
|
21887
|
-
/* @__PURE__ */
|
|
21888
|
-
/* @__PURE__ */
|
|
22097
|
+
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(SelectInput4, { items, onSelect: (item) => onPick(item.value) }) }),
|
|
22098
|
+
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text15, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "\u2191/\u2193 select \xB7 Enter \xB7 Esc cancel" }) })
|
|
21889
22099
|
]
|
|
21890
22100
|
}
|
|
21891
22101
|
);
|
|
@@ -21977,10 +22187,10 @@ var init_probe_unified_billing = __esm({
|
|
|
21977
22187
|
});
|
|
21978
22188
|
|
|
21979
22189
|
// src/ui/unified-billing-status.tsx
|
|
21980
|
-
import { useEffect as useEffect7, useState as
|
|
21981
|
-
import { Box as
|
|
21982
|
-
import
|
|
21983
|
-
import { jsx as
|
|
22190
|
+
import { useEffect as useEffect7, useState as useState12 } from "react";
|
|
22191
|
+
import { Box as Box15, Text as Text16, useInput as useInput8 } from "ink";
|
|
22192
|
+
import SelectInput5 from "ink-select-input";
|
|
22193
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
21984
22194
|
function UnifiedBillingStatus({
|
|
21985
22195
|
model,
|
|
21986
22196
|
accountId,
|
|
@@ -21989,8 +22199,8 @@ function UnifiedBillingStatus({
|
|
|
21989
22199
|
onResolve
|
|
21990
22200
|
}) {
|
|
21991
22201
|
const theme = useTheme();
|
|
21992
|
-
const [phase, setPhase] =
|
|
21993
|
-
const [attempt, setAttempt] =
|
|
22202
|
+
const [phase, setPhase] = useState12({ kind: "probing" });
|
|
22203
|
+
const [attempt, setAttempt] = useState12(0);
|
|
21994
22204
|
const name = PROVIDER_NAME2[model.provider];
|
|
21995
22205
|
useEffect7(() => {
|
|
21996
22206
|
let cancelled = false;
|
|
@@ -22025,21 +22235,21 @@ function UnifiedBillingStatus({
|
|
|
22025
22235
|
cancelled = true;
|
|
22026
22236
|
};
|
|
22027
22237
|
}, [attempt]);
|
|
22028
|
-
|
|
22238
|
+
useInput8((_input, key) => {
|
|
22029
22239
|
if (key.escape) onResolve("cancelled");
|
|
22030
22240
|
});
|
|
22031
22241
|
if (phase.kind === "probing") {
|
|
22032
|
-
return /* @__PURE__ */
|
|
22033
|
-
/* @__PURE__ */
|
|
22242
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
|
|
22243
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.accent, bold: true, children: [
|
|
22034
22244
|
"Enabling unified billing for ",
|
|
22035
22245
|
name,
|
|
22036
22246
|
"\u2026"
|
|
22037
22247
|
] }),
|
|
22038
|
-
/* @__PURE__ */
|
|
22248
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.info.color, dimColor: true, children: "Sending a 1-token test request through your AI Gateway. This takes a moment." }) })
|
|
22039
22249
|
] });
|
|
22040
22250
|
}
|
|
22041
22251
|
if (phase.kind === "success") {
|
|
22042
|
-
return /* @__PURE__ */
|
|
22252
|
+
return /* @__PURE__ */ jsx17(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: /* @__PURE__ */ jsxs15(Text16, { color: theme.accent, bold: true, children: [
|
|
22043
22253
|
"\u2713 done \u2014 ",
|
|
22044
22254
|
name,
|
|
22045
22255
|
" billed via your Cloudflare credits."
|
|
@@ -22055,45 +22265,45 @@ function UnifiedBillingStatus({
|
|
|
22055
22265
|
{ label: `Use my own ${name} API key instead`, value: "byok" },
|
|
22056
22266
|
{ label: "Cancel", value: "cancel" }
|
|
22057
22267
|
];
|
|
22058
|
-
return /* @__PURE__ */
|
|
22059
|
-
/* @__PURE__ */
|
|
22268
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
|
|
22269
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.accent, bold: true, children: [
|
|
22060
22270
|
name,
|
|
22061
22271
|
" needs Cloudflare credits before Unified Billing can pay for it."
|
|
22062
22272
|
] }),
|
|
22063
|
-
/* @__PURE__ */
|
|
22064
|
-
/* @__PURE__ */
|
|
22065
|
-
/* @__PURE__ */
|
|
22066
|
-
/* @__PURE__ */
|
|
22067
|
-
/* @__PURE__ */
|
|
22068
|
-
/* @__PURE__ */
|
|
22273
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
|
|
22274
|
+
/* @__PURE__ */ jsx17(Text16, { children: "Step-by-step (Unified Billing is implicit \u2014 adding credits IS enabling it):" }),
|
|
22275
|
+
/* @__PURE__ */ jsx17(Text16, { children: " 1. Open the AI Gateway Credits page:" }),
|
|
22276
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/credits` }),
|
|
22277
|
+
/* @__PURE__ */ jsx17(Text16, { children: " 2. Add a payment method if you don't have one yet." }),
|
|
22278
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
22069
22279
|
" 3. Click ",
|
|
22070
|
-
/* @__PURE__ */
|
|
22280
|
+
/* @__PURE__ */ jsx17(Text16, { bold: true, children: '"Top-up credits"' }),
|
|
22071
22281
|
" and confirm the amount."
|
|
22072
22282
|
] }),
|
|
22073
|
-
/* @__PURE__ */
|
|
22283
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
22074
22284
|
" 4. Come back here and pick ",
|
|
22075
|
-
/* @__PURE__ */
|
|
22285
|
+
/* @__PURE__ */ jsx17(Text16, { bold: true, children: `"I've enabled it \u2014 try again"` }),
|
|
22076
22286
|
"."
|
|
22077
22287
|
] }),
|
|
22078
|
-
/* @__PURE__ */
|
|
22079
|
-
/* @__PURE__ */
|
|
22080
|
-
phase.eventId ? /* @__PURE__ */
|
|
22081
|
-
/* @__PURE__ */
|
|
22288
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Credits are one account-wide pool. Confirmed providers: OpenAI & Anthropic. Others (Google, Groq, xAI) may not be supported yet \u2014 the retry will tell you." }) }),
|
|
22289
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: 'Hint: if you already have credits, your gateway probably has Authentication turned off. CF needs it ON for Unified Billing to activate. Picking "Enable Authentication" above flips it for you.' }) }),
|
|
22290
|
+
phase.eventId ? /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
|
|
22291
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
|
|
22082
22292
|
"Debug \xB7 HTTP ",
|
|
22083
22293
|
phase.status,
|
|
22084
22294
|
" \xB7 cf-aig-event-id: ",
|
|
22085
22295
|
phase.eventId
|
|
22086
22296
|
] }),
|
|
22087
|
-
/* @__PURE__ */
|
|
22088
|
-
/* @__PURE__ */
|
|
22089
|
-
/* @__PURE__ */
|
|
22297
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Look up the full upstream error at:" }),
|
|
22298
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/gateways/${gatewayId}/logs` }),
|
|
22299
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
|
|
22090
22300
|
"CF response: ",
|
|
22091
22301
|
phase.message
|
|
22092
22302
|
] })
|
|
22093
22303
|
] }) : null
|
|
22094
22304
|
] }),
|
|
22095
|
-
/* @__PURE__ */
|
|
22096
|
-
|
|
22305
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(
|
|
22306
|
+
SelectInput5,
|
|
22097
22307
|
{
|
|
22098
22308
|
items: items2,
|
|
22099
22309
|
onSelect: (item) => {
|
|
@@ -22129,21 +22339,21 @@ function UnifiedBillingStatus({
|
|
|
22129
22339
|
{ label: `Use my own ${name} API key instead`, value: "byok" },
|
|
22130
22340
|
{ label: "Cancel", value: "cancel" }
|
|
22131
22341
|
];
|
|
22132
|
-
return /* @__PURE__ */
|
|
22133
|
-
/* @__PURE__ */
|
|
22134
|
-
/* @__PURE__ */
|
|
22135
|
-
phase.eventId ? /* @__PURE__ */
|
|
22136
|
-
/* @__PURE__ */
|
|
22342
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 2, paddingY: 1, children: [
|
|
22343
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.accent, bold: true, children: "Couldn't reach your AI Gateway." }),
|
|
22344
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(Text16, { color: theme.info.color, children: phase.message }) }),
|
|
22345
|
+
phase.eventId ? /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
|
|
22346
|
+
/* @__PURE__ */ jsxs15(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
|
|
22137
22347
|
"Debug \xB7 HTTP ",
|
|
22138
22348
|
phase.status,
|
|
22139
22349
|
" \xB7 cf-aig-event-id: ",
|
|
22140
22350
|
phase.eventId
|
|
22141
22351
|
] }),
|
|
22142
|
-
/* @__PURE__ */
|
|
22143
|
-
/* @__PURE__ */
|
|
22352
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Look up the full upstream error at:" }),
|
|
22353
|
+
/* @__PURE__ */ jsx17(Text16, { color: theme.accent, underline: true, children: ` https://dash.cloudflare.com/${accountId}/ai/ai-gateway/gateways/${gatewayId}/logs` })
|
|
22144
22354
|
] }) : null,
|
|
22145
|
-
/* @__PURE__ */
|
|
22146
|
-
|
|
22355
|
+
/* @__PURE__ */ jsx17(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx17(
|
|
22356
|
+
SelectInput5,
|
|
22147
22357
|
{
|
|
22148
22358
|
items,
|
|
22149
22359
|
onSelect: (item) => {
|
|
@@ -22257,10 +22467,10 @@ var init_secrets_store = __esm({
|
|
|
22257
22467
|
});
|
|
22258
22468
|
|
|
22259
22469
|
// src/ui/key-entry-modal.tsx
|
|
22260
|
-
import { useState as
|
|
22261
|
-
import { Box as
|
|
22262
|
-
import
|
|
22263
|
-
import { jsx as
|
|
22470
|
+
import { useState as useState13 } from "react";
|
|
22471
|
+
import { Box as Box16, Text as Text17, useInput as useInput9 } from "ink";
|
|
22472
|
+
import SelectInput6 from "ink-select-input";
|
|
22473
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
22264
22474
|
function maskPreview(value) {
|
|
22265
22475
|
if (!value) return "";
|
|
22266
22476
|
if (value.length <= 8) return "\u2022".repeat(value.length);
|
|
@@ -22275,11 +22485,11 @@ function KeyEntryModal({
|
|
|
22275
22485
|
onCancel
|
|
22276
22486
|
}) {
|
|
22277
22487
|
const theme = useTheme();
|
|
22278
|
-
const [value, setValue] =
|
|
22279
|
-
const [reveal, setReveal] =
|
|
22280
|
-
const [phase, setPhase] =
|
|
22488
|
+
const [value, setValue] = useState13("");
|
|
22489
|
+
const [reveal, setReveal] = useState13(false);
|
|
22490
|
+
const [phase, setPhase] = useState13({ kind: "collecting" });
|
|
22281
22491
|
const info = PROVIDER_INFO[model.provider];
|
|
22282
|
-
|
|
22492
|
+
useInput9((input, key) => {
|
|
22283
22493
|
if (key.escape && phase.kind === "collecting") {
|
|
22284
22494
|
onCancel();
|
|
22285
22495
|
return;
|
|
@@ -22327,8 +22537,8 @@ function KeyEntryModal({
|
|
|
22327
22537
|
void upload(trimmed);
|
|
22328
22538
|
};
|
|
22329
22539
|
if (phase.kind === "uploading") {
|
|
22330
|
-
return /* @__PURE__ */
|
|
22331
|
-
|
|
22540
|
+
return /* @__PURE__ */ jsxs16(
|
|
22541
|
+
Box16,
|
|
22332
22542
|
{
|
|
22333
22543
|
flexDirection: "column",
|
|
22334
22544
|
borderStyle: "round",
|
|
@@ -22336,8 +22546,8 @@ function KeyEntryModal({
|
|
|
22336
22546
|
paddingX: 2,
|
|
22337
22547
|
paddingY: 1,
|
|
22338
22548
|
children: [
|
|
22339
|
-
/* @__PURE__ */
|
|
22340
|
-
/* @__PURE__ */
|
|
22549
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Storing in Cloudflare Secrets Store\u2026" }),
|
|
22550
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, dimColor: true, children: "Your key never touches disk \u2014 it's being pushed straight to Cloudflare with scope: ai_gateway." }) })
|
|
22341
22551
|
]
|
|
22342
22552
|
}
|
|
22343
22553
|
);
|
|
@@ -22348,8 +22558,8 @@ function KeyEntryModal({
|
|
|
22348
22558
|
{ label: "Store the key locally instead (\u26A0 less safe)", value: "local" },
|
|
22349
22559
|
{ label: "Cancel", value: "cancel" }
|
|
22350
22560
|
];
|
|
22351
|
-
return /* @__PURE__ */
|
|
22352
|
-
|
|
22561
|
+
return /* @__PURE__ */ jsxs16(
|
|
22562
|
+
Box16,
|
|
22353
22563
|
{
|
|
22354
22564
|
flexDirection: "column",
|
|
22355
22565
|
borderStyle: "round",
|
|
@@ -22357,17 +22567,17 @@ function KeyEntryModal({
|
|
|
22357
22567
|
paddingX: 2,
|
|
22358
22568
|
paddingY: 1,
|
|
22359
22569
|
children: [
|
|
22360
|
-
/* @__PURE__ */
|
|
22361
|
-
/* @__PURE__ */
|
|
22362
|
-
/* @__PURE__ */
|
|
22570
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Your Cloudflare token can't write to Secrets Store." }),
|
|
22571
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
22572
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.info.color, children: [
|
|
22363
22573
|
"To keep your key off disk, add the ",
|
|
22364
|
-
/* @__PURE__ */
|
|
22574
|
+
/* @__PURE__ */ jsx18(Text17, { bold: true, children: "Secrets Store Edit" }),
|
|
22365
22575
|
" permission to your token at:"
|
|
22366
22576
|
] }),
|
|
22367
|
-
/* @__PURE__ */
|
|
22577
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, underline: true, children: "https://dash.cloudflare.com/profile/api-tokens" })
|
|
22368
22578
|
] }),
|
|
22369
|
-
/* @__PURE__ */
|
|
22370
|
-
|
|
22579
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
22580
|
+
SelectInput6,
|
|
22371
22581
|
{
|
|
22372
22582
|
items: fallbackItems,
|
|
22373
22583
|
onSelect: (item) => {
|
|
@@ -22381,14 +22591,14 @@ function KeyEntryModal({
|
|
|
22381
22591
|
}
|
|
22382
22592
|
}
|
|
22383
22593
|
) }),
|
|
22384
|
-
/* @__PURE__ */
|
|
22594
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Local fallback writes to ~/.config/kimiflare/config.json (mode 600). Do not commit that file." }) })
|
|
22385
22595
|
]
|
|
22386
22596
|
}
|
|
22387
22597
|
);
|
|
22388
22598
|
}
|
|
22389
22599
|
if (phase.kind === "error") {
|
|
22390
|
-
return /* @__PURE__ */
|
|
22391
|
-
|
|
22600
|
+
return /* @__PURE__ */ jsxs16(
|
|
22601
|
+
Box16,
|
|
22392
22602
|
{
|
|
22393
22603
|
flexDirection: "column",
|
|
22394
22604
|
borderStyle: "round",
|
|
@@ -22396,10 +22606,10 @@ function KeyEntryModal({
|
|
|
22396
22606
|
paddingX: 2,
|
|
22397
22607
|
paddingY: 1,
|
|
22398
22608
|
children: [
|
|
22399
|
-
/* @__PURE__ */
|
|
22400
|
-
/* @__PURE__ */
|
|
22401
|
-
/* @__PURE__ */
|
|
22402
|
-
|
|
22609
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, bold: true, children: "Couldn't store the key." }),
|
|
22610
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: phase.message }) }),
|
|
22611
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
22612
|
+
SelectInput6,
|
|
22403
22613
|
{
|
|
22404
22614
|
items: [
|
|
22405
22615
|
{ label: "Try again", value: "retry" },
|
|
@@ -22415,8 +22625,8 @@ function KeyEntryModal({
|
|
|
22415
22625
|
}
|
|
22416
22626
|
);
|
|
22417
22627
|
}
|
|
22418
|
-
return /* @__PURE__ */
|
|
22419
|
-
|
|
22628
|
+
return /* @__PURE__ */ jsxs16(
|
|
22629
|
+
Box16,
|
|
22420
22630
|
{
|
|
22421
22631
|
flexDirection: "column",
|
|
22422
22632
|
borderStyle: "round",
|
|
@@ -22424,39 +22634,39 @@ function KeyEntryModal({
|
|
|
22424
22634
|
paddingX: 2,
|
|
22425
22635
|
paddingY: 1,
|
|
22426
22636
|
children: [
|
|
22427
|
-
/* @__PURE__ */
|
|
22637
|
+
/* @__PURE__ */ jsxs16(Text17, { color: theme.accent, bold: true, children: [
|
|
22428
22638
|
"Connect ",
|
|
22429
22639
|
info.name
|
|
22430
22640
|
] }),
|
|
22431
|
-
/* @__PURE__ */
|
|
22432
|
-
/* @__PURE__ */
|
|
22641
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
22642
|
+
/* @__PURE__ */ jsxs16(Text17, { children: [
|
|
22433
22643
|
"To use ",
|
|
22434
|
-
/* @__PURE__ */
|
|
22644
|
+
/* @__PURE__ */ jsx18(Text17, { bold: true, children: model.id }),
|
|
22435
22645
|
", kimi-code needs your ",
|
|
22436
22646
|
info.name,
|
|
22437
22647
|
" API key."
|
|
22438
22648
|
] }),
|
|
22439
|
-
/* @__PURE__ */
|
|
22649
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsxs16(Text17, { children: [
|
|
22440
22650
|
"1. Get a key here:",
|
|
22441
22651
|
" ",
|
|
22442
|
-
/* @__PURE__ */
|
|
22652
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.accent, underline: true, children: info.url })
|
|
22443
22653
|
] }) }),
|
|
22444
|
-
/* @__PURE__ */
|
|
22445
|
-
/* @__PURE__ */
|
|
22654
|
+
/* @__PURE__ */ jsx18(Text17, { children: "2. Paste it below and press Enter." }),
|
|
22655
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: info.hint }) })
|
|
22446
22656
|
] }),
|
|
22447
|
-
/* @__PURE__ */
|
|
22448
|
-
/* @__PURE__ */
|
|
22449
|
-
reveal ? /* @__PURE__ */
|
|
22450
|
-
/* @__PURE__ */
|
|
22451
|
-
/* @__PURE__ */
|
|
22657
|
+
/* @__PURE__ */ jsxs16(Box16, { marginTop: 1, flexDirection: "column", children: [
|
|
22658
|
+
/* @__PURE__ */ jsx18(Text17, { color: theme.info.color, children: "API key:" }),
|
|
22659
|
+
reveal ? /* @__PURE__ */ jsx18(CustomTextInput, { value, onChange: setValue, onSubmit: submit, focus: true }) : /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", children: [
|
|
22660
|
+
/* @__PURE__ */ jsx18(Text17, { children: maskPreview(value) || " " }),
|
|
22661
|
+
/* @__PURE__ */ jsx18(Box16, { height: 0, overflow: "hidden", children: /* @__PURE__ */ jsx18(CustomTextInput, { value, onChange: setValue, onSubmit: submit, focus: true }) })
|
|
22452
22662
|
] })
|
|
22453
22663
|
] }),
|
|
22454
|
-
/* @__PURE__ */
|
|
22664
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsxs16(Text17, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: [
|
|
22455
22665
|
"Enter to save \xB7 Ctrl+R to ",
|
|
22456
22666
|
reveal ? "hide" : "reveal",
|
|
22457
22667
|
" \xB7 Esc to cancel"
|
|
22458
22668
|
] }) }),
|
|
22459
|
-
/* @__PURE__ */
|
|
22669
|
+
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(Text17, { color: theme.muted?.color ?? theme.info.color, dimColor: true, children: "Key never touches disk. Pushed to Cloudflare Secrets Store (scope: ai_gateway), then referenced by alias on every request. Audit: src/agent/secrets-store.ts \xB7 src/agent/client.ts" }) })
|
|
22460
22670
|
]
|
|
22461
22671
|
}
|
|
22462
22672
|
);
|
|
@@ -22499,31 +22709,31 @@ var init_key_entry_modal = __esm({
|
|
|
22499
22709
|
});
|
|
22500
22710
|
|
|
22501
22711
|
// src/ui/onboarding.tsx
|
|
22502
|
-
import { useState as
|
|
22503
|
-
import { Box as
|
|
22504
|
-
import { Fragment, jsx as
|
|
22712
|
+
import { useState as useState14, useCallback as useCallback3, useEffect as useEffect8 } from "react";
|
|
22713
|
+
import { Box as Box17, Text as Text18, useInput as useInput10 } from "ink";
|
|
22714
|
+
import { Fragment, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
22505
22715
|
function Onboarding({ onDone, onCancel }) {
|
|
22506
22716
|
const theme = useTheme();
|
|
22507
|
-
const [step, setStep] =
|
|
22508
|
-
const [accountId, setAccountId] =
|
|
22509
|
-
const [apiToken, setApiToken] =
|
|
22510
|
-
const [model, setModel] =
|
|
22511
|
-
const [savedPath, setSavedPath] =
|
|
22512
|
-
const [useGateway, setUseGateway] =
|
|
22513
|
-
const [routingPickIdx, setRoutingPickIdx] =
|
|
22514
|
-
const [gateways, setGateways] =
|
|
22515
|
-
const [gatewayPickIdx, setGatewayPickIdx] =
|
|
22516
|
-
const [aiGatewayId, setAiGatewayId] =
|
|
22517
|
-
const [gatewayNewName, setGatewayNewName] =
|
|
22518
|
-
const [gatewayManualId, setGatewayManualId] =
|
|
22519
|
-
const [gatewayError, setGatewayError] =
|
|
22520
|
-
const [gatewayProbeMsg, setGatewayProbeMsg] =
|
|
22521
|
-
const [pickedEntry, setPickedEntry] =
|
|
22522
|
-
const [unifiedBilling, setUnifiedBilling] =
|
|
22523
|
-
const [providerKeyAliases, setProviderKeyAliases] =
|
|
22524
|
-
const [providerKeys, setProviderKeys] =
|
|
22525
|
-
const [secretsStoreId, setSecretsStoreId] =
|
|
22526
|
-
|
|
22717
|
+
const [step, setStep] = useState14("accountId");
|
|
22718
|
+
const [accountId, setAccountId] = useState14("");
|
|
22719
|
+
const [apiToken, setApiToken] = useState14("");
|
|
22720
|
+
const [model, setModel] = useState14(DEFAULT_MODEL);
|
|
22721
|
+
const [savedPath, setSavedPath] = useState14(null);
|
|
22722
|
+
const [useGateway, setUseGateway] = useState14(null);
|
|
22723
|
+
const [routingPickIdx, setRoutingPickIdx] = useState14(0);
|
|
22724
|
+
const [gateways, setGateways] = useState14([]);
|
|
22725
|
+
const [gatewayPickIdx, setGatewayPickIdx] = useState14(0);
|
|
22726
|
+
const [aiGatewayId, setAiGatewayId] = useState14("");
|
|
22727
|
+
const [gatewayNewName, setGatewayNewName] = useState14("kimiflare");
|
|
22728
|
+
const [gatewayManualId, setGatewayManualId] = useState14("");
|
|
22729
|
+
const [gatewayError, setGatewayError] = useState14(null);
|
|
22730
|
+
const [gatewayProbeMsg, setGatewayProbeMsg] = useState14(null);
|
|
22731
|
+
const [pickedEntry, setPickedEntry] = useState14(null);
|
|
22732
|
+
const [unifiedBilling, setUnifiedBilling] = useState14(false);
|
|
22733
|
+
const [providerKeyAliases, setProviderKeyAliases] = useState14({});
|
|
22734
|
+
const [providerKeys, setProviderKeys] = useState14({});
|
|
22735
|
+
const [secretsStoreId, setSecretsStoreId] = useState14(void 0);
|
|
22736
|
+
useInput10(
|
|
22527
22737
|
useCallback3(
|
|
22528
22738
|
(_input, key) => {
|
|
22529
22739
|
if (key.escape && onCancel) {
|
|
@@ -22533,7 +22743,7 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22533
22743
|
[onCancel]
|
|
22534
22744
|
)
|
|
22535
22745
|
);
|
|
22536
|
-
|
|
22746
|
+
useInput10(
|
|
22537
22747
|
(_input, key) => {
|
|
22538
22748
|
if (step !== "routingMode") return;
|
|
22539
22749
|
const total = 2;
|
|
@@ -22552,7 +22762,7 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22552
22762
|
}
|
|
22553
22763
|
}
|
|
22554
22764
|
);
|
|
22555
|
-
|
|
22765
|
+
useInput10(
|
|
22556
22766
|
(_input, key) => {
|
|
22557
22767
|
if (step !== "gatewayPick") return;
|
|
22558
22768
|
const total = gateways.length + 1;
|
|
@@ -22720,26 +22930,26 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22720
22930
|
const visibleSteps = ["accountId", "apiToken", "routingMode", "model", "confirm"];
|
|
22721
22931
|
const stepIndex = Math.max(1, visibleSteps.indexOf(step) === -1 ? 3 : visibleSteps.indexOf(step) + 1);
|
|
22722
22932
|
const totalSteps = visibleSteps.length;
|
|
22723
|
-
return /* @__PURE__ */
|
|
22724
|
-
/* @__PURE__ */
|
|
22725
|
-
/* @__PURE__ */
|
|
22726
|
-
/* @__PURE__ */
|
|
22933
|
+
return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", paddingY: 1, children: [
|
|
22934
|
+
/* @__PURE__ */ jsxs17(Box17, { marginBottom: 1, children: [
|
|
22935
|
+
/* @__PURE__ */ jsx19(Text18, { bold: true, color: theme.palette.primary, children: "kimiflare" }),
|
|
22936
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
|
|
22727
22937
|
" ",
|
|
22728
22938
|
"Terminal coding agent"
|
|
22729
22939
|
] })
|
|
22730
22940
|
] }),
|
|
22731
|
-
/* @__PURE__ */
|
|
22941
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
|
|
22732
22942
|
"Step ",
|
|
22733
22943
|
stepIndex,
|
|
22734
22944
|
" of ",
|
|
22735
22945
|
totalSteps
|
|
22736
22946
|
] }),
|
|
22737
|
-
/* @__PURE__ */
|
|
22738
|
-
step === "accountId" && /* @__PURE__ */
|
|
22739
|
-
/* @__PURE__ */
|
|
22740
|
-
/* @__PURE__ */
|
|
22741
|
-
/* @__PURE__ */
|
|
22742
|
-
/* @__PURE__ */
|
|
22947
|
+
/* @__PURE__ */ jsxs17(Box17, { marginTop: 1, flexDirection: "column", children: [
|
|
22948
|
+
step === "accountId" && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
22949
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Enter your Cloudflare Account ID" }),
|
|
22950
|
+
/* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
|
|
22951
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "\u203A " }),
|
|
22952
|
+
/* @__PURE__ */ jsx19(
|
|
22743
22953
|
CustomTextInput,
|
|
22744
22954
|
{
|
|
22745
22955
|
value: accountId,
|
|
@@ -22749,13 +22959,13 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22749
22959
|
)
|
|
22750
22960
|
] })
|
|
22751
22961
|
] }),
|
|
22752
|
-
step === "apiToken" && /* @__PURE__ */
|
|
22753
|
-
/* @__PURE__ */
|
|
22754
|
-
/* @__PURE__ */
|
|
22755
|
-
/* @__PURE__ */
|
|
22756
|
-
/* @__PURE__ */
|
|
22757
|
-
/* @__PURE__ */
|
|
22758
|
-
/* @__PURE__ */
|
|
22962
|
+
step === "apiToken" && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
22963
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Enter your Cloudflare API Token" }),
|
|
22964
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Create one at https://dash.cloudflare.com/profile/api-tokens" }),
|
|
22965
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Required permissions: Workers AI:Read, AI Gateway:Read, AI Gateway:Edit" }),
|
|
22966
|
+
/* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
|
|
22967
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "\u203A " }),
|
|
22968
|
+
/* @__PURE__ */ jsx19(
|
|
22759
22969
|
CustomTextInput,
|
|
22760
22970
|
{
|
|
22761
22971
|
value: apiToken,
|
|
@@ -22766,50 +22976,50 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22766
22976
|
)
|
|
22767
22977
|
] })
|
|
22768
22978
|
] }),
|
|
22769
|
-
step === "routingMode" && /* @__PURE__ */
|
|
22770
|
-
/* @__PURE__ */
|
|
22771
|
-
/* @__PURE__ */
|
|
22772
|
-
/* @__PURE__ */
|
|
22773
|
-
/* @__PURE__ */
|
|
22979
|
+
step === "routingMode" && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
22980
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Choose how to route AI requests" }),
|
|
22981
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Use \u2191/\u2193 to navigate, Enter to select." }),
|
|
22982
|
+
/* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", marginTop: 1, children: [
|
|
22983
|
+
/* @__PURE__ */ jsxs17(Text18, { color: routingPickIdx === 0 ? theme.palette.primary : void 0, children: [
|
|
22774
22984
|
routingPickIdx === 0 ? "\u203A " : " ",
|
|
22775
22985
|
"Workers AI (direct) \u2014 fastest, no gateway overhead"
|
|
22776
22986
|
] }),
|
|
22777
|
-
/* @__PURE__ */
|
|
22987
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, dimColor: true, children: [
|
|
22778
22988
|
" ",
|
|
22779
22989
|
"Recommended for the best terminal experience. Uses Cloudflare Workers AI directly."
|
|
22780
22990
|
] }),
|
|
22781
|
-
/* @__PURE__ */
|
|
22782
|
-
/* @__PURE__ */
|
|
22991
|
+
/* @__PURE__ */ jsx19(Text18, { children: " " }),
|
|
22992
|
+
/* @__PURE__ */ jsxs17(Text18, { color: routingPickIdx === 1 ? theme.palette.primary : void 0, children: [
|
|
22783
22993
|
routingPickIdx === 1 ? "\u203A " : " ",
|
|
22784
22994
|
"AI Gateway \u2014 logs, caching, multi-provider support"
|
|
22785
22995
|
] }),
|
|
22786
|
-
/* @__PURE__ */
|
|
22996
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, dimColor: true, children: [
|
|
22787
22997
|
" ",
|
|
22788
22998
|
"Slightly higher latency, but gives you a dashboard, request logs, and the ability to use non-Workers-AI models later."
|
|
22789
22999
|
] })
|
|
22790
23000
|
] })
|
|
22791
23001
|
] }),
|
|
22792
|
-
step === "gatewayLoading" && /* @__PURE__ */
|
|
22793
|
-
step === "gatewayPick" && /* @__PURE__ */
|
|
22794
|
-
/* @__PURE__ */
|
|
22795
|
-
/* @__PURE__ */
|
|
22796
|
-
/* @__PURE__ */
|
|
22797
|
-
gateways.map((gw, i) => /* @__PURE__ */
|
|
23002
|
+
step === "gatewayLoading" && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Looking up your AI Gateways\u2026" }),
|
|
23003
|
+
step === "gatewayPick" && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
23004
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Pick an AI Gateway to route requests through" }),
|
|
23005
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Use \u2191/\u2193 to navigate, Enter to select." }),
|
|
23006
|
+
/* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", marginTop: 1, children: [
|
|
23007
|
+
gateways.map((gw, i) => /* @__PURE__ */ jsxs17(Text18, { color: i === gatewayPickIdx ? theme.palette.primary : void 0, children: [
|
|
22798
23008
|
i === gatewayPickIdx ? "\u203A " : " ",
|
|
22799
23009
|
gw.id
|
|
22800
23010
|
] }, gw.id)),
|
|
22801
|
-
/* @__PURE__ */
|
|
23011
|
+
/* @__PURE__ */ jsxs17(Text18, { color: gatewayPickIdx === gateways.length ? theme.palette.primary : void 0, children: [
|
|
22802
23012
|
gatewayPickIdx === gateways.length ? "\u203A " : " ",
|
|
22803
23013
|
"+ Create new\u2026"
|
|
22804
23014
|
] })
|
|
22805
23015
|
] })
|
|
22806
23016
|
] }),
|
|
22807
|
-
step === "gatewayCreate" && /* @__PURE__ */
|
|
22808
|
-
/* @__PURE__ */
|
|
22809
|
-
/* @__PURE__ */
|
|
22810
|
-
/* @__PURE__ */
|
|
22811
|
-
/* @__PURE__ */
|
|
22812
|
-
/* @__PURE__ */
|
|
23017
|
+
step === "gatewayCreate" && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
23018
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Name for your new AI Gateway" }),
|
|
23019
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Lowercase letters, numbers, _ and - only. Default: kimiflare" }),
|
|
23020
|
+
/* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
|
|
23021
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "\u203A " }),
|
|
23022
|
+
/* @__PURE__ */ jsx19(
|
|
22813
23023
|
CustomTextInput,
|
|
22814
23024
|
{
|
|
22815
23025
|
value: gatewayNewName,
|
|
@@ -22819,25 +23029,25 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22819
23029
|
)
|
|
22820
23030
|
] })
|
|
22821
23031
|
] }),
|
|
22822
|
-
step === "gatewayProbing" && /* @__PURE__ */
|
|
22823
|
-
step === "gatewayScopeError" && /* @__PURE__ */
|
|
22824
|
-
/* @__PURE__ */
|
|
23032
|
+
step === "gatewayProbing" && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Verifying gateway routing\u2026" }),
|
|
23033
|
+
step === "gatewayScopeError" && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
23034
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.palette.error ?? "red", children: [
|
|
22825
23035
|
"Couldn't reach AI Gateway: ",
|
|
22826
23036
|
gatewayError ?? "permission denied"
|
|
22827
23037
|
] }),
|
|
22828
|
-
/* @__PURE__ */
|
|
22829
|
-
/* @__PURE__ */
|
|
22830
|
-
/* @__PURE__ */
|
|
22831
|
-
/* @__PURE__ */
|
|
22832
|
-
/* @__PURE__ */
|
|
22833
|
-
/* @__PURE__ */
|
|
22834
|
-
/* @__PURE__ */
|
|
23038
|
+
/* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", marginTop: 1, children: [
|
|
23039
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Your API token likely lacks the required scopes." }),
|
|
23040
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Required permissions:" }),
|
|
23041
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: " \u2022 AI Gateway:Read (to list gateways)" }),
|
|
23042
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: " \u2022 AI Gateway:Edit (to create one)" }),
|
|
23043
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: " \u2022 Workers AI:Read (to run models)" }),
|
|
23044
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Edit your token at: https://dash.cloudflare.com/profile/api-tokens" })
|
|
22835
23045
|
] }),
|
|
22836
|
-
/* @__PURE__ */
|
|
22837
|
-
/* @__PURE__ */
|
|
22838
|
-
/* @__PURE__ */
|
|
22839
|
-
/* @__PURE__ */
|
|
22840
|
-
/* @__PURE__ */
|
|
23046
|
+
/* @__PURE__ */ jsx19(Text18, { children: " " }),
|
|
23047
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Press Enter to retry, or type a Gateway ID manually below." }),
|
|
23048
|
+
/* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
|
|
23049
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "retry \u203A " }),
|
|
23050
|
+
/* @__PURE__ */ jsx19(
|
|
22841
23051
|
CustomTextInput,
|
|
22842
23052
|
{
|
|
22843
23053
|
value: "",
|
|
@@ -22847,9 +23057,9 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22847
23057
|
}
|
|
22848
23058
|
)
|
|
22849
23059
|
] }),
|
|
22850
|
-
/* @__PURE__ */
|
|
22851
|
-
/* @__PURE__ */
|
|
22852
|
-
/* @__PURE__ */
|
|
23060
|
+
/* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
|
|
23061
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "manual \u203A " }),
|
|
23062
|
+
/* @__PURE__ */ jsx19(
|
|
22853
23063
|
CustomTextInput,
|
|
22854
23064
|
{
|
|
22855
23065
|
value: gatewayManualId,
|
|
@@ -22859,23 +23069,23 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22859
23069
|
)
|
|
22860
23070
|
] })
|
|
22861
23071
|
] }),
|
|
22862
|
-
step === "model" && /* @__PURE__ */
|
|
22863
|
-
/* @__PURE__ */
|
|
22864
|
-
aiGatewayId && /* @__PURE__ */
|
|
23072
|
+
step === "model" && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
23073
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Pick a model to start with (you can change it anytime with /model)" }),
|
|
23074
|
+
aiGatewayId && /* @__PURE__ */ jsxs17(Text18, { color: theme.palette.success, children: [
|
|
22865
23075
|
"Gateway: ",
|
|
22866
23076
|
aiGatewayId,
|
|
22867
23077
|
" \u2713"
|
|
22868
23078
|
] }),
|
|
22869
|
-
!aiGatewayId && useGateway === false && /* @__PURE__ */
|
|
22870
|
-
/* @__PURE__ */
|
|
22871
|
-
/* @__PURE__ */
|
|
23079
|
+
!aiGatewayId && useGateway === false && /* @__PURE__ */ jsx19(Text18, { color: theme.palette.success, children: "Routing: Workers AI (direct) \u2713" }),
|
|
23080
|
+
/* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(ModelPicker, { current: model, onPick: handleModelPick }) }),
|
|
23081
|
+
/* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, dimColor: true, children: [
|
|
22872
23082
|
"Tip: Esc keeps the default (",
|
|
22873
23083
|
DEFAULT_MODEL,
|
|
22874
23084
|
") and continues."
|
|
22875
23085
|
] }) })
|
|
22876
23086
|
] }),
|
|
22877
|
-
step === "billingChoice" && pickedEntry && /* @__PURE__ */
|
|
22878
|
-
step === "unifiedProbe" && pickedEntry && /* @__PURE__ */
|
|
23087
|
+
step === "billingChoice" && pickedEntry && /* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(BillingChooser, { model: pickedEntry, onPick: handleBillingChoice }) }),
|
|
23088
|
+
step === "unifiedProbe" && pickedEntry && /* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
|
|
22879
23089
|
UnifiedBillingStatus,
|
|
22880
23090
|
{
|
|
22881
23091
|
model: pickedEntry,
|
|
@@ -22885,7 +23095,7 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22885
23095
|
onResolve: handleProbeResolve
|
|
22886
23096
|
}
|
|
22887
23097
|
) }),
|
|
22888
|
-
step === "keyEntry" && pickedEntry && /* @__PURE__ */
|
|
23098
|
+
step === "keyEntry" && pickedEntry && /* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
|
|
22889
23099
|
KeyEntryModal,
|
|
22890
23100
|
{
|
|
22891
23101
|
model: pickedEntry,
|
|
@@ -22896,10 +23106,10 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22896
23106
|
onCancel: handleCancelKeyEntry
|
|
22897
23107
|
}
|
|
22898
23108
|
) }),
|
|
22899
|
-
step === "confirm" && /* @__PURE__ */
|
|
22900
|
-
/* @__PURE__ */
|
|
22901
|
-
/* @__PURE__ */
|
|
22902
|
-
|
|
23109
|
+
step === "confirm" && /* @__PURE__ */ jsxs17(Fragment, { children: [
|
|
23110
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Ready to save configuration" }),
|
|
23111
|
+
/* @__PURE__ */ jsxs17(
|
|
23112
|
+
Box17,
|
|
22903
23113
|
{
|
|
22904
23114
|
flexDirection: "column",
|
|
22905
23115
|
marginTop: 1,
|
|
@@ -22908,29 +23118,29 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22908
23118
|
borderColor: theme.info.color,
|
|
22909
23119
|
paddingX: 1,
|
|
22910
23120
|
children: [
|
|
22911
|
-
/* @__PURE__ */
|
|
23121
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
|
|
22912
23122
|
"Account ID: ",
|
|
22913
23123
|
accountId
|
|
22914
23124
|
] }),
|
|
22915
|
-
/* @__PURE__ */
|
|
23125
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
|
|
22916
23126
|
"API Token: ",
|
|
22917
23127
|
"\u2022".repeat(apiToken.length)
|
|
22918
23128
|
] }),
|
|
22919
|
-
/* @__PURE__ */
|
|
23129
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
|
|
22920
23130
|
"Model: ",
|
|
22921
23131
|
model
|
|
22922
23132
|
] }),
|
|
22923
|
-
aiGatewayId ? /* @__PURE__ */
|
|
23133
|
+
aiGatewayId ? /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
|
|
22924
23134
|
"AI Gateway: ",
|
|
22925
23135
|
aiGatewayId
|
|
22926
|
-
] }) : /* @__PURE__ */
|
|
22927
|
-
unifiedBilling && /* @__PURE__ */
|
|
22928
|
-
Object.keys(providerKeyAliases).length > 0 && /* @__PURE__ */
|
|
23136
|
+
] }) : /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Routing: Workers AI (direct)" }),
|
|
23137
|
+
unifiedBilling && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Billing: Cloudflare credits (Unified Billing)" }),
|
|
23138
|
+
Object.keys(providerKeyAliases).length > 0 && /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
|
|
22929
23139
|
"Provider keys: ",
|
|
22930
23140
|
Object.keys(providerKeyAliases).join(", "),
|
|
22931
23141
|
" (in Cloudflare Secrets Store)"
|
|
22932
23142
|
] }),
|
|
22933
|
-
Object.keys(providerKeys).length > 0 && /* @__PURE__ */
|
|
23143
|
+
Object.keys(providerKeys).length > 0 && /* @__PURE__ */ jsxs17(Text18, { color: theme.info.color, children: [
|
|
22934
23144
|
"Provider keys: ",
|
|
22935
23145
|
Object.keys(providerKeys).join(", "),
|
|
22936
23146
|
" (local \u2014 do not commit ~/.config/kimiflare/config.json)"
|
|
@@ -22938,11 +23148,11 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22938
23148
|
]
|
|
22939
23149
|
}
|
|
22940
23150
|
),
|
|
22941
|
-
/* @__PURE__ */
|
|
22942
|
-
aiGatewayId && /* @__PURE__ */
|
|
22943
|
-
/* @__PURE__ */
|
|
22944
|
-
/* @__PURE__ */
|
|
22945
|
-
/* @__PURE__ */
|
|
23151
|
+
/* @__PURE__ */ jsx19(Text18, { children: "Press Enter to confirm, or Ctrl+C to cancel" }),
|
|
23152
|
+
aiGatewayId && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Tip: enable response caching with `/gateway cache-ttl 60` to cut costs on repeated prompts." }),
|
|
23153
|
+
/* @__PURE__ */ jsxs17(Box17, { marginTop: 1, children: [
|
|
23154
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.palette.primary, children: "\u203A " }),
|
|
23155
|
+
/* @__PURE__ */ jsx19(
|
|
22946
23156
|
CustomTextInput,
|
|
22947
23157
|
{
|
|
22948
23158
|
value: "",
|
|
@@ -22953,11 +23163,11 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
22953
23163
|
)
|
|
22954
23164
|
] })
|
|
22955
23165
|
] }),
|
|
22956
|
-
gatewayProbeMsg && step !== "gatewayProbing" && step !== "gatewayScopeError" && /* @__PURE__ */
|
|
23166
|
+
gatewayProbeMsg && step !== "gatewayProbing" && step !== "gatewayScopeError" && /* @__PURE__ */ jsxs17(Text18, { color: theme.palette.error ?? "red", children: [
|
|
22957
23167
|
"Probe failed: ",
|
|
22958
23168
|
gatewayProbeMsg
|
|
22959
23169
|
] }),
|
|
22960
|
-
savedPath && /* @__PURE__ */
|
|
23170
|
+
savedPath && /* @__PURE__ */ jsxs17(Text18, { color: theme.palette.success, children: [
|
|
22961
23171
|
"Config saved to ",
|
|
22962
23172
|
savedPath
|
|
22963
23173
|
] })
|
|
@@ -22980,8 +23190,8 @@ var init_onboarding = __esm({
|
|
|
22980
23190
|
});
|
|
22981
23191
|
|
|
22982
23192
|
// src/ui/welcome.tsx
|
|
22983
|
-
import { Box as
|
|
22984
|
-
import { jsx as
|
|
23193
|
+
import { Box as Box18, Text as Text19 } from "ink";
|
|
23194
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
22985
23195
|
function Welcome() {
|
|
22986
23196
|
const theme = useTheme();
|
|
22987
23197
|
const now2 = /* @__PURE__ */ new Date();
|
|
@@ -22989,9 +23199,9 @@ function Welcome() {
|
|
|
22989
23199
|
hour: now2.getHours(),
|
|
22990
23200
|
day: now2.getDay()
|
|
22991
23201
|
});
|
|
22992
|
-
return /* @__PURE__ */
|
|
22993
|
-
/* @__PURE__ */
|
|
22994
|
-
/* @__PURE__ */
|
|
23202
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", marginBottom: 1, children: [
|
|
23203
|
+
/* @__PURE__ */ jsx20(Box18, { marginBottom: 1, children: /* @__PURE__ */ jsx20(Text19, { bold: true, color: theme.accent, children: headline }) }),
|
|
23204
|
+
/* @__PURE__ */ jsx20(Box18, { flexDirection: "column", children: /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, dimColor: true, children: "Type / for commands" }) })
|
|
22995
23205
|
] });
|
|
22996
23206
|
}
|
|
22997
23207
|
var init_welcome = __esm({
|
|
@@ -23593,8 +23803,8 @@ var init_lsp_nudge = __esm({
|
|
|
23593
23803
|
});
|
|
23594
23804
|
|
|
23595
23805
|
// src/ui/file-picker.tsx
|
|
23596
|
-
import { Box as
|
|
23597
|
-
import { jsx as
|
|
23806
|
+
import { Box as Box19, Text as Text20 } from "ink";
|
|
23807
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
23598
23808
|
function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
23599
23809
|
const theme = useTheme();
|
|
23600
23810
|
let startIndex = 0;
|
|
@@ -23606,12 +23816,12 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
|
23606
23816
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT;
|
|
23607
23817
|
const recentInVisible = visible.filter((item) => recentFiles?.has(item.name)).length;
|
|
23608
23818
|
const hasRecentSection = recentInVisible > 0;
|
|
23609
|
-
return /* @__PURE__ */
|
|
23610
|
-
/* @__PURE__ */
|
|
23611
|
-
/* @__PURE__ */
|
|
23612
|
-
/* @__PURE__ */
|
|
23613
|
-
visible.length === 0 && /* @__PURE__ */
|
|
23614
|
-
hasMoreAbove && /* @__PURE__ */
|
|
23819
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
23820
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: query ? `Files matching "${query}"` : "Mention a file" }),
|
|
23821
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: true, children: "\u2191\u2193 navigate \xB7 Enter pick \xB7 Esc cancel" }),
|
|
23822
|
+
/* @__PURE__ */ jsxs19(Box19, { marginTop: 1, flexDirection: "column", children: [
|
|
23823
|
+
visible.length === 0 && /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, children: "No matches" }),
|
|
23824
|
+
hasMoreAbove && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, dimColor: true, children: [
|
|
23615
23825
|
"\u2026 ",
|
|
23616
23826
|
startIndex,
|
|
23617
23827
|
" more above"
|
|
@@ -23623,28 +23833,28 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
|
23623
23833
|
const label = item.isDirectory ? `${item.name}/` : item.name;
|
|
23624
23834
|
const isFirstRecent = isRecent && (i === 0 || !recentFiles?.has(visible[i - 1]?.name ?? ""));
|
|
23625
23835
|
const isFirstNonRecentAfterRecent = !isRecent && (i > 0 && recentFiles?.has(visible[i - 1]?.name ?? ""));
|
|
23626
|
-
return /* @__PURE__ */
|
|
23627
|
-
hasRecentSection && isFirstRecent && /* @__PURE__ */
|
|
23836
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", children: [
|
|
23837
|
+
hasRecentSection && isFirstRecent && /* @__PURE__ */ jsxs19(Text20, { color: theme.palette.success, bold: true, children: [
|
|
23628
23838
|
" ",
|
|
23629
23839
|
"Recent"
|
|
23630
23840
|
] }),
|
|
23631
|
-
hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */
|
|
23841
|
+
hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, dimColor: true, children: [
|
|
23632
23842
|
" ",
|
|
23633
23843
|
"All files"
|
|
23634
23844
|
] }),
|
|
23635
|
-
/* @__PURE__ */
|
|
23845
|
+
/* @__PURE__ */ jsxs19(Text20, { color: isSelected ? theme.accent : isRecent ? theme.palette.success : void 0, bold: isSelected || isRecent, children: [
|
|
23636
23846
|
isSelected ? "\u203A " : isRecent ? "\u2192 " : " ",
|
|
23637
23847
|
isRecent ? "\u21BB " : "",
|
|
23638
23848
|
label
|
|
23639
23849
|
] })
|
|
23640
23850
|
] }, item.name);
|
|
23641
23851
|
}),
|
|
23642
|
-
hasMoreBelow && /* @__PURE__ */
|
|
23852
|
+
hasMoreBelow && /* @__PURE__ */ jsxs19(Text20, { color: theme.info.color, dimColor: true, children: [
|
|
23643
23853
|
"\u2026 ",
|
|
23644
23854
|
items.length - (startIndex + VISIBLE_LIMIT),
|
|
23645
23855
|
" more below"
|
|
23646
23856
|
] }),
|
|
23647
|
-
hasRecentSection && /* @__PURE__ */
|
|
23857
|
+
hasRecentSection && /* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: true, children: "\u21BB = recently used" }) })
|
|
23648
23858
|
] })
|
|
23649
23859
|
] });
|
|
23650
23860
|
}
|
|
@@ -23658,8 +23868,8 @@ var init_file_picker = __esm({
|
|
|
23658
23868
|
});
|
|
23659
23869
|
|
|
23660
23870
|
// src/ui/slash-picker.tsx
|
|
23661
|
-
import { Box as
|
|
23662
|
-
import { jsx as
|
|
23871
|
+
import { Box as Box20, Text as Text21 } from "ink";
|
|
23872
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
23663
23873
|
function sourceBadge(source) {
|
|
23664
23874
|
if (source === "builtin") return "";
|
|
23665
23875
|
if (source === "project") return "project";
|
|
@@ -23679,12 +23889,12 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
23679
23889
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT2;
|
|
23680
23890
|
const longestLabel = visible.reduce((m, it) => Math.max(m, commandLabel(it).length), 0);
|
|
23681
23891
|
const nameColWidth = Math.max(NAME_COL_MIN_WIDTH, longestLabel + NAME_DESC_GAP);
|
|
23682
|
-
return /* @__PURE__ */
|
|
23683
|
-
/* @__PURE__ */
|
|
23684
|
-
/* @__PURE__ */
|
|
23685
|
-
/* @__PURE__ */
|
|
23686
|
-
visible.length === 0 && /* @__PURE__ */
|
|
23687
|
-
hasMoreAbove && /* @__PURE__ */
|
|
23892
|
+
return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
23893
|
+
/* @__PURE__ */ jsx22(Text21, { color: theme.accent, bold: true, children: query ? `Commands matching "/${query}"` : "Slash commands" }),
|
|
23894
|
+
/* @__PURE__ */ jsx22(Text21, { color: theme.info.color, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
23895
|
+
/* @__PURE__ */ jsxs20(Box20, { marginTop: 1, flexDirection: "column", children: [
|
|
23896
|
+
visible.length === 0 && /* @__PURE__ */ jsx22(Text21, { color: theme.info.color, children: "No matches" }),
|
|
23897
|
+
hasMoreAbove && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
23688
23898
|
"\u2026 ",
|
|
23689
23899
|
startIndex,
|
|
23690
23900
|
" more above"
|
|
@@ -23694,16 +23904,16 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
23694
23904
|
const isSelected = actualIndex === selectedIndex;
|
|
23695
23905
|
const nameCol = commandLabel(item).padEnd(nameColWidth);
|
|
23696
23906
|
const badge = sourceBadge(item.source);
|
|
23697
|
-
return /* @__PURE__ */
|
|
23907
|
+
return /* @__PURE__ */ jsxs20(Text21, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: [
|
|
23698
23908
|
isSelected ? "\u203A " : " ",
|
|
23699
23909
|
nameCol,
|
|
23700
|
-
/* @__PURE__ */
|
|
23910
|
+
/* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
23701
23911
|
item.description,
|
|
23702
23912
|
badge && ` [${badge}]`
|
|
23703
23913
|
] })
|
|
23704
23914
|
] }, item.name);
|
|
23705
23915
|
}),
|
|
23706
|
-
hasMoreBelow && /* @__PURE__ */
|
|
23916
|
+
hasMoreBelow && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
23707
23917
|
"\u2026 ",
|
|
23708
23918
|
items.length - (startIndex + VISIBLE_LIMIT2),
|
|
23709
23919
|
" more below"
|
|
@@ -23723,7 +23933,7 @@ var init_slash_picker = __esm({
|
|
|
23723
23933
|
});
|
|
23724
23934
|
|
|
23725
23935
|
// src/ui/use-picker-controller.ts
|
|
23726
|
-
import { useCallback as useCallback4, useEffect as useEffect9, useMemo as useMemo3, useRef as useRef4, useState as
|
|
23936
|
+
import { useCallback as useCallback4, useEffect as useEffect9, useMemo as useMemo3, useRef as useRef4, useState as useState15 } from "react";
|
|
23727
23937
|
function filterPickerItems(items, query) {
|
|
23728
23938
|
return fuzzyFilter(items, query, (item) => item.name).slice(0, 50);
|
|
23729
23939
|
}
|
|
@@ -23789,8 +23999,8 @@ function usePickerController(opts2) {
|
|
|
23789
23999
|
onSlashSelected,
|
|
23790
24000
|
getRecentFiles
|
|
23791
24001
|
} = opts2;
|
|
23792
|
-
const [active, setActive] =
|
|
23793
|
-
const [fileItemsRaw, setFileItemsRaw] =
|
|
24002
|
+
const [active, setActive] = useState15(null);
|
|
24003
|
+
const [fileItemsRaw, setFileItemsRaw] = useState15([]);
|
|
23794
24004
|
const filesLoadedRef = useRef4(false);
|
|
23795
24005
|
const cancelOffsetRef = useRef4(null);
|
|
23796
24006
|
const onFileSelectedRef = useRef4(onFileSelected);
|
|
@@ -23927,32 +24137,32 @@ var init_use_picker_controller = __esm({
|
|
|
23927
24137
|
});
|
|
23928
24138
|
|
|
23929
24139
|
// src/ui/use-modal-host.ts
|
|
23930
|
-
import { useMemo as useMemo4, useState as
|
|
24140
|
+
import { useMemo as useMemo4, useState as useState16 } from "react";
|
|
23931
24141
|
function useModalHost() {
|
|
23932
|
-
const [limitModal, setLimitModal] =
|
|
23933
|
-
const [loopModal, setLoopModal] =
|
|
23934
|
-
const [commandWizard, setCommandWizard] =
|
|
23935
|
-
const [commandPicker, setCommandPicker] =
|
|
23936
|
-
const [commandToDelete, setCommandToDelete] =
|
|
23937
|
-
const [showCommandList, setShowCommandList] =
|
|
23938
|
-
const [showLspWizard, setShowLspWizard] =
|
|
23939
|
-
const [showThemePicker, setShowThemePicker] =
|
|
23940
|
-
const [showUiPicker, setShowUiPicker] =
|
|
23941
|
-
const [showModelPicker, setShowModelPicker] =
|
|
23942
|
-
const [showModePicker, setShowModePicker] =
|
|
23943
|
-
const [keyEntryFor, setKeyEntryFor] =
|
|
23944
|
-
const [billingChooserFor, setBillingChooserFor] =
|
|
23945
|
-
const [unifiedProbeFor, setUnifiedProbeFor] =
|
|
23946
|
-
const [showRemoteDashboard, setShowRemoteDashboard] =
|
|
23947
|
-
const [showInboxModal, setShowInboxModal] =
|
|
23948
|
-
const [showMultiAgentModal, setShowMultiAgentModal] =
|
|
23949
|
-
const [showHooksDashboard, setShowHooksDashboard] =
|
|
23950
|
-
const [showHelpMenu, setShowHelpMenu] =
|
|
23951
|
-
const [showMemoryPicker, setShowMemoryPicker] =
|
|
23952
|
-
const [showGatewayPicker, setShowGatewayPicker] =
|
|
23953
|
-
const [showSkillsPicker, setShowSkillsPicker] =
|
|
23954
|
-
const [showShellPicker, setShowShellPicker] =
|
|
23955
|
-
const [showPlanCompletePicker, setShowPlanCompletePicker] =
|
|
24142
|
+
const [limitModal, setLimitModal] = useState16(null);
|
|
24143
|
+
const [loopModal, setLoopModal] = useState16(null);
|
|
24144
|
+
const [commandWizard, setCommandWizard] = useState16(null);
|
|
24145
|
+
const [commandPicker, setCommandPicker] = useState16(null);
|
|
24146
|
+
const [commandToDelete, setCommandToDelete] = useState16(null);
|
|
24147
|
+
const [showCommandList, setShowCommandList] = useState16(false);
|
|
24148
|
+
const [showLspWizard, setShowLspWizard] = useState16(false);
|
|
24149
|
+
const [showThemePicker, setShowThemePicker] = useState16(false);
|
|
24150
|
+
const [showUiPicker, setShowUiPicker] = useState16(false);
|
|
24151
|
+
const [showModelPicker, setShowModelPicker] = useState16(false);
|
|
24152
|
+
const [showModePicker, setShowModePicker] = useState16(false);
|
|
24153
|
+
const [keyEntryFor, setKeyEntryFor] = useState16(null);
|
|
24154
|
+
const [billingChooserFor, setBillingChooserFor] = useState16(null);
|
|
24155
|
+
const [unifiedProbeFor, setUnifiedProbeFor] = useState16(null);
|
|
24156
|
+
const [showRemoteDashboard, setShowRemoteDashboard] = useState16(false);
|
|
24157
|
+
const [showInboxModal, setShowInboxModal] = useState16(false);
|
|
24158
|
+
const [showMultiAgentModal, setShowMultiAgentModal] = useState16(false);
|
|
24159
|
+
const [showHooksDashboard, setShowHooksDashboard] = useState16(false);
|
|
24160
|
+
const [showHelpMenu, setShowHelpMenu] = useState16(false);
|
|
24161
|
+
const [showMemoryPicker, setShowMemoryPicker] = useState16(false);
|
|
24162
|
+
const [showGatewayPicker, setShowGatewayPicker] = useState16(false);
|
|
24163
|
+
const [showSkillsPicker, setShowSkillsPicker] = useState16(false);
|
|
24164
|
+
const [showShellPicker, setShowShellPicker] = useState16(false);
|
|
24165
|
+
const [showPlanCompletePicker, setShowPlanCompletePicker] = useState16(false);
|
|
23956
24166
|
const flags = useMemo4(() => {
|
|
23957
24167
|
const hasFullscreenModal = commandWizard !== null || commandPicker !== null || commandToDelete !== null || showCommandList || showLspWizard || showThemePicker || showUiPicker || showModelPicker || showModePicker || keyEntryFor !== null || billingChooserFor !== null || unifiedProbeFor !== null || showRemoteDashboard || showInboxModal || showMultiAgentModal || showHooksDashboard || showHelpMenu || showMemoryPicker || showGatewayPicker || showSkillsPicker || showShellPicker;
|
|
23958
24168
|
const hasOverlayModal = limitModal !== null || loopModal !== null || showPlanCompletePicker;
|
|
@@ -24046,9 +24256,9 @@ var init_use_modal_host = __esm({
|
|
|
24046
24256
|
});
|
|
24047
24257
|
|
|
24048
24258
|
// src/ui/limit-modal.tsx
|
|
24049
|
-
import { Box as
|
|
24050
|
-
import
|
|
24051
|
-
import { jsx as
|
|
24259
|
+
import { Box as Box21, Text as Text22 } from "ink";
|
|
24260
|
+
import SelectInput7 from "ink-select-input";
|
|
24261
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
24052
24262
|
function LimitModal({ limit, onDecide, title, description, items }) {
|
|
24053
24263
|
const theme = useTheme();
|
|
24054
24264
|
const defaultItems = [
|
|
@@ -24056,11 +24266,11 @@ function LimitModal({ limit, onDecide, title, description, items }) {
|
|
|
24056
24266
|
{ label: "Stop", value: "stop" }
|
|
24057
24267
|
];
|
|
24058
24268
|
const selectItems = items ?? defaultItems;
|
|
24059
|
-
return /* @__PURE__ */
|
|
24060
|
-
/* @__PURE__ */
|
|
24061
|
-
/* @__PURE__ */
|
|
24062
|
-
/* @__PURE__ */
|
|
24063
|
-
|
|
24269
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.error, paddingX: 1, children: [
|
|
24270
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.error, bold: true, children: title ?? `Tool-call limit reached (${limit})` }),
|
|
24271
|
+
/* @__PURE__ */ jsx23(Text22, { dimColor: true, children: description ?? `This session has made ${limit} tool calls. What would you like to do?` }),
|
|
24272
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
24273
|
+
SelectInput7,
|
|
24064
24274
|
{
|
|
24065
24275
|
items: selectItems,
|
|
24066
24276
|
onSelect: (item) => onDecide(item.value)
|
|
@@ -24076,21 +24286,21 @@ var init_limit_modal = __esm({
|
|
|
24076
24286
|
});
|
|
24077
24287
|
|
|
24078
24288
|
// src/ui/command-wizard.tsx
|
|
24079
|
-
import { useState as
|
|
24080
|
-
import { Box as
|
|
24081
|
-
import
|
|
24082
|
-
import { Fragment as Fragment2, jsx as
|
|
24289
|
+
import { useState as useState17 } from "react";
|
|
24290
|
+
import { Box as Box22, Text as Text23, useInput as useInput11, useWindowSize } from "ink";
|
|
24291
|
+
import SelectInput8 from "ink-select-input";
|
|
24292
|
+
import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
24083
24293
|
function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onSave }) {
|
|
24084
24294
|
const theme = useTheme();
|
|
24085
|
-
const [step, setStep] =
|
|
24086
|
-
const [name, setName] =
|
|
24087
|
-
const [description, setDescription] =
|
|
24088
|
-
const [template, setTemplate] =
|
|
24089
|
-
const [cmdMode, setCmdMode] =
|
|
24090
|
-
const [cmdEffort, setCmdEffort] =
|
|
24091
|
-
const [cmdModel, setCmdModel] =
|
|
24092
|
-
const [source, setSource] =
|
|
24093
|
-
const [error, setError] =
|
|
24295
|
+
const [step, setStep] = useState17("name");
|
|
24296
|
+
const [name, setName] = useState17(initial?.name ?? "");
|
|
24297
|
+
const [description, setDescription] = useState17(initial?.description ?? "");
|
|
24298
|
+
const [template, setTemplate] = useState17(initial?.template ?? "");
|
|
24299
|
+
const [cmdMode, setCmdMode] = useState17(initial?.mode);
|
|
24300
|
+
const [cmdEffort, setCmdEffort] = useState17(initial?.effort);
|
|
24301
|
+
const [cmdModel, setCmdModel] = useState17(initial?.model);
|
|
24302
|
+
const [source, setSource] = useState17(initial?.source ?? "project");
|
|
24303
|
+
const [error, setError] = useState17(null);
|
|
24094
24304
|
const { columns } = useWindowSize();
|
|
24095
24305
|
const totalSteps = 5;
|
|
24096
24306
|
const stepIndex = step === "name" ? 1 : step === "description" ? 2 : step === "template" ? 3 : step === "advanced" || step === "mode" || step === "effort" || step === "model" ? 4 : step === "location" ? 4 : 5;
|
|
@@ -24103,7 +24313,7 @@ function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onS
|
|
|
24103
24313
|
if (existingNames.includes(trimmed) && !isEditingSelf(trimmed)) return `/${trimmed} already exists`;
|
|
24104
24314
|
return null;
|
|
24105
24315
|
};
|
|
24106
|
-
|
|
24316
|
+
useInput11((_input, key) => {
|
|
24107
24317
|
if (key.escape) {
|
|
24108
24318
|
onDone();
|
|
24109
24319
|
}
|
|
@@ -24203,8 +24413,8 @@ ${template}`;
|
|
|
24203
24413
|
const renderStep = () => {
|
|
24204
24414
|
switch (step) {
|
|
24205
24415
|
case "name":
|
|
24206
|
-
return /* @__PURE__ */
|
|
24207
|
-
/* @__PURE__ */
|
|
24416
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24417
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24208
24418
|
mode === "create" ? "Create" : "Edit",
|
|
24209
24419
|
" custom command \u2014 Name (",
|
|
24210
24420
|
stepIndex,
|
|
@@ -24212,8 +24422,8 @@ ${template}`;
|
|
|
24212
24422
|
totalSteps,
|
|
24213
24423
|
")"
|
|
24214
24424
|
] }),
|
|
24215
|
-
error && /* @__PURE__ */
|
|
24216
|
-
/* @__PURE__ */
|
|
24425
|
+
error && /* @__PURE__ */ jsx24(Text23, { color: theme.error, children: error }),
|
|
24426
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24217
24427
|
CustomTextInput,
|
|
24218
24428
|
{
|
|
24219
24429
|
value: name,
|
|
@@ -24222,11 +24432,11 @@ ${template}`;
|
|
|
24222
24432
|
focus: true
|
|
24223
24433
|
}
|
|
24224
24434
|
) }),
|
|
24225
|
-
/* @__PURE__ */
|
|
24435
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "letters, numbers, _ - / only; must start with a letter" })
|
|
24226
24436
|
] });
|
|
24227
24437
|
case "description":
|
|
24228
|
-
return /* @__PURE__ */
|
|
24229
|
-
/* @__PURE__ */
|
|
24438
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24439
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24230
24440
|
mode === "create" ? "Create" : "Edit",
|
|
24231
24441
|
" custom command \u2014 Description (",
|
|
24232
24442
|
stepIndex,
|
|
@@ -24234,7 +24444,7 @@ ${template}`;
|
|
|
24234
24444
|
totalSteps,
|
|
24235
24445
|
")"
|
|
24236
24446
|
] }),
|
|
24237
|
-
/* @__PURE__ */
|
|
24447
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24238
24448
|
CustomTextInput,
|
|
24239
24449
|
{
|
|
24240
24450
|
value: description,
|
|
@@ -24243,49 +24453,49 @@ ${template}`;
|
|
|
24243
24453
|
focus: true
|
|
24244
24454
|
}
|
|
24245
24455
|
) }),
|
|
24246
|
-
/* @__PURE__ */
|
|
24456
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Press Enter to skip" })
|
|
24247
24457
|
] });
|
|
24248
24458
|
case "template": {
|
|
24249
|
-
const guide = /* @__PURE__ */
|
|
24250
|
-
/* @__PURE__ */
|
|
24251
|
-
/* @__PURE__ */
|
|
24252
|
-
/* @__PURE__ */
|
|
24459
|
+
const guide = /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", paddingLeft: 1, children: [
|
|
24460
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: "What is this?" }),
|
|
24461
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "A prompt template \u2014 instructions to the AI." }),
|
|
24462
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
24253
24463
|
"When you type /",
|
|
24254
24464
|
name || "yourcommand",
|
|
24255
24465
|
" later, this gets sent to the model."
|
|
24256
24466
|
] }),
|
|
24257
|
-
/* @__PURE__ */
|
|
24258
|
-
/* @__PURE__ */
|
|
24259
|
-
/* @__PURE__ */
|
|
24467
|
+
/* @__PURE__ */ jsxs22(Box22, { marginTop: 1, flexDirection: "column", children: [
|
|
24468
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: "Variables" }),
|
|
24469
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
24260
24470
|
" ",
|
|
24261
24471
|
"$1, $2 ... \u2192 arguments you type"
|
|
24262
24472
|
] }),
|
|
24263
|
-
/* @__PURE__ */
|
|
24473
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
24264
24474
|
" ",
|
|
24265
24475
|
"$ARGUMENTS \u2192 everything after the command"
|
|
24266
24476
|
] })
|
|
24267
24477
|
] }),
|
|
24268
|
-
/* @__PURE__ */
|
|
24269
|
-
/* @__PURE__ */
|
|
24270
|
-
/* @__PURE__ */
|
|
24478
|
+
/* @__PURE__ */ jsxs22(Box22, { marginTop: 1, flexDirection: "column", children: [
|
|
24479
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: "Dynamic inlines" }),
|
|
24480
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
24271
24481
|
" ",
|
|
24272
24482
|
"!`git diff` \u2192 shell output inlined"
|
|
24273
24483
|
] }),
|
|
24274
|
-
/* @__PURE__ */
|
|
24484
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
24275
24485
|
" ",
|
|
24276
24486
|
"@README.md \u2192 file contents inlined"
|
|
24277
24487
|
] })
|
|
24278
24488
|
] }),
|
|
24279
|
-
/* @__PURE__ */
|
|
24280
|
-
/* @__PURE__ */
|
|
24281
|
-
/* @__PURE__ */
|
|
24282
|
-
/* @__PURE__ */
|
|
24283
|
-
/* @__PURE__ */
|
|
24489
|
+
/* @__PURE__ */ jsxs22(Box22, { marginTop: 1, flexDirection: "column", children: [
|
|
24490
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.accent, bold: true, children: "Example" }),
|
|
24491
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Review this PR diff:" }),
|
|
24492
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "!`git diff main...HEAD`" }),
|
|
24493
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Focus on: $1" })
|
|
24284
24494
|
] })
|
|
24285
24495
|
] });
|
|
24286
|
-
const inputArea = /* @__PURE__ */
|
|
24287
|
-
error && /* @__PURE__ */
|
|
24288
|
-
/* @__PURE__ */
|
|
24496
|
+
const inputArea = /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", flexGrow: 1, children: [
|
|
24497
|
+
error && /* @__PURE__ */ jsx24(Text23, { color: theme.error, children: error }),
|
|
24498
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24289
24499
|
CustomTextInput,
|
|
24290
24500
|
{
|
|
24291
24501
|
value: template,
|
|
@@ -24295,13 +24505,13 @@ ${template}`;
|
|
|
24295
24505
|
enablePaste: true
|
|
24296
24506
|
}
|
|
24297
24507
|
) }),
|
|
24298
|
-
columns < 100 && /* @__PURE__ */
|
|
24299
|
-
/* @__PURE__ */
|
|
24300
|
-
/* @__PURE__ */
|
|
24508
|
+
columns < 100 && /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24509
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Paste multi-line templates with Ctrl+V." }),
|
|
24510
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Variables: $1 $2 ... $ARGUMENTS Shell: !`cmd` File: @path" })
|
|
24301
24511
|
] })
|
|
24302
24512
|
] });
|
|
24303
|
-
return /* @__PURE__ */
|
|
24304
|
-
/* @__PURE__ */
|
|
24513
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24514
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24305
24515
|
mode === "create" ? "Create" : "Edit",
|
|
24306
24516
|
" custom command \u2014 Template (",
|
|
24307
24517
|
stepIndex,
|
|
@@ -24309,10 +24519,10 @@ ${template}`;
|
|
|
24309
24519
|
totalSteps,
|
|
24310
24520
|
")"
|
|
24311
24521
|
] }),
|
|
24312
|
-
columns >= 100 ? /* @__PURE__ */
|
|
24313
|
-
/* @__PURE__ */
|
|
24314
|
-
/* @__PURE__ */
|
|
24315
|
-
] }) : /* @__PURE__ */
|
|
24522
|
+
columns >= 100 ? /* @__PURE__ */ jsxs22(Box22, { flexDirection: "row", marginTop: 1, children: [
|
|
24523
|
+
/* @__PURE__ */ jsx24(Box22, { flexDirection: "column", width: "50%", children: inputArea }),
|
|
24524
|
+
/* @__PURE__ */ jsx24(Box22, { flexDirection: "column", width: "50%", children: guide })
|
|
24525
|
+
] }) : /* @__PURE__ */ jsx24(Box22, { flexDirection: "column", marginTop: 1, children: inputArea })
|
|
24316
24526
|
] });
|
|
24317
24527
|
}
|
|
24318
24528
|
case "advanced": {
|
|
@@ -24321,8 +24531,8 @@ ${template}`;
|
|
|
24321
24531
|
{ label: "Skip", value: "skip", key: "skip" },
|
|
24322
24532
|
{ label: "\u2190 Cancel", value: "cancel", key: "cancel" }
|
|
24323
24533
|
];
|
|
24324
|
-
return /* @__PURE__ */
|
|
24325
|
-
/* @__PURE__ */
|
|
24534
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24535
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24326
24536
|
mode === "create" ? "Create" : "Edit",
|
|
24327
24537
|
" custom command \u2014 Options (",
|
|
24328
24538
|
stepIndex,
|
|
@@ -24330,8 +24540,8 @@ ${template}`;
|
|
|
24330
24540
|
totalSteps,
|
|
24331
24541
|
")"
|
|
24332
24542
|
] }),
|
|
24333
|
-
/* @__PURE__ */
|
|
24334
|
-
|
|
24543
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24544
|
+
SelectInput8,
|
|
24335
24545
|
{
|
|
24336
24546
|
items,
|
|
24337
24547
|
onSelect: (item) => {
|
|
@@ -24350,17 +24560,17 @@ ${template}`;
|
|
|
24350
24560
|
{ label: cmdMode === "auto" ? "auto \xB7 current" : "auto", value: "auto", key: "auto" },
|
|
24351
24561
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
24352
24562
|
];
|
|
24353
|
-
return /* @__PURE__ */
|
|
24354
|
-
/* @__PURE__ */
|
|
24563
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24564
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24355
24565
|
"Mode override (",
|
|
24356
24566
|
stepIndex,
|
|
24357
24567
|
"/",
|
|
24358
24568
|
totalSteps,
|
|
24359
24569
|
")"
|
|
24360
24570
|
] }),
|
|
24361
|
-
/* @__PURE__ */
|
|
24362
|
-
/* @__PURE__ */
|
|
24363
|
-
|
|
24571
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Saved to file but not yet enforced at runtime" }),
|
|
24572
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24573
|
+
SelectInput8,
|
|
24364
24574
|
{
|
|
24365
24575
|
items,
|
|
24366
24576
|
onSelect: (item) => {
|
|
@@ -24379,16 +24589,16 @@ ${template}`;
|
|
|
24379
24589
|
{ label: cmdEffort === "high" ? "high \xB7 current" : "high", value: "high", key: "high" },
|
|
24380
24590
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
24381
24591
|
];
|
|
24382
|
-
return /* @__PURE__ */
|
|
24383
|
-
/* @__PURE__ */
|
|
24592
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24593
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24384
24594
|
"Reasoning effort (",
|
|
24385
24595
|
stepIndex,
|
|
24386
24596
|
"/",
|
|
24387
24597
|
totalSteps,
|
|
24388
24598
|
")"
|
|
24389
24599
|
] }),
|
|
24390
|
-
/* @__PURE__ */
|
|
24391
|
-
|
|
24600
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24601
|
+
SelectInput8,
|
|
24392
24602
|
{
|
|
24393
24603
|
items,
|
|
24394
24604
|
onSelect: (item) => {
|
|
@@ -24400,15 +24610,15 @@ ${template}`;
|
|
|
24400
24610
|
] });
|
|
24401
24611
|
}
|
|
24402
24612
|
case "model":
|
|
24403
|
-
return /* @__PURE__ */
|
|
24404
|
-
/* @__PURE__ */
|
|
24613
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24614
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24405
24615
|
"Model override (",
|
|
24406
24616
|
stepIndex,
|
|
24407
24617
|
"/",
|
|
24408
24618
|
totalSteps,
|
|
24409
24619
|
")"
|
|
24410
24620
|
] }),
|
|
24411
|
-
/* @__PURE__ */
|
|
24621
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24412
24622
|
CustomTextInput,
|
|
24413
24623
|
{
|
|
24414
24624
|
value: cmdModel ?? "",
|
|
@@ -24417,7 +24627,7 @@ ${template}`;
|
|
|
24417
24627
|
focus: true
|
|
24418
24628
|
}
|
|
24419
24629
|
) }),
|
|
24420
|
-
/* @__PURE__ */
|
|
24630
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Press Enter to skip" })
|
|
24421
24631
|
] });
|
|
24422
24632
|
case "location": {
|
|
24423
24633
|
const items = [
|
|
@@ -24425,16 +24635,16 @@ ${template}`;
|
|
|
24425
24635
|
{ label: source === "global" ? "Global \xB7 current" : "Global", value: "global", key: "global" },
|
|
24426
24636
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
24427
24637
|
];
|
|
24428
|
-
return /* @__PURE__ */
|
|
24429
|
-
/* @__PURE__ */
|
|
24638
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24639
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24430
24640
|
"Save location (",
|
|
24431
24641
|
stepIndex,
|
|
24432
24642
|
"/",
|
|
24433
24643
|
totalSteps,
|
|
24434
24644
|
")"
|
|
24435
24645
|
] }),
|
|
24436
|
-
/* @__PURE__ */
|
|
24437
|
-
|
|
24646
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24647
|
+
SelectInput8,
|
|
24438
24648
|
{
|
|
24439
24649
|
items,
|
|
24440
24650
|
onSelect: (item) => {
|
|
@@ -24443,7 +24653,7 @@ ${template}`;
|
|
|
24443
24653
|
}
|
|
24444
24654
|
}
|
|
24445
24655
|
) }),
|
|
24446
|
-
/* @__PURE__ */
|
|
24656
|
+
/* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: "Project: .kimiflare/commands/ Global: ~/.config/kimiflare/commands/" })
|
|
24447
24657
|
] });
|
|
24448
24658
|
}
|
|
24449
24659
|
case "confirm": {
|
|
@@ -24451,8 +24661,8 @@ ${template}`;
|
|
|
24451
24661
|
{ label: "Save", value: "save", key: "save" },
|
|
24452
24662
|
{ label: "Cancel", value: "cancel", key: "cancel" }
|
|
24453
24663
|
];
|
|
24454
|
-
return /* @__PURE__ */
|
|
24455
|
-
/* @__PURE__ */
|
|
24664
|
+
return /* @__PURE__ */ jsxs22(Fragment2, { children: [
|
|
24665
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.accent, bold: true, children: [
|
|
24456
24666
|
mode === "create" ? "Create" : "Edit",
|
|
24457
24667
|
" custom command \u2014 Confirm (",
|
|
24458
24668
|
stepIndex,
|
|
@@ -24460,14 +24670,14 @@ ${template}`;
|
|
|
24460
24670
|
totalSteps,
|
|
24461
24671
|
")"
|
|
24462
24672
|
] }),
|
|
24463
|
-
/* @__PURE__ */
|
|
24673
|
+
/* @__PURE__ */ jsxs22(Text23, { color: theme.info.color, children: [
|
|
24464
24674
|
source === "project" ? ".kimiflare/commands/" : "~/.config/kimiflare/commands/",
|
|
24465
24675
|
name,
|
|
24466
24676
|
".md"
|
|
24467
24677
|
] }),
|
|
24468
|
-
/* @__PURE__ */
|
|
24469
|
-
/* @__PURE__ */
|
|
24470
|
-
|
|
24678
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, flexDirection: "column", children: previewContent().split("\n").map((line, i) => /* @__PURE__ */ jsx24(Text23, { color: theme.info.color, children: line || " " }, i)) }),
|
|
24679
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
24680
|
+
SelectInput8,
|
|
24471
24681
|
{
|
|
24472
24682
|
items,
|
|
24473
24683
|
onSelect: (item) => handleConfirm(item.value)
|
|
@@ -24477,7 +24687,7 @@ ${template}`;
|
|
|
24477
24687
|
}
|
|
24478
24688
|
}
|
|
24479
24689
|
};
|
|
24480
|
-
return /* @__PURE__ */
|
|
24690
|
+
return /* @__PURE__ */ jsx24(Box22, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: renderStep() });
|
|
24481
24691
|
}
|
|
24482
24692
|
var NAME_RE;
|
|
24483
24693
|
var init_command_wizard = __esm({
|
|
@@ -24490,9 +24700,9 @@ var init_command_wizard = __esm({
|
|
|
24490
24700
|
});
|
|
24491
24701
|
|
|
24492
24702
|
// src/ui/command-picker.tsx
|
|
24493
|
-
import { Box as
|
|
24494
|
-
import
|
|
24495
|
-
import { jsx as
|
|
24703
|
+
import { Box as Box23, Text as Text24 } from "ink";
|
|
24704
|
+
import SelectInput9 from "ink-select-input";
|
|
24705
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
24496
24706
|
function CommandPicker({ commands, title, onPick }) {
|
|
24497
24707
|
const theme = useTheme();
|
|
24498
24708
|
const items = commands.map((cmd) => ({
|
|
@@ -24501,11 +24711,11 @@ function CommandPicker({ commands, title, onPick }) {
|
|
|
24501
24711
|
key: cmd.name
|
|
24502
24712
|
}));
|
|
24503
24713
|
items.push({ label: "\u2190 Cancel", value: null, key: "__cancel__" });
|
|
24504
|
-
return /* @__PURE__ */
|
|
24505
|
-
/* @__PURE__ */
|
|
24506
|
-
/* @__PURE__ */
|
|
24507
|
-
/* @__PURE__ */
|
|
24508
|
-
|
|
24714
|
+
return /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
24715
|
+
/* @__PURE__ */ jsx25(Text24, { color: theme.accent, bold: true, children: title }),
|
|
24716
|
+
/* @__PURE__ */ jsx25(Text24, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
24717
|
+
/* @__PURE__ */ jsx25(Box23, { marginTop: 1, children: /* @__PURE__ */ jsx25(
|
|
24718
|
+
SelectInput9,
|
|
24509
24719
|
{
|
|
24510
24720
|
items,
|
|
24511
24721
|
onSelect: (item) => {
|
|
@@ -24527,64 +24737,64 @@ var init_command_picker = __esm({
|
|
|
24527
24737
|
});
|
|
24528
24738
|
|
|
24529
24739
|
// src/ui/command-list.tsx
|
|
24530
|
-
import { Box as
|
|
24531
|
-
import { jsx as
|
|
24740
|
+
import { Box as Box24, Text as Text25, useInput as useInput12 } from "ink";
|
|
24741
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
24532
24742
|
function CommandList({ commands, onDone }) {
|
|
24533
24743
|
const theme = useTheme();
|
|
24534
|
-
|
|
24744
|
+
useInput12((_input, key) => {
|
|
24535
24745
|
if (key.escape) {
|
|
24536
24746
|
onDone();
|
|
24537
24747
|
}
|
|
24538
24748
|
});
|
|
24539
|
-
return /* @__PURE__ */
|
|
24540
|
-
/* @__PURE__ */
|
|
24541
|
-
/* @__PURE__ */
|
|
24542
|
-
/* @__PURE__ */
|
|
24543
|
-
commands.length === 0 && /* @__PURE__ */
|
|
24544
|
-
commands.map((cmd) => /* @__PURE__ */
|
|
24545
|
-
/* @__PURE__ */
|
|
24749
|
+
return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
24750
|
+
/* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: "Custom commands" }),
|
|
24751
|
+
/* @__PURE__ */ jsx26(Text25, { color: theme.info.color, dimColor: false, children: "Esc to close." }),
|
|
24752
|
+
/* @__PURE__ */ jsxs24(Box24, { marginTop: 1, flexDirection: "column", children: [
|
|
24753
|
+
commands.length === 0 && /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, children: "No custom commands found." }),
|
|
24754
|
+
commands.map((cmd) => /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", marginBottom: 1, children: [
|
|
24755
|
+
/* @__PURE__ */ jsxs24(Text25, { color: theme.accent, bold: true, children: [
|
|
24546
24756
|
"/",
|
|
24547
24757
|
cmd.name
|
|
24548
24758
|
] }),
|
|
24549
|
-
/* @__PURE__ */
|
|
24759
|
+
/* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24550
24760
|
" ",
|
|
24551
24761
|
"source: ",
|
|
24552
24762
|
cmd.source
|
|
24553
24763
|
] }),
|
|
24554
|
-
/* @__PURE__ */
|
|
24764
|
+
/* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24555
24765
|
" ",
|
|
24556
24766
|
"path: ",
|
|
24557
24767
|
cmd.filepath
|
|
24558
24768
|
] }),
|
|
24559
|
-
cmd.description && /* @__PURE__ */
|
|
24769
|
+
cmd.description && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24560
24770
|
" ",
|
|
24561
24771
|
"desc: ",
|
|
24562
24772
|
cmd.description
|
|
24563
24773
|
] }),
|
|
24564
|
-
cmd.mode && /* @__PURE__ */
|
|
24774
|
+
cmd.mode && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24565
24775
|
" ",
|
|
24566
24776
|
"mode: ",
|
|
24567
24777
|
cmd.mode
|
|
24568
24778
|
] }),
|
|
24569
|
-
cmd.effort && /* @__PURE__ */
|
|
24779
|
+
cmd.effort && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24570
24780
|
" ",
|
|
24571
24781
|
"effort: ",
|
|
24572
24782
|
cmd.effort
|
|
24573
24783
|
] }),
|
|
24574
|
-
cmd.model && /* @__PURE__ */
|
|
24784
|
+
cmd.model && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24575
24785
|
" ",
|
|
24576
24786
|
"model: ",
|
|
24577
24787
|
cmd.model
|
|
24578
24788
|
] }),
|
|
24579
|
-
/* @__PURE__ */
|
|
24789
|
+
/* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24580
24790
|
" ",
|
|
24581
24791
|
"template:"
|
|
24582
24792
|
] }),
|
|
24583
|
-
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */
|
|
24793
|
+
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24584
24794
|
" ",
|
|
24585
24795
|
line || " "
|
|
24586
24796
|
] }, i)),
|
|
24587
|
-
cmd.template.split("\n").length > 5 && /* @__PURE__ */
|
|
24797
|
+
cmd.template.split("\n").length > 5 && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
24588
24798
|
" ",
|
|
24589
24799
|
"..."
|
|
24590
24800
|
] })
|
|
@@ -24600,20 +24810,20 @@ var init_command_list = __esm({
|
|
|
24600
24810
|
});
|
|
24601
24811
|
|
|
24602
24812
|
// src/ui/lsp-wizard.tsx
|
|
24603
|
-
import { useState as
|
|
24604
|
-
import { Box as
|
|
24605
|
-
import
|
|
24813
|
+
import { useState as useState18 } from "react";
|
|
24814
|
+
import { Box as Box25, Text as Text26 } from "ink";
|
|
24815
|
+
import SelectInput10 from "ink-select-input";
|
|
24606
24816
|
import { spawn as spawn6 } from "child_process";
|
|
24607
|
-
import { jsx as
|
|
24817
|
+
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
24608
24818
|
function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
24609
24819
|
const theme = useTheme();
|
|
24610
|
-
const [page, setPage] =
|
|
24611
|
-
const [selectedPreset, setSelectedPreset] =
|
|
24612
|
-
const [customName, setCustomName] =
|
|
24613
|
-
const [customCommand, setCustomCommand] =
|
|
24614
|
-
const [installState, setInstallState] =
|
|
24615
|
-
const [pendingServers, setPendingServers] =
|
|
24616
|
-
const [pendingEnabled, setPendingEnabled] =
|
|
24820
|
+
const [page, setPage] = useState18("main");
|
|
24821
|
+
const [selectedPreset, setSelectedPreset] = useState18(null);
|
|
24822
|
+
const [customName, setCustomName] = useState18("");
|
|
24823
|
+
const [customCommand, setCustomCommand] = useState18("");
|
|
24824
|
+
const [installState, setInstallState] = useState18({ status: "idle", output: "" });
|
|
24825
|
+
const [pendingServers, setPendingServers] = useState18(null);
|
|
24826
|
+
const [pendingEnabled, setPendingEnabled] = useState18(true);
|
|
24617
24827
|
const runInstall = (command) => {
|
|
24618
24828
|
setInstallState({ status: "running", output: "Installing..." });
|
|
24619
24829
|
const { shell, args } = getShellCommand();
|
|
@@ -24716,11 +24926,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24716
24926
|
{ label: "(close)", value: "__close__", key: "__close__" }
|
|
24717
24927
|
];
|
|
24718
24928
|
if (page === "main") {
|
|
24719
|
-
return /* @__PURE__ */
|
|
24720
|
-
/* @__PURE__ */
|
|
24721
|
-
/* @__PURE__ */
|
|
24722
|
-
/* @__PURE__ */
|
|
24723
|
-
|
|
24929
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
24930
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "LSP Servers" }),
|
|
24931
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
24932
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
24933
|
+
SelectInput10,
|
|
24724
24934
|
{
|
|
24725
24935
|
items: mainItems,
|
|
24726
24936
|
onSelect: (item) => {
|
|
@@ -24747,11 +24957,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24747
24957
|
}),
|
|
24748
24958
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
24749
24959
|
];
|
|
24750
|
-
return /* @__PURE__ */
|
|
24751
|
-
/* @__PURE__ */
|
|
24752
|
-
/* @__PURE__ */
|
|
24753
|
-
/* @__PURE__ */
|
|
24754
|
-
|
|
24960
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
24961
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Add LSP Server" }),
|
|
24962
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Select a language server to configure." }),
|
|
24963
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
24964
|
+
SelectInput10,
|
|
24755
24965
|
{
|
|
24756
24966
|
items,
|
|
24757
24967
|
onSelect: (item) => {
|
|
@@ -24778,19 +24988,19 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24778
24988
|
{ label: isSuccess ? "Save to config \u2713" : "Save anyway", value: "save", key: "save" },
|
|
24779
24989
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
24780
24990
|
];
|
|
24781
|
-
return /* @__PURE__ */
|
|
24782
|
-
/* @__PURE__ */
|
|
24991
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
24992
|
+
/* @__PURE__ */ jsxs25(Text26, { color: theme.accent, bold: true, children: [
|
|
24783
24993
|
"Install ",
|
|
24784
24994
|
selectedPreset.name
|
|
24785
24995
|
] }),
|
|
24786
|
-
/* @__PURE__ */
|
|
24787
|
-
/* @__PURE__ */
|
|
24788
|
-
/* @__PURE__ */
|
|
24789
|
-
/* @__PURE__ */
|
|
24996
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: selectedPreset.installHint }),
|
|
24997
|
+
/* @__PURE__ */ jsxs25(Box25, { marginTop: 1, flexDirection: "column", children: [
|
|
24998
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Command:" }),
|
|
24999
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, children: selectedPreset.installCommand || "(none required)" })
|
|
24790
25000
|
] }),
|
|
24791
|
-
installState.output && /* @__PURE__ */
|
|
24792
|
-
/* @__PURE__ */
|
|
24793
|
-
|
|
25001
|
+
installState.output && /* @__PURE__ */ jsx27(Box25, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx27(Text26, { color: isSuccess ? theme.accent : theme.error, children: installState.output.slice(-500) }) }),
|
|
25002
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25003
|
+
SelectInput10,
|
|
24794
25004
|
{
|
|
24795
25005
|
items,
|
|
24796
25006
|
onSelect: (item) => {
|
|
@@ -24807,16 +25017,16 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24807
25017
|
}
|
|
24808
25018
|
}
|
|
24809
25019
|
) }),
|
|
24810
|
-
isSuccess && /* @__PURE__ */
|
|
25020
|
+
isSuccess && /* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(Text26, { color: theme.accent, children: "Server saved. Run /lsp reload to start it." }) })
|
|
24811
25021
|
] });
|
|
24812
25022
|
}
|
|
24813
25023
|
if (page === "custom-name") {
|
|
24814
|
-
return /* @__PURE__ */
|
|
24815
|
-
/* @__PURE__ */
|
|
24816
|
-
/* @__PURE__ */
|
|
24817
|
-
/* @__PURE__ */
|
|
24818
|
-
/* @__PURE__ */
|
|
24819
|
-
/* @__PURE__ */
|
|
25024
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25025
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Name" }),
|
|
25026
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Enter a name for this server (e.g., my-server)." }),
|
|
25027
|
+
/* @__PURE__ */ jsxs25(Box25, { marginTop: 1, children: [
|
|
25028
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, children: "\u203A " }),
|
|
25029
|
+
/* @__PURE__ */ jsx27(
|
|
24820
25030
|
CustomTextInput,
|
|
24821
25031
|
{
|
|
24822
25032
|
value: customName,
|
|
@@ -24830,8 +25040,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24830
25040
|
}
|
|
24831
25041
|
)
|
|
24832
25042
|
] }),
|
|
24833
|
-
/* @__PURE__ */
|
|
24834
|
-
|
|
25043
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25044
|
+
SelectInput10,
|
|
24835
25045
|
{
|
|
24836
25046
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
24837
25047
|
onSelect: () => setPage("add")
|
|
@@ -24840,12 +25050,12 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24840
25050
|
] });
|
|
24841
25051
|
}
|
|
24842
25052
|
if (page === "custom-command") {
|
|
24843
|
-
return /* @__PURE__ */
|
|
24844
|
-
/* @__PURE__ */
|
|
24845
|
-
/* @__PURE__ */
|
|
24846
|
-
/* @__PURE__ */
|
|
24847
|
-
/* @__PURE__ */
|
|
24848
|
-
/* @__PURE__ */
|
|
25053
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25054
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Command" }),
|
|
25055
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Enter the command to start the server (space-separated)." }),
|
|
25056
|
+
/* @__PURE__ */ jsxs25(Box25, { marginTop: 1, children: [
|
|
25057
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, children: "\u203A " }),
|
|
25058
|
+
/* @__PURE__ */ jsx27(
|
|
24849
25059
|
CustomTextInput,
|
|
24850
25060
|
{
|
|
24851
25061
|
value: customCommand,
|
|
@@ -24859,8 +25069,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24859
25069
|
}
|
|
24860
25070
|
)
|
|
24861
25071
|
] }),
|
|
24862
|
-
/* @__PURE__ */
|
|
24863
|
-
|
|
25072
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25073
|
+
SelectInput10,
|
|
24864
25074
|
{
|
|
24865
25075
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
24866
25076
|
onSelect: () => setPage("custom-name")
|
|
@@ -24883,11 +25093,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24883
25093
|
},
|
|
24884
25094
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
24885
25095
|
];
|
|
24886
|
-
return /* @__PURE__ */
|
|
24887
|
-
/* @__PURE__ */
|
|
24888
|
-
/* @__PURE__ */
|
|
24889
|
-
/* @__PURE__ */
|
|
24890
|
-
|
|
25096
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25097
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Save LSP Config" }),
|
|
25098
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Where should this server configuration be saved?" }),
|
|
25099
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25100
|
+
SelectInput10,
|
|
24891
25101
|
{
|
|
24892
25102
|
items,
|
|
24893
25103
|
onSelect: (item) => {
|
|
@@ -24905,11 +25115,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24905
25115
|
if (page === "edit") {
|
|
24906
25116
|
const keys = Object.keys(servers);
|
|
24907
25117
|
if (keys.length === 0) {
|
|
24908
|
-
return /* @__PURE__ */
|
|
24909
|
-
/* @__PURE__ */
|
|
24910
|
-
/* @__PURE__ */
|
|
24911
|
-
/* @__PURE__ */
|
|
24912
|
-
|
|
25118
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25119
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
25120
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: "No servers configured." }),
|
|
25121
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25122
|
+
SelectInput10,
|
|
24913
25123
|
{
|
|
24914
25124
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
24915
25125
|
onSelect: () => setPage("main")
|
|
@@ -24929,11 +25139,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24929
25139
|
}),
|
|
24930
25140
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
24931
25141
|
];
|
|
24932
|
-
return /* @__PURE__ */
|
|
24933
|
-
/* @__PURE__ */
|
|
24934
|
-
/* @__PURE__ */
|
|
24935
|
-
/* @__PURE__ */
|
|
24936
|
-
|
|
25142
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25143
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
25144
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Select a server to toggle enabled/disabled." }),
|
|
25145
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25146
|
+
SelectInput10,
|
|
24937
25147
|
{
|
|
24938
25148
|
items,
|
|
24939
25149
|
onSelect: (item) => {
|
|
@@ -24950,11 +25160,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24950
25160
|
if (page === "delete") {
|
|
24951
25161
|
const keys = Object.keys(servers);
|
|
24952
25162
|
if (keys.length === 0) {
|
|
24953
|
-
return /* @__PURE__ */
|
|
24954
|
-
/* @__PURE__ */
|
|
24955
|
-
/* @__PURE__ */
|
|
24956
|
-
/* @__PURE__ */
|
|
24957
|
-
|
|
25163
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25164
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
25165
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: "No servers configured." }),
|
|
25166
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25167
|
+
SelectInput10,
|
|
24958
25168
|
{
|
|
24959
25169
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
24960
25170
|
onSelect: () => setPage("main")
|
|
@@ -24970,11 +25180,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24970
25180
|
})),
|
|
24971
25181
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
24972
25182
|
];
|
|
24973
|
-
return /* @__PURE__ */
|
|
24974
|
-
/* @__PURE__ */
|
|
24975
|
-
/* @__PURE__ */
|
|
24976
|
-
/* @__PURE__ */
|
|
24977
|
-
|
|
25183
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25184
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
25185
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, dimColor: false, children: "Select a server to remove from config." }),
|
|
25186
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25187
|
+
SelectInput10,
|
|
24978
25188
|
{
|
|
24979
25189
|
items,
|
|
24980
25190
|
onSelect: (item) => {
|
|
@@ -24990,15 +25200,15 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
24990
25200
|
}
|
|
24991
25201
|
if (page === "list") {
|
|
24992
25202
|
const keys = Object.keys(servers);
|
|
24993
|
-
return /* @__PURE__ */
|
|
24994
|
-
/* @__PURE__ */
|
|
24995
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
25203
|
+
return /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25204
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.accent, bold: true, children: "Configured LSP Servers" }),
|
|
25205
|
+
keys.length === 0 ? /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: "No servers configured." }) : /* @__PURE__ */ jsx27(Box25, { marginTop: 1, flexDirection: "column", children: keys.map((k) => {
|
|
24996
25206
|
const s = servers[k];
|
|
24997
25207
|
const status = s.enabled !== false ? "enabled" : "disabled";
|
|
24998
|
-
return /* @__PURE__ */
|
|
25208
|
+
return /* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: ` ${k.padEnd(16)} ${status} ${s.command.join(" ")}` }, k);
|
|
24999
25209
|
}) }),
|
|
25000
|
-
/* @__PURE__ */
|
|
25001
|
-
|
|
25210
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
25211
|
+
SelectInput10,
|
|
25002
25212
|
{
|
|
25003
25213
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
25004
25214
|
onSelect: () => setPage("main")
|
|
@@ -25125,9 +25335,9 @@ var init_lsp_wizard = __esm({
|
|
|
25125
25335
|
});
|
|
25126
25336
|
|
|
25127
25337
|
// src/ui/theme-picker.tsx
|
|
25128
|
-
import { Box as
|
|
25129
|
-
import
|
|
25130
|
-
import { jsx as
|
|
25338
|
+
import { Box as Box26, Text as Text27 } from "ink";
|
|
25339
|
+
import SelectInput11 from "ink-select-input";
|
|
25340
|
+
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
25131
25341
|
function PaletteSwatches({ palette }) {
|
|
25132
25342
|
const colors = [
|
|
25133
25343
|
palette.primary,
|
|
@@ -25135,7 +25345,7 @@ function PaletteSwatches({ palette }) {
|
|
|
25135
25345
|
palette.success,
|
|
25136
25346
|
palette.error
|
|
25137
25347
|
];
|
|
25138
|
-
return /* @__PURE__ */
|
|
25348
|
+
return /* @__PURE__ */ jsx28(Box26, { children: colors.map((c, i) => /* @__PURE__ */ jsx28(Text27, { color: c, children: "\u2588" }, i)) });
|
|
25139
25349
|
}
|
|
25140
25350
|
function ThemePicker({ themes, onPick }) {
|
|
25141
25351
|
const current = useTheme();
|
|
@@ -25143,10 +25353,10 @@ function ThemePicker({ themes, onPick }) {
|
|
|
25143
25353
|
...themes.map((t) => ({ label: t.label, value: t.name })),
|
|
25144
25354
|
{ label: "< Back", value: "__back__" }
|
|
25145
25355
|
];
|
|
25146
|
-
return /* @__PURE__ */
|
|
25147
|
-
/* @__PURE__ */
|
|
25148
|
-
/* @__PURE__ */
|
|
25149
|
-
|
|
25356
|
+
return /* @__PURE__ */ jsxs26(Box26, { flexDirection: "column", borderStyle: "round", borderColor: current.accent, paddingX: 1, children: [
|
|
25357
|
+
/* @__PURE__ */ jsx28(Text27, { color: current.accent, bold: true, children: "Pick a theme (restart to apply)" }),
|
|
25358
|
+
/* @__PURE__ */ jsx28(Box26, { marginTop: 1, children: /* @__PURE__ */ jsx28(
|
|
25359
|
+
SelectInput11,
|
|
25150
25360
|
{
|
|
25151
25361
|
items,
|
|
25152
25362
|
onSelect: (item) => {
|
|
@@ -25160,9 +25370,9 @@ function ThemePicker({ themes, onPick }) {
|
|
|
25160
25370
|
itemComponent: ({ label, isSelected }) => {
|
|
25161
25371
|
const t = themes.find((x) => x.label === label);
|
|
25162
25372
|
const color = t?.accent ?? current.accent;
|
|
25163
|
-
return /* @__PURE__ */
|
|
25164
|
-
/* @__PURE__ */
|
|
25165
|
-
t && /* @__PURE__ */
|
|
25373
|
+
return /* @__PURE__ */ jsxs26(Box26, { children: [
|
|
25374
|
+
/* @__PURE__ */ jsx28(Text27, { color, bold: isSelected, dimColor: !isSelected, children: label }),
|
|
25375
|
+
t && /* @__PURE__ */ jsx28(Box26, { marginLeft: 1, children: /* @__PURE__ */ jsx28(PaletteSwatches, { palette: t.palette }) })
|
|
25166
25376
|
] });
|
|
25167
25377
|
}
|
|
25168
25378
|
}
|
|
@@ -25177,9 +25387,9 @@ var init_theme_picker = __esm({
|
|
|
25177
25387
|
});
|
|
25178
25388
|
|
|
25179
25389
|
// src/ui/ui-picker.tsx
|
|
25180
|
-
import { Box as
|
|
25181
|
-
import
|
|
25182
|
-
import { jsx as
|
|
25390
|
+
import { Box as Box27, Text as Text28 } from "ink";
|
|
25391
|
+
import SelectInput12 from "ink-select-input";
|
|
25392
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
25183
25393
|
function UiPicker({ current, onPick }) {
|
|
25184
25394
|
const theme = useTheme();
|
|
25185
25395
|
const items = [
|
|
@@ -25195,10 +25405,10 @@ function UiPicker({ current, onPick }) {
|
|
|
25195
25405
|
},
|
|
25196
25406
|
{ label: "< Back", value: "__back__", description: "" }
|
|
25197
25407
|
];
|
|
25198
|
-
return /* @__PURE__ */
|
|
25199
|
-
/* @__PURE__ */
|
|
25200
|
-
/* @__PURE__ */
|
|
25201
|
-
|
|
25408
|
+
return /* @__PURE__ */ jsxs27(Box27, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25409
|
+
/* @__PURE__ */ jsx29(Text28, { color: theme.accent, bold: true, children: "Pick UI engine (takes effect on next launch)" }),
|
|
25410
|
+
/* @__PURE__ */ jsx29(Box27, { marginTop: 1, children: /* @__PURE__ */ jsx29(
|
|
25411
|
+
SelectInput12,
|
|
25202
25412
|
{
|
|
25203
25413
|
items,
|
|
25204
25414
|
initialIndex: items.findIndex((i) => i.value === current),
|
|
@@ -25212,9 +25422,9 @@ function UiPicker({ current, onPick }) {
|
|
|
25212
25422
|
itemComponent: ({ label, isSelected }) => {
|
|
25213
25423
|
const item = items.find((i) => i.label === label);
|
|
25214
25424
|
const desc = item?.description ?? "";
|
|
25215
|
-
return /* @__PURE__ */
|
|
25216
|
-
/* @__PURE__ */
|
|
25217
|
-
desc ? /* @__PURE__ */
|
|
25425
|
+
return /* @__PURE__ */ jsxs27(Box27, { children: [
|
|
25426
|
+
/* @__PURE__ */ jsx29(Text28, { bold: isSelected, dimColor: !isSelected, children: label }),
|
|
25427
|
+
desc ? /* @__PURE__ */ jsx29(Text28, { dimColor: true, children: ` \u2014 ${desc}` }) : null
|
|
25218
25428
|
] });
|
|
25219
25429
|
}
|
|
25220
25430
|
}
|
|
@@ -25229,9 +25439,9 @@ var init_ui_picker = __esm({
|
|
|
25229
25439
|
});
|
|
25230
25440
|
|
|
25231
25441
|
// src/ui/mode-picker.tsx
|
|
25232
|
-
import { Box as
|
|
25233
|
-
import
|
|
25234
|
-
import { jsx as
|
|
25442
|
+
import { Box as Box28, Text as Text29 } from "ink";
|
|
25443
|
+
import SelectInput13 from "ink-select-input";
|
|
25444
|
+
import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
25235
25445
|
function ModePicker({ current, onPick, multiAgentEnabled }) {
|
|
25236
25446
|
const theme = useTheme();
|
|
25237
25447
|
const availableModes = multiAgentEnabled ? MODES : MODES.filter((m) => m !== "multi-agent-experimental");
|
|
@@ -25240,11 +25450,11 @@ function ModePicker({ current, onPick, multiAgentEnabled }) {
|
|
|
25240
25450
|
value: m,
|
|
25241
25451
|
key: m
|
|
25242
25452
|
}));
|
|
25243
|
-
return /* @__PURE__ */
|
|
25244
|
-
/* @__PURE__ */
|
|
25245
|
-
/* @__PURE__ */
|
|
25246
|
-
/* @__PURE__ */
|
|
25247
|
-
|
|
25453
|
+
return /* @__PURE__ */ jsxs28(Box28, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25454
|
+
/* @__PURE__ */ jsx30(Text29, { color: theme.accent, bold: true, children: "Select mode" }),
|
|
25455
|
+
/* @__PURE__ */ jsx30(Text29, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
25456
|
+
/* @__PURE__ */ jsx30(Box28, { marginTop: 1, children: /* @__PURE__ */ jsx30(
|
|
25457
|
+
SelectInput13,
|
|
25248
25458
|
{
|
|
25249
25459
|
items,
|
|
25250
25460
|
onSelect: (item) => onPick(item.value)
|
|
@@ -25261,9 +25471,9 @@ var init_mode_picker = __esm({
|
|
|
25261
25471
|
});
|
|
25262
25472
|
|
|
25263
25473
|
// src/ui/shell-picker.tsx
|
|
25264
|
-
import { Box as
|
|
25265
|
-
import
|
|
25266
|
-
import { jsx as
|
|
25474
|
+
import { Box as Box29, Text as Text30 } from "ink";
|
|
25475
|
+
import SelectInput14 from "ink-select-input";
|
|
25476
|
+
import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
25267
25477
|
function ShellPicker({ current, onPick }) {
|
|
25268
25478
|
const theme = useTheme();
|
|
25269
25479
|
const items = SHELLS.map((s) => ({
|
|
@@ -25271,10 +25481,10 @@ function ShellPicker({ current, onPick }) {
|
|
|
25271
25481
|
value: s.value,
|
|
25272
25482
|
key: s.value
|
|
25273
25483
|
}));
|
|
25274
|
-
return /* @__PURE__ */
|
|
25275
|
-
/* @__PURE__ */
|
|
25276
|
-
/* @__PURE__ */
|
|
25277
|
-
/* @__PURE__ */
|
|
25484
|
+
return /* @__PURE__ */ jsxs29(Box29, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25485
|
+
/* @__PURE__ */ jsx31(Text30, { color: theme.accent, bold: true, children: "Select shell" }),
|
|
25486
|
+
/* @__PURE__ */ jsx31(Text30, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
25487
|
+
/* @__PURE__ */ jsx31(Box29, { marginTop: 1, children: /* @__PURE__ */ jsx31(SelectInput14, { items, onSelect: (item) => onPick(item.value) }) })
|
|
25278
25488
|
] });
|
|
25279
25489
|
}
|
|
25280
25490
|
var SHELLS;
|
|
@@ -25292,18 +25502,18 @@ var init_shell_picker = __esm({
|
|
|
25292
25502
|
});
|
|
25293
25503
|
|
|
25294
25504
|
// src/ui/memory-picker.tsx
|
|
25295
|
-
import { useState as
|
|
25296
|
-
import { Box as
|
|
25297
|
-
import
|
|
25298
|
-
import { jsx as
|
|
25505
|
+
import { useState as useState19, useCallback as useCallback5 } from "react";
|
|
25506
|
+
import { Box as Box30, Text as Text31, useInput as useInput13 } from "ink";
|
|
25507
|
+
import SelectInput15 from "ink-select-input";
|
|
25508
|
+
import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
25299
25509
|
function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
|
|
25300
25510
|
const theme = useTheme();
|
|
25301
|
-
const [screen, setScreen] =
|
|
25302
|
-
const [query, setQuery] =
|
|
25303
|
-
const [results, setResults] =
|
|
25304
|
-
const [searching, setSearching] =
|
|
25305
|
-
const [searched, setSearched] =
|
|
25306
|
-
|
|
25511
|
+
const [screen, setScreen] = useState19("menu");
|
|
25512
|
+
const [query, setQuery] = useState19("");
|
|
25513
|
+
const [results, setResults] = useState19([]);
|
|
25514
|
+
const [searching, setSearching] = useState19(false);
|
|
25515
|
+
const [searched, setSearched] = useState19(false);
|
|
25516
|
+
useInput13((_, key) => {
|
|
25307
25517
|
if (key.escape) {
|
|
25308
25518
|
if (screen === "search" || screen === "confirm-clear") {
|
|
25309
25519
|
setScreen("menu");
|
|
@@ -25332,11 +25542,11 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
|
|
|
25332
25542
|
[memoryManager]
|
|
25333
25543
|
);
|
|
25334
25544
|
if (screen === "confirm-clear") {
|
|
25335
|
-
return /* @__PURE__ */
|
|
25336
|
-
/* @__PURE__ */
|
|
25337
|
-
/* @__PURE__ */
|
|
25338
|
-
/* @__PURE__ */
|
|
25339
|
-
|
|
25545
|
+
return /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25546
|
+
/* @__PURE__ */ jsx32(Text31, { color: theme.accent, bold: true, children: "\u26A0\uFE0F Clear All Memories" }),
|
|
25547
|
+
/* @__PURE__ */ jsx32(Text31, { color: theme.info.color, children: "This will permanently delete every stored memory. This cannot be undone." }),
|
|
25548
|
+
/* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(
|
|
25549
|
+
SelectInput15,
|
|
25340
25550
|
{
|
|
25341
25551
|
items: [
|
|
25342
25552
|
{ label: "Yes, clear everything", value: "yes", key: "yes" },
|
|
@@ -25353,10 +25563,10 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
|
|
|
25353
25563
|
] });
|
|
25354
25564
|
}
|
|
25355
25565
|
if (screen === "search") {
|
|
25356
|
-
return /* @__PURE__ */
|
|
25357
|
-
/* @__PURE__ */
|
|
25358
|
-
/* @__PURE__ */
|
|
25359
|
-
/* @__PURE__ */
|
|
25566
|
+
return /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25567
|
+
/* @__PURE__ */ jsx32(Text31, { color: theme.accent, bold: true, children: "Search Memories" }),
|
|
25568
|
+
/* @__PURE__ */ jsx32(Text31, { color: theme.info.color, dimColor: false, children: "Type a query and press Enter. Esc to go back." }),
|
|
25569
|
+
/* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(
|
|
25360
25570
|
CustomTextInput,
|
|
25361
25571
|
{
|
|
25362
25572
|
value: query,
|
|
@@ -25365,16 +25575,16 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
|
|
|
25365
25575
|
focus: true
|
|
25366
25576
|
}
|
|
25367
25577
|
) }),
|
|
25368
|
-
searching && /* @__PURE__ */
|
|
25369
|
-
searched && !searching && results.length === 0 && /* @__PURE__ */
|
|
25370
|
-
results.length > 0 && /* @__PURE__ */
|
|
25371
|
-
/* @__PURE__ */
|
|
25578
|
+
searching && /* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(Text31, { color: theme.info.color, children: "Searching\u2026" }) }),
|
|
25579
|
+
searched && !searching && results.length === 0 && /* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(Text31, { color: theme.info.color, children: "No memories found." }) }),
|
|
25580
|
+
results.length > 0 && /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", marginTop: 1, children: [
|
|
25581
|
+
/* @__PURE__ */ jsxs30(Text31, { color: theme.accent, bold: true, children: [
|
|
25372
25582
|
"Results (",
|
|
25373
25583
|
results.length,
|
|
25374
25584
|
")"
|
|
25375
25585
|
] }),
|
|
25376
|
-
results.map((r, i) => /* @__PURE__ */
|
|
25377
|
-
/* @__PURE__ */
|
|
25586
|
+
results.map((r, i) => /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", marginTop: 1, children: [
|
|
25587
|
+
/* @__PURE__ */ jsxs30(Text31, { color: theme.info.color, dimColor: false, children: [
|
|
25378
25588
|
"#",
|
|
25379
25589
|
i + 1,
|
|
25380
25590
|
" \xB7 ",
|
|
@@ -25382,8 +25592,8 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
|
|
|
25382
25592
|
" \xB7 importance ",
|
|
25383
25593
|
r.memory.importance
|
|
25384
25594
|
] }),
|
|
25385
|
-
/* @__PURE__ */
|
|
25386
|
-
/* @__PURE__ */
|
|
25595
|
+
/* @__PURE__ */ jsx32(Text31, { children: r.memory.content.length > 120 ? r.memory.content.slice(0, 120) + "\u2026" : r.memory.content }),
|
|
25596
|
+
/* @__PURE__ */ jsxs30(Text31, { color: theme.info.color, dimColor: false, children: [
|
|
25387
25597
|
"score: ",
|
|
25388
25598
|
r.combinedScore.toFixed(3),
|
|
25389
25599
|
" \xB7 ",
|
|
@@ -25400,11 +25610,11 @@ function MemoryPicker({ enabled, memoryManager, onAction, onDone }) {
|
|
|
25400
25610
|
{ label: " Search memories\u2026", value: "search", key: "search" },
|
|
25401
25611
|
{ label: " (close)", value: "__close__", key: "close" }
|
|
25402
25612
|
];
|
|
25403
|
-
return /* @__PURE__ */
|
|
25404
|
-
/* @__PURE__ */
|
|
25405
|
-
/* @__PURE__ */
|
|
25406
|
-
/* @__PURE__ */
|
|
25407
|
-
|
|
25613
|
+
return /* @__PURE__ */ jsxs30(Box30, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25614
|
+
/* @__PURE__ */ jsx32(Text31, { color: theme.accent, bold: true, children: "Memory" }),
|
|
25615
|
+
/* @__PURE__ */ jsx32(Text31, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
|
|
25616
|
+
/* @__PURE__ */ jsx32(Box30, { marginTop: 1, children: /* @__PURE__ */ jsx32(
|
|
25617
|
+
SelectInput15,
|
|
25408
25618
|
{
|
|
25409
25619
|
items,
|
|
25410
25620
|
onSelect: (item) => {
|
|
@@ -25435,9 +25645,9 @@ var init_memory_picker = __esm({
|
|
|
25435
25645
|
});
|
|
25436
25646
|
|
|
25437
25647
|
// src/ui/gateway-picker.tsx
|
|
25438
|
-
import { Box as
|
|
25439
|
-
import
|
|
25440
|
-
import { jsx as
|
|
25648
|
+
import { Box as Box31, Text as Text32 } from "ink";
|
|
25649
|
+
import SelectInput16 from "ink-select-input";
|
|
25650
|
+
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
25441
25651
|
function GatewayPicker({ gatewayId, skipCache, collectLogs, metadataCount, onAction, onDone }) {
|
|
25442
25652
|
const theme = useTheme();
|
|
25443
25653
|
const items = [
|
|
@@ -25477,11 +25687,11 @@ function GatewayPicker({ gatewayId, skipCache, collectLogs, metadataCount, onAct
|
|
|
25477
25687
|
}
|
|
25478
25688
|
items.push({ label: " (close)", value: "__close__", key: "close" });
|
|
25479
25689
|
const selectable = items.filter((i) => !i.value.startsWith("__label_"));
|
|
25480
|
-
return /* @__PURE__ */
|
|
25481
|
-
/* @__PURE__ */
|
|
25482
|
-
/* @__PURE__ */
|
|
25483
|
-
/* @__PURE__ */
|
|
25484
|
-
|
|
25690
|
+
return /* @__PURE__ */ jsxs31(Box31, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25691
|
+
/* @__PURE__ */ jsx33(Text32, { color: theme.accent, bold: true, children: "AI Gateway" }),
|
|
25692
|
+
/* @__PURE__ */ jsx33(Text32, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
|
|
25693
|
+
/* @__PURE__ */ jsx33(Box31, { marginTop: 1, children: /* @__PURE__ */ jsx33(
|
|
25694
|
+
SelectInput16,
|
|
25485
25695
|
{
|
|
25486
25696
|
items: selectable,
|
|
25487
25697
|
onSelect: (item) => {
|
|
@@ -25503,9 +25713,9 @@ var init_gateway_picker = __esm({
|
|
|
25503
25713
|
});
|
|
25504
25714
|
|
|
25505
25715
|
// src/ui/skills-picker.tsx
|
|
25506
|
-
import { Box as
|
|
25507
|
-
import
|
|
25508
|
-
import { jsx as
|
|
25716
|
+
import { Box as Box32, Text as Text33 } from "ink";
|
|
25717
|
+
import SelectInput17 from "ink-select-input";
|
|
25718
|
+
import { jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
25509
25719
|
function SkillsPicker({ onAction, onDone }) {
|
|
25510
25720
|
const theme = useTheme();
|
|
25511
25721
|
const items = [
|
|
@@ -25517,11 +25727,11 @@ function SkillsPicker({ onAction, onDone }) {
|
|
|
25517
25727
|
{ label: " Disable skill\u2026", value: "disable", key: "disable" },
|
|
25518
25728
|
{ label: " (close)", value: "__close__", key: "close" }
|
|
25519
25729
|
];
|
|
25520
|
-
return /* @__PURE__ */
|
|
25521
|
-
/* @__PURE__ */
|
|
25522
|
-
/* @__PURE__ */
|
|
25523
|
-
/* @__PURE__ */
|
|
25524
|
-
|
|
25730
|
+
return /* @__PURE__ */ jsxs32(Box32, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
25731
|
+
/* @__PURE__ */ jsx34(Text33, { color: theme.accent, bold: true, children: "Skills" }),
|
|
25732
|
+
/* @__PURE__ */ jsx34(Text33, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
|
|
25733
|
+
/* @__PURE__ */ jsx34(Box32, { marginTop: 1, children: /* @__PURE__ */ jsx34(
|
|
25734
|
+
SelectInput17,
|
|
25525
25735
|
{
|
|
25526
25736
|
items,
|
|
25527
25737
|
onSelect: (item) => {
|
|
@@ -25543,16 +25753,16 @@ var init_skills_picker = __esm({
|
|
|
25543
25753
|
});
|
|
25544
25754
|
|
|
25545
25755
|
// src/ui/remote-dashboard.tsx
|
|
25546
|
-
import { useEffect as useEffect10, useState as
|
|
25547
|
-
import { Box as
|
|
25548
|
-
import
|
|
25549
|
-
import { jsx as
|
|
25756
|
+
import { useEffect as useEffect10, useState as useState20 } from "react";
|
|
25757
|
+
import { Box as Box33, Text as Text34, useInput as useInput14 } from "ink";
|
|
25758
|
+
import SelectInput18 from "ink-select-input";
|
|
25759
|
+
import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
25550
25760
|
function RemoteDashboard({ onSelect, onCancel }) {
|
|
25551
25761
|
const theme = useTheme();
|
|
25552
|
-
const [sessions, setSessions] =
|
|
25553
|
-
const [loading, setLoading] =
|
|
25554
|
-
const [error, setError] =
|
|
25555
|
-
const [refreshing, setRefreshing] =
|
|
25762
|
+
const [sessions, setSessions] = useState20([]);
|
|
25763
|
+
const [loading, setLoading] = useState20(true);
|
|
25764
|
+
const [error, setError] = useState20(null);
|
|
25765
|
+
const [refreshing, setRefreshing] = useState20(false);
|
|
25556
25766
|
useEffect10(() => {
|
|
25557
25767
|
loadSessions();
|
|
25558
25768
|
}, []);
|
|
@@ -25589,7 +25799,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
25589
25799
|
setRefreshing(false);
|
|
25590
25800
|
}
|
|
25591
25801
|
}
|
|
25592
|
-
|
|
25802
|
+
useInput14((input, key) => {
|
|
25593
25803
|
if (input === "r" || input === "R") {
|
|
25594
25804
|
void loadSessions();
|
|
25595
25805
|
}
|
|
@@ -25602,31 +25812,31 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
25602
25812
|
value: s.sessionId
|
|
25603
25813
|
}));
|
|
25604
25814
|
if (loading) {
|
|
25605
|
-
return /* @__PURE__ */
|
|
25815
|
+
return /* @__PURE__ */ jsx35(Box33, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ jsx35(Text34, { color: theme.accent, children: "Loading remote sessions..." }) });
|
|
25606
25816
|
}
|
|
25607
25817
|
if (error) {
|
|
25608
|
-
return /* @__PURE__ */
|
|
25609
|
-
/* @__PURE__ */
|
|
25818
|
+
return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", padding: 1, children: [
|
|
25819
|
+
/* @__PURE__ */ jsxs33(Text34, { color: theme.error, children: [
|
|
25610
25820
|
"Error: ",
|
|
25611
25821
|
error
|
|
25612
25822
|
] }),
|
|
25613
|
-
/* @__PURE__ */
|
|
25823
|
+
/* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Press R to retry, Esc to close" })
|
|
25614
25824
|
] });
|
|
25615
25825
|
}
|
|
25616
25826
|
if (sessions.length === 0) {
|
|
25617
|
-
return /* @__PURE__ */
|
|
25618
|
-
/* @__PURE__ */
|
|
25619
|
-
/* @__PURE__ */
|
|
25620
|
-
/* @__PURE__ */
|
|
25827
|
+
return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", padding: 1, children: [
|
|
25828
|
+
/* @__PURE__ */ jsx35(Text34, { color: theme.accent, children: "No remote sessions yet." }),
|
|
25829
|
+
/* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Type /remote <prompt> to start one." }),
|
|
25830
|
+
/* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Press Esc to close" })
|
|
25621
25831
|
] });
|
|
25622
25832
|
}
|
|
25623
|
-
return /* @__PURE__ */
|
|
25624
|
-
/* @__PURE__ */
|
|
25833
|
+
return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", padding: 1, children: [
|
|
25834
|
+
/* @__PURE__ */ jsxs33(Text34, { bold: true, color: theme.accent, children: [
|
|
25625
25835
|
"Recent remote tasks ",
|
|
25626
25836
|
refreshing ? "(refreshing...)" : ""
|
|
25627
25837
|
] }),
|
|
25628
|
-
/* @__PURE__ */
|
|
25629
|
-
|
|
25838
|
+
/* @__PURE__ */ jsx35(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx35(
|
|
25839
|
+
SelectInput18,
|
|
25630
25840
|
{
|
|
25631
25841
|
items,
|
|
25632
25842
|
onSelect: (item) => {
|
|
@@ -25635,7 +25845,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
25635
25845
|
}
|
|
25636
25846
|
}
|
|
25637
25847
|
) }),
|
|
25638
|
-
/* @__PURE__ */
|
|
25848
|
+
/* @__PURE__ */ jsx35(Box33, { marginTop: 1, children: /* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter select \u2022 R refresh \u2022 Esc close" }) })
|
|
25639
25849
|
] });
|
|
25640
25850
|
}
|
|
25641
25851
|
function formatSessionLine(s) {
|
|
@@ -25667,8 +25877,8 @@ function RemoteSessionDetail({
|
|
|
25667
25877
|
onCancel
|
|
25668
25878
|
}) {
|
|
25669
25879
|
const theme = useTheme();
|
|
25670
|
-
const [cancelling, setCancelling] =
|
|
25671
|
-
|
|
25880
|
+
const [cancelling, setCancelling] = useState20(false);
|
|
25881
|
+
useInput14((input, key) => {
|
|
25672
25882
|
if (key.escape) {
|
|
25673
25883
|
onBack();
|
|
25674
25884
|
}
|
|
@@ -25688,50 +25898,50 @@ function RemoteSessionDetail({
|
|
|
25688
25898
|
}
|
|
25689
25899
|
}
|
|
25690
25900
|
const isRunning = session.status === "running" || session.status === "pending";
|
|
25691
|
-
return /* @__PURE__ */
|
|
25692
|
-
/* @__PURE__ */
|
|
25693
|
-
/* @__PURE__ */
|
|
25694
|
-
/* @__PURE__ */
|
|
25901
|
+
return /* @__PURE__ */ jsxs33(Box33, { flexDirection: "column", padding: 1, children: [
|
|
25902
|
+
/* @__PURE__ */ jsx35(Text34, { bold: true, color: theme.accent, children: "Remote Session" }),
|
|
25903
|
+
/* @__PURE__ */ jsxs33(Box33, { marginTop: 1, flexDirection: "column", children: [
|
|
25904
|
+
/* @__PURE__ */ jsxs33(Text34, { children: [
|
|
25695
25905
|
"ID: ",
|
|
25696
25906
|
session.sessionId
|
|
25697
25907
|
] }),
|
|
25698
|
-
/* @__PURE__ */
|
|
25908
|
+
/* @__PURE__ */ jsxs33(Text34, { children: [
|
|
25699
25909
|
"Repo: ",
|
|
25700
25910
|
session.repo
|
|
25701
25911
|
] }),
|
|
25702
|
-
/* @__PURE__ */
|
|
25912
|
+
/* @__PURE__ */ jsxs33(Text34, { children: [
|
|
25703
25913
|
"Status: ",
|
|
25704
25914
|
session.status
|
|
25705
25915
|
] }),
|
|
25706
|
-
/* @__PURE__ */
|
|
25916
|
+
/* @__PURE__ */ jsxs33(Text34, { children: [
|
|
25707
25917
|
"Prompt: ",
|
|
25708
25918
|
session.prompt
|
|
25709
25919
|
] }),
|
|
25710
|
-
session.prUrl && /* @__PURE__ */
|
|
25920
|
+
session.prUrl && /* @__PURE__ */ jsxs33(Text34, { children: [
|
|
25711
25921
|
"PR: ",
|
|
25712
25922
|
session.prUrl
|
|
25713
25923
|
] }),
|
|
25714
|
-
session.errorMessage && /* @__PURE__ */
|
|
25924
|
+
session.errorMessage && /* @__PURE__ */ jsxs33(Text34, { color: theme.error, children: [
|
|
25715
25925
|
"Error: ",
|
|
25716
25926
|
session.errorMessage
|
|
25717
25927
|
] }),
|
|
25718
|
-
session.tokensUsed !== void 0 && /* @__PURE__ */
|
|
25928
|
+
session.tokensUsed !== void 0 && /* @__PURE__ */ jsxs33(Text34, { children: [
|
|
25719
25929
|
"Tokens: ",
|
|
25720
25930
|
formatTokens2(session.tokensUsed),
|
|
25721
25931
|
session.tokensBudget ? ` / ${formatTokens2(session.tokensBudget)}` : ""
|
|
25722
25932
|
] }),
|
|
25723
|
-
/* @__PURE__ */
|
|
25933
|
+
/* @__PURE__ */ jsxs33(Text34, { children: [
|
|
25724
25934
|
"Created: ",
|
|
25725
25935
|
new Date(session.createdAt).toLocaleString()
|
|
25726
25936
|
] }),
|
|
25727
|
-
session.finishedAt && /* @__PURE__ */
|
|
25937
|
+
session.finishedAt && /* @__PURE__ */ jsxs33(Text34, { children: [
|
|
25728
25938
|
"Finished: ",
|
|
25729
25939
|
new Date(session.finishedAt).toLocaleString()
|
|
25730
25940
|
] })
|
|
25731
25941
|
] }),
|
|
25732
|
-
/* @__PURE__ */
|
|
25733
|
-
isRunning && onCancel && /* @__PURE__ */
|
|
25734
|
-
/* @__PURE__ */
|
|
25942
|
+
/* @__PURE__ */ jsxs33(Box33, { marginTop: 1, flexDirection: "row", gap: 2, children: [
|
|
25943
|
+
isRunning && onCancel && /* @__PURE__ */ jsx35(Text34, { color: theme.error, children: cancelling ? "Cancelling..." : "[C] Cancel session" }),
|
|
25944
|
+
/* @__PURE__ */ jsx35(Text34, { dimColor: true, children: "Esc back" })
|
|
25735
25945
|
] })
|
|
25736
25946
|
] });
|
|
25737
25947
|
}
|
|
@@ -25745,17 +25955,17 @@ var init_remote_dashboard = __esm({
|
|
|
25745
25955
|
});
|
|
25746
25956
|
|
|
25747
25957
|
// src/ui/inbox-modal.tsx
|
|
25748
|
-
import { useState as
|
|
25749
|
-
import { Box as
|
|
25750
|
-
import { Fragment as Fragment3, jsx as
|
|
25958
|
+
import { useState as useState21, useCallback as useCallback6 } from "react";
|
|
25959
|
+
import { Box as Box34, Text as Text35, useInput as useInput15 } from "ink";
|
|
25960
|
+
import { Fragment as Fragment3, jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
25751
25961
|
function InboxModal({ onDone, onOpen }) {
|
|
25752
25962
|
const theme = useTheme();
|
|
25753
|
-
const [step, setStep] =
|
|
25754
|
-
const [twitter, setTwitter] =
|
|
25755
|
-
const [secret, setSecret] =
|
|
25756
|
-
const [messages, setMessages] =
|
|
25757
|
-
const [selectedIndex, setSelectedIndex] =
|
|
25758
|
-
const [error, setError] =
|
|
25963
|
+
const [step, setStep] = useState21("twitter");
|
|
25964
|
+
const [twitter, setTwitter] = useState21("");
|
|
25965
|
+
const [secret, setSecret] = useState21("");
|
|
25966
|
+
const [messages, setMessages] = useState21([]);
|
|
25967
|
+
const [selectedIndex, setSelectedIndex] = useState21(0);
|
|
25968
|
+
const [error, setError] = useState21(null);
|
|
25759
25969
|
const checkInbox = useCallback6(
|
|
25760
25970
|
async (u, s) => {
|
|
25761
25971
|
setStep("checking");
|
|
@@ -25812,7 +26022,7 @@ function InboxModal({ onDone, onOpen }) {
|
|
|
25812
26022
|
onOpen(url);
|
|
25813
26023
|
onDone();
|
|
25814
26024
|
}, [messages, selectedIndex, twitter, secret, onOpen, onDone]);
|
|
25815
|
-
|
|
26025
|
+
useInput15(
|
|
25816
26026
|
(_input, key) => {
|
|
25817
26027
|
if (key.escape) {
|
|
25818
26028
|
onDone();
|
|
@@ -25834,11 +26044,11 @@ function InboxModal({ onDone, onOpen }) {
|
|
|
25834
26044
|
},
|
|
25835
26045
|
{ isActive: step === "result" }
|
|
25836
26046
|
);
|
|
25837
|
-
return /* @__PURE__ */
|
|
25838
|
-
/* @__PURE__ */
|
|
25839
|
-
step === "twitter" && /* @__PURE__ */
|
|
25840
|
-
/* @__PURE__ */
|
|
25841
|
-
/* @__PURE__ */
|
|
26047
|
+
return /* @__PURE__ */ jsxs34(Box34, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
26048
|
+
/* @__PURE__ */ jsx36(Text35, { color: theme.accent, bold: true, children: "/inbox" }),
|
|
26049
|
+
step === "twitter" && /* @__PURE__ */ jsxs34(Fragment3, { children: [
|
|
26050
|
+
/* @__PURE__ */ jsx36(Text35, { color: theme.palette.foreground, children: "Enter your Twitter username (or press Enter to cancel):" }),
|
|
26051
|
+
/* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(
|
|
25842
26052
|
CustomTextInput,
|
|
25843
26053
|
{
|
|
25844
26054
|
value: twitter,
|
|
@@ -25848,9 +26058,9 @@ function InboxModal({ onDone, onOpen }) {
|
|
|
25848
26058
|
}
|
|
25849
26059
|
) })
|
|
25850
26060
|
] }),
|
|
25851
|
-
step === "secret" && /* @__PURE__ */
|
|
25852
|
-
/* @__PURE__ */
|
|
25853
|
-
/* @__PURE__ */
|
|
26061
|
+
step === "secret" && /* @__PURE__ */ jsxs34(Fragment3, { children: [
|
|
26062
|
+
/* @__PURE__ */ jsx36(Text35, { color: theme.palette.foreground, children: "Enter your secret (or press Enter to cancel):" }),
|
|
26063
|
+
/* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(
|
|
25854
26064
|
CustomTextInput,
|
|
25855
26065
|
{
|
|
25856
26066
|
value: secret,
|
|
@@ -25861,13 +26071,13 @@ function InboxModal({ onDone, onOpen }) {
|
|
|
25861
26071
|
}
|
|
25862
26072
|
) })
|
|
25863
26073
|
] }),
|
|
25864
|
-
step === "checking" && /* @__PURE__ */
|
|
25865
|
-
step === "result" && /* @__PURE__ */
|
|
25866
|
-
error ? /* @__PURE__ */
|
|
26074
|
+
step === "checking" && /* @__PURE__ */ jsx36(Text35, { color: theme.info.color, children: "Checking your inbox\u2026" }),
|
|
26075
|
+
step === "result" && /* @__PURE__ */ jsxs34(Fragment3, { children: [
|
|
26076
|
+
error ? /* @__PURE__ */ jsxs34(Text35, { color: theme.error, children: [
|
|
25867
26077
|
"Error: ",
|
|
25868
26078
|
error
|
|
25869
|
-
] }) : messages.length > 0 ? /* @__PURE__ */
|
|
25870
|
-
/* @__PURE__ */
|
|
26079
|
+
] }) : messages.length > 0 ? /* @__PURE__ */ jsxs34(Fragment3, { children: [
|
|
26080
|
+
/* @__PURE__ */ jsxs34(Text35, { color: theme.palette.foreground, children: [
|
|
25871
26081
|
"You have ",
|
|
25872
26082
|
messages.length,
|
|
25873
26083
|
" message",
|
|
@@ -25875,12 +26085,12 @@ function InboxModal({ onDone, onOpen }) {
|
|
|
25875
26085
|
messages.some((m) => !m.seen) ? " (\u{1F534} new)" : "",
|
|
25876
26086
|
":"
|
|
25877
26087
|
] }),
|
|
25878
|
-
/* @__PURE__ */
|
|
26088
|
+
/* @__PURE__ */ jsx36(Box34, { flexDirection: "column", marginTop: 1, children: messages.map((msg, idx) => {
|
|
25879
26089
|
const isSelected = idx === selectedIndex;
|
|
25880
26090
|
const dateStr = new Date(msg.createdAt).toLocaleString();
|
|
25881
26091
|
const marker = msg.seen ? " " : "\u{1F534} ";
|
|
25882
|
-
return /* @__PURE__ */
|
|
25883
|
-
|
|
26092
|
+
return /* @__PURE__ */ jsxs34(
|
|
26093
|
+
Text35,
|
|
25884
26094
|
{
|
|
25885
26095
|
color: isSelected ? theme.accent : theme.palette.foreground,
|
|
25886
26096
|
bold: isSelected,
|
|
@@ -25895,15 +26105,15 @@ function InboxModal({ onDone, onOpen }) {
|
|
|
25895
26105
|
msg.id
|
|
25896
26106
|
);
|
|
25897
26107
|
}) }),
|
|
25898
|
-
/* @__PURE__ */
|
|
25899
|
-
] }) : /* @__PURE__ */
|
|
26108
|
+
/* @__PURE__ */ jsx36(Box34, { marginTop: 1, children: /* @__PURE__ */ jsx36(Text35, { color: theme.info.color, children: "\u2191\u2193 to select \xB7 Enter to open in browser" }) })
|
|
26109
|
+
] }) : /* @__PURE__ */ jsxs34(Text35, { color: theme.muted?.color ?? theme.palette.secondary, children: [
|
|
25900
26110
|
"No messages yet for @",
|
|
25901
26111
|
twitter,
|
|
25902
26112
|
" / ",
|
|
25903
26113
|
secret.replace(/./g, "*"),
|
|
25904
26114
|
"."
|
|
25905
26115
|
] }),
|
|
25906
|
-
/* @__PURE__ */
|
|
26116
|
+
/* @__PURE__ */ jsx36(Text35, { dimColor: true, children: "Press Esc to close." })
|
|
25907
26117
|
] })
|
|
25908
26118
|
] });
|
|
25909
26119
|
}
|
|
@@ -26160,17 +26370,17 @@ var init_app_helpers = __esm({
|
|
|
26160
26370
|
});
|
|
26161
26371
|
|
|
26162
26372
|
// src/ui/multi-agent-modal.tsx
|
|
26163
|
-
import { useState as
|
|
26164
|
-
import { Box as
|
|
26165
|
-
import { Fragment as Fragment4, jsx as
|
|
26373
|
+
import { useState as useState22, useCallback as useCallback7 } from "react";
|
|
26374
|
+
import { Box as Box35, Text as Text36, useInput as useInput16 } from "ink";
|
|
26375
|
+
import { Fragment as Fragment4, jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
26166
26376
|
function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthSecret }) {
|
|
26167
26377
|
const theme = useTheme();
|
|
26168
|
-
const [state, setState] =
|
|
26169
|
-
const [cursor, setCursor] =
|
|
26170
|
-
const [editing, setEditing] =
|
|
26171
|
-
const [editValue, setEditValue] =
|
|
26172
|
-
const [deployLog, setDeployLog] =
|
|
26173
|
-
const [deploying, setDeploying] =
|
|
26378
|
+
const [state, setState] = useState22(initial);
|
|
26379
|
+
const [cursor, setCursor] = useState22(0);
|
|
26380
|
+
const [editing, setEditing] = useState22(null);
|
|
26381
|
+
const [editValue, setEditValue] = useState22("");
|
|
26382
|
+
const [deployLog, setDeployLog] = useState22([]);
|
|
26383
|
+
const [deploying, setDeploying] = useState22(false);
|
|
26174
26384
|
const isBool = (f) => f === "enabled" || f === "autoExecute";
|
|
26175
26385
|
const currentBool = (f) => f === "enabled" ? !!state.multiAgentEnabled : !!state.autoExecute;
|
|
26176
26386
|
const currentStr = (f) => {
|
|
@@ -26195,8 +26405,8 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
|
|
|
26195
26405
|
"deploy",
|
|
26196
26406
|
...hasEndpoint ? ["teardown"] : []
|
|
26197
26407
|
];
|
|
26198
|
-
const [pickerCandidates, setPickerCandidates] =
|
|
26199
|
-
const [pickerCursor, setPickerCursor] =
|
|
26408
|
+
const [pickerCandidates, setPickerCandidates] = useState22(null);
|
|
26409
|
+
const [pickerCursor, setPickerCursor] = useState22(0);
|
|
26200
26410
|
const startDeployWithName = useCallback7(async (workerName) => {
|
|
26201
26411
|
setDeploying(true);
|
|
26202
26412
|
setDeployLog([`Starting deploy${workerName ? ` to ${workerName}` : ""}\u2026`]);
|
|
@@ -26230,7 +26440,7 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
|
|
|
26230
26440
|
}
|
|
26231
26441
|
await startDeployWithName();
|
|
26232
26442
|
}, [startDeployWithName]);
|
|
26233
|
-
const [teardownConfirming, setTeardownConfirming] =
|
|
26443
|
+
const [teardownConfirming, setTeardownConfirming] = useState22(false);
|
|
26234
26444
|
const runTeardown = useCallback7(async () => {
|
|
26235
26445
|
setDeploying(true);
|
|
26236
26446
|
setDeployLog(["Starting tear-down\u2026"]);
|
|
@@ -26280,7 +26490,7 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
|
|
|
26280
26490
|
setEditing(null);
|
|
26281
26491
|
setEditValue("");
|
|
26282
26492
|
}, [editing, persist]);
|
|
26283
|
-
|
|
26493
|
+
useInput16(
|
|
26284
26494
|
(input, key) => {
|
|
26285
26495
|
if (deploying) return;
|
|
26286
26496
|
if (pickerCandidates) {
|
|
@@ -26381,12 +26591,12 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
|
|
|
26381
26591
|
if (!v) return "(not set)";
|
|
26382
26592
|
return v;
|
|
26383
26593
|
};
|
|
26384
|
-
return /* @__PURE__ */
|
|
26385
|
-
/* @__PURE__ */
|
|
26386
|
-
pickerCandidates ? /* @__PURE__ */
|
|
26387
|
-
/* @__PURE__ */
|
|
26388
|
-
/* @__PURE__ */
|
|
26389
|
-
/* @__PURE__ */
|
|
26594
|
+
return /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
26595
|
+
/* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: "/multi-agent \xB7 settings" }),
|
|
26596
|
+
pickerCandidates ? /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, children: [
|
|
26597
|
+
/* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: "Existing Workers found on your account" }),
|
|
26598
|
+
/* @__PURE__ */ jsx37(Text36, { dimColor: true, children: "Pick one to deploy to, or create a new isolated Worker:" }),
|
|
26599
|
+
/* @__PURE__ */ jsx37(Box35, { flexDirection: "column", marginTop: 1, children: [
|
|
26390
26600
|
...pickerCandidates.map((n, idx) => ({
|
|
26391
26601
|
key: n,
|
|
26392
26602
|
idx,
|
|
@@ -26399,23 +26609,23 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
|
|
|
26399
26609
|
}
|
|
26400
26610
|
].map(({ key, idx, label }) => {
|
|
26401
26611
|
const selected = idx === pickerCursor;
|
|
26402
|
-
return /* @__PURE__ */
|
|
26612
|
+
return /* @__PURE__ */ jsxs35(Text36, { color: selected ? theme.accent : theme.palette.foreground, bold: selected, children: [
|
|
26403
26613
|
selected ? "\u203A " : " ",
|
|
26404
26614
|
label
|
|
26405
26615
|
] }, key);
|
|
26406
26616
|
}) }),
|
|
26407
|
-
/* @__PURE__ */
|
|
26408
|
-
] }) : teardownConfirming ? /* @__PURE__ */
|
|
26409
|
-
/* @__PURE__ */
|
|
26410
|
-
/* @__PURE__ */
|
|
26411
|
-
/* @__PURE__ */
|
|
26412
|
-
] }) : editing ? /* @__PURE__ */
|
|
26413
|
-
/* @__PURE__ */
|
|
26617
|
+
/* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: "\u2191\u2193 to pick \xB7 Enter to deploy \xB7 Esc to cancel" }) })
|
|
26618
|
+
] }) : teardownConfirming ? /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, children: [
|
|
26619
|
+
/* @__PURE__ */ jsx37(Text36, { color: theme.palette.error, bold: true, children: "Tear down multi-agent?" }),
|
|
26620
|
+
/* @__PURE__ */ jsx37(Text36, { color: theme.palette.foreground, children: "This deletes the Worker and OAUTH_KV namespace from your Cloudflare account, and clears your local config." }),
|
|
26621
|
+
/* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: "y to confirm \xB7 n or Esc to cancel" }) })
|
|
26622
|
+
] }) : editing ? /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, children: [
|
|
26623
|
+
/* @__PURE__ */ jsxs35(Text36, { color: theme.palette.foreground, children: [
|
|
26414
26624
|
LABELS[editing],
|
|
26415
26625
|
":"
|
|
26416
26626
|
] }),
|
|
26417
|
-
PLACEHOLDERS[editing] ? /* @__PURE__ */
|
|
26418
|
-
/* @__PURE__ */
|
|
26627
|
+
PLACEHOLDERS[editing] ? /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: `example: ${PLACEHOLDERS[editing]}` }) : null,
|
|
26628
|
+
/* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(
|
|
26419
26629
|
CustomTextInput,
|
|
26420
26630
|
{
|
|
26421
26631
|
value: editValue,
|
|
@@ -26425,11 +26635,11 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
|
|
|
26425
26635
|
focus: true
|
|
26426
26636
|
}
|
|
26427
26637
|
) }),
|
|
26428
|
-
/* @__PURE__ */
|
|
26429
|
-
] }) : /* @__PURE__ */
|
|
26430
|
-
!deploying && /* @__PURE__ */
|
|
26638
|
+
/* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: "Enter to save \xB7 Esc to cancel \xB7 blank to clear" }) })
|
|
26639
|
+
] }) : /* @__PURE__ */ jsxs35(Fragment4, { children: [
|
|
26640
|
+
!deploying && /* @__PURE__ */ jsx37(Box35, { flexDirection: "column", marginTop: 1, children: fields.map((f, idx) => {
|
|
26431
26641
|
const selected = idx === cursor;
|
|
26432
|
-
return /* @__PURE__ */
|
|
26642
|
+
return /* @__PURE__ */ jsx37(Box35, { children: /* @__PURE__ */ jsxs35(Text36, { color: selected ? theme.accent : theme.palette.foreground, bold: selected, children: [
|
|
26433
26643
|
selected ? "\u203A " : " ",
|
|
26434
26644
|
LABELS[f].padEnd(28),
|
|
26435
26645
|
" ",
|
|
@@ -26439,42 +26649,42 @@ function MultiAgentModal({ initial, onSave, onDone, remoteWorkerUrl, remoteAuthS
|
|
|
26439
26649
|
deployLog.length > 0 && (() => {
|
|
26440
26650
|
const failed = !deploying && deployLog.some((l) => l.startsWith("\u2717"));
|
|
26441
26651
|
const ctaUrl = deployLog.map((l) => l.match(/https:\/\/dash\.cloudflare\.com\/[^\s)]+/)?.[0]).find((u) => !!u) ?? "https://dash.cloudflare.com/profile/api-tokens";
|
|
26442
|
-
return /* @__PURE__ */
|
|
26443
|
-
/* @__PURE__ */
|
|
26444
|
-
/* @__PURE__ */
|
|
26652
|
+
return /* @__PURE__ */ jsxs35(Fragment4, { children: [
|
|
26653
|
+
/* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, borderStyle: "single", borderColor: failed ? theme.palette.error : theme.info.color, paddingX: 1, children: [
|
|
26654
|
+
/* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: deploying ? "Deploying\u2026" : failed ? "Setup failed" : "Deploy log" }),
|
|
26445
26655
|
deployLog.slice(-16).map((line, i) => {
|
|
26446
26656
|
const isErr = line.startsWith("\u2717");
|
|
26447
26657
|
const isDone = line.startsWith("\u2713");
|
|
26448
|
-
return /* @__PURE__ */
|
|
26658
|
+
return /* @__PURE__ */ jsx37(Text36, { color: isErr ? theme.palette.error : isDone ? theme.palette.success : theme.palette.foreground, children: line }, i);
|
|
26449
26659
|
})
|
|
26450
26660
|
] }),
|
|
26451
|
-
failed && /* @__PURE__ */
|
|
26452
|
-
/* @__PURE__ */
|
|
26453
|
-
/* @__PURE__ */
|
|
26661
|
+
failed && /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
26662
|
+
/* @__PURE__ */ jsx37(Text36, { color: theme.accent, bold: true, children: "Next steps" }),
|
|
26663
|
+
/* @__PURE__ */ jsxs35(Text36, { children: [
|
|
26454
26664
|
"1. Press ",
|
|
26455
|
-
/* @__PURE__ */
|
|
26665
|
+
/* @__PURE__ */ jsx37(Text36, { bold: true, children: "O" }),
|
|
26456
26666
|
" to open your Cloudflare tokens"
|
|
26457
26667
|
] }),
|
|
26458
|
-
/* @__PURE__ */
|
|
26459
|
-
/* @__PURE__ */
|
|
26460
|
-
/* @__PURE__ */
|
|
26668
|
+
/* @__PURE__ */ jsx37(Text36, { children: "2. Find the token kimiflare is using \u2192 Edit \u2192 add the scopes above" }),
|
|
26669
|
+
/* @__PURE__ */ jsx37(Text36, { children: "3. Save (the token value doesn't change)" }),
|
|
26670
|
+
/* @__PURE__ */ jsxs35(Text36, { children: [
|
|
26461
26671
|
"4. Press ",
|
|
26462
|
-
/* @__PURE__ */
|
|
26672
|
+
/* @__PURE__ */ jsx37(Text36, { bold: true, children: "R" }),
|
|
26463
26673
|
" to retry, or Esc to close"
|
|
26464
26674
|
] }),
|
|
26465
|
-
/* @__PURE__ */
|
|
26675
|
+
/* @__PURE__ */ jsx37(Text36, { dimColor: true, children: ctaUrl })
|
|
26466
26676
|
] }),
|
|
26467
|
-
!failed && !deploying && deployLog.some((l) => l.startsWith("\u2713")) && /* @__PURE__ */
|
|
26468
|
-
/* @__PURE__ */
|
|
26469
|
-
/* @__PURE__ */
|
|
26677
|
+
!failed && !deploying && deployLog.some((l) => l.startsWith("\u2713")) && /* @__PURE__ */ jsxs35(Box35, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.palette.success, paddingX: 1, children: [
|
|
26678
|
+
/* @__PURE__ */ jsx37(Text36, { color: theme.palette.success, bold: true, children: "Multi-agent is ready" }),
|
|
26679
|
+
/* @__PURE__ */ jsxs35(Text36, { children: [
|
|
26470
26680
|
"Press ",
|
|
26471
|
-
/* @__PURE__ */
|
|
26681
|
+
/* @__PURE__ */ jsx37(Text36, { bold: true, children: "Enter" }),
|
|
26472
26682
|
" to close and start using it."
|
|
26473
26683
|
] })
|
|
26474
26684
|
] })
|
|
26475
26685
|
] });
|
|
26476
26686
|
})(),
|
|
26477
|
-
/* @__PURE__ */
|
|
26687
|
+
/* @__PURE__ */ jsx37(Box35, { marginTop: 1, children: /* @__PURE__ */ jsx37(Text36, { dimColor: true, children: deploying ? "Deploying\u2026 please wait." : deployLog.some((l) => l.startsWith("\u2717")) ? "O open CF tokens \xB7 R retry \xB7 Esc close" : deployLog.some((l) => l.startsWith("\u2713")) ? "Enter to close \xB7 Esc to close" : `\u2191\u2193 to pick \xB7 Enter to ${fields[cursor] === "deploy" ? "deploy" : fields[cursor] === "teardown" ? "tear down" : isBool(fields[cursor]) ? "toggle" : "edit"} \xB7 Esc to close` }) })
|
|
26478
26688
|
] })
|
|
26479
26689
|
] });
|
|
26480
26690
|
}
|
|
@@ -26597,21 +26807,21 @@ var init_recommended = __esm({
|
|
|
26597
26807
|
});
|
|
26598
26808
|
|
|
26599
26809
|
// src/ui/hooks-wizard.tsx
|
|
26600
|
-
import { useState as
|
|
26601
|
-
import { Box as
|
|
26602
|
-
import
|
|
26603
|
-
import { jsx as
|
|
26810
|
+
import { useState as useState23 } from "react";
|
|
26811
|
+
import { Box as Box36, Text as Text37, useInput as useInput17 } from "ink";
|
|
26812
|
+
import SelectInput19 from "ink-select-input";
|
|
26813
|
+
import { jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
26604
26814
|
function HooksWizard(props) {
|
|
26605
26815
|
const theme = useTheme();
|
|
26606
|
-
const [step, setStep] =
|
|
26607
|
-
const [event, setEvent] =
|
|
26608
|
-
const [matcher, setMatcher] =
|
|
26609
|
-
const [command, setCommand] =
|
|
26610
|
-
const [id, setId] =
|
|
26611
|
-
const [description, setDescription] =
|
|
26612
|
-
const [scope, setScope] =
|
|
26613
|
-
const [error, setError] =
|
|
26614
|
-
|
|
26816
|
+
const [step, setStep] = useState23("event");
|
|
26817
|
+
const [event, setEvent] = useState23(null);
|
|
26818
|
+
const [matcher, setMatcher] = useState23("");
|
|
26819
|
+
const [command, setCommand] = useState23("");
|
|
26820
|
+
const [id, setId] = useState23("");
|
|
26821
|
+
const [description, setDescription] = useState23("");
|
|
26822
|
+
const [scope, setScope] = useState23("project");
|
|
26823
|
+
const [error, setError] = useState23(null);
|
|
26824
|
+
useInput17((_input, key) => {
|
|
26615
26825
|
if (!key.escape) return;
|
|
26616
26826
|
setError(null);
|
|
26617
26827
|
if (step === "event") {
|
|
@@ -26649,14 +26859,14 @@ function HooksWizard(props) {
|
|
|
26649
26859
|
value: ev,
|
|
26650
26860
|
key: ev
|
|
26651
26861
|
}));
|
|
26652
|
-
return /* @__PURE__ */
|
|
26862
|
+
return /* @__PURE__ */ jsx38(
|
|
26653
26863
|
WizardFrame,
|
|
26654
26864
|
{
|
|
26655
26865
|
title: "Create hook \xB7 step 1 of 6: pick the event",
|
|
26656
26866
|
hint: "The lifecycle moment that fires your command.",
|
|
26657
26867
|
error,
|
|
26658
|
-
children: /* @__PURE__ */
|
|
26659
|
-
|
|
26868
|
+
children: /* @__PURE__ */ jsx38(
|
|
26869
|
+
SelectInput19,
|
|
26660
26870
|
{
|
|
26661
26871
|
items,
|
|
26662
26872
|
onSelect: (it) => {
|
|
@@ -26669,7 +26879,7 @@ function HooksWizard(props) {
|
|
|
26669
26879
|
);
|
|
26670
26880
|
}
|
|
26671
26881
|
if (step === "matcher") {
|
|
26672
|
-
return /* @__PURE__ */
|
|
26882
|
+
return /* @__PURE__ */ jsxs36(
|
|
26673
26883
|
WizardFrame,
|
|
26674
26884
|
{
|
|
26675
26885
|
title: `Create hook \xB7 step 2 of 6: matcher (optional)`,
|
|
@@ -26679,8 +26889,8 @@ Common patterns:
|
|
|
26679
26889
|
` + MATCHER_EXAMPLES.map((s) => ` ${s}`).join("\n"),
|
|
26680
26890
|
error,
|
|
26681
26891
|
children: [
|
|
26682
|
-
/* @__PURE__ */
|
|
26683
|
-
/* @__PURE__ */
|
|
26892
|
+
/* @__PURE__ */ jsx38(Box36, { marginBottom: 1, children: /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Your matcher: " }) }),
|
|
26893
|
+
/* @__PURE__ */ jsx38(
|
|
26684
26894
|
CustomTextInput,
|
|
26685
26895
|
{
|
|
26686
26896
|
value: matcher,
|
|
@@ -26702,7 +26912,7 @@ Common patterns:
|
|
|
26702
26912
|
focus: true
|
|
26703
26913
|
}
|
|
26704
26914
|
),
|
|
26705
|
-
/* @__PURE__ */
|
|
26915
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Enter (even if blank) to continue \xB7 Esc to go back" })
|
|
26706
26916
|
]
|
|
26707
26917
|
}
|
|
26708
26918
|
);
|
|
@@ -26710,7 +26920,7 @@ Common patterns:
|
|
|
26710
26920
|
if (step === "command") {
|
|
26711
26921
|
const stepNum = TOOL_EVENTS.has(event) ? 3 : 2;
|
|
26712
26922
|
const examples = EVENT_COMMAND_EXAMPLES[event];
|
|
26713
|
-
return /* @__PURE__ */
|
|
26923
|
+
return /* @__PURE__ */ jsxs36(
|
|
26714
26924
|
WizardFrame,
|
|
26715
26925
|
{
|
|
26716
26926
|
title: `Create hook \xB7 step ${stepNum} of 6: shell command`,
|
|
@@ -26729,13 +26939,13 @@ Note: this is a VETO event \u2014 exit non-zero (e.g. \`exit 1\`) to cancel
|
|
|
26729
26939
|
the ${event === "PreToolUse" ? "tool call" : "prompt"}. Stdout becomes the rejection reason shown to the user.` : ""),
|
|
26730
26940
|
error,
|
|
26731
26941
|
children: [
|
|
26732
|
-
/* @__PURE__ */
|
|
26733
|
-
/* @__PURE__ */
|
|
26734
|
-
examples.map((line, i) => /* @__PURE__ */
|
|
26735
|
-
/* @__PURE__ */
|
|
26942
|
+
/* @__PURE__ */ jsxs36(Box36, { flexDirection: "column", marginBottom: 1, children: [
|
|
26943
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "\u2500\u2500 Examples (copy / adapt) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" }),
|
|
26944
|
+
examples.map((line, i) => /* @__PURE__ */ jsx38(Text37, { color: line.startsWith("#") ? theme.info.color : void 0, dimColor: line.startsWith("#"), children: line || " " }, i)),
|
|
26945
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" })
|
|
26736
26946
|
] }),
|
|
26737
|
-
/* @__PURE__ */
|
|
26738
|
-
/* @__PURE__ */
|
|
26947
|
+
/* @__PURE__ */ jsx38(Box36, { children: /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Your command: " }) }),
|
|
26948
|
+
/* @__PURE__ */ jsx38(
|
|
26739
26949
|
CustomTextInput,
|
|
26740
26950
|
{
|
|
26741
26951
|
value: command,
|
|
@@ -26753,14 +26963,14 @@ the ${event === "PreToolUse" ? "tool call" : "prompt"}. Stdout becomes the rejec
|
|
|
26753
26963
|
focus: true
|
|
26754
26964
|
}
|
|
26755
26965
|
),
|
|
26756
|
-
/* @__PURE__ */
|
|
26966
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
|
|
26757
26967
|
]
|
|
26758
26968
|
}
|
|
26759
26969
|
);
|
|
26760
26970
|
}
|
|
26761
26971
|
if (step === "id") {
|
|
26762
26972
|
const stepNum = TOOL_EVENTS.has(event) ? 4 : 3;
|
|
26763
|
-
return /* @__PURE__ */
|
|
26973
|
+
return /* @__PURE__ */ jsxs36(
|
|
26764
26974
|
WizardFrame,
|
|
26765
26975
|
{
|
|
26766
26976
|
title: `Create hook \xB7 step ${stepNum} of 6: id (optional)`,
|
|
@@ -26768,7 +26978,7 @@ the ${event === "PreToolUse" ? "tool call" : "prompt"}. Stdout becomes the rejec
|
|
|
26768
26978
|
derive from event+command (8 hex chars).`,
|
|
26769
26979
|
error,
|
|
26770
26980
|
children: [
|
|
26771
|
-
/* @__PURE__ */
|
|
26981
|
+
/* @__PURE__ */ jsx38(
|
|
26772
26982
|
CustomTextInput,
|
|
26773
26983
|
{
|
|
26774
26984
|
value: id,
|
|
@@ -26781,21 +26991,21 @@ derive from event+command (8 hex chars).`,
|
|
|
26781
26991
|
focus: true
|
|
26782
26992
|
}
|
|
26783
26993
|
),
|
|
26784
|
-
/* @__PURE__ */
|
|
26994
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
|
|
26785
26995
|
]
|
|
26786
26996
|
}
|
|
26787
26997
|
);
|
|
26788
26998
|
}
|
|
26789
26999
|
if (step === "description") {
|
|
26790
27000
|
const stepNum = TOOL_EVENTS.has(event) ? 5 : 4;
|
|
26791
|
-
return /* @__PURE__ */
|
|
27001
|
+
return /* @__PURE__ */ jsxs36(
|
|
26792
27002
|
WizardFrame,
|
|
26793
27003
|
{
|
|
26794
27004
|
title: `Create hook \xB7 step ${stepNum} of 6: description (optional)`,
|
|
26795
27005
|
hint: "One-line summary shown by /hooks list.",
|
|
26796
27006
|
error,
|
|
26797
27007
|
children: [
|
|
26798
|
-
/* @__PURE__ */
|
|
27008
|
+
/* @__PURE__ */ jsx38(
|
|
26799
27009
|
CustomTextInput,
|
|
26800
27010
|
{
|
|
26801
27011
|
value: description,
|
|
@@ -26808,14 +27018,14 @@ derive from event+command (8 hex chars).`,
|
|
|
26808
27018
|
focus: true
|
|
26809
27019
|
}
|
|
26810
27020
|
),
|
|
26811
|
-
/* @__PURE__ */
|
|
27021
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "Enter to continue \xB7 Esc to go back" })
|
|
26812
27022
|
]
|
|
26813
27023
|
}
|
|
26814
27024
|
);
|
|
26815
27025
|
}
|
|
26816
27026
|
if (step === "scope") {
|
|
26817
27027
|
const stepNum = TOOL_EVENTS.has(event) ? 6 : 5;
|
|
26818
|
-
return /* @__PURE__ */
|
|
27028
|
+
return /* @__PURE__ */ jsx38(
|
|
26819
27029
|
WizardFrame,
|
|
26820
27030
|
{
|
|
26821
27031
|
title: `Create hook \xB7 step ${stepNum} of 6: scope`,
|
|
@@ -26824,8 +27034,8 @@ derive from event+command (8 hex chars).`,
|
|
|
26824
27034
|
global \u2014 lives in ~/.config/kimiflare/settings.json (applies to
|
|
26825
27035
|
every project)`,
|
|
26826
27036
|
error,
|
|
26827
|
-
children: /* @__PURE__ */
|
|
26828
|
-
|
|
27037
|
+
children: /* @__PURE__ */ jsx38(
|
|
27038
|
+
SelectInput19,
|
|
26829
27039
|
{
|
|
26830
27040
|
items: [
|
|
26831
27041
|
{ label: "project (.kimiflare/settings.json)", value: "project", key: "project" },
|
|
@@ -26847,41 +27057,41 @@ global \u2014 lives in ~/.config/kimiflare/settings.json (applies to
|
|
|
26847
27057
|
...description ? { description } : {},
|
|
26848
27058
|
enabled: true
|
|
26849
27059
|
};
|
|
26850
|
-
return /* @__PURE__ */
|
|
27060
|
+
return /* @__PURE__ */ jsxs36(
|
|
26851
27061
|
WizardFrame,
|
|
26852
27062
|
{
|
|
26853
27063
|
title: "Create hook \xB7 step 6 of 6: review + save",
|
|
26854
27064
|
hint: "Enter on 'Save' to write to settings.json. Esc to go back.",
|
|
26855
27065
|
error,
|
|
26856
27066
|
children: [
|
|
26857
|
-
/* @__PURE__ */
|
|
26858
|
-
/* @__PURE__ */
|
|
26859
|
-
/* @__PURE__ */
|
|
27067
|
+
/* @__PURE__ */ jsxs36(Box36, { marginTop: 1, flexDirection: "column", children: [
|
|
27068
|
+
/* @__PURE__ */ jsxs36(Text37, { children: [
|
|
27069
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "event: " }),
|
|
26860
27070
|
event
|
|
26861
27071
|
] }),
|
|
26862
|
-
matcher && /* @__PURE__ */
|
|
26863
|
-
/* @__PURE__ */
|
|
27072
|
+
matcher && /* @__PURE__ */ jsxs36(Text37, { children: [
|
|
27073
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "matcher: " }),
|
|
26864
27074
|
matcher
|
|
26865
27075
|
] }),
|
|
26866
|
-
/* @__PURE__ */
|
|
26867
|
-
/* @__PURE__ */
|
|
27076
|
+
/* @__PURE__ */ jsxs36(Text37, { children: [
|
|
27077
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "command: " }),
|
|
26868
27078
|
command
|
|
26869
27079
|
] }),
|
|
26870
|
-
id && /* @__PURE__ */
|
|
26871
|
-
/* @__PURE__ */
|
|
27080
|
+
id && /* @__PURE__ */ jsxs36(Text37, { children: [
|
|
27081
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "id: " }),
|
|
26872
27082
|
id
|
|
26873
27083
|
] }),
|
|
26874
|
-
description && /* @__PURE__ */
|
|
26875
|
-
/* @__PURE__ */
|
|
27084
|
+
description && /* @__PURE__ */ jsxs36(Text37, { children: [
|
|
27085
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "description: " }),
|
|
26876
27086
|
description
|
|
26877
27087
|
] }),
|
|
26878
|
-
/* @__PURE__ */
|
|
26879
|
-
/* @__PURE__ */
|
|
27088
|
+
/* @__PURE__ */ jsxs36(Text37, { children: [
|
|
27089
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: "scope: " }),
|
|
26880
27090
|
scope
|
|
26881
27091
|
] })
|
|
26882
27092
|
] }),
|
|
26883
|
-
/* @__PURE__ */
|
|
26884
|
-
|
|
27093
|
+
/* @__PURE__ */ jsx38(Box36, { marginTop: 1, children: /* @__PURE__ */ jsx38(
|
|
27094
|
+
SelectInput19,
|
|
26885
27095
|
{
|
|
26886
27096
|
items: [
|
|
26887
27097
|
{ label: "\u2713 Save", value: "save", key: "save" },
|
|
@@ -26907,11 +27117,11 @@ global \u2014 lives in ~/.config/kimiflare/settings.json (applies to
|
|
|
26907
27117
|
}
|
|
26908
27118
|
function WizardFrame(props) {
|
|
26909
27119
|
const theme = useTheme();
|
|
26910
|
-
return /* @__PURE__ */
|
|
26911
|
-
/* @__PURE__ */
|
|
26912
|
-
props.hint && /* @__PURE__ */
|
|
26913
|
-
/* @__PURE__ */
|
|
26914
|
-
props.error && /* @__PURE__ */
|
|
27120
|
+
return /* @__PURE__ */ jsxs36(Box36, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
27121
|
+
/* @__PURE__ */ jsx38(Text37, { color: theme.accent, bold: true, children: props.title }),
|
|
27122
|
+
props.hint && /* @__PURE__ */ jsx38(Box36, { marginTop: 1, flexDirection: "column", children: props.hint.split("\n").map((line, i) => /* @__PURE__ */ jsx38(Text37, { color: theme.info.color, dimColor: true, children: line }, i)) }),
|
|
27123
|
+
/* @__PURE__ */ jsx38(Box36, { marginTop: 1, flexDirection: "column", children: props.children }),
|
|
27124
|
+
props.error && /* @__PURE__ */ jsx38(Box36, { marginTop: 1, children: /* @__PURE__ */ jsx38(Text37, { color: theme.palette.error, children: props.error }) })
|
|
26915
27125
|
] });
|
|
26916
27126
|
}
|
|
26917
27127
|
var TOOL_EVENTS, EVENT_DESCRIPTIONS, EVENT_COMMAND_EXAMPLES, MATCHER_EXAMPLES;
|
|
@@ -26974,10 +27184,10 @@ var init_hooks_wizard = __esm({
|
|
|
26974
27184
|
});
|
|
26975
27185
|
|
|
26976
27186
|
// src/ui/hooks-dashboard.tsx
|
|
26977
|
-
import { useMemo as useMemo5, useState as
|
|
26978
|
-
import { Box as
|
|
26979
|
-
import
|
|
26980
|
-
import { jsx as
|
|
27187
|
+
import { useMemo as useMemo5, useState as useState24 } from "react";
|
|
27188
|
+
import { Box as Box37, Text as Text38, useInput as useInput18 } from "ink";
|
|
27189
|
+
import SelectInput20 from "ink-select-input";
|
|
27190
|
+
import { jsx as jsx39, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
26981
27191
|
function tag(event) {
|
|
26982
27192
|
return `[${event}]`.padEnd(20);
|
|
26983
27193
|
}
|
|
@@ -26991,22 +27201,22 @@ function ColoredRow({ isSelected, label }) {
|
|
|
26991
27201
|
const match = label.match(/^(.+?)(\[ [✓✗+] \w+\s*\])\s*$/);
|
|
26992
27202
|
const baseColor = isSelected ? "cyan" : void 0;
|
|
26993
27203
|
if (!match) {
|
|
26994
|
-
return /* @__PURE__ */
|
|
27204
|
+
return /* @__PURE__ */ jsx39(Text38, { color: baseColor, bold: isSelected, children: label });
|
|
26995
27205
|
}
|
|
26996
27206
|
const [, body, badge] = match;
|
|
26997
27207
|
const badgeColor = badge.includes("\u2713") ? "green" : badge.includes("\u2717") ? "red" : void 0;
|
|
26998
|
-
return /* @__PURE__ */
|
|
27208
|
+
return /* @__PURE__ */ jsxs37(Text38, { color: baseColor, bold: isSelected, children: [
|
|
26999
27209
|
body,
|
|
27000
|
-
/* @__PURE__ */
|
|
27210
|
+
/* @__PURE__ */ jsx39(Text38, { color: badgeColor, dimColor: badgeColor === void 0, children: badge })
|
|
27001
27211
|
] });
|
|
27002
27212
|
}
|
|
27003
27213
|
function HooksDashboard(props) {
|
|
27004
27214
|
const theme = useTheme();
|
|
27005
|
-
const [message2, setMessage] =
|
|
27006
|
-
const [version, setVersion] =
|
|
27007
|
-
const [highlighted, setHighlighted] =
|
|
27008
|
-
const [showWizard, setShowWizard] =
|
|
27009
|
-
|
|
27215
|
+
const [message2, setMessage] = useState24(null);
|
|
27216
|
+
const [version, setVersion] = useState24(0);
|
|
27217
|
+
const [highlighted, setHighlighted] = useState24(null);
|
|
27218
|
+
const [showWizard, setShowWizard] = useState24(false);
|
|
27219
|
+
useInput18((_input, key) => {
|
|
27010
27220
|
if (showWizard) return;
|
|
27011
27221
|
if (key.escape) props.onDone();
|
|
27012
27222
|
});
|
|
@@ -27089,7 +27299,7 @@ function HooksDashboard(props) {
|
|
|
27089
27299
|
}
|
|
27090
27300
|
};
|
|
27091
27301
|
if (showWizard) {
|
|
27092
|
-
return /* @__PURE__ */
|
|
27302
|
+
return /* @__PURE__ */ jsx39(
|
|
27093
27303
|
HooksWizard,
|
|
27094
27304
|
{
|
|
27095
27305
|
cwd: props.cwd,
|
|
@@ -27105,49 +27315,49 @@ function HooksDashboard(props) {
|
|
|
27105
27315
|
}
|
|
27106
27316
|
const focus = highlighted ?? items[0]?.value ?? null;
|
|
27107
27317
|
const focusMeta = focus && focus.kind === "row" ? focus.meta : null;
|
|
27108
|
-
return /* @__PURE__ */
|
|
27109
|
-
/* @__PURE__ */
|
|
27110
|
-
/* @__PURE__ */
|
|
27111
|
-
message2 && /* @__PURE__ */
|
|
27318
|
+
return /* @__PURE__ */ jsxs37(Box37, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
27319
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.accent, bold: true, children: "Hooks" }),
|
|
27320
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "Arrow keys to navigate. Enter to toggle. Esc when done." }),
|
|
27321
|
+
message2 && /* @__PURE__ */ jsx39(Box37, { marginTop: 1, paddingX: 1, borderStyle: "single", borderColor: "green", children: /* @__PURE__ */ jsxs37(Text38, { color: "green", bold: true, children: [
|
|
27112
27322
|
"\u2713 ",
|
|
27113
27323
|
message2
|
|
27114
27324
|
] }) }),
|
|
27115
|
-
/* @__PURE__ */
|
|
27116
|
-
/* @__PURE__ */
|
|
27117
|
-
/* @__PURE__ */
|
|
27325
|
+
/* @__PURE__ */ jsxs37(Box37, { marginTop: 1, flexDirection: "column", children: [
|
|
27326
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "Events:" }),
|
|
27327
|
+
/* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27118
27328
|
" ",
|
|
27119
|
-
/* @__PURE__ */
|
|
27329
|
+
/* @__PURE__ */ jsx39(Text38, { bold: true, children: "PreToolUse" }),
|
|
27120
27330
|
" \u2014 ",
|
|
27121
27331
|
EVENT_EXPLANATIONS.PreToolUse
|
|
27122
27332
|
] }),
|
|
27123
|
-
/* @__PURE__ */
|
|
27333
|
+
/* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27124
27334
|
" ",
|
|
27125
|
-
/* @__PURE__ */
|
|
27335
|
+
/* @__PURE__ */ jsx39(Text38, { bold: true, children: "PostToolUse" }),
|
|
27126
27336
|
" \u2014 ",
|
|
27127
27337
|
EVENT_EXPLANATIONS.PostToolUse
|
|
27128
27338
|
] }),
|
|
27129
|
-
/* @__PURE__ */
|
|
27339
|
+
/* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27130
27340
|
" ",
|
|
27131
|
-
/* @__PURE__ */
|
|
27341
|
+
/* @__PURE__ */ jsx39(Text38, { bold: true, children: "UserPromptSubmit" }),
|
|
27132
27342
|
" \u2014 ",
|
|
27133
27343
|
EVENT_EXPLANATIONS.UserPromptSubmit
|
|
27134
27344
|
] }),
|
|
27135
|
-
/* @__PURE__ */
|
|
27345
|
+
/* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27136
27346
|
" ",
|
|
27137
|
-
/* @__PURE__ */
|
|
27347
|
+
/* @__PURE__ */ jsx39(Text38, { bold: true, children: "Stop" }),
|
|
27138
27348
|
" \u2014 ",
|
|
27139
27349
|
EVENT_EXPLANATIONS.Stop
|
|
27140
27350
|
] }),
|
|
27141
|
-
/* @__PURE__ */
|
|
27351
|
+
/* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27142
27352
|
" ",
|
|
27143
|
-
/* @__PURE__ */
|
|
27353
|
+
/* @__PURE__ */ jsx39(Text38, { bold: true, children: "PreCompact" }),
|
|
27144
27354
|
" \u2014 ",
|
|
27145
27355
|
EVENT_EXPLANATIONS.PreCompact
|
|
27146
27356
|
] })
|
|
27147
27357
|
] }),
|
|
27148
|
-
configured.length === 0 && /* @__PURE__ */
|
|
27149
|
-
/* @__PURE__ */
|
|
27150
|
-
|
|
27358
|
+
configured.length === 0 && /* @__PURE__ */ jsx39(Box37, { marginTop: 1, children: /* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "No hooks configured yet. Pick a recommended one below \u2014 or create your own." }) }),
|
|
27359
|
+
/* @__PURE__ */ jsx39(Box37, { marginTop: 1, children: /* @__PURE__ */ jsx39(
|
|
27360
|
+
SelectInput20,
|
|
27151
27361
|
{
|
|
27152
27362
|
items,
|
|
27153
27363
|
itemComponent: ColoredRow,
|
|
@@ -27155,26 +27365,26 @@ function HooksDashboard(props) {
|
|
|
27155
27365
|
onHighlight: (it) => setHighlighted(it.value)
|
|
27156
27366
|
}
|
|
27157
27367
|
) }),
|
|
27158
|
-
focusMeta && /* @__PURE__ */
|
|
27159
|
-
/* @__PURE__ */
|
|
27160
|
-
/* @__PURE__ */
|
|
27161
|
-
/* @__PURE__ */
|
|
27162
|
-
/* @__PURE__ */
|
|
27163
|
-
/* @__PURE__ */
|
|
27164
|
-
/* @__PURE__ */
|
|
27165
|
-
/* @__PURE__ */
|
|
27368
|
+
focusMeta && /* @__PURE__ */ jsxs37(Box37, { marginTop: 1, flexDirection: "column", borderStyle: "single", borderColor: theme.info.color, paddingX: 1, children: [
|
|
27369
|
+
/* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27370
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "id: " }),
|
|
27371
|
+
/* @__PURE__ */ jsx39(Text38, { bold: true, children: focusMeta.id }),
|
|
27372
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: " event: " }),
|
|
27373
|
+
/* @__PURE__ */ jsx39(Text38, { children: focusMeta.event }),
|
|
27374
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: " source: " }),
|
|
27375
|
+
/* @__PURE__ */ jsx39(Text38, { children: focusMeta.source ?? "\u2014" })
|
|
27166
27376
|
] }),
|
|
27167
|
-
focusMeta.description && /* @__PURE__ */
|
|
27168
|
-
/* @__PURE__ */
|
|
27377
|
+
focusMeta.description && /* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27378
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "what: " }),
|
|
27169
27379
|
focusMeta.description
|
|
27170
27380
|
] }),
|
|
27171
|
-
/* @__PURE__ */
|
|
27172
|
-
/* @__PURE__ */
|
|
27173
|
-
/* @__PURE__ */
|
|
27381
|
+
/* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27382
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "runs: " }),
|
|
27383
|
+
/* @__PURE__ */ jsx39(Text38, { children: focusMeta.command.length > 100 ? focusMeta.command.slice(0, 100) + "\u2026" : focusMeta.command })
|
|
27174
27384
|
] }),
|
|
27175
|
-
/* @__PURE__ */
|
|
27176
|
-
/* @__PURE__ */
|
|
27177
|
-
/* @__PURE__ */
|
|
27385
|
+
/* @__PURE__ */ jsxs37(Text38, { children: [
|
|
27386
|
+
/* @__PURE__ */ jsx39(Text38, { color: theme.info.color, dimColor: true, children: "action: " }),
|
|
27387
|
+
/* @__PURE__ */ jsxs37(Text38, { color: theme.accent, children: [
|
|
27178
27388
|
"Enter to ",
|
|
27179
27389
|
focusMeta.kind === "configured" ? focusMeta.enabled ? "disable" : "re-enable" : "enable (adds to project settings.json)"
|
|
27180
27390
|
] })
|
|
@@ -27201,15 +27411,15 @@ var init_hooks_dashboard = __esm({
|
|
|
27201
27411
|
});
|
|
27202
27412
|
|
|
27203
27413
|
// src/ui/help-menu.tsx
|
|
27204
|
-
import { useState as
|
|
27205
|
-
import { Box as
|
|
27206
|
-
import
|
|
27207
|
-
import { jsx as
|
|
27414
|
+
import { useState as useState25 } from "react";
|
|
27415
|
+
import { Box as Box38, Text as Text39, useInput as useInput19 } from "ink";
|
|
27416
|
+
import SelectInput21 from "ink-select-input";
|
|
27417
|
+
import { jsx as jsx40, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
27208
27418
|
function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand }) {
|
|
27209
27419
|
const theme = useTheme();
|
|
27210
|
-
const [page, setPage] =
|
|
27420
|
+
const [page, setPage] = useState25("main");
|
|
27211
27421
|
const customs = customCommands ?? [];
|
|
27212
|
-
|
|
27422
|
+
useInput19((_input, key) => {
|
|
27213
27423
|
if (key.escape) {
|
|
27214
27424
|
if (page !== "main") {
|
|
27215
27425
|
setPage("main");
|
|
@@ -27233,11 +27443,11 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
|
|
|
27233
27443
|
items2.push({ label: "Run custom commands", value: "custom", key: "custom" });
|
|
27234
27444
|
}
|
|
27235
27445
|
items2.push({ label: "(close)", value: "__close__", key: "__close__" });
|
|
27236
|
-
return /* @__PURE__ */
|
|
27237
|
-
/* @__PURE__ */
|
|
27238
|
-
/* @__PURE__ */
|
|
27239
|
-
/* @__PURE__ */
|
|
27240
|
-
|
|
27446
|
+
return /* @__PURE__ */ jsxs38(Box38, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
27447
|
+
/* @__PURE__ */ jsx40(Text39, { color: theme.accent, bold: true, children: "Help" }),
|
|
27448
|
+
/* @__PURE__ */ jsx40(Text39, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to close." }),
|
|
27449
|
+
/* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(
|
|
27450
|
+
SelectInput21,
|
|
27241
27451
|
{
|
|
27242
27452
|
items: items2,
|
|
27243
27453
|
onSelect: (item) => {
|
|
@@ -27249,8 +27459,8 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
|
|
|
27249
27459
|
}
|
|
27250
27460
|
}
|
|
27251
27461
|
) }),
|
|
27252
|
-
/* @__PURE__ */
|
|
27253
|
-
/* @__PURE__ */
|
|
27462
|
+
/* @__PURE__ */ jsx40(Box38, { marginTop: 1, flexDirection: "column", children: SINGLE_COMMANDS.map((cmd) => /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, dimColor: false, children: ` ${cmd.command.padEnd(20)} ${cmd.description}` }, cmd.command)) }),
|
|
27463
|
+
/* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(Text39, { 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" }) })
|
|
27254
27464
|
] });
|
|
27255
27465
|
}
|
|
27256
27466
|
if (page === "custom") {
|
|
@@ -27260,11 +27470,11 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
|
|
|
27260
27470
|
key: c.name
|
|
27261
27471
|
}));
|
|
27262
27472
|
items2.push({ label: "\u2190 Back", value: "__back__", key: "__back__" });
|
|
27263
|
-
return /* @__PURE__ */
|
|
27264
|
-
/* @__PURE__ */
|
|
27265
|
-
/* @__PURE__ */
|
|
27266
|
-
/* @__PURE__ */
|
|
27267
|
-
|
|
27473
|
+
return /* @__PURE__ */ jsxs38(Box38, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
27474
|
+
/* @__PURE__ */ jsx40(Text39, { color: theme.accent, bold: true, children: "Custom commands" }),
|
|
27475
|
+
/* @__PURE__ */ jsx40(Text39, { 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." }),
|
|
27476
|
+
/* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(
|
|
27477
|
+
SelectInput21,
|
|
27268
27478
|
{
|
|
27269
27479
|
items: items2,
|
|
27270
27480
|
onSelect: (item) => {
|
|
@@ -27287,11 +27497,11 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
|
|
|
27287
27497
|
key: cmd.command
|
|
27288
27498
|
}));
|
|
27289
27499
|
items.push({ label: "\u2190 Back", value: "__back__", key: "__back__" });
|
|
27290
|
-
return /* @__PURE__ */
|
|
27291
|
-
/* @__PURE__ */
|
|
27292
|
-
/* @__PURE__ */
|
|
27293
|
-
/* @__PURE__ */
|
|
27294
|
-
|
|
27500
|
+
return /* @__PURE__ */ jsxs38(Box38, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
27501
|
+
/* @__PURE__ */ jsx40(Text39, { color: theme.accent, bold: true, children: category.label }),
|
|
27502
|
+
/* @__PURE__ */ jsx40(Text39, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to execute, Esc to go back." }),
|
|
27503
|
+
/* @__PURE__ */ jsx40(Box38, { marginTop: 1, children: /* @__PURE__ */ jsx40(
|
|
27504
|
+
SelectInput21,
|
|
27295
27505
|
{
|
|
27296
27506
|
items,
|
|
27297
27507
|
onSelect: (item) => {
|
|
@@ -27303,7 +27513,7 @@ function HelpMenu({ customCommands, costAttributionEnabled, onDone, onCommand })
|
|
|
27303
27513
|
}
|
|
27304
27514
|
}
|
|
27305
27515
|
) }),
|
|
27306
|
-
staticCmds.length > 0 && /* @__PURE__ */
|
|
27516
|
+
staticCmds.length > 0 && /* @__PURE__ */ jsx40(Box38, { marginTop: 1, flexDirection: "column", children: staticCmds.map((cmd) => /* @__PURE__ */ jsx40(Text39, { color: theme.info.color, children: ` ${cmd.command.padEnd(28)} ${cmd.description}` }, cmd.command)) })
|
|
27307
27517
|
] });
|
|
27308
27518
|
}
|
|
27309
27519
|
var CATEGORIES, SINGLE_COMMANDS;
|
|
@@ -27442,9 +27652,9 @@ var init_help_menu = __esm({
|
|
|
27442
27652
|
});
|
|
27443
27653
|
|
|
27444
27654
|
// src/ui/modal-host.tsx
|
|
27445
|
-
import { Box as
|
|
27446
|
-
import
|
|
27447
|
-
import { jsx as
|
|
27655
|
+
import { Box as Box39, Text as Text40 } from "ink";
|
|
27656
|
+
import SelectInput22 from "ink-select-input";
|
|
27657
|
+
import { jsx as jsx41, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
27448
27658
|
function ModalHost(props) {
|
|
27449
27659
|
const {
|
|
27450
27660
|
modals,
|
|
@@ -27477,7 +27687,7 @@ function ModalHost(props) {
|
|
|
27477
27687
|
onInboxOpen
|
|
27478
27688
|
} = props;
|
|
27479
27689
|
if (modals.showRemoteDashboard) {
|
|
27480
|
-
return /* @__PURE__ */
|
|
27690
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: selectedRemoteSession ? /* @__PURE__ */ jsx41(
|
|
27481
27691
|
RemoteSessionDetail,
|
|
27482
27692
|
{
|
|
27483
27693
|
session: selectedRemoteSession,
|
|
@@ -27486,7 +27696,7 @@ function ModalHost(props) {
|
|
|
27486
27696
|
void onCancelRemoteSession(session);
|
|
27487
27697
|
}
|
|
27488
27698
|
}
|
|
27489
|
-
) : /* @__PURE__ */
|
|
27699
|
+
) : /* @__PURE__ */ jsx41(
|
|
27490
27700
|
RemoteDashboard,
|
|
27491
27701
|
{
|
|
27492
27702
|
onSelect: (session) => onSelectRemoteSession(session),
|
|
@@ -27495,7 +27705,7 @@ function ModalHost(props) {
|
|
|
27495
27705
|
) }) });
|
|
27496
27706
|
}
|
|
27497
27707
|
if (modals.showInboxModal) {
|
|
27498
|
-
return /* @__PURE__ */
|
|
27708
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27499
27709
|
InboxModal,
|
|
27500
27710
|
{
|
|
27501
27711
|
onDone: () => modals.setShowInboxModal(false),
|
|
@@ -27504,7 +27714,7 @@ function ModalHost(props) {
|
|
|
27504
27714
|
) }) });
|
|
27505
27715
|
}
|
|
27506
27716
|
if (modals.showMultiAgentModal) {
|
|
27507
|
-
return /* @__PURE__ */
|
|
27717
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27508
27718
|
MultiAgentModal,
|
|
27509
27719
|
{
|
|
27510
27720
|
initial: props.multiAgentSettings ?? {},
|
|
@@ -27517,7 +27727,7 @@ function ModalHost(props) {
|
|
|
27517
27727
|
) }) });
|
|
27518
27728
|
}
|
|
27519
27729
|
if (modals.showHooksDashboard) {
|
|
27520
|
-
return /* @__PURE__ */
|
|
27730
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27521
27731
|
HooksDashboard,
|
|
27522
27732
|
{
|
|
27523
27733
|
getConfigured: props.getConfiguredHooks,
|
|
@@ -27528,7 +27738,7 @@ function ModalHost(props) {
|
|
|
27528
27738
|
) }) });
|
|
27529
27739
|
}
|
|
27530
27740
|
if (modals.showHelpMenu) {
|
|
27531
|
-
return /* @__PURE__ */
|
|
27741
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27532
27742
|
HelpMenu,
|
|
27533
27743
|
{
|
|
27534
27744
|
customCommands: customCommands.map((c) => ({ name: c.name, description: c.description })),
|
|
@@ -27542,10 +27752,10 @@ function ModalHost(props) {
|
|
|
27542
27752
|
) }) });
|
|
27543
27753
|
}
|
|
27544
27754
|
if (modals.showShellPicker) {
|
|
27545
|
-
return /* @__PURE__ */
|
|
27755
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(ShellPicker, { current: props.currentShell, onPick: props.onPickShell }) }) });
|
|
27546
27756
|
}
|
|
27547
27757
|
if (modals.showMemoryPicker) {
|
|
27548
|
-
return /* @__PURE__ */
|
|
27758
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27549
27759
|
MemoryPicker,
|
|
27550
27760
|
{
|
|
27551
27761
|
enabled: props.memoryEnabled,
|
|
@@ -27556,7 +27766,7 @@ function ModalHost(props) {
|
|
|
27556
27766
|
) }) });
|
|
27557
27767
|
}
|
|
27558
27768
|
if (modals.showGatewayPicker) {
|
|
27559
|
-
return /* @__PURE__ */
|
|
27769
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27560
27770
|
GatewayPicker,
|
|
27561
27771
|
{
|
|
27562
27772
|
gatewayId: props.gatewayId,
|
|
@@ -27569,10 +27779,10 @@ function ModalHost(props) {
|
|
|
27569
27779
|
) }) });
|
|
27570
27780
|
}
|
|
27571
27781
|
if (modals.showSkillsPicker) {
|
|
27572
|
-
return /* @__PURE__ */
|
|
27782
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(SkillsPicker, { onAction: props.onSkillsAction, onDone: props.onSkillsDone }) }) });
|
|
27573
27783
|
}
|
|
27574
27784
|
if (modals.showLspWizard) {
|
|
27575
|
-
return /* @__PURE__ */
|
|
27785
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27576
27786
|
LspWizard,
|
|
27577
27787
|
{
|
|
27578
27788
|
servers: lspServers,
|
|
@@ -27584,7 +27794,7 @@ function ModalHost(props) {
|
|
|
27584
27794
|
) }) });
|
|
27585
27795
|
}
|
|
27586
27796
|
if (modals.commandWizard) {
|
|
27587
|
-
return /* @__PURE__ */
|
|
27797
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27588
27798
|
CommandWizard,
|
|
27589
27799
|
{
|
|
27590
27800
|
mode: modals.commandWizard.mode,
|
|
@@ -27598,7 +27808,7 @@ function ModalHost(props) {
|
|
|
27598
27808
|
}
|
|
27599
27809
|
if (modals.commandPicker) {
|
|
27600
27810
|
const pickerMode = modals.commandPicker.mode;
|
|
27601
|
-
return /* @__PURE__ */
|
|
27811
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27602
27812
|
CommandPicker,
|
|
27603
27813
|
{
|
|
27604
27814
|
commands: customCommands,
|
|
@@ -27617,15 +27827,15 @@ function ModalHost(props) {
|
|
|
27617
27827
|
}
|
|
27618
27828
|
if (modals.commandToDelete) {
|
|
27619
27829
|
const cmd = modals.commandToDelete;
|
|
27620
|
-
return /* @__PURE__ */
|
|
27621
|
-
/* @__PURE__ */
|
|
27830
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs39(Box39, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
27831
|
+
/* @__PURE__ */ jsxs39(Text40, { color: theme.accent, bold: true, children: [
|
|
27622
27832
|
"Delete /",
|
|
27623
27833
|
cmd.name,
|
|
27624
27834
|
"?"
|
|
27625
27835
|
] }),
|
|
27626
|
-
/* @__PURE__ */
|
|
27627
|
-
/* @__PURE__ */
|
|
27628
|
-
|
|
27836
|
+
/* @__PURE__ */ jsx41(Text40, { color: theme.info.color, children: cmd.filepath }),
|
|
27837
|
+
/* @__PURE__ */ jsx41(Box39, { marginTop: 1, children: /* @__PURE__ */ jsx41(
|
|
27838
|
+
SelectInput22,
|
|
27629
27839
|
{
|
|
27630
27840
|
items: [
|
|
27631
27841
|
{ label: "Yes, delete", value: "yes", key: "yes" },
|
|
@@ -27643,7 +27853,7 @@ function ModalHost(props) {
|
|
|
27643
27853
|
] }) });
|
|
27644
27854
|
}
|
|
27645
27855
|
if (modals.showCommandList) {
|
|
27646
|
-
return /* @__PURE__ */
|
|
27856
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27647
27857
|
CommandList,
|
|
27648
27858
|
{
|
|
27649
27859
|
commands: customCommands,
|
|
@@ -27652,24 +27862,24 @@ function ModalHost(props) {
|
|
|
27652
27862
|
) }) });
|
|
27653
27863
|
}
|
|
27654
27864
|
if (modals.showThemePicker) {
|
|
27655
|
-
return /* @__PURE__ */
|
|
27865
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(ThemePicker, { themes, onPick: onPickTheme }) }) });
|
|
27656
27866
|
}
|
|
27657
27867
|
if (modals.showUiPicker) {
|
|
27658
|
-
return /* @__PURE__ */
|
|
27868
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(UiPicker, { current: currentUiEngine, onPick: onPickUi }) }) });
|
|
27659
27869
|
}
|
|
27660
27870
|
if (modals.showModelPicker) {
|
|
27661
|
-
return /* @__PURE__ */
|
|
27871
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(ModelPicker, { current: currentModel, onPick: onPickModel }) }) });
|
|
27662
27872
|
}
|
|
27663
27873
|
if (modals.showModePicker) {
|
|
27664
|
-
return /* @__PURE__ */
|
|
27874
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(ModePicker, { current: props.currentMode, onPick: props.onPickMode, multiAgentEnabled: props.multiAgentEnabled }) }) });
|
|
27665
27875
|
}
|
|
27666
27876
|
if (modals.billingChooserFor) {
|
|
27667
27877
|
const model = modals.billingChooserFor;
|
|
27668
|
-
return /* @__PURE__ */
|
|
27878
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(BillingChooser, { model, onPick: (choice) => onPickBilling(model, choice) }) }) });
|
|
27669
27879
|
}
|
|
27670
27880
|
if (modals.unifiedProbeFor) {
|
|
27671
27881
|
const model = modals.unifiedProbeFor;
|
|
27672
|
-
return /* @__PURE__ */
|
|
27882
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27673
27883
|
UnifiedBillingStatus,
|
|
27674
27884
|
{
|
|
27675
27885
|
model,
|
|
@@ -27682,7 +27892,7 @@ function ModalHost(props) {
|
|
|
27682
27892
|
}
|
|
27683
27893
|
if (modals.keyEntryFor) {
|
|
27684
27894
|
const model = modals.keyEntryFor;
|
|
27685
|
-
return /* @__PURE__ */
|
|
27895
|
+
return /* @__PURE__ */ jsx41(ThemeProvider, { theme, children: /* @__PURE__ */ jsx41(Box39, { flexDirection: "column", children: /* @__PURE__ */ jsx41(
|
|
27686
27896
|
KeyEntryModal,
|
|
27687
27897
|
{
|
|
27688
27898
|
model,
|
|
@@ -27703,7 +27913,7 @@ function ModalOverlay({
|
|
|
27703
27913
|
}) {
|
|
27704
27914
|
if (modals.limitModal) {
|
|
27705
27915
|
const m = modals.limitModal;
|
|
27706
|
-
return /* @__PURE__ */
|
|
27916
|
+
return /* @__PURE__ */ jsx41(
|
|
27707
27917
|
LimitModal,
|
|
27708
27918
|
{
|
|
27709
27919
|
limit: m.limit,
|
|
@@ -27717,7 +27927,7 @@ function ModalOverlay({
|
|
|
27717
27927
|
}
|
|
27718
27928
|
if (modals.loopModal) {
|
|
27719
27929
|
const m = modals.loopModal;
|
|
27720
|
-
return /* @__PURE__ */
|
|
27930
|
+
return /* @__PURE__ */ jsx41(
|
|
27721
27931
|
LimitModal,
|
|
27722
27932
|
{
|
|
27723
27933
|
limit: 50,
|
|
@@ -27766,9 +27976,9 @@ var init_modal_host = __esm({
|
|
|
27766
27976
|
});
|
|
27767
27977
|
|
|
27768
27978
|
// src/ui/plan-complete-picker.tsx
|
|
27769
|
-
import { Box as
|
|
27770
|
-
import
|
|
27771
|
-
import { jsx as
|
|
27979
|
+
import { Box as Box40, Text as Text41 } from "ink";
|
|
27980
|
+
import SelectInput23 from "ink-select-input";
|
|
27981
|
+
import { jsx as jsx42, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
27772
27982
|
function PlanCompletePicker({ onPick }) {
|
|
27773
27983
|
const theme = useTheme();
|
|
27774
27984
|
const items = [
|
|
@@ -27776,11 +27986,11 @@ function PlanCompletePicker({ onPick }) {
|
|
|
27776
27986
|
{ label: "\u25B8 Start building and ask for permission (edit mode)", value: "edit", key: "edit" },
|
|
27777
27987
|
{ label: "\u25B8 Continue planning / ask a question", value: "continue", key: "continue" }
|
|
27778
27988
|
];
|
|
27779
|
-
return /* @__PURE__ */
|
|
27780
|
-
/* @__PURE__ */
|
|
27781
|
-
/* @__PURE__ */
|
|
27782
|
-
/* @__PURE__ */
|
|
27783
|
-
|
|
27989
|
+
return /* @__PURE__ */ jsxs40(Box40, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
27990
|
+
/* @__PURE__ */ jsx42(Text41, { color: theme.accent, bold: true, children: "Plan complete \u2014 what next?" }),
|
|
27991
|
+
/* @__PURE__ */ jsx42(Text41, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
27992
|
+
/* @__PURE__ */ jsx42(Box40, { marginTop: 1, children: /* @__PURE__ */ jsx42(
|
|
27993
|
+
SelectInput23,
|
|
27784
27994
|
{
|
|
27785
27995
|
items,
|
|
27786
27996
|
onSelect: (item) => onPick(item.value),
|
|
@@ -27798,7 +28008,7 @@ var init_plan_complete_picker = __esm({
|
|
|
27798
28008
|
});
|
|
27799
28009
|
|
|
27800
28010
|
// src/ui/use-session-manager.ts
|
|
27801
|
-
import { useCallback as useCallback8, useRef as useRef5, useState as
|
|
28011
|
+
import { useCallback as useCallback8, useRef as useRef5, useState as useState26 } from "react";
|
|
27802
28012
|
function extractFirstUserText(messages) {
|
|
27803
28013
|
const firstUser = messages.find((m) => m.role === "user");
|
|
27804
28014
|
if (!firstUser) return "session";
|
|
@@ -27815,9 +28025,9 @@ function useSessionManager(deps) {
|
|
|
27815
28025
|
const sessionIdRef = useRef5(null);
|
|
27816
28026
|
const sessionCreatedAtRef = useRef5(null);
|
|
27817
28027
|
const sessionTitleRef = useRef5(null);
|
|
27818
|
-
const [resumeSessions, setResumeSessions] =
|
|
27819
|
-
const [checkpointSession, setCheckpointSession] =
|
|
27820
|
-
const [checkpointList, setCheckpointList] =
|
|
28028
|
+
const [resumeSessions, setResumeSessions] = useState26(null);
|
|
28029
|
+
const [checkpointSession, setCheckpointSession] = useState26(null);
|
|
28030
|
+
const [checkpointList, setCheckpointList] = useState26([]);
|
|
27821
28031
|
const depsRef = useRef5(deps);
|
|
27822
28032
|
depsRef.current = deps;
|
|
27823
28033
|
const ensureSessionId = useCallback8(() => {
|
|
@@ -27993,26 +28203,26 @@ var init_use_session_manager = __esm({
|
|
|
27993
28203
|
});
|
|
27994
28204
|
|
|
27995
28205
|
// src/ui/use-turn-controller.ts
|
|
27996
|
-
import { useCallback as useCallback9, useRef as useRef6, useState as
|
|
28206
|
+
import { useCallback as useCallback9, useRef as useRef6, useState as useState27 } from "react";
|
|
27997
28207
|
function useTurnController() {
|
|
27998
|
-
const [busy, setBusy] =
|
|
28208
|
+
const [busy, setBusy] = useState27(false);
|
|
27999
28209
|
const busyRef = useRef6(false);
|
|
28000
28210
|
const isAbortingRef = useRef6(false);
|
|
28001
28211
|
const lastEscapeAtRef = useRef6(0);
|
|
28002
28212
|
const supervisorRef = useRef6(new TurnSupervisor());
|
|
28003
|
-
const [turnPhase, setTurnPhase] =
|
|
28004
|
-
const [turnStartedAt, setTurnStartedAt] =
|
|
28005
|
-
const [currentToolName, setCurrentToolName] =
|
|
28006
|
-
const [lastActivityAt, setLastActivityAt] =
|
|
28213
|
+
const [turnPhase, setTurnPhase] = useState27("waiting");
|
|
28214
|
+
const [turnStartedAt, setTurnStartedAt] = useState27(null);
|
|
28215
|
+
const [currentToolName, setCurrentToolName] = useState27(null);
|
|
28216
|
+
const [lastActivityAt, setLastActivityAt] = useState27(null);
|
|
28007
28217
|
const turnCounterRef = useRef6(0);
|
|
28008
|
-
const [showReasoning, setShowReasoning] =
|
|
28218
|
+
const [showReasoning, setShowReasoning] = useState27(false);
|
|
28009
28219
|
const toggleReasoning = useCallback9(() => {
|
|
28010
28220
|
setShowReasoning((s) => !s);
|
|
28011
28221
|
}, []);
|
|
28012
|
-
const [tasks, setTasks] =
|
|
28222
|
+
const [tasks, setTasks] = useState27([]);
|
|
28013
28223
|
const tasksRef = useRef6([]);
|
|
28014
|
-
const [tasksStartedAt, setTasksStartedAt] =
|
|
28015
|
-
const [tasksStartTokens, setTasksStartTokens] =
|
|
28224
|
+
const [tasksStartedAt, setTasksStartedAt] = useState27(null);
|
|
28225
|
+
const [tasksStartTokens, setTasksStartTokens] = useState27(0);
|
|
28016
28226
|
const beginTurn = useCallback9(() => {
|
|
28017
28227
|
setBusy(true);
|
|
28018
28228
|
busyRef.current = true;
|
|
@@ -28218,6 +28428,41 @@ var init_tui_report = __esm({
|
|
|
28218
28428
|
import { join as join32 } from "path";
|
|
28219
28429
|
import { unlink as unlink5 } from "fs/promises";
|
|
28220
28430
|
import QRCode from "qrcode";
|
|
28431
|
+
function executeFreshStart(ctx, planText) {
|
|
28432
|
+
const oldSessionId = ctx.sessionIdRef.current;
|
|
28433
|
+
if (ctx.cacheStableRef.current && ctx.messagesRef.current.length >= 2) {
|
|
28434
|
+
ctx.messagesRef.current = [ctx.messagesRef.current[0], ctx.messagesRef.current[1]];
|
|
28435
|
+
} else {
|
|
28436
|
+
ctx.messagesRef.current = [ctx.messagesRef.current[0]];
|
|
28437
|
+
}
|
|
28438
|
+
ctx.resetSession();
|
|
28439
|
+
ctx.executorRef.current.clearArtifacts();
|
|
28440
|
+
if (ctx.flushTimeoutRef.current) {
|
|
28441
|
+
clearTimeout(ctx.flushTimeoutRef.current);
|
|
28442
|
+
ctx.flushTimeoutRef.current = null;
|
|
28443
|
+
}
|
|
28444
|
+
ctx.pendingTextRef.current.clear();
|
|
28445
|
+
ctx.activeAsstIdRef.current = null;
|
|
28446
|
+
ctx.pendingToolCallsRef.current.clear();
|
|
28447
|
+
ctx.usageRef.current = null;
|
|
28448
|
+
ctx.turnCounterRef.current = 0;
|
|
28449
|
+
ctx.setEvents([]);
|
|
28450
|
+
ctx.setUsage(null);
|
|
28451
|
+
ctx.setSessionUsage(null);
|
|
28452
|
+
ctx.gatewayMetaRef.current = null;
|
|
28453
|
+
ctx.setGatewayMeta(null);
|
|
28454
|
+
ctx.clearTaskTracking();
|
|
28455
|
+
ctx.compactSuggestedRef.current = false;
|
|
28456
|
+
ctx.updateNudgedRef.current = false;
|
|
28457
|
+
ctx.messagesRef.current.push({ role: "user", content: planText });
|
|
28458
|
+
const newSessionId = ctx.ensureSessionId();
|
|
28459
|
+
if (oldSessionId) {
|
|
28460
|
+
void carryOverSessionBaseline(oldSessionId, newSessionId).then(() => {
|
|
28461
|
+
void getCostReport(newSessionId).then((report) => ctx.setSessionUsage(report.session));
|
|
28462
|
+
});
|
|
28463
|
+
}
|
|
28464
|
+
return writeToClipboard(planText);
|
|
28465
|
+
}
|
|
28221
28466
|
function dispatchSlashCommand(ctx, cmd) {
|
|
28222
28467
|
const raw = cmd.trim();
|
|
28223
28468
|
const [head, ...rest] = raw.split(/\s+/);
|
|
@@ -28309,32 +28554,7 @@ var init_slash_commands = __esm({
|
|
|
28309
28554
|
]);
|
|
28310
28555
|
return true;
|
|
28311
28556
|
}
|
|
28312
|
-
const clipResult =
|
|
28313
|
-
if (ctx.cacheStableRef.current && ctx.messagesRef.current.length >= 2) {
|
|
28314
|
-
ctx.messagesRef.current = [ctx.messagesRef.current[0], ctx.messagesRef.current[1]];
|
|
28315
|
-
} else {
|
|
28316
|
-
ctx.messagesRef.current = [ctx.messagesRef.current[0]];
|
|
28317
|
-
}
|
|
28318
|
-
ctx.resetSession();
|
|
28319
|
-
ctx.executorRef.current.clearArtifacts();
|
|
28320
|
-
if (ctx.flushTimeoutRef.current) {
|
|
28321
|
-
clearTimeout(ctx.flushTimeoutRef.current);
|
|
28322
|
-
ctx.flushTimeoutRef.current = null;
|
|
28323
|
-
}
|
|
28324
|
-
ctx.pendingTextRef.current.clear();
|
|
28325
|
-
ctx.activeAsstIdRef.current = null;
|
|
28326
|
-
ctx.pendingToolCallsRef.current.clear();
|
|
28327
|
-
ctx.usageRef.current = null;
|
|
28328
|
-
ctx.turnCounterRef.current = 0;
|
|
28329
|
-
setEvents([]);
|
|
28330
|
-
ctx.setUsage(null);
|
|
28331
|
-
ctx.setSessionUsage(null);
|
|
28332
|
-
ctx.gatewayMetaRef.current = null;
|
|
28333
|
-
ctx.setGatewayMeta(null);
|
|
28334
|
-
ctx.clearTaskTracking();
|
|
28335
|
-
ctx.compactSuggestedRef.current = false;
|
|
28336
|
-
ctx.updateNudgedRef.current = false;
|
|
28337
|
-
ctx.messagesRef.current.push({ role: "user", content: plan });
|
|
28557
|
+
const clipResult = executeFreshStart(ctx, plan);
|
|
28338
28558
|
setEvents((e) => [
|
|
28339
28559
|
...e,
|
|
28340
28560
|
{
|
|
@@ -30726,11 +30946,11 @@ var app_exports = {};
|
|
|
30726
30946
|
__export(app_exports, {
|
|
30727
30947
|
renderApp: () => renderApp
|
|
30728
30948
|
});
|
|
30729
|
-
import
|
|
30730
|
-
import { Box as
|
|
30949
|
+
import React24, { useState as useState28, useRef as useRef7, useEffect as useEffect11, useCallback as useCallback10, useMemo as useMemo6 } from "react";
|
|
30950
|
+
import { Box as Box41, Text as Text42, useApp, useInput as useInput20, render } from "ink";
|
|
30731
30951
|
import { existsSync as existsSync8 } from "fs";
|
|
30732
30952
|
import { join as join37 } from "path";
|
|
30733
|
-
import { jsx as
|
|
30953
|
+
import { jsx as jsx43, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
30734
30954
|
function App({
|
|
30735
30955
|
initialCfg,
|
|
30736
30956
|
initialUpdateResult,
|
|
@@ -30738,14 +30958,14 @@ function App({
|
|
|
30738
30958
|
initialLspProjectPath
|
|
30739
30959
|
}) {
|
|
30740
30960
|
const { exit } = useApp();
|
|
30741
|
-
const [cfg, setCfg] =
|
|
30961
|
+
const [cfg, setCfg] = useState28(initialCfg);
|
|
30742
30962
|
const modelContextLimit = useMemo6(
|
|
30743
30963
|
() => cfg ? getModelOrInfer(cfg.model).contextWindow : CONTEXT_LIMIT,
|
|
30744
30964
|
[cfg?.model]
|
|
30745
30965
|
);
|
|
30746
|
-
const [lspScope, setLspScope] =
|
|
30747
|
-
const [lspProjectPath, setLspProjectPath] =
|
|
30748
|
-
const [events, setRawEvents] =
|
|
30966
|
+
const [lspScope, setLspScope] = useState28(initialLspScope);
|
|
30967
|
+
const [lspProjectPath, setLspProjectPath] = useState28(initialLspProjectPath);
|
|
30968
|
+
const [events, setRawEvents] = useState28([]);
|
|
30749
30969
|
const setEvents = useCallback10(
|
|
30750
30970
|
(updater) => {
|
|
30751
30971
|
setRawEvents((prev) => {
|
|
@@ -30755,9 +30975,9 @@ function App({
|
|
|
30755
30975
|
},
|
|
30756
30976
|
[]
|
|
30757
30977
|
);
|
|
30758
|
-
const [input, setInput] =
|
|
30759
|
-
const [usage, setUsage] =
|
|
30760
|
-
const [sessionUsage, setSessionUsage] =
|
|
30978
|
+
const [input, setInput] = useState28("");
|
|
30979
|
+
const [usage, setUsage] = useState28(null);
|
|
30980
|
+
const [sessionUsage, setSessionUsage] = useState28(null);
|
|
30761
30981
|
useEffect11(() => {
|
|
30762
30982
|
const handler = (sid) => {
|
|
30763
30983
|
if (sessionIdRef.current && sid === sessionIdRef.current) {
|
|
@@ -30769,7 +30989,7 @@ function App({
|
|
|
30769
30989
|
usageEvents.off("update", handler);
|
|
30770
30990
|
};
|
|
30771
30991
|
}, []);
|
|
30772
|
-
const [gatewayMeta, setGatewayMeta] =
|
|
30992
|
+
const [gatewayMeta, setGatewayMeta] = useState28(null);
|
|
30773
30993
|
const turn = useTurnController();
|
|
30774
30994
|
const {
|
|
30775
30995
|
busy,
|
|
@@ -30797,6 +31017,8 @@ function App({
|
|
|
30797
31017
|
endTurn,
|
|
30798
31018
|
clearTaskTracking
|
|
30799
31019
|
} = turn;
|
|
31020
|
+
const [planOptions, setPlanOptions] = useState28(null);
|
|
31021
|
+
const planOptionsRef = useRef7(null);
|
|
30800
31022
|
const {
|
|
30801
31023
|
pending: perm,
|
|
30802
31024
|
askPermission: askForPermission,
|
|
@@ -30865,36 +31087,36 @@ function App({
|
|
|
30865
31087
|
hasFullscreenModal,
|
|
30866
31088
|
hasAnyModal
|
|
30867
31089
|
} = modals;
|
|
30868
|
-
const [queue2, setQueue] =
|
|
30869
|
-
const [history, setHistory] =
|
|
30870
|
-
const [historyIndex, setHistoryIndex] =
|
|
30871
|
-
const [draftInput, setDraftInput] =
|
|
30872
|
-
const [mode, setMode] =
|
|
31090
|
+
const [queue2, setQueue] = useState28([]);
|
|
31091
|
+
const [history, setHistory] = useState28([]);
|
|
31092
|
+
const [historyIndex, setHistoryIndex] = useState28(-1);
|
|
31093
|
+
const [draftInput, setDraftInput] = useState28("");
|
|
31094
|
+
const [mode, setMode] = useState28("edit");
|
|
30873
31095
|
useEffect11(() => {
|
|
30874
31096
|
if (mode === "multi-agent-experimental" && cfg && !cfg.workerEndpoint && !cfg.remoteWorkerUrl && !showMultiAgentModal) {
|
|
30875
31097
|
setShowMultiAgentModal(true);
|
|
30876
31098
|
}
|
|
30877
31099
|
}, [mode, cfg?.workerEndpoint, cfg?.remoteWorkerUrl]);
|
|
30878
|
-
const [codeMode, setCodeMode] =
|
|
31100
|
+
const [codeMode, setCodeMode] = useState28(false);
|
|
30879
31101
|
const filePickerEnabled = initialCfg?.filePicker ?? true;
|
|
30880
|
-
const [effort, setEffort] =
|
|
31102
|
+
const [effort, setEffort] = useState28(
|
|
30881
31103
|
initialCfg?.reasoningEffort ?? DEFAULT_REASONING_EFFORT
|
|
30882
31104
|
);
|
|
30883
|
-
const [selectedRemoteSession, setSelectedRemoteSession] =
|
|
30884
|
-
const [verbose, setVerbose] =
|
|
30885
|
-
const [hasUpdate, setHasUpdate] =
|
|
30886
|
-
const [latestVersion, setLatestVersion] =
|
|
30887
|
-
const [theme, setTheme] =
|
|
30888
|
-
const [originalTheme, setOriginalTheme] =
|
|
30889
|
-
const [skillsActive, setSkillsActive] =
|
|
30890
|
-
const [memoryRecalled, setMemoryRecalled] =
|
|
30891
|
-
const [intentTier, setIntentTier] =
|
|
30892
|
-
const [kimiMdStale, setKimiMdStale] =
|
|
30893
|
-
const [gitBranch, setGitBranch] =
|
|
30894
|
-
const [lastSessionTopic, setLastSessionTopic] =
|
|
30895
|
-
const [activeWorkers, setActiveWorkers] =
|
|
30896
|
-
const [isSynthesizing, setIsSynthesizing] =
|
|
30897
|
-
const [coordinatorNarration, setCoordinatorNarration] =
|
|
31105
|
+
const [selectedRemoteSession, setSelectedRemoteSession] = useState28(null);
|
|
31106
|
+
const [verbose, setVerbose] = useState28(false);
|
|
31107
|
+
const [hasUpdate, setHasUpdate] = useState28(initialUpdateResult?.hasUpdate ?? false);
|
|
31108
|
+
const [latestVersion, setLatestVersion] = useState28(initialUpdateResult?.latestVersion ?? null);
|
|
31109
|
+
const [theme, setTheme] = useState28(resolveTheme(initialCfg?.theme));
|
|
31110
|
+
const [originalTheme, setOriginalTheme] = useState28(null);
|
|
31111
|
+
const [skillsActive, setSkillsActive] = useState28(0);
|
|
31112
|
+
const [memoryRecalled, setMemoryRecalled] = useState28(false);
|
|
31113
|
+
const [intentTier, setIntentTier] = useState28(null);
|
|
31114
|
+
const [kimiMdStale, setKimiMdStale] = useState28(false);
|
|
31115
|
+
const [gitBranch, setGitBranch] = useState28(null);
|
|
31116
|
+
const [lastSessionTopic, setLastSessionTopic] = useState28(null);
|
|
31117
|
+
const [activeWorkers, setActiveWorkers] = useState28([]);
|
|
31118
|
+
const [isSynthesizing, setIsSynthesizing] = useState28(false);
|
|
31119
|
+
const [coordinatorNarration, setCoordinatorNarration] = useState28("");
|
|
30898
31120
|
useEffect11(() => {
|
|
30899
31121
|
setGitBranch(detectGitBranch());
|
|
30900
31122
|
}, []);
|
|
@@ -30944,8 +31166,8 @@ ${wcagWarnings.join("\n")}` }
|
|
|
30944
31166
|
cancelled = true;
|
|
30945
31167
|
};
|
|
30946
31168
|
}, []);
|
|
30947
|
-
const [cursorOffset, setCursorOffset] =
|
|
30948
|
-
const [customCommandsVersion, setCustomCommandsVersion] =
|
|
31169
|
+
const [cursorOffset, setCursorOffset] = useState28(0);
|
|
31170
|
+
const [customCommandsVersion, setCustomCommandsVersion] = useState28(0);
|
|
30949
31171
|
const cacheStableRef = useRef7(initialCfg?.cacheStablePrompts !== false);
|
|
30950
31172
|
const messagesRef = useRef7(
|
|
30951
31173
|
makePrefixMessages(cacheStableRef.current, cfg?.model ?? DEFAULT_MODEL, "edit", ALL_TOOLS)
|
|
@@ -31023,7 +31245,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
31023
31245
|
const customCommandsRef = useRef7([]);
|
|
31024
31246
|
const recentFilesRef = useRef7(/* @__PURE__ */ new Map());
|
|
31025
31247
|
const MAX_RECENT_FILES = 10;
|
|
31026
|
-
const allSlashCommands =
|
|
31248
|
+
const allSlashCommands = React24.useMemo(() => {
|
|
31027
31249
|
const customs = customCommandsRef.current.filter((c) => !BUILTIN_COMMAND_NAMES.has(c.name.toLowerCase())).map((c) => ({
|
|
31028
31250
|
name: c.name,
|
|
31029
31251
|
description: c.description ?? "",
|
|
@@ -31389,7 +31611,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
31389
31611
|
[cfg]
|
|
31390
31612
|
);
|
|
31391
31613
|
const interruptDepsRef = useRef7(null);
|
|
31392
|
-
|
|
31614
|
+
useInput20((inputChar, key) => {
|
|
31393
31615
|
if (key.ctrl && inputChar === "c") {
|
|
31394
31616
|
logger.info("input:ctrl+c", {
|
|
31395
31617
|
busy: busyRef.current,
|
|
@@ -31411,7 +31633,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
31411
31633
|
}
|
|
31412
31634
|
if (key.escape) {
|
|
31413
31635
|
const now2 = Date.now();
|
|
31414
|
-
const modalOpen = perm !== null || limitModal !== null || loopModal !== null || showLspWizard || showCommandList || commandWizard !== null || commandToDelete !== null || resumeSessions !== null || checkpointSession !== null || showThemePicker;
|
|
31636
|
+
const modalOpen = perm !== null || limitModal !== null || loopModal !== null || showLspWizard || showCommandList || commandWizard !== null || commandToDelete !== null || resumeSessions !== null || checkpointSession !== null || planOptions !== null || showThemePicker;
|
|
31415
31637
|
if (!modalOpen && !isAbortingRef.current && now2 - lastEscapeAtRef.current > 500) {
|
|
31416
31638
|
if (multiAgentAbortRef.current) {
|
|
31417
31639
|
lastEscapeAtRef.current = now2;
|
|
@@ -32355,6 +32577,9 @@ ${conflicts.join("\n")}` }
|
|
|
32355
32577
|
setTasksStartTokens(0);
|
|
32356
32578
|
}
|
|
32357
32579
|
},
|
|
32580
|
+
onPlanOptions: (options) => {
|
|
32581
|
+
planOptionsRef.current = options;
|
|
32582
|
+
},
|
|
32358
32583
|
askPermission: askForPermission,
|
|
32359
32584
|
onToolLimitReached: () => new Promise((resolve5) => {
|
|
32360
32585
|
limitResolveRef.current = resolve5;
|
|
@@ -32583,6 +32808,9 @@ ${conflicts.join("\n")}` }
|
|
|
32583
32808
|
setShowPlanCompletePicker(true);
|
|
32584
32809
|
}
|
|
32585
32810
|
}
|
|
32811
|
+
if (planOptionsRef.current) {
|
|
32812
|
+
setPlanOptions(planOptionsRef.current);
|
|
32813
|
+
}
|
|
32586
32814
|
},
|
|
32587
32815
|
onError: async (e) => {
|
|
32588
32816
|
if (e.name === "AbortError") {
|
|
@@ -32677,7 +32905,7 @@ ${conflicts.join("\n")}` }
|
|
|
32677
32905
|
});
|
|
32678
32906
|
}, [usage, modelContextLimit, busy, runCompact2]);
|
|
32679
32907
|
if (!cfg) {
|
|
32680
|
-
return /* @__PURE__ */
|
|
32908
|
+
return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsx43(
|
|
32681
32909
|
Onboarding,
|
|
32682
32910
|
{
|
|
32683
32911
|
onCancel: () => exit(),
|
|
@@ -32691,8 +32919,38 @@ ${conflicts.join("\n")}` }
|
|
|
32691
32919
|
}
|
|
32692
32920
|
) });
|
|
32693
32921
|
}
|
|
32922
|
+
if (planOptions !== null) {
|
|
32923
|
+
return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsx43(Box41, { flexDirection: "column", children: /* @__PURE__ */ jsx43(
|
|
32924
|
+
PlanOptionsPicker,
|
|
32925
|
+
{
|
|
32926
|
+
options: planOptions,
|
|
32927
|
+
onPick: (option) => {
|
|
32928
|
+
setPlanOptions(null);
|
|
32929
|
+
planOptionsRef.current = null;
|
|
32930
|
+
if (option) {
|
|
32931
|
+
const ctx = buildSlashContext();
|
|
32932
|
+
const clipResult = executeFreshStart(ctx, option.plan);
|
|
32933
|
+
setEvents((e) => [
|
|
32934
|
+
...e,
|
|
32935
|
+
{
|
|
32936
|
+
kind: "info",
|
|
32937
|
+
key: mkKey(),
|
|
32938
|
+
text: clipResult.success ? `Plan "${option.label}" copied to clipboard. Starting fresh session with plan only\u2026` : `Starting fresh session with plan "${option.label}"\u2026`
|
|
32939
|
+
}
|
|
32940
|
+
]);
|
|
32941
|
+
if (!clipResult.success) {
|
|
32942
|
+
setEvents((e) => [
|
|
32943
|
+
...e,
|
|
32944
|
+
{ kind: "info", key: mkKey(), text: "--- Plan ---\n" + option.plan }
|
|
32945
|
+
]);
|
|
32946
|
+
}
|
|
32947
|
+
}
|
|
32948
|
+
}
|
|
32949
|
+
}
|
|
32950
|
+
) }) });
|
|
32951
|
+
}
|
|
32694
32952
|
if (checkpointSession !== null) {
|
|
32695
|
-
return /* @__PURE__ */
|
|
32953
|
+
return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsx43(Box41, { flexDirection: "column", children: /* @__PURE__ */ jsx43(
|
|
32696
32954
|
CheckpointPicker,
|
|
32697
32955
|
{
|
|
32698
32956
|
session: checkpointSession,
|
|
@@ -32702,10 +32960,10 @@ ${conflicts.join("\n")}` }
|
|
|
32702
32960
|
) }) });
|
|
32703
32961
|
}
|
|
32704
32962
|
if (resumeSessions !== null) {
|
|
32705
|
-
return /* @__PURE__ */
|
|
32963
|
+
return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsx43(Box41, { flexDirection: "column", children: /* @__PURE__ */ jsx43(ResumePicker, { sessions: resumeSessions, onPick: handleResumePick }) }) });
|
|
32706
32964
|
}
|
|
32707
32965
|
if (hasFullscreenModal) {
|
|
32708
|
-
return /* @__PURE__ */
|
|
32966
|
+
return /* @__PURE__ */ jsx43(
|
|
32709
32967
|
ModalHost,
|
|
32710
32968
|
{
|
|
32711
32969
|
modals,
|
|
@@ -32849,9 +33107,9 @@ ${conflicts.join("\n")}` }
|
|
|
32849
33107
|
);
|
|
32850
33108
|
}
|
|
32851
33109
|
const hasConversation = events.some((e) => e.kind === "user" || e.kind === "assistant");
|
|
32852
|
-
return /* @__PURE__ */
|
|
32853
|
-
!hasConversation && events.length === 0 ? /* @__PURE__ */
|
|
32854
|
-
perm ? /* @__PURE__ */
|
|
33110
|
+
return /* @__PURE__ */ jsx43(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs41(Box41, { flexDirection: "column", children: [
|
|
33111
|
+
!hasConversation && events.length === 0 ? /* @__PURE__ */ jsx43(Welcome, {}) : /* @__PURE__ */ jsx43(ChatView, { events, showReasoning, verbose, intentTier: intentTier ?? void 0 }),
|
|
33112
|
+
perm ? /* @__PURE__ */ jsx43(
|
|
32855
33113
|
PermissionModal,
|
|
32856
33114
|
{
|
|
32857
33115
|
tool: perm.tool,
|
|
@@ -32861,7 +33119,7 @@ ${conflicts.join("\n")}` }
|
|
|
32861
33119
|
submitRef.current(text);
|
|
32862
33120
|
}
|
|
32863
33121
|
}
|
|
32864
|
-
) : limitModal || loopModal ? /* @__PURE__ */
|
|
33122
|
+
) : limitModal || loopModal ? /* @__PURE__ */ jsx43(
|
|
32865
33123
|
ModalOverlay,
|
|
32866
33124
|
{
|
|
32867
33125
|
modals,
|
|
@@ -32872,9 +33130,9 @@ ${conflicts.join("\n")}` }
|
|
|
32872
33130
|
loopResolveRef.current = null;
|
|
32873
33131
|
}
|
|
32874
33132
|
}
|
|
32875
|
-
) : showPlanCompletePicker ? /* @__PURE__ */
|
|
32876
|
-
(activeWorkers.length > 0 || coordinatorNarration) && /* @__PURE__ */
|
|
32877
|
-
tasks.length > 0 && /* @__PURE__ */
|
|
33133
|
+
) : showPlanCompletePicker ? /* @__PURE__ */ jsx43(PlanCompletePicker, { onPick: handlePlanCompletePick }) : /* @__PURE__ */ jsxs41(Box41, { flexDirection: "column", marginTop: 1, children: [
|
|
33134
|
+
(activeWorkers.length > 0 || coordinatorNarration) && /* @__PURE__ */ jsx43(WorkerList, { workers: activeWorkers, isSynthesizing, narration: coordinatorNarration }),
|
|
33135
|
+
tasks.length > 0 && /* @__PURE__ */ jsx43(
|
|
32878
33136
|
TaskList,
|
|
32879
33137
|
{
|
|
32880
33138
|
tasks,
|
|
@@ -32882,11 +33140,11 @@ ${conflicts.join("\n")}` }
|
|
|
32882
33140
|
tokensDelta: Math.max(0, (usage?.prompt_tokens ?? 0) - tasksStartTokens)
|
|
32883
33141
|
}
|
|
32884
33142
|
),
|
|
32885
|
-
queue2.length > 0 && /* @__PURE__ */
|
|
33143
|
+
queue2.length > 0 && /* @__PURE__ */ jsx43(Box41, { flexDirection: "column", marginBottom: 1, children: queue2.map((q, i) => /* @__PURE__ */ jsxs41(Text42, { color: theme.info.color, dimColor: theme.info.dim, children: [
|
|
32886
33144
|
"\u23F3 ",
|
|
32887
33145
|
q.display
|
|
32888
33146
|
] }, `queue_${i}`)) }),
|
|
32889
|
-
/* @__PURE__ */
|
|
33147
|
+
/* @__PURE__ */ jsx43(
|
|
32890
33148
|
StatusBar,
|
|
32891
33149
|
{
|
|
32892
33150
|
usage,
|
|
@@ -32908,7 +33166,7 @@ ${conflicts.join("\n")}` }
|
|
|
32908
33166
|
intentTier: intentTier ?? void 0
|
|
32909
33167
|
}
|
|
32910
33168
|
),
|
|
32911
|
-
picker.active?.kind === "file" && /* @__PURE__ */
|
|
33169
|
+
picker.active?.kind === "file" && /* @__PURE__ */ jsx43(
|
|
32912
33170
|
FilePicker,
|
|
32913
33171
|
{
|
|
32914
33172
|
items: picker.fileItems,
|
|
@@ -32917,7 +33175,7 @@ ${conflicts.join("\n")}` }
|
|
|
32917
33175
|
recentFiles: new Set(recentFilesRef.current.keys())
|
|
32918
33176
|
}
|
|
32919
33177
|
),
|
|
32920
|
-
picker.active?.kind === "slash" && /* @__PURE__ */
|
|
33178
|
+
picker.active?.kind === "slash" && /* @__PURE__ */ jsx43(
|
|
32921
33179
|
SlashPicker,
|
|
32922
33180
|
{
|
|
32923
33181
|
items: picker.slashItems,
|
|
@@ -32925,9 +33183,9 @@ ${conflicts.join("\n")}` }
|
|
|
32925
33183
|
query: picker.query
|
|
32926
33184
|
}
|
|
32927
33185
|
),
|
|
32928
|
-
/* @__PURE__ */
|
|
32929
|
-
/* @__PURE__ */
|
|
32930
|
-
/* @__PURE__ */
|
|
33186
|
+
/* @__PURE__ */ jsxs41(Box41, { marginTop: 1, children: [
|
|
33187
|
+
/* @__PURE__ */ jsx43(Text42, { color: theme.prompt ?? theme.accent, children: "\u203A " }),
|
|
33188
|
+
/* @__PURE__ */ jsx43(
|
|
32931
33189
|
CustomTextInput,
|
|
32932
33190
|
{
|
|
32933
33191
|
value: input,
|
|
@@ -32984,7 +33242,7 @@ ${conflicts.join("\n")}` }
|
|
|
32984
33242
|
}
|
|
32985
33243
|
async function renderApp(cfg, updateResult, lspScope = "global", lspProjectPath = null) {
|
|
32986
33244
|
const instance = render(
|
|
32987
|
-
/* @__PURE__ */
|
|
33245
|
+
/* @__PURE__ */ jsx43(
|
|
32988
33246
|
App,
|
|
32989
33247
|
{
|
|
32990
33248
|
initialCfg: cfg,
|
|
@@ -33029,6 +33287,7 @@ var init_app = __esm({
|
|
|
33029
33287
|
init_use_permission_controller();
|
|
33030
33288
|
init_resume_picker();
|
|
33031
33289
|
init_checkpoint_picker();
|
|
33290
|
+
init_plan_options_picker();
|
|
33032
33291
|
init_task_list();
|
|
33033
33292
|
init_worker_list();
|
|
33034
33293
|
init_text_input();
|