kimiflare 0.60.0 → 0.61.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 +30 -9
- package/dist/index.js.map +1 -1
- package/dist/sdk/index.js +10 -2
- package/dist/sdk/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3715,9 +3715,17 @@ ${sandboxResult.output}` : sandboxResult.output;
|
|
|
3715
3715
|
loopExhausted = false;
|
|
3716
3716
|
recentToolCalls.length = 0;
|
|
3717
3717
|
continue;
|
|
3718
|
-
} else {
|
|
3719
|
-
return;
|
|
3720
3718
|
}
|
|
3719
|
+
if (decision === "synthesize") {
|
|
3720
|
+
opts2.messages.push({
|
|
3721
|
+
role: "system",
|
|
3722
|
+
content: "You were stuck calling the same tools with identical arguments. Please synthesize and conclude your findings so far. Do not call any more tools."
|
|
3723
|
+
});
|
|
3724
|
+
loopExhausted = false;
|
|
3725
|
+
recentToolCalls.length = 0;
|
|
3726
|
+
continue;
|
|
3727
|
+
}
|
|
3728
|
+
return;
|
|
3721
3729
|
}
|
|
3722
3730
|
throw new AgentLoopError();
|
|
3723
3731
|
}
|
|
@@ -6740,6 +6748,7 @@ async function loadCloudCredentials() {
|
|
|
6740
6748
|
}
|
|
6741
6749
|
async function saveCloudCredentials(creds) {
|
|
6742
6750
|
const p = cloudCredPath();
|
|
6751
|
+
await mkdir8(join15(p, ".."), { recursive: true });
|
|
6743
6752
|
await writeFile8(p, JSON.stringify(creds, null, 2), "utf8");
|
|
6744
6753
|
if (creds.deviceId) {
|
|
6745
6754
|
await persistDeviceId(creds.deviceId).catch(() => {
|
|
@@ -12298,19 +12307,20 @@ var init_permission = __esm({
|
|
|
12298
12307
|
import { Box as Box10, Text as Text11 } from "ink";
|
|
12299
12308
|
import SelectInput from "ink-select-input";
|
|
12300
12309
|
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
12301
|
-
function LimitModal({ limit, onDecide, title, description }) {
|
|
12310
|
+
function LimitModal({ limit, onDecide, title, description, items }) {
|
|
12302
12311
|
const theme = useTheme();
|
|
12303
|
-
const
|
|
12312
|
+
const defaultItems = [
|
|
12304
12313
|
{ label: "Continue", value: "continue" },
|
|
12305
12314
|
{ label: "Stop", value: "stop" }
|
|
12306
12315
|
];
|
|
12316
|
+
const selectItems = items ?? defaultItems;
|
|
12307
12317
|
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", borderStyle: "round", borderColor: theme.error, paddingX: 1, children: [
|
|
12308
12318
|
/* @__PURE__ */ jsx12(Text11, { color: theme.error, bold: true, children: title ?? `Tool-call limit reached (${limit})` }),
|
|
12309
12319
|
/* @__PURE__ */ jsx12(Text11, { dimColor: true, children: description ?? `This session has made ${limit} tool calls. What would you like to do?` }),
|
|
12310
12320
|
/* @__PURE__ */ jsx12(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx12(
|
|
12311
12321
|
SelectInput,
|
|
12312
12322
|
{
|
|
12313
|
-
items,
|
|
12323
|
+
items: selectItems,
|
|
12314
12324
|
onSelect: (item) => onDecide(item.value)
|
|
12315
12325
|
}
|
|
12316
12326
|
) })
|
|
@@ -12816,7 +12826,7 @@ function Onboarding({ onDone, onCancel }) {
|
|
|
12816
12826
|
try {
|
|
12817
12827
|
const path = await saveConfig(cfg);
|
|
12818
12828
|
setSavedPath(path);
|
|
12819
|
-
onDone(cfg);
|
|
12829
|
+
onDone(cfg, cloudAuth.creds);
|
|
12820
12830
|
} catch (e) {
|
|
12821
12831
|
setSavedPath(`error: ${e.message}`);
|
|
12822
12832
|
}
|
|
@@ -20775,13 +20785,13 @@ ${lines.join("\n")}` }]);
|
|
|
20775
20785
|
Onboarding,
|
|
20776
20786
|
{
|
|
20777
20787
|
onCancel: () => exit(),
|
|
20778
|
-
onDone: async (newCfg) => {
|
|
20788
|
+
onDone: async (newCfg, cloudCredentials) => {
|
|
20779
20789
|
setCfg(newCfg);
|
|
20780
20790
|
if (newCfg.cloudMode) {
|
|
20781
|
-
const
|
|
20782
|
-
const creds = await loadCloudCredentials2();
|
|
20791
|
+
const creds = cloudCredentials;
|
|
20783
20792
|
if (creds) {
|
|
20784
20793
|
setCloudToken(creds.accessToken);
|
|
20794
|
+
setCloudDeviceId(creds.deviceId);
|
|
20785
20795
|
setEvents((e) => [
|
|
20786
20796
|
...e,
|
|
20787
20797
|
{ kind: "info", key: mkKey(), text: "configuration saved \u2014 welcome to kimiflare! (cloud mode)" }
|
|
@@ -20986,6 +20996,10 @@ ${lines.join("\n")}` }]);
|
|
|
20986
20996
|
limit: 50,
|
|
20987
20997
|
title: "Agent stuck in a loop",
|
|
20988
20998
|
description: "The agent kept calling the same tools with identical arguments. What would you like to do?",
|
|
20999
|
+
items: [
|
|
21000
|
+
{ label: "Continue", value: "continue" },
|
|
21001
|
+
{ label: "Synthesize", value: "synthesize" }
|
|
21002
|
+
],
|
|
20989
21003
|
onDecide: (d) => {
|
|
20990
21004
|
loopModal.resolve(d);
|
|
20991
21005
|
loopResolveRef.current = null;
|
|
@@ -21374,6 +21388,13 @@ Kimiflare Cloud Authentication`);
|
|
|
21374
21388
|
}
|
|
21375
21389
|
});
|
|
21376
21390
|
console.log(`Authenticated! Token expires at ${new Date(creds.expiresAt * 1e3).toISOString()}`);
|
|
21391
|
+
const existing = await loadConfig();
|
|
21392
|
+
await saveConfig({
|
|
21393
|
+
accountId: "",
|
|
21394
|
+
apiToken: "",
|
|
21395
|
+
model: existing?.model ?? DEFAULT_MODEL,
|
|
21396
|
+
cloudMode: true
|
|
21397
|
+
});
|
|
21377
21398
|
const { fetchCloudUsage: fetchCloudUsage2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
21378
21399
|
const usage = await fetchCloudUsage2(creds.accessToken, creds.deviceId);
|
|
21379
21400
|
if (usage) {
|