larkin 0.2.89 → 0.2.91
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/setup/bot-register.mjs +11 -3
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ import { managedLarkCliEnv } from "../app/agent-lark-cli-workspace.mjs";
|
|
|
14
14
|
import { resolveOfficialLarkCli } from "../app/official-lark-cli.mjs";
|
|
15
15
|
import { collectSetupAgentChoice, recoverUnavailableExternalPi, terminalSetupQuestioner } from "./setup-agent-choice.mjs";
|
|
16
16
|
import { probeNativeRuntimeReadiness } from "../runtime/runtime-readiness.mjs";
|
|
17
|
-
import { configureBuiltinPiProviderModel, stageBuiltinPiProvider, validatePiBaseUrl, listProviderModels, PI_PROVIDER_PRESETS } from "../runtime/pi-provider-config.mjs";
|
|
17
|
+
import { configureBuiltinPiProviderModel, stageBuiltinPiProvider, validatePiBaseUrl, validateBuiltinPiProviderSelection, listProviderModels, PI_PROVIDER_PRESETS } from "../runtime/pi-provider-config.mjs";
|
|
18
18
|
import { beginBuiltinPiCredentialTransaction, createOfficialPiCredentialRuntime, createOfficialPiAuthInteraction, createOfficialPiModelRuntime, createOfficialPiLogoutRuntime, createOfficialPiRegistryRuntime, listOfficialPiAuthProviders, logoutOfficialPiProvider, officialPiAuthStatus, runOfficialPiLogin, verifyOfficialPiProviderTurn, } from "../runtime/pi-official-auth.mjs";
|
|
19
19
|
import { documentCommentSubscriptionCapability, markDocumentCommentSubscriptionVerified, } from "../platform/callback-capability.mjs";
|
|
20
20
|
// qrcode-terminal does not publish TypeScript declarations.
|
|
@@ -600,7 +600,11 @@ export async function main() {
|
|
|
600
600
|
}
|
|
601
601
|
if (!setupApiKey)
|
|
602
602
|
throw new Error("builtin-pi 需要 --api-key;或改用 --runtime external-pi 使用已有 pi 登录");
|
|
603
|
-
|
|
603
|
+
// 自定义网关(--base-url)走 custom 预设:pi 会把 baseUrl 作为 provider 端点写入配置,
|
|
604
|
+
// 而不是用预设厂商目录(否则会打到预设默认地址,如 api.openai.com)。
|
|
605
|
+
const presetId = setupBaseUrl ? "custom" : (setupProvider ?? "custom");
|
|
606
|
+
if (presetId === "custom" && !setupModel)
|
|
607
|
+
throw new Error("custom base-url 需要 --model <模型名>");
|
|
604
608
|
const presetDef = PI_PROVIDER_PRESETS.find((p) => p.id === presetId);
|
|
605
609
|
if (!presetDef && !setupBaseUrl)
|
|
606
610
|
throw new Error(`未知 provider \`${presetId}\`;可选:${PI_PROVIDER_PRESETS.map((p) => p.id).join(" | ")} | custom`);
|
|
@@ -627,8 +631,12 @@ export async function main() {
|
|
|
627
631
|
}
|
|
628
632
|
}
|
|
629
633
|
stageBuiltinPiProvider(CFG_DIR, id, { ...raw, apiKey: setupApiKey });
|
|
634
|
+
// 选择文件写入解析后的全称模型(custom 预设为 larkin-custom/<model>):
|
|
635
|
+
// pi 运行时按 provider 前缀解析凭证,裸模型名会回落到默认 provider(deepseek)
|
|
636
|
+
// 导致「No API key found for deepseek」。
|
|
637
|
+
const validated = validateBuiltinPiProviderSelection({ ...raw, apiKey: setupApiKey });
|
|
630
638
|
temporaryAgentChoiceFile = path.join(CFG_DIR, `.setup-agent-choice-${process.pid}-${Date.now()}.json`);
|
|
631
|
-
fs.writeFileSync(temporaryAgentChoiceFile, `${JSON.stringify({ ...raw, runtime: "pi", authCompleted: true, readinessCompleted: true })}\n`, { mode: 0o600, flag: "wx" });
|
|
639
|
+
fs.writeFileSync(temporaryAgentChoiceFile, `${JSON.stringify({ ...raw, runtime: "pi", model: validated.model, authCompleted: true, readinessCompleted: true })}\n`, { mode: 0o600, flag: "wx" });
|
|
632
640
|
say(`[setup 2/5] ✓ 内置 Pi provider 已配置(${presetId}${setupBaseUrl ? " / custom" : ""})`);
|
|
633
641
|
}
|
|
634
642
|
else if (piDistributionFlag === "external" && (setupProvider || setupApiKey || setupBaseUrl)) {
|