kimiflare 0.95.0 → 0.96.1
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 +70 -35
- package/dist/index.js.map +1 -1
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +4867 -4864
- package/dist/sdk/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
40
40
|
// src/config.ts
|
|
41
41
|
var config_exports = {};
|
|
42
42
|
__export(config_exports, {
|
|
43
|
+
DEFAULT_CLOUD_MODEL: () => DEFAULT_CLOUD_MODEL,
|
|
43
44
|
DEFAULT_MODEL: () => DEFAULT_MODEL,
|
|
44
45
|
DEFAULT_REASONING_EFFORT: () => DEFAULT_REASONING_EFFORT,
|
|
45
46
|
EFFORTS: () => EFFORTS,
|
|
@@ -388,12 +389,13 @@ async function saveConfig(cfg) {
|
|
|
388
389
|
await chmod(p, 384);
|
|
389
390
|
return p;
|
|
390
391
|
}
|
|
391
|
-
var EFFORTS, DEFAULT_MODEL, DEFAULT_REASONING_EFFORT;
|
|
392
|
+
var EFFORTS, DEFAULT_MODEL, DEFAULT_CLOUD_MODEL, DEFAULT_REASONING_EFFORT;
|
|
392
393
|
var init_config = __esm({
|
|
393
394
|
"src/config.ts"() {
|
|
394
395
|
"use strict";
|
|
395
396
|
EFFORTS = ["low", "medium", "high"];
|
|
396
397
|
DEFAULT_MODEL = "@cf/moonshotai/kimi-k2.6";
|
|
398
|
+
DEFAULT_CLOUD_MODEL = "@cf/moonshotai/kimi-k2.7-code";
|
|
397
399
|
DEFAULT_REASONING_EFFORT = "medium";
|
|
398
400
|
}
|
|
399
401
|
});
|
|
@@ -2240,7 +2242,7 @@ async function* runKimi(opts2) {
|
|
|
2240
2242
|
`Your stored ${modelProvider} key is likely invalid or expired. Fix:`,
|
|
2241
2243
|
` /keys set ${modelProvider} <new-key> replace the stored key`,
|
|
2242
2244
|
` /keys clear ${modelProvider} remove it and reopen the picker to paste fresh`,
|
|
2243
|
-
` /model
|
|
2245
|
+
` /model ${opts2.cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL} switch back to Workers AI (no key needed)`
|
|
2244
2246
|
].join("\n") : msg;
|
|
2245
2247
|
const apiErr = new KimiApiError(`kimiflare: ${wrappedMsg}`, err?.code, res.status);
|
|
2246
2248
|
if (isRetryable(apiErr, attempt)) {
|
|
@@ -2320,7 +2322,7 @@ function validateModelId(model) {
|
|
|
2320
2322
|
if (/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/.test(model)) return;
|
|
2321
2323
|
throw new KimiApiError(`Invalid model ID: ${model}`, 400);
|
|
2322
2324
|
}
|
|
2323
|
-
function missingKeyMessage(model, provider, unifiedAvailable) {
|
|
2325
|
+
function missingKeyMessage(model, provider, unifiedAvailable, cloudMode) {
|
|
2324
2326
|
const doc = PROVIDER_DOC[provider] ?? { name: "your provider", where: "your provider's dashboard" };
|
|
2325
2327
|
const lines = [
|
|
2326
2328
|
`kimiflare: ${model} needs a ${doc.name} API key.`,
|
|
@@ -2331,7 +2333,8 @@ function missingKeyMessage(model, provider, unifiedAvailable) {
|
|
|
2331
2333
|
if (unifiedAvailable) {
|
|
2332
2334
|
lines.push(` 2. Enable Cloudflare Unified Billing for this gateway in the CF dashboard, then run: /keys unified on`);
|
|
2333
2335
|
}
|
|
2334
|
-
|
|
2336
|
+
const fallbackModel = cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL;
|
|
2337
|
+
lines.push(` ${unifiedAvailable ? "3" : "2"}. Switch back to a Workers AI model: /model ${fallbackModel}`);
|
|
2335
2338
|
return lines.join("\n");
|
|
2336
2339
|
}
|
|
2337
2340
|
function gatewayHeadersFor(opts2) {
|
|
@@ -2394,7 +2397,7 @@ function buildKimiRequestTarget(opts2) {
|
|
|
2394
2397
|
headers["cf-aig-authorization"] = `Bearer ${providerKey}`;
|
|
2395
2398
|
} else {
|
|
2396
2399
|
throw new KimiApiError(
|
|
2397
|
-
missingKeyMessage(opts2.model, entry.provider, entry.billingMode === "unified"),
|
|
2400
|
+
missingKeyMessage(opts2.model, entry.provider, entry.billingMode === "unified", opts2.cloudMode),
|
|
2398
2401
|
void 0,
|
|
2399
2402
|
401
|
|
2400
2403
|
);
|
|
@@ -2573,6 +2576,7 @@ var init_client = __esm({
|
|
|
2573
2576
|
init_log_sink();
|
|
2574
2577
|
init_llm_dump();
|
|
2575
2578
|
init_registry();
|
|
2579
|
+
init_config();
|
|
2576
2580
|
RETRYABLE_CODES = /* @__PURE__ */ new Set([3040]);
|
|
2577
2581
|
MAX_ATTEMPTS = 5;
|
|
2578
2582
|
PROVIDER_DOC = {
|
|
@@ -7844,7 +7848,7 @@ var init_spawn_worker = __esm({
|
|
|
7844
7848
|
},
|
|
7845
7849
|
model: {
|
|
7846
7850
|
type: "string",
|
|
7847
|
-
description:
|
|
7851
|
+
description: `Model to use for the worker. Defaults to ${DEFAULT_MODEL} (or ${DEFAULT_CLOUD_MODEL} in cloud mode).`
|
|
7848
7852
|
},
|
|
7849
7853
|
branchName: {
|
|
7850
7854
|
type: "string",
|
|
@@ -7882,6 +7886,7 @@ var init_spawn_worker = __esm({
|
|
|
7882
7886
|
const timeoutMs = readNumberEnv2("KIMIFLARE_WORKER_TIMEOUT_MS") ?? DEFAULT_WORKER_TIMEOUT_MS;
|
|
7883
7887
|
const cfg = await loadConfig().catch(() => null);
|
|
7884
7888
|
const budgetUsd = resolveWorkerBudgetUsd(cfg);
|
|
7889
|
+
const defaultModel = cfg?.cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL;
|
|
7885
7890
|
const payload = {
|
|
7886
7891
|
mode: args.mode,
|
|
7887
7892
|
task: args.task,
|
|
@@ -7889,7 +7894,7 @@ var init_spawn_worker = __esm({
|
|
|
7889
7894
|
budget: { maxCostUsd: budgetUsd },
|
|
7890
7895
|
outputFormat: args.outputFormat ?? "structured",
|
|
7891
7896
|
tools: args.tools ?? (args.mode === "plan" ? "read-only" : "all"),
|
|
7892
|
-
model: args.model ??
|
|
7897
|
+
model: args.model ?? defaultModel,
|
|
7893
7898
|
...args.mode === "execute" ? {
|
|
7894
7899
|
branchName: args.branchName,
|
|
7895
7900
|
baseBranch: args.baseBranch ?? "main",
|
|
@@ -7969,7 +7974,8 @@ var init_plan_options = __esm({
|
|
|
7969
7974
|
"Present a list of plan options to the user and let them pick one.",
|
|
7970
7975
|
"Use this when you have multiple viable approaches and want the user to choose",
|
|
7971
7976
|
"which plan to pursue. Each option needs a short label and the full plan text.",
|
|
7972
|
-
"After the user selects an option,
|
|
7977
|
+
"After the user selects an option, they choose an execution mode and the",
|
|
7978
|
+
"session starts fresh seeded with the chosen plan."
|
|
7973
7979
|
].join(" "),
|
|
7974
7980
|
parameters: {
|
|
7975
7981
|
type: "object",
|
|
@@ -10868,7 +10874,7 @@ function setupRoutes(config2) {
|
|
|
10868
10874
|
if (pathname === "/prompt" && method === "POST") {
|
|
10869
10875
|
const body = await readBody(req);
|
|
10870
10876
|
const prompt = typeof body.prompt === "string" ? body.prompt : "";
|
|
10871
|
-
const model = typeof body.model === "string" ? body.model : config2.model ??
|
|
10877
|
+
const model = typeof body.model === "string" ? body.model : config2.model ?? (config2.cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL);
|
|
10872
10878
|
const cwd = typeof body.cwd === "string" ? body.cwd : process.cwd();
|
|
10873
10879
|
const title = typeof body.title === "string" ? body.title : void 0;
|
|
10874
10880
|
const files = Array.isArray(body.files) ? body.files.filter((f) => typeof f === "string") : [];
|
|
@@ -11043,6 +11049,7 @@ var activeSessions;
|
|
|
11043
11049
|
var init_routes = __esm({
|
|
11044
11050
|
"src/server/routes.ts"() {
|
|
11045
11051
|
"use strict";
|
|
11052
|
+
init_config();
|
|
11046
11053
|
init_loop();
|
|
11047
11054
|
init_system_prompt();
|
|
11048
11055
|
init_executor();
|
|
@@ -11827,6 +11834,7 @@ var init_manager2 = __esm({
|
|
|
11827
11834
|
init_schema();
|
|
11828
11835
|
init_db2();
|
|
11829
11836
|
init_embeddings();
|
|
11837
|
+
init_config();
|
|
11830
11838
|
init_retrieval();
|
|
11831
11839
|
init_cleanup();
|
|
11832
11840
|
SECRET_PATTERNS = [
|
|
@@ -11877,7 +11885,7 @@ Return a JSON array of strings. Example:
|
|
|
11877
11885
|
return {
|
|
11878
11886
|
accountId: this.opts.accountId,
|
|
11879
11887
|
apiToken: this.opts.apiToken,
|
|
11880
|
-
model: this.opts.model ??
|
|
11888
|
+
model: this.opts.model ?? (this.opts.cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL),
|
|
11881
11889
|
gateway: this.opts.gateway
|
|
11882
11890
|
};
|
|
11883
11891
|
}
|
|
@@ -13717,7 +13725,8 @@ async function createAgentSession(opts2) {
|
|
|
13717
13725
|
extractionModel: config2.memoryExtractionModel,
|
|
13718
13726
|
embeddingModel: config2.memoryEmbeddingModel,
|
|
13719
13727
|
maxAgeDays: config2.memoryMaxAgeDays,
|
|
13720
|
-
maxEntries: config2.memoryMaxEntries
|
|
13728
|
+
maxEntries: config2.memoryMaxEntries,
|
|
13729
|
+
cloudMode: config2.cloudMode
|
|
13721
13730
|
});
|
|
13722
13731
|
memoryManager.open();
|
|
13723
13732
|
}
|
|
@@ -14849,6 +14858,7 @@ var init_supervisor = __esm({
|
|
|
14849
14858
|
logger.warn("supervisor:mcp_export_failed", { error: err.message });
|
|
14850
14859
|
}
|
|
14851
14860
|
}
|
|
14861
|
+
const defaultWorkerModel = cfg?.cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL;
|
|
14852
14862
|
const payload = {
|
|
14853
14863
|
mode: w.mode,
|
|
14854
14864
|
task: w.task,
|
|
@@ -14858,7 +14868,7 @@ ${w.context ?? ""}` : w.context ?? "",
|
|
|
14858
14868
|
budget: { maxCostUsd },
|
|
14859
14869
|
outputFormat: "structured",
|
|
14860
14870
|
tools: w.mode === "plan" ? "read-only" : "all",
|
|
14861
|
-
model: w.model ??
|
|
14871
|
+
model: w.model ?? defaultWorkerModel,
|
|
14862
14872
|
// Sandbox-driven worker needs the repo to clone:
|
|
14863
14873
|
githubToken: repo.token,
|
|
14864
14874
|
owner: repo.owner,
|
|
@@ -28871,7 +28881,7 @@ function executeFreshStart(ctx, planText, overrideMode, opts2 = {}) {
|
|
|
28871
28881
|
rebuildSystemPromptForMode(
|
|
28872
28882
|
ctx.messagesRef.current,
|
|
28873
28883
|
ctx.cacheStableRef.current,
|
|
28874
|
-
ctx.cfg?.model ??
|
|
28884
|
+
ctx.cfg?.model ?? (ctx.cfg?.cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL),
|
|
28875
28885
|
overrideMode ?? ctx.mode,
|
|
28876
28886
|
[...ALL_TOOLS, ...ctx.mcpToolsRef.current, ...ctx.lspToolsRef.current],
|
|
28877
28887
|
ctx.cfg?.preferPullRequests
|
|
@@ -31509,7 +31519,8 @@ function runStartupTasks(deps) {
|
|
|
31509
31519
|
embeddingModel: cfg.memoryEmbeddingModel,
|
|
31510
31520
|
gateway: gatewayFromConfig(cfg),
|
|
31511
31521
|
maxAgeDays: cfg.memoryMaxAgeDays ?? RETENTION.memoryMaxAgeDays,
|
|
31512
|
-
maxEntries: cfg.memoryMaxEntries ?? RETENTION.memoryMaxEntries
|
|
31522
|
+
maxEntries: cfg.memoryMaxEntries ?? RETENTION.memoryMaxEntries,
|
|
31523
|
+
cloudMode: cfg.cloudMode
|
|
31513
31524
|
});
|
|
31514
31525
|
manager.open();
|
|
31515
31526
|
memoryManagerRef.current = manager;
|
|
@@ -32422,6 +32433,7 @@ ${wcagWarnings.join("\n")}` }
|
|
|
32422
32433
|
const sessionStartRecallRef = useRef7(null);
|
|
32423
32434
|
const kimiMdStaleNudgedRef = useRef7(false);
|
|
32424
32435
|
const sessionPlanRef = useRef7(null);
|
|
32436
|
+
const planCompletePlanRef = useRef7(null);
|
|
32425
32437
|
const sessionMgr = useSessionManager({
|
|
32426
32438
|
cfg,
|
|
32427
32439
|
mode,
|
|
@@ -33485,8 +33497,10 @@ ${wcagWarnings.join("\n")}` }
|
|
|
33485
33497
|
const handlePlanCompletePick = useCallback10(
|
|
33486
33498
|
(picked) => {
|
|
33487
33499
|
setShowPlanCompletePicker(false);
|
|
33500
|
+
const boundPlan = planCompletePlanRef.current;
|
|
33501
|
+
planCompletePlanRef.current = null;
|
|
33488
33502
|
if (!picked || picked === "continue") return;
|
|
33489
|
-
const plan = resolvePlanForFresh({
|
|
33503
|
+
const plan = boundPlan ?? resolvePlanForFresh({
|
|
33490
33504
|
mode: "plan",
|
|
33491
33505
|
messages: messagesRef.current,
|
|
33492
33506
|
sessionPlan: sessionPlanRef.current,
|
|
@@ -34341,7 +34355,10 @@ ${conflicts.join("\n")}` }
|
|
|
34341
34355
|
void memoryManagerRef.current.rememberPlan(plan, process.cwd(), sessionIdRef.current).catch(() => {
|
|
34342
34356
|
});
|
|
34343
34357
|
}
|
|
34344
|
-
|
|
34358
|
+
if (!planOptionsRef.current) {
|
|
34359
|
+
planCompletePlanRef.current = plan;
|
|
34360
|
+
setShowPlanCompletePicker(true);
|
|
34361
|
+
}
|
|
34345
34362
|
}
|
|
34346
34363
|
}
|
|
34347
34364
|
if (planOptionsRef.current) {
|
|
@@ -34498,22 +34515,21 @@ ${conflicts.join("\n")}` }
|
|
|
34498
34515
|
setPlanOptions(null);
|
|
34499
34516
|
planOptionsRef.current = null;
|
|
34500
34517
|
if (option) {
|
|
34501
|
-
|
|
34502
|
-
|
|
34518
|
+
sessionPlanRef.current = option.plan;
|
|
34519
|
+
if (cfg?.memoryEnabled && memoryManagerRef.current && sessionIdRef.current) {
|
|
34520
|
+
void memoryManagerRef.current.rememberPlan(option.plan, process.cwd(), sessionIdRef.current).catch(() => {
|
|
34521
|
+
});
|
|
34522
|
+
}
|
|
34523
|
+
planCompletePlanRef.current = option.plan;
|
|
34524
|
+
setShowPlanCompletePicker(true);
|
|
34503
34525
|
setEvents((e) => [
|
|
34504
34526
|
...e,
|
|
34505
34527
|
{
|
|
34506
34528
|
kind: "info",
|
|
34507
34529
|
key: mkKey(),
|
|
34508
|
-
text:
|
|
34530
|
+
text: `Selected plan "${option.label}" \u2014 choose how to execute.`
|
|
34509
34531
|
}
|
|
34510
34532
|
]);
|
|
34511
|
-
if (!clipResult.success) {
|
|
34512
|
-
setEvents((e) => [
|
|
34513
|
-
...e,
|
|
34514
|
-
{ kind: "info", key: mkKey(), text: "--- Plan ---\n" + option.plan }
|
|
34515
|
-
]);
|
|
34516
|
-
}
|
|
34517
34533
|
}
|
|
34518
34534
|
}
|
|
34519
34535
|
}
|
|
@@ -34985,6 +35001,7 @@ init_errors();
|
|
|
34985
35001
|
init_lsp_config();
|
|
34986
35002
|
init_update_check();
|
|
34987
35003
|
init_version();
|
|
35004
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
34988
35005
|
import { Command as Command2 } from "commander";
|
|
34989
35006
|
|
|
34990
35007
|
// src/remote/cli.ts
|
|
@@ -35111,11 +35128,12 @@ var LOGO_ART = `\x1B[49m \x1B[m
|
|
|
35111
35128
|
\x1B[49m \x1B[m
|
|
35112
35129
|
`;
|
|
35113
35130
|
var LOGO_WIDTH = 48;
|
|
35114
|
-
function buildTextLines(version) {
|
|
35131
|
+
function buildTextLines(version, cloudMode) {
|
|
35115
35132
|
const accent = "\x1B[38;2;255;153;0m";
|
|
35116
35133
|
const dim = "\x1B[2m";
|
|
35117
35134
|
const reset = "\x1B[0m";
|
|
35118
35135
|
const bold = "\x1B[1m";
|
|
35136
|
+
const modelLabel = cloudMode ? "Kimi-K2.7" : "Kimi-K2.6";
|
|
35119
35137
|
return [
|
|
35120
35138
|
"",
|
|
35121
35139
|
"",
|
|
@@ -35126,7 +35144,7 @@ function buildTextLines(version) {
|
|
|
35126
35144
|
` ${bold}${accent}Kimiflare${reset}`,
|
|
35127
35145
|
"",
|
|
35128
35146
|
` ${dim}Terminal coding agent${reset}`,
|
|
35129
|
-
` ${dim}powered by
|
|
35147
|
+
` ${dim}powered by ${modelLabel}${reset}`,
|
|
35130
35148
|
"",
|
|
35131
35149
|
` ${dim}v${version}${reset}`,
|
|
35132
35150
|
"",
|
|
@@ -35150,9 +35168,9 @@ function padVisual(str, width) {
|
|
|
35150
35168
|
const visualLen = stripAnsi(str).length;
|
|
35151
35169
|
return str + " ".repeat(Math.max(0, width - visualLen));
|
|
35152
35170
|
}
|
|
35153
|
-
function renderLogo(version) {
|
|
35171
|
+
function renderLogo(version, cloudMode) {
|
|
35154
35172
|
const logoLines = LOGO_ART.split("\n");
|
|
35155
|
-
const textLines = buildTextLines(version);
|
|
35173
|
+
const textLines = buildTextLines(version, cloudMode);
|
|
35156
35174
|
const out = [];
|
|
35157
35175
|
for (let i = 0; i < logoLines.length; i++) {
|
|
35158
35176
|
const logoLine = padVisual(logoLines[i], LOGO_WIDTH);
|
|
@@ -35509,8 +35527,20 @@ async function runPrintMode(opts2) {
|
|
|
35509
35527
|
}
|
|
35510
35528
|
|
|
35511
35529
|
// src/index.tsx
|
|
35530
|
+
function isCloudModeConfigured() {
|
|
35531
|
+
if (process.env.KIMIFLARE_CLOUD === "1" || process.env.KIMIFLARE_CLOUD === "true") return true;
|
|
35532
|
+
try {
|
|
35533
|
+
const raw = readFileSync5(configPath(), "utf8");
|
|
35534
|
+
const parsed = JSON.parse(raw);
|
|
35535
|
+
return parsed.cloudMode === true;
|
|
35536
|
+
} catch {
|
|
35537
|
+
return false;
|
|
35538
|
+
}
|
|
35539
|
+
}
|
|
35540
|
+
var helpDefaultModel = isCloudModeConfigured() ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL;
|
|
35541
|
+
var helpModelName = helpDefaultModel === DEFAULT_CLOUD_MODEL ? "Kimi-K2.7" : "Kimi-K2.6";
|
|
35512
35542
|
var program = new Command2();
|
|
35513
|
-
program.name("kimiflare").description(
|
|
35543
|
+
program.name("kimiflare").description(`Terminal coding agent powered by ${helpModelName} on Cloudflare Workers AI.`).version(getAppVersion()).option("-p, --print <prompt>", "one-shot mode: send prompt, stream reply to stdout, exit").option("-m, --model <id>", `model id (defaults to ${helpDefaultModel})`).option("--cloud", "use Kimiflare Cloud (api.kimiflare.com) instead of direct Workers AI").option("--dangerously-allow-all", "auto-approve every permission prompt (print mode only)").option("--reasoning", "include reasoning in stdout (print mode only)").option("--thinking", "alias for --reasoning").option("--continue-on-limit", "reset tool-call counter and continue when the 200-call limit is hit (print mode only)").option("--max-input-tokens <n>", "cumulative prompt token budget; exits 42 when exhausted (print mode only)", (v) => parseInt(v, 10)).option("--emit-events", "emit Camouflage NDJSON events to stdout; requires -p (for initial prompt)").option("--multi-turn", "with --emit-events: keep reading stdin for UserInputSubmitted follow-ups after the initial turn").option("--ui <name>", "render UI with React Ink (the only supported engine). This flag and KIMIFLARE_UI are currently ignored.").option("--mode <mode>", "run mode: interactive (default), print, rpc").option("-c, --continue", "continue the most recent session in the current working directory (print mode only)").option("-S, --session <id>", "resume a specific session by id (print mode only)").option("-f, --file <path>", "attach file(s) to the prompt; repeatable, supports globs (print mode only)", (v, prev) => (prev ?? []).concat(v)).option("--format <mode>", "output format for print mode: text (default), json, stream-json").option("--dir <path>", "run in the specified directory instead of the current one (print mode only)").option("--title <title>", "override the auto-generated session title (print mode only)").option("--attach <url>", "attach to a running kimiflare serve instance (print mode only)");
|
|
35514
35544
|
program.command("cost").description("Show cost attribution by task type (requires costAttribution enabled)").option("-w, --week", "last 7 days (default)").option("-m, --month", "last 30 days").option("-d, --day", "today only").option("-s, --session <id>", "single session detail").option("-c, --category <name>", "filter by category").option("--json", "machine-readable output").option("--reclassify", "re-run classification on all sessions").option("--local-only", "skip Cloudflare reconciliation").action(async (cmdOpts) => {
|
|
35515
35545
|
const cfg = await loadConfig();
|
|
35516
35546
|
const enabled = cfg?.costAttribution ?? false;
|
|
@@ -35682,7 +35712,7 @@ async function main() {
|
|
|
35682
35712
|
}
|
|
35683
35713
|
}
|
|
35684
35714
|
cfg = {
|
|
35685
|
-
...cfg ?? { accountId: "", apiToken: "", model:
|
|
35715
|
+
...cfg ?? { accountId: "", apiToken: "", model: DEFAULT_CLOUD_MODEL, memoryEnabled: false },
|
|
35686
35716
|
cloudMode: true
|
|
35687
35717
|
};
|
|
35688
35718
|
}
|
|
@@ -35702,7 +35732,7 @@ async function main() {
|
|
|
35702
35732
|
console.error("kimiflare: --emit-events requires credentials.");
|
|
35703
35733
|
process.exit(2);
|
|
35704
35734
|
}
|
|
35705
|
-
const model = opts.model ?? cfg.model ?? DEFAULT_MODEL;
|
|
35735
|
+
const model = opts.model ?? cfg.model ?? (cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL);
|
|
35706
35736
|
const { runEmitMode: runEmitMode2 } = await Promise.resolve().then(() => (init_emit_mode(), emit_mode_exports));
|
|
35707
35737
|
await runEmitMode2({
|
|
35708
35738
|
accountId: cfg.accountId,
|
|
@@ -35721,13 +35751,18 @@ async function main() {
|
|
|
35721
35751
|
return;
|
|
35722
35752
|
}
|
|
35723
35753
|
if (opts.print !== void 0) {
|
|
35754
|
+
const exampleModel = cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL;
|
|
35724
35755
|
if (!cfg) {
|
|
35725
35756
|
console.error(
|
|
35726
|
-
|
|
35757
|
+
`kimiflare: missing credentials.
|
|
35758
|
+
Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN, or write them to
|
|
35759
|
+
~/.config/kimiflare/config.json (chmod 600)
|
|
35760
|
+
{ "accountId": "...", "apiToken": "...", "model": "${exampleModel}" }
|
|
35761
|
+
Or use cloud mode: kimiflare --cloud -p "..."`
|
|
35727
35762
|
);
|
|
35728
35763
|
process.exit(2);
|
|
35729
35764
|
}
|
|
35730
|
-
const model = opts.model ?? cfg.model ?? DEFAULT_MODEL;
|
|
35765
|
+
const model = opts.model ?? cfg.model ?? (cloudMode ? DEFAULT_CLOUD_MODEL : DEFAULT_MODEL);
|
|
35731
35766
|
const format = opts.format ?? "text";
|
|
35732
35767
|
if (format !== "text" && format !== "json" && format !== "stream-json") {
|
|
35733
35768
|
console.error(`kimiflare: invalid --format "${format}". Use: text, json, stream-json`);
|
|
@@ -35775,7 +35810,7 @@ async function main() {
|
|
|
35775
35810
|
);
|
|
35776
35811
|
process.exit(2);
|
|
35777
35812
|
}
|
|
35778
|
-
const logoText = renderLogo(getAppVersion());
|
|
35813
|
+
const logoText = renderLogo(getAppVersion(), cloudMode);
|
|
35779
35814
|
const uiEngine = "ink";
|
|
35780
35815
|
console.log(logoText);
|
|
35781
35816
|
const { renderApp: renderApp2 } = await Promise.resolve().then(() => (init_app(), app_exports));
|