@yitom/acp-client 0.1.12 → 0.1.13

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 CHANGED
@@ -142,8 +142,8 @@ var BUILTIN_ACP_RUNTIMES = [
142
142
  {
143
143
  id: "deepseek",
144
144
  name: "DeepSeek",
145
- description: "通过 bunx 启动 @deepseek-ai/dsh(--profile acp);无 ACP 登录,靠 harness 自身凭证(DEEPSEEK_API_KEY / harness 配置);模型经 session 到达,无需额外动作",
146
- authHint: "无 ACP 登录,靠 harness 自身凭证(DEEPSEEK_API_KEY / harness 配置);未配置先导出 DEEPSEEK_API_KEY;模型经 session 到达,无需额外动作;若官方最新 dsh 存在坏依赖(如 rc.3 缺失),可设 DSH_PACKAGE pin 旧版",
145
+ description: "通过 dsh 启动 @deepseek-ai/dsh(--profile acp);无 ACP 登录,靠 harness 自身凭证(DEEPSEEK_API_KEY 或 $DSH_HOME/.credentials.yaml);模型经 session 到达(V4.1-Flash 的 id 是 deepseek-flash)",
146
+ authHint: "无 ACP 登录,靠 harness 自身凭证;先导出 DEEPSEEK_API_KEY 或在 dsh 里完成登录;稳定安装可设 DSH_BIN 指向 dsh 入口(bunx 临时目录被清理会让 profile 断链);pin 包版本用 DSH_PACKAGE(如 @deepseek-ai/dsh@0.2.1-rc.2)",
147
147
  command: "bunx",
148
148
  args: ["-y", `${DEEPSEEK_DSH_NPM_PACKAGE}@latest`, "--profile", "acp"],
149
149
  requiredEnvKeys: ["DEEPSEEK_API_KEY"]
@@ -162,7 +162,7 @@ function findBuiltinAcpRuntime(id) {
162
162
  return BUILTIN_ACP_RUNTIMES.find((item) => item.id === id);
163
163
  }
164
164
  // src/version.ts
165
- var ACP_CLIENT_VERSION = "0.1.12";
165
+ var ACP_CLIENT_VERSION = "0.1.13";
166
166
  // src/client/sdk-client.ts
167
167
  import { PassThrough, Readable, Writable } from "node:stream";
168
168
  import {
@@ -679,11 +679,24 @@ function parseRateLimitsFromStatusText(text, runtimeId = "unknown") {
679
679
  class QuotaCache {
680
680
  bySession = new Map;
681
681
  byRuntime = new Map;
682
+ usageBySession = new Map;
683
+ usageByRuntime = new Map;
682
684
  observe(params, defaultRuntimeId = "unknown") {
683
685
  if (!params || typeof params !== "object")
684
686
  return null;
685
687
  const p = params;
686
688
  const sessionId = typeof p.sessionId === "string" ? p.sessionId : undefined;
689
+ if (p.update?.sessionUpdate === "usage_update") {
690
+ const used = Number(p.update.used);
691
+ const size = Number(p.update.size);
692
+ if (Number.isFinite(used) && Number.isFinite(size) && size > 0) {
693
+ const usage = { used, size, updatedAt: Date.now() };
694
+ if (sessionId)
695
+ this.usageBySession.set(sessionId, usage);
696
+ this.usageByRuntime.set(defaultRuntimeId, usage);
697
+ }
698
+ return null;
699
+ }
687
700
  let textToParse = "";
688
701
  if (p.update?.content && p.update.content.type === "text" && typeof p.update.content.text === "string") {
689
702
  textToParse = p.update.content.text;
@@ -719,9 +732,29 @@ class QuotaCache {
719
732
  }
720
733
  return;
721
734
  }
735
+ applyContextUsage(quota, sessionId, runtimeId = "unknown") {
736
+ const usage = (sessionId ? this.usageBySession.get(sessionId) : undefined) ?? this.usageByRuntime.get(runtimeId);
737
+ if (!usage)
738
+ return quota ?? null;
739
+ const usedPercent = usage.size > 0 ? Math.min(100, Math.round(usage.used / usage.size * 100)) : 0;
740
+ const window = {
741
+ label: "Context",
742
+ used: usage.used,
743
+ total: usage.size,
744
+ usedPercent,
745
+ percentLeft: Math.max(0, 100 - usedPercent)
746
+ };
747
+ if (!quota) {
748
+ return { runtimeId, primaryWindow: window, status: "ok", updatedAt: usage.updatedAt };
749
+ }
750
+ const rest = (quota.extraWindows ?? []).filter((item) => item.label !== "Context");
751
+ return { ...quota, extraWindows: [window, ...rest] };
752
+ }
722
753
  clear() {
723
754
  this.bySession.clear();
724
755
  this.byRuntime.clear();
756
+ this.usageBySession.clear();
757
+ this.usageByRuntime.clear();
725
758
  }
726
759
  }
727
760
 
@@ -2295,14 +2328,383 @@ function getCursorCatalogIds(execFile, overrides) {
2295
2328
  }
2296
2329
  }
2297
2330
 
2331
+ // src/runtimes/deepseek/index.ts
2332
+ import { existsSync as existsSync15, readFileSync as readFileSync10 } from "node:fs";
2333
+
2334
+ // src/runtimes/deepseek/deepseek-provider.ts
2335
+ import { existsSync as existsSync13, mkdirSync, readFileSync as readFileSync8, rmSync, writeFileSync } from "node:fs";
2336
+ import { homedir as homedir11 } from "node:os";
2337
+ import { dirname as dirname4, join as join16 } from "node:path";
2338
+ var DEEPSEEK_OFFICIAL_BASE_URL = "https://api.deepseek.com/anthropic";
2339
+ function resolveDshHome(env = process.env) {
2340
+ const override = env.DSH_HOME?.trim();
2341
+ return override || join16(homedir11(), ".dsh");
2342
+ }
2343
+ function resolveDshCredentialsFile(env = process.env) {
2344
+ return join16(resolveDshHome(env), ".credentials.yaml");
2345
+ }
2346
+ function escapeRegExp(value) {
2347
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2348
+ }
2349
+ function readHarnessCredential(name, env = process.env) {
2350
+ try {
2351
+ const text = readFileSync8(resolveDshCredentialsFile(env), "utf8");
2352
+ const pattern = new RegExp(`^\\s+${escapeRegExp(name)}\\s*:\\s*(.+)$`);
2353
+ let inRefs = false;
2354
+ for (const line of text.split(/\r?\n/)) {
2355
+ if (/^refs\s*:/.test(line)) {
2356
+ inRefs = true;
2357
+ continue;
2358
+ }
2359
+ if (!inRefs)
2360
+ continue;
2361
+ if (/^\S/.test(line))
2362
+ break;
2363
+ const match = pattern.exec(line);
2364
+ if (match) {
2365
+ const value = match[1].trim().replace(/^['"]|['"]$/g, "");
2366
+ return value || null;
2367
+ }
2368
+ }
2369
+ return null;
2370
+ } catch {
2371
+ return null;
2372
+ }
2373
+ }
2374
+ function normalizeDeepseekBaseUrl(raw) {
2375
+ const trimmed = (raw ?? "").trim();
2376
+ if (!trimmed)
2377
+ return DEEPSEEK_OFFICIAL_BASE_URL;
2378
+ const withoutSlash = trimmed.replace(/\/+$/, "");
2379
+ try {
2380
+ const url = new URL(withoutSlash);
2381
+ if (url.host.toLowerCase() === "api.deepseek.com" && (url.pathname === "" || url.pathname === "/")) {
2382
+ return DEEPSEEK_OFFICIAL_BASE_URL;
2383
+ }
2384
+ return withoutSlash;
2385
+ } catch {
2386
+ return withoutSlash;
2387
+ }
2388
+ }
2389
+ function providerFilePath2(dir) {
2390
+ return join16(dir, "agent", "deepseek-provider.json");
2391
+ }
2392
+ function readStoredDeepseekProvider(dir = getDefaultAgentDataDir()) {
2393
+ const file = providerFilePath2(dir);
2394
+ if (!existsSync13(file))
2395
+ return null;
2396
+ try {
2397
+ const raw = JSON.parse(readFileSync8(file, "utf8"));
2398
+ if (typeof raw.baseUrl !== "string" || typeof raw.apiKey !== "string" || !raw.apiKey.trim()) {
2399
+ return null;
2400
+ }
2401
+ return { baseUrl: normalizeDeepseekBaseUrl(raw.baseUrl), apiKey: raw.apiKey };
2402
+ } catch {
2403
+ return null;
2404
+ }
2405
+ }
2406
+ function getDeepseekProviderStatus(dir = getDefaultAgentDataDir()) {
2407
+ const stored = readStoredDeepseekProvider(dir);
2408
+ if (!stored)
2409
+ return { configured: false, isOfficial: true, hasApiKey: false };
2410
+ return {
2411
+ configured: true,
2412
+ baseUrl: stored.baseUrl,
2413
+ isOfficial: stored.baseUrl === DEEPSEEK_OFFICIAL_BASE_URL,
2414
+ hasApiKey: Boolean(stored.apiKey)
2415
+ };
2416
+ }
2417
+ function validateBaseUrl(baseUrl) {
2418
+ try {
2419
+ const url = new URL(baseUrl);
2420
+ if (url.protocol !== "http:" && url.protocol !== "https:")
2421
+ return "URL 必须是 http(s) 地址";
2422
+ if (!url.hostname)
2423
+ return "URL 缺少主机名";
2424
+ return null;
2425
+ } catch {
2426
+ return "URL 不是合法地址";
2427
+ }
2428
+ }
2429
+ function saveDeepseekProvider(payload, dir = getDefaultAgentDataDir()) {
2430
+ const baseUrl = normalizeDeepseekBaseUrl(payload.baseUrl);
2431
+ const invalid = validateBaseUrl(baseUrl);
2432
+ if (invalid)
2433
+ return err({ code: "INVALID_ARGUMENT", message: invalid });
2434
+ const apiKey = payload.apiKey?.trim() || readStoredDeepseekProvider(dir)?.apiKey || "";
2435
+ if (!apiKey)
2436
+ return err({ code: "INVALID_ARGUMENT", message: "Token/API Key 不能为空" });
2437
+ const file = providerFilePath2(dir);
2438
+ try {
2439
+ mkdirSync(dirname4(file), { recursive: true });
2440
+ writeFileSync(file, JSON.stringify({ baseUrl, apiKey }, null, 2), "utf8");
2441
+ } catch (error) {
2442
+ return err({
2443
+ code: "FILE_WRITE_ERROR",
2444
+ message: error instanceof Error ? error.message : "写入 DeepSeek 配置失败"
2445
+ });
2446
+ }
2447
+ return ok(getDeepseekProviderStatus(dir));
2448
+ }
2449
+ function clearDeepseekProvider(dir = getDefaultAgentDataDir()) {
2450
+ try {
2451
+ rmSync(providerFilePath2(dir), { force: true });
2452
+ return ok(undefined);
2453
+ } catch (error) {
2454
+ return err({
2455
+ code: "FILE_WRITE_ERROR",
2456
+ message: error instanceof Error ? error.message : "删除 DeepSeek 配置失败"
2457
+ });
2458
+ }
2459
+ }
2460
+ function buildDeepseekProviderEnv(stored, currentEnv = process.env) {
2461
+ if (!stored)
2462
+ return {};
2463
+ const env = {};
2464
+ if (!currentEnv.DEEPSEEK_BASE_URL?.trim())
2465
+ env.DEEPSEEK_BASE_URL = stored.baseUrl;
2466
+ if (!currentEnv.DEEPSEEK_API_KEY?.trim())
2467
+ env.DEEPSEEK_API_KEY = stored.apiKey;
2468
+ return env;
2469
+ }
2470
+
2471
+ // src/runtimes/deepseek/dsh-acp-bootstrap.ts
2472
+ import { existsSync as existsSync14, mkdirSync as mkdirSync2, readFileSync as readFileSync9, readdirSync as readdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
2473
+ import { homedir as homedir12, tmpdir as tmpdir2 } from "node:os";
2474
+ import { join as join17 } from "node:path";
2475
+ var DSH_ACP_PINNED_VERSION = "0.2.1-rc.2";
2476
+ var DSH_ACP_DEFAULT_MODEL = "deepseek-flash";
2477
+ var DSH_ACP_DEFAULT_PROVIDER = "deepseek-official";
2478
+ function resolveDshRuntimeRoot(env = process.env) {
2479
+ const override = env.DSH_RUNTIME_DIR?.trim();
2480
+ if (override)
2481
+ return override;
2482
+ if (process.platform === "win32") {
2483
+ const localAppData = env.LOCALAPPDATA?.trim() || join17(homedir12(), "AppData", "Local");
2484
+ return join17(localAppData, "acp-dsh");
2485
+ }
2486
+ if (process.platform === "darwin") {
2487
+ return join17(homedir12(), "Library", "Application Support", "acp-dsh");
2488
+ }
2489
+ const dataHome = env.XDG_DATA_HOME?.trim() || join17(homedir12(), ".local", "share");
2490
+ return join17(dataHome, "acp-dsh");
2491
+ }
2492
+ function resolveManagedDshEntry(env = process.env, version = resolveManagedDshVersion(env)) {
2493
+ return join17(resolveDshRuntimeRoot(env), version, "node_modules", "@deepseek-ai", "dsh", "lib", "bin.js");
2494
+ }
2495
+ function parseVersion(value) {
2496
+ const match = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(value);
2497
+ if (!match)
2498
+ return null;
2499
+ return {
2500
+ nums: [Number(match[1]), Number(match[2]), Number(match[3])],
2501
+ pre: match[4] ? match[4].split(".") : []
2502
+ };
2503
+ }
2504
+ function compareDshVersions(a, b) {
2505
+ const left = parseVersion(a);
2506
+ const right = parseVersion(b);
2507
+ if (!left || !right)
2508
+ return a.localeCompare(b);
2509
+ for (let i = 0;i < 3; i += 1) {
2510
+ if (left.nums[i] !== right.nums[i])
2511
+ return left.nums[i] - right.nums[i];
2512
+ }
2513
+ if (left.pre.length === 0 && right.pre.length > 0)
2514
+ return 1;
2515
+ if (left.pre.length > 0 && right.pre.length === 0)
2516
+ return -1;
2517
+ for (let i = 0;i < Math.max(left.pre.length, right.pre.length); i += 1) {
2518
+ const x = left.pre[i];
2519
+ const y = right.pre[i];
2520
+ if (x === undefined)
2521
+ return -1;
2522
+ if (y === undefined)
2523
+ return 1;
2524
+ const nx = Number(x);
2525
+ const ny = Number(y);
2526
+ if (!Number.isNaN(nx) && !Number.isNaN(ny) && nx !== ny)
2527
+ return nx - ny;
2528
+ if (x !== y)
2529
+ return x < y ? -1 : 1;
2530
+ }
2531
+ return 0;
2532
+ }
2533
+ function hasManagedEntry(root, version) {
2534
+ return existsSync14(join17(root, version, "node_modules", "@deepseek-ai", "dsh", "lib", "bin.js"));
2535
+ }
2536
+ function resolveManagedDshVersion(env = process.env) {
2537
+ const explicit = env.DSH_RUNTIME_VERSION?.trim();
2538
+ if (explicit)
2539
+ return explicit;
2540
+ const root = resolveDshRuntimeRoot(env);
2541
+ let best = null;
2542
+ try {
2543
+ for (const name of readdirSync2(root)) {
2544
+ if (!parseVersion(name))
2545
+ continue;
2546
+ if (!hasManagedEntry(root, name))
2547
+ continue;
2548
+ if (best === null || compareDshVersions(name, best) > 0)
2549
+ best = name;
2550
+ }
2551
+ } catch {}
2552
+ return best ?? DSH_ACP_PINNED_VERSION;
2553
+ }
2554
+ function hasManagedDshRuntime(env = process.env) {
2555
+ return existsSync14(resolveManagedDshEntry(env));
2556
+ }
2557
+ function safeId(raw, fallback) {
2558
+ const value = raw?.trim();
2559
+ return value && /^[A-Za-z0-9._-]+$/.test(value) ? value : fallback;
2560
+ }
2561
+ function resolveAcpModelOverride(env = process.env) {
2562
+ const flag = env.DSH_ACP_MODEL_PATCH?.trim().toLowerCase();
2563
+ if (flag === "off" || flag === "0" || flag === "false" || flag === "none")
2564
+ return null;
2565
+ return {
2566
+ provider: safeId(env.DSH_PROVIDER, DSH_ACP_DEFAULT_PROVIDER),
2567
+ model: safeId(env.DSH_MODEL, DSH_ACP_DEFAULT_MODEL)
2568
+ };
2569
+ }
2570
+ function buildAcpModelPatch(override) {
2571
+ return [
2572
+ "# 由 @yitom/acp-client 生成:修正 ACP 会话默认模型。",
2573
+ "# dsh-acp-app 自带补丁把 model 写死为 deepseek-v4-flash,该 id 不在 provider catalog 中;",
2574
+ "# V4.1-Flash 的 catalog id 是 deepseek-flash(桌面端 1017 只是 UI 徽标)。",
2575
+ "- id: acp",
2576
+ " name: '@deepseek-ai/dsh-acp'",
2577
+ " config:",
2578
+ ` provider: ${override.provider}`,
2579
+ ` model: ${override.model}`,
2580
+ ""
2581
+ ].join(`
2582
+ `);
2583
+ }
2584
+ var patchFileCache = new Map;
2585
+ function ensureAcpModelPatchFile(env = process.env) {
2586
+ const override = resolveAcpModelOverride(env);
2587
+ if (!override)
2588
+ return null;
2589
+ const key = `${override.provider}/${override.model}`;
2590
+ const cached = patchFileCache.get(key);
2591
+ if (cached !== undefined)
2592
+ return cached;
2593
+ try {
2594
+ const dir = join17(tmpdir2(), "acp-dsh-runtime");
2595
+ mkdirSync2(dir, { recursive: true });
2596
+ const file = join17(dir, `acp-model-${override.provider}--${override.model}.patch.yml`);
2597
+ const body = buildAcpModelPatch(override);
2598
+ if (!existsSync14(file) || readFileSync9(file, "utf8") !== body) {
2599
+ writeFileSync2(file, body, "utf8");
2600
+ }
2601
+ patchFileCache.set(key, file);
2602
+ return file;
2603
+ } catch {
2604
+ patchFileCache.set(key, null);
2605
+ return null;
2606
+ }
2607
+ }
2608
+ function resetAcpModelPatchCache() {
2609
+ patchFileCache.clear();
2610
+ }
2611
+
2612
+ // src/runtimes/deepseek/quota.ts
2613
+ var DEFAULT_TIMEOUT_MS = 4000;
2614
+ function resolveDeepseekQuotaKey(options = {}) {
2615
+ const env = options.env ?? process.env;
2616
+ const envKey = env.DEEPSEEK_API_KEY?.trim();
2617
+ if (envKey)
2618
+ return envKey;
2619
+ if (options.dataDir) {
2620
+ const stored = readStoredDeepseekProvider(options.dataDir);
2621
+ if (stored?.apiKey)
2622
+ return stored.apiKey;
2623
+ }
2624
+ return readHarnessCredential("DEEPSEEK_API_KEY", env);
2625
+ }
2626
+ function resolveDeepseekApiBase(options = {}) {
2627
+ const env = options.env ?? process.env;
2628
+ const raw = env.DEEPSEEK_BASE_URL?.trim() || (options.dataDir ? readStoredDeepseekProvider(options.dataDir)?.baseUrl : undefined) || DEEPSEEK_OFFICIAL_BASE_URL;
2629
+ const trimmed = raw.replace(/\/+$/, "").replace(/\/anthropic$/i, "");
2630
+ return trimmed || "https://api.deepseek.com";
2631
+ }
2632
+ function unauthorized(runtimeId, message) {
2633
+ return { runtimeId, provider: "DeepSeek", status: "unauthorized", message, updatedAt: Date.now() };
2634
+ }
2635
+ async function probeDeepseekQuota(options = {}) {
2636
+ const runtimeId = options.runtimeId ?? "deepseek";
2637
+ const apiKey = resolveDeepseekQuotaKey(options);
2638
+ if (!apiKey) {
2639
+ return unauthorized(runtimeId, "未配置 DEEPSEEK_API_KEY / 表单 Token,无法查询余额");
2640
+ }
2641
+ const doFetch = options.fetchImpl ?? fetch;
2642
+ try {
2643
+ const response = await doFetch(`${resolveDeepseekApiBase(options)}/user/balance`, {
2644
+ headers: { Authorization: `Bearer ${apiKey}`, Accept: "application/json" },
2645
+ signal: AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS)
2646
+ });
2647
+ if (response.status === 401 || response.status === 403) {
2648
+ return unauthorized(runtimeId, `余额查询被拒绝 (HTTP ${response.status})`);
2649
+ }
2650
+ if (!response.ok)
2651
+ return null;
2652
+ const data = await response.json();
2653
+ const infos = Array.isArray(data.balance_infos) ? data.balance_infos : [];
2654
+ const first = infos[0];
2655
+ const total = first ? Number(first.total_balance) : Number.NaN;
2656
+ const credits = first ? {
2657
+ balance: Number.isFinite(total) ? total : first.total_balance ?? "0",
2658
+ currency: first.currency
2659
+ } : undefined;
2660
+ const balanceText = infos.map((info) => `${info.total_balance ?? "0"} ${info.currency ?? ""}`.trim()).join(" / ");
2661
+ return {
2662
+ runtimeId,
2663
+ provider: "DeepSeek",
2664
+ account: { type: "apiKey", plan: "DeepSeek API" },
2665
+ credits,
2666
+ status: data.is_available === false ? "exhausted" : "ok",
2667
+ message: data.is_available === false ? "账户余额不足,API 暂不可用" : `可用余额 ${balanceText || "未知"}`,
2668
+ rawText: JSON.stringify(data),
2669
+ updatedAt: Date.now()
2670
+ };
2671
+ } catch {
2672
+ return null;
2673
+ }
2674
+ }
2675
+
2298
2676
  // src/runtimes/deepseek/index.ts
2299
2677
  function buildDeepseekMissingKeyMessage() {
2300
- return "未检测到 DEEPSEEK_API_KEY:请先在终端导出该变量(或完成 harness 自身登录)后再连接";
2678
+ return "未检测到 DEEPSEEK_API_KEY,也未在 harness 凭证库中找到登录记录:请先在终端导出该变量,或先在该 harness(dsh)里完成登录后再连接";
2679
+ }
2680
+ function hasDshCredentials(env) {
2681
+ try {
2682
+ const text = readFileSync10(resolveDshCredentialsFile(env), "utf8");
2683
+ const match = /^records\s*:(.*)$/m.exec(text);
2684
+ if (!match)
2685
+ return false;
2686
+ if (/^\s*(\[\]|\{\}|null|~)\s*$/.test(match[1]))
2687
+ return false;
2688
+ for (const line of text.slice(match.index + match[0].length).split(/\r?\n/)) {
2689
+ if (!line.trim() || line.trim().startsWith("#"))
2690
+ continue;
2691
+ if (/^\s+\S/.test(line))
2692
+ return true;
2693
+ return false;
2694
+ }
2695
+ return false;
2696
+ } catch {
2697
+ return false;
2698
+ }
2301
2699
  }
2302
- function resolveDeepseekSpawnBlocker(env) {
2700
+ function resolveDeepseekSpawnBlocker(env, dataDir) {
2303
2701
  const source = env ?? process.env;
2304
2702
  if (source.DEEPSEEK_API_KEY?.trim())
2305
2703
  return null;
2704
+ if (dataDir && readStoredDeepseekProvider(dataDir))
2705
+ return null;
2706
+ if (hasDshCredentials(source))
2707
+ return null;
2306
2708
  return buildDeepseekMissingKeyMessage();
2307
2709
  }
2308
2710
  function resolveDeepseekPackage(env) {
@@ -2318,39 +2720,86 @@ function resolveDeepseekPackage(env) {
2318
2720
  }
2319
2721
  return raw;
2320
2722
  }
2723
+ var UNSAFE_BIN = /[\u0000-\u001f;&|$()`"'<>*?~#!]/;
2724
+ function resolveDeepseekBin(env) {
2725
+ const raw = (env ?? process.env).DSH_BIN?.trim();
2726
+ if (!raw)
2727
+ return null;
2728
+ if (UNSAFE_BIN.test(raw)) {
2729
+ if (true) {
2730
+ console.warn(`[acp:deepseek] 非法 DSH_BIN 回落包解析: ${raw}`);
2731
+ }
2732
+ return null;
2733
+ }
2734
+ return raw;
2735
+ }
2321
2736
  function resolveDeepseekSpawnCommand(env) {
2322
- const pkg = resolveDeepseekPackage(env);
2737
+ const source = env ?? process.env;
2738
+ const patchFile = ensureAcpModelPatchFile(source);
2739
+ const withPatch = (args) => patchFile ? [...args, "--patch", patchFile] : args;
2740
+ const bin = resolveDeepseekBin(source);
2741
+ if (bin) {
2742
+ const args = ["--profile", "acp"];
2743
+ if (/\.(c|m)?js$/i.test(bin))
2744
+ return { command: process.execPath, args: withPatch([bin, ...args]) };
2745
+ const looksAbsolute = /^([A-Za-z]:[\\/]|\\\\|\/)/.test(bin);
2746
+ if (/\.(cmd|bat)$/i.test(bin) && /\s/.test(bin)) {
2747
+ if (true) {
2748
+ console.warn(`[acp:deepseek] DSH_BIN 为含空格的批处理,回落包解析: ${bin}`);
2749
+ }
2750
+ } else if (!looksAbsolute || existsSync15(bin)) {
2751
+ return { command: bin, args: withPatch(args) };
2752
+ } else if (true) {
2753
+ console.warn(`[acp:deepseek] DSH_BIN 不存在,回落包解析: ${bin}`);
2754
+ }
2755
+ }
2756
+ if (hasManagedDshRuntime(source)) {
2757
+ const entry = resolveManagedDshEntry(source);
2758
+ return { command: process.execPath, args: withPatch([entry, "--profile", "acp"]) };
2759
+ }
2760
+ const pkg = resolveDeepseekPackage(source);
2323
2761
  const spec = pkg === DEEPSEEK_DSH_NPM_PACKAGE ? `${pkg}@latest` : pkg;
2324
- return { command: "bunx", args: ["-y", spec, "--profile", "acp"] };
2762
+ return { command: "bunx", args: withPatch(["-y", spec, "--profile", "acp"]) };
2325
2763
  }
2326
- function probeDeepseekAuth() {
2327
- const hasApiKeyEnv = Boolean(process.env.DEEPSEEK_API_KEY?.trim());
2764
+ function probeDeepseekAuth(env, dataDir) {
2765
+ const source = env ?? process.env;
2766
+ const hasApiKeyEnv = Boolean(source.DEEPSEEK_API_KEY?.trim());
2767
+ const dshHome = resolveDshHome(source);
2768
+ const hasCredentialsFile = existsSync15(resolveDshCredentialsFile(source));
2769
+ const hasCredentialRecords = hasDshCredentials(source);
2770
+ const hasStoredProvider = Boolean(dataDir && readStoredDeepseekProvider(dataDir));
2328
2771
  return {
2329
- codexHome: "",
2330
- hasCodexHome: false,
2331
- hasAuthFile: false,
2332
- hasApiKeyEnv,
2333
- looksLoggedIn: hasApiKeyEnv
2772
+ codexHome: dshHome,
2773
+ hasCodexHome: existsSync15(dshHome),
2774
+ hasAuthFile: hasCredentialsFile,
2775
+ hasApiKeyEnv: hasApiKeyEnv || hasStoredProvider,
2776
+ looksLoggedIn: hasApiKeyEnv || hasStoredProvider || hasCredentialRecords
2334
2777
  };
2335
2778
  }
2336
2779
  var deepseekAdapter = {
2337
2780
  id: "deepseek",
2338
2781
  prepareAppResources: async ({ directory }) => prepareCompatibilityResources(directory, "native-config-entry-not-verified"),
2339
- probeAuth: () => probeDeepseekAuth(),
2782
+ probeAuth: (context) => probeDeepseekAuth(context?.env, context?.dataDir),
2340
2783
  resolveSpawnCommand: () => resolveDeepseekSpawnCommand(),
2341
- resolveSpawnBlocker: () => resolveDeepseekSpawnBlocker(),
2784
+ resolveSpawnBlocker: (context) => resolveDeepseekSpawnBlocker(context?.env, context?.dataDir),
2785
+ getProviderEnv: ({ dataDir, env }) => buildDeepseekProviderEnv(readStoredDeepseekProvider(dataDir), env),
2786
+ probeQuota: (options) => probeDeepseekQuota({
2787
+ runtimeId: "deepseek",
2788
+ dataDir: options?.dataDir,
2789
+ env: options?.env
2790
+ }),
2342
2791
  orderAuthMethods: (methods) => methods,
2343
2792
  canSkipInteractiveAuth: () => false
2344
2793
  };
2345
2794
 
2346
2795
  // src/runtimes/agy/quota.ts
2347
- import { existsSync as existsSync13, readFileSync as readFileSync8, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
2348
- import { join as join16 } from "node:path";
2796
+ import { existsSync as existsSync16, readFileSync as readFileSync11, readdirSync as readdirSync3, statSync as statSync2 } from "node:fs";
2797
+ import { join as join18 } from "node:path";
2349
2798
  import { execFileSync } from "node:child_process";
2350
2799
  import * as os2 from "node:os";
2351
2800
  function resolveGeminiHome2() {
2352
2801
  const home = process.env.USERPROFILE || process.env.HOME || "";
2353
- return join16(home, ".gemini");
2802
+ return join18(home, ".gemini");
2354
2803
  }
2355
2804
  function resolveAntigravityAccount() {
2356
2805
  if (process.env.GOOGLE_ACCOUNT?.trim()) {
@@ -2363,14 +2812,14 @@ function resolveAntigravityAccount() {
2363
2812
  }
2364
2813
  const home = process.env.USERPROFILE || process.env.HOME || os2.homedir() || "";
2365
2814
  const candidates = [
2366
- process.env.APPDATA ? join16(process.env.APPDATA, "Antigravity", "app_storage.json") : null,
2367
- join16(home, ".config", "Antigravity", "app_storage.json"),
2368
- join16(home, "Library", "Application Support", "Antigravity", "app_storage.json")
2815
+ process.env.APPDATA ? join18(process.env.APPDATA, "Antigravity", "app_storage.json") : null,
2816
+ join18(home, ".config", "Antigravity", "app_storage.json"),
2817
+ join18(home, "Library", "Application Support", "Antigravity", "app_storage.json")
2369
2818
  ].filter(Boolean);
2370
2819
  for (const file of candidates) {
2371
2820
  try {
2372
- if (existsSync13(file)) {
2373
- const raw = readFileSync8(file, "utf8");
2821
+ if (existsSync16(file)) {
2822
+ const raw = readFileSync11(file, "utf8");
2374
2823
  const json = JSON.parse(raw);
2375
2824
  const username = json["jetski.onboarding.lastLoginUsername"];
2376
2825
  if (username && typeof username === "string" && username.trim()) {
@@ -2391,30 +2840,30 @@ function resolveAntigravityAccount() {
2391
2840
  }
2392
2841
  function resolveAntigravityLanguageServer() {
2393
2842
  const home = process.env.USERPROFILE || process.env.HOME || os2.homedir() || "";
2394
- const appData = process.env.APPDATA || (process.platform === "win32" ? join16(home, "AppData", "Roaming") : "");
2843
+ const appData = process.env.APPDATA || (process.platform === "win32" ? join18(home, "AppData", "Roaming") : "");
2395
2844
  const baseDirs = [
2396
- appData ? join16(appData, "Antigravity IDE", "logs") : null,
2397
- appData ? join16(appData, "Antigravity", "logs") : null,
2398
- join16(home, ".config", "Antigravity IDE", "logs"),
2399
- join16(home, ".config", "Antigravity", "logs"),
2400
- join16(home, "Library", "Application Support", "Antigravity IDE", "logs"),
2401
- join16(home, "Library", "Application Support", "Antigravity", "logs")
2845
+ appData ? join18(appData, "Antigravity IDE", "logs") : null,
2846
+ appData ? join18(appData, "Antigravity", "logs") : null,
2847
+ join18(home, ".config", "Antigravity IDE", "logs"),
2848
+ join18(home, ".config", "Antigravity", "logs"),
2849
+ join18(home, "Library", "Application Support", "Antigravity IDE", "logs"),
2850
+ join18(home, "Library", "Application Support", "Antigravity", "logs")
2402
2851
  ].filter(Boolean);
2403
2852
  for (const base of baseDirs) {
2404
2853
  try {
2405
- if (!existsSync13(base))
2854
+ if (!existsSync16(base))
2406
2855
  continue;
2407
- const sessionDirs = readdirSync2(base).map((d) => {
2856
+ const sessionDirs = readdirSync3(base).map((d) => {
2408
2857
  try {
2409
- return { name: d, time: statSync2(join16(base, d)).mtimeMs };
2858
+ return { name: d, time: statSync2(join18(base, d)).mtimeMs };
2410
2859
  } catch {
2411
2860
  return null;
2412
2861
  }
2413
2862
  }).filter((d) => Boolean(d)).sort((a, b) => b.time - a.time);
2414
2863
  for (const s of sessionDirs) {
2415
- const logFile = join16(base, s.name, "ls-main.log");
2416
- if (existsSync13(logFile)) {
2417
- const content = readFileSync8(logFile, "utf8");
2864
+ const logFile = join18(base, s.name, "ls-main.log");
2865
+ if (existsSync16(logFile)) {
2866
+ const content = readFileSync11(logFile, "utf8");
2418
2867
  const csrfMatch = content.match(/--csrf_token\s+([a-f0-9\-]+)/);
2419
2868
  const portMatch = content.match(/LS started on port\s+(\d+)/) || content.match(/--https_server_port\s+(\d+)/);
2420
2869
  if (csrfMatch && portMatch) {
@@ -2571,7 +3020,7 @@ async function probeAgyQuota(options) {
2571
3020
  } catch {}
2572
3021
  }
2573
3022
  const geminiHome = resolveGeminiHome2();
2574
- const hasAgyDir = existsSync13(join16(geminiHome, "antigravity")) || existsSync13(join16(geminiHome, "antigravity-cli"));
3023
+ const hasAgyDir = existsSync16(join18(geminiHome, "antigravity")) || existsSync16(join18(geminiHome, "antigravity-cli"));
2575
3024
  const hasApiKey = Boolean(process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY);
2576
3025
  const isAvailable = hasAgyDir || hasApiKey || Boolean(acc.email || acc.name);
2577
3026
  if (!isAvailable) {
@@ -2892,7 +3341,7 @@ import { methods as methods2, RequestError } from "@agentclientprotocol/sdk";
2892
3341
 
2893
3342
  // src/client/acp-fs.ts
2894
3343
  import { access, readFile as readFile4, writeFile as writeFile4 } from "node:fs/promises";
2895
- import { dirname as dirname4, extname, resolve as resolve2, sep as sep2 } from "node:path";
3344
+ import { dirname as dirname5, extname, resolve as resolve2, sep as sep2 } from "node:path";
2896
3345
  import { mkdir as mkdir4 } from "node:fs/promises";
2897
3346
  var MAX_READ_BYTES = 2 * 1024 * 1024;
2898
3347
  var BINARY_DOCUMENT_EXTENSIONS = new Set([".epub", ".mobi", ".azw", ".azw3", ".pdf"]);
@@ -2933,7 +3382,7 @@ async function acpReadTextFile(params) {
2933
3382
  }
2934
3383
  async function acpWriteTextFile(params) {
2935
3384
  const abs = assertPathInsideWorkspace(params.path, params.workspaceRoot);
2936
- await mkdir4(dirname4(abs), { recursive: true });
3385
+ await mkdir4(dirname5(abs), { recursive: true });
2937
3386
  await writeFile4(abs, params.content, "utf-8");
2938
3387
  return {};
2939
3388
  }
@@ -3137,6 +3586,16 @@ function coerceOptionValue(raw) {
3137
3586
  return String(raw);
3138
3587
  if (typeof raw === "boolean")
3139
3588
  return String(raw);
3589
+ if (raw !== null && typeof raw === "object") {
3590
+ if (!Array.isArray(raw) && Object.keys(raw).length === 0)
3591
+ return null;
3592
+ try {
3593
+ const encoded = JSON.stringify(raw);
3594
+ return encoded && encoded !== "null" ? encoded : null;
3595
+ } catch {
3596
+ return null;
3597
+ }
3598
+ }
3140
3599
  return null;
3141
3600
  }
3142
3601
  function coerceCurrentValue(raw) {
@@ -3146,8 +3605,41 @@ function coerceCurrentValue(raw) {
3146
3605
  return raw;
3147
3606
  if (typeof raw === "number" && Number.isFinite(raw))
3148
3607
  return String(raw);
3608
+ if (raw !== null && typeof raw === "object") {
3609
+ if (!Array.isArray(raw) && Object.keys(raw).length === 0)
3610
+ return;
3611
+ try {
3612
+ const encoded = JSON.stringify(raw);
3613
+ return encoded && encoded !== "null" ? encoded : undefined;
3614
+ } catch {
3615
+ return;
3616
+ }
3617
+ }
3149
3618
  return;
3150
3619
  }
3620
+ function collectOptionValues(rows, group, out) {
3621
+ for (const opt of rows) {
3622
+ if (!opt || typeof opt !== "object")
3623
+ continue;
3624
+ const o = opt;
3625
+ const nested = Array.isArray(o.options) ? o.options : null;
3626
+ const label = typeof o.group === "string" && o.group ? o.group : group;
3627
+ if (nested && nested.length > 0) {
3628
+ const fallbackName = typeof o.name === "string" && o.name ? o.name : undefined;
3629
+ collectOptionValues(nested, label ?? fallbackName, out);
3630
+ continue;
3631
+ }
3632
+ const value = coerceOptionValue(o.value) ?? coerceOptionValue(o.id);
3633
+ if (!value)
3634
+ continue;
3635
+ out.push({
3636
+ value,
3637
+ name: typeof o.name === "string" ? o.name : String(value),
3638
+ ...typeof o.description === "string" ? { description: o.description } : {},
3639
+ ...label ? { group: label } : {}
3640
+ });
3641
+ }
3642
+ }
3151
3643
  function parseAcpConfigOptions(raw) {
3152
3644
  if (!Array.isArray(raw))
3153
3645
  return [];
@@ -3162,21 +3654,8 @@ function parseAcpConfigOptions(raw) {
3162
3654
  const name = typeof row.name === "string" ? row.name : configId;
3163
3655
  const type = typeof row.type === "string" ? row.type : "select";
3164
3656
  const values = [];
3165
- if (Array.isArray(row.options)) {
3166
- for (const opt of row.options) {
3167
- if (!opt || typeof opt !== "object")
3168
- continue;
3169
- const o = opt;
3170
- const value = coerceOptionValue(o.value) ?? coerceOptionValue(o.id);
3171
- if (!value)
3172
- continue;
3173
- values.push({
3174
- value,
3175
- name: typeof o.name === "string" ? o.name : String(value),
3176
- description: typeof o.description === "string" ? o.description : undefined
3177
- });
3178
- }
3179
- }
3657
+ if (Array.isArray(row.options))
3658
+ collectOptionValues(row.options, undefined, values);
3180
3659
  options.push({
3181
3660
  configId,
3182
3661
  name,
@@ -3655,8 +4134,8 @@ class AcpTerminalManager {
3655
4134
 
3656
4135
  // src/client/acp-proxy-service.ts
3657
4136
  import { mkdir as mkdir5, readFile as readFile5, writeFile as writeFile5 } from "node:fs/promises";
3658
- import { existsSync as existsSync14 } from "node:fs";
3659
- import { join as join17 } from "node:path";
4137
+ import { existsSync as existsSync17 } from "node:fs";
4138
+ import { join as join19 } from "node:path";
3660
4139
  var DEFAULT_ACP_PROXY_SETTINGS = {
3661
4140
  enabled: false,
3662
4141
  host: "127.0.0.1",
@@ -3665,7 +4144,7 @@ var DEFAULT_ACP_PROXY_SETTINGS = {
3665
4144
  var PROXY_ENV_KEYS = ["HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY"];
3666
4145
  var LOWERCASE_PROXY_ENV_KEYS = ["http_proxy", "https_proxy", "all_proxy", "no_proxy"];
3667
4146
  function proxyFilePath(dir) {
3668
- return join17(dir, "agent", "proxy.json");
4147
+ return join19(dir, "agent", "proxy.json");
3669
4148
  }
3670
4149
  function validate2(settings) {
3671
4150
  if (!settings.host.trim())
@@ -3677,7 +4156,7 @@ function validate2(settings) {
3677
4156
  }
3678
4157
  async function readAcpProxySettings(dir = getDefaultAgentDataDir()) {
3679
4158
  const file = proxyFilePath(dir);
3680
- if (!existsSync14(file))
4159
+ if (!existsSync17(file))
3681
4160
  return { ...DEFAULT_ACP_PROXY_SETTINGS };
3682
4161
  try {
3683
4162
  const raw = JSON.parse(await readFile5(file, "utf8"));
@@ -3699,7 +4178,7 @@ async function saveAcpProxySettings(payload, dir = getDefaultAgentDataDir()) {
3699
4178
  host: payload.host.trim() || DEFAULT_ACP_PROXY_SETTINGS.host,
3700
4179
  port: payload.port
3701
4180
  };
3702
- await mkdir5(join17(dir, "agent"), { recursive: true });
4181
+ await mkdir5(join19(dir, "agent"), { recursive: true });
3703
4182
  await writeFile5(proxyFilePath(dir), JSON.stringify(stored, null, 2), "utf8");
3704
4183
  return ok(stored);
3705
4184
  }
@@ -3755,9 +4234,9 @@ function compatDeliveryKey(sessionId, generation, digest) {
3755
4234
  }
3756
4235
 
3757
4236
  // src/mcp/app-skills-mcp.ts
3758
- import { dirname as dirname5, join as join18 } from "node:path";
4237
+ import { dirname as dirname6, join as join20 } from "node:path";
3759
4238
  import { fileURLToPath } from "node:url";
3760
- import { existsSync as existsSync15, readFileSync as readFileSync9, statSync as statSync3 } from "node:fs";
4239
+ import { existsSync as existsSync18, readFileSync as readFileSync12, statSync as statSync3 } from "node:fs";
3761
4240
  var APP_SKILLS_MCP_SERVER_NAME = "app-skills";
3762
4241
  var APP_SKILLS_TOOLS = [
3763
4242
  {
@@ -3793,11 +4272,11 @@ function buildAppSkillsMcpServer(directory, opts) {
3793
4272
  function resolveAppSkillsRunnerPath(fromFile) {
3794
4273
  const base = fromFile ?? fileURLToPath(import.meta.url);
3795
4274
  const candidates = [
3796
- join18(dirname5(base), "app-skills-mcp-serve.cjs"),
3797
- join18(dirname5(base), "app-skills-mcp-serve.ts")
4275
+ join20(dirname6(base), "app-skills-mcp-serve.cjs"),
4276
+ join20(dirname6(base), "app-skills-mcp-serve.ts")
3798
4277
  ];
3799
4278
  for (const candidate of candidates) {
3800
- if (existsSync15(candidate))
4279
+ if (existsSync18(candidate))
3801
4280
  return candidate;
3802
4281
  }
3803
4282
  throw new Error(`技能 MCP 入口缺失(dist 未构建?): ${candidates[0]}`);
@@ -3977,7 +4456,10 @@ class AcpClient {
3977
4456
  const connectGen = this.connectionGen;
3978
4457
  try {
3979
4458
  this.setStatus("connecting");
3980
- const blocker = this.adapter.resolveSpawnBlocker?.();
4459
+ const blocker = this.adapter.resolveSpawnBlocker?.({
4460
+ env: { ...process.env, ...this.extraEnv },
4461
+ dataDir: this.dataDir
4462
+ });
3981
4463
  if (blocker) {
3982
4464
  this.setStatus("error", blocker);
3983
4465
  return err({ code: "ACP_SPAWN_ERROR", message: blocker });
@@ -4000,6 +4482,10 @@ class AcpClient {
4000
4482
  ...baseEnv,
4001
4483
  env: { ...baseEnv.env ?? {}, ...this.extraEnv ?? {} }
4002
4484
  };
4485
+ const providerEnv = this.adapter.getProviderEnv?.({
4486
+ dataDir: this.dataDir,
4487
+ env: { ...process.env, ...spawnEnv.env }
4488
+ }) ?? {};
4003
4489
  let resourceEnv = {};
4004
4490
  let profileTag = null;
4005
4491
  if (this.resourcesDir && this.configurationScope === "session") {
@@ -4074,7 +4560,7 @@ class AcpClient {
4074
4560
  reason: "runtime-not-supported"
4075
4561
  } } : null;
4076
4562
  }
4077
- const finalEnv = { ...spawnEnv.env, ...resourceEnv };
4563
+ const finalEnv = { ...spawnEnv.env, ...providerEnv, ...resourceEnv };
4078
4564
  await this.adapter.beforeSpawn?.();
4079
4565
  if (connectGen !== this.connectionGen || this.status !== "connecting")
4080
4566
  return err({ code: "CANCELLED", message: "连接已取消" });
@@ -4186,21 +4672,25 @@ class AcpClient {
4186
4672
  }
4187
4673
  }
4188
4674
  getCachedQuota(sessionId) {
4189
- return this.quotaCache.get(sessionId, this.runtimeInfo.id);
4675
+ return this.quotaCache.applyContextUsage(this.quotaCache.get(sessionId, this.runtimeInfo.id), sessionId, this.runtimeInfo.id) ?? undefined;
4190
4676
  }
4191
4677
  async getQuota(sessionId) {
4192
- const cached = this.getCachedQuota(sessionId);
4678
+ const cached = this.quotaCache.get(sessionId, this.runtimeInfo.id);
4193
4679
  if (cached && Date.now() - cached.updatedAt < 30000) {
4194
- return cached;
4680
+ return this.quotaCache.applyContextUsage(cached, sessionId, this.runtimeInfo.id);
4195
4681
  }
4196
4682
  if (this.adapter.probeQuota) {
4197
- const probed = await this.adapter.probeQuota({ sessionId });
4683
+ const probed = await this.adapter.probeQuota({
4684
+ sessionId,
4685
+ dataDir: this.dataDir,
4686
+ env: { ...process.env, ...this.extraEnv }
4687
+ });
4198
4688
  if (probed) {
4199
4689
  this.quotaCache.set(probed, sessionId);
4200
- return probed;
4690
+ return this.quotaCache.applyContextUsage(probed, sessionId, this.runtimeInfo.id);
4201
4691
  }
4202
4692
  }
4203
- return cached ?? null;
4693
+ return this.quotaCache.applyContextUsage(cached ?? null, sessionId, this.runtimeInfo.id);
4204
4694
  }
4205
4695
  getAvailableCommands(sessionId) {
4206
4696
  return this.commandsCache.get(sessionId);
@@ -5322,8 +5812,12 @@ export {
5322
5812
  CLAUDE_ACP_NPM_PACKAGE,
5323
5813
  CODEX_ACP_NPM_PACKAGE,
5324
5814
  DEEPSEEK_DSH_NPM_PACKAGE,
5815
+ DEEPSEEK_OFFICIAL_BASE_URL,
5325
5816
  DEFAULT_ACP_PROXY_SETTINGS,
5326
5817
  DEFAULT_ACP_RUNTIME_ID,
5818
+ DSH_ACP_DEFAULT_MODEL,
5819
+ DSH_ACP_DEFAULT_PROVIDER,
5820
+ DSH_ACP_PINNED_VERSION,
5327
5821
  INKDOWN_MCP_TOOLS,
5328
5822
  INKDOWN_PROVIDER_API_KEY_ENV,
5329
5823
  INKDOWN_PROVIDER_ID,
@@ -5340,19 +5834,23 @@ export {
5340
5834
  agyAdapter,
5341
5835
  appendTerminalOutput,
5342
5836
  assertPathInsideWorkspace,
5837
+ buildAcpModelPatch,
5343
5838
  buildAcpProxySpawnEnv,
5344
5839
  buildCursorMissingCliMessage,
5345
5840
  buildCustomProviderConfigToml,
5346
5841
  buildCustomProviderSpawnEnv,
5347
5842
  buildDeepseekMissingKeyMessage,
5843
+ buildDeepseekProviderEnv,
5348
5844
  callInkdownMcpTool,
5349
5845
  callInkdownTocTool,
5350
5846
  claudeAdapter,
5351
5847
  claudeResourceSessionMeta,
5352
5848
  clearAcpProvider,
5353
5849
  clearCursorCatalogCache,
5850
+ clearDeepseekProvider,
5354
5851
  closeAcpSessions,
5355
5852
  codexAdapter,
5853
+ compareDshVersions,
5356
5854
  connectSdkClient,
5357
5855
  copilotAdapter,
5358
5856
  createSdkStreamHandle,
@@ -5363,6 +5861,7 @@ export {
5363
5861
  digestAppResources,
5364
5862
  disposeAllAcpProcesses,
5365
5863
  emptyAcpAuthPreflight,
5864
+ ensureAcpModelPatchFile,
5366
5865
  err,
5367
5866
  extractAvailableCommands,
5368
5867
  findBuiltinAcpRuntime,
@@ -5376,10 +5875,13 @@ export {
5376
5875
  getAcpRuntimeAdapter,
5377
5876
  getActiveAcpProcess,
5378
5877
  getCursorCatalogIds,
5878
+ getDeepseekProviderStatus,
5379
5879
  getDefaultAcpRuntime,
5380
5880
  getDefaultAgentDataDir,
5381
5881
  getLiveAcpProcess,
5382
5882
  handleInkdownMcpRpc,
5883
+ hasDshCredentials,
5884
+ hasManagedDshRuntime,
5383
5885
  isAbsolutePathLike,
5384
5886
  isAppError,
5385
5887
  isAuthenticationRequired,
@@ -5402,6 +5904,7 @@ export {
5402
5904
  mergeOpenCodeAppConfig,
5403
5905
  mergeOpenCodeQuestionConfig,
5404
5906
  mergeTopLevelModelsIntoConfigOptions,
5907
+ normalizeDeepseekBaseUrl,
5405
5908
  ok,
5406
5909
  opencodeAdapter,
5407
5910
  opencodeV2Adapter,
@@ -5428,6 +5931,7 @@ export {
5428
5931
  probeCursorAuth,
5429
5932
  probeCursorQuota,
5430
5933
  probeDeepseekAuth,
5934
+ probeDeepseekQuota,
5431
5935
  probeGeminiAuth,
5432
5936
  probeOpencodeAuth,
5433
5937
  probeOpencodeQuota,
@@ -5435,19 +5939,31 @@ export {
5435
5939
  readAcpProxySettings,
5436
5940
  readAppResourcesDir,
5437
5941
  readAppRulesText,
5942
+ readHarnessCredential,
5438
5943
  readStoredAcpProvider,
5944
+ readStoredDeepseekProvider,
5439
5945
  registerAcpClientHandlers,
5440
5946
  requestSessionWithResources,
5947
+ resetAcpModelPatchCache,
5948
+ resolveAcpModelOverride,
5441
5949
  resolveClaudeHome,
5442
5950
  resolveCodexHome,
5443
5951
  resolveCopilotHome,
5444
5952
  resolveCursorAuthCandidates,
5445
5953
  resolveCursorCommand,
5446
5954
  resolveCursorSpawnCommand,
5955
+ resolveDeepseekApiBase,
5956
+ resolveDeepseekBin,
5447
5957
  resolveDeepseekPackage,
5958
+ resolveDeepseekQuotaKey,
5448
5959
  resolveDeepseekSpawnBlocker,
5449
5960
  resolveDeepseekSpawnCommand,
5961
+ resolveDshCredentialsFile,
5962
+ resolveDshHome,
5963
+ resolveDshRuntimeRoot,
5450
5964
  resolveGeminiHome,
5965
+ resolveManagedDshEntry,
5966
+ resolveManagedDshVersion,
5451
5967
  resolveOpenCodeQuestionMode,
5452
5968
  resolveOpencodeAuthCandidates,
5453
5969
  resolveOpencodeAuthFile,
@@ -5457,6 +5973,7 @@ export {
5457
5973
  runConnectAuthGate,
5458
5974
  saveAcpProvider,
5459
5975
  saveAcpProxySettings,
5976
+ saveDeepseekProvider,
5460
5977
  sdkRequest,
5461
5978
  shouldPromptAuthWizard,
5462
5979
  spawnAcpProcess,