kimiflare 0.61.0 → 0.63.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 +605 -638
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -11244,6 +11244,12 @@ var init_chat = __esm({
|
|
|
11244
11244
|
if (evt.kind === "service_ended") {
|
|
11245
11245
|
return /* @__PURE__ */ jsx8(ServiceEndedMessage, { endedAt: evt.endedAt });
|
|
11246
11246
|
}
|
|
11247
|
+
if (evt.kind === "qrcode") {
|
|
11248
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginY: 1, children: [
|
|
11249
|
+
/* @__PURE__ */ jsx8(Text7, { color: theme.info.color, children: evt.caption }),
|
|
11250
|
+
/* @__PURE__ */ jsx8(Box7, { flexDirection: "column", marginTop: 1, children: evt.lines.map((line, i) => /* @__PURE__ */ jsx8(Text7, { children: line }, i)) })
|
|
11251
|
+
] });
|
|
11252
|
+
}
|
|
11247
11253
|
return /* @__PURE__ */ jsxs7(Text7, { color: theme.error, children: [
|
|
11248
11254
|
"! ",
|
|
11249
11255
|
evt.text
|
|
@@ -12699,88 +12705,16 @@ var init_task_list = __esm({
|
|
|
12699
12705
|
});
|
|
12700
12706
|
|
|
12701
12707
|
// src/ui/onboarding.tsx
|
|
12702
|
-
import { useState as useState8,
|
|
12708
|
+
import { useState as useState8, useCallback as useCallback2 } from "react";
|
|
12703
12709
|
import { Box as Box14, Text as Text15, useInput as useInput5 } from "ink";
|
|
12704
|
-
import SelectInput4 from "ink-select-input";
|
|
12705
|
-
import Spinner5 from "ink-spinner";
|
|
12706
|
-
import { exec } from "child_process";
|
|
12707
|
-
import { promisify as promisify2 } from "util";
|
|
12708
12710
|
import { Fragment, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
12709
|
-
function openBrowser(url) {
|
|
12710
|
-
const platform5 = process.platform;
|
|
12711
|
-
const cmd = platform5 === "darwin" ? `open "${url}"` : platform5 === "win32" ? `start "" "${url}"` : `xdg-open "${url}"`;
|
|
12712
|
-
exec(cmd, (err) => {
|
|
12713
|
-
if (err) {
|
|
12714
|
-
}
|
|
12715
|
-
});
|
|
12716
|
-
}
|
|
12717
|
-
function formatRemaining(ms) {
|
|
12718
|
-
const totalSeconds = Math.ceil(ms / 1e3);
|
|
12719
|
-
const mins = Math.floor(totalSeconds / 60);
|
|
12720
|
-
const secs = totalSeconds % 60;
|
|
12721
|
-
return `${mins}:${secs.toString().padStart(2, "0")}`;
|
|
12722
|
-
}
|
|
12723
12711
|
function Onboarding({ onDone, onCancel }) {
|
|
12724
12712
|
const theme = useTheme();
|
|
12725
|
-
const [step, setStep] = useState8("
|
|
12726
|
-
const [mode, setMode] = useState8("byok");
|
|
12713
|
+
const [step, setStep] = useState8("accountId");
|
|
12727
12714
|
const [accountId, setAccountId] = useState8("");
|
|
12728
12715
|
const [apiToken, setApiToken] = useState8("");
|
|
12729
12716
|
const [model, setModel] = useState8(DEFAULT_MODEL);
|
|
12730
12717
|
const [savedPath, setSavedPath] = useState8(null);
|
|
12731
|
-
const [cloudAuth, setCloudAuth] = useState8(null);
|
|
12732
|
-
const [pollTick, setPollTick] = useState8(0);
|
|
12733
|
-
useEffect5(() => {
|
|
12734
|
-
if (step !== "cloudAuth" || !cloudAuth) return;
|
|
12735
|
-
if (cloudAuth.phase !== "polling") return;
|
|
12736
|
-
let cancelled = false;
|
|
12737
|
-
const tick = setInterval(() => {
|
|
12738
|
-
setPollTick((t) => t + 1);
|
|
12739
|
-
}, 1e3);
|
|
12740
|
-
const poll = async () => {
|
|
12741
|
-
while (!cancelled) {
|
|
12742
|
-
const elapsed = Date.now() - cloudAuth.startTime;
|
|
12743
|
-
if (elapsed >= POLL_TIMEOUT_MS) {
|
|
12744
|
-
if (!cancelled) {
|
|
12745
|
-
setCloudAuth({ phase: "error", message: "Authentication timed out. Please try again." });
|
|
12746
|
-
}
|
|
12747
|
-
return;
|
|
12748
|
-
}
|
|
12749
|
-
try {
|
|
12750
|
-
const creds = await pollForToken(cloudAuth.codes.deviceCode, cloudAuth.codes.deviceId);
|
|
12751
|
-
if (creds && !cancelled) {
|
|
12752
|
-
const usage = await fetchCloudUsage(creds.accessToken, creds.deviceId);
|
|
12753
|
-
if (usage && !cancelled) {
|
|
12754
|
-
setCloudAuth({
|
|
12755
|
-
phase: "success",
|
|
12756
|
-
creds,
|
|
12757
|
-
usage
|
|
12758
|
-
});
|
|
12759
|
-
} else if (!cancelled) {
|
|
12760
|
-
setCloudAuth({ phase: "error", message: "Authenticated but failed to fetch usage." });
|
|
12761
|
-
}
|
|
12762
|
-
return;
|
|
12763
|
-
}
|
|
12764
|
-
} catch (err) {
|
|
12765
|
-
if (isKillSwitchError(err)) {
|
|
12766
|
-
if (!cancelled) {
|
|
12767
|
-
setCloudAuth({
|
|
12768
|
-
phase: "error",
|
|
12769
|
-
message: "KimiFlare Cloud has reached its maximum budget across all users. The free credits period has ended. Switch to BYOK mode to continue using KimiFlare."
|
|
12770
|
-
});
|
|
12771
|
-
}
|
|
12772
|
-
return;
|
|
12773
|
-
}
|
|
12774
|
-
}
|
|
12775
|
-
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
12776
|
-
}
|
|
12777
|
-
};
|
|
12778
|
-
poll();
|
|
12779
|
-
return () => {
|
|
12780
|
-
cancelled = true;
|
|
12781
|
-
clearInterval(tick);
|
|
12782
|
-
};
|
|
12783
|
-
}, [step, cloudAuth]);
|
|
12784
12718
|
useInput5(
|
|
12785
12719
|
useCallback2(
|
|
12786
12720
|
(_input, key) => {
|
|
@@ -12791,55 +12725,6 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12791
12725
|
[onCancel]
|
|
12792
12726
|
)
|
|
12793
12727
|
);
|
|
12794
|
-
const startCloudAuth = useCallback2(async () => {
|
|
12795
|
-
try {
|
|
12796
|
-
const codes = await generateDeviceCodes();
|
|
12797
|
-
await registerDevice(codes);
|
|
12798
|
-
setCloudAuth({ phase: "ready", codes });
|
|
12799
|
-
setStep("cloudAuth");
|
|
12800
|
-
} catch (err) {
|
|
12801
|
-
setCloudAuth({
|
|
12802
|
-
phase: "error",
|
|
12803
|
-
message: err instanceof Error ? err.message : "Failed to start authentication"
|
|
12804
|
-
});
|
|
12805
|
-
setStep("cloudAuth");
|
|
12806
|
-
}
|
|
12807
|
-
}, []);
|
|
12808
|
-
const handleModeSelect = (item) => {
|
|
12809
|
-
if (item.value === "cloud") {
|
|
12810
|
-
setMode("cloud");
|
|
12811
|
-
void startCloudAuth();
|
|
12812
|
-
} else {
|
|
12813
|
-
setMode("byok");
|
|
12814
|
-
setStep("accountId");
|
|
12815
|
-
}
|
|
12816
|
-
};
|
|
12817
|
-
const handleOpenBrowser = () => {
|
|
12818
|
-
if (cloudAuth?.phase === "ready") {
|
|
12819
|
-
openBrowser(cloudAuth.codes.authUrl);
|
|
12820
|
-
setCloudAuth({ phase: "polling", codes: cloudAuth.codes, startTime: Date.now() });
|
|
12821
|
-
}
|
|
12822
|
-
};
|
|
12823
|
-
const handleCloudSuccess = async () => {
|
|
12824
|
-
if (cloudAuth?.phase !== "success") return;
|
|
12825
|
-
const cfg = { accountId: "", apiToken: "", model: DEFAULT_MODEL, cloudMode: true };
|
|
12826
|
-
try {
|
|
12827
|
-
const path = await saveConfig(cfg);
|
|
12828
|
-
setSavedPath(path);
|
|
12829
|
-
onDone(cfg, cloudAuth.creds);
|
|
12830
|
-
} catch (e) {
|
|
12831
|
-
setSavedPath(`error: ${e.message}`);
|
|
12832
|
-
}
|
|
12833
|
-
};
|
|
12834
|
-
const handleCloudRetry = () => {
|
|
12835
|
-
setCloudAuth(null);
|
|
12836
|
-
void startCloudAuth();
|
|
12837
|
-
};
|
|
12838
|
-
const handleCloudSwitchToByok = () => {
|
|
12839
|
-
setCloudAuth(null);
|
|
12840
|
-
setMode("byok");
|
|
12841
|
-
setStep("accountId");
|
|
12842
|
-
};
|
|
12843
12728
|
const handleAccountIdSubmit = (value) => {
|
|
12844
12729
|
const trimmed = value.trim();
|
|
12845
12730
|
if (!trimmed) return;
|
|
@@ -12867,9 +12752,9 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12867
12752
|
setSavedPath(`error: ${e.message}`);
|
|
12868
12753
|
}
|
|
12869
12754
|
};
|
|
12870
|
-
const
|
|
12871
|
-
const stepIndex =
|
|
12872
|
-
const totalSteps =
|
|
12755
|
+
const steps = ["accountId", "apiToken", "model", "confirm"];
|
|
12756
|
+
const stepIndex = steps.indexOf(step) + 1;
|
|
12757
|
+
const totalSteps = steps.length;
|
|
12873
12758
|
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingY: 1, children: [
|
|
12874
12759
|
/* @__PURE__ */ jsxs14(Box14, { marginBottom: 1, children: [
|
|
12875
12760
|
/* @__PURE__ */ jsx16(Text15, { bold: true, color: theme.palette.primary, children: "kimiflare" }),
|
|
@@ -12885,111 +12770,6 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12885
12770
|
totalSteps
|
|
12886
12771
|
] }),
|
|
12887
12772
|
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
|
|
12888
|
-
step === "mode" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12889
|
-
/* @__PURE__ */ jsx16(Text15, { children: "How do you want to connect?" }),
|
|
12890
|
-
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(
|
|
12891
|
-
SelectInput4,
|
|
12892
|
-
{
|
|
12893
|
-
items: [
|
|
12894
|
-
{ label: "Cloud (managed) \u2014 no API key needed", value: "cloud" },
|
|
12895
|
-
{ label: "BYOK \u2014 bring your own Cloudflare key", value: "byok" }
|
|
12896
|
-
],
|
|
12897
|
-
onSelect: handleModeSelect
|
|
12898
|
-
}
|
|
12899
|
-
) })
|
|
12900
|
-
] }),
|
|
12901
|
-
step === "cloudAuth" && cloudAuth?.phase === "ready" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12902
|
-
/* @__PURE__ */ jsx16(Text15, { children: "Authenticating with Kimiflare Cloud..." }),
|
|
12903
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
|
|
12904
|
-
/* @__PURE__ */ jsx16(Text15, { children: "1. Open this URL in your browser:" }),
|
|
12905
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.primary, children: cloudAuth.codes.authUrl })
|
|
12906
|
-
] }),
|
|
12907
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
12908
|
-
/* @__PURE__ */ jsx16(Text15, { children: "2. " }),
|
|
12909
|
-
/* @__PURE__ */ jsx16(Text15, { bold: true, children: "[Press Enter to open browser]" })
|
|
12910
|
-
] }),
|
|
12911
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
12912
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.primary, children: "\u203A " }),
|
|
12913
|
-
/* @__PURE__ */ jsx16(
|
|
12914
|
-
CustomTextInput,
|
|
12915
|
-
{
|
|
12916
|
-
value: "",
|
|
12917
|
-
onChange: () => {
|
|
12918
|
-
},
|
|
12919
|
-
onSubmit: handleOpenBrowser
|
|
12920
|
-
}
|
|
12921
|
-
)
|
|
12922
|
-
] })
|
|
12923
|
-
] }),
|
|
12924
|
-
step === "cloudAuth" && cloudAuth?.phase === "polling" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12925
|
-
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
12926
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.spinner, children: /* @__PURE__ */ jsx16(Spinner5, { type: "dots" }) }),
|
|
12927
|
-
" ",
|
|
12928
|
-
"Waiting for authentication..."
|
|
12929
|
-
] }),
|
|
12930
|
-
/* @__PURE__ */ jsxs14(Text15, { color: theme.info.color, children: [
|
|
12931
|
-
"Expires in ",
|
|
12932
|
-
formatRemaining(POLL_TIMEOUT_MS - (Date.now() - cloudAuth.startTime))
|
|
12933
|
-
] }),
|
|
12934
|
-
/* @__PURE__ */ jsxs14(Text15, { color: theme.info.color, children: [
|
|
12935
|
-
"URL: ",
|
|
12936
|
-
cloudAuth.codes.authUrl
|
|
12937
|
-
] })
|
|
12938
|
-
] }),
|
|
12939
|
-
step === "cloudAuth" && cloudAuth?.phase === "success" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12940
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.success, children: "Authenticated!" }),
|
|
12941
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
|
|
12942
|
-
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
12943
|
-
"Token budget:",
|
|
12944
|
-
" ",
|
|
12945
|
-
/* @__PURE__ */ jsxs14(Text15, { bold: true, children: [
|
|
12946
|
-
cloudAuth.usage.remaining.toLocaleString(),
|
|
12947
|
-
" /",
|
|
12948
|
-
" ",
|
|
12949
|
-
cloudAuth.usage.input_token_limit.toLocaleString()
|
|
12950
|
-
] }),
|
|
12951
|
-
" ",
|
|
12952
|
-
"remaining"
|
|
12953
|
-
] }),
|
|
12954
|
-
/* @__PURE__ */ jsxs14(Text15, { color: theme.info.color, children: [
|
|
12955
|
-
"Grant expires: ",
|
|
12956
|
-
cloudAuth.usage.expires_at
|
|
12957
|
-
] }),
|
|
12958
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.info.color, children: "Or when the global pool of free tokens runs out." })
|
|
12959
|
-
] }),
|
|
12960
|
-
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text15, { children: "[Press Enter to continue]" }) }),
|
|
12961
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
12962
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.primary, children: "\u203A " }),
|
|
12963
|
-
/* @__PURE__ */ jsx16(
|
|
12964
|
-
CustomTextInput,
|
|
12965
|
-
{
|
|
12966
|
-
value: "",
|
|
12967
|
-
onChange: () => {
|
|
12968
|
-
},
|
|
12969
|
-
onSubmit: handleCloudSuccess
|
|
12970
|
-
}
|
|
12971
|
-
)
|
|
12972
|
-
] })
|
|
12973
|
-
] }),
|
|
12974
|
-
step === "cloudAuth" && cloudAuth?.phase === "error" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12975
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.error, children: "Authentication failed" }),
|
|
12976
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.info.color, children: cloudAuth.message }),
|
|
12977
|
-
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(
|
|
12978
|
-
SelectInput4,
|
|
12979
|
-
{
|
|
12980
|
-
items: [
|
|
12981
|
-
{ label: "Retry", value: "retry" },
|
|
12982
|
-
{ label: "Switch to BYOK", value: "byok" },
|
|
12983
|
-
{ label: "Cancel", value: "cancel" }
|
|
12984
|
-
],
|
|
12985
|
-
onSelect: (item) => {
|
|
12986
|
-
if (item.value === "retry") handleCloudRetry();
|
|
12987
|
-
else if (item.value === "byok") handleCloudSwitchToByok();
|
|
12988
|
-
else if (onCancel) onCancel();
|
|
12989
|
-
}
|
|
12990
|
-
}
|
|
12991
|
-
) })
|
|
12992
|
-
] }),
|
|
12993
12773
|
step === "accountId" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12994
12774
|
/* @__PURE__ */ jsx16(Text15, { children: "Enter your Cloudflare Account ID" }),
|
|
12995
12775
|
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
@@ -13086,16 +12866,12 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
13086
12866
|
] })
|
|
13087
12867
|
] });
|
|
13088
12868
|
}
|
|
13089
|
-
var execAsync;
|
|
13090
12869
|
var init_onboarding = __esm({
|
|
13091
12870
|
"src/ui/onboarding.tsx"() {
|
|
13092
12871
|
"use strict";
|
|
13093
12872
|
init_text_input();
|
|
13094
12873
|
init_config();
|
|
13095
12874
|
init_theme_context();
|
|
13096
|
-
init_auth();
|
|
13097
|
-
init_errors();
|
|
13098
|
-
execAsync = promisify2(exec);
|
|
13099
12875
|
}
|
|
13100
12876
|
});
|
|
13101
12877
|
|
|
@@ -13256,9 +13032,9 @@ var init_worker_client = __esm({
|
|
|
13256
13032
|
});
|
|
13257
13033
|
|
|
13258
13034
|
// src/ui/remote-dashboard.tsx
|
|
13259
|
-
import { useEffect as
|
|
13035
|
+
import { useEffect as useEffect5, useState as useState9 } from "react";
|
|
13260
13036
|
import { Box as Box16, Text as Text17, useInput as useInput6 } from "ink";
|
|
13261
|
-
import
|
|
13037
|
+
import SelectInput4 from "ink-select-input";
|
|
13262
13038
|
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
13263
13039
|
function RemoteDashboard({ onSelect, onCancel }) {
|
|
13264
13040
|
const theme = useTheme();
|
|
@@ -13266,7 +13042,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
13266
13042
|
const [loading, setLoading] = useState9(true);
|
|
13267
13043
|
const [error, setError] = useState9(null);
|
|
13268
13044
|
const [refreshing, setRefreshing] = useState9(false);
|
|
13269
|
-
|
|
13045
|
+
useEffect5(() => {
|
|
13270
13046
|
loadSessions();
|
|
13271
13047
|
}, []);
|
|
13272
13048
|
async function loadSessions() {
|
|
@@ -13339,7 +13115,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
13339
13115
|
refreshing ? "(refreshing...)" : ""
|
|
13340
13116
|
] }),
|
|
13341
13117
|
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13342
|
-
|
|
13118
|
+
SelectInput4,
|
|
13343
13119
|
{
|
|
13344
13120
|
items,
|
|
13345
13121
|
onSelect: (item) => {
|
|
@@ -13457,6 +13233,179 @@ var init_remote_dashboard = __esm({
|
|
|
13457
13233
|
}
|
|
13458
13234
|
});
|
|
13459
13235
|
|
|
13236
|
+
// src/ui/inbox-modal.tsx
|
|
13237
|
+
import { useState as useState10, useCallback as useCallback3 } from "react";
|
|
13238
|
+
import { Box as Box17, Text as Text18, useInput as useInput7 } from "ink";
|
|
13239
|
+
import { Fragment as Fragment2, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
13240
|
+
function InboxModal({ onDone, onOpen }) {
|
|
13241
|
+
const theme = useTheme();
|
|
13242
|
+
const [step, setStep] = useState10("twitter");
|
|
13243
|
+
const [twitter, setTwitter] = useState10("");
|
|
13244
|
+
const [secret, setSecret] = useState10("");
|
|
13245
|
+
const [messages, setMessages] = useState10([]);
|
|
13246
|
+
const [selectedIndex, setSelectedIndex] = useState10(0);
|
|
13247
|
+
const [error, setError] = useState10(null);
|
|
13248
|
+
const checkInbox = useCallback3(
|
|
13249
|
+
async (u, s) => {
|
|
13250
|
+
setStep("checking");
|
|
13251
|
+
setError(null);
|
|
13252
|
+
try {
|
|
13253
|
+
const res = await fetch(
|
|
13254
|
+
`${FEEDBACK_WORKER_URL}/inbox/check?u=${encodeURIComponent(u)}&s=${encodeURIComponent(s)}`
|
|
13255
|
+
);
|
|
13256
|
+
if (!res.ok) {
|
|
13257
|
+
throw new Error(`Server returned ${res.status}`);
|
|
13258
|
+
}
|
|
13259
|
+
const data = await res.json();
|
|
13260
|
+
const sorted = (data.messages ?? []).sort((a, b) => b.createdAt - a.createdAt);
|
|
13261
|
+
setMessages(sorted);
|
|
13262
|
+
setSelectedIndex(0);
|
|
13263
|
+
setStep("result");
|
|
13264
|
+
} catch (e) {
|
|
13265
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
13266
|
+
setMessages([]);
|
|
13267
|
+
setStep("result");
|
|
13268
|
+
}
|
|
13269
|
+
},
|
|
13270
|
+
[]
|
|
13271
|
+
);
|
|
13272
|
+
const handleTwitterSubmit = useCallback3(
|
|
13273
|
+
(value) => {
|
|
13274
|
+
const trimmed = value.trim();
|
|
13275
|
+
if (!trimmed) {
|
|
13276
|
+
onDone();
|
|
13277
|
+
return;
|
|
13278
|
+
}
|
|
13279
|
+
setTwitter(trimmed);
|
|
13280
|
+
setStep("secret");
|
|
13281
|
+
},
|
|
13282
|
+
[onDone]
|
|
13283
|
+
);
|
|
13284
|
+
const handleSecretSubmit = useCallback3(
|
|
13285
|
+
(value) => {
|
|
13286
|
+
const trimmed = value.trim();
|
|
13287
|
+
if (!trimmed) {
|
|
13288
|
+
onDone();
|
|
13289
|
+
return;
|
|
13290
|
+
}
|
|
13291
|
+
setSecret(trimmed);
|
|
13292
|
+
void checkInbox(twitter, trimmed);
|
|
13293
|
+
},
|
|
13294
|
+
[twitter, checkInbox, onDone]
|
|
13295
|
+
);
|
|
13296
|
+
const openSelected = useCallback3(() => {
|
|
13297
|
+
if (messages.length === 0) return;
|
|
13298
|
+
const msg = messages[selectedIndex];
|
|
13299
|
+
if (!msg) return;
|
|
13300
|
+
const url = `${FEEDBACK_WORKER_URL}/inbox?u=${encodeURIComponent(twitter)}&s=${encodeURIComponent(secret)}&m=${encodeURIComponent(msg.id)}`;
|
|
13301
|
+
onOpen(url);
|
|
13302
|
+
onDone();
|
|
13303
|
+
}, [messages, selectedIndex, twitter, secret, onOpen, onDone]);
|
|
13304
|
+
useInput7(
|
|
13305
|
+
(_input, key) => {
|
|
13306
|
+
if (key.escape) {
|
|
13307
|
+
onDone();
|
|
13308
|
+
return;
|
|
13309
|
+
}
|
|
13310
|
+
if (step === "result") {
|
|
13311
|
+
if (key.upArrow) {
|
|
13312
|
+
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
13313
|
+
return;
|
|
13314
|
+
}
|
|
13315
|
+
if (key.downArrow) {
|
|
13316
|
+
setSelectedIndex((i) => Math.min(messages.length - 1, i + 1));
|
|
13317
|
+
return;
|
|
13318
|
+
}
|
|
13319
|
+
if (key.return && messages.length > 0) {
|
|
13320
|
+
openSelected();
|
|
13321
|
+
}
|
|
13322
|
+
}
|
|
13323
|
+
},
|
|
13324
|
+
{ isActive: step === "result" }
|
|
13325
|
+
);
|
|
13326
|
+
return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
13327
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.accent, bold: true, children: "/inbox" }),
|
|
13328
|
+
step === "twitter" && /* @__PURE__ */ jsxs17(Fragment2, { children: [
|
|
13329
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.palette.foreground, children: "Enter your Twitter username (or press Enter to cancel):" }),
|
|
13330
|
+
/* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
|
|
13331
|
+
CustomTextInput,
|
|
13332
|
+
{
|
|
13333
|
+
value: twitter,
|
|
13334
|
+
onChange: setTwitter,
|
|
13335
|
+
onSubmit: handleTwitterSubmit,
|
|
13336
|
+
focus: true
|
|
13337
|
+
}
|
|
13338
|
+
) })
|
|
13339
|
+
] }),
|
|
13340
|
+
step === "secret" && /* @__PURE__ */ jsxs17(Fragment2, { children: [
|
|
13341
|
+
/* @__PURE__ */ jsx19(Text18, { color: theme.palette.foreground, children: "Enter your secret (or press Enter to cancel):" }),
|
|
13342
|
+
/* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(
|
|
13343
|
+
CustomTextInput,
|
|
13344
|
+
{
|
|
13345
|
+
value: secret,
|
|
13346
|
+
onChange: setSecret,
|
|
13347
|
+
onSubmit: handleSecretSubmit,
|
|
13348
|
+
mask: "*",
|
|
13349
|
+
focus: true
|
|
13350
|
+
}
|
|
13351
|
+
) })
|
|
13352
|
+
] }),
|
|
13353
|
+
step === "checking" && /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "Checking your inbox\u2026" }),
|
|
13354
|
+
step === "result" && /* @__PURE__ */ jsxs17(Fragment2, { children: [
|
|
13355
|
+
error ? /* @__PURE__ */ jsxs17(Text18, { color: theme.error, children: [
|
|
13356
|
+
"Error: ",
|
|
13357
|
+
error
|
|
13358
|
+
] }) : messages.length > 0 ? /* @__PURE__ */ jsxs17(Fragment2, { children: [
|
|
13359
|
+
/* @__PURE__ */ jsxs17(Text18, { color: theme.palette.foreground, children: [
|
|
13360
|
+
"You have ",
|
|
13361
|
+
messages.length,
|
|
13362
|
+
" message",
|
|
13363
|
+
messages.length === 1 ? "" : "s",
|
|
13364
|
+
messages.some((m) => !m.seen) ? " (\u{1F534} new)" : "",
|
|
13365
|
+
":"
|
|
13366
|
+
] }),
|
|
13367
|
+
/* @__PURE__ */ jsx19(Box17, { flexDirection: "column", marginTop: 1, children: messages.map((msg, idx) => {
|
|
13368
|
+
const isSelected = idx === selectedIndex;
|
|
13369
|
+
const dateStr = new Date(msg.createdAt).toLocaleString();
|
|
13370
|
+
const marker = msg.seen ? " " : "\u{1F534} ";
|
|
13371
|
+
return /* @__PURE__ */ jsxs17(
|
|
13372
|
+
Text18,
|
|
13373
|
+
{
|
|
13374
|
+
color: isSelected ? theme.accent : theme.palette.foreground,
|
|
13375
|
+
bold: isSelected,
|
|
13376
|
+
dimColor: !isSelected && msg.seen,
|
|
13377
|
+
children: [
|
|
13378
|
+
isSelected ? "> " : " ",
|
|
13379
|
+
marker,
|
|
13380
|
+
dateStr,
|
|
13381
|
+
msg.seen ? " (played)" : " (new)"
|
|
13382
|
+
]
|
|
13383
|
+
},
|
|
13384
|
+
msg.id
|
|
13385
|
+
);
|
|
13386
|
+
}) }),
|
|
13387
|
+
/* @__PURE__ */ jsx19(Box17, { marginTop: 1, children: /* @__PURE__ */ jsx19(Text18, { color: theme.info.color, children: "\u2191\u2193 to select \xB7 Enter to open in browser" }) })
|
|
13388
|
+
] }) : /* @__PURE__ */ jsxs17(Text18, { color: theme.muted?.color ?? theme.palette.secondary, children: [
|
|
13389
|
+
"No messages yet for @",
|
|
13390
|
+
twitter,
|
|
13391
|
+
" / ",
|
|
13392
|
+
secret.replace(/./g, "*"),
|
|
13393
|
+
"."
|
|
13394
|
+
] }),
|
|
13395
|
+
/* @__PURE__ */ jsx19(Text18, { dimColor: true, children: "Press Esc to close." })
|
|
13396
|
+
] })
|
|
13397
|
+
] });
|
|
13398
|
+
}
|
|
13399
|
+
var FEEDBACK_WORKER_URL;
|
|
13400
|
+
var init_inbox_modal = __esm({
|
|
13401
|
+
"src/ui/inbox-modal.tsx"() {
|
|
13402
|
+
"use strict";
|
|
13403
|
+
init_text_input();
|
|
13404
|
+
init_theme_context();
|
|
13405
|
+
FEEDBACK_WORKER_URL = "https://hello.kimiflare.com";
|
|
13406
|
+
}
|
|
13407
|
+
});
|
|
13408
|
+
|
|
13460
13409
|
// src/intent/classify.ts
|
|
13461
13410
|
function classifyIntent(prompt) {
|
|
13462
13411
|
let intentScore = 0;
|
|
@@ -14186,10 +14135,10 @@ var init_loader2 = __esm({
|
|
|
14186
14135
|
});
|
|
14187
14136
|
|
|
14188
14137
|
// src/commands/renderer.ts
|
|
14189
|
-
import { exec
|
|
14138
|
+
import { exec } from "child_process";
|
|
14190
14139
|
import { open as open2, realpath as realpath2 } from "fs/promises";
|
|
14191
14140
|
import { isAbsolute as isAbsolute2, relative as relative5, resolve as resolvePathJoin, basename as pathBasename } from "path";
|
|
14192
|
-
import { promisify as
|
|
14141
|
+
import { promisify as promisify2 } from "util";
|
|
14193
14142
|
function tokenizeArgs(s) {
|
|
14194
14143
|
return [...s.matchAll(ARG_TOKEN_RE)].map((match) => {
|
|
14195
14144
|
const token = match[0];
|
|
@@ -14256,7 +14205,7 @@ async function replaceShell(prompt, warnings, cmd, shellTimeoutMs) {
|
|
|
14256
14205
|
matches.map(async (match) => {
|
|
14257
14206
|
const command = match[1] ?? "";
|
|
14258
14207
|
try {
|
|
14259
|
-
const { stdout } = await
|
|
14208
|
+
const { stdout } = await execAsync(command, {
|
|
14260
14209
|
timeout: shellTimeoutMs,
|
|
14261
14210
|
maxBuffer: 1024 * 1024
|
|
14262
14211
|
});
|
|
@@ -14337,12 +14286,12 @@ async function replaceFiles(prompt, warnings, cmd, cwd, maxFileBytes) {
|
|
|
14337
14286
|
function message(error) {
|
|
14338
14287
|
return error instanceof Error ? error.message : String(error);
|
|
14339
14288
|
}
|
|
14340
|
-
var
|
|
14289
|
+
var execAsync, ARG_TOKEN_RE, POSITIONAL_RE, HAS_POSITIONAL, SHELL_RE, FILE_RE, DEFAULT_MAX_FILE_BYTES, DEFAULT_SHELL_TIMEOUT_MS, SECRET_PATTERNS2;
|
|
14341
14290
|
var init_renderer2 = __esm({
|
|
14342
14291
|
"src/commands/renderer.ts"() {
|
|
14343
14292
|
"use strict";
|
|
14344
14293
|
init_paths();
|
|
14345
|
-
|
|
14294
|
+
execAsync = promisify2(exec);
|
|
14346
14295
|
ARG_TOKEN_RE = /(?:"[^"]*"|'[^']*'|[^\s"']+)/g;
|
|
14347
14296
|
POSITIONAL_RE = /\$(\d+)/g;
|
|
14348
14297
|
HAS_POSITIONAL = /\$\d+/;
|
|
@@ -14400,6 +14349,7 @@ var init_builtins = __esm({
|
|
|
14400
14349
|
{ name: "remote", argHint: "<prompt>", description: "Run a remote session on Cloudflare", source: "builtin" },
|
|
14401
14350
|
{ name: "update", description: "Check for updates", source: "builtin" },
|
|
14402
14351
|
{ name: "hello", description: "Send a voice note to the creator", source: "builtin" },
|
|
14352
|
+
{ name: "inbox", description: "Check for a voice reply from the creator", source: "builtin" },
|
|
14403
14353
|
{ name: "report", argHint: "[send] [note]", description: "Report the last API error with diagnostic logs", source: "builtin" },
|
|
14404
14354
|
{ name: "shell", argHint: "[auto|bash|cmd|powershell|<path>]", description: "Show or set shell for bash tool", source: "builtin" },
|
|
14405
14355
|
{ name: "logout", description: "Clear stored credentials", source: "builtin" },
|
|
@@ -14441,21 +14391,21 @@ var init_save = __esm({
|
|
|
14441
14391
|
});
|
|
14442
14392
|
|
|
14443
14393
|
// src/ui/command-wizard.tsx
|
|
14444
|
-
import { useState as
|
|
14445
|
-
import { Box as
|
|
14446
|
-
import
|
|
14447
|
-
import { Fragment as
|
|
14394
|
+
import { useState as useState11 } from "react";
|
|
14395
|
+
import { Box as Box18, Text as Text19, useInput as useInput8, useWindowSize } from "ink";
|
|
14396
|
+
import SelectInput5 from "ink-select-input";
|
|
14397
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
14448
14398
|
function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onSave }) {
|
|
14449
14399
|
const theme = useTheme();
|
|
14450
|
-
const [step, setStep] =
|
|
14451
|
-
const [name, setName] =
|
|
14452
|
-
const [description, setDescription] =
|
|
14453
|
-
const [template, setTemplate] =
|
|
14454
|
-
const [cmdMode, setCmdMode] =
|
|
14455
|
-
const [cmdEffort, setCmdEffort] =
|
|
14456
|
-
const [cmdModel, setCmdModel] =
|
|
14457
|
-
const [source, setSource] =
|
|
14458
|
-
const [error, setError] =
|
|
14400
|
+
const [step, setStep] = useState11("name");
|
|
14401
|
+
const [name, setName] = useState11(initial?.name ?? "");
|
|
14402
|
+
const [description, setDescription] = useState11(initial?.description ?? "");
|
|
14403
|
+
const [template, setTemplate] = useState11(initial?.template ?? "");
|
|
14404
|
+
const [cmdMode, setCmdMode] = useState11(initial?.mode);
|
|
14405
|
+
const [cmdEffort, setCmdEffort] = useState11(initial?.effort);
|
|
14406
|
+
const [cmdModel, setCmdModel] = useState11(initial?.model);
|
|
14407
|
+
const [source, setSource] = useState11(initial?.source ?? "project");
|
|
14408
|
+
const [error, setError] = useState11(null);
|
|
14459
14409
|
const { columns } = useWindowSize();
|
|
14460
14410
|
const totalSteps = 5;
|
|
14461
14411
|
const stepIndex = step === "name" ? 1 : step === "description" ? 2 : step === "template" ? 3 : step === "advanced" || step === "mode" || step === "effort" || step === "model" ? 4 : step === "location" ? 4 : 5;
|
|
@@ -14468,7 +14418,7 @@ function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onS
|
|
|
14468
14418
|
if (existingNames.includes(trimmed) && !isEditingSelf(trimmed)) return `/${trimmed} already exists`;
|
|
14469
14419
|
return null;
|
|
14470
14420
|
};
|
|
14471
|
-
|
|
14421
|
+
useInput8((_input, key) => {
|
|
14472
14422
|
if (key.escape) {
|
|
14473
14423
|
onDone();
|
|
14474
14424
|
}
|
|
@@ -14568,8 +14518,8 @@ ${template}`;
|
|
|
14568
14518
|
const renderStep = () => {
|
|
14569
14519
|
switch (step) {
|
|
14570
14520
|
case "name":
|
|
14571
|
-
return /* @__PURE__ */
|
|
14572
|
-
/* @__PURE__ */
|
|
14521
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14522
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14573
14523
|
mode === "create" ? "Create" : "Edit",
|
|
14574
14524
|
" custom command \u2014 Name (",
|
|
14575
14525
|
stepIndex,
|
|
@@ -14577,8 +14527,8 @@ ${template}`;
|
|
|
14577
14527
|
totalSteps,
|
|
14578
14528
|
")"
|
|
14579
14529
|
] }),
|
|
14580
|
-
error && /* @__PURE__ */
|
|
14581
|
-
/* @__PURE__ */
|
|
14530
|
+
error && /* @__PURE__ */ jsx20(Text19, { color: theme.error, children: error }),
|
|
14531
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14582
14532
|
CustomTextInput,
|
|
14583
14533
|
{
|
|
14584
14534
|
value: name,
|
|
@@ -14587,11 +14537,11 @@ ${template}`;
|
|
|
14587
14537
|
focus: true
|
|
14588
14538
|
}
|
|
14589
14539
|
) }),
|
|
14590
|
-
/* @__PURE__ */
|
|
14540
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "letters, numbers, _ - / only; must start with a letter" })
|
|
14591
14541
|
] });
|
|
14592
14542
|
case "description":
|
|
14593
|
-
return /* @__PURE__ */
|
|
14594
|
-
/* @__PURE__ */
|
|
14543
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14544
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14595
14545
|
mode === "create" ? "Create" : "Edit",
|
|
14596
14546
|
" custom command \u2014 Description (",
|
|
14597
14547
|
stepIndex,
|
|
@@ -14599,7 +14549,7 @@ ${template}`;
|
|
|
14599
14549
|
totalSteps,
|
|
14600
14550
|
")"
|
|
14601
14551
|
] }),
|
|
14602
|
-
/* @__PURE__ */
|
|
14552
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14603
14553
|
CustomTextInput,
|
|
14604
14554
|
{
|
|
14605
14555
|
value: description,
|
|
@@ -14608,49 +14558,49 @@ ${template}`;
|
|
|
14608
14558
|
focus: true
|
|
14609
14559
|
}
|
|
14610
14560
|
) }),
|
|
14611
|
-
/* @__PURE__ */
|
|
14561
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Press Enter to skip" })
|
|
14612
14562
|
] });
|
|
14613
14563
|
case "template": {
|
|
14614
|
-
const guide = /* @__PURE__ */
|
|
14615
|
-
/* @__PURE__ */
|
|
14616
|
-
/* @__PURE__ */
|
|
14617
|
-
/* @__PURE__ */
|
|
14564
|
+
const guide = /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", paddingLeft: 1, children: [
|
|
14565
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.accent, bold: true, children: "What is this?" }),
|
|
14566
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "A prompt template \u2014 instructions to the AI." }),
|
|
14567
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14618
14568
|
"When you type /",
|
|
14619
14569
|
name || "yourcommand",
|
|
14620
14570
|
" later, this gets sent to the model."
|
|
14621
14571
|
] }),
|
|
14622
|
-
/* @__PURE__ */
|
|
14623
|
-
/* @__PURE__ */
|
|
14624
|
-
/* @__PURE__ */
|
|
14572
|
+
/* @__PURE__ */ jsxs18(Box18, { marginTop: 1, flexDirection: "column", children: [
|
|
14573
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.accent, bold: true, children: "Variables" }),
|
|
14574
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14625
14575
|
" ",
|
|
14626
14576
|
"$1, $2 ... \u2192 arguments you type"
|
|
14627
14577
|
] }),
|
|
14628
|
-
/* @__PURE__ */
|
|
14578
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14629
14579
|
" ",
|
|
14630
14580
|
"$ARGUMENTS \u2192 everything after the command"
|
|
14631
14581
|
] })
|
|
14632
14582
|
] }),
|
|
14633
|
-
/* @__PURE__ */
|
|
14634
|
-
/* @__PURE__ */
|
|
14635
|
-
/* @__PURE__ */
|
|
14583
|
+
/* @__PURE__ */ jsxs18(Box18, { marginTop: 1, flexDirection: "column", children: [
|
|
14584
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.accent, bold: true, children: "Dynamic inlines" }),
|
|
14585
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14636
14586
|
" ",
|
|
14637
14587
|
"!`git diff` \u2192 shell output inlined"
|
|
14638
14588
|
] }),
|
|
14639
|
-
/* @__PURE__ */
|
|
14589
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14640
14590
|
" ",
|
|
14641
14591
|
"@README.md \u2192 file contents inlined"
|
|
14642
14592
|
] })
|
|
14643
14593
|
] }),
|
|
14644
|
-
/* @__PURE__ */
|
|
14645
|
-
/* @__PURE__ */
|
|
14646
|
-
/* @__PURE__ */
|
|
14647
|
-
/* @__PURE__ */
|
|
14648
|
-
/* @__PURE__ */
|
|
14594
|
+
/* @__PURE__ */ jsxs18(Box18, { marginTop: 1, flexDirection: "column", children: [
|
|
14595
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.accent, bold: true, children: "Example" }),
|
|
14596
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Review this PR diff:" }),
|
|
14597
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "!`git diff main...HEAD`" }),
|
|
14598
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Focus on: $1" })
|
|
14649
14599
|
] })
|
|
14650
14600
|
] });
|
|
14651
|
-
const inputArea = /* @__PURE__ */
|
|
14652
|
-
error && /* @__PURE__ */
|
|
14653
|
-
/* @__PURE__ */
|
|
14601
|
+
const inputArea = /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", flexGrow: 1, children: [
|
|
14602
|
+
error && /* @__PURE__ */ jsx20(Text19, { color: theme.error, children: error }),
|
|
14603
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14654
14604
|
CustomTextInput,
|
|
14655
14605
|
{
|
|
14656
14606
|
value: template,
|
|
@@ -14660,13 +14610,13 @@ ${template}`;
|
|
|
14660
14610
|
enablePaste: true
|
|
14661
14611
|
}
|
|
14662
14612
|
) }),
|
|
14663
|
-
columns < 100 && /* @__PURE__ */
|
|
14664
|
-
/* @__PURE__ */
|
|
14665
|
-
/* @__PURE__ */
|
|
14613
|
+
columns < 100 && /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14614
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Paste multi-line templates with Ctrl+V." }),
|
|
14615
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Variables: $1 $2 ... $ARGUMENTS Shell: !`cmd` File: @path" })
|
|
14666
14616
|
] })
|
|
14667
14617
|
] });
|
|
14668
|
-
return /* @__PURE__ */
|
|
14669
|
-
/* @__PURE__ */
|
|
14618
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14619
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14670
14620
|
mode === "create" ? "Create" : "Edit",
|
|
14671
14621
|
" custom command \u2014 Template (",
|
|
14672
14622
|
stepIndex,
|
|
@@ -14674,10 +14624,10 @@ ${template}`;
|
|
|
14674
14624
|
totalSteps,
|
|
14675
14625
|
")"
|
|
14676
14626
|
] }),
|
|
14677
|
-
columns >= 100 ? /* @__PURE__ */
|
|
14678
|
-
/* @__PURE__ */
|
|
14679
|
-
/* @__PURE__ */
|
|
14680
|
-
] }) : /* @__PURE__ */
|
|
14627
|
+
columns >= 100 ? /* @__PURE__ */ jsxs18(Box18, { flexDirection: "row", marginTop: 1, children: [
|
|
14628
|
+
/* @__PURE__ */ jsx20(Box18, { flexDirection: "column", width: "50%", children: inputArea }),
|
|
14629
|
+
/* @__PURE__ */ jsx20(Box18, { flexDirection: "column", width: "50%", children: guide })
|
|
14630
|
+
] }) : /* @__PURE__ */ jsx20(Box18, { flexDirection: "column", marginTop: 1, children: inputArea })
|
|
14681
14631
|
] });
|
|
14682
14632
|
}
|
|
14683
14633
|
case "advanced": {
|
|
@@ -14686,8 +14636,8 @@ ${template}`;
|
|
|
14686
14636
|
{ label: "Skip", value: "skip", key: "skip" },
|
|
14687
14637
|
{ label: "\u2190 Cancel", value: "cancel", key: "cancel" }
|
|
14688
14638
|
];
|
|
14689
|
-
return /* @__PURE__ */
|
|
14690
|
-
/* @__PURE__ */
|
|
14639
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14640
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14691
14641
|
mode === "create" ? "Create" : "Edit",
|
|
14692
14642
|
" custom command \u2014 Options (",
|
|
14693
14643
|
stepIndex,
|
|
@@ -14695,8 +14645,8 @@ ${template}`;
|
|
|
14695
14645
|
totalSteps,
|
|
14696
14646
|
")"
|
|
14697
14647
|
] }),
|
|
14698
|
-
/* @__PURE__ */
|
|
14699
|
-
|
|
14648
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14649
|
+
SelectInput5,
|
|
14700
14650
|
{
|
|
14701
14651
|
items,
|
|
14702
14652
|
onSelect: (item) => {
|
|
@@ -14715,17 +14665,17 @@ ${template}`;
|
|
|
14715
14665
|
{ label: cmdMode === "auto" ? "auto \xB7 current" : "auto", value: "auto", key: "auto" },
|
|
14716
14666
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14717
14667
|
];
|
|
14718
|
-
return /* @__PURE__ */
|
|
14719
|
-
/* @__PURE__ */
|
|
14668
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14669
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14720
14670
|
"Mode override (",
|
|
14721
14671
|
stepIndex,
|
|
14722
14672
|
"/",
|
|
14723
14673
|
totalSteps,
|
|
14724
14674
|
")"
|
|
14725
14675
|
] }),
|
|
14726
|
-
/* @__PURE__ */
|
|
14727
|
-
/* @__PURE__ */
|
|
14728
|
-
|
|
14676
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Saved to file but not yet enforced at runtime" }),
|
|
14677
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14678
|
+
SelectInput5,
|
|
14729
14679
|
{
|
|
14730
14680
|
items,
|
|
14731
14681
|
onSelect: (item) => {
|
|
@@ -14744,16 +14694,16 @@ ${template}`;
|
|
|
14744
14694
|
{ label: cmdEffort === "high" ? "high \xB7 current" : "high", value: "high", key: "high" },
|
|
14745
14695
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14746
14696
|
];
|
|
14747
|
-
return /* @__PURE__ */
|
|
14748
|
-
/* @__PURE__ */
|
|
14697
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14698
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14749
14699
|
"Reasoning effort (",
|
|
14750
14700
|
stepIndex,
|
|
14751
14701
|
"/",
|
|
14752
14702
|
totalSteps,
|
|
14753
14703
|
")"
|
|
14754
14704
|
] }),
|
|
14755
|
-
/* @__PURE__ */
|
|
14756
|
-
|
|
14705
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14706
|
+
SelectInput5,
|
|
14757
14707
|
{
|
|
14758
14708
|
items,
|
|
14759
14709
|
onSelect: (item) => {
|
|
@@ -14765,15 +14715,15 @@ ${template}`;
|
|
|
14765
14715
|
] });
|
|
14766
14716
|
}
|
|
14767
14717
|
case "model":
|
|
14768
|
-
return /* @__PURE__ */
|
|
14769
|
-
/* @__PURE__ */
|
|
14718
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14719
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14770
14720
|
"Model override (",
|
|
14771
14721
|
stepIndex,
|
|
14772
14722
|
"/",
|
|
14773
14723
|
totalSteps,
|
|
14774
14724
|
")"
|
|
14775
14725
|
] }),
|
|
14776
|
-
/* @__PURE__ */
|
|
14726
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14777
14727
|
CustomTextInput,
|
|
14778
14728
|
{
|
|
14779
14729
|
value: cmdModel ?? "",
|
|
@@ -14782,7 +14732,7 @@ ${template}`;
|
|
|
14782
14732
|
focus: true
|
|
14783
14733
|
}
|
|
14784
14734
|
) }),
|
|
14785
|
-
/* @__PURE__ */
|
|
14735
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Press Enter to skip" })
|
|
14786
14736
|
] });
|
|
14787
14737
|
case "location": {
|
|
14788
14738
|
const items = [
|
|
@@ -14790,16 +14740,16 @@ ${template}`;
|
|
|
14790
14740
|
{ label: source === "global" ? "Global \xB7 current" : "Global", value: "global", key: "global" },
|
|
14791
14741
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
14792
14742
|
];
|
|
14793
|
-
return /* @__PURE__ */
|
|
14794
|
-
/* @__PURE__ */
|
|
14743
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14744
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14795
14745
|
"Save location (",
|
|
14796
14746
|
stepIndex,
|
|
14797
14747
|
"/",
|
|
14798
14748
|
totalSteps,
|
|
14799
14749
|
")"
|
|
14800
14750
|
] }),
|
|
14801
|
-
/* @__PURE__ */
|
|
14802
|
-
|
|
14751
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14752
|
+
SelectInput5,
|
|
14803
14753
|
{
|
|
14804
14754
|
items,
|
|
14805
14755
|
onSelect: (item) => {
|
|
@@ -14808,7 +14758,7 @@ ${template}`;
|
|
|
14808
14758
|
}
|
|
14809
14759
|
}
|
|
14810
14760
|
) }),
|
|
14811
|
-
/* @__PURE__ */
|
|
14761
|
+
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Project: .kimiflare/commands/ Global: ~/.config/kimiflare/commands/" })
|
|
14812
14762
|
] });
|
|
14813
14763
|
}
|
|
14814
14764
|
case "confirm": {
|
|
@@ -14816,8 +14766,8 @@ ${template}`;
|
|
|
14816
14766
|
{ label: "Save", value: "save", key: "save" },
|
|
14817
14767
|
{ label: "Cancel", value: "cancel", key: "cancel" }
|
|
14818
14768
|
];
|
|
14819
|
-
return /* @__PURE__ */
|
|
14820
|
-
/* @__PURE__ */
|
|
14769
|
+
return /* @__PURE__ */ jsxs18(Fragment3, { children: [
|
|
14770
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.accent, bold: true, children: [
|
|
14821
14771
|
mode === "create" ? "Create" : "Edit",
|
|
14822
14772
|
" custom command \u2014 Confirm (",
|
|
14823
14773
|
stepIndex,
|
|
@@ -14825,14 +14775,14 @@ ${template}`;
|
|
|
14825
14775
|
totalSteps,
|
|
14826
14776
|
")"
|
|
14827
14777
|
] }),
|
|
14828
|
-
/* @__PURE__ */
|
|
14778
|
+
/* @__PURE__ */ jsxs18(Text19, { color: theme.info.color, children: [
|
|
14829
14779
|
source === "project" ? ".kimiflare/commands/" : "~/.config/kimiflare/commands/",
|
|
14830
14780
|
name,
|
|
14831
14781
|
".md"
|
|
14832
14782
|
] }),
|
|
14833
|
-
/* @__PURE__ */
|
|
14834
|
-
/* @__PURE__ */
|
|
14835
|
-
|
|
14783
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, flexDirection: "column", children: previewContent().split("\n").map((line, i) => /* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: line || " " }, i)) }),
|
|
14784
|
+
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14785
|
+
SelectInput5,
|
|
14836
14786
|
{
|
|
14837
14787
|
items,
|
|
14838
14788
|
onSelect: (item) => handleConfirm(item.value)
|
|
@@ -14842,7 +14792,7 @@ ${template}`;
|
|
|
14842
14792
|
}
|
|
14843
14793
|
}
|
|
14844
14794
|
};
|
|
14845
|
-
return /* @__PURE__ */
|
|
14795
|
+
return /* @__PURE__ */ jsx20(Box18, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: renderStep() });
|
|
14846
14796
|
}
|
|
14847
14797
|
var NAME_RE;
|
|
14848
14798
|
var init_command_wizard = __esm({
|
|
@@ -15287,9 +15237,9 @@ var init_context_generator = __esm({
|
|
|
15287
15237
|
});
|
|
15288
15238
|
|
|
15289
15239
|
// src/ui/command-picker.tsx
|
|
15290
|
-
import { Box as
|
|
15291
|
-
import
|
|
15292
|
-
import { jsx as
|
|
15240
|
+
import { Box as Box19, Text as Text20 } from "ink";
|
|
15241
|
+
import SelectInput6 from "ink-select-input";
|
|
15242
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
15293
15243
|
function CommandPicker({ commands, title, onPick }) {
|
|
15294
15244
|
const theme = useTheme();
|
|
15295
15245
|
const items = commands.map((cmd) => ({
|
|
@@ -15298,11 +15248,11 @@ function CommandPicker({ commands, title, onPick }) {
|
|
|
15298
15248
|
key: cmd.name
|
|
15299
15249
|
}));
|
|
15300
15250
|
items.push({ label: "\u2190 Cancel", value: null, key: "__cancel__" });
|
|
15301
|
-
return /* @__PURE__ */
|
|
15302
|
-
/* @__PURE__ */
|
|
15303
|
-
/* @__PURE__ */
|
|
15304
|
-
/* @__PURE__ */
|
|
15305
|
-
|
|
15251
|
+
return /* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15252
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: title }),
|
|
15253
|
+
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
15254
|
+
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15255
|
+
SelectInput6,
|
|
15306
15256
|
{
|
|
15307
15257
|
items,
|
|
15308
15258
|
onSelect: (item) => {
|
|
@@ -15324,64 +15274,64 @@ var init_command_picker = __esm({
|
|
|
15324
15274
|
});
|
|
15325
15275
|
|
|
15326
15276
|
// src/ui/command-list.tsx
|
|
15327
|
-
import { Box as
|
|
15328
|
-
import { jsx as
|
|
15277
|
+
import { Box as Box20, Text as Text21, useInput as useInput9 } from "ink";
|
|
15278
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
15329
15279
|
function CommandList({ commands, onDone }) {
|
|
15330
15280
|
const theme = useTheme();
|
|
15331
|
-
|
|
15281
|
+
useInput9((_input, key) => {
|
|
15332
15282
|
if (key.escape) {
|
|
15333
15283
|
onDone();
|
|
15334
15284
|
}
|
|
15335
15285
|
});
|
|
15336
|
-
return /* @__PURE__ */
|
|
15337
|
-
/* @__PURE__ */
|
|
15338
|
-
/* @__PURE__ */
|
|
15339
|
-
/* @__PURE__ */
|
|
15340
|
-
commands.length === 0 && /* @__PURE__ */
|
|
15341
|
-
commands.map((cmd) => /* @__PURE__ */
|
|
15342
|
-
/* @__PURE__ */
|
|
15286
|
+
return /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15287
|
+
/* @__PURE__ */ jsx22(Text21, { color: theme.accent, bold: true, children: "Custom commands" }),
|
|
15288
|
+
/* @__PURE__ */ jsx22(Text21, { color: theme.info.color, dimColor: false, children: "Esc to close." }),
|
|
15289
|
+
/* @__PURE__ */ jsxs20(Box20, { marginTop: 1, flexDirection: "column", children: [
|
|
15290
|
+
commands.length === 0 && /* @__PURE__ */ jsx22(Text21, { color: theme.info.color, children: "No custom commands found." }),
|
|
15291
|
+
commands.map((cmd) => /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", marginBottom: 1, children: [
|
|
15292
|
+
/* @__PURE__ */ jsxs20(Text21, { color: theme.accent, bold: true, children: [
|
|
15343
15293
|
"/",
|
|
15344
15294
|
cmd.name
|
|
15345
15295
|
] }),
|
|
15346
|
-
/* @__PURE__ */
|
|
15296
|
+
/* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15347
15297
|
" ",
|
|
15348
15298
|
"source: ",
|
|
15349
15299
|
cmd.source
|
|
15350
15300
|
] }),
|
|
15351
|
-
/* @__PURE__ */
|
|
15301
|
+
/* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15352
15302
|
" ",
|
|
15353
15303
|
"path: ",
|
|
15354
15304
|
cmd.filepath
|
|
15355
15305
|
] }),
|
|
15356
|
-
cmd.description && /* @__PURE__ */
|
|
15306
|
+
cmd.description && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15357
15307
|
" ",
|
|
15358
15308
|
"desc: ",
|
|
15359
15309
|
cmd.description
|
|
15360
15310
|
] }),
|
|
15361
|
-
cmd.mode && /* @__PURE__ */
|
|
15311
|
+
cmd.mode && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15362
15312
|
" ",
|
|
15363
15313
|
"mode: ",
|
|
15364
15314
|
cmd.mode
|
|
15365
15315
|
] }),
|
|
15366
|
-
cmd.effort && /* @__PURE__ */
|
|
15316
|
+
cmd.effort && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15367
15317
|
" ",
|
|
15368
15318
|
"effort: ",
|
|
15369
15319
|
cmd.effort
|
|
15370
15320
|
] }),
|
|
15371
|
-
cmd.model && /* @__PURE__ */
|
|
15321
|
+
cmd.model && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15372
15322
|
" ",
|
|
15373
15323
|
"model: ",
|
|
15374
15324
|
cmd.model
|
|
15375
15325
|
] }),
|
|
15376
|
-
/* @__PURE__ */
|
|
15326
|
+
/* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15377
15327
|
" ",
|
|
15378
15328
|
"template:"
|
|
15379
15329
|
] }),
|
|
15380
|
-
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */
|
|
15330
|
+
cmd.template.split("\n").slice(0, 5).map((line, i) => /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15381
15331
|
" ",
|
|
15382
15332
|
line || " "
|
|
15383
15333
|
] }, i)),
|
|
15384
|
-
cmd.template.split("\n").length > 5 && /* @__PURE__ */
|
|
15334
|
+
cmd.template.split("\n").length > 5 && /* @__PURE__ */ jsxs20(Text21, { color: theme.info.color, children: [
|
|
15385
15335
|
" ",
|
|
15386
15336
|
"..."
|
|
15387
15337
|
] })
|
|
@@ -15397,20 +15347,20 @@ var init_command_list = __esm({
|
|
|
15397
15347
|
});
|
|
15398
15348
|
|
|
15399
15349
|
// src/ui/lsp-wizard.tsx
|
|
15400
|
-
import { useState as
|
|
15401
|
-
import { Box as
|
|
15402
|
-
import
|
|
15350
|
+
import { useState as useState12 } from "react";
|
|
15351
|
+
import { Box as Box21, Text as Text22 } from "ink";
|
|
15352
|
+
import SelectInput7 from "ink-select-input";
|
|
15403
15353
|
import { spawn as spawn3 } from "child_process";
|
|
15404
|
-
import { jsx as
|
|
15354
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
15405
15355
|
function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
15406
15356
|
const theme = useTheme();
|
|
15407
|
-
const [page, setPage] =
|
|
15408
|
-
const [selectedPreset, setSelectedPreset] =
|
|
15409
|
-
const [customName, setCustomName] =
|
|
15410
|
-
const [customCommand, setCustomCommand] =
|
|
15411
|
-
const [installState, setInstallState] =
|
|
15412
|
-
const [pendingServers, setPendingServers] =
|
|
15413
|
-
const [pendingEnabled, setPendingEnabled] =
|
|
15357
|
+
const [page, setPage] = useState12("main");
|
|
15358
|
+
const [selectedPreset, setSelectedPreset] = useState12(null);
|
|
15359
|
+
const [customName, setCustomName] = useState12("");
|
|
15360
|
+
const [customCommand, setCustomCommand] = useState12("");
|
|
15361
|
+
const [installState, setInstallState] = useState12({ status: "idle", output: "" });
|
|
15362
|
+
const [pendingServers, setPendingServers] = useState12(null);
|
|
15363
|
+
const [pendingEnabled, setPendingEnabled] = useState12(true);
|
|
15414
15364
|
const runInstall = (command) => {
|
|
15415
15365
|
setInstallState({ status: "running", output: "Installing..." });
|
|
15416
15366
|
const { shell, args } = getShellCommand();
|
|
@@ -15513,11 +15463,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15513
15463
|
{ label: "(close)", value: "__close__", key: "__close__" }
|
|
15514
15464
|
];
|
|
15515
15465
|
if (page === "main") {
|
|
15516
|
-
return /* @__PURE__ */
|
|
15517
|
-
/* @__PURE__ */
|
|
15518
|
-
/* @__PURE__ */
|
|
15519
|
-
/* @__PURE__ */
|
|
15520
|
-
|
|
15466
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15467
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "LSP Servers" }),
|
|
15468
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
15469
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15470
|
+
SelectInput7,
|
|
15521
15471
|
{
|
|
15522
15472
|
items: mainItems,
|
|
15523
15473
|
onSelect: (item) => {
|
|
@@ -15544,11 +15494,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15544
15494
|
}),
|
|
15545
15495
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
15546
15496
|
];
|
|
15547
|
-
return /* @__PURE__ */
|
|
15548
|
-
/* @__PURE__ */
|
|
15549
|
-
/* @__PURE__ */
|
|
15550
|
-
/* @__PURE__ */
|
|
15551
|
-
|
|
15497
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15498
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Add LSP Server" }),
|
|
15499
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Select a language server to configure." }),
|
|
15500
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15501
|
+
SelectInput7,
|
|
15552
15502
|
{
|
|
15553
15503
|
items,
|
|
15554
15504
|
onSelect: (item) => {
|
|
@@ -15575,19 +15525,19 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15575
15525
|
{ label: isSuccess ? "Save to config \u2713" : "Save anyway", value: "save", key: "save" },
|
|
15576
15526
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
15577
15527
|
];
|
|
15578
|
-
return /* @__PURE__ */
|
|
15579
|
-
/* @__PURE__ */
|
|
15528
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15529
|
+
/* @__PURE__ */ jsxs21(Text22, { color: theme.accent, bold: true, children: [
|
|
15580
15530
|
"Install ",
|
|
15581
15531
|
selectedPreset.name
|
|
15582
15532
|
] }),
|
|
15583
|
-
/* @__PURE__ */
|
|
15584
|
-
/* @__PURE__ */
|
|
15585
|
-
/* @__PURE__ */
|
|
15586
|
-
/* @__PURE__ */
|
|
15533
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: selectedPreset.installHint }),
|
|
15534
|
+
/* @__PURE__ */ jsxs21(Box21, { marginTop: 1, flexDirection: "column", children: [
|
|
15535
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Command:" }),
|
|
15536
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, children: selectedPreset.installCommand || "(none required)" })
|
|
15587
15537
|
] }),
|
|
15588
|
-
installState.output && /* @__PURE__ */
|
|
15589
|
-
/* @__PURE__ */
|
|
15590
|
-
|
|
15538
|
+
installState.output && /* @__PURE__ */ jsx23(Box21, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx23(Text22, { color: isSuccess ? theme.accent : theme.error, children: installState.output.slice(-500) }) }),
|
|
15539
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15540
|
+
SelectInput7,
|
|
15591
15541
|
{
|
|
15592
15542
|
items,
|
|
15593
15543
|
onSelect: (item) => {
|
|
@@ -15604,16 +15554,16 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15604
15554
|
}
|
|
15605
15555
|
}
|
|
15606
15556
|
) }),
|
|
15607
|
-
isSuccess && /* @__PURE__ */
|
|
15557
|
+
isSuccess && /* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(Text22, { color: theme.accent, children: "Server saved. Run /lsp reload to start it." }) })
|
|
15608
15558
|
] });
|
|
15609
15559
|
}
|
|
15610
15560
|
if (page === "custom-name") {
|
|
15611
|
-
return /* @__PURE__ */
|
|
15612
|
-
/* @__PURE__ */
|
|
15613
|
-
/* @__PURE__ */
|
|
15614
|
-
/* @__PURE__ */
|
|
15615
|
-
/* @__PURE__ */
|
|
15616
|
-
/* @__PURE__ */
|
|
15561
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15562
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Name" }),
|
|
15563
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Enter a name for this server (e.g., my-server)." }),
|
|
15564
|
+
/* @__PURE__ */ jsxs21(Box21, { marginTop: 1, children: [
|
|
15565
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, children: "\u203A " }),
|
|
15566
|
+
/* @__PURE__ */ jsx23(
|
|
15617
15567
|
CustomTextInput,
|
|
15618
15568
|
{
|
|
15619
15569
|
value: customName,
|
|
@@ -15627,8 +15577,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15627
15577
|
}
|
|
15628
15578
|
)
|
|
15629
15579
|
] }),
|
|
15630
|
-
/* @__PURE__ */
|
|
15631
|
-
|
|
15580
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15581
|
+
SelectInput7,
|
|
15632
15582
|
{
|
|
15633
15583
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15634
15584
|
onSelect: () => setPage("add")
|
|
@@ -15637,12 +15587,12 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15637
15587
|
] });
|
|
15638
15588
|
}
|
|
15639
15589
|
if (page === "custom-command") {
|
|
15640
|
-
return /* @__PURE__ */
|
|
15641
|
-
/* @__PURE__ */
|
|
15642
|
-
/* @__PURE__ */
|
|
15643
|
-
/* @__PURE__ */
|
|
15644
|
-
/* @__PURE__ */
|
|
15645
|
-
/* @__PURE__ */
|
|
15590
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15591
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Custom LSP Server \u2014 Command" }),
|
|
15592
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Enter the command to start the server (space-separated)." }),
|
|
15593
|
+
/* @__PURE__ */ jsxs21(Box21, { marginTop: 1, children: [
|
|
15594
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, children: "\u203A " }),
|
|
15595
|
+
/* @__PURE__ */ jsx23(
|
|
15646
15596
|
CustomTextInput,
|
|
15647
15597
|
{
|
|
15648
15598
|
value: customCommand,
|
|
@@ -15656,8 +15606,8 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15656
15606
|
}
|
|
15657
15607
|
)
|
|
15658
15608
|
] }),
|
|
15659
|
-
/* @__PURE__ */
|
|
15660
|
-
|
|
15609
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15610
|
+
SelectInput7,
|
|
15661
15611
|
{
|
|
15662
15612
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15663
15613
|
onSelect: () => setPage("custom-name")
|
|
@@ -15680,11 +15630,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15680
15630
|
},
|
|
15681
15631
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
15682
15632
|
];
|
|
15683
|
-
return /* @__PURE__ */
|
|
15684
|
-
/* @__PURE__ */
|
|
15685
|
-
/* @__PURE__ */
|
|
15686
|
-
/* @__PURE__ */
|
|
15687
|
-
|
|
15633
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15634
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Save LSP Config" }),
|
|
15635
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Where should this server configuration be saved?" }),
|
|
15636
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15637
|
+
SelectInput7,
|
|
15688
15638
|
{
|
|
15689
15639
|
items,
|
|
15690
15640
|
onSelect: (item) => {
|
|
@@ -15702,11 +15652,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15702
15652
|
if (page === "edit") {
|
|
15703
15653
|
const keys = Object.keys(servers);
|
|
15704
15654
|
if (keys.length === 0) {
|
|
15705
|
-
return /* @__PURE__ */
|
|
15706
|
-
/* @__PURE__ */
|
|
15707
|
-
/* @__PURE__ */
|
|
15708
|
-
/* @__PURE__ */
|
|
15709
|
-
|
|
15655
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15656
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
15657
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "No servers configured." }),
|
|
15658
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15659
|
+
SelectInput7,
|
|
15710
15660
|
{
|
|
15711
15661
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15712
15662
|
onSelect: () => setPage("main")
|
|
@@ -15726,11 +15676,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15726
15676
|
}),
|
|
15727
15677
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
15728
15678
|
];
|
|
15729
|
-
return /* @__PURE__ */
|
|
15730
|
-
/* @__PURE__ */
|
|
15731
|
-
/* @__PURE__ */
|
|
15732
|
-
/* @__PURE__ */
|
|
15733
|
-
|
|
15679
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15680
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
15681
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Select a server to toggle enabled/disabled." }),
|
|
15682
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15683
|
+
SelectInput7,
|
|
15734
15684
|
{
|
|
15735
15685
|
items,
|
|
15736
15686
|
onSelect: (item) => {
|
|
@@ -15747,11 +15697,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15747
15697
|
if (page === "delete") {
|
|
15748
15698
|
const keys = Object.keys(servers);
|
|
15749
15699
|
if (keys.length === 0) {
|
|
15750
|
-
return /* @__PURE__ */
|
|
15751
|
-
/* @__PURE__ */
|
|
15752
|
-
/* @__PURE__ */
|
|
15753
|
-
/* @__PURE__ */
|
|
15754
|
-
|
|
15700
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15701
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
15702
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "No servers configured." }),
|
|
15703
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15704
|
+
SelectInput7,
|
|
15755
15705
|
{
|
|
15756
15706
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15757
15707
|
onSelect: () => setPage("main")
|
|
@@ -15767,11 +15717,11 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15767
15717
|
})),
|
|
15768
15718
|
{ label: "\u2190 Back", value: "__back__", key: "__back__" }
|
|
15769
15719
|
];
|
|
15770
|
-
return /* @__PURE__ */
|
|
15771
|
-
/* @__PURE__ */
|
|
15772
|
-
/* @__PURE__ */
|
|
15773
|
-
/* @__PURE__ */
|
|
15774
|
-
|
|
15720
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15721
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
15722
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Select a server to remove from config." }),
|
|
15723
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15724
|
+
SelectInput7,
|
|
15775
15725
|
{
|
|
15776
15726
|
items,
|
|
15777
15727
|
onSelect: (item) => {
|
|
@@ -15787,15 +15737,15 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15787
15737
|
}
|
|
15788
15738
|
if (page === "list") {
|
|
15789
15739
|
const keys = Object.keys(servers);
|
|
15790
|
-
return /* @__PURE__ */
|
|
15791
|
-
/* @__PURE__ */
|
|
15792
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
15740
|
+
return /* @__PURE__ */ jsxs21(Box21, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
15741
|
+
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Configured LSP Servers" }),
|
|
15742
|
+
keys.length === 0 ? /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "No servers configured." }) : /* @__PURE__ */ jsx23(Box21, { marginTop: 1, flexDirection: "column", children: keys.map((k) => {
|
|
15793
15743
|
const s = servers[k];
|
|
15794
15744
|
const status = s.enabled !== false ? "enabled" : "disabled";
|
|
15795
|
-
return /* @__PURE__ */
|
|
15745
|
+
return /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: ` ${k.padEnd(16)} ${status} ${s.command.join(" ")}` }, k);
|
|
15796
15746
|
}) }),
|
|
15797
|
-
/* @__PURE__ */
|
|
15798
|
-
|
|
15747
|
+
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15748
|
+
SelectInput7,
|
|
15799
15749
|
{
|
|
15800
15750
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15801
15751
|
onSelect: () => setPage("main")
|
|
@@ -15922,9 +15872,9 @@ var init_lsp_wizard = __esm({
|
|
|
15922
15872
|
});
|
|
15923
15873
|
|
|
15924
15874
|
// src/ui/theme-picker.tsx
|
|
15925
|
-
import { Box as
|
|
15926
|
-
import
|
|
15927
|
-
import { jsx as
|
|
15875
|
+
import { Box as Box22, Text as Text23 } from "ink";
|
|
15876
|
+
import SelectInput8 from "ink-select-input";
|
|
15877
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
15928
15878
|
function PaletteSwatches({ palette }) {
|
|
15929
15879
|
const colors = [
|
|
15930
15880
|
palette.primary,
|
|
@@ -15932,7 +15882,7 @@ function PaletteSwatches({ palette }) {
|
|
|
15932
15882
|
palette.success,
|
|
15933
15883
|
palette.error
|
|
15934
15884
|
];
|
|
15935
|
-
return /* @__PURE__ */
|
|
15885
|
+
return /* @__PURE__ */ jsx24(Box22, { children: colors.map((c, i) => /* @__PURE__ */ jsx24(Text23, { color: c, children: "\u2588" }, i)) });
|
|
15936
15886
|
}
|
|
15937
15887
|
function ThemePicker({ themes, onPick }) {
|
|
15938
15888
|
const current = useTheme();
|
|
@@ -15940,10 +15890,10 @@ function ThemePicker({ themes, onPick }) {
|
|
|
15940
15890
|
...themes.map((t) => ({ label: t.label, value: t.name })),
|
|
15941
15891
|
{ label: "< Back", value: "__back__" }
|
|
15942
15892
|
];
|
|
15943
|
-
return /* @__PURE__ */
|
|
15944
|
-
/* @__PURE__ */
|
|
15945
|
-
/* @__PURE__ */
|
|
15946
|
-
|
|
15893
|
+
return /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", borderStyle: "round", borderColor: current.accent, paddingX: 1, children: [
|
|
15894
|
+
/* @__PURE__ */ jsx24(Text23, { color: current.accent, bold: true, children: "Pick a theme (restart to apply)" }),
|
|
15895
|
+
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
15896
|
+
SelectInput8,
|
|
15947
15897
|
{
|
|
15948
15898
|
items,
|
|
15949
15899
|
onSelect: (item) => {
|
|
@@ -15957,9 +15907,9 @@ function ThemePicker({ themes, onPick }) {
|
|
|
15957
15907
|
itemComponent: ({ label, isSelected }) => {
|
|
15958
15908
|
const t = themes.find((x) => x.label === label);
|
|
15959
15909
|
const color = t?.accent ?? current.accent;
|
|
15960
|
-
return /* @__PURE__ */
|
|
15961
|
-
/* @__PURE__ */
|
|
15962
|
-
t && /* @__PURE__ */
|
|
15910
|
+
return /* @__PURE__ */ jsxs22(Box22, { children: [
|
|
15911
|
+
/* @__PURE__ */ jsx24(Text23, { color, bold: isSelected, dimColor: !isSelected, children: label }),
|
|
15912
|
+
t && /* @__PURE__ */ jsx24(Box22, { marginLeft: 1, children: /* @__PURE__ */ jsx24(PaletteSwatches, { palette: t.palette }) })
|
|
15963
15913
|
] });
|
|
15964
15914
|
}
|
|
15965
15915
|
}
|
|
@@ -17146,8 +17096,8 @@ var init_lsp_nudge = __esm({
|
|
|
17146
17096
|
});
|
|
17147
17097
|
|
|
17148
17098
|
// src/ui/file-picker.tsx
|
|
17149
|
-
import { Box as
|
|
17150
|
-
import { jsx as
|
|
17099
|
+
import { Box as Box23, Text as Text24 } from "ink";
|
|
17100
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
17151
17101
|
function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
17152
17102
|
const theme = useTheme();
|
|
17153
17103
|
let startIndex = 0;
|
|
@@ -17159,12 +17109,12 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
|
17159
17109
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT;
|
|
17160
17110
|
const recentInVisible = visible.filter((item) => recentFiles?.has(item.name)).length;
|
|
17161
17111
|
const hasRecentSection = recentInVisible > 0;
|
|
17162
|
-
return /* @__PURE__ */
|
|
17163
|
-
/* @__PURE__ */
|
|
17164
|
-
/* @__PURE__ */
|
|
17165
|
-
/* @__PURE__ */
|
|
17166
|
-
visible.length === 0 && /* @__PURE__ */
|
|
17167
|
-
hasMoreAbove && /* @__PURE__ */
|
|
17112
|
+
return /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
17113
|
+
/* @__PURE__ */ jsx25(Text24, { color: theme.accent, bold: true, children: query ? `Files matching "${query}"` : "Mention a file" }),
|
|
17114
|
+
/* @__PURE__ */ jsx25(Text24, { color: theme.info.color, dimColor: true, children: "\u2191\u2193 navigate \xB7 Enter pick \xB7 Esc cancel" }),
|
|
17115
|
+
/* @__PURE__ */ jsxs23(Box23, { marginTop: 1, flexDirection: "column", children: [
|
|
17116
|
+
visible.length === 0 && /* @__PURE__ */ jsx25(Text24, { color: theme.info.color, children: "No matches" }),
|
|
17117
|
+
hasMoreAbove && /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, dimColor: true, children: [
|
|
17168
17118
|
"\u2026 ",
|
|
17169
17119
|
startIndex,
|
|
17170
17120
|
" more above"
|
|
@@ -17176,28 +17126,28 @@ function FilePicker({ items, selectedIndex, query, recentFiles }) {
|
|
|
17176
17126
|
const label = item.isDirectory ? `${item.name}/` : item.name;
|
|
17177
17127
|
const isFirstRecent = isRecent && (i === 0 || !recentFiles?.has(visible[i - 1]?.name ?? ""));
|
|
17178
17128
|
const isFirstNonRecentAfterRecent = !isRecent && (i > 0 && recentFiles?.has(visible[i - 1]?.name ?? ""));
|
|
17179
|
-
return /* @__PURE__ */
|
|
17180
|
-
hasRecentSection && isFirstRecent && /* @__PURE__ */
|
|
17129
|
+
return /* @__PURE__ */ jsxs23(Box23, { flexDirection: "column", children: [
|
|
17130
|
+
hasRecentSection && isFirstRecent && /* @__PURE__ */ jsxs23(Text24, { color: theme.palette.success, bold: true, children: [
|
|
17181
17131
|
" ",
|
|
17182
17132
|
"Recent"
|
|
17183
17133
|
] }),
|
|
17184
|
-
hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */
|
|
17134
|
+
hasRecentSection && isFirstNonRecentAfterRecent && /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, dimColor: true, children: [
|
|
17185
17135
|
" ",
|
|
17186
17136
|
"All files"
|
|
17187
17137
|
] }),
|
|
17188
|
-
/* @__PURE__ */
|
|
17138
|
+
/* @__PURE__ */ jsxs23(Text24, { color: isSelected ? theme.accent : isRecent ? theme.palette.success : void 0, bold: isSelected || isRecent, children: [
|
|
17189
17139
|
isSelected ? "\u203A " : isRecent ? "\u2192 " : " ",
|
|
17190
17140
|
isRecent ? "\u21BB " : "",
|
|
17191
17141
|
label
|
|
17192
17142
|
] })
|
|
17193
17143
|
] }, item.name);
|
|
17194
17144
|
}),
|
|
17195
|
-
hasMoreBelow && /* @__PURE__ */
|
|
17145
|
+
hasMoreBelow && /* @__PURE__ */ jsxs23(Text24, { color: theme.info.color, dimColor: true, children: [
|
|
17196
17146
|
"\u2026 ",
|
|
17197
17147
|
items.length - (startIndex + VISIBLE_LIMIT),
|
|
17198
17148
|
" more below"
|
|
17199
17149
|
] }),
|
|
17200
|
-
hasRecentSection && /* @__PURE__ */
|
|
17150
|
+
hasRecentSection && /* @__PURE__ */ jsx25(Box23, { marginTop: 1, children: /* @__PURE__ */ jsx25(Text24, { color: theme.info.color, dimColor: true, children: "\u21BB = recently used" }) })
|
|
17201
17151
|
] })
|
|
17202
17152
|
] });
|
|
17203
17153
|
}
|
|
@@ -17211,8 +17161,8 @@ var init_file_picker = __esm({
|
|
|
17211
17161
|
});
|
|
17212
17162
|
|
|
17213
17163
|
// src/ui/slash-picker.tsx
|
|
17214
|
-
import { Box as
|
|
17215
|
-
import { jsx as
|
|
17164
|
+
import { Box as Box24, Text as Text25 } from "ink";
|
|
17165
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
17216
17166
|
function sourceBadge(source) {
|
|
17217
17167
|
if (source === "builtin") return "";
|
|
17218
17168
|
if (source === "project") return "project";
|
|
@@ -17232,12 +17182,12 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
17232
17182
|
const hasMoreBelow = items.length > startIndex + VISIBLE_LIMIT2;
|
|
17233
17183
|
const longestLabel = visible.reduce((m, it) => Math.max(m, commandLabel(it).length), 0);
|
|
17234
17184
|
const nameColWidth = Math.max(NAME_COL_MIN_WIDTH, longestLabel + NAME_DESC_GAP);
|
|
17235
|
-
return /* @__PURE__ */
|
|
17236
|
-
/* @__PURE__ */
|
|
17237
|
-
/* @__PURE__ */
|
|
17238
|
-
/* @__PURE__ */
|
|
17239
|
-
visible.length === 0 && /* @__PURE__ */
|
|
17240
|
-
hasMoreAbove && /* @__PURE__ */
|
|
17185
|
+
return /* @__PURE__ */ jsxs24(Box24, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
17186
|
+
/* @__PURE__ */ jsx26(Text25, { color: theme.accent, bold: true, children: query ? `Commands matching "/${query}"` : "Slash commands" }),
|
|
17187
|
+
/* @__PURE__ */ jsx26(Text25, { color: theme.info.color, children: "Arrow keys to navigate, Enter to select, Esc to cancel." }),
|
|
17188
|
+
/* @__PURE__ */ jsxs24(Box24, { marginTop: 1, flexDirection: "column", children: [
|
|
17189
|
+
visible.length === 0 && /* @__PURE__ */ jsx26(Text25, { color: theme.info.color, children: "No matches" }),
|
|
17190
|
+
hasMoreAbove && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
17241
17191
|
"\u2026 ",
|
|
17242
17192
|
startIndex,
|
|
17243
17193
|
" more above"
|
|
@@ -17247,16 +17197,16 @@ function SlashPicker({ items, selectedIndex, query }) {
|
|
|
17247
17197
|
const isSelected = actualIndex === selectedIndex;
|
|
17248
17198
|
const nameCol = commandLabel(item).padEnd(nameColWidth);
|
|
17249
17199
|
const badge = sourceBadge(item.source);
|
|
17250
|
-
return /* @__PURE__ */
|
|
17200
|
+
return /* @__PURE__ */ jsxs24(Text25, { color: isSelected ? theme.accent : void 0, bold: isSelected, children: [
|
|
17251
17201
|
isSelected ? "\u203A " : " ",
|
|
17252
17202
|
nameCol,
|
|
17253
|
-
/* @__PURE__ */
|
|
17203
|
+
/* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
17254
17204
|
item.description,
|
|
17255
17205
|
badge && ` [${badge}]`
|
|
17256
17206
|
] })
|
|
17257
17207
|
] }, item.name);
|
|
17258
17208
|
}),
|
|
17259
|
-
hasMoreBelow && /* @__PURE__ */
|
|
17209
|
+
hasMoreBelow && /* @__PURE__ */ jsxs24(Text25, { color: theme.info.color, children: [
|
|
17260
17210
|
"\u2026 ",
|
|
17261
17211
|
items.length - (startIndex + VISIBLE_LIMIT2),
|
|
17262
17212
|
" more below"
|
|
@@ -17366,18 +17316,19 @@ __export(app_exports, {
|
|
|
17366
17316
|
shouldOpenMentionPicker: () => shouldOpenMentionPicker,
|
|
17367
17317
|
shouldOpenSlashPicker: () => shouldOpenSlashPicker
|
|
17368
17318
|
});
|
|
17369
|
-
import
|
|
17370
|
-
import { Box as
|
|
17371
|
-
import
|
|
17319
|
+
import React16, { useState as useState13, useRef as useRef3, useEffect as useEffect6, useCallback as useCallback4 } from "react";
|
|
17320
|
+
import { Box as Box25, Text as Text26, useApp, useInput as useInput10, render } from "ink";
|
|
17321
|
+
import SelectInput9 from "ink-select-input";
|
|
17372
17322
|
import { existsSync as existsSync4, statSync as statSync4 } from "fs";
|
|
17373
17323
|
import { join as join28 } from "path";
|
|
17324
|
+
import QRCode from "qrcode";
|
|
17374
17325
|
import { unlink as unlink4 } from "fs/promises";
|
|
17375
17326
|
import { execSync as execSync2 } from "child_process";
|
|
17376
17327
|
import { spawn as spawn4 } from "child_process";
|
|
17377
17328
|
import { platform as platform4 } from "os";
|
|
17378
17329
|
import fg4 from "fast-glob";
|
|
17379
17330
|
import { readFileSync as readFileSync3 } from "fs";
|
|
17380
|
-
import { jsx as
|
|
17331
|
+
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
17381
17332
|
function buildFilePickerIgnoreList(cwd) {
|
|
17382
17333
|
const hardcoded = [
|
|
17383
17334
|
// Dependencies
|
|
@@ -17516,7 +17467,7 @@ function gatewayUsageLookupFromConfig(cfg, meta) {
|
|
|
17516
17467
|
meta
|
|
17517
17468
|
};
|
|
17518
17469
|
}
|
|
17519
|
-
function
|
|
17470
|
+
function openBrowser(url) {
|
|
17520
17471
|
const cmd = platform4() === "darwin" ? "open" : platform4() === "win32" ? "start" : "xdg-open";
|
|
17521
17472
|
const child = spawn4(cmd, [url], { detached: true, stdio: "ignore" });
|
|
17522
17473
|
child.unref();
|
|
@@ -17626,13 +17577,13 @@ function App({
|
|
|
17626
17577
|
initialCloudDeviceId
|
|
17627
17578
|
}) {
|
|
17628
17579
|
const { exit } = useApp();
|
|
17629
|
-
const [cfg, setCfg] =
|
|
17630
|
-
const [lspScope, setLspScope] =
|
|
17631
|
-
const [lspProjectPath, setLspProjectPath] =
|
|
17632
|
-
const [cloudToken, setCloudToken] =
|
|
17633
|
-
const [cloudDeviceId, setCloudDeviceId] =
|
|
17634
|
-
const [events, setRawEvents] =
|
|
17635
|
-
const setEvents =
|
|
17580
|
+
const [cfg, setCfg] = useState13(initialCfg);
|
|
17581
|
+
const [lspScope, setLspScope] = useState13(initialLspScope);
|
|
17582
|
+
const [lspProjectPath, setLspProjectPath] = useState13(initialLspProjectPath);
|
|
17583
|
+
const [cloudToken, setCloudToken] = useState13(initialCloudToken);
|
|
17584
|
+
const [cloudDeviceId, setCloudDeviceId] = useState13(initialCloudDeviceId);
|
|
17585
|
+
const [events, setRawEvents] = useState13([]);
|
|
17586
|
+
const setEvents = useCallback4(
|
|
17636
17587
|
(updater) => {
|
|
17637
17588
|
setRawEvents((prev) => {
|
|
17638
17589
|
const next = typeof updater === "function" ? updater(prev) : updater;
|
|
@@ -17641,59 +17592,60 @@ function App({
|
|
|
17641
17592
|
},
|
|
17642
17593
|
[]
|
|
17643
17594
|
);
|
|
17644
|
-
const [input, setInput] =
|
|
17645
|
-
const [busy, setBusy] =
|
|
17646
|
-
const [usage, setUsage] =
|
|
17647
|
-
const [sessionUsage, setSessionUsage] =
|
|
17648
|
-
const [gatewayMeta, setGatewayMeta] =
|
|
17649
|
-
const [cloudBudget, setCloudBudget] =
|
|
17650
|
-
const [showReasoning, setShowReasoning] =
|
|
17651
|
-
const [perm, setPerm] =
|
|
17652
|
-
const [limitModal, setLimitModal] =
|
|
17653
|
-
const [loopModal, setLoopModal] =
|
|
17654
|
-
const [queue, setQueue] =
|
|
17655
|
-
const [history, setHistory] =
|
|
17656
|
-
const [historyIndex, setHistoryIndex] =
|
|
17657
|
-
const [draftInput, setDraftInput] =
|
|
17658
|
-
const [mode, setMode] =
|
|
17659
|
-
const [codeMode, setCodeMode] =
|
|
17595
|
+
const [input, setInput] = useState13("");
|
|
17596
|
+
const [busy, setBusy] = useState13(false);
|
|
17597
|
+
const [usage, setUsage] = useState13(null);
|
|
17598
|
+
const [sessionUsage, setSessionUsage] = useState13(null);
|
|
17599
|
+
const [gatewayMeta, setGatewayMeta] = useState13(null);
|
|
17600
|
+
const [cloudBudget, setCloudBudget] = useState13(null);
|
|
17601
|
+
const [showReasoning, setShowReasoning] = useState13(false);
|
|
17602
|
+
const [perm, setPerm] = useState13(null);
|
|
17603
|
+
const [limitModal, setLimitModal] = useState13(null);
|
|
17604
|
+
const [loopModal, setLoopModal] = useState13(null);
|
|
17605
|
+
const [queue, setQueue] = useState13([]);
|
|
17606
|
+
const [history, setHistory] = useState13([]);
|
|
17607
|
+
const [historyIndex, setHistoryIndex] = useState13(-1);
|
|
17608
|
+
const [draftInput, setDraftInput] = useState13("");
|
|
17609
|
+
const [mode, setMode] = useState13("edit");
|
|
17610
|
+
const [codeMode, setCodeMode] = useState13(false);
|
|
17660
17611
|
const filePickerEnabled = initialCfg?.filePicker ?? true;
|
|
17661
|
-
const [effort, setEffort] =
|
|
17612
|
+
const [effort, setEffort] = useState13(
|
|
17662
17613
|
initialCfg?.reasoningEffort ?? DEFAULT_REASONING_EFFORT
|
|
17663
17614
|
);
|
|
17664
|
-
const [resumeSessions, setResumeSessions] =
|
|
17665
|
-
const [checkpointSession, setCheckpointSession] =
|
|
17666
|
-
const [checkpointList, setCheckpointList] =
|
|
17667
|
-
const [commandWizard, setCommandWizard] =
|
|
17668
|
-
const [commandPicker, setCommandPicker] =
|
|
17669
|
-
const [commandToDelete, setCommandToDelete] =
|
|
17670
|
-
const [showCommandList, setShowCommandList] =
|
|
17671
|
-
const [showLspWizard, setShowLspWizard] =
|
|
17672
|
-
const [showRemoteDashboard, setShowRemoteDashboard] =
|
|
17673
|
-
const [selectedRemoteSession, setSelectedRemoteSession] =
|
|
17674
|
-
const [
|
|
17675
|
-
const [
|
|
17676
|
-
const [
|
|
17677
|
-
const [
|
|
17678
|
-
const [
|
|
17679
|
-
const [
|
|
17680
|
-
const [
|
|
17681
|
-
const [
|
|
17682
|
-
const [
|
|
17683
|
-
const [
|
|
17684
|
-
const [
|
|
17685
|
-
const [
|
|
17686
|
-
const [
|
|
17687
|
-
const [
|
|
17688
|
-
const [
|
|
17689
|
-
const [
|
|
17690
|
-
const [
|
|
17691
|
-
const [
|
|
17692
|
-
const [
|
|
17693
|
-
|
|
17615
|
+
const [resumeSessions, setResumeSessions] = useState13(null);
|
|
17616
|
+
const [checkpointSession, setCheckpointSession] = useState13(null);
|
|
17617
|
+
const [checkpointList, setCheckpointList] = useState13([]);
|
|
17618
|
+
const [commandWizard, setCommandWizard] = useState13(null);
|
|
17619
|
+
const [commandPicker, setCommandPicker] = useState13(null);
|
|
17620
|
+
const [commandToDelete, setCommandToDelete] = useState13(null);
|
|
17621
|
+
const [showCommandList, setShowCommandList] = useState13(false);
|
|
17622
|
+
const [showLspWizard, setShowLspWizard] = useState13(false);
|
|
17623
|
+
const [showRemoteDashboard, setShowRemoteDashboard] = useState13(false);
|
|
17624
|
+
const [selectedRemoteSession, setSelectedRemoteSession] = useState13(null);
|
|
17625
|
+
const [showInboxModal, setShowInboxModal] = useState13(false);
|
|
17626
|
+
const [tasks, setTasks] = useState13([]);
|
|
17627
|
+
const [tasksStartedAt, setTasksStartedAt] = useState13(null);
|
|
17628
|
+
const [tasksStartTokens, setTasksStartTokens] = useState13(0);
|
|
17629
|
+
const [turnStartedAt, setTurnStartedAt] = useState13(null);
|
|
17630
|
+
const [turnPhase, setTurnPhase] = useState13("waiting");
|
|
17631
|
+
const [currentToolName, setCurrentToolName] = useState13(null);
|
|
17632
|
+
const [lastActivityAt, setLastActivityAt] = useState13(null);
|
|
17633
|
+
const [verbose, setVerbose] = useState13(false);
|
|
17634
|
+
const [hasUpdate, setHasUpdate] = useState13(initialUpdateResult?.hasUpdate ?? false);
|
|
17635
|
+
const [latestVersion, setLatestVersion] = useState13(initialUpdateResult?.latestVersion ?? null);
|
|
17636
|
+
const [theme, setTheme] = useState13(resolveTheme(initialCfg?.theme));
|
|
17637
|
+
const [showThemePicker, setShowThemePicker] = useState13(false);
|
|
17638
|
+
const [originalTheme, setOriginalTheme] = useState13(null);
|
|
17639
|
+
const [skillsActive, setSkillsActive] = useState13(0);
|
|
17640
|
+
const [memoryRecalled, setMemoryRecalled] = useState13(false);
|
|
17641
|
+
const [intentTier, setIntentTier] = useState13(null);
|
|
17642
|
+
const [kimiMdStale, setKimiMdStale] = useState13(false);
|
|
17643
|
+
const [gitBranch, setGitBranch] = useState13(null);
|
|
17644
|
+
const [lastSessionTopic, setLastSessionTopic] = useState13(null);
|
|
17645
|
+
useEffect6(() => {
|
|
17694
17646
|
setGitBranch(detectGitBranch());
|
|
17695
17647
|
}, []);
|
|
17696
|
-
|
|
17648
|
+
useEffect6(() => {
|
|
17697
17649
|
void Promise.resolve().then(() => (init_sessions(), sessions_exports)).then(
|
|
17698
17650
|
({ listSessions: listSessions2 }) => listSessions2(1).then((sessions) => {
|
|
17699
17651
|
const last = sessions[0];
|
|
@@ -17703,7 +17655,7 @@ function App({
|
|
|
17703
17655
|
})
|
|
17704
17656
|
);
|
|
17705
17657
|
}, []);
|
|
17706
|
-
|
|
17658
|
+
useEffect6(() => {
|
|
17707
17659
|
const onSigint = () => {
|
|
17708
17660
|
logger.info("sigint:fired", {
|
|
17709
17661
|
hasHandler: sigintHandlerRef.current !== null
|
|
@@ -17715,7 +17667,7 @@ function App({
|
|
|
17715
17667
|
process.off("SIGINT", onSigint);
|
|
17716
17668
|
};
|
|
17717
17669
|
}, []);
|
|
17718
|
-
|
|
17670
|
+
useEffect6(() => {
|
|
17719
17671
|
let cancelled = false;
|
|
17720
17672
|
loadAndMergeThemes().then(({ errors, wcagWarnings }) => {
|
|
17721
17673
|
if (cancelled) return;
|
|
@@ -17739,7 +17691,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17739
17691
|
cancelled = true;
|
|
17740
17692
|
};
|
|
17741
17693
|
}, []);
|
|
17742
|
-
|
|
17694
|
+
useEffect6(() => {
|
|
17743
17695
|
if (!cfg?.cloudMode || !initialCloudToken) return;
|
|
17744
17696
|
let cancelled = false;
|
|
17745
17697
|
const fetchBudget = async () => {
|
|
@@ -17765,11 +17717,11 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17765
17717
|
cancelled = true;
|
|
17766
17718
|
};
|
|
17767
17719
|
}, [cfg?.cloudMode, initialCloudToken]);
|
|
17768
|
-
const [cursorOffset, setCursorOffset] =
|
|
17769
|
-
const [activePicker, setActivePicker] =
|
|
17770
|
-
const [filePickerItems, setFilePickerItems] =
|
|
17720
|
+
const [cursorOffset, setCursorOffset] = useState13(0);
|
|
17721
|
+
const [activePicker, setActivePicker] = useState13(null);
|
|
17722
|
+
const [filePickerItems, setFilePickerItems] = useState13([]);
|
|
17771
17723
|
const filePickerLoadedRef = useRef3(false);
|
|
17772
|
-
const [customCommandsVersion, setCustomCommandsVersion] =
|
|
17724
|
+
const [customCommandsVersion, setCustomCommandsVersion] = useState13(0);
|
|
17773
17725
|
const cacheStableRef = useRef3(initialCfg?.cacheStablePrompts !== false);
|
|
17774
17726
|
const messagesRef = useRef3(
|
|
17775
17727
|
makePrefixMessages(cacheStableRef.current, cfg?.model ?? DEFAULT_MODEL, "edit", ALL_TOOLS)
|
|
@@ -17822,11 +17774,11 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17822
17774
|
const MAX_RECENT_FILES = 10;
|
|
17823
17775
|
const pickerAnchor = activePicker?.anchor ?? null;
|
|
17824
17776
|
const pickerKind = activePicker?.kind ?? null;
|
|
17825
|
-
const pickerQuery =
|
|
17777
|
+
const pickerQuery = React16.useMemo(() => {
|
|
17826
17778
|
if (pickerAnchor === null) return null;
|
|
17827
17779
|
return input.slice(pickerAnchor + 1, cursorOffset);
|
|
17828
17780
|
}, [input, cursorOffset, pickerAnchor]);
|
|
17829
|
-
const filteredFileItems =
|
|
17781
|
+
const filteredFileItems = React16.useMemo(() => {
|
|
17830
17782
|
if (pickerKind !== "file" || pickerQuery === null) return [];
|
|
17831
17783
|
const items = filterPickerItems(filePickerItems, pickerQuery).slice();
|
|
17832
17784
|
const now2 = Date.now();
|
|
@@ -17841,7 +17793,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17841
17793
|
return a.name.localeCompare(b.name);
|
|
17842
17794
|
});
|
|
17843
17795
|
}, [pickerKind, filePickerItems, pickerQuery]);
|
|
17844
|
-
const allSlashCommands =
|
|
17796
|
+
const allSlashCommands = React16.useMemo(() => {
|
|
17845
17797
|
const customs = customCommandsRef.current.filter((c) => !BUILTIN_COMMAND_NAMES.has(c.name.toLowerCase())).map((c) => ({
|
|
17846
17798
|
name: c.name,
|
|
17847
17799
|
description: c.description ?? "",
|
|
@@ -17849,11 +17801,11 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17849
17801
|
}));
|
|
17850
17802
|
return [...BUILTIN_COMMANDS, ...customs];
|
|
17851
17803
|
}, [customCommandsVersion]);
|
|
17852
|
-
const filteredSlashItems =
|
|
17804
|
+
const filteredSlashItems = React16.useMemo(() => {
|
|
17853
17805
|
if (pickerKind !== "slash" || pickerQuery === null) return [];
|
|
17854
17806
|
return fuzzyFilter(allSlashCommands, pickerQuery, (c) => c.name).slice(0, 50);
|
|
17855
17807
|
}, [pickerKind, allSlashCommands, pickerQuery]);
|
|
17856
|
-
|
|
17808
|
+
useEffect6(() => {
|
|
17857
17809
|
if (activePicker !== null) {
|
|
17858
17810
|
const trigger = activePicker.kind === "file" ? "@" : "/";
|
|
17859
17811
|
if (cursorOffset < activePicker.anchor) {
|
|
@@ -17910,28 +17862,28 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17910
17862
|
return;
|
|
17911
17863
|
}
|
|
17912
17864
|
}, [input, cursorOffset, activePicker, filePickerEnabled]);
|
|
17913
|
-
|
|
17865
|
+
useEffect6(() => {
|
|
17914
17866
|
if (activePicker?.kind !== "file") return;
|
|
17915
17867
|
const max = Math.max(0, filteredFileItems.length - 1);
|
|
17916
17868
|
if (activePicker.selected > max) {
|
|
17917
17869
|
setActivePicker({ ...activePicker, selected: max });
|
|
17918
17870
|
}
|
|
17919
17871
|
}, [filteredFileItems.length, activePicker]);
|
|
17920
|
-
|
|
17872
|
+
useEffect6(() => {
|
|
17921
17873
|
if (activePicker?.kind !== "slash") return;
|
|
17922
17874
|
const max = Math.max(0, filteredSlashItems.length - 1);
|
|
17923
17875
|
if (activePicker.selected > max) {
|
|
17924
17876
|
setActivePicker({ ...activePicker, selected: max });
|
|
17925
17877
|
}
|
|
17926
17878
|
}, [filteredSlashItems.length, activePicker]);
|
|
17927
|
-
const handlePickerUp =
|
|
17879
|
+
const handlePickerUp = useCallback4(() => {
|
|
17928
17880
|
setActivePicker((p) => {
|
|
17929
17881
|
if (!p) return null;
|
|
17930
17882
|
const next = Math.max(0, p.selected - 1);
|
|
17931
17883
|
return next === p.selected ? p : { ...p, selected: next };
|
|
17932
17884
|
});
|
|
17933
17885
|
}, []);
|
|
17934
|
-
const handlePickerDown =
|
|
17886
|
+
const handlePickerDown = useCallback4(() => {
|
|
17935
17887
|
setActivePicker((p) => {
|
|
17936
17888
|
if (!p) return null;
|
|
17937
17889
|
const max = p.kind === "file" ? Math.max(0, filteredFileItems.length - 1) : Math.max(0, filteredSlashItems.length - 1);
|
|
@@ -17939,7 +17891,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17939
17891
|
return next === p.selected ? p : { ...p, selected: next };
|
|
17940
17892
|
});
|
|
17941
17893
|
}, [filteredFileItems.length, filteredSlashItems.length]);
|
|
17942
|
-
const handlePickerSelect =
|
|
17894
|
+
const handlePickerSelect = useCallback4(() => {
|
|
17943
17895
|
if (!activePicker) return;
|
|
17944
17896
|
if (activePicker.kind === "file") {
|
|
17945
17897
|
const item2 = filteredFileItems[activePicker.selected];
|
|
@@ -17958,12 +17910,12 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17958
17910
|
setActivePicker(null);
|
|
17959
17911
|
submitRef.current(value);
|
|
17960
17912
|
}, [activePicker, filteredFileItems, filteredSlashItems, input, cursorOffset]);
|
|
17961
|
-
const handlePickerCancel =
|
|
17913
|
+
const handlePickerCancel = useCallback4(() => {
|
|
17962
17914
|
pickerCancelRef.current = cursorOffset;
|
|
17963
17915
|
setActivePicker(null);
|
|
17964
17916
|
}, [cursorOffset]);
|
|
17965
|
-
|
|
17966
|
-
const modalActive = commandWizard !== null || commandPicker !== null || commandToDelete !== null || showCommandList || showLspWizard || resumeSessions !== null || checkpointSession !== null || perm !== null || limitModal !== null || loopModal !== null;
|
|
17917
|
+
useEffect6(() => {
|
|
17918
|
+
const modalActive = commandWizard !== null || commandPicker !== null || commandToDelete !== null || showCommandList || showLspWizard || resumeSessions !== null || checkpointSession !== null || perm !== null || limitModal !== null || loopModal !== null || showInboxModal;
|
|
17967
17919
|
if (modalActive && activePicker !== null) {
|
|
17968
17920
|
setActivePicker(null);
|
|
17969
17921
|
}
|
|
@@ -17977,9 +17929,10 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17977
17929
|
perm,
|
|
17978
17930
|
limitModal,
|
|
17979
17931
|
loopModal,
|
|
17932
|
+
showInboxModal,
|
|
17980
17933
|
activePicker
|
|
17981
17934
|
]);
|
|
17982
|
-
|
|
17935
|
+
useEffect6(() => {
|
|
17983
17936
|
if (!cfg) return;
|
|
17984
17937
|
void Promise.resolve().then(() => (init_sessions(), sessions_exports)).then(
|
|
17985
17938
|
({ pruneSessions: pruneSessions2 }) => pruneSessions2().then((removed) => {
|
|
@@ -18091,7 +18044,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18091
18044
|
}
|
|
18092
18045
|
});
|
|
18093
18046
|
}, [cfg, setEvents]);
|
|
18094
|
-
|
|
18047
|
+
useEffect6(() => {
|
|
18095
18048
|
const id = setInterval(() => {
|
|
18096
18049
|
try {
|
|
18097
18050
|
performance.clearMarks();
|
|
@@ -18101,7 +18054,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18101
18054
|
}, 3e5);
|
|
18102
18055
|
return () => clearInterval(id);
|
|
18103
18056
|
}, []);
|
|
18104
|
-
const reloadCustomCommands =
|
|
18057
|
+
const reloadCustomCommands = useCallback4(async () => {
|
|
18105
18058
|
const { commands, warnings } = await loadCustomCommands(process.cwd());
|
|
18106
18059
|
customCommandsRef.current = commands;
|
|
18107
18060
|
setCustomCommandsVersion((v) => v + 1);
|
|
@@ -18116,7 +18069,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18116
18069
|
]);
|
|
18117
18070
|
}
|
|
18118
18071
|
}, [setEvents]);
|
|
18119
|
-
|
|
18072
|
+
useEffect6(() => {
|
|
18120
18073
|
if (!cfg || updateCheckedRef.current) return;
|
|
18121
18074
|
updateCheckedRef.current = true;
|
|
18122
18075
|
if (initialUpdateResult) {
|
|
@@ -18167,7 +18120,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18167
18120
|
}
|
|
18168
18121
|
});
|
|
18169
18122
|
}, [cfg, initialUpdateResult]);
|
|
18170
|
-
|
|
18123
|
+
useEffect6(() => {
|
|
18171
18124
|
modeRef.current = mode;
|
|
18172
18125
|
if (cacheStableRef.current) {
|
|
18173
18126
|
messagesRef.current[1] = {
|
|
@@ -18194,10 +18147,10 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18194
18147
|
executorRef.current.clearSessionPermissions();
|
|
18195
18148
|
}
|
|
18196
18149
|
}, [mode, cfg?.model]);
|
|
18197
|
-
|
|
18150
|
+
useEffect6(() => {
|
|
18198
18151
|
effortRef.current = effort;
|
|
18199
18152
|
}, [effort]);
|
|
18200
|
-
|
|
18153
|
+
useEffect6(() => {
|
|
18201
18154
|
if (!cfg) return;
|
|
18202
18155
|
const id = setInterval(() => {
|
|
18203
18156
|
void checkForUpdate().then((result) => {
|
|
@@ -18228,7 +18181,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18228
18181
|
}, 30 * 60 * 1e3);
|
|
18229
18182
|
return () => clearInterval(id);
|
|
18230
18183
|
}, [cfg]);
|
|
18231
|
-
const initMcp =
|
|
18184
|
+
const initMcp = useCallback4(async () => {
|
|
18232
18185
|
if (!cfg?.mcpServers || mcpInitRef.current) return;
|
|
18233
18186
|
mcpInitRef.current = true;
|
|
18234
18187
|
const manager = mcpManagerRef.current;
|
|
@@ -18289,7 +18242,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18289
18242
|
]);
|
|
18290
18243
|
}
|
|
18291
18244
|
}, [cfg]);
|
|
18292
|
-
const initLsp =
|
|
18245
|
+
const initLsp = useCallback4(async () => {
|
|
18293
18246
|
if (!cfg?.lspEnabled || !cfg?.lspServers || lspInitRef.current) {
|
|
18294
18247
|
if (lspInitRef.current) return;
|
|
18295
18248
|
if (!cfg?.lspEnabled) {
|
|
@@ -18352,7 +18305,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18352
18305
|
]);
|
|
18353
18306
|
}
|
|
18354
18307
|
}, [cfg]);
|
|
18355
|
-
|
|
18308
|
+
useEffect6(() => {
|
|
18356
18309
|
if (cfg && !mcpInitRef.current) {
|
|
18357
18310
|
void initMcp();
|
|
18358
18311
|
}
|
|
@@ -18360,7 +18313,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18360
18313
|
void initLsp();
|
|
18361
18314
|
}
|
|
18362
18315
|
}, [cfg, initMcp, initLsp]);
|
|
18363
|
-
const ensureSessionId =
|
|
18316
|
+
const ensureSessionId = useCallback4(() => {
|
|
18364
18317
|
if (sessionIdRef.current) return sessionIdRef.current;
|
|
18365
18318
|
const firstUser = messagesRef.current.find((m) => m.role === "user");
|
|
18366
18319
|
let firstText = "session";
|
|
@@ -18373,7 +18326,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18373
18326
|
sessionIdRef.current = makeSessionId(firstText);
|
|
18374
18327
|
return sessionIdRef.current;
|
|
18375
18328
|
}, []);
|
|
18376
|
-
const saveSessionSafe =
|
|
18329
|
+
const saveSessionSafe = useCallback4(async () => {
|
|
18377
18330
|
if (!cfg) return;
|
|
18378
18331
|
ensureSessionId();
|
|
18379
18332
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -18399,7 +18352,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18399
18352
|
]);
|
|
18400
18353
|
}
|
|
18401
18354
|
}, [cfg, ensureSessionId]);
|
|
18402
|
-
const onIterationEnd =
|
|
18355
|
+
const onIterationEnd = useCallback4(
|
|
18403
18356
|
async (messages, signal) => {
|
|
18404
18357
|
if (signal.aborted) return messages;
|
|
18405
18358
|
if (!shouldCompact({ messages })) return messages;
|
|
@@ -18477,7 +18430,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18477
18430
|
},
|
|
18478
18431
|
[cfg]
|
|
18479
18432
|
);
|
|
18480
|
-
|
|
18433
|
+
useInput10((inputChar, key) => {
|
|
18481
18434
|
if (key.ctrl && inputChar === "c") {
|
|
18482
18435
|
logger.info("input:ctrl+c", {
|
|
18483
18436
|
busy: busyRef.current,
|
|
@@ -18614,7 +18567,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18614
18567
|
void lspManagerRef.current.stopAll().finally(() => exit());
|
|
18615
18568
|
}
|
|
18616
18569
|
};
|
|
18617
|
-
const flushAssistantUpdates =
|
|
18570
|
+
const flushAssistantUpdates = useCallback4(() => {
|
|
18618
18571
|
flushTimeoutRef.current = null;
|
|
18619
18572
|
const pending = pendingTextRef.current;
|
|
18620
18573
|
if (pending.size === 0) return;
|
|
@@ -18632,7 +18585,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18632
18585
|
})
|
|
18633
18586
|
);
|
|
18634
18587
|
}, []);
|
|
18635
|
-
const updateAssistant =
|
|
18588
|
+
const updateAssistant = useCallback4(
|
|
18636
18589
|
(id, patch) => {
|
|
18637
18590
|
const result = patch({ text: "", reasoning: "" });
|
|
18638
18591
|
const assistantResult = result;
|
|
@@ -18661,7 +18614,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18661
18614
|
},
|
|
18662
18615
|
[flushAssistantUpdates]
|
|
18663
18616
|
);
|
|
18664
|
-
const updateTool =
|
|
18617
|
+
const updateTool = useCallback4(
|
|
18665
18618
|
(id, patch) => {
|
|
18666
18619
|
setEvents(
|
|
18667
18620
|
(evts) => evts.map(
|
|
@@ -18671,11 +18624,11 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18671
18624
|
},
|
|
18672
18625
|
[]
|
|
18673
18626
|
);
|
|
18674
|
-
const updateGatewayMeta =
|
|
18627
|
+
const updateGatewayMeta = useCallback4((meta) => {
|
|
18675
18628
|
gatewayMetaRef.current = meta;
|
|
18676
18629
|
setGatewayMeta(meta);
|
|
18677
18630
|
}, []);
|
|
18678
|
-
const runCompact =
|
|
18631
|
+
const runCompact = useCallback4(async () => {
|
|
18679
18632
|
if (!cfg) return;
|
|
18680
18633
|
if (busy) {
|
|
18681
18634
|
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "can't compact while model is running" }]);
|
|
@@ -18771,11 +18724,11 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18771
18724
|
pendingToolCallsRef.current.clear();
|
|
18772
18725
|
}
|
|
18773
18726
|
}, [cfg, busy, saveSessionSafe]);
|
|
18774
|
-
const openResumePicker =
|
|
18727
|
+
const openResumePicker = useCallback4(async () => {
|
|
18775
18728
|
const sessions = await listSessions(200, process.cwd());
|
|
18776
18729
|
setResumeSessions(sessions);
|
|
18777
18730
|
}, []);
|
|
18778
|
-
const runInit =
|
|
18731
|
+
const runInit = useCallback4(async () => {
|
|
18779
18732
|
if (!cfg) return;
|
|
18780
18733
|
if (busy) {
|
|
18781
18734
|
setEvents((e) => [...e, { kind: "info", key: mkKey(), text: "can't /init while model is running" }]);
|
|
@@ -19098,7 +19051,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
19098
19051
|
pendingToolCallsRef.current.clear();
|
|
19099
19052
|
}
|
|
19100
19053
|
}, [cfg, busy, updateAssistant, updateTool, updateGatewayMeta]);
|
|
19101
|
-
const handleThemePick =
|
|
19054
|
+
const handleThemePick = useCallback4(
|
|
19102
19055
|
(picked) => {
|
|
19103
19056
|
setShowThemePicker(false);
|
|
19104
19057
|
if (!picked) return;
|
|
@@ -19116,7 +19069,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
19116
19069
|
},
|
|
19117
19070
|
[]
|
|
19118
19071
|
);
|
|
19119
|
-
const doResumeSession =
|
|
19072
|
+
const doResumeSession = useCallback4(
|
|
19120
19073
|
async (filePath, checkpointId) => {
|
|
19121
19074
|
try {
|
|
19122
19075
|
const file = checkpointId ? (await loadSessionFromCheckpoint(filePath, checkpointId)).file : await loadSession(filePath);
|
|
@@ -19168,7 +19121,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
19168
19121
|
},
|
|
19169
19122
|
[]
|
|
19170
19123
|
);
|
|
19171
|
-
const handleResumePick =
|
|
19124
|
+
const handleResumePick = useCallback4(
|
|
19172
19125
|
async (picked) => {
|
|
19173
19126
|
setResumeSessions(null);
|
|
19174
19127
|
if (!picked) return;
|
|
@@ -19190,7 +19143,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
19190
19143
|
},
|
|
19191
19144
|
[doResumeSession]
|
|
19192
19145
|
);
|
|
19193
|
-
const handleCheckpointPick =
|
|
19146
|
+
const handleCheckpointPick = useCallback4(
|
|
19194
19147
|
async (checkpointId) => {
|
|
19195
19148
|
const session = checkpointSession;
|
|
19196
19149
|
setCheckpointSession(null);
|
|
@@ -19209,7 +19162,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
19209
19162
|
},
|
|
19210
19163
|
[checkpointSession, doResumeSession]
|
|
19211
19164
|
);
|
|
19212
|
-
const handleSlash =
|
|
19165
|
+
const handleSlash = useCallback4(
|
|
19213
19166
|
(cmd) => {
|
|
19214
19167
|
const raw = cmd.trim();
|
|
19215
19168
|
const [head, ...rest] = raw.split(/\s+/);
|
|
@@ -19877,12 +19830,33 @@ ${lines.join("\n")}` }]);
|
|
|
19877
19830
|
}
|
|
19878
19831
|
if (c === "/hello") {
|
|
19879
19832
|
const session = crypto.randomUUID();
|
|
19880
|
-
const url = `${
|
|
19881
|
-
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
|
|
19885
|
-
|
|
19833
|
+
const url = `${FEEDBACK_WORKER_URL2}/?s=${session}&v=${getAppVersion()}`;
|
|
19834
|
+
openBrowser(url);
|
|
19835
|
+
void (async () => {
|
|
19836
|
+
try {
|
|
19837
|
+
const qr = await QRCode.toString(url, { type: "terminal", small: true });
|
|
19838
|
+
const lines = qr.split("\n").map((line) => line.replace(/\x1b\[[0-9;]*m/g, ""));
|
|
19839
|
+
setEvents((e) => [
|
|
19840
|
+
...e,
|
|
19841
|
+
{
|
|
19842
|
+
kind: "qrcode",
|
|
19843
|
+
key: mkKey(),
|
|
19844
|
+
lines,
|
|
19845
|
+
caption: "Scan this QR code with your phone to send a voice note:"
|
|
19846
|
+
},
|
|
19847
|
+
{ kind: "info", key: mkKey(), text: "Also opened voice note page in your browser." }
|
|
19848
|
+
]);
|
|
19849
|
+
} catch {
|
|
19850
|
+
setEvents((e) => [
|
|
19851
|
+
...e,
|
|
19852
|
+
{ kind: "info", key: mkKey(), text: "Opened voice note page in your browser. Record your message there and hit Send when you're done." }
|
|
19853
|
+
]);
|
|
19854
|
+
}
|
|
19855
|
+
})();
|
|
19856
|
+
return true;
|
|
19857
|
+
}
|
|
19858
|
+
if (c === "/inbox") {
|
|
19859
|
+
setShowInboxModal(true);
|
|
19886
19860
|
return true;
|
|
19887
19861
|
}
|
|
19888
19862
|
if (c === "/report") {
|
|
@@ -20155,7 +20129,7 @@ ${lines.join("\n")}` }]);
|
|
|
20155
20129
|
},
|
|
20156
20130
|
[cfg, exit, usage, theme, mode, openResumePicker, runCompact, runInit, initMcp, setCfg, setShowRemoteDashboard, setSelectedRemoteSession]
|
|
20157
20131
|
);
|
|
20158
|
-
const handleCommandSave =
|
|
20132
|
+
const handleCommandSave = useCallback4(
|
|
20159
20133
|
async (opts2) => {
|
|
20160
20134
|
setCommandWizard(null);
|
|
20161
20135
|
try {
|
|
@@ -20177,7 +20151,7 @@ ${lines.join("\n")}` }]);
|
|
|
20177
20151
|
},
|
|
20178
20152
|
[commandWizard, reloadCustomCommands, setEvents]
|
|
20179
20153
|
);
|
|
20180
|
-
const handleCommandDelete =
|
|
20154
|
+
const handleCommandDelete = useCallback4(
|
|
20181
20155
|
async (cmd) => {
|
|
20182
20156
|
setCommandToDelete(null);
|
|
20183
20157
|
try {
|
|
@@ -20196,7 +20170,7 @@ ${lines.join("\n")}` }]);
|
|
|
20196
20170
|
},
|
|
20197
20171
|
[reloadCustomCommands, setEvents]
|
|
20198
20172
|
);
|
|
20199
|
-
const processMessage =
|
|
20173
|
+
const processMessage = useCallback4(
|
|
20200
20174
|
async (text, displayText, opts2) => {
|
|
20201
20175
|
if (!cfg) return;
|
|
20202
20176
|
let trimmed = text.trim();
|
|
@@ -20736,14 +20710,14 @@ ${lines.join("\n")}` }]);
|
|
|
20736
20710
|
},
|
|
20737
20711
|
[cfg, handleSlash, updateAssistant, updateTool, saveSessionSafe, updateGatewayMeta]
|
|
20738
20712
|
);
|
|
20739
|
-
|
|
20713
|
+
useEffect6(() => {
|
|
20740
20714
|
if (!busy && queue.length > 0 && supervisorRef.current.phase === "idle") {
|
|
20741
20715
|
const next = queue[0];
|
|
20742
20716
|
setQueue((q) => q.slice(1));
|
|
20743
20717
|
processMessage(next.full, next.display, { queuedKey: next.key });
|
|
20744
20718
|
}
|
|
20745
20719
|
}, [busy, queue, processMessage]);
|
|
20746
|
-
const submit =
|
|
20720
|
+
const submit = useCallback4(
|
|
20747
20721
|
(full, display) => {
|
|
20748
20722
|
const trimmedFull = full.trim();
|
|
20749
20723
|
if (!trimmedFull) return;
|
|
@@ -20766,7 +20740,7 @@ ${lines.join("\n")}` }]);
|
|
|
20766
20740
|
[processMessage]
|
|
20767
20741
|
);
|
|
20768
20742
|
submitRef.current = submit;
|
|
20769
|
-
|
|
20743
|
+
useEffect6(() => {
|
|
20770
20744
|
if (compactSuggestedRef.current) return;
|
|
20771
20745
|
if (usage && usage.prompt_tokens / CONTEXT_LIMIT >= AUTO_COMPACT_SUGGEST_PCT) {
|
|
20772
20746
|
compactSuggestedRef.current = true;
|
|
@@ -20781,39 +20755,22 @@ ${lines.join("\n")}` }]);
|
|
|
20781
20755
|
}
|
|
20782
20756
|
}, [usage]);
|
|
20783
20757
|
if (!cfg) {
|
|
20784
|
-
return /* @__PURE__ */
|
|
20758
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(
|
|
20785
20759
|
Onboarding,
|
|
20786
20760
|
{
|
|
20787
20761
|
onCancel: () => exit(),
|
|
20788
|
-
onDone: async (newCfg
|
|
20762
|
+
onDone: async (newCfg) => {
|
|
20789
20763
|
setCfg(newCfg);
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
setCloudDeviceId(creds.deviceId);
|
|
20795
|
-
setEvents((e) => [
|
|
20796
|
-
...e,
|
|
20797
|
-
{ kind: "info", key: mkKey(), text: "configuration saved \u2014 welcome to kimiflare! (cloud mode)" }
|
|
20798
|
-
]);
|
|
20799
|
-
} else {
|
|
20800
|
-
setEvents((e) => [
|
|
20801
|
-
...e,
|
|
20802
|
-
{ kind: "info", key: mkKey(), text: "cloud mode configured \u2014 run `kimiflare auth cloud` to sign in" }
|
|
20803
|
-
]);
|
|
20804
|
-
}
|
|
20805
|
-
} else {
|
|
20806
|
-
setEvents((e) => [
|
|
20807
|
-
...e,
|
|
20808
|
-
{ kind: "info", key: mkKey(), text: "configuration saved \u2014 welcome to kimiflare!" }
|
|
20809
|
-
]);
|
|
20810
|
-
}
|
|
20764
|
+
setEvents((e) => [
|
|
20765
|
+
...e,
|
|
20766
|
+
{ kind: "info", key: mkKey(), text: "configuration saved \u2014 welcome to kimiflare!" }
|
|
20767
|
+
]);
|
|
20811
20768
|
}
|
|
20812
20769
|
}
|
|
20813
20770
|
) });
|
|
20814
20771
|
}
|
|
20815
20772
|
if (checkpointSession !== null) {
|
|
20816
|
-
return /* @__PURE__ */
|
|
20773
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx27(
|
|
20817
20774
|
CheckpointPicker,
|
|
20818
20775
|
{
|
|
20819
20776
|
session: checkpointSession,
|
|
@@ -20823,10 +20780,10 @@ ${lines.join("\n")}` }]);
|
|
|
20823
20780
|
) }) });
|
|
20824
20781
|
}
|
|
20825
20782
|
if (resumeSessions !== null) {
|
|
20826
|
-
return /* @__PURE__ */
|
|
20783
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx27(ResumePicker, { sessions: resumeSessions, onPick: handleResumePick }) }) });
|
|
20827
20784
|
}
|
|
20828
20785
|
if (showRemoteDashboard) {
|
|
20829
|
-
return /* @__PURE__ */
|
|
20786
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: selectedRemoteSession ? /* @__PURE__ */ jsx27(
|
|
20830
20787
|
RemoteSessionDetail,
|
|
20831
20788
|
{
|
|
20832
20789
|
session: selectedRemoteSession,
|
|
@@ -20849,7 +20806,7 @@ ${lines.join("\n")}` }]);
|
|
|
20849
20806
|
setShowRemoteDashboard(false);
|
|
20850
20807
|
}
|
|
20851
20808
|
}
|
|
20852
|
-
) : /* @__PURE__ */
|
|
20809
|
+
) : /* @__PURE__ */ jsx27(
|
|
20853
20810
|
RemoteDashboard,
|
|
20854
20811
|
{
|
|
20855
20812
|
onSelect: (session) => setSelectedRemoteSession(session),
|
|
@@ -20857,8 +20814,17 @@ ${lines.join("\n")}` }]);
|
|
|
20857
20814
|
}
|
|
20858
20815
|
) }) });
|
|
20859
20816
|
}
|
|
20817
|
+
if (showInboxModal) {
|
|
20818
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx27(
|
|
20819
|
+
InboxModal,
|
|
20820
|
+
{
|
|
20821
|
+
onDone: () => setShowInboxModal(false),
|
|
20822
|
+
onOpen: (url) => openBrowser(url)
|
|
20823
|
+
}
|
|
20824
|
+
) }) });
|
|
20825
|
+
}
|
|
20860
20826
|
if (showLspWizard) {
|
|
20861
|
-
return /* @__PURE__ */
|
|
20827
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx27(
|
|
20862
20828
|
LspWizard,
|
|
20863
20829
|
{
|
|
20864
20830
|
servers: cfg?.lspServers ?? {},
|
|
@@ -20895,7 +20861,7 @@ ${lines.join("\n")}` }]);
|
|
|
20895
20861
|
) }) });
|
|
20896
20862
|
}
|
|
20897
20863
|
if (commandWizard) {
|
|
20898
|
-
return /* @__PURE__ */
|
|
20864
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx27(
|
|
20899
20865
|
CommandWizard,
|
|
20900
20866
|
{
|
|
20901
20867
|
mode: commandWizard.mode,
|
|
@@ -20908,7 +20874,7 @@ ${lines.join("\n")}` }]);
|
|
|
20908
20874
|
) }) });
|
|
20909
20875
|
}
|
|
20910
20876
|
if (commandPicker) {
|
|
20911
|
-
return /* @__PURE__ */
|
|
20877
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx27(
|
|
20912
20878
|
CommandPicker,
|
|
20913
20879
|
{
|
|
20914
20880
|
commands: customCommandsRef.current,
|
|
@@ -20926,15 +20892,15 @@ ${lines.join("\n")}` }]);
|
|
|
20926
20892
|
) }) });
|
|
20927
20893
|
}
|
|
20928
20894
|
if (commandToDelete) {
|
|
20929
|
-
return /* @__PURE__ */
|
|
20930
|
-
/* @__PURE__ */
|
|
20895
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, children: [
|
|
20896
|
+
/* @__PURE__ */ jsxs25(Text26, { color: theme.accent, bold: true, children: [
|
|
20931
20897
|
"Delete /",
|
|
20932
20898
|
commandToDelete.name,
|
|
20933
20899
|
"?"
|
|
20934
20900
|
] }),
|
|
20935
|
-
/* @__PURE__ */
|
|
20936
|
-
/* @__PURE__ */
|
|
20937
|
-
|
|
20901
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: commandToDelete.filepath }),
|
|
20902
|
+
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
20903
|
+
SelectInput9,
|
|
20938
20904
|
{
|
|
20939
20905
|
items: [
|
|
20940
20906
|
{ label: "Yes, delete", value: "yes", key: "yes" },
|
|
@@ -20952,7 +20918,7 @@ ${lines.join("\n")}` }]);
|
|
|
20952
20918
|
] }) });
|
|
20953
20919
|
}
|
|
20954
20920
|
if (showCommandList) {
|
|
20955
|
-
return /* @__PURE__ */
|
|
20921
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx27(
|
|
20956
20922
|
CommandList,
|
|
20957
20923
|
{
|
|
20958
20924
|
commands: customCommandsRef.current,
|
|
@@ -20961,12 +20927,12 @@ ${lines.join("\n")}` }]);
|
|
|
20961
20927
|
) }) });
|
|
20962
20928
|
}
|
|
20963
20929
|
if (showThemePicker) {
|
|
20964
|
-
return /* @__PURE__ */
|
|
20930
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", children: /* @__PURE__ */ jsx27(ThemePicker, { themes: themeList(), onPick: handleThemePick }) }) });
|
|
20965
20931
|
}
|
|
20966
20932
|
const hasConversation = events.some((e) => e.kind === "user" || e.kind === "assistant");
|
|
20967
|
-
return /* @__PURE__ */
|
|
20968
|
-
!hasConversation && events.length === 0 ? /* @__PURE__ */
|
|
20969
|
-
perm ? /* @__PURE__ */
|
|
20933
|
+
return /* @__PURE__ */ jsx27(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", children: [
|
|
20934
|
+
!hasConversation && events.length === 0 ? /* @__PURE__ */ jsx27(Welcome, {}) : /* @__PURE__ */ jsx27(ChatView, { events, showReasoning, verbose, intentTier: intentTier ?? void 0 }),
|
|
20935
|
+
perm ? /* @__PURE__ */ jsx27(
|
|
20970
20936
|
PermissionModal,
|
|
20971
20937
|
{
|
|
20972
20938
|
tool: perm.tool,
|
|
@@ -20980,7 +20946,7 @@ ${lines.join("\n")}` }]);
|
|
|
20980
20946
|
submitRef.current(text);
|
|
20981
20947
|
}
|
|
20982
20948
|
}
|
|
20983
|
-
) : limitModal ? /* @__PURE__ */
|
|
20949
|
+
) : limitModal ? /* @__PURE__ */ jsx27(
|
|
20984
20950
|
LimitModal,
|
|
20985
20951
|
{
|
|
20986
20952
|
limit: limitModal.limit,
|
|
@@ -20990,7 +20956,7 @@ ${lines.join("\n")}` }]);
|
|
|
20990
20956
|
setLimitModal(null);
|
|
20991
20957
|
}
|
|
20992
20958
|
}
|
|
20993
|
-
) : loopModal ? /* @__PURE__ */
|
|
20959
|
+
) : loopModal ? /* @__PURE__ */ jsx27(
|
|
20994
20960
|
LimitModal,
|
|
20995
20961
|
{
|
|
20996
20962
|
limit: 50,
|
|
@@ -21006,8 +20972,8 @@ ${lines.join("\n")}` }]);
|
|
|
21006
20972
|
setLoopModal(null);
|
|
21007
20973
|
}
|
|
21008
20974
|
}
|
|
21009
|
-
) : /* @__PURE__ */
|
|
21010
|
-
tasks.length > 0 && /* @__PURE__ */
|
|
20975
|
+
) : /* @__PURE__ */ jsxs25(Box25, { flexDirection: "column", marginTop: 1, children: [
|
|
20976
|
+
tasks.length > 0 && /* @__PURE__ */ jsx27(
|
|
21011
20977
|
TaskList,
|
|
21012
20978
|
{
|
|
21013
20979
|
tasks,
|
|
@@ -21015,11 +20981,11 @@ ${lines.join("\n")}` }]);
|
|
|
21015
20981
|
tokensDelta: Math.max(0, (usage?.prompt_tokens ?? 0) - tasksStartTokens)
|
|
21016
20982
|
}
|
|
21017
20983
|
),
|
|
21018
|
-
queue.length > 0 && /* @__PURE__ */
|
|
20984
|
+
queue.length > 0 && /* @__PURE__ */ jsx27(Box25, { flexDirection: "column", marginBottom: 1, children: queue.map((q, i) => /* @__PURE__ */ jsxs25(Text26, { color: theme.info.color, dimColor: theme.info.dim, children: [
|
|
21019
20985
|
"\u23F3 ",
|
|
21020
20986
|
q.display
|
|
21021
20987
|
] }, `queue_${i}`)) }),
|
|
21022
|
-
/* @__PURE__ */
|
|
20988
|
+
/* @__PURE__ */ jsx27(
|
|
21023
20989
|
StatusBar,
|
|
21024
20990
|
{
|
|
21025
20991
|
usage,
|
|
@@ -21042,7 +21008,7 @@ ${lines.join("\n")}` }]);
|
|
|
21042
21008
|
intentTier: intentTier ?? void 0
|
|
21043
21009
|
}
|
|
21044
21010
|
),
|
|
21045
|
-
activePicker?.kind === "file" && /* @__PURE__ */
|
|
21011
|
+
activePicker?.kind === "file" && /* @__PURE__ */ jsx27(
|
|
21046
21012
|
FilePicker,
|
|
21047
21013
|
{
|
|
21048
21014
|
items: filteredFileItems,
|
|
@@ -21051,7 +21017,7 @@ ${lines.join("\n")}` }]);
|
|
|
21051
21017
|
recentFiles: new Set(recentFilesRef.current.keys())
|
|
21052
21018
|
}
|
|
21053
21019
|
),
|
|
21054
|
-
activePicker?.kind === "slash" && /* @__PURE__ */
|
|
21020
|
+
activePicker?.kind === "slash" && /* @__PURE__ */ jsx27(
|
|
21055
21021
|
SlashPicker,
|
|
21056
21022
|
{
|
|
21057
21023
|
items: filteredSlashItems,
|
|
@@ -21059,9 +21025,9 @@ ${lines.join("\n")}` }]);
|
|
|
21059
21025
|
query: pickerQuery ?? ""
|
|
21060
21026
|
}
|
|
21061
21027
|
),
|
|
21062
|
-
/* @__PURE__ */
|
|
21063
|
-
/* @__PURE__ */
|
|
21064
|
-
/* @__PURE__ */
|
|
21028
|
+
/* @__PURE__ */ jsxs25(Box25, { marginTop: 1, children: [
|
|
21029
|
+
/* @__PURE__ */ jsx27(Text26, { color: theme.prompt ?? theme.accent, children: "\u203A " }),
|
|
21030
|
+
/* @__PURE__ */ jsx27(
|
|
21065
21031
|
CustomTextInput,
|
|
21066
21032
|
{
|
|
21067
21033
|
value: input,
|
|
@@ -21118,7 +21084,7 @@ ${lines.join("\n")}` }]);
|
|
|
21118
21084
|
}
|
|
21119
21085
|
async function renderApp(cfg, updateResult, lspScope = "global", lspProjectPath = null, cloudToken, cloudDeviceId) {
|
|
21120
21086
|
const instance = render(
|
|
21121
|
-
/* @__PURE__ */
|
|
21087
|
+
/* @__PURE__ */ jsx27(
|
|
21122
21088
|
App,
|
|
21123
21089
|
{
|
|
21124
21090
|
initialCfg: cfg,
|
|
@@ -21135,7 +21101,7 @@ async function renderApp(cfg, updateResult, lspScope = "global", lspProjectPath
|
|
|
21135
21101
|
);
|
|
21136
21102
|
await instance.waitUntilExit();
|
|
21137
21103
|
}
|
|
21138
|
-
var MAX_GITIGNORE_SIZE,
|
|
21104
|
+
var MAX_GITIGNORE_SIZE, FEEDBACK_WORKER_URL2, CONTEXT_LIMIT, AUTO_COMPACT_SUGGEST_PCT, MAX_EVENTS, nextAssistantId, nextKey, mkKey, MAX_IMAGES_PER_MESSAGE;
|
|
21139
21105
|
var init_app = __esm({
|
|
21140
21106
|
"src/app.tsx"() {
|
|
21141
21107
|
"use strict";
|
|
@@ -21172,6 +21138,7 @@ var init_app = __esm({
|
|
|
21172
21138
|
init_deploy();
|
|
21173
21139
|
init_tui_auth();
|
|
21174
21140
|
init_remote_dashboard();
|
|
21141
|
+
init_inbox_modal();
|
|
21175
21142
|
init_mode();
|
|
21176
21143
|
init_classify();
|
|
21177
21144
|
init_skills();
|
|
@@ -21203,7 +21170,7 @@ var init_app = __esm({
|
|
|
21203
21170
|
init_slash_picker();
|
|
21204
21171
|
init_fuzzy();
|
|
21205
21172
|
MAX_GITIGNORE_SIZE = 1 * 1024 * 1024;
|
|
21206
|
-
|
|
21173
|
+
FEEDBACK_WORKER_URL2 = "https://hello.kimiflare.com";
|
|
21207
21174
|
CONTEXT_LIMIT = 262e3;
|
|
21208
21175
|
AUTO_COMPACT_SUGGEST_PCT = 0.8;
|
|
21209
21176
|
MAX_EVENTS = 500;
|