kimiflare 0.62.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 +65 -312
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -12705,88 +12705,16 @@ var init_task_list = __esm({
|
|
|
12705
12705
|
});
|
|
12706
12706
|
|
|
12707
12707
|
// src/ui/onboarding.tsx
|
|
12708
|
-
import { useState as useState8,
|
|
12708
|
+
import { useState as useState8, useCallback as useCallback2 } from "react";
|
|
12709
12709
|
import { Box as Box14, Text as Text15, useInput as useInput5 } from "ink";
|
|
12710
|
-
import SelectInput4 from "ink-select-input";
|
|
12711
|
-
import Spinner5 from "ink-spinner";
|
|
12712
|
-
import { exec } from "child_process";
|
|
12713
|
-
import { promisify as promisify2 } from "util";
|
|
12714
12710
|
import { Fragment, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
12715
|
-
function openBrowser(url) {
|
|
12716
|
-
const platform5 = process.platform;
|
|
12717
|
-
const cmd = platform5 === "darwin" ? `open "${url}"` : platform5 === "win32" ? `start "" "${url}"` : `xdg-open "${url}"`;
|
|
12718
|
-
exec(cmd, (err) => {
|
|
12719
|
-
if (err) {
|
|
12720
|
-
}
|
|
12721
|
-
});
|
|
12722
|
-
}
|
|
12723
|
-
function formatRemaining(ms) {
|
|
12724
|
-
const totalSeconds = Math.ceil(ms / 1e3);
|
|
12725
|
-
const mins = Math.floor(totalSeconds / 60);
|
|
12726
|
-
const secs = totalSeconds % 60;
|
|
12727
|
-
return `${mins}:${secs.toString().padStart(2, "0")}`;
|
|
12728
|
-
}
|
|
12729
12711
|
function Onboarding({ onDone, onCancel }) {
|
|
12730
12712
|
const theme = useTheme();
|
|
12731
|
-
const [step, setStep] = useState8("
|
|
12732
|
-
const [mode, setMode] = useState8("byok");
|
|
12713
|
+
const [step, setStep] = useState8("accountId");
|
|
12733
12714
|
const [accountId, setAccountId] = useState8("");
|
|
12734
12715
|
const [apiToken, setApiToken] = useState8("");
|
|
12735
12716
|
const [model, setModel] = useState8(DEFAULT_MODEL);
|
|
12736
12717
|
const [savedPath, setSavedPath] = useState8(null);
|
|
12737
|
-
const [cloudAuth, setCloudAuth] = useState8(null);
|
|
12738
|
-
const [pollTick, setPollTick] = useState8(0);
|
|
12739
|
-
useEffect5(() => {
|
|
12740
|
-
if (step !== "cloudAuth" || !cloudAuth) return;
|
|
12741
|
-
if (cloudAuth.phase !== "polling") return;
|
|
12742
|
-
let cancelled = false;
|
|
12743
|
-
const tick = setInterval(() => {
|
|
12744
|
-
setPollTick((t) => t + 1);
|
|
12745
|
-
}, 1e3);
|
|
12746
|
-
const poll = async () => {
|
|
12747
|
-
while (!cancelled) {
|
|
12748
|
-
const elapsed = Date.now() - cloudAuth.startTime;
|
|
12749
|
-
if (elapsed >= POLL_TIMEOUT_MS) {
|
|
12750
|
-
if (!cancelled) {
|
|
12751
|
-
setCloudAuth({ phase: "error", message: "Authentication timed out. Please try again." });
|
|
12752
|
-
}
|
|
12753
|
-
return;
|
|
12754
|
-
}
|
|
12755
|
-
try {
|
|
12756
|
-
const creds = await pollForToken(cloudAuth.codes.deviceCode, cloudAuth.codes.deviceId);
|
|
12757
|
-
if (creds && !cancelled) {
|
|
12758
|
-
const usage = await fetchCloudUsage(creds.accessToken, creds.deviceId);
|
|
12759
|
-
if (usage && !cancelled) {
|
|
12760
|
-
setCloudAuth({
|
|
12761
|
-
phase: "success",
|
|
12762
|
-
creds,
|
|
12763
|
-
usage
|
|
12764
|
-
});
|
|
12765
|
-
} else if (!cancelled) {
|
|
12766
|
-
setCloudAuth({ phase: "error", message: "Authenticated but failed to fetch usage." });
|
|
12767
|
-
}
|
|
12768
|
-
return;
|
|
12769
|
-
}
|
|
12770
|
-
} catch (err) {
|
|
12771
|
-
if (isKillSwitchError(err)) {
|
|
12772
|
-
if (!cancelled) {
|
|
12773
|
-
setCloudAuth({
|
|
12774
|
-
phase: "error",
|
|
12775
|
-
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."
|
|
12776
|
-
});
|
|
12777
|
-
}
|
|
12778
|
-
return;
|
|
12779
|
-
}
|
|
12780
|
-
}
|
|
12781
|
-
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
12782
|
-
}
|
|
12783
|
-
};
|
|
12784
|
-
poll();
|
|
12785
|
-
return () => {
|
|
12786
|
-
cancelled = true;
|
|
12787
|
-
clearInterval(tick);
|
|
12788
|
-
};
|
|
12789
|
-
}, [step, cloudAuth]);
|
|
12790
12718
|
useInput5(
|
|
12791
12719
|
useCallback2(
|
|
12792
12720
|
(_input, key) => {
|
|
@@ -12797,55 +12725,6 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12797
12725
|
[onCancel]
|
|
12798
12726
|
)
|
|
12799
12727
|
);
|
|
12800
|
-
const startCloudAuth = useCallback2(async () => {
|
|
12801
|
-
try {
|
|
12802
|
-
const codes = await generateDeviceCodes();
|
|
12803
|
-
await registerDevice(codes);
|
|
12804
|
-
setCloudAuth({ phase: "ready", codes });
|
|
12805
|
-
setStep("cloudAuth");
|
|
12806
|
-
} catch (err) {
|
|
12807
|
-
setCloudAuth({
|
|
12808
|
-
phase: "error",
|
|
12809
|
-
message: err instanceof Error ? err.message : "Failed to start authentication"
|
|
12810
|
-
});
|
|
12811
|
-
setStep("cloudAuth");
|
|
12812
|
-
}
|
|
12813
|
-
}, []);
|
|
12814
|
-
const handleModeSelect = (item) => {
|
|
12815
|
-
if (item.value === "cloud") {
|
|
12816
|
-
setMode("cloud");
|
|
12817
|
-
void startCloudAuth();
|
|
12818
|
-
} else {
|
|
12819
|
-
setMode("byok");
|
|
12820
|
-
setStep("accountId");
|
|
12821
|
-
}
|
|
12822
|
-
};
|
|
12823
|
-
const handleOpenBrowser = () => {
|
|
12824
|
-
if (cloudAuth?.phase === "ready") {
|
|
12825
|
-
openBrowser(cloudAuth.codes.authUrl);
|
|
12826
|
-
setCloudAuth({ phase: "polling", codes: cloudAuth.codes, startTime: Date.now() });
|
|
12827
|
-
}
|
|
12828
|
-
};
|
|
12829
|
-
const handleCloudSuccess = async () => {
|
|
12830
|
-
if (cloudAuth?.phase !== "success") return;
|
|
12831
|
-
const cfg = { accountId: "", apiToken: "", model: DEFAULT_MODEL, cloudMode: true };
|
|
12832
|
-
try {
|
|
12833
|
-
const path = await saveConfig(cfg);
|
|
12834
|
-
setSavedPath(path);
|
|
12835
|
-
onDone(cfg, cloudAuth.creds);
|
|
12836
|
-
} catch (e) {
|
|
12837
|
-
setSavedPath(`error: ${e.message}`);
|
|
12838
|
-
}
|
|
12839
|
-
};
|
|
12840
|
-
const handleCloudRetry = () => {
|
|
12841
|
-
setCloudAuth(null);
|
|
12842
|
-
void startCloudAuth();
|
|
12843
|
-
};
|
|
12844
|
-
const handleCloudSwitchToByok = () => {
|
|
12845
|
-
setCloudAuth(null);
|
|
12846
|
-
setMode("byok");
|
|
12847
|
-
setStep("accountId");
|
|
12848
|
-
};
|
|
12849
12728
|
const handleAccountIdSubmit = (value) => {
|
|
12850
12729
|
const trimmed = value.trim();
|
|
12851
12730
|
if (!trimmed) return;
|
|
@@ -12873,9 +12752,9 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12873
12752
|
setSavedPath(`error: ${e.message}`);
|
|
12874
12753
|
}
|
|
12875
12754
|
};
|
|
12876
|
-
const
|
|
12877
|
-
const stepIndex =
|
|
12878
|
-
const totalSteps =
|
|
12755
|
+
const steps = ["accountId", "apiToken", "model", "confirm"];
|
|
12756
|
+
const stepIndex = steps.indexOf(step) + 1;
|
|
12757
|
+
const totalSteps = steps.length;
|
|
12879
12758
|
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingY: 1, children: [
|
|
12880
12759
|
/* @__PURE__ */ jsxs14(Box14, { marginBottom: 1, children: [
|
|
12881
12760
|
/* @__PURE__ */ jsx16(Text15, { bold: true, color: theme.palette.primary, children: "kimiflare" }),
|
|
@@ -12891,111 +12770,6 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12891
12770
|
totalSteps
|
|
12892
12771
|
] }),
|
|
12893
12772
|
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
|
|
12894
|
-
step === "mode" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12895
|
-
/* @__PURE__ */ jsx16(Text15, { children: "How do you want to connect?" }),
|
|
12896
|
-
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(
|
|
12897
|
-
SelectInput4,
|
|
12898
|
-
{
|
|
12899
|
-
items: [
|
|
12900
|
-
{ label: "Cloud (managed) \u2014 no API key needed", value: "cloud" },
|
|
12901
|
-
{ label: "BYOK \u2014 bring your own Cloudflare key", value: "byok" }
|
|
12902
|
-
],
|
|
12903
|
-
onSelect: handleModeSelect
|
|
12904
|
-
}
|
|
12905
|
-
) })
|
|
12906
|
-
] }),
|
|
12907
|
-
step === "cloudAuth" && cloudAuth?.phase === "ready" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12908
|
-
/* @__PURE__ */ jsx16(Text15, { children: "Authenticating with Kimiflare Cloud..." }),
|
|
12909
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
|
|
12910
|
-
/* @__PURE__ */ jsx16(Text15, { children: "1. Open this URL in your browser:" }),
|
|
12911
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.primary, children: cloudAuth.codes.authUrl })
|
|
12912
|
-
] }),
|
|
12913
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
12914
|
-
/* @__PURE__ */ jsx16(Text15, { children: "2. " }),
|
|
12915
|
-
/* @__PURE__ */ jsx16(Text15, { bold: true, children: "[Press Enter to open browser]" })
|
|
12916
|
-
] }),
|
|
12917
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
12918
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.primary, children: "\u203A " }),
|
|
12919
|
-
/* @__PURE__ */ jsx16(
|
|
12920
|
-
CustomTextInput,
|
|
12921
|
-
{
|
|
12922
|
-
value: "",
|
|
12923
|
-
onChange: () => {
|
|
12924
|
-
},
|
|
12925
|
-
onSubmit: handleOpenBrowser
|
|
12926
|
-
}
|
|
12927
|
-
)
|
|
12928
|
-
] })
|
|
12929
|
-
] }),
|
|
12930
|
-
step === "cloudAuth" && cloudAuth?.phase === "polling" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12931
|
-
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
12932
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.spinner, children: /* @__PURE__ */ jsx16(Spinner5, { type: "dots" }) }),
|
|
12933
|
-
" ",
|
|
12934
|
-
"Waiting for authentication..."
|
|
12935
|
-
] }),
|
|
12936
|
-
/* @__PURE__ */ jsxs14(Text15, { color: theme.info.color, children: [
|
|
12937
|
-
"Expires in ",
|
|
12938
|
-
formatRemaining(POLL_TIMEOUT_MS - (Date.now() - cloudAuth.startTime))
|
|
12939
|
-
] }),
|
|
12940
|
-
/* @__PURE__ */ jsxs14(Text15, { color: theme.info.color, children: [
|
|
12941
|
-
"URL: ",
|
|
12942
|
-
cloudAuth.codes.authUrl
|
|
12943
|
-
] })
|
|
12944
|
-
] }),
|
|
12945
|
-
step === "cloudAuth" && cloudAuth?.phase === "success" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12946
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.success, children: "Authenticated!" }),
|
|
12947
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, flexDirection: "column", children: [
|
|
12948
|
-
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
12949
|
-
"Token budget:",
|
|
12950
|
-
" ",
|
|
12951
|
-
/* @__PURE__ */ jsxs14(Text15, { bold: true, children: [
|
|
12952
|
-
cloudAuth.usage.remaining.toLocaleString(),
|
|
12953
|
-
" /",
|
|
12954
|
-
" ",
|
|
12955
|
-
cloudAuth.usage.input_token_limit.toLocaleString()
|
|
12956
|
-
] }),
|
|
12957
|
-
" ",
|
|
12958
|
-
"remaining"
|
|
12959
|
-
] }),
|
|
12960
|
-
/* @__PURE__ */ jsxs14(Text15, { color: theme.info.color, children: [
|
|
12961
|
-
"Grant expires: ",
|
|
12962
|
-
cloudAuth.usage.expires_at
|
|
12963
|
-
] }),
|
|
12964
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.info.color, children: "Or when the global pool of free tokens runs out." })
|
|
12965
|
-
] }),
|
|
12966
|
-
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text15, { children: "[Press Enter to continue]" }) }),
|
|
12967
|
-
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
12968
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.primary, children: "\u203A " }),
|
|
12969
|
-
/* @__PURE__ */ jsx16(
|
|
12970
|
-
CustomTextInput,
|
|
12971
|
-
{
|
|
12972
|
-
value: "",
|
|
12973
|
-
onChange: () => {
|
|
12974
|
-
},
|
|
12975
|
-
onSubmit: handleCloudSuccess
|
|
12976
|
-
}
|
|
12977
|
-
)
|
|
12978
|
-
] })
|
|
12979
|
-
] }),
|
|
12980
|
-
step === "cloudAuth" && cloudAuth?.phase === "error" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
12981
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.palette.error, children: "Authentication failed" }),
|
|
12982
|
-
/* @__PURE__ */ jsx16(Text15, { color: theme.info.color, children: cloudAuth.message }),
|
|
12983
|
-
/* @__PURE__ */ jsx16(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx16(
|
|
12984
|
-
SelectInput4,
|
|
12985
|
-
{
|
|
12986
|
-
items: [
|
|
12987
|
-
{ label: "Retry", value: "retry" },
|
|
12988
|
-
{ label: "Switch to BYOK", value: "byok" },
|
|
12989
|
-
{ label: "Cancel", value: "cancel" }
|
|
12990
|
-
],
|
|
12991
|
-
onSelect: (item) => {
|
|
12992
|
-
if (item.value === "retry") handleCloudRetry();
|
|
12993
|
-
else if (item.value === "byok") handleCloudSwitchToByok();
|
|
12994
|
-
else if (onCancel) onCancel();
|
|
12995
|
-
}
|
|
12996
|
-
}
|
|
12997
|
-
) })
|
|
12998
|
-
] }),
|
|
12999
12773
|
step === "accountId" && /* @__PURE__ */ jsxs14(Fragment, { children: [
|
|
13000
12774
|
/* @__PURE__ */ jsx16(Text15, { children: "Enter your Cloudflare Account ID" }),
|
|
13001
12775
|
/* @__PURE__ */ jsxs14(Box14, { marginTop: 1, children: [
|
|
@@ -13092,16 +12866,12 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
13092
12866
|
] })
|
|
13093
12867
|
] });
|
|
13094
12868
|
}
|
|
13095
|
-
var execAsync;
|
|
13096
12869
|
var init_onboarding = __esm({
|
|
13097
12870
|
"src/ui/onboarding.tsx"() {
|
|
13098
12871
|
"use strict";
|
|
13099
12872
|
init_text_input();
|
|
13100
12873
|
init_config();
|
|
13101
12874
|
init_theme_context();
|
|
13102
|
-
init_auth();
|
|
13103
|
-
init_errors();
|
|
13104
|
-
execAsync = promisify2(exec);
|
|
13105
12875
|
}
|
|
13106
12876
|
});
|
|
13107
12877
|
|
|
@@ -13262,9 +13032,9 @@ var init_worker_client = __esm({
|
|
|
13262
13032
|
});
|
|
13263
13033
|
|
|
13264
13034
|
// src/ui/remote-dashboard.tsx
|
|
13265
|
-
import { useEffect as
|
|
13035
|
+
import { useEffect as useEffect5, useState as useState9 } from "react";
|
|
13266
13036
|
import { Box as Box16, Text as Text17, useInput as useInput6 } from "ink";
|
|
13267
|
-
import
|
|
13037
|
+
import SelectInput4 from "ink-select-input";
|
|
13268
13038
|
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
13269
13039
|
function RemoteDashboard({ onSelect, onCancel }) {
|
|
13270
13040
|
const theme = useTheme();
|
|
@@ -13272,7 +13042,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
13272
13042
|
const [loading, setLoading] = useState9(true);
|
|
13273
13043
|
const [error, setError] = useState9(null);
|
|
13274
13044
|
const [refreshing, setRefreshing] = useState9(false);
|
|
13275
|
-
|
|
13045
|
+
useEffect5(() => {
|
|
13276
13046
|
loadSessions();
|
|
13277
13047
|
}, []);
|
|
13278
13048
|
async function loadSessions() {
|
|
@@ -13345,7 +13115,7 @@ function RemoteDashboard({ onSelect, onCancel }) {
|
|
|
13345
13115
|
refreshing ? "(refreshing...)" : ""
|
|
13346
13116
|
] }),
|
|
13347
13117
|
/* @__PURE__ */ jsx18(Box16, { marginTop: 1, children: /* @__PURE__ */ jsx18(
|
|
13348
|
-
|
|
13118
|
+
SelectInput4,
|
|
13349
13119
|
{
|
|
13350
13120
|
items,
|
|
13351
13121
|
onSelect: (item) => {
|
|
@@ -14365,10 +14135,10 @@ var init_loader2 = __esm({
|
|
|
14365
14135
|
});
|
|
14366
14136
|
|
|
14367
14137
|
// src/commands/renderer.ts
|
|
14368
|
-
import { exec
|
|
14138
|
+
import { exec } from "child_process";
|
|
14369
14139
|
import { open as open2, realpath as realpath2 } from "fs/promises";
|
|
14370
14140
|
import { isAbsolute as isAbsolute2, relative as relative5, resolve as resolvePathJoin, basename as pathBasename } from "path";
|
|
14371
|
-
import { promisify as
|
|
14141
|
+
import { promisify as promisify2 } from "util";
|
|
14372
14142
|
function tokenizeArgs(s) {
|
|
14373
14143
|
return [...s.matchAll(ARG_TOKEN_RE)].map((match) => {
|
|
14374
14144
|
const token = match[0];
|
|
@@ -14435,7 +14205,7 @@ async function replaceShell(prompt, warnings, cmd, shellTimeoutMs) {
|
|
|
14435
14205
|
matches.map(async (match) => {
|
|
14436
14206
|
const command = match[1] ?? "";
|
|
14437
14207
|
try {
|
|
14438
|
-
const { stdout } = await
|
|
14208
|
+
const { stdout } = await execAsync(command, {
|
|
14439
14209
|
timeout: shellTimeoutMs,
|
|
14440
14210
|
maxBuffer: 1024 * 1024
|
|
14441
14211
|
});
|
|
@@ -14516,12 +14286,12 @@ async function replaceFiles(prompt, warnings, cmd, cwd, maxFileBytes) {
|
|
|
14516
14286
|
function message(error) {
|
|
14517
14287
|
return error instanceof Error ? error.message : String(error);
|
|
14518
14288
|
}
|
|
14519
|
-
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;
|
|
14520
14290
|
var init_renderer2 = __esm({
|
|
14521
14291
|
"src/commands/renderer.ts"() {
|
|
14522
14292
|
"use strict";
|
|
14523
14293
|
init_paths();
|
|
14524
|
-
|
|
14294
|
+
execAsync = promisify2(exec);
|
|
14525
14295
|
ARG_TOKEN_RE = /(?:"[^"]*"|'[^']*'|[^\s"']+)/g;
|
|
14526
14296
|
POSITIONAL_RE = /\$(\d+)/g;
|
|
14527
14297
|
HAS_POSITIONAL = /\$\d+/;
|
|
@@ -14623,7 +14393,7 @@ var init_save = __esm({
|
|
|
14623
14393
|
// src/ui/command-wizard.tsx
|
|
14624
14394
|
import { useState as useState11 } from "react";
|
|
14625
14395
|
import { Box as Box18, Text as Text19, useInput as useInput8, useWindowSize } from "ink";
|
|
14626
|
-
import
|
|
14396
|
+
import SelectInput5 from "ink-select-input";
|
|
14627
14397
|
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
14628
14398
|
function CommandWizard({ mode, initial, existingNames, builtinNames, onDone, onSave }) {
|
|
14629
14399
|
const theme = useTheme();
|
|
@@ -14876,7 +14646,7 @@ ${template}`;
|
|
|
14876
14646
|
")"
|
|
14877
14647
|
] }),
|
|
14878
14648
|
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14879
|
-
|
|
14649
|
+
SelectInput5,
|
|
14880
14650
|
{
|
|
14881
14651
|
items,
|
|
14882
14652
|
onSelect: (item) => {
|
|
@@ -14905,7 +14675,7 @@ ${template}`;
|
|
|
14905
14675
|
] }),
|
|
14906
14676
|
/* @__PURE__ */ jsx20(Text19, { color: theme.info.color, children: "Saved to file but not yet enforced at runtime" }),
|
|
14907
14677
|
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14908
|
-
|
|
14678
|
+
SelectInput5,
|
|
14909
14679
|
{
|
|
14910
14680
|
items,
|
|
14911
14681
|
onSelect: (item) => {
|
|
@@ -14933,7 +14703,7 @@ ${template}`;
|
|
|
14933
14703
|
")"
|
|
14934
14704
|
] }),
|
|
14935
14705
|
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14936
|
-
|
|
14706
|
+
SelectInput5,
|
|
14937
14707
|
{
|
|
14938
14708
|
items,
|
|
14939
14709
|
onSelect: (item) => {
|
|
@@ -14979,7 +14749,7 @@ ${template}`;
|
|
|
14979
14749
|
")"
|
|
14980
14750
|
] }),
|
|
14981
14751
|
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
14982
|
-
|
|
14752
|
+
SelectInput5,
|
|
14983
14753
|
{
|
|
14984
14754
|
items,
|
|
14985
14755
|
onSelect: (item) => {
|
|
@@ -15012,7 +14782,7 @@ ${template}`;
|
|
|
15012
14782
|
] }),
|
|
15013
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)) }),
|
|
15014
14784
|
/* @__PURE__ */ jsx20(Box18, { marginTop: 1, children: /* @__PURE__ */ jsx20(
|
|
15015
|
-
|
|
14785
|
+
SelectInput5,
|
|
15016
14786
|
{
|
|
15017
14787
|
items,
|
|
15018
14788
|
onSelect: (item) => handleConfirm(item.value)
|
|
@@ -15468,7 +15238,7 @@ var init_context_generator = __esm({
|
|
|
15468
15238
|
|
|
15469
15239
|
// src/ui/command-picker.tsx
|
|
15470
15240
|
import { Box as Box19, Text as Text20 } from "ink";
|
|
15471
|
-
import
|
|
15241
|
+
import SelectInput6 from "ink-select-input";
|
|
15472
15242
|
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
15473
15243
|
function CommandPicker({ commands, title, onPick }) {
|
|
15474
15244
|
const theme = useTheme();
|
|
@@ -15482,7 +15252,7 @@ function CommandPicker({ commands, title, onPick }) {
|
|
|
15482
15252
|
/* @__PURE__ */ jsx21(Text20, { color: theme.accent, bold: true, children: title }),
|
|
15483
15253
|
/* @__PURE__ */ jsx21(Text20, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
15484
15254
|
/* @__PURE__ */ jsx21(Box19, { marginTop: 1, children: /* @__PURE__ */ jsx21(
|
|
15485
|
-
|
|
15255
|
+
SelectInput6,
|
|
15486
15256
|
{
|
|
15487
15257
|
items,
|
|
15488
15258
|
onSelect: (item) => {
|
|
@@ -15579,7 +15349,7 @@ var init_command_list = __esm({
|
|
|
15579
15349
|
// src/ui/lsp-wizard.tsx
|
|
15580
15350
|
import { useState as useState12 } from "react";
|
|
15581
15351
|
import { Box as Box21, Text as Text22 } from "ink";
|
|
15582
|
-
import
|
|
15352
|
+
import SelectInput7 from "ink-select-input";
|
|
15583
15353
|
import { spawn as spawn3 } from "child_process";
|
|
15584
15354
|
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
15585
15355
|
function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
@@ -15697,7 +15467,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15697
15467
|
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "LSP Servers" }),
|
|
15698
15468
|
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Arrow keys to navigate, Enter to select." }),
|
|
15699
15469
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15700
|
-
|
|
15470
|
+
SelectInput7,
|
|
15701
15471
|
{
|
|
15702
15472
|
items: mainItems,
|
|
15703
15473
|
onSelect: (item) => {
|
|
@@ -15728,7 +15498,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15728
15498
|
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Add LSP Server" }),
|
|
15729
15499
|
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Select a language server to configure." }),
|
|
15730
15500
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15731
|
-
|
|
15501
|
+
SelectInput7,
|
|
15732
15502
|
{
|
|
15733
15503
|
items,
|
|
15734
15504
|
onSelect: (item) => {
|
|
@@ -15767,7 +15537,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15767
15537
|
] }),
|
|
15768
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) }) }),
|
|
15769
15539
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15770
|
-
|
|
15540
|
+
SelectInput7,
|
|
15771
15541
|
{
|
|
15772
15542
|
items,
|
|
15773
15543
|
onSelect: (item) => {
|
|
@@ -15808,7 +15578,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15808
15578
|
)
|
|
15809
15579
|
] }),
|
|
15810
15580
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15811
|
-
|
|
15581
|
+
SelectInput7,
|
|
15812
15582
|
{
|
|
15813
15583
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15814
15584
|
onSelect: () => setPage("add")
|
|
@@ -15837,7 +15607,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15837
15607
|
)
|
|
15838
15608
|
] }),
|
|
15839
15609
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15840
|
-
|
|
15610
|
+
SelectInput7,
|
|
15841
15611
|
{
|
|
15842
15612
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15843
15613
|
onSelect: () => setPage("custom-name")
|
|
@@ -15864,7 +15634,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15864
15634
|
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Save LSP Config" }),
|
|
15865
15635
|
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Where should this server configuration be saved?" }),
|
|
15866
15636
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15867
|
-
|
|
15637
|
+
SelectInput7,
|
|
15868
15638
|
{
|
|
15869
15639
|
items,
|
|
15870
15640
|
onSelect: (item) => {
|
|
@@ -15886,7 +15656,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15886
15656
|
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
15887
15657
|
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "No servers configured." }),
|
|
15888
15658
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15889
|
-
|
|
15659
|
+
SelectInput7,
|
|
15890
15660
|
{
|
|
15891
15661
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15892
15662
|
onSelect: () => setPage("main")
|
|
@@ -15910,7 +15680,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15910
15680
|
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Edit LSP Server" }),
|
|
15911
15681
|
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Select a server to toggle enabled/disabled." }),
|
|
15912
15682
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15913
|
-
|
|
15683
|
+
SelectInput7,
|
|
15914
15684
|
{
|
|
15915
15685
|
items,
|
|
15916
15686
|
onSelect: (item) => {
|
|
@@ -15931,7 +15701,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15931
15701
|
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
15932
15702
|
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: "No servers configured." }),
|
|
15933
15703
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15934
|
-
|
|
15704
|
+
SelectInput7,
|
|
15935
15705
|
{
|
|
15936
15706
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15937
15707
|
onSelect: () => setPage("main")
|
|
@@ -15951,7 +15721,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15951
15721
|
/* @__PURE__ */ jsx23(Text22, { color: theme.accent, bold: true, children: "Delete LSP Server" }),
|
|
15952
15722
|
/* @__PURE__ */ jsx23(Text22, { color: theme.info.color, dimColor: false, children: "Select a server to remove from config." }),
|
|
15953
15723
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15954
|
-
|
|
15724
|
+
SelectInput7,
|
|
15955
15725
|
{
|
|
15956
15726
|
items,
|
|
15957
15727
|
onSelect: (item) => {
|
|
@@ -15975,7 +15745,7 @@ function LspWizard({ servers, currentScope, hasProjectDir, onDone, onSave }) {
|
|
|
15975
15745
|
return /* @__PURE__ */ jsx23(Text22, { color: theme.info.color, children: ` ${k.padEnd(16)} ${status} ${s.command.join(" ")}` }, k);
|
|
15976
15746
|
}) }),
|
|
15977
15747
|
/* @__PURE__ */ jsx23(Box21, { marginTop: 1, children: /* @__PURE__ */ jsx23(
|
|
15978
|
-
|
|
15748
|
+
SelectInput7,
|
|
15979
15749
|
{
|
|
15980
15750
|
items: [{ label: "\u2190 Back", value: "__back__", key: "__back__" }],
|
|
15981
15751
|
onSelect: () => setPage("main")
|
|
@@ -16103,7 +15873,7 @@ var init_lsp_wizard = __esm({
|
|
|
16103
15873
|
|
|
16104
15874
|
// src/ui/theme-picker.tsx
|
|
16105
15875
|
import { Box as Box22, Text as Text23 } from "ink";
|
|
16106
|
-
import
|
|
15876
|
+
import SelectInput8 from "ink-select-input";
|
|
16107
15877
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
16108
15878
|
function PaletteSwatches({ palette }) {
|
|
16109
15879
|
const colors = [
|
|
@@ -16123,7 +15893,7 @@ function ThemePicker({ themes, onPick }) {
|
|
|
16123
15893
|
return /* @__PURE__ */ jsxs22(Box22, { flexDirection: "column", borderStyle: "round", borderColor: current.accent, paddingX: 1, children: [
|
|
16124
15894
|
/* @__PURE__ */ jsx24(Text23, { color: current.accent, bold: true, children: "Pick a theme (restart to apply)" }),
|
|
16125
15895
|
/* @__PURE__ */ jsx24(Box22, { marginTop: 1, children: /* @__PURE__ */ jsx24(
|
|
16126
|
-
|
|
15896
|
+
SelectInput8,
|
|
16127
15897
|
{
|
|
16128
15898
|
items,
|
|
16129
15899
|
onSelect: (item) => {
|
|
@@ -17546,9 +17316,9 @@ __export(app_exports, {
|
|
|
17546
17316
|
shouldOpenMentionPicker: () => shouldOpenMentionPicker,
|
|
17547
17317
|
shouldOpenSlashPicker: () => shouldOpenSlashPicker
|
|
17548
17318
|
});
|
|
17549
|
-
import React16, { useState as useState13, useRef as useRef3, useEffect as
|
|
17319
|
+
import React16, { useState as useState13, useRef as useRef3, useEffect as useEffect6, useCallback as useCallback4 } from "react";
|
|
17550
17320
|
import { Box as Box25, Text as Text26, useApp, useInput as useInput10, render } from "ink";
|
|
17551
|
-
import
|
|
17321
|
+
import SelectInput9 from "ink-select-input";
|
|
17552
17322
|
import { existsSync as existsSync4, statSync as statSync4 } from "fs";
|
|
17553
17323
|
import { join as join28 } from "path";
|
|
17554
17324
|
import QRCode from "qrcode";
|
|
@@ -17697,7 +17467,7 @@ function gatewayUsageLookupFromConfig(cfg, meta) {
|
|
|
17697
17467
|
meta
|
|
17698
17468
|
};
|
|
17699
17469
|
}
|
|
17700
|
-
function
|
|
17470
|
+
function openBrowser(url) {
|
|
17701
17471
|
const cmd = platform4() === "darwin" ? "open" : platform4() === "win32" ? "start" : "xdg-open";
|
|
17702
17472
|
const child = spawn4(cmd, [url], { detached: true, stdio: "ignore" });
|
|
17703
17473
|
child.unref();
|
|
@@ -17872,10 +17642,10 @@ function App({
|
|
|
17872
17642
|
const [kimiMdStale, setKimiMdStale] = useState13(false);
|
|
17873
17643
|
const [gitBranch, setGitBranch] = useState13(null);
|
|
17874
17644
|
const [lastSessionTopic, setLastSessionTopic] = useState13(null);
|
|
17875
|
-
|
|
17645
|
+
useEffect6(() => {
|
|
17876
17646
|
setGitBranch(detectGitBranch());
|
|
17877
17647
|
}, []);
|
|
17878
|
-
|
|
17648
|
+
useEffect6(() => {
|
|
17879
17649
|
void Promise.resolve().then(() => (init_sessions(), sessions_exports)).then(
|
|
17880
17650
|
({ listSessions: listSessions2 }) => listSessions2(1).then((sessions) => {
|
|
17881
17651
|
const last = sessions[0];
|
|
@@ -17885,7 +17655,7 @@ function App({
|
|
|
17885
17655
|
})
|
|
17886
17656
|
);
|
|
17887
17657
|
}, []);
|
|
17888
|
-
|
|
17658
|
+
useEffect6(() => {
|
|
17889
17659
|
const onSigint = () => {
|
|
17890
17660
|
logger.info("sigint:fired", {
|
|
17891
17661
|
hasHandler: sigintHandlerRef.current !== null
|
|
@@ -17897,7 +17667,7 @@ function App({
|
|
|
17897
17667
|
process.off("SIGINT", onSigint);
|
|
17898
17668
|
};
|
|
17899
17669
|
}, []);
|
|
17900
|
-
|
|
17670
|
+
useEffect6(() => {
|
|
17901
17671
|
let cancelled = false;
|
|
17902
17672
|
loadAndMergeThemes().then(({ errors, wcagWarnings }) => {
|
|
17903
17673
|
if (cancelled) return;
|
|
@@ -17921,7 +17691,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
17921
17691
|
cancelled = true;
|
|
17922
17692
|
};
|
|
17923
17693
|
}, []);
|
|
17924
|
-
|
|
17694
|
+
useEffect6(() => {
|
|
17925
17695
|
if (!cfg?.cloudMode || !initialCloudToken) return;
|
|
17926
17696
|
let cancelled = false;
|
|
17927
17697
|
const fetchBudget = async () => {
|
|
@@ -18035,7 +17805,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18035
17805
|
if (pickerKind !== "slash" || pickerQuery === null) return [];
|
|
18036
17806
|
return fuzzyFilter(allSlashCommands, pickerQuery, (c) => c.name).slice(0, 50);
|
|
18037
17807
|
}, [pickerKind, allSlashCommands, pickerQuery]);
|
|
18038
|
-
|
|
17808
|
+
useEffect6(() => {
|
|
18039
17809
|
if (activePicker !== null) {
|
|
18040
17810
|
const trigger = activePicker.kind === "file" ? "@" : "/";
|
|
18041
17811
|
if (cursorOffset < activePicker.anchor) {
|
|
@@ -18092,14 +17862,14 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18092
17862
|
return;
|
|
18093
17863
|
}
|
|
18094
17864
|
}, [input, cursorOffset, activePicker, filePickerEnabled]);
|
|
18095
|
-
|
|
17865
|
+
useEffect6(() => {
|
|
18096
17866
|
if (activePicker?.kind !== "file") return;
|
|
18097
17867
|
const max = Math.max(0, filteredFileItems.length - 1);
|
|
18098
17868
|
if (activePicker.selected > max) {
|
|
18099
17869
|
setActivePicker({ ...activePicker, selected: max });
|
|
18100
17870
|
}
|
|
18101
17871
|
}, [filteredFileItems.length, activePicker]);
|
|
18102
|
-
|
|
17872
|
+
useEffect6(() => {
|
|
18103
17873
|
if (activePicker?.kind !== "slash") return;
|
|
18104
17874
|
const max = Math.max(0, filteredSlashItems.length - 1);
|
|
18105
17875
|
if (activePicker.selected > max) {
|
|
@@ -18144,7 +17914,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18144
17914
|
pickerCancelRef.current = cursorOffset;
|
|
18145
17915
|
setActivePicker(null);
|
|
18146
17916
|
}, [cursorOffset]);
|
|
18147
|
-
|
|
17917
|
+
useEffect6(() => {
|
|
18148
17918
|
const modalActive = commandWizard !== null || commandPicker !== null || commandToDelete !== null || showCommandList || showLspWizard || resumeSessions !== null || checkpointSession !== null || perm !== null || limitModal !== null || loopModal !== null || showInboxModal;
|
|
18149
17919
|
if (modalActive && activePicker !== null) {
|
|
18150
17920
|
setActivePicker(null);
|
|
@@ -18162,7 +17932,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18162
17932
|
showInboxModal,
|
|
18163
17933
|
activePicker
|
|
18164
17934
|
]);
|
|
18165
|
-
|
|
17935
|
+
useEffect6(() => {
|
|
18166
17936
|
if (!cfg) return;
|
|
18167
17937
|
void Promise.resolve().then(() => (init_sessions(), sessions_exports)).then(
|
|
18168
17938
|
({ pruneSessions: pruneSessions2 }) => pruneSessions2().then((removed) => {
|
|
@@ -18274,7 +18044,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18274
18044
|
}
|
|
18275
18045
|
});
|
|
18276
18046
|
}, [cfg, setEvents]);
|
|
18277
|
-
|
|
18047
|
+
useEffect6(() => {
|
|
18278
18048
|
const id = setInterval(() => {
|
|
18279
18049
|
try {
|
|
18280
18050
|
performance.clearMarks();
|
|
@@ -18299,7 +18069,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18299
18069
|
]);
|
|
18300
18070
|
}
|
|
18301
18071
|
}, [setEvents]);
|
|
18302
|
-
|
|
18072
|
+
useEffect6(() => {
|
|
18303
18073
|
if (!cfg || updateCheckedRef.current) return;
|
|
18304
18074
|
updateCheckedRef.current = true;
|
|
18305
18075
|
if (initialUpdateResult) {
|
|
@@ -18350,7 +18120,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18350
18120
|
}
|
|
18351
18121
|
});
|
|
18352
18122
|
}, [cfg, initialUpdateResult]);
|
|
18353
|
-
|
|
18123
|
+
useEffect6(() => {
|
|
18354
18124
|
modeRef.current = mode;
|
|
18355
18125
|
if (cacheStableRef.current) {
|
|
18356
18126
|
messagesRef.current[1] = {
|
|
@@ -18377,10 +18147,10 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18377
18147
|
executorRef.current.clearSessionPermissions();
|
|
18378
18148
|
}
|
|
18379
18149
|
}, [mode, cfg?.model]);
|
|
18380
|
-
|
|
18150
|
+
useEffect6(() => {
|
|
18381
18151
|
effortRef.current = effort;
|
|
18382
18152
|
}, [effort]);
|
|
18383
|
-
|
|
18153
|
+
useEffect6(() => {
|
|
18384
18154
|
if (!cfg) return;
|
|
18385
18155
|
const id = setInterval(() => {
|
|
18386
18156
|
void checkForUpdate().then((result) => {
|
|
@@ -18535,7 +18305,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
18535
18305
|
]);
|
|
18536
18306
|
}
|
|
18537
18307
|
}, [cfg]);
|
|
18538
|
-
|
|
18308
|
+
useEffect6(() => {
|
|
18539
18309
|
if (cfg && !mcpInitRef.current) {
|
|
18540
18310
|
void initMcp();
|
|
18541
18311
|
}
|
|
@@ -20061,7 +19831,7 @@ ${lines.join("\n")}` }]);
|
|
|
20061
19831
|
if (c === "/hello") {
|
|
20062
19832
|
const session = crypto.randomUUID();
|
|
20063
19833
|
const url = `${FEEDBACK_WORKER_URL2}/?s=${session}&v=${getAppVersion()}`;
|
|
20064
|
-
|
|
19834
|
+
openBrowser(url);
|
|
20065
19835
|
void (async () => {
|
|
20066
19836
|
try {
|
|
20067
19837
|
const qr = await QRCode.toString(url, { type: "terminal", small: true });
|
|
@@ -20940,7 +20710,7 @@ ${lines.join("\n")}` }]);
|
|
|
20940
20710
|
},
|
|
20941
20711
|
[cfg, handleSlash, updateAssistant, updateTool, saveSessionSafe, updateGatewayMeta]
|
|
20942
20712
|
);
|
|
20943
|
-
|
|
20713
|
+
useEffect6(() => {
|
|
20944
20714
|
if (!busy && queue.length > 0 && supervisorRef.current.phase === "idle") {
|
|
20945
20715
|
const next = queue[0];
|
|
20946
20716
|
setQueue((q) => q.slice(1));
|
|
@@ -20970,7 +20740,7 @@ ${lines.join("\n")}` }]);
|
|
|
20970
20740
|
[processMessage]
|
|
20971
20741
|
);
|
|
20972
20742
|
submitRef.current = submit;
|
|
20973
|
-
|
|
20743
|
+
useEffect6(() => {
|
|
20974
20744
|
if (compactSuggestedRef.current) return;
|
|
20975
20745
|
if (usage && usage.prompt_tokens / CONTEXT_LIMIT >= AUTO_COMPACT_SUGGEST_PCT) {
|
|
20976
20746
|
compactSuggestedRef.current = true;
|
|
@@ -20989,29 +20759,12 @@ ${lines.join("\n")}` }]);
|
|
|
20989
20759
|
Onboarding,
|
|
20990
20760
|
{
|
|
20991
20761
|
onCancel: () => exit(),
|
|
20992
|
-
onDone: async (newCfg
|
|
20762
|
+
onDone: async (newCfg) => {
|
|
20993
20763
|
setCfg(newCfg);
|
|
20994
|
-
|
|
20995
|
-
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
setCloudDeviceId(creds.deviceId);
|
|
20999
|
-
setEvents((e) => [
|
|
21000
|
-
...e,
|
|
21001
|
-
{ kind: "info", key: mkKey(), text: "configuration saved \u2014 welcome to kimiflare! (cloud mode)" }
|
|
21002
|
-
]);
|
|
21003
|
-
} else {
|
|
21004
|
-
setEvents((e) => [
|
|
21005
|
-
...e,
|
|
21006
|
-
{ kind: "info", key: mkKey(), text: "cloud mode configured \u2014 run `kimiflare auth cloud` to sign in" }
|
|
21007
|
-
]);
|
|
21008
|
-
}
|
|
21009
|
-
} else {
|
|
21010
|
-
setEvents((e) => [
|
|
21011
|
-
...e,
|
|
21012
|
-
{ kind: "info", key: mkKey(), text: "configuration saved \u2014 welcome to kimiflare!" }
|
|
21013
|
-
]);
|
|
21014
|
-
}
|
|
20764
|
+
setEvents((e) => [
|
|
20765
|
+
...e,
|
|
20766
|
+
{ kind: "info", key: mkKey(), text: "configuration saved \u2014 welcome to kimiflare!" }
|
|
20767
|
+
]);
|
|
21015
20768
|
}
|
|
21016
20769
|
}
|
|
21017
20770
|
) });
|
|
@@ -21066,7 +20819,7 @@ ${lines.join("\n")}` }]);
|
|
|
21066
20819
|
InboxModal,
|
|
21067
20820
|
{
|
|
21068
20821
|
onDone: () => setShowInboxModal(false),
|
|
21069
|
-
onOpen: (url) =>
|
|
20822
|
+
onOpen: (url) => openBrowser(url)
|
|
21070
20823
|
}
|
|
21071
20824
|
) }) });
|
|
21072
20825
|
}
|
|
@@ -21147,7 +20900,7 @@ ${lines.join("\n")}` }]);
|
|
|
21147
20900
|
] }),
|
|
21148
20901
|
/* @__PURE__ */ jsx27(Text26, { color: theme.info.color, children: commandToDelete.filepath }),
|
|
21149
20902
|
/* @__PURE__ */ jsx27(Box25, { marginTop: 1, children: /* @__PURE__ */ jsx27(
|
|
21150
|
-
|
|
20903
|
+
SelectInput9,
|
|
21151
20904
|
{
|
|
21152
20905
|
items: [
|
|
21153
20906
|
{ label: "Yes, delete", value: "yes", key: "yes" },
|