@cjhyy/code-shell 0.1.0-alpha.3 → 0.1.6
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/CHANGELOG.md +107 -0
- package/dist/anthropic-IBTI4WL2.cjs +10 -0
- package/dist/anthropic-PRZZKHEZ.js +10 -0
- package/dist/arena/index.cjs +7 -6
- package/dist/arena/index.js +6 -5
- package/dist/arena/model-presets.d.ts +10 -1
- package/dist/{arena-ENHBHB2W.js → arena-2LTLIXOL.js} +9 -7
- package/dist/{arena-HHDYYVHJ.cjs → arena-ADB7DRFI.cjs} +25 -23
- package/dist/{chunk-EL2RL5DG.cjs → chunk-2YW4FPFG.cjs} +2 -2
- package/dist/chunk-3OA5G4TM.js +47 -0
- package/dist/{chunk-FPFTIKEJ.js → chunk-3QO25N6E.js} +131 -173
- package/dist/chunk-3SBSUOWZ.js +447 -0
- package/dist/chunk-52LGZKT3.cjs +47 -0
- package/dist/{chunk-KOGV6PDQ.cjs → chunk-55XGPMAP.cjs} +44 -9
- package/dist/{chunk-YD7XTI7T.cjs → chunk-6QVAYW7C.cjs} +116 -28
- package/dist/{chunk-SCDKLTN3.js → chunk-6S4BJ65N.js} +5 -4
- package/dist/{chunk-ZLPJJZUW.js → chunk-76HYEPDM.js} +2 -2
- package/dist/chunk-7BI3V74Y.cjs +447 -0
- package/dist/{chunk-GZBD6QRS.cjs → chunk-7EG3V4JY.cjs} +13 -12
- package/dist/{chunk-LMEKCQX4.js → chunk-7JVTYEEC.js} +6 -6
- package/dist/{chunk-SW3L7HIM.js → chunk-7QIM3BKD.js} +2 -2
- package/dist/{chunk-5C5HIOML.js → chunk-7Y6S3OCX.js} +109 -21
- package/dist/{chunk-REFCCVDM.js → chunk-ABRRONJ7.js} +2 -2
- package/dist/{chunk-F5BS3GUC.js → chunk-BSW22MPA.js} +39 -4
- package/dist/{chunk-ZRVPCXI7.js → chunk-BXCY2FSE.js} +2 -1
- package/dist/{chunk-Y7TSCDF6.js → chunk-BZ5TNE7L.js} +347 -6
- package/dist/{chunk-X2DNIMPC.cjs → chunk-DDB6QOKJ.cjs} +32 -32
- package/dist/{chunk-C7C7ZZY4.cjs → chunk-HEKQCI7B.cjs} +10 -10
- package/dist/{chunk-JHNCK7JP.cjs → chunk-IK4EWJBP.cjs} +4 -3
- package/dist/{chunk-3CAZIWUA.cjs → chunk-ILHE7XLT.cjs} +9 -9
- package/dist/{chunk-M2QI5X3X.cjs → chunk-JMR33QVF.cjs} +2 -2
- package/dist/{chunk-TDXBHD24.js → chunk-KAQHULYN.js} +2 -2
- package/dist/chunk-KE4EQOWA.js +294 -0
- package/dist/{chunk-YAFCN7ZW.cjs → chunk-KOVYSDHZ.cjs} +15 -15
- package/dist/{chunk-IJSHQGMP.cjs → chunk-KS3RYAYL.cjs} +4 -4
- package/dist/{chunk-DI7RDLOS.js → chunk-MD32R22I.js} +7 -4
- package/dist/chunk-MV7YI4WO.cjs +293 -0
- package/dist/chunk-MY5XHADU.cjs +216 -0
- package/dist/{chunk-OP57WUWQ.cjs → chunk-NUNC3VFB.cjs} +6 -6
- package/dist/{chunk-ID6EJUHP.js → chunk-PKGRTCCY.js} +1307 -212
- package/dist/{chunk-OUC2DFA7.js → chunk-QARL3IDQ.js} +3 -3
- package/dist/{chunk-VIPLU4RY.cjs → chunk-S754JHLR.cjs} +4 -4
- package/dist/{chunk-FUOKLKR2.js → chunk-SFXHZSRF.js} +1 -1
- package/dist/{chunk-2EUAE7AY.js → chunk-SIHHIQLO.js} +2 -2
- package/dist/{chunk-SK62UVS6.js → chunk-T6VYG46N.js} +1 -1
- package/dist/{chunk-JHXNOB5G.cjs → chunk-TNLGBJYS.cjs} +6 -6
- package/dist/{chunk-3QR52LL5.cjs → chunk-TUY2T5KP.cjs} +2 -2
- package/dist/{chunk-VWFET3MG.cjs → chunk-UXOCVJJ6.cjs} +1519 -424
- package/dist/{chunk-I57ZD5IQ.js → chunk-VIAGTYYW.js} +1 -1
- package/dist/chunk-WASS5YWB.js +215 -0
- package/dist/{chunk-HOXQLX5R.cjs → chunk-WZJV6DJC.cjs} +444 -103
- package/dist/{chunk-BUJ5KYCI.cjs → chunk-YIQBXAYU.cjs} +13 -13
- package/dist/{chunk-BF4LXLQV.cjs → chunk-YKIAELDZ.cjs} +132 -174
- package/dist/{chunk-M2SVOKC6.js → chunk-ZBPSQCPU.js} +6 -6
- package/dist/cli/commands/builtin/export-md.d.ts +19 -0
- package/dist/cli/commands/builtin/init/detect.d.ts +25 -0
- package/dist/cli/commands/builtin/init/index.d.ts +19 -0
- package/dist/cli/main.cjs +2372 -1453
- package/dist/cli/main.js +2502 -1583
- package/dist/cli/migrate-models.d.ts +45 -0
- package/dist/cli/onboarding.d.ts +110 -5
- package/dist/cli/updater.d.ts +59 -4
- package/dist/client-base-HTF236ZD.cjs +9 -0
- package/dist/client-base-QKRKCOWB.js +9 -0
- package/dist/{compaction-YNWCEF7B.js → compaction-6VU2T643.js} +4 -2
- package/dist/compaction-OKUNTCA7.cjs +33 -0
- package/dist/context/compaction.d.ts +35 -3
- package/dist/context/manager.d.ts +40 -3
- package/dist/context/tool-result-storage.d.ts +96 -0
- package/dist/devtools-T2NIZBJK.cjs +6 -0
- package/dist/{devtools-IRQQPIRY.js → devtools-YXWHOVKR.js} +1 -1
- package/dist/engine/engine.d.ts +47 -0
- package/dist/engine/turn-loop.d.ts +6 -0
- package/dist/export-md-RXDW6F5W.cjs +135 -0
- package/dist/export-md-XXKZANW5.js +135 -0
- package/dist/file-history-KYPE3ECT.cjs +7 -0
- package/dist/file-history-LF4F7X26.js +7 -0
- package/dist/index.cjs +42 -22
- package/dist/index.d.ts +5 -2
- package/dist/index.js +38 -18
- package/dist/llm/client-base.d.ts +1 -1
- package/dist/llm/model-cache.d.ts +21 -0
- package/dist/llm/model-fetcher.d.ts +29 -0
- package/dist/llm/model-pool.d.ts +13 -0
- package/dist/llm/provider-catalog.d.ts +30 -0
- package/dist/llm/provider-kinds.d.ts +21 -0
- package/dist/llm/types.d.ts +8 -0
- package/dist/logging/session-recorder.d.ts +77 -0
- package/dist/manager-D65VFAPX.js +7 -0
- package/dist/manager-TTF5VHJC.cjs +7 -0
- package/dist/mcp-manager-QMKWPBZ4.js +8 -0
- package/dist/mcp-manager-Z3OKI74O.cjs +8 -0
- package/dist/memory-5LWZ6FI2.cjs +9 -0
- package/dist/{memory-EPFDBPII.js → memory-VIJLBAMQ.js} +2 -2
- package/dist/model-cache-5KIYL5SL.js +13 -0
- package/dist/model-cache-OED3IM4R.cjs +13 -0
- package/dist/model-fetcher-HKGICACL.js +8 -0
- package/dist/model-fetcher-UR6WJOQP.cjs +8 -0
- package/dist/openai-JR2WEKOF.js +10 -0
- package/dist/openai-YBTOET4O.cjs +10 -0
- package/dist/{openrouter-models-2FM3H4SQ.js → openrouter-models-H56GHBHN.js} +2 -2
- package/dist/openrouter-models-TWUFWZ5T.cjs +15 -0
- package/dist/openrouter-sync-5VMGN6C2.cjs +11 -0
- package/dist/{openrouter-sync-SO3AWEAM.js → openrouter-sync-ALEMF5IU.js} +3 -3
- package/dist/product/index.cjs +17 -15
- package/dist/product/index.js +16 -14
- package/dist/protocol/server.d.ts +3 -1
- package/dist/protocol/types.d.ts +36 -2
- package/dist/run/index.cjs +17 -15
- package/dist/run/index.js +16 -14
- package/dist/services/index.d.ts +0 -1
- package/dist/session-manager-Q22BBMD3.js +8 -0
- package/dist/session-manager-XODQVL3C.cjs +8 -0
- package/dist/settings/schema.d.ts +267 -42
- package/dist/{tool-summary-RYNR4DDB.cjs → tool-summary-63DPIS7G.cjs} +4 -4
- package/dist/{tool-summary-2RUFL5QK.js → tool-summary-NP5CDBKG.js} +2 -2
- package/dist/tool-system/builtin/ask-user.d.ts +9 -1
- package/dist/tool-system/context.d.ts +31 -2
- package/dist/tool-system/executor.d.ts +4 -0
- package/dist/tool-system/investigation-guard.d.ts +46 -0
- package/dist/types.d.ts +13 -2
- package/dist/ui/components/AskUserPrompt.d.ts +8 -1
- package/dist/ui/components/DiffLine.d.ts +33 -0
- package/dist/ui/components/ModelManager.d.ts +34 -1
- package/dist/ui/components/OnboardingPrompt.d.ts +10 -1
- package/dist/ui/components/ProviderModelFlow.d.ts +58 -0
- package/dist/ui/components/UpdateBanner.d.ts +1 -0
- package/dist/updater-I7QBW4DP.cjs +17 -0
- package/dist/updater-NVME5S3Z.js +17 -0
- package/dist/utils/semver.d.ts +1 -0
- package/dist/utils/task-sanitizer.d.ts +6 -0
- package/package.json +2 -1
- package/skills-builtin/codeshell-help.md +135 -0
- package/dist/anthropic-P5VETAFI.cjs +0 -10
- package/dist/anthropic-W2GU3D76.js +0 -10
- package/dist/chunk-75E4BBFC.js +0 -224
- package/dist/chunk-FV2ARONZ.cjs +0 -224
- package/dist/client-base-TOVE25FA.js +0 -9
- package/dist/client-base-VDDIADAC.cjs +0 -9
- package/dist/compaction-D3KV2NWY.cjs +0 -31
- package/dist/devtools-WTC3NFNE.cjs +0 -6
- package/dist/file-history-HZWO2WQ5.js +0 -7
- package/dist/file-history-UQQILIY7.cjs +0 -7
- package/dist/manager-FWLOVEEK.cjs +0 -7
- package/dist/manager-GEXJLOIS.js +0 -7
- package/dist/mcp-manager-37GQLFGX.js +0 -8
- package/dist/mcp-manager-U77NEXBY.cjs +0 -8
- package/dist/memory-ADGOWADP.cjs +0 -9
- package/dist/openai-RXU5URYI.js +0 -10
- package/dist/openai-SQW4H2K4.cjs +0 -10
- package/dist/openrouter-models-PLCWZZYE.cjs +0 -15
- package/dist/openrouter-sync-K2WK3A2A.cjs +0 -11
- package/dist/services/compact.d.ts +0 -56
- package/dist/session-manager-HRSKENKB.cjs +0 -8
- package/dist/session-manager-NEKFEHF3.js +0 -8
- package/dist/updater-J7L7R6BY.cjs +0 -185
- package/dist/updater-LDBNYCAO.js +0 -185
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getOpenRouterModels
|
|
3
|
+
} from "./chunk-3QO25N6E.js";
|
|
1
4
|
import {
|
|
2
5
|
LLMError
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SFXHZSRF.js";
|
|
4
7
|
import {
|
|
5
8
|
logger
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BXCY2FSE.js";
|
|
7
10
|
import {
|
|
8
11
|
init_esm_shims
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-MD32R22I.js";
|
|
10
13
|
|
|
11
14
|
// src/llm/client-factory.ts
|
|
12
15
|
init_esm_shims();
|
|
@@ -18,11 +21,11 @@ async function createLLMClient(config) {
|
|
|
18
21
|
let Cls = PROVIDER_REGISTRY.get(config.provider);
|
|
19
22
|
if (!Cls) {
|
|
20
23
|
if (config.provider === "anthropic") {
|
|
21
|
-
const { AnthropicClient } = await import("./anthropic-
|
|
24
|
+
const { AnthropicClient } = await import("./anthropic-PRZZKHEZ.js");
|
|
22
25
|
registerProvider("anthropic", AnthropicClient);
|
|
23
26
|
Cls = AnthropicClient;
|
|
24
27
|
} else if (config.provider === "openai") {
|
|
25
|
-
const { OpenAIClient } = await import("./openai-
|
|
28
|
+
const { OpenAIClient } = await import("./openai-JR2WEKOF.js");
|
|
26
29
|
registerProvider("openai", OpenAIClient);
|
|
27
30
|
Cls = OpenAIClient;
|
|
28
31
|
}
|
|
@@ -4308,6 +4311,337 @@ var Arena = class {
|
|
|
4308
4311
|
}
|
|
4309
4312
|
};
|
|
4310
4313
|
|
|
4314
|
+
// src/cli/onboarding.ts
|
|
4315
|
+
init_esm_shims();
|
|
4316
|
+
import { mkdirSync, writeFileSync, readFileSync as readFileSync4, existsSync as existsSync4, renameSync } from "fs";
|
|
4317
|
+
import { join as join4 } from "path";
|
|
4318
|
+
import { homedir } from "os";
|
|
4319
|
+
var PROVIDERS = [
|
|
4320
|
+
{
|
|
4321
|
+
id: "openrouter",
|
|
4322
|
+
name: "OpenRouter (\u63A8\u8350 \u2014 \u652F\u6301\u6240\u6709\u6A21\u578B)",
|
|
4323
|
+
envKey: "OPENROUTER_API_KEY",
|
|
4324
|
+
provider: "openai",
|
|
4325
|
+
baseUrl: "https://openrouter.ai/api/v1",
|
|
4326
|
+
defaultModel: "anthropic/claude-sonnet-4.6",
|
|
4327
|
+
keyUrl: "https://openrouter.ai/keys",
|
|
4328
|
+
keyPrefix: "sk-or-",
|
|
4329
|
+
models: [
|
|
4330
|
+
"anthropic/claude-opus-4.7",
|
|
4331
|
+
"anthropic/claude-sonnet-4.6",
|
|
4332
|
+
"anthropic/claude-haiku-4.5",
|
|
4333
|
+
"openai/gpt-5",
|
|
4334
|
+
"openai/gpt-5-mini",
|
|
4335
|
+
"openai/gpt-4o",
|
|
4336
|
+
"openai/o4-mini",
|
|
4337
|
+
"openai/o3",
|
|
4338
|
+
"google/gemini-2.5-pro",
|
|
4339
|
+
"google/gemini-2.5-flash",
|
|
4340
|
+
"deepseek/deepseek-chat",
|
|
4341
|
+
"deepseek/deepseek-reasoner",
|
|
4342
|
+
"qwen/qwen3-coder",
|
|
4343
|
+
"meta-llama/llama-4-maverick"
|
|
4344
|
+
]
|
|
4345
|
+
},
|
|
4346
|
+
{
|
|
4347
|
+
id: "anthropic",
|
|
4348
|
+
name: "Anthropic (\u76F4\u8FDE Claude API)",
|
|
4349
|
+
envKey: "ANTHROPIC_API_KEY",
|
|
4350
|
+
provider: "anthropic",
|
|
4351
|
+
baseUrl: "https://api.anthropic.com",
|
|
4352
|
+
defaultModel: "claude-sonnet-4-6",
|
|
4353
|
+
keyUrl: "https://console.anthropic.com/settings/keys",
|
|
4354
|
+
keyPrefix: "sk-ant-",
|
|
4355
|
+
models: [
|
|
4356
|
+
"claude-opus-4-7",
|
|
4357
|
+
"claude-sonnet-4-6",
|
|
4358
|
+
"claude-haiku-4-5"
|
|
4359
|
+
]
|
|
4360
|
+
},
|
|
4361
|
+
{
|
|
4362
|
+
id: "openai",
|
|
4363
|
+
name: "OpenAI",
|
|
4364
|
+
envKey: "OPENAI_API_KEY",
|
|
4365
|
+
provider: "openai",
|
|
4366
|
+
baseUrl: "https://api.openai.com/v1",
|
|
4367
|
+
defaultModel: "gpt-5",
|
|
4368
|
+
keyUrl: "https://platform.openai.com/api-keys",
|
|
4369
|
+
keyPrefix: "sk-",
|
|
4370
|
+
models: ["gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-4o", "o4-mini", "o3"]
|
|
4371
|
+
},
|
|
4372
|
+
{
|
|
4373
|
+
id: "deepseek",
|
|
4374
|
+
name: "DeepSeek (\u5B98\u65B9\u76F4\u8FDE)",
|
|
4375
|
+
envKey: "DEEPSEEK_API_KEY",
|
|
4376
|
+
provider: "openai",
|
|
4377
|
+
baseUrl: "https://api.deepseek.com/v1",
|
|
4378
|
+
defaultModel: "deepseek-v4-pro",
|
|
4379
|
+
keyUrl: "https://platform.deepseek.com/api_keys",
|
|
4380
|
+
keyPrefix: "sk-",
|
|
4381
|
+
models: ["deepseek-v4-pro", "deepseek-v4-flash", "deepseek-chat"]
|
|
4382
|
+
},
|
|
4383
|
+
{
|
|
4384
|
+
id: "gemini",
|
|
4385
|
+
name: "Google Gemini (\u5B98\u65B9\u76F4\u8FDE)",
|
|
4386
|
+
envKey: "GEMINI_API_KEY",
|
|
4387
|
+
provider: "openai",
|
|
4388
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
|
|
4389
|
+
defaultModel: "gemini-2.5-pro",
|
|
4390
|
+
keyUrl: "https://aistudio.google.com/apikey",
|
|
4391
|
+
keyPrefix: "",
|
|
4392
|
+
models: [
|
|
4393
|
+
"gemini-2.5-pro",
|
|
4394
|
+
"gemini-2.5-flash",
|
|
4395
|
+
"gemini-2.0-flash"
|
|
4396
|
+
]
|
|
4397
|
+
},
|
|
4398
|
+
{
|
|
4399
|
+
id: "ollama",
|
|
4400
|
+
name: "Ollama (\u672C\u5730\uFF0C\u65E0\u9700 Key)",
|
|
4401
|
+
envKey: "",
|
|
4402
|
+
provider: "openai",
|
|
4403
|
+
baseUrl: "http://localhost:11434/v1",
|
|
4404
|
+
defaultModel: "llama3.1",
|
|
4405
|
+
keyUrl: "https://ollama.com/library",
|
|
4406
|
+
keyPrefix: "",
|
|
4407
|
+
models: ["llama3.1", "qwen2.5-coder", "deepseek-r1", "mistral", "gemma3"],
|
|
4408
|
+
noKey: true
|
|
4409
|
+
},
|
|
4410
|
+
{
|
|
4411
|
+
id: "custom",
|
|
4412
|
+
name: "\u81EA\u5B9A\u4E49 (\u4EFB\u4F55 OpenAI \u517C\u5BB9 API)",
|
|
4413
|
+
envKey: "",
|
|
4414
|
+
provider: "openai",
|
|
4415
|
+
baseUrl: "",
|
|
4416
|
+
defaultModel: "",
|
|
4417
|
+
keyUrl: "",
|
|
4418
|
+
keyPrefix: "",
|
|
4419
|
+
models: []
|
|
4420
|
+
}
|
|
4421
|
+
];
|
|
4422
|
+
var OPENROUTER_VENDORS = [
|
|
4423
|
+
{ prefix: "anthropic/", take: 4 },
|
|
4424
|
+
{ prefix: "openai/", take: 5 },
|
|
4425
|
+
{ prefix: "google/", take: 3 },
|
|
4426
|
+
{ prefix: "deepseek/", take: 3 },
|
|
4427
|
+
{ prefix: "x-ai/", take: 2 },
|
|
4428
|
+
{ prefix: "qwen/", take: 2 },
|
|
4429
|
+
{ prefix: "meta-llama/", take: 2 },
|
|
4430
|
+
{ prefix: "mistralai/", take: 1 }
|
|
4431
|
+
];
|
|
4432
|
+
function buildOpenRouterModelList(fallback) {
|
|
4433
|
+
const all = getOpenRouterModels();
|
|
4434
|
+
if (all.length === 0) return fallback;
|
|
4435
|
+
const skip = /(?:-guard|-embedding|-rerank|-vision-only|:free)/i;
|
|
4436
|
+
const out = [];
|
|
4437
|
+
for (const { prefix, take } of OPENROUTER_VENDORS) {
|
|
4438
|
+
const candidates = all.filter((m) => m.id.startsWith(prefix)).filter((m) => !skip.test(m.id) && !m.id.includes("-preview")).slice(0, take);
|
|
4439
|
+
out.push(...candidates.map((m) => m.id));
|
|
4440
|
+
}
|
|
4441
|
+
return out.length > 0 ? out : fallback;
|
|
4442
|
+
}
|
|
4443
|
+
function resolveProviderModels(provider) {
|
|
4444
|
+
if (provider.id === "openrouter") {
|
|
4445
|
+
return buildOpenRouterModelList(provider.models);
|
|
4446
|
+
}
|
|
4447
|
+
return provider.models;
|
|
4448
|
+
}
|
|
4449
|
+
function detectEnvKeys() {
|
|
4450
|
+
const found = [];
|
|
4451
|
+
for (const p of PROVIDERS) {
|
|
4452
|
+
if (!p.envKey) continue;
|
|
4453
|
+
const v = process.env[p.envKey];
|
|
4454
|
+
if (v && v.trim()) {
|
|
4455
|
+
found.push({ provider: p, envKey: p.envKey, apiKey: v.trim() });
|
|
4456
|
+
}
|
|
4457
|
+
}
|
|
4458
|
+
return found;
|
|
4459
|
+
}
|
|
4460
|
+
function detectProviderFromApiKey(apiKey, baseUrl) {
|
|
4461
|
+
for (const p of PROVIDERS) {
|
|
4462
|
+
if (p.keyPrefix && apiKey.startsWith(p.keyPrefix)) return p;
|
|
4463
|
+
}
|
|
4464
|
+
if (baseUrl) {
|
|
4465
|
+
for (const p of PROVIDERS) {
|
|
4466
|
+
if (p.baseUrl && baseUrl.startsWith(p.baseUrl)) return p;
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
4469
|
+
for (const p of PROVIDERS) {
|
|
4470
|
+
if (!p.envKey) continue;
|
|
4471
|
+
const v = process.env[p.envKey];
|
|
4472
|
+
if (v && v.trim() === apiKey) return p;
|
|
4473
|
+
}
|
|
4474
|
+
return void 0;
|
|
4475
|
+
}
|
|
4476
|
+
function resolveApiKey(optionsApiKey, settingsApiKey) {
|
|
4477
|
+
if (optionsApiKey) return optionsApiKey;
|
|
4478
|
+
if (settingsApiKey) return settingsApiKey;
|
|
4479
|
+
for (const p of PROVIDERS) {
|
|
4480
|
+
if (!p.envKey) continue;
|
|
4481
|
+
const v = process.env[p.envKey];
|
|
4482
|
+
if (v && v.trim()) return v.trim();
|
|
4483
|
+
}
|
|
4484
|
+
return void 0;
|
|
4485
|
+
}
|
|
4486
|
+
var KNOWN_MAX_OUTPUT = {
|
|
4487
|
+
"anthropic/claude-opus-4.7": 32e3,
|
|
4488
|
+
"anthropic/claude-opus-4-7": 32e3,
|
|
4489
|
+
"claude-opus-4-7": 32e3,
|
|
4490
|
+
"anthropic/claude-sonnet-4.6": 16e3,
|
|
4491
|
+
"anthropic/claude-sonnet-4-6": 16e3,
|
|
4492
|
+
"claude-sonnet-4-6": 16e3,
|
|
4493
|
+
"anthropic/claude-haiku-4.5": 8192,
|
|
4494
|
+
"anthropic/claude-haiku-4-5": 8192,
|
|
4495
|
+
"claude-haiku-4-5": 8192,
|
|
4496
|
+
"openai/gpt-5": 32e3,
|
|
4497
|
+
"openai/gpt-5-mini": 32e3,
|
|
4498
|
+
"openai/gpt-5-nano": 16e3,
|
|
4499
|
+
"gpt-5": 32e3,
|
|
4500
|
+
"gpt-5-mini": 32e3,
|
|
4501
|
+
"gpt-5-nano": 16e3,
|
|
4502
|
+
"openai/gpt-4o": 16384,
|
|
4503
|
+
"gpt-4o": 16384,
|
|
4504
|
+
"openai/o4-mini": 1e5,
|
|
4505
|
+
"o4-mini": 1e5,
|
|
4506
|
+
"openai/o3": 1e5,
|
|
4507
|
+
"o3": 1e5,
|
|
4508
|
+
"google/gemini-2.5-pro": 65536,
|
|
4509
|
+
"google/gemini-2.5-flash": 65536,
|
|
4510
|
+
"gemini-2.5-pro": 65536,
|
|
4511
|
+
"gemini-2.5-flash": 65536,
|
|
4512
|
+
"gemini-2.0-flash": 8192,
|
|
4513
|
+
"deepseek/deepseek-v3.2": 8192,
|
|
4514
|
+
"deepseek/deepseek-r1": 8192,
|
|
4515
|
+
"deepseek-v4-flash": 8192,
|
|
4516
|
+
"deepseek-v4-pro": 65536,
|
|
4517
|
+
"deepseek-chat": 8192,
|
|
4518
|
+
"qwen/qwen3-coder": 16384,
|
|
4519
|
+
"meta-llama/llama-4-maverick": 32e3
|
|
4520
|
+
};
|
|
4521
|
+
var KNOWN_CONTEXT_WINDOWS = {
|
|
4522
|
+
"deepseek-v4-pro": 1e6,
|
|
4523
|
+
"deepseek-v4-flash": 1e6,
|
|
4524
|
+
"deepseek-chat": 1e6,
|
|
4525
|
+
"deepseek/deepseek-chat": 1e6,
|
|
4526
|
+
"deepseek/deepseek-v4-pro": 1e6,
|
|
4527
|
+
"deepseek/deepseek-v4-flash": 1e6
|
|
4528
|
+
};
|
|
4529
|
+
function resolveMaxOutput(model) {
|
|
4530
|
+
if (KNOWN_MAX_OUTPUT[model]) return KNOWN_MAX_OUTPUT[model];
|
|
4531
|
+
if (model.includes("/")) {
|
|
4532
|
+
const hit = getOpenRouterModels().find((m) => m.id === model);
|
|
4533
|
+
if (hit && hit.maxOutputTokens > 0) return hit.maxOutputTokens;
|
|
4534
|
+
}
|
|
4535
|
+
return void 0;
|
|
4536
|
+
}
|
|
4537
|
+
function resolveContextWindow(model) {
|
|
4538
|
+
if (KNOWN_CONTEXT_WINDOWS[model]) return KNOWN_CONTEXT_WINDOWS[model];
|
|
4539
|
+
if (model.includes("/")) {
|
|
4540
|
+
const hit = getOpenRouterModels().find((m) => m.id === model);
|
|
4541
|
+
if (hit && hit.contextLength > 0) return hit.contextLength;
|
|
4542
|
+
}
|
|
4543
|
+
return void 0;
|
|
4544
|
+
}
|
|
4545
|
+
function deriveModelPoolKey(providerKind, modelId, used = []) {
|
|
4546
|
+
const slash = modelId.lastIndexOf("/");
|
|
4547
|
+
const base = slash >= 0 ? modelId.slice(slash + 1) : modelId;
|
|
4548
|
+
const prefix = providerKind.toLowerCase();
|
|
4549
|
+
const candidate = base.toLowerCase().startsWith(`${prefix}-`) ? base : `${prefix}-${base}`;
|
|
4550
|
+
const set = new Set(used);
|
|
4551
|
+
if (!set.has(candidate)) return candidate;
|
|
4552
|
+
for (let i = 2; ; i++) {
|
|
4553
|
+
const k = `${candidate}-${i}`;
|
|
4554
|
+
if (!set.has(k)) return k;
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4557
|
+
function buildModelPool(provider, apiKey) {
|
|
4558
|
+
const models = resolveProviderModels(provider);
|
|
4559
|
+
const used = [];
|
|
4560
|
+
return models.map((m) => {
|
|
4561
|
+
const key = deriveModelPoolKey(provider.id, m, used);
|
|
4562
|
+
used.push(key);
|
|
4563
|
+
return {
|
|
4564
|
+
key,
|
|
4565
|
+
label: modelDisplayName(m),
|
|
4566
|
+
provider: provider.provider,
|
|
4567
|
+
model: m,
|
|
4568
|
+
baseUrl: provider.baseUrl,
|
|
4569
|
+
apiKey,
|
|
4570
|
+
maxOutputTokens: resolveMaxOutput(m),
|
|
4571
|
+
maxContextTokens: resolveContextWindow(m)
|
|
4572
|
+
};
|
|
4573
|
+
});
|
|
4574
|
+
}
|
|
4575
|
+
function modelDisplayName(model) {
|
|
4576
|
+
const slash = model.lastIndexOf("/");
|
|
4577
|
+
const base = slash >= 0 ? model.slice(slash + 1) : model;
|
|
4578
|
+
const parts = base.split("-");
|
|
4579
|
+
if (parts[0] === "claude") {
|
|
4580
|
+
const variant = parts[1] ?? "";
|
|
4581
|
+
return `Claude ${variant.charAt(0).toUpperCase() + variant.slice(1)}`;
|
|
4582
|
+
}
|
|
4583
|
+
if (base.startsWith("gpt-")) return `GPT-${parts.slice(1).join("-")}`;
|
|
4584
|
+
if (base.startsWith("gemini-")) return `Gemini ${parts.slice(1).join("-")}`;
|
|
4585
|
+
return base.charAt(0).toUpperCase() + base.slice(1);
|
|
4586
|
+
}
|
|
4587
|
+
function appendOnboardingResult(opts) {
|
|
4588
|
+
const dir = join4(homedir(), ".code-shell");
|
|
4589
|
+
const file = join4(dir, "settings.json");
|
|
4590
|
+
mkdirSync(dir, { recursive: true });
|
|
4591
|
+
let existing = {};
|
|
4592
|
+
if (existsSync4(file)) {
|
|
4593
|
+
try {
|
|
4594
|
+
existing = JSON.parse(readFileSync4(file, "utf-8"));
|
|
4595
|
+
} catch {
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
const existingProviders = Array.isArray(existing.providers) ? existing.providers : [];
|
|
4599
|
+
let providersOut = existingProviders;
|
|
4600
|
+
if (opts.addedProvider) {
|
|
4601
|
+
const has = existingProviders.some((p) => p?.key === opts.addedProvider.key);
|
|
4602
|
+
if (!has) providersOut = [...existingProviders, opts.addedProvider];
|
|
4603
|
+
}
|
|
4604
|
+
const existingModels = Array.isArray(existing.models) ? existing.models : [];
|
|
4605
|
+
const existingKeys = new Set(existingModels.map((m) => m?.key));
|
|
4606
|
+
const modelsToAppend = opts.addedModels.filter((m) => !existingKeys.has(m.key));
|
|
4607
|
+
const updated = {
|
|
4608
|
+
...existing,
|
|
4609
|
+
activeKey: opts.activeKey,
|
|
4610
|
+
model: {
|
|
4611
|
+
...typeof existing.model === "object" && existing.model ? existing.model : {},
|
|
4612
|
+
provider: opts.activeMirror.provider,
|
|
4613
|
+
name: opts.activeMirror.model,
|
|
4614
|
+
apiKey: opts.activeMirror.apiKey,
|
|
4615
|
+
baseUrl: opts.activeMirror.baseUrl
|
|
4616
|
+
},
|
|
4617
|
+
providers: providersOut,
|
|
4618
|
+
models: [...existingModels, ...modelsToAppend]
|
|
4619
|
+
};
|
|
4620
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
4621
|
+
writeFileSync(tmp, JSON.stringify(updated, null, 2) + "\n", "utf-8");
|
|
4622
|
+
try {
|
|
4623
|
+
renameSync(tmp, file);
|
|
4624
|
+
} catch {
|
|
4625
|
+
writeFileSync(file, JSON.stringify(updated, null, 2) + "\n", "utf-8");
|
|
4626
|
+
}
|
|
4627
|
+
}
|
|
4628
|
+
function saveArenaSettingsByKeys(keys) {
|
|
4629
|
+
const dir = join4(homedir(), ".code-shell");
|
|
4630
|
+
const file = join4(dir, "settings.json");
|
|
4631
|
+
let existing = {};
|
|
4632
|
+
if (existsSync4(file)) {
|
|
4633
|
+
try {
|
|
4634
|
+
existing = JSON.parse(readFileSync4(file, "utf-8"));
|
|
4635
|
+
} catch {
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
const updated = {
|
|
4639
|
+
...existing,
|
|
4640
|
+
arena: { participants: keys }
|
|
4641
|
+
};
|
|
4642
|
+
writeFileSync(file, JSON.stringify(updated, null, 2) + "\n", "utf-8");
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4311
4645
|
// src/arena/model-presets.ts
|
|
4312
4646
|
init_esm_shims();
|
|
4313
4647
|
var MODEL_PRESETS = {
|
|
@@ -4332,7 +4666,8 @@ function getMaxOutputTokens(model) {
|
|
|
4332
4666
|
const byKey = MODEL_PRESETS[model];
|
|
4333
4667
|
if (byKey) return byKey.maxOutputTokens;
|
|
4334
4668
|
const byModel = Object.values(MODEL_PRESETS).find((p) => p.model === model);
|
|
4335
|
-
return byModel
|
|
4669
|
+
if (byModel) return byModel.maxOutputTokens;
|
|
4670
|
+
return resolveMaxOutput(model) ?? 8192;
|
|
4336
4671
|
}
|
|
4337
4672
|
|
|
4338
4673
|
// src/arena/render/terminal.ts
|
|
@@ -4777,6 +5112,12 @@ export {
|
|
|
4777
5112
|
buildConsensus,
|
|
4778
5113
|
ArenaLedger,
|
|
4779
5114
|
Arena,
|
|
5115
|
+
detectEnvKeys,
|
|
5116
|
+
detectProviderFromApiKey,
|
|
5117
|
+
resolveApiKey,
|
|
5118
|
+
buildModelPool,
|
|
5119
|
+
appendOnboardingResult,
|
|
5120
|
+
saveArenaSettingsByKeys,
|
|
4780
5121
|
MODEL_PRESETS,
|
|
4781
5122
|
getMaxOutputTokens,
|
|
4782
5123
|
formatArenaResult,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWZJV6DJCcjs = require('./chunk-WZJV6DJC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkIK4EWJBPcjs = require('./chunk-IK4EWJBP.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkKS3RYAYLcjs = require('./chunk-KS3RYAYL.cjs');
|
|
10
10
|
|
|
11
11
|
// src/arena/index.ts
|
|
12
|
-
|
|
12
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
13
13
|
|
|
14
14
|
// src/arena/iterate/index.ts
|
|
15
|
-
|
|
15
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
16
16
|
|
|
17
17
|
// src/arena/iterate/iterative-arena.ts
|
|
18
|
-
|
|
18
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
19
19
|
|
|
20
20
|
// src/arena/iterate/convergence.ts
|
|
21
|
-
|
|
21
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
22
22
|
function diffRatio(a, b) {
|
|
23
23
|
if (a === b) return 0;
|
|
24
24
|
if (!a || !b) return 1;
|
|
@@ -93,7 +93,7 @@ function defaultConvergence(args) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// src/arena/iterate/formats/index.ts
|
|
96
|
-
|
|
96
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
97
97
|
var COMMON_DRAFT_RULES = `
|
|
98
98
|
Hard rules:
|
|
99
99
|
- Output the FULL artifact, not a sketch or outline.
|
|
@@ -368,10 +368,10 @@ function getFormat(format) {
|
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
// src/arena/iterate/phases/argue.ts
|
|
371
|
-
|
|
371
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
372
372
|
|
|
373
373
|
// src/arena/iterate/parse.ts
|
|
374
|
-
|
|
374
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
375
375
|
function extractTag(text, tag) {
|
|
376
376
|
const closed = new RegExp(`<${tag}>([\\s\\S]*?)<\\/${tag}>`, "i");
|
|
377
377
|
const closedMatch = text.match(closed);
|
|
@@ -454,10 +454,10 @@ function parseCritiquesResponse(text, criticName, idPrefix) {
|
|
|
454
454
|
}
|
|
455
455
|
|
|
456
456
|
// src/arena/iterate/tools/web-tools.ts
|
|
457
|
-
|
|
457
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
458
458
|
|
|
459
459
|
// src/tool-system/builtin/web-search.ts
|
|
460
|
-
|
|
460
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
461
461
|
var webSearchToolDef = {
|
|
462
462
|
name: "WebSearch",
|
|
463
463
|
description: "Search the web for information. Returns a list of search results with titles, URLs, and snippets. Use this when you need up-to-date information or facts not in your training data.",
|
|
@@ -553,7 +553,7 @@ async function searchSearXNG(query, num, baseUrl) {
|
|
|
553
553
|
}
|
|
554
554
|
|
|
555
555
|
// src/tool-system/builtin/web-fetch.ts
|
|
556
|
-
|
|
556
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
557
557
|
var webFetchToolDef = {
|
|
558
558
|
name: "WebFetch",
|
|
559
559
|
description: "Fetch a web page and return its text content. Strips HTML tags to return readable text. Use this to read articles, documentation, or any web page.",
|
|
@@ -744,7 +744,7 @@ async function runArgueRound(args) {
|
|
|
744
744
|
const wantWeb = Boolean(enableWebSearch);
|
|
745
745
|
const webAvailable = wantWeb && hasWebSearchProvider();
|
|
746
746
|
if (wantWeb && !webAvailable) {
|
|
747
|
-
|
|
747
|
+
_chunkIK4EWJBPcjs.logger.warn("arena.iterate.argue_web_unavailable", {
|
|
748
748
|
reason: "No SERPER_API_KEY / TAVILY_API_KEY / SEARXNG_URL configured"
|
|
749
749
|
});
|
|
750
750
|
}
|
|
@@ -765,7 +765,7 @@ async function runArgueRound(args) {
|
|
|
765
765
|
}
|
|
766
766
|
return await argueSingleShot({ critic: c, subject, format, draft, idPrefix, signal });
|
|
767
767
|
} catch (err) {
|
|
768
|
-
|
|
768
|
+
_chunkIK4EWJBPcjs.logger.warn("arena.iterate.argue_failed", {
|
|
769
769
|
round,
|
|
770
770
|
critic: c.name,
|
|
771
771
|
error: err.message
|
|
@@ -784,7 +784,7 @@ async function runArgueRound(args) {
|
|
|
784
784
|
}
|
|
785
785
|
async function argueSingleShot(args) {
|
|
786
786
|
const { critic, subject, format, draft, idPrefix, signal } = args;
|
|
787
|
-
const client = await
|
|
787
|
+
const client = await _chunkWZJV6DJCcjs.createLLMClient.call(void 0, { ...critic.llm, enableStreaming: false });
|
|
788
788
|
const resp = await client.createMessage({
|
|
789
789
|
systemPrompt: format.argueSystem(format.format),
|
|
790
790
|
messages: [{ role: "user", content: format.argueUser(subject, draft) }],
|
|
@@ -792,7 +792,7 @@ async function argueSingleShot(args) {
|
|
|
792
792
|
signal
|
|
793
793
|
});
|
|
794
794
|
const critiques = parseCritiquesResponse(resp.text, critic.name, idPrefix);
|
|
795
|
-
|
|
795
|
+
_chunkIK4EWJBPcjs.logger.info("arena.iterate.argue_singleshot", {
|
|
796
796
|
critic: critic.name,
|
|
797
797
|
critiqueCount: critiques.length
|
|
798
798
|
});
|
|
@@ -800,7 +800,7 @@ async function argueSingleShot(args) {
|
|
|
800
800
|
}
|
|
801
801
|
async function argueWithToolLoop(args) {
|
|
802
802
|
const { critic, subject, format, draft, idPrefix, maxToolRounds, signal } = args;
|
|
803
|
-
const client = await
|
|
803
|
+
const client = await _chunkWZJV6DJCcjs.createLLMClient.call(void 0, { ...critic.llm, enableStreaming: false });
|
|
804
804
|
const messages = [
|
|
805
805
|
{ role: "user", content: format.argueUser(subject, draft) }
|
|
806
806
|
];
|
|
@@ -866,7 +866,7 @@ async function argueWithToolLoop(args) {
|
|
|
866
866
|
finalText = resp.text;
|
|
867
867
|
}
|
|
868
868
|
const critiques = parseCritiquesResponse(finalText, critic.name, idPrefix);
|
|
869
|
-
|
|
869
|
+
_chunkIK4EWJBPcjs.logger.info("arena.iterate.argue_toolloop", {
|
|
870
870
|
critic: critic.name,
|
|
871
871
|
critiqueCount: critiques.length,
|
|
872
872
|
toolRounds
|
|
@@ -875,11 +875,11 @@ async function argueWithToolLoop(args) {
|
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
// src/arena/iterate/phases/revise.ts
|
|
878
|
-
|
|
878
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
879
879
|
async function runRevise(args) {
|
|
880
880
|
const { subject, format, previous, critiques, author, minDraftLength, signal, onProgress } = args;
|
|
881
881
|
_optionalChain([onProgress, 'optionalCall', _12 => _12({ type: "revise_start", round: previous.version + 1, participant: author.name })]);
|
|
882
|
-
const client = await
|
|
882
|
+
const client = await _chunkWZJV6DJCcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
|
|
883
883
|
const prompt = format.revisePrompt(subject, previous, critiques, minDraftLength);
|
|
884
884
|
const resp = await client.createMessage({
|
|
885
885
|
systemPrompt: prompt,
|
|
@@ -892,7 +892,7 @@ async function runRevise(args) {
|
|
|
892
892
|
let acceptedContent = content;
|
|
893
893
|
const shrinkage = previous.content.length > 0 ? 1 - acceptedContent.length / previous.content.length : 0;
|
|
894
894
|
if (shrinkage > 0.3 && acceptedContent.length < minDraftLength) {
|
|
895
|
-
|
|
895
|
+
_chunkIK4EWJBPcjs.logger.warn("arena.iterate.revise_too_short", {
|
|
896
896
|
version: previous.version + 1,
|
|
897
897
|
previousLength: previous.content.length,
|
|
898
898
|
newLength: acceptedContent.length,
|
|
@@ -917,7 +917,7 @@ async function runRevise(args) {
|
|
|
917
917
|
participant: author.name,
|
|
918
918
|
data: { length: acceptedContent.length, accepted: _nullishCoalesce(_optionalChain([meta, 'access', _14 => _14.acceptedCritiques, 'optionalAccess', _15 => _15.length]), () => ( 0)) }
|
|
919
919
|
})]);
|
|
920
|
-
|
|
920
|
+
_chunkIK4EWJBPcjs.logger.info("arena.iterate.revise", {
|
|
921
921
|
version: next.version,
|
|
922
922
|
author: author.name,
|
|
923
923
|
length: acceptedContent.length,
|
|
@@ -928,13 +928,13 @@ async function runRevise(args) {
|
|
|
928
928
|
}
|
|
929
929
|
|
|
930
930
|
// src/arena/iterate/phases/tournament.ts
|
|
931
|
-
|
|
931
|
+
_chunkKS3RYAYLcjs.init_cjs_shims.call(void 0, );
|
|
932
932
|
async function runTournamentCandidates(args) {
|
|
933
933
|
const { subject, format, participants, minDraftLength, signal, onProgress } = args;
|
|
934
934
|
_optionalChain([onProgress, 'optionalCall', _20 => _20({ type: "v1_tournament_start", data: { count: participants.length } })]);
|
|
935
935
|
const tasks = participants.map(async (p, idx) => {
|
|
936
936
|
_optionalChain([signal, 'optionalAccess', _21 => _21.throwIfAborted, 'call', _22 => _22()]);
|
|
937
|
-
const client = await
|
|
937
|
+
const client = await _chunkWZJV6DJCcjs.createLLMClient.call(void 0, { ...p.llm, enableStreaming: false });
|
|
938
938
|
const prompt = format.draftPrompt(subject, minDraftLength);
|
|
939
939
|
const resp = await client.createMessage({
|
|
940
940
|
systemPrompt: prompt,
|
|
@@ -955,7 +955,7 @@ async function runTournamentCandidates(args) {
|
|
|
955
955
|
participant: p.name,
|
|
956
956
|
data: { length: content.length, anonymousLabel: candidate.anonymousLabel }
|
|
957
957
|
})]);
|
|
958
|
-
|
|
958
|
+
_chunkIK4EWJBPcjs.logger.info("arena.iterate.v1_candidate", {
|
|
959
959
|
participant: p.name,
|
|
960
960
|
anonymousLabel: candidate.anonymousLabel,
|
|
961
961
|
length: content.length
|
|
@@ -966,7 +966,7 @@ async function runTournamentCandidates(args) {
|
|
|
966
966
|
const candidates = [];
|
|
967
967
|
for (const s of settled) {
|
|
968
968
|
if (s.status === "fulfilled") candidates.push(s.value);
|
|
969
|
-
else
|
|
969
|
+
else _chunkIK4EWJBPcjs.logger.warn("arena.iterate.v1_candidate_failed", { error: _optionalChain([s, 'access', _24 => _24.reason, 'optionalAccess', _25 => _25.message]) });
|
|
970
970
|
}
|
|
971
971
|
if (candidates.length === 0) {
|
|
972
972
|
throw new Error("All v1 tournament candidates failed");
|
|
@@ -982,7 +982,7 @@ async function runTournamentCandidates(args) {
|
|
|
982
982
|
async function mergeCandidatesToV1(args) {
|
|
983
983
|
const { subject, format, author, candidates, minDraftLength, signal, onProgress } = args;
|
|
984
984
|
_optionalChain([onProgress, 'optionalCall', _26 => _26({ type: "v1_merge_start", participant: author.name })]);
|
|
985
|
-
const client = await
|
|
985
|
+
const client = await _chunkWZJV6DJCcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
|
|
986
986
|
const prompt = format.mergePrompt(subject, candidates, minDraftLength);
|
|
987
987
|
const resp = await client.createMessage({
|
|
988
988
|
systemPrompt: prompt,
|
|
@@ -1001,7 +1001,7 @@ async function mergeCandidatesToV1(args) {
|
|
|
1001
1001
|
mergeRationale: rationale
|
|
1002
1002
|
};
|
|
1003
1003
|
_optionalChain([onProgress, 'optionalCall', _27 => _27({ type: "v1_merge_done", participant: author.name, data: { length: content.length } })]);
|
|
1004
|
-
|
|
1004
|
+
_chunkIK4EWJBPcjs.logger.info("arena.iterate.v1_merge", {
|
|
1005
1005
|
author: author.name,
|
|
1006
1006
|
candidateCount: candidates.length,
|
|
1007
1007
|
length: content.length
|
|
@@ -1010,7 +1010,7 @@ async function mergeCandidatesToV1(args) {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
async function singleAuthorV1(args) {
|
|
1012
1012
|
const { subject, format, author, minDraftLength, signal } = args;
|
|
1013
|
-
const client = await
|
|
1013
|
+
const client = await _chunkWZJV6DJCcjs.createLLMClient.call(void 0, { ...author.llm, enableStreaming: false });
|
|
1014
1014
|
const prompt = format.draftPrompt(subject, minDraftLength);
|
|
1015
1015
|
const resp = await client.createMessage({
|
|
1016
1016
|
systemPrompt: prompt,
|
|
@@ -1082,7 +1082,7 @@ var IterativeArena = class {
|
|
|
1082
1082
|
});
|
|
1083
1083
|
}
|
|
1084
1084
|
} catch (err) {
|
|
1085
|
-
|
|
1085
|
+
_chunkIK4EWJBPcjs.logger.error("arena.iterate.v1_failed", { error: err.message });
|
|
1086
1086
|
throw err;
|
|
1087
1087
|
}
|
|
1088
1088
|
let currentAuthor = config.author;
|
|
@@ -1228,7 +1228,7 @@ var IterativeArena = class {
|
|
|
1228
1228
|
finalLength: finalDraft.content.length
|
|
1229
1229
|
}
|
|
1230
1230
|
})]);
|
|
1231
|
-
|
|
1231
|
+
_chunkIK4EWJBPcjs.logger.info("arena.iterate.complete", {
|
|
1232
1232
|
stoppedAt,
|
|
1233
1233
|
rounds: rounds.length,
|
|
1234
1234
|
finalVersion: finalDraft.version,
|