@eddyskywalker/dsh-chatgpt-subscription 0.66.2 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +1 -1
  3. package/lib/client.js +111 -631
  4. package/lib/client.js.map +1 -1
  5. package/lib/codemode.js +28 -7
  6. package/lib/{entry-plan-mode-CLRKkgYG.js → entry-plan-mode-gqE4UeU5.js} +5 -2
  7. package/lib/{entry-progress-updates-DZ0ZRus4.js → entry-progress-updates-DpzbX1GP.js} +5 -1
  8. package/lib/index.js +408 -2062
  9. package/lib/plan-mode-pipeline.js +1 -1
  10. package/lib/plan-mode.js +1 -1
  11. package/lib/progress-updates.js +1 -1
  12. package/lib/types/client/cline-pass/ClinePassSection.d.ts +1 -1
  13. package/lib/types/client/cline-pass/ClinePassSection.d.ts.map +1 -1
  14. package/lib/types/client/cline-pass/api.d.ts +2 -36
  15. package/lib/types/client/cline-pass/api.d.ts.map +1 -1
  16. package/lib/types/client/cline-pass/locales.d.ts +30 -264
  17. package/lib/types/client/cline-pass/locales.d.ts.map +1 -1
  18. package/lib/types/client/cline-pass/styles.d.ts +2 -2
  19. package/lib/types/client/cline-pass/styles.d.ts.map +1 -1
  20. package/lib/types/client/locales-ru/cline-pass.d.ts.map +1 -1
  21. package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
  22. package/lib/types/client/progress-updates/locales.d.ts +8 -2
  23. package/lib/types/client/progress-updates/locales.d.ts.map +1 -1
  24. package/lib/types/client/progress-updates/settings-binding.d.ts +3 -1
  25. package/lib/types/client/progress-updates/settings-binding.d.ts.map +1 -1
  26. package/lib/types/client/progress-updates/settings-section.d.ts.map +1 -1
  27. package/lib/types/compat.d.ts +1 -1
  28. package/lib/types/entry-codemode.d.ts.map +1 -1
  29. package/lib/types/entry-plan-mode-pipeline.d.ts.map +1 -1
  30. package/lib/types/entry-plan-mode.d.ts.map +1 -1
  31. package/lib/types/host/agent-preset.d.ts.map +1 -1
  32. package/lib/types/host/antigravity/adapter.d.ts.map +1 -1
  33. package/lib/types/host/antigravity/client-version.d.ts.map +1 -1
  34. package/lib/types/host/antigravity/types.d.ts +5 -5
  35. package/lib/types/host/antigravity/types.d.ts.map +1 -1
  36. package/lib/types/host/cline-pass/adapter.d.ts +3 -4
  37. package/lib/types/host/cline-pass/adapter.d.ts.map +1 -1
  38. package/lib/types/host/cline-pass/client.d.ts +0 -22
  39. package/lib/types/host/cline-pass/client.d.ts.map +1 -1
  40. package/lib/types/host/cline-pass/engine.d.ts +9 -147
  41. package/lib/types/host/cline-pass/engine.d.ts.map +1 -1
  42. package/lib/types/host/cline-pass/line.d.ts.map +1 -1
  43. package/lib/types/host/cline-pass/mapper.d.ts +1 -3
  44. package/lib/types/host/cline-pass/mapper.d.ts.map +1 -1
  45. package/lib/types/host/cline-pass/protocol.d.ts +1 -161
  46. package/lib/types/host/cline-pass/protocol.d.ts.map +1 -1
  47. package/lib/types/host/cline-pass/routes.d.ts +2 -7
  48. package/lib/types/host/cline-pass/routes.d.ts.map +1 -1
  49. package/lib/types/host/cline-pass/store.d.ts +11 -35
  50. package/lib/types/host/cline-pass/store.d.ts.map +1 -1
  51. package/lib/types/host/cline-pass/token-store.d.ts +1 -10
  52. package/lib/types/host/cline-pass/token-store.d.ts.map +1 -1
  53. package/lib/types/host/cline-pass/tools.d.ts.map +1 -1
  54. package/lib/types/host/cline-pass/types.d.ts +7 -76
  55. package/lib/types/host/cline-pass/types.d.ts.map +1 -1
  56. package/lib/types/host/codemode/rules.d.ts +13 -5
  57. package/lib/types/host/codemode/rules.d.ts.map +1 -1
  58. package/lib/types/host/command-code/adapter.d.ts.map +1 -1
  59. package/lib/types/host/dispatch-execution-guard.d.ts.map +1 -1
  60. package/lib/types/host/kimi-code/mapper.d.ts.map +1 -1
  61. package/lib/types/host/kimi-code/tool-argument-guard.d.ts +7 -0
  62. package/lib/types/host/kimi-code/tool-argument-guard.d.ts.map +1 -1
  63. package/lib/types/host/kimi-code/tool-argument-recovery.d.ts.map +1 -1
  64. package/lib/types/host/progress-updates/prompt.d.ts.map +1 -1
  65. package/lib/types/host/progress-updates/tool.d.ts.map +1 -1
  66. package/lib/types/index.d.ts +14 -4
  67. package/lib/types/index.d.ts.map +1 -1
  68. package/lib/types/shared/cline-pass-contracts.d.ts +6 -92
  69. package/lib/types/shared/cline-pass-contracts.d.ts.map +1 -1
  70. package/package.json +1 -1
  71. package/presets/dispatch/README.md +9 -9
  72. package/presets/dispatch/agent.cordis.yml +26 -18
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { a as resolveProgressUpdatesSettings, n as attachProgressSettings } from "./entry-progress-updates-DZ0ZRus4.js";
1
+ import { a as resolveProgressUpdatesSettings, n as attachProgressSettings } from "./entry-progress-updates-DpzbX1GP.js";
2
2
  import { attachPlanModePipelineSettings, resolvePlanModePipelineEnabled } from "./plan-mode-pipeline.js";
3
3
  import { n as PLUGIN_MESSAGE_SOURCE_KIND, r as normalizeGenerateOptions, t as LlmError$1 } from "./llm-compat-u9mor0uu.js";
4
4
  import { DEFAULT_SKIP_PROVIDERS, PRUNER_SERVICE_NAME, resolveSkipProviders, shouldSkipPruningForSession } from "./tool-result-pruner.js";
5
- import { b as installDispatchExecutionGuard, h as installPlanModeExitReminder, l as PLAN_PROJECTION_KEY, p as createPlanNotice, v as registeredPlanControllerActive, x as resolveDispatchExecutionGuardEnabled } from "./entry-plan-mode-CLRKkgYG.js";
5
+ import { b as installDispatchExecutionGuard, h as installPlanModeExitReminder, l as PLAN_PROJECTION_KEY, p as createPlanNotice, v as registeredPlanControllerActive, x as resolveDispatchExecutionGuardEnabled } from "./entry-plan-mode-gqE4UeU5.js";
6
6
  import { createRequire } from "node:module";
7
7
  import * as LlmModule from "@deepseek-ai/dsh-llm";
8
8
  import { EMPTY_RESPONSE_CODE, HarnessError, LlmAdapter, LlmError, ProviderRequestId, ReasoningEffortId, ToolCallId, attributionHeaders, createUserMessage, errorChain, resolveRetryPolicy } from "@deepseek-ai/dsh-llm";
@@ -809,7 +809,7 @@ const ROUTE_PREFIX$5 = "/api/dsh-chatgpt-subscription";
809
809
  * `test/responses-client.test.ts` asserts the two agree, so a release that
810
810
  * forgets this constant fails the suite instead of shipping quietly.
811
811
  */
812
- const PLUGIN_VERSION = "0.66.2";
812
+ const PLUGIN_VERSION = "0.68.0";
813
813
  const CODEX_CHATGPT_PROVIDER_ID = "codex-chatgpt";
814
814
  const CODEX_API_BASE = "https://chatgpt.com/backend-api/codex";
815
815
  const CODEX_RESPONSES_URL = `${CODEX_API_BASE}/responses`;
@@ -4488,7 +4488,7 @@ var OAuthService = class {
4488
4488
  throw new OAuthServiceError("oauth-token-exchange-failed", `The ChatGPT device code could not be issued (${response.status}${detail === null ? "" : `, ${detail}`}).`, response.status);
4489
4489
  }
4490
4490
  const payload = await response.json().catch(() => null);
4491
- const record = isRecord$70(payload) ? payload : {};
4491
+ const record = isRecord$71(payload) ? payload : {};
4492
4492
  const authId = nonEmptyString$11(record.device_auth_id);
4493
4493
  const userCode = nonEmptyString$11(record.user_code) ?? nonEmptyString$11(record.usercode);
4494
4494
  if (authId === void 0 || userCode === void 0) throw new OAuthServiceError("oauth-token-exchange-failed", "ChatGPT returned no device code.");
@@ -4555,7 +4555,7 @@ var OAuthService = class {
4555
4555
  const detail = deviceErrorIdentifier(payload);
4556
4556
  throw new OAuthServiceError("oauth-token-exchange-failed", `The ChatGPT device confirmation was refused (${response.status}${detail === void 0 ? "" : `, ${detail}`}).`, response.status);
4557
4557
  }
4558
- const record = isRecord$70(payload) ? payload : {};
4558
+ const record = isRecord$71(payload) ? payload : {};
4559
4559
  const authorizationCode = nonEmptyString$11(record.authorization_code);
4560
4560
  const codeVerifier = nonEmptyString$11(record.code_verifier);
4561
4561
  if (authorizationCode === void 0 || codeVerifier === void 0) throw new OAuthServiceError("oauth-token-exchange-failed", "ChatGPT confirmed the device code but returned no authorization code.");
@@ -4888,11 +4888,11 @@ const DEVICE_PENDING_STATUSES = /* @__PURE__ */ new Set([
4888
4888
  function isPendingDeviceAnswer(response, payload) {
4889
4889
  if (response.status === 403 || response.status === 404) return true;
4890
4890
  if (!response.ok && response.status !== 400) return false;
4891
- if (!isRecord$70(payload)) return false;
4891
+ if (!isRecord$71(payload)) return false;
4892
4892
  const status = payload.status;
4893
4893
  if (typeof status === "string" && DEVICE_PENDING_STATUSES.has(status.toLowerCase())) return true;
4894
4894
  const error = payload.error;
4895
- if (isRecord$70(error)) {
4895
+ if (isRecord$71(error)) {
4896
4896
  const code = error.code;
4897
4897
  if (typeof code === "string" && DEVICE_PENDING_STATUSES.has(code.toLowerCase())) return true;
4898
4898
  }
@@ -4906,18 +4906,18 @@ function isPendingDeviceAnswer(response, payload) {
4906
4906
  * wrong.
4907
4907
  */
4908
4908
  function deviceErrorIdentifier(payload) {
4909
- if (!isRecord$70(payload)) return void 0;
4909
+ if (!isRecord$71(payload)) return void 0;
4910
4910
  const candidates = [payload.code];
4911
4911
  const error = payload.error;
4912
4912
  if (typeof error === "string") candidates.push(error);
4913
- else if (isRecord$70(error)) candidates.push(error.code, error.type);
4913
+ else if (isRecord$71(error)) candidates.push(error.code, error.type);
4914
4914
  candidates.push(payload.status);
4915
4915
  for (const candidate of candidates) if (typeof candidate === "string" && /^[a-z0-9_.-]{1,64}$/i.test(candidate)) return candidate;
4916
4916
  }
4917
4917
  function nonEmptyString$11(value) {
4918
4918
  return typeof value === "string" && value !== "" ? value : void 0;
4919
4919
  }
4920
- function isRecord$70(value) {
4920
+ function isRecord$71(value) {
4921
4921
  return typeof value === "object" && value !== null && !Array.isArray(value);
4922
4922
  }
4923
4923
  async function oauthErrorIdentifier(response) {
@@ -5098,7 +5098,7 @@ const CODEX_CLI_CREDENTIAL_SOURCE = "codex";
5098
5098
  * here, and the import has to be repeated afterwards.
5099
5099
  */
5100
5100
  const ADOPTED_CODEX_CREDENTIAL_EXPIRED_HINT = "The sign-in imported from the Codex CLI has expired. Sign in again in the Codex CLI, then import it again from this settings card.";
5101
- function isRecord$69(value) {
5101
+ function isRecord$70(value) {
5102
5102
  return typeof value === "object" && value !== null && !Array.isArray(value);
5103
5103
  }
5104
5104
  /** A trimmed, non-empty string, or nothing. */
@@ -5200,7 +5200,7 @@ function decodeJwtClaims$1(token) {
5200
5200
  if (parts.length !== 3) return void 0;
5201
5201
  try {
5202
5202
  const value = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
5203
- return isRecord$69(value) ? value : void 0;
5203
+ return isRecord$70(value) ? value : void 0;
5204
5204
  } catch {
5205
5205
  return;
5206
5206
  }
@@ -5245,10 +5245,10 @@ function expiryFromAccessToken(accessToken) {
5245
5245
  * the file carries cannot reach the result.
5246
5246
  */
5247
5247
  function parseAdoptedCodexCredential(value, sourcePath) {
5248
- if (!isRecord$69(value)) return void 0;
5248
+ if (!isRecord$70(value)) return void 0;
5249
5249
  if (value.auth_mode !== "chatgpt") return void 0;
5250
5250
  const tokens = value[CODEX_CLI_TOKENS_KEY];
5251
- if (!isRecord$69(tokens)) return void 0;
5251
+ if (!isRecord$70(tokens)) return void 0;
5252
5252
  const accessToken = nonEmptyString$10(tokens.access_token);
5253
5253
  if (accessToken === void 0) return void 0;
5254
5254
  const refreshToken = nonEmptyString$10(tokens.refresh_token);
@@ -5267,7 +5267,7 @@ function parseAdoptedCodexCredential(value, sourcePath) {
5267
5267
  const email = claims === void 0 ? void 0 : nonEmptyString$10(claims.email);
5268
5268
  if (email !== void 0) credentials.email = email;
5269
5269
  const authClaims = claims === void 0 ? void 0 : claims[CODEX_AUTH_CLAIMS_KEY];
5270
- const planType = isRecord$69(authClaims) ? nonEmptyString$10(authClaims.chatgpt_plan_type) : void 0;
5270
+ const planType = isRecord$70(authClaims) ? nonEmptyString$10(authClaims.chatgpt_plan_type) : void 0;
5271
5271
  if (planType !== void 0) credentials.planType = planType;
5272
5272
  }
5273
5273
  const accountId = nonEmptyString$10(tokens.account_id);
@@ -6589,6 +6589,17 @@ const TOOL_CALLING_MODE = {
6589
6589
  validated: "VALIDATED"
6590
6590
  };
6591
6591
  const ROUTING = {
6592
+ "gemini-4-carbon": {
6593
+ off: "gemini-4-carbon-low",
6594
+ routing: {
6595
+ minimal: "gemini-4-carbon-low",
6596
+ low: "gemini-4-carbon-low",
6597
+ medium: "gemini-4-carbon-medium",
6598
+ high: "gemini-4-carbon-high",
6599
+ xhigh: "gemini-4-carbon-high"
6600
+ },
6601
+ defaultRequestId: "gemini-4-carbon-medium"
6602
+ },
6592
6603
  "gemini-4-argon": {
6593
6604
  off: "gemini-4-argon-low",
6594
6605
  routing: {
@@ -6637,39 +6648,6 @@ const ROUTING = {
6637
6648
  },
6638
6649
  defaultRequestId: "claude-sonnet-5-5-medium"
6639
6650
  },
6640
- "gemini-3.7-flash": {
6641
- off: "gemini-3.7-flash-low",
6642
- routing: {
6643
- minimal: "gemini-3.7-flash-low",
6644
- low: "gemini-3.7-flash-low",
6645
- medium: "gemini-3.7-flash-medium",
6646
- high: "gemini-3.7-flash-high",
6647
- xhigh: "gemini-3.7-flash-high"
6648
- },
6649
- defaultRequestId: "gemini-3.7-flash-medium"
6650
- },
6651
- "gemini-3.6-flash": {
6652
- off: "gemini-3.6-flash-low",
6653
- routing: {
6654
- minimal: "gemini-3.6-flash-low",
6655
- low: "gemini-3.6-flash-low",
6656
- medium: "gemini-3.6-flash-medium",
6657
- high: "gemini-3.6-flash-high",
6658
- xhigh: "gemini-3.6-flash-high"
6659
- },
6660
- defaultRequestId: "gemini-3.6-flash-high"
6661
- },
6662
- "gemini-3.5-flash": {
6663
- off: "gemini-3.5-flash-extra-low",
6664
- routing: {
6665
- minimal: "gemini-3.5-flash-extra-low",
6666
- low: "gemini-3.5-flash-extra-low",
6667
- medium: "gemini-3.5-flash-low",
6668
- high: "gemini-3-flash-agent",
6669
- xhigh: "gemini-3-flash-agent"
6670
- },
6671
- defaultRequestId: "gemini-3-flash-agent"
6672
- },
6673
6651
  "gemini-3.5-flash-lite": {
6674
6652
  off: "gemini-3.5-flash-lite",
6675
6653
  routing: {
@@ -6681,17 +6659,6 @@ const ROUTING = {
6681
6659
  },
6682
6660
  defaultRequestId: "gemini-3.5-flash-lite"
6683
6661
  },
6684
- "gemini-3.1-pro": {
6685
- off: "gemini-3.1-pro-low",
6686
- routing: {
6687
- minimal: "gemini-3.1-pro-low",
6688
- low: "gemini-3.1-pro-low",
6689
- medium: "gemini-pro-agent",
6690
- high: "gemini-pro-agent",
6691
- xhigh: "gemini-pro-agent"
6692
- },
6693
- defaultRequestId: "gemini-pro-agent"
6694
- },
6695
6662
  "gemini-3.1-flash-lite": {
6696
6663
  off: "gemini-3.1-flash-lite",
6697
6664
  routing: {
@@ -6749,72 +6716,36 @@ const ROUTING = {
6749
6716
  }
6750
6717
  };
6751
6718
  const RUNTIME_MAX_OUTPUT_TOKENS = {
6719
+ "gemini-4-carbon": 262144,
6720
+ "gemini-4-carbon-low": 262144,
6721
+ "gemini-4-carbon-medium": 262144,
6722
+ "gemini-4-carbon-high": 262144,
6752
6723
  "gemini-4-argon": 65536,
6753
6724
  "gemini-4-argon-low": 65536,
6754
6725
  "gemini-4-argon-medium": 65536,
6755
6726
  "gemini-4-argon-high": 65536,
6756
6727
  "gemini-3.8-flash": 65536,
6757
6728
  "gemini-3.8-flash-tiered": 65536,
6758
- "gemini-3.7-flash": 65536,
6759
- "gemini-3.7-flash-low": 65536,
6760
- "gemini-3.7-flash-medium": 65536,
6761
- "gemini-3.7-flash-high": 65536,
6762
- "gemini-3.6-flash": 65536,
6763
- "gemini-3.6-flash-low": 65536,
6764
- "gemini-3.6-flash-medium": 65536,
6765
- "gemini-3.6-flash-high": 65536,
6766
- "gemini-3.5-flash": 65536,
6767
- "gemini-3.5-flash-extra-low": 65536,
6768
- "gemini-3.5-flash-low": 65536,
6769
- "gemini-3-flash-agent": 65536,
6770
6729
  "gemini-3.5-flash-lite": 65536,
6771
6730
  "gemini-3.1-flash-lite": 65536,
6772
- "gemini-3.1-pro": 65535,
6773
- "gemini-3.1-pro-low": 65535,
6774
- "gemini-3.1-pro-high": 65535,
6775
- "gemini-pro-agent": 65535,
6776
- "claude-opus-5-5": 64e3,
6777
- "claude-opus-5-5-low": 64e3,
6778
- "claude-opus-5-5-medium": 64e3,
6779
- "claude-opus-5-5-high": 64e3,
6780
- "claude-sonnet-5-5": 64e3,
6781
- "claude-sonnet-5-5-low": 64e3,
6782
- "claude-sonnet-5-5-medium": 64e3,
6783
- "claude-sonnet-5-5-high": 64e3,
6731
+ "claude-opus-5-5": 128e3,
6732
+ "claude-opus-5-5-low": 128e3,
6733
+ "claude-opus-5-5-medium": 128e3,
6734
+ "claude-opus-5-5-high": 128e3,
6735
+ "claude-sonnet-5-5": 128e3,
6736
+ "claude-sonnet-5-5-low": 128e3,
6737
+ "claude-sonnet-5-5-medium": 128e3,
6738
+ "claude-sonnet-5-5-high": 128e3,
6784
6739
  "gpt-oss-120b": 32768,
6785
6740
  "gpt-oss-120b-medium": 32768
6786
6741
  };
6787
6742
  const MODELS = [
6788
6743
  {
6789
- id: "gemini-4-argon",
6790
- name: "Gemini 4 Argon",
6791
- inputModalities: ["text", "image"],
6792
- contextWindow: 1048576,
6793
- maxTokens: 65536,
6794
- reasoningEfforts: [
6795
- "low",
6796
- "medium",
6797
- "high"
6798
- ]
6799
- },
6800
- {
6801
- id: "gemini-3.8-flash",
6802
- name: "Gemini 3.8 Flash",
6803
- inputModalities: ["text", "image"],
6804
- contextWindow: 1048576,
6805
- maxTokens: 65536,
6806
- reasoningEfforts: [
6807
- "low",
6808
- "medium",
6809
- "high"
6810
- ]
6811
- },
6812
- {
6813
- id: "gemini-3.7-flash",
6814
- name: "Gemini 3.7 Flash",
6744
+ id: "gemini-4-carbon",
6745
+ name: "Gemini 4 Carbon",
6815
6746
  inputModalities: ["text", "image"],
6816
6747
  contextWindow: 1048576,
6817
- maxTokens: 65536,
6748
+ maxTokens: 262144,
6818
6749
  reasoningEfforts: [
6819
6750
  "low",
6820
6751
  "medium",
@@ -6822,8 +6753,8 @@ const MODELS = [
6822
6753
  ]
6823
6754
  },
6824
6755
  {
6825
- id: "gemini-3.6-flash",
6826
- name: "Gemini 3.6 Flash",
6756
+ id: "gemini-4-argon",
6757
+ name: "Gemini 4 Argon",
6827
6758
  inputModalities: ["text", "image"],
6828
6759
  contextWindow: 1048576,
6829
6760
  maxTokens: 65536,
@@ -6834,8 +6765,8 @@ const MODELS = [
6834
6765
  ]
6835
6766
  },
6836
6767
  {
6837
- id: "gemini-3.5-flash",
6838
- name: "Gemini 3.5 Flash",
6768
+ id: "gemini-3.8-flash",
6769
+ name: "Gemini 3.8 Flash",
6839
6770
  inputModalities: ["text", "image"],
6840
6771
  contextWindow: 1048576,
6841
6772
  maxTokens: 65536,
@@ -6852,14 +6783,6 @@ const MODELS = [
6852
6783
  contextWindow: 1048576,
6853
6784
  maxTokens: 65536
6854
6785
  },
6855
- {
6856
- id: "gemini-3.1-pro",
6857
- name: "Gemini 3.1 Pro",
6858
- inputModalities: ["text", "image"],
6859
- contextWindow: 1048576,
6860
- maxTokens: 65535,
6861
- reasoningEfforts: ["low", "high"]
6862
- },
6863
6786
  {
6864
6787
  id: "gemini-3.1-flash-lite",
6865
6788
  name: "Gemini 3.1 Flash Lite",
@@ -6892,8 +6815,8 @@ const MODELS = [
6892
6815
  id: "claude-opus-5-5",
6893
6816
  name: "Claude Opus 5.5",
6894
6817
  inputModalities: ["text", "image"],
6895
- contextWindow: 1048576,
6896
- maxTokens: 64e3,
6818
+ contextWindow: 1e6,
6819
+ maxTokens: 128e3,
6897
6820
  reasoningEfforts: [
6898
6821
  "low",
6899
6822
  "medium",
@@ -6904,8 +6827,8 @@ const MODELS = [
6904
6827
  id: "claude-sonnet-5-5",
6905
6828
  name: "Claude Sonnet 5.5",
6906
6829
  inputModalities: ["text", "image"],
6907
- contextWindow: 1048576,
6908
- maxTokens: 64e3,
6830
+ contextWindow: 1e6,
6831
+ maxTokens: 128e3,
6909
6832
  reasoningEfforts: [
6910
6833
  "low",
6911
6834
  "medium",
@@ -6916,7 +6839,7 @@ const MODELS = [
6916
6839
  id: "gpt-oss-120b",
6917
6840
  name: "GPT-OSS 120B",
6918
6841
  inputModalities: ["text"],
6919
- contextWindow: 262144,
6842
+ contextWindow: 131072,
6920
6843
  maxTokens: 32768,
6921
6844
  reasoningEfforts: [
6922
6845
  "low",
@@ -7290,7 +7213,8 @@ const HUB_MANIFEST_USER_AGENT = "electron-builder";
7290
7213
  const HUB_RELEASE_CHANGELISTS = {
7291
7214
  "2.23.0": "998057262",
7292
7215
  "2.24.0": "1000335682",
7293
- "2.29.0": "1013060670"
7216
+ "2.29.0": "1013060670",
7217
+ "2.31.0": "1017595969"
7294
7218
  };
7295
7219
  const MANIFEST_TIMEOUT_MS = 5e3;
7296
7220
  /** How long a read manifest is trusted before another read is attempted. */
@@ -7307,7 +7231,7 @@ let inFlight;
7307
7231
  * around a Hub release that misbehaves, and discovery must not override it.
7308
7232
  */
7309
7233
  function currentHubVersion() {
7310
- return process.env.DSH_ANTIGRAVITY_VERSION?.trim() || discoveredVersion || "2.29.0";
7234
+ return process.env.DSH_ANTIGRAVITY_VERSION?.trim() || discoveredVersion || "2.31.0";
7311
7235
  }
7312
7236
  /**
7313
7237
  * The changelist that belongs to a release, or undefined when it is unknown.
@@ -8160,7 +8084,7 @@ const schemaFields = /* @__PURE__ */ new Set([
8160
8084
  "required",
8161
8085
  "propertyOrdering"
8162
8086
  ]);
8163
- function isRecord$68(value) {
8087
+ function isRecord$69(value) {
8164
8088
  return typeof value === "object" && value !== null && !Array.isArray(value);
8165
8089
  }
8166
8090
  function mergeSchemas(left, right) {
@@ -8168,7 +8092,7 @@ function mergeSchemas(left, right) {
8168
8092
  ...left,
8169
8093
  ...right
8170
8094
  };
8171
- if (isRecord$68(left.properties) && isRecord$68(right.properties)) merged.properties = {
8095
+ if (isRecord$69(left.properties) && isRecord$69(right.properties)) merged.properties = {
8172
8096
  ...left.properties,
8173
8097
  ...right.properties
8174
8098
  };
@@ -8204,9 +8128,9 @@ const mergedTypeKeys = /* @__PURE__ */ new Set([
8204
8128
  * model with strictly less than the schema it started from.
8205
8129
  */
8206
8130
  function describeBranch(branch) {
8207
- const type = typeof branch.type === "string" ? branch.type : isRecord$68(branch.properties) ? "object" : isRecord$68(branch.items) ? "array" : "value";
8131
+ const type = typeof branch.type === "string" ? branch.type : isRecord$69(branch.properties) ? "object" : isRecord$69(branch.items) ? "array" : "value";
8208
8132
  const details = [];
8209
- if (isRecord$68(branch.properties)) {
8133
+ if (isRecord$69(branch.properties)) {
8210
8134
  const names = Object.keys(branch.properties);
8211
8135
  if (names.length > 0) details.push(`{${names.join(",")}}`);
8212
8136
  }
@@ -8220,7 +8144,7 @@ function describeBranch(branch) {
8220
8144
  }
8221
8145
  /** How well one branch can stand in for a whole union; a named object shape wins. */
8222
8146
  function branchRank(branch) {
8223
- if (isRecord$68(branch.properties)) return 3;
8147
+ if (isRecord$69(branch.properties)) return 3;
8224
8148
  if (branch.type === "object") return 2;
8225
8149
  if (branch.type === "array") return 1;
8226
8150
  return 0;
@@ -8249,7 +8173,7 @@ function unionShape(branches) {
8249
8173
  shape: branches[0],
8250
8174
  folded: false
8251
8175
  };
8252
- if (new Set(branches.map((branch) => branch.type)).size === 1 && branches.every((branch) => !isRecord$68(branch.properties) && !isRecord$68(branch.items))) {
8176
+ if (new Set(branches.map((branch) => branch.type)).size === 1 && branches.every((branch) => !isRecord$69(branch.properties) && !isRecord$69(branch.items))) {
8253
8177
  const shape = { type: branches[0].type };
8254
8178
  if (branches.every((branch) => Array.isArray(branch.enum))) {
8255
8179
  const values = [...new Set(branches.flatMap((branch) => branch.enum))];
@@ -8286,7 +8210,7 @@ function foldOwnFields(node) {
8286
8210
  const out = {};
8287
8211
  for (const [key, value] of Object.entries(node)) {
8288
8212
  if (key === "anyOf" || key === "oneOf" || key === "allOf") continue;
8289
- if (key === "properties" && isRecord$68(value)) {
8213
+ if (key === "properties" && isRecord$69(value)) {
8290
8214
  out.properties = Object.fromEntries(Object.entries(value).map(([name, child]) => [name, foldSchemaUnions(child)]));
8291
8215
  continue;
8292
8216
  }
@@ -8315,15 +8239,15 @@ function foldOwnFields(node) {
8315
8239
  * argument the model sends anyway fails there, naming the actual problem.
8316
8240
  */
8317
8241
  function foldSchemaUnions(node) {
8318
- if (!isRecord$68(node)) return node;
8242
+ if (!isRecord$69(node)) return node;
8319
8243
  let own = foldOwnFields(node);
8320
8244
  if (Array.isArray(node.allOf)) for (const branch of node.allOf) {
8321
8245
  const folded = foldSchemaUnions(branch);
8322
- if (isRecord$68(folded)) own = mergeSchemas(own, folded);
8246
+ if (isRecord$69(folded)) own = mergeSchemas(own, folded);
8323
8247
  }
8324
8248
  const alternatives = Array.isArray(node.anyOf) ? node.anyOf : Array.isArray(node.oneOf) ? node.oneOf : [];
8325
8249
  if (alternatives.length === 0) return own;
8326
- const branches = alternatives.map((branch) => foldSchemaUnions(branch)).filter(isRecord$68);
8250
+ const branches = alternatives.map((branch) => foldSchemaUnions(branch)).filter(isRecord$69);
8327
8251
  if (branches.length === 0) return own;
8328
8252
  const shapes = branches.filter((branch) => branch.type !== "null");
8329
8253
  const acceptsNull = branches.some((branch) => branch.type === "null");
@@ -8339,7 +8263,7 @@ function foldSchemaUnions(node) {
8339
8263
  return merged;
8340
8264
  }
8341
8265
  function toAntigravityToolSchema(schema, options = {}) {
8342
- if (!isRecord$68(schema)) return schema;
8266
+ if (!isRecord$69(schema)) return schema;
8343
8267
  const root = schema;
8344
8268
  function resolveReference(reference) {
8345
8269
  let target = root;
@@ -8347,13 +8271,13 @@ function toAntigravityToolSchema(schema, options = {}) {
8347
8271
  const path = reference === "#" ? [] : reference.slice(2).split("/");
8348
8272
  for (const segment of path) {
8349
8273
  const key = segment.replace(/~1/g, "/").replace(/~0/g, "~");
8350
- target = isRecord$68(target) && Object.hasOwn(target, key) ? target[key] : void 0;
8274
+ target = isRecord$69(target) && Object.hasOwn(target, key) ? target[key] : void 0;
8351
8275
  }
8352
- if (!isRecord$68(target)) throw new LlmError(`Antigravity tool schema reference was not found: ${reference}`, "PROVIDER_ERROR");
8276
+ if (!isRecord$69(target)) throw new LlmError(`Antigravity tool schema reference was not found: ${reference}`, "PROVIDER_ERROR");
8353
8277
  return target;
8354
8278
  }
8355
8279
  function convert(node, references) {
8356
- if (!isRecord$68(node)) return {};
8280
+ if (!isRecord$69(node)) return {};
8357
8281
  let inherited = {};
8358
8282
  if (typeof node.$ref === "string") {
8359
8283
  if (references.has(node.$ref)) throw new LlmError(`Antigravity tool schema contains a recursive reference: ${node.$ref}`, "PROVIDER_ERROR");
@@ -8362,8 +8286,8 @@ function toAntigravityToolSchema(schema, options = {}) {
8362
8286
  if (Array.isArray(node.allOf)) for (const branch of node.allOf) inherited = mergeSchemas(inherited, convert(branch, references));
8363
8287
  const out = {};
8364
8288
  for (const [key, value] of Object.entries(node)) if (schemaFields.has(key)) out[key] = value;
8365
- if (isRecord$68(node.properties)) out.properties = Object.fromEntries(Object.entries(node.properties).map(([name, child]) => [name, convert(child, references)]));
8366
- if (isRecord$68(node.items)) out.items = convert(node.items, references);
8289
+ if (isRecord$69(node.properties)) out.properties = Object.fromEntries(Object.entries(node.properties).map(([name, child]) => [name, convert(child, references)]));
8290
+ if (isRecord$69(node.items)) out.items = convert(node.items, references);
8367
8291
  const alternatives = Array.isArray(node.anyOf) ? node.anyOf : node.oneOf;
8368
8292
  if (Array.isArray(alternatives)) out.anyOf = alternatives.map((child) => convert(child, references));
8369
8293
  if (Array.isArray(node.type)) {
@@ -8399,7 +8323,7 @@ let toolCallCounter = 0;
8399
8323
  function sanitizeText$9(text) {
8400
8324
  return text.replace(/\0/g, "");
8401
8325
  }
8402
- function isRecord$67(value) {
8326
+ function isRecord$68(value) {
8403
8327
  return typeof value === "object" && value !== null && !Array.isArray(value);
8404
8328
  }
8405
8329
  function asString$30(value) {
@@ -8419,25 +8343,25 @@ function toolCallIdNeeded(modelId, runtimeModel) {
8419
8343
  return modelId.startsWith("claude-") || modelId.startsWith("gpt-oss-") || runtimeModel.startsWith("claude-") || runtimeModel.startsWith("gpt-oss-");
8420
8344
  }
8421
8345
  function parseArguments$1(raw) {
8422
- if (isRecord$67(raw)) return raw;
8346
+ if (isRecord$68(raw)) return raw;
8423
8347
  if (raw === void 0 || raw === null || raw === "") return {};
8424
8348
  const parsed = typeof raw === "string" ? safeJsonParse$9(raw) : raw;
8425
- return isRecord$67(parsed) ? parsed : {};
8349
+ return isRecord$68(parsed) ? parsed : {};
8426
8350
  }
8427
8351
  const NO_RESOLVED_IMAGES$5 = /* @__PURE__ */ new Map();
8428
8352
  function attachmentOf$5(block) {
8429
8353
  const attachment = block.attachment;
8430
- if (!isRecord$67(attachment)) return void 0;
8354
+ if (!isRecord$68(attachment)) return void 0;
8431
8355
  return typeof attachment.attachmentId === "string" ? attachment : void 0;
8432
8356
  }
8433
8357
  function attachmentLabel$6(block) {
8434
- const attachment = isRecord$67(block.attachment) ? block.attachment : void 0;
8358
+ const attachment = isRecord$68(block.attachment) ? block.attachment : void 0;
8435
8359
  return asString$30(attachment?.name) || asString$30(attachment?.attachmentId);
8436
8360
  }
8437
8361
  function collectImageRefs$3(content, refs) {
8438
8362
  if (!Array.isArray(content)) return;
8439
8363
  for (const block of content) {
8440
- if (!isRecord$67(block)) continue;
8364
+ if (!isRecord$68(block)) continue;
8441
8365
  if (block.type === "image") {
8442
8366
  const attachment = attachmentOf$5(block);
8443
8367
  if (attachment) refs.set(attachment.attachmentId, attachment);
@@ -8570,7 +8494,7 @@ function unavailableImageText$6(block) {
8570
8494
  }
8571
8495
  function imageBlockToPart(block, images) {
8572
8496
  let data = asString$30(block.data) || asString$30(block.base64);
8573
- const source = isRecord$67(block.source) ? block.source : void 0;
8497
+ const source = isRecord$68(block.source) ? block.source : void 0;
8574
8498
  if (!data && source) data = asString$30(source.data) || asString$30(source.base64);
8575
8499
  let mimeType = asString$30(block.mimeType) || asString$30(block.mediaType) || (source ? asString$30(source.mimeType) || asString$30(source.mediaType) : void 0) || "image/png";
8576
8500
  if (data?.startsWith("data:")) {
@@ -8595,8 +8519,8 @@ function contentToUserParts(content, images) {
8595
8519
  if (typeof content === "string") return [{ text: sanitizeText$9(content) }];
8596
8520
  if (!Array.isArray(content)) return [];
8597
8521
  const parts = [];
8598
- for (const block of content) if (isRecord$67(block) && block.type === "text" && typeof block.text === "string") parts.push({ text: sanitizeText$9(block.text) });
8599
- else if (isRecord$67(block) && block.type === "image") {
8522
+ for (const block of content) if (isRecord$68(block) && block.type === "text" && typeof block.text === "string") parts.push({ text: sanitizeText$9(block.text) });
8523
+ else if (isRecord$68(block) && block.type === "image") {
8600
8524
  const img = imageBlockToPart(block, images);
8601
8525
  parts.push(img ?? { text: unavailableImageText$6(block) });
8602
8526
  }
@@ -8611,7 +8535,7 @@ function toolResultImageParts(blocks, images) {
8611
8535
  if (!Array.isArray(blocks)) return [];
8612
8536
  const parts = [];
8613
8537
  for (const block of blocks) {
8614
- if (!isRecord$67(block)) continue;
8538
+ if (!isRecord$68(block)) continue;
8615
8539
  if (block.type === "image") {
8616
8540
  parts.push(imageBlockToPart(block, images) ?? { text: unavailableImageText$6(block) });
8617
8541
  continue;
@@ -8623,7 +8547,7 @@ function toolResultImageParts(blocks, images) {
8623
8547
  function toolResultText$9(blocks) {
8624
8548
  if (!Array.isArray(blocks)) return "";
8625
8549
  return blocks.map((block) => {
8626
- if (!isRecord$67(block)) return "";
8550
+ if (!isRecord$68(block)) return "";
8627
8551
  if (block.type === "text" && typeof block.text === "string") return sanitizeText$9(block.text);
8628
8552
  if (block.type === "tool-result") return toolResultText$9(block.content);
8629
8553
  if (block.type === "image") {
@@ -8637,9 +8561,9 @@ function replayBlockFor$1(message, index) {
8637
8561
  const source = message.source;
8638
8562
  if (!source || source.kind !== "model" || source.provider !== "antigravity") return void 0;
8639
8563
  const state = source.replayState;
8640
- if (!isRecord$67(state)) return void 0;
8564
+ if (!isRecord$68(state)) return void 0;
8641
8565
  if (Array.isArray(state.blocks)) return state.blocks[index];
8642
- const resp = isRecord$67(state.response) ? state.response : void 0;
8566
+ const resp = isRecord$68(state.response) ? state.response : void 0;
8643
8567
  if (resp) {
8644
8568
  if (Array.isArray(resp.outputItems)) return resp.outputItems[index];
8645
8569
  if (Array.isArray(resp.blocks)) return resp.blocks[index];
@@ -8741,10 +8665,10 @@ function assistantParts(message, model, runtimeModel, toolCalls) {
8741
8665
  if (!Array.isArray(message.content)) return parts;
8742
8666
  for (let index = 0; index < message.content.length; index++) {
8743
8667
  const block = message.content[index];
8744
- if (!isRecord$67(block)) continue;
8668
+ if (!isRecord$68(block)) continue;
8745
8669
  if (block.type === "reasoning" && runtimeModel.startsWith("claude-") && (message.source?.kind !== "model" || message.source.provider !== "antigravity" || !("model" in message.source) || message.source.model !== model.id)) continue;
8746
8670
  const replay = replayBlockFor$1(message, index);
8747
- const originalParts = Array.isArray(replay?.parts) ? replay.parts.filter(isRecord$67) : [];
8671
+ const originalParts = Array.isArray(replay?.parts) ? replay.parts.filter(isRecord$68) : [];
8748
8672
  if ((block.type === "text" || block.type === "reasoning") && originalParts.length > 0 && originalParts.every((part) => !part.functionCall) && originalParts.map((part) => asString$30(part.text) || "").join("") === sanitizeText$9(String(block.text || ""))) {
8749
8673
  parts.push(...originalParts.map(replayPart));
8750
8674
  continue;
@@ -8765,8 +8689,8 @@ function assistantParts(message, model, runtimeModel, toolCalls) {
8765
8689
  } else if (block.type === "tool-call") {
8766
8690
  const toolId = String(block.id || "");
8767
8691
  const toolName = String(block.name || "");
8768
- const originalCall = originalParts.find((part) => isRecord$67(part.functionCall));
8769
- const wireId = asString$30((isRecord$67(originalCall?.functionCall) ? originalCall.functionCall : void 0)?.id) || (toolCallIdNeeded(model.id, runtimeModel) ? sanitizeToolCallId(toolId, toolName) : originalCall ? void 0 : toolId || void 0);
8692
+ const originalCall = originalParts.find((part) => isRecord$68(part.functionCall));
8693
+ const wireId = asString$30((isRecord$68(originalCall?.functionCall) ? originalCall.functionCall : void 0)?.id) || (toolCallIdNeeded(model.id, runtimeModel) ? sanitizeToolCallId(toolId, toolName) : originalCall ? void 0 : toolId || void 0);
8770
8694
  toolCalls.set(toolId, {
8771
8695
  name: toolName,
8772
8696
  id: wireId
@@ -8818,7 +8742,7 @@ function convertMessages(options, model, runtimeModel, images = NO_RESOLVED_IMAG
8818
8742
  continue;
8819
8743
  }
8820
8744
  const content = Array.isArray(message.content) ? message.content : [];
8821
- const userParts = contentToUserParts(content.filter((b) => !isRecord$67(b) || b.type !== "tool-result"), images);
8745
+ const userParts = contentToUserParts(content.filter((b) => !isRecord$68(b) || b.type !== "tool-result"), images);
8822
8746
  if (role === "system") {
8823
8747
  if (userParts.length) contents.push({
8824
8748
  role: GEMINI_ROLE.user,
@@ -8830,7 +8754,7 @@ function convertMessages(options, model, runtimeModel, images = NO_RESOLVED_IMAG
8830
8754
  role: GEMINI_ROLE.user,
8831
8755
  parts: userParts
8832
8756
  });
8833
- for (const b of content) if (isRecord$67(b) && b.type === "tool-result") pushToolResult(contents, b, toolCalls, model, runtimeModel, images);
8757
+ for (const b of content) if (isRecord$68(b) && b.type === "tool-result") pushToolResult(contents, b, toolCalls, model, runtimeModel, images);
8834
8758
  }
8835
8759
  return contents;
8836
8760
  }
@@ -8973,7 +8897,7 @@ const USAGE_FIELDS = [
8973
8897
  "totalTokenCount"
8974
8898
  ];
8975
8899
  function collectUsage(value, state) {
8976
- if (!isRecord$67(value)) return;
8900
+ if (!isRecord$68(value)) return;
8977
8901
  for (const key of USAGE_FIELDS) {
8978
8902
  const count = value[key];
8979
8903
  if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0) continue;
@@ -9003,17 +8927,17 @@ function processStreamLine$4(line, state) {
9003
8927
  }
9004
8928
  if (!json) return [];
9005
8929
  const chunk = safeJsonParse$9(json);
9006
- if (!isRecord$67(chunk)) return [];
9007
- const responseData = isRecord$67(chunk.response) ? chunk.response : chunk;
9008
- const error = isRecord$67(chunk.error) ? chunk.error : isRecord$67(responseData.error) ? responseData.error : void 0;
8930
+ if (!isRecord$68(chunk)) return [];
8931
+ const responseData = isRecord$68(chunk.response) ? chunk.response : chunk;
8932
+ const error = isRecord$68(chunk.error) ? chunk.error : isRecord$68(responseData.error) ? responseData.error : void 0;
9009
8933
  if (error !== void 0) throw new LlmError$1(`Antigravity stream error: ${asString$30(error.message) ?? "unknown error"}`, isContextOverflow(error) ? CONTEXT_OVERFLOW_CODE : "PROVIDER_ERROR");
9010
8934
  const candidates = Array.isArray(responseData.candidates) ? responseData.candidates : [];
9011
- const candidate = isRecord$67(candidates[0]) ? candidates[0] : void 0;
9012
- const content = isRecord$67(candidate?.content) ? candidate.content : void 0;
8935
+ const candidate = isRecord$68(candidates[0]) ? candidates[0] : void 0;
8936
+ const content = isRecord$68(candidate?.content) ? candidate.content : void 0;
9013
8937
  const parts = Array.isArray(content?.parts) ? content.parts : [];
9014
8938
  const out = [];
9015
8939
  for (const part of parts) {
9016
- if (!isRecord$67(part)) continue;
8940
+ if (!isRecord$68(part)) continue;
9017
8941
  if (typeof part.text === "string" && part.text !== "") {
9018
8942
  const isThinking = Boolean(part.thought);
9019
8943
  const blockType = isThinking ? "reasoning" : "text";
@@ -9045,7 +8969,7 @@ function processStreamLine$4(line, state) {
9045
8969
  index: state.currentBlock.index,
9046
8970
  text: delta
9047
8971
  });
9048
- } else if (!isRecord$67(part.functionCall) && thoughtSignature(part)) {
8972
+ } else if (!isRecord$68(part.functionCall) && thoughtSignature(part)) {
9049
8973
  if (state.replayBlocks.length === 0) {
9050
8974
  const type = part.thought ? "reasoning" : "text";
9051
8975
  state.blocks.push({
@@ -9069,12 +8993,12 @@ function processStreamLine$4(line, state) {
9069
8993
  }
9070
8994
  state.replayBlocks[state.replayBlocks.length - 1].parts.push(replayPart(part));
9071
8995
  }
9072
- if (isRecord$67(part.functionCall)) {
8996
+ if (isRecord$68(part.functionCall)) {
9073
8997
  out.push(...closeCurrentBlock(state));
9074
8998
  const fc = part.functionCall;
9075
8999
  const toolName = asString$30(fc.name) || "";
9076
9000
  const toolId = asString$30(fc.id) || sanitizeToolCallId("", toolName);
9077
- const argsText = JSON.stringify(isRecord$67(fc.args) ? fc.args : {});
9001
+ const argsText = JSON.stringify(isRecord$68(fc.args) ? fc.args : {});
9078
9002
  const index = state.blocks.length;
9079
9003
  const block = {
9080
9004
  type: "tool-call",
@@ -9113,7 +9037,7 @@ function processStreamLine$4(line, state) {
9113
9037
  if (responseData !== chunk) collectUsage(responseData.usageMetadata, state);
9114
9038
  const finishMessage = asString$30(candidate?.finishMessage);
9115
9039
  if (finishMessage) state.finishMessage = finishMessage;
9116
- const blockReason = asString$30((isRecord$67(responseData.promptFeedback) ? responseData.promptFeedback : void 0)?.blockReason);
9040
+ const blockReason = asString$30((isRecord$68(responseData.promptFeedback) ? responseData.promptFeedback : void 0)?.blockReason);
9117
9041
  const finishReason = asString$30(candidate?.finishReason) || asString$30(responseData.finishReason) || (blockReason ? `PROMPT_BLOCKED:${blockReason}` : void 0);
9118
9042
  if (finishReason) {
9119
9043
  state.finishReason = finishReason;
@@ -9186,7 +9110,7 @@ function closeStream$7(state) {
9186
9110
  *
9187
9111
  * @module dsh-chatgpt-subscription/request-images
9188
9112
  */
9189
- function isRecord$66(value) {
9113
+ function isRecord$67(value) {
9190
9114
  return typeof value === "object" && value !== null && !Array.isArray(value);
9191
9115
  }
9192
9116
  function asString$29(value) {
@@ -9245,17 +9169,17 @@ const SUPPORTED_IMAGE_MEDIA_TYPES$4 = /* @__PURE__ */ new Set([
9245
9169
  ]);
9246
9170
  function attachmentOf$4(block) {
9247
9171
  const attachment = block.attachment;
9248
- if (!isRecord$66(attachment)) return void 0;
9172
+ if (!isRecord$67(attachment)) return void 0;
9249
9173
  return typeof attachment.attachmentId === "string" ? attachment : void 0;
9250
9174
  }
9251
9175
  function attachmentLabel$5(block) {
9252
- const attachment = isRecord$66(block.attachment) ? block.attachment : void 0;
9176
+ const attachment = isRecord$67(block.attachment) ? block.attachment : void 0;
9253
9177
  return asString$29(attachment?.name) || asString$29(attachment?.attachmentId);
9254
9178
  }
9255
9179
  function collectImageRefs$2(content, refs) {
9256
9180
  if (!Array.isArray(content)) return;
9257
9181
  for (const block of content) {
9258
- if (!isRecord$66(block)) continue;
9182
+ if (!isRecord$67(block)) continue;
9259
9183
  if (block.type === "image") {
9260
9184
  const attachment = attachmentOf$4(block);
9261
9185
  if (attachment) refs.set(attachment.attachmentId, attachment);
@@ -9285,7 +9209,7 @@ function base64Length$2(bytes) {
9285
9209
  */
9286
9210
  function inlinePayloadOf$1(block) {
9287
9211
  let data = asString$29(block.data) || asString$29(block.base64);
9288
- const source = isRecord$66(block.source) ? block.source : void 0;
9212
+ const source = isRecord$67(block.source) ? block.source : void 0;
9289
9213
  if (!data && source) data = asString$29(source.data) || asString$29(source.base64);
9290
9214
  if (data?.startsWith("data:")) {
9291
9215
  const matched = data.match(/^data:([^;,]+);base64,(.*)$/s);
@@ -9315,7 +9239,7 @@ function requestImagePayloadLength(block, images) {
9315
9239
  function collectRequestImagePayloads(content, images, lengths) {
9316
9240
  if (!Array.isArray(content)) return;
9317
9241
  for (const block of content) {
9318
- if (!isRecord$66(block)) continue;
9242
+ if (!isRecord$67(block)) continue;
9319
9243
  if (block.type === "image") {
9320
9244
  const bytes = requestImagePayloadLength(block, images);
9321
9245
  if (bytes !== void 0) lengths.push(bytes);
@@ -9369,7 +9293,7 @@ function replaceOldestRequestImages(options, count, images) {
9369
9293
  let replaced = false;
9370
9294
  return {
9371
9295
  content: content.map((block) => {
9372
- if (remaining.count === 0 || !isRecord$66(block)) return block;
9296
+ if (remaining.count === 0 || !isRecord$67(block)) return block;
9373
9297
  if (block.type === "image") {
9374
9298
  if (requestImagePayloadLength(block, images) === void 0) return block;
9375
9299
  remaining.count -= 1;
@@ -9511,7 +9435,7 @@ function collectImageOccurrences(options, images) {
9511
9435
  const walk = (content) => {
9512
9436
  if (!Array.isArray(content)) return;
9513
9437
  for (const block of content) {
9514
- if (!isRecord$66(block)) continue;
9438
+ if (!isRecord$67(block)) continue;
9515
9439
  if (block.type === "image") {
9516
9440
  const bytes = requestImagePayloadLength(block, images);
9517
9441
  const key = requestImageKey(block, images);
@@ -9581,7 +9505,7 @@ function replaceDroppedRequestImages(options, droppedKeys, images) {
9581
9505
  let replaced = false;
9582
9506
  return {
9583
9507
  content: content.map((block) => {
9584
- if (!isRecord$66(block)) return block;
9508
+ if (!isRecord$67(block)) return block;
9585
9509
  if (block.type === "image") {
9586
9510
  const key = requestImageKey(block, images);
9587
9511
  if (key === void 0 || !droppedKeys.has(key)) return block;
@@ -9770,7 +9694,7 @@ function unavailableImageText$5(block) {
9770
9694
  }
9771
9695
  function imageBlockToInline$3(block, images) {
9772
9696
  let data = asString$29(block.data) || asString$29(block.base64);
9773
- const source = isRecord$66(block.source) ? block.source : void 0;
9697
+ const source = isRecord$67(block.source) ? block.source : void 0;
9774
9698
  if (!data && source) data = asString$29(source.data) || asString$29(source.base64);
9775
9699
  let mediaType = asString$29(block.mimeType) || asString$29(block.mediaType) || (source ? asString$29(source.mimeType) || asString$29(source.mediaType) : void 0) || "image/png";
9776
9700
  if (data?.startsWith("data:")) {
@@ -9916,12 +9840,12 @@ const BOOLEAN_KEYS = [
9916
9840
  "waitWarmup",
9917
9841
  "hint"
9918
9842
  ];
9919
- function isRecord$65(value) {
9843
+ function isRecord$66(value) {
9920
9844
  return typeof value === "object" && value !== null && !Array.isArray(value);
9921
9845
  }
9922
9846
  /** Validate one provider override without silently dropping unknown keys. */
9923
9847
  function parsePromptCacheOverride(provider, value) {
9924
- if (!isRecord$65(value)) throw new Error(`prompt cache policy for "${provider}" must be an object`);
9848
+ if (!isRecord$66(value)) throw new Error(`prompt cache policy for "${provider}" must be an object`);
9925
9849
  const out = {};
9926
9850
  for (const [key, entry] of Object.entries(value)) {
9927
9851
  if (!OVERRIDE_KEYS.has(key)) throw new Error(`prompt cache policy for "${provider}" has unknown field "${key}"`);
@@ -9942,7 +9866,7 @@ function parsePromptCacheOverride(provider, value) {
9942
9866
  /** Validate a whole config-owned map. Undefined means no overrides. */
9943
9867
  function parsePromptCacheOverrides(value) {
9944
9868
  if (value === void 0) return {};
9945
- if (!isRecord$65(value)) throw new Error("promptCacheOverrides must be an object keyed by provider id");
9869
+ if (!isRecord$66(value)) throw new Error("promptCacheOverrides must be an object keyed by provider id");
9946
9870
  const out = {};
9947
9871
  for (const [provider, override] of Object.entries(value)) {
9948
9872
  if (!/^[a-z0-9][a-z0-9-]*$/.test(provider)) throw new Error(`invalid prompt cache provider id "${provider}"`);
@@ -10124,14 +10048,14 @@ async function fetchWithPrefixCoordination(fetchFn, coordinator, groupKey, warmT
10124
10048
  }
10125
10049
  //#endregion
10126
10050
  //#region src/host/common/prefix-stability.ts
10127
- function isRecord$64(value) {
10051
+ function isRecord$65(value) {
10128
10052
  return typeof value === "object" && value !== null && !Array.isArray(value);
10129
10053
  }
10130
10054
  function firstTextOf$1(content) {
10131
10055
  if (typeof content === "string") return content.trim() === "" ? void 0 : content;
10132
10056
  if (!Array.isArray(content)) return void 0;
10133
10057
  for (const block of content) {
10134
- if (!isRecord$64(block)) continue;
10058
+ if (!isRecord$65(block)) continue;
10135
10059
  if (block.type === "text" && typeof block.text === "string" && block.text !== "") return block.text;
10136
10060
  if (block.type === "tool-result") {
10137
10061
  const nested = firstTextOf$1(block.content);
@@ -10145,7 +10069,7 @@ function isToolResultMessage$9(message) {
10145
10069
  /** Stability tier for an initial bootstrap reminder; null means dynamic/history-bound. */
10146
10070
  function classifyBootstrapUserMessage$1(message) {
10147
10071
  if (message.role !== "user" || isToolResultMessage$9(message)) return null;
10148
- const source = isRecord$64(message.source) ? message.source : void 0;
10072
+ const source = isRecord$65(message.source) ? message.source : void 0;
10149
10073
  const kind = source !== void 0 && typeof source.kind === "string" ? source.kind : void 0;
10150
10074
  const text = firstTextOf$1(message.content)?.trimStart() ?? "";
10151
10075
  if (kind === "progress-updates-language" || text.startsWith("Progress update output language override:")) return 1;
@@ -10156,7 +10080,7 @@ function classifyBootstrapUserMessage$1(message) {
10156
10080
  }
10157
10081
  function isCompactCheckpointMessage(message) {
10158
10082
  if (message === void 0 || message.role !== "user" || isToolResultMessage$9(message)) return false;
10159
- const source = isRecord$64(message.source) ? message.source : void 0;
10083
+ const source = isRecord$65(message.source) ? message.source : void 0;
10160
10084
  if (source !== void 0 && source.kind === "compact-checkpoint") return true;
10161
10085
  return firstTextOf$1(message.content)?.trimStart().startsWith("This is an automatically generated checkpoint condensing") === true;
10162
10086
  }
@@ -10164,7 +10088,7 @@ function isCompactCheckpointMessage(message) {
10164
10088
  function normalizeAgentInstructionsMessage(message) {
10165
10089
  if (!Array.isArray(message.content) || message.content.length !== 1) return message;
10166
10090
  const first = message.content[0];
10167
- if (!isRecord$64(first) || first.type !== "text" || typeof first.text !== "string") return message;
10091
+ if (!isRecord$65(first) || first.type !== "text" || typeof first.text !== "string") return message;
10168
10092
  const raw = first.text;
10169
10093
  const firstIdx = raw.indexOf("\n\nInstructions from: ");
10170
10094
  if (firstIdx < 0) return message;
@@ -10277,7 +10201,7 @@ function allTextOf(content) {
10277
10201
  if (typeof content === "string") return content;
10278
10202
  if (!Array.isArray(content)) return "";
10279
10203
  return content.map((block) => {
10280
- if (!isRecord$64(block)) return "";
10204
+ if (!isRecord$65(block)) return "";
10281
10205
  if (block.type === "text" && typeof block.text === "string") return block.text;
10282
10206
  if (block.type === "tool-result") return allTextOf(block.content);
10283
10207
  return "";
@@ -11060,7 +10984,7 @@ function withoutValidatedToolConfig(body) {
11060
10984
  * a tool call only runs after its stream finishes, so retrying can neither
11061
10985
  * repeat committed output nor re-run a tool.
11062
10986
  */
11063
- function streamFailure$2(error, signal) {
10987
+ function streamFailure$3(error, signal) {
11064
10988
  if (error instanceof LlmError) return error;
11065
10989
  if (signal.aborted) return new LlmError("Antigravity stream aborted", "ABORTED", { cause: error });
11066
10990
  const chain = errorChain(error).trim();
@@ -11186,7 +11110,7 @@ var AntigravityAdapter = class extends LlmAdapter {
11186
11110
  const fetchFn = this.options.fetchFn ?? fetch;
11187
11111
  const effort = String(options.reasoningEffort || "medium").toLowerCase();
11188
11112
  const routing = ROUTING[model.id];
11189
- const runtimeModel = routing?.routing[effort] || routing?.defaultRequestId || model.id;
11113
+ const runtimeModel = (effort === "off" || effort === "none" ? routing?.off : routing?.routing[effort]) || routing?.defaultRequestId || model.id;
11190
11114
  const family = quotaFamilyForModel(model.id);
11191
11115
  const runtimeMaxOutput = catalogMaxOutputFor(runtimeModel, catalog);
11192
11116
  const normalizedOptions = withStaticPrefixOrdering("antigravity", normalizeGenerateOptions(options), this.options.promptCache);
@@ -11340,7 +11264,7 @@ var AntigravityAdapter = class extends LlmAdapter {
11340
11264
  try {
11341
11265
  while (true) {
11342
11266
  const { done, value } = await reader.read().catch((error) => {
11343
- throw streamFailure$2(error, signal);
11267
+ throw streamFailure$3(error, signal);
11344
11268
  });
11345
11269
  if (done) break;
11346
11270
  if (value !== void 0 && value.byteLength > 0) activity?.pulse();
@@ -12758,11 +12682,11 @@ function createControlledModelFetch(baseFetch, options) {
12758
12682
  * text and may opt into a hard handoff threshold; coordination tools are exempt
12759
12683
  * because they are expected to recur while real work continues.
12760
12684
  */
12761
- function isRecord$63(value) {
12685
+ function isRecord$64(value) {
12762
12686
  return typeof value === "object" && value !== null;
12763
12687
  }
12764
12688
  function isPlainRecord$2(value) {
12765
- if (!isRecord$63(value) || Array.isArray(value)) return false;
12689
+ if (!isRecord$64(value) || Array.isArray(value)) return false;
12766
12690
  const prototype = Object.getPrototypeOf(value);
12767
12691
  return prototype === Object.prototype || prototype === null;
12768
12692
  }
@@ -14852,7 +14776,7 @@ var ResponsesClient = class {
14852
14776
  try {
14853
14777
  yield* wrapStreamWithWatchdog((watchdogSignal, activity) => parseResponsesStream(response, watchdogSignal, void 0, activity), options.signal, this.codexStreamIdleTimeoutMs, "LLM_STREAM_IDLE_TIMEOUT", "Codex");
14854
14778
  } catch (error) {
14855
- throw streamFailure$1(error, options.signal);
14779
+ throw streamFailure$2(error, options.signal);
14856
14780
  } finally {
14857
14781
  this.turnStates.delete(turnKey);
14858
14782
  release?.();
@@ -15061,7 +14985,7 @@ function isPreConnectionFailure$2(error) {
15061
14985
  * attempt on retry, and a tool call is only executed after its stream finishes,
15062
14986
  * so retrying can neither repeat committed output nor re-run a tool.
15063
14987
  */
15064
- function streamFailure$1(error, signal) {
14988
+ function streamFailure$2(error, signal) {
15065
14989
  if (error instanceof LlmError) return error;
15066
14990
  if (signal?.aborted) return new LlmError("Codex request aborted", "ABORTED", { cause: error });
15067
14991
  const chain = errorChain(error).trim();
@@ -17150,7 +17074,7 @@ async function compactionCandidates(ctx) {
17150
17074
  };
17151
17075
  }))).filter((provider) => provider.models.length > 0) };
17152
17076
  }
17153
- function isRecord$62(value) {
17077
+ function isRecord$63(value) {
17154
17078
  return typeof value === "object" && value !== null && !Array.isArray(value);
17155
17079
  }
17156
17080
  function readPreferencesUpdate(value, current) {
@@ -17208,7 +17132,7 @@ function readPreferencesUpdate(value, current) {
17208
17132
  patch.subagentAllowParentForkByMainModel = value.subagentAllowParentForkByMainModel;
17209
17133
  }
17210
17134
  if ("contextWindowOverrides" in value) {
17211
- if (!isRecord$62(value.contextWindowOverrides)) throw new PreferenceError("contextWindowOverrides must be an object.");
17135
+ if (!isRecord$63(value.contextWindowOverrides)) throw new PreferenceError("contextWindowOverrides must be an object.");
17212
17136
  const overrides = {};
17213
17137
  for (const [model, contextWindow] of Object.entries(value.contextWindowOverrides)) {
17214
17138
  if (!isCodexModelId(model)) throw new PreferenceError("Unknown Codex model for a context window override.");
@@ -22106,11 +22030,11 @@ function commandCodeHeaders(apiKey, extra = {}) {
22106
22030
  function timeoutSignal$5(signal, ms) {
22107
22031
  return signal ? AbortSignal.any([signal, AbortSignal.timeout(ms)]) : AbortSignal.timeout(ms);
22108
22032
  }
22109
- function isRecord$61(value) {
22033
+ function isRecord$62(value) {
22110
22034
  return typeof value === "object" && value !== null && !Array.isArray(value);
22111
22035
  }
22112
22036
  function asRecord$16(value) {
22113
- return isRecord$61(value) ? value : void 0;
22037
+ return isRecord$62(value) ? value : void 0;
22114
22038
  }
22115
22039
  function asString$28(value) {
22116
22040
  if (typeof value === "string" && value.trim() !== "") return value;
@@ -22154,7 +22078,7 @@ function deepValue(value, keys, depth = 0) {
22154
22078
  }
22155
22079
  return;
22156
22080
  }
22157
- if (!isRecord$61(value)) return void 0;
22081
+ if (!isRecord$62(value)) return void 0;
22158
22082
  for (const key of keys) if (value[key] !== void 0 && value[key] !== null) return value[key];
22159
22083
  for (const nested of Object.values(value)) {
22160
22084
  const hit = deepValue(nested, keys, depth + 1);
@@ -22168,7 +22092,7 @@ function collectRecords(value, keys, depth = 0, out = []) {
22168
22092
  for (const entry of value) collectRecords(entry, keys, depth + 1, out);
22169
22093
  return out;
22170
22094
  }
22171
- if (!isRecord$61(value)) return out;
22095
+ if (!isRecord$62(value)) return out;
22172
22096
  if (keys.some((key) => value[key] !== void 0)) out.push(value);
22173
22097
  for (const nested of Object.values(value)) collectRecords(nested, keys, depth + 1, out);
22174
22098
  return out;
@@ -23064,7 +22988,7 @@ function cleanOrphanedToolCalls(messages, refold) {
23064
22988
  *
23065
22989
  * https://commandcode.ai/blog/command-code-provider-api
23066
22990
  */
23067
- function isRecord$60(value) {
22991
+ function isRecord$61(value) {
23068
22992
  return typeof value === "object" && value !== null && !Array.isArray(value);
23069
22993
  }
23070
22994
  function asString$26(value) {
@@ -23104,17 +23028,17 @@ const SUPPORTED_IMAGE_MEDIA_TYPES$3 = /* @__PURE__ */ new Set([
23104
23028
  ]);
23105
23029
  function attachmentOf$3(block) {
23106
23030
  const attachment = block.attachment;
23107
- if (!isRecord$60(attachment)) return void 0;
23031
+ if (!isRecord$61(attachment)) return void 0;
23108
23032
  return typeof attachment.attachmentId === "string" ? attachment : void 0;
23109
23033
  }
23110
23034
  function attachmentLabel$4(block) {
23111
- const attachment = isRecord$60(block.attachment) ? block.attachment : void 0;
23035
+ const attachment = isRecord$61(block.attachment) ? block.attachment : void 0;
23112
23036
  return asString$26(attachment?.name) || asString$26(attachment?.attachmentId);
23113
23037
  }
23114
23038
  function collectImageRefs$1(content, refs) {
23115
23039
  if (!Array.isArray(content)) return;
23116
23040
  for (const block of content) {
23117
- if (!isRecord$60(block)) continue;
23041
+ if (!isRecord$61(block)) continue;
23118
23042
  if (block.type === "image") {
23119
23043
  const attachment = attachmentOf$3(block);
23120
23044
  if (attachment) refs.set(attachment.attachmentId, attachment);
@@ -23135,7 +23059,7 @@ function requestImageBytes$1(block) {
23135
23059
  function collectRequestImageBytes$1(content, lengths) {
23136
23060
  if (!Array.isArray(content)) return;
23137
23061
  for (const block of content) {
23138
- if (!isRecord$60(block)) continue;
23062
+ if (!isRecord$61(block)) continue;
23139
23063
  if (block.type === "tool-result") {
23140
23064
  collectRequestImageBytes$1(block.content, lengths);
23141
23065
  continue;
@@ -23171,7 +23095,7 @@ function offloadOldestRequestImages$1(options) {
23171
23095
  let replaced = false;
23172
23096
  return {
23173
23097
  content: content.map((block) => {
23174
- if (remaining.count === 0 || !isRecord$60(block)) return block;
23098
+ if (remaining.count === 0 || !isRecord$61(block)) return block;
23175
23099
  if (block.type === "image") {
23176
23100
  if (requestImageBytes$1(block) === void 0) return block;
23177
23101
  remaining.count -= 1;
@@ -23243,7 +23167,7 @@ function unavailableImageText$4(block) {
23243
23167
  }
23244
23168
  function imageBlockToInline$2(block, images) {
23245
23169
  let data = asString$26(block.data) || asString$26(block.base64);
23246
- const source = isRecord$60(block.source) ? block.source : void 0;
23170
+ const source = isRecord$61(block.source) ? block.source : void 0;
23247
23171
  if (!data && source) data = asString$26(source.data) || asString$26(source.base64);
23248
23172
  let mediaType = asString$26(block.mimeType) || asString$26(block.mediaType) || (source ? asString$26(source.mimeType) || asString$26(source.mediaType) : void 0) || "image/png";
23249
23173
  if (data?.startsWith("data:")) {
@@ -23269,7 +23193,7 @@ function textOf$9(content) {
23269
23193
  if (!Array.isArray(content)) return "";
23270
23194
  const parts = [];
23271
23195
  for (const block of content) {
23272
- if (!isRecord$60(block)) continue;
23196
+ if (!isRecord$61(block)) continue;
23273
23197
  if (block.type === "text" && typeof block.text === "string") parts.push(sanitizeText$8(block.text));
23274
23198
  else if (block.type === "tool-result") parts.push(textOf$9(block.content));
23275
23199
  }
@@ -23278,7 +23202,7 @@ function textOf$9(content) {
23278
23202
  function toolResultText$8(blocks) {
23279
23203
  if (!Array.isArray(blocks)) return "";
23280
23204
  return blocks.map((block) => {
23281
- if (!isRecord$60(block)) return "";
23205
+ if (!isRecord$61(block)) return "";
23282
23206
  if (block.type === "text" && typeof block.text === "string") return sanitizeText$8(block.text);
23283
23207
  if (block.type === "tool-result") return toolResultText$8(block.content);
23284
23208
  if (block.type === "image") return `[image: ${attachmentLabel$4(block) ?? "attached image"}]`;
@@ -23296,7 +23220,7 @@ function toolResultBlocks$2(blocks, images) {
23296
23220
  const out = [];
23297
23221
  let hasImage = false;
23298
23222
  for (const block of blocks) {
23299
- if (!isRecord$60(block)) continue;
23223
+ if (!isRecord$61(block)) continue;
23300
23224
  if (block.type === "text" && typeof block.text === "string") {
23301
23225
  out.push({
23302
23226
  type: "text",
@@ -23345,7 +23269,7 @@ function toolResultImageBlocks$5(blocks, images) {
23345
23269
  if (!Array.isArray(blocks)) return [];
23346
23270
  const out = [];
23347
23271
  for (const block of blocks) {
23348
- if (!isRecord$60(block)) continue;
23272
+ if (!isRecord$61(block)) continue;
23349
23273
  if (block.type === "image") {
23350
23274
  const inline = imageBlockToInline$2(block, images);
23351
23275
  if (inline && SUPPORTED_IMAGE_MEDIA_TYPES$3.has(inline.mediaType)) out.push({
@@ -23389,7 +23313,7 @@ function nonSystemMessages$7(options) {
23389
23313
  }
23390
23314
  /** Drop the JSON-Schema keywords provider gateways reject or ignore. */
23391
23315
  function stripMetaSchema$2(schema) {
23392
- if (!isRecord$60(schema)) return {
23316
+ if (!isRecord$61(schema)) return {
23393
23317
  type: "object",
23394
23318
  properties: {}
23395
23319
  };
@@ -23406,7 +23330,7 @@ function openAIUserContent$4(message, images) {
23406
23330
  const parts = [];
23407
23331
  let hasImage = false;
23408
23332
  for (const block of message.content) {
23409
- if (!isRecord$60(block)) continue;
23333
+ if (!isRecord$61(block)) continue;
23410
23334
  if (block.type === "text" && typeof block.text === "string") {
23411
23335
  const text = sanitizeText$8(block.text);
23412
23336
  if (text !== "") parts.push({
@@ -23434,7 +23358,7 @@ function openAIAssistantContent$4(message) {
23434
23358
  const textParts = [];
23435
23359
  const toolCalls = [];
23436
23360
  for (const block of message.content) {
23437
- if (!isRecord$60(block)) continue;
23361
+ if (!isRecord$61(block)) continue;
23438
23362
  if (block.type === "text" && typeof block.text === "string") textParts.push(sanitizeText$8(block.text));
23439
23363
  else if (block.type === "tool-call" && typeof block.name === "string") toolCalls.push({
23440
23364
  id: typeof block.id === "string" && block.id !== "" ? block.id : `call_${toolCalls.length}`,
@@ -23484,7 +23408,7 @@ function buildOpenAIRequest$1(options, images = NO_RESOLVED_IMAGES$3) {
23484
23408
  while (index < conversation.length && isToolResultMessage$8(conversation[index])) {
23485
23409
  const current = conversation[index];
23486
23410
  const block = current.content[0];
23487
- const callId = isRecord$60(block) && typeof block.toolCallId === "string" ? block.toolCallId : "";
23411
+ const callId = isRecord$61(block) && typeof block.toolCallId === "string" ? block.toolCallId : "";
23488
23412
  messages.push({
23489
23413
  role: "tool",
23490
23414
  tool_call_id: callId,
@@ -23545,7 +23469,7 @@ function anthropicUserContent$3(message, images) {
23545
23469
  if (!Array.isArray(message.content)) return [];
23546
23470
  const blocks = [];
23547
23471
  for (const block of message.content) {
23548
- if (!isRecord$60(block)) continue;
23472
+ if (!isRecord$61(block)) continue;
23549
23473
  if (block.type === "text" && typeof block.text === "string") {
23550
23474
  const text = sanitizeText$8(block.text);
23551
23475
  if (text !== "") blocks.push({
@@ -23582,7 +23506,7 @@ function anthropicUserContent$3(message, images) {
23582
23506
  function anthropicAssistantContent$3(message) {
23583
23507
  const blocks = [];
23584
23508
  for (const block of message.content) {
23585
- if (!isRecord$60(block)) continue;
23509
+ if (!isRecord$61(block)) continue;
23586
23510
  if (block.type === "text" && typeof block.text === "string") {
23587
23511
  const text = sanitizeText$8(block.text);
23588
23512
  if (text !== "") blocks.push({
@@ -23595,7 +23519,7 @@ function anthropicAssistantContent$3(message) {
23595
23519
  type: "tool_use",
23596
23520
  id: typeof block.id === "string" && block.id !== "" ? block.id : `toolu_${blocks.length}`,
23597
23521
  name: block.name,
23598
- input: isRecord$60(parsed) ? parsed : {}
23522
+ input: isRecord$61(parsed) ? parsed : {}
23599
23523
  });
23600
23524
  }
23601
23525
  }
@@ -23734,7 +23658,7 @@ function responsesUserContent(message, images) {
23734
23658
  if (!Array.isArray(message.content)) return [];
23735
23659
  const parts = [];
23736
23660
  for (const block of message.content) {
23737
- if (!isRecord$60(block)) continue;
23661
+ if (!isRecord$61(block)) continue;
23738
23662
  if (block.type === "text" && typeof block.text === "string") {
23739
23663
  const text = sanitizeText$8(block.text);
23740
23664
  if (text !== "") parts.push({
@@ -23759,7 +23683,7 @@ function responsesToolResultImageBlocks(blocks, images) {
23759
23683
  if (!Array.isArray(blocks)) return [];
23760
23684
  const out = [];
23761
23685
  for (const block of blocks) {
23762
- if (!isRecord$60(block)) continue;
23686
+ if (!isRecord$61(block)) continue;
23763
23687
  if (block.type === "image") {
23764
23688
  const inline = imageBlockToInline$2(block, images);
23765
23689
  if (inline && SUPPORTED_IMAGE_MEDIA_TYPES$3.has(inline.mediaType)) out.push({
@@ -23786,8 +23710,8 @@ function buildResponsesRequest(options, images = NO_RESOLVED_IMAGES$3) {
23786
23710
  const imageBlocks = [];
23787
23711
  while (index < conversation.length && isToolResultMessage$8(conversation[index])) {
23788
23712
  const current = conversation[index];
23789
- const toolResult = Array.isArray(current.content) ? current.content.find((b) => isRecord$60(b) && b.type === "tool-result") : void 0;
23790
- const callId = (isRecord$60(toolResult) && typeof toolResult.toolCallId === "string" ? toolResult.toolCallId : "") || (typeof current.source?.callId === "string" ? current.source.callId : "");
23713
+ const toolResult = Array.isArray(current.content) ? current.content.find((b) => isRecord$61(b) && b.type === "tool-result") : void 0;
23714
+ const callId = (isRecord$61(toolResult) && typeof toolResult.toolCallId === "string" ? toolResult.toolCallId : "") || (typeof current.source?.callId === "string" ? current.source.callId : "");
23791
23715
  input.push({
23792
23716
  type: "function_call_output",
23793
23717
  call_id: callId,
@@ -23810,7 +23734,7 @@ function buildResponsesRequest(options, images = NO_RESOLVED_IMAGES$3) {
23810
23734
  content
23811
23735
  });
23812
23736
  for (const call of toolCalls) {
23813
- const fn = isRecord$60(call.function) ? call.function : void 0;
23737
+ const fn = isRecord$61(call.function) ? call.function : void 0;
23814
23738
  input.push({
23815
23739
  type: "function_call",
23816
23740
  call_id: call.id,
@@ -23933,9 +23857,9 @@ function processOpenAIStreamLine$1(line, state) {
23933
23857
  }
23934
23858
  if (payload === "") return [];
23935
23859
  const chunk = safeJsonParse$8(payload);
23936
- if (!isRecord$60(chunk)) return [];
23860
+ if (!isRecord$61(chunk)) return [];
23937
23861
  const out = [];
23938
- if (isRecord$60(chunk.error)) {
23862
+ if (isRecord$61(chunk.error)) {
23939
23863
  const message = asString$26(chunk.error.message) ?? "unknown error";
23940
23864
  state.streamError = {
23941
23865
  vocabulary: "openai",
@@ -23944,20 +23868,20 @@ function processOpenAIStreamLine$1(line, state) {
23944
23868
  };
23945
23869
  throw new LlmError$1(`Command Code stream error: ${message}`, isContextOverflow(chunk.error) ? CONTEXT_OVERFLOW_CODE : "PROVIDER_ERROR");
23946
23870
  }
23947
- const usage = isRecord$60(chunk.usage) ? chunk.usage : void 0;
23871
+ const usage = isRecord$61(chunk.usage) ? chunk.usage : void 0;
23948
23872
  if (usage) {
23949
23873
  state.sawUsage = true;
23950
23874
  const prompt = numberOr$9(usage.prompt_tokens, 0);
23951
- const details = isRecord$60(usage.prompt_tokens_details) ? usage.prompt_tokens_details : void 0;
23875
+ const details = isRecord$61(usage.prompt_tokens_details) ? usage.prompt_tokens_details : void 0;
23952
23876
  const cached = details ? numberOr$9(details.cached_tokens, 0) : 0;
23953
23877
  state.inputTokens = Math.max(0, prompt - cached);
23954
23878
  state.cacheReadTokens = cached;
23955
23879
  state.outputTokens = numberOr$9(usage.completion_tokens, state.outputTokens);
23956
- if (isRecord$60(usage.completion_tokens_details)) state.reasoningTokens = numberOr$9(usage.completion_tokens_details.reasoning_tokens, state.reasoningTokens);
23880
+ if (isRecord$61(usage.completion_tokens_details)) state.reasoningTokens = numberOr$9(usage.completion_tokens_details.reasoning_tokens, state.reasoningTokens);
23957
23881
  }
23958
23882
  const choices = Array.isArray(chunk.choices) ? chunk.choices : [];
23959
- const choice = isRecord$60(choices[0]) ? choices[0] : void 0;
23960
- const delta = isRecord$60(choice?.delta) ? choice.delta : void 0;
23883
+ const choice = isRecord$61(choices[0]) ? choices[0] : void 0;
23884
+ const delta = isRecord$61(choice?.delta) ? choice.delta : void 0;
23961
23885
  if (delta) {
23962
23886
  const reasoning = asString$26(delta.reasoning_content) ?? asString$26(delta.reasoning);
23963
23887
  if (reasoning !== void 0 && reasoning !== "") {
@@ -23985,7 +23909,7 @@ function processOpenAIStreamLine$1(line, state) {
23985
23909
  }
23986
23910
  const toolDeltas = Array.isArray(delta.tool_calls) ? delta.tool_calls : [];
23987
23911
  for (const entry of toolDeltas) {
23988
- if (!isRecord$60(entry)) continue;
23912
+ if (!isRecord$61(entry)) continue;
23989
23913
  out.push(...applyOpenAIToolDelta$1(entry, state));
23990
23914
  }
23991
23915
  }
@@ -23999,7 +23923,7 @@ function processOpenAIStreamLine$1(line, state) {
23999
23923
  }
24000
23924
  function applyOpenAIToolDelta$1(entry, state) {
24001
23925
  const wireIndex = typeof entry.index === "number" ? entry.index : 0;
24002
- const fn = isRecord$60(entry.function) ? entry.function : {};
23926
+ const fn = isRecord$61(entry.function) ? entry.function : {};
24003
23927
  const out = [];
24004
23928
  let call = state.toolCalls.get(wireIndex);
24005
23929
  const incomingId = asString$26(entry.id);
@@ -24074,12 +23998,12 @@ function processAnthropicStreamLine$1(line, state) {
24074
23998
  const payload = trimmed.slice(5).trim();
24075
23999
  if (payload === "" || payload === "[DONE]") return [];
24076
24000
  const event = safeJsonParse$8(payload);
24077
- if (!isRecord$60(event)) return [];
24001
+ if (!isRecord$61(event)) return [];
24078
24002
  const type = asString$26(event.type);
24079
24003
  const out = [];
24080
24004
  if (type === "message_start") {
24081
- const message = isRecord$60(event.message) ? event.message : void 0;
24082
- const usage = message && isRecord$60(message.usage) ? message.usage : void 0;
24005
+ const message = isRecord$61(event.message) ? event.message : void 0;
24006
+ const usage = message && isRecord$61(message.usage) ? message.usage : void 0;
24083
24007
  if (usage) {
24084
24008
  state.sawUsage = true;
24085
24009
  state.inputTokens = numberOr$9(usage.input_tokens, 0);
@@ -24093,7 +24017,7 @@ function processAnthropicStreamLine$1(line, state) {
24093
24017
  }
24094
24018
  if (type === "content_block_start") {
24095
24019
  const contentIndex = numberOr$9(event.index, 0);
24096
- const block = isRecord$60(event.content_block) ? event.content_block : {};
24020
+ const block = isRecord$61(event.content_block) ? event.content_block : {};
24097
24021
  const blockType = asString$26(block.type);
24098
24022
  out.push(...closeCurrent$6(state));
24099
24023
  if (blockType === "tool_use") {
@@ -24143,7 +24067,7 @@ function processAnthropicStreamLine$1(line, state) {
24143
24067
  }
24144
24068
  if (type === "content_block_delta") {
24145
24069
  const contentIndex = numberOr$9(event.index, 0);
24146
- const delta = isRecord$60(event.delta) ? event.delta : {};
24070
+ const delta = isRecord$61(event.delta) ? event.delta : {};
24147
24071
  const deltaType = asString$26(delta.type);
24148
24072
  if (deltaType === "input_json_delta") {
24149
24073
  const pending = state.toolCalls.get(contentIndex);
@@ -24216,10 +24140,10 @@ function processAnthropicStreamLine$1(line, state) {
24216
24140
  return out;
24217
24141
  }
24218
24142
  if (type === "message_delta") {
24219
- const delta = isRecord$60(event.delta) ? event.delta : void 0;
24143
+ const delta = isRecord$61(event.delta) ? event.delta : void 0;
24220
24144
  const stop = delta ? asString$26(delta.stop_reason) : void 0;
24221
24145
  if (stop !== void 0 && stop !== "") state.finishReason = stop;
24222
- const usage = isRecord$60(event.usage) ? event.usage : void 0;
24146
+ const usage = isRecord$61(event.usage) ? event.usage : void 0;
24223
24147
  if (usage) {
24224
24148
  state.sawUsage = true;
24225
24149
  state.outputTokens = numberOr$9(usage.output_tokens, state.outputTokens);
@@ -24231,7 +24155,7 @@ function processAnthropicStreamLine$1(line, state) {
24231
24155
  return closeStream$6(state);
24232
24156
  }
24233
24157
  if (type === "error") {
24234
- const error = isRecord$60(event.error) ? event.error : {};
24158
+ const error = isRecord$61(event.error) ? event.error : {};
24235
24159
  const message = asString$26(error.message) ?? "unknown error";
24236
24160
  state.streamError = {
24237
24161
  vocabulary: "anthropic",
@@ -24277,7 +24201,7 @@ function processResponsesStreamLine(line, state) {
24277
24201
  } catch {
24278
24202
  return [];
24279
24203
  }
24280
- if (!isRecord$60(parsed)) return [];
24204
+ if (!isRecord$61(parsed)) return [];
24281
24205
  const type = typeof parsed.type === "string" ? parsed.type : "";
24282
24206
  if (type === "response.output_text.delta") {
24283
24207
  const delta = typeof parsed.delta === "string" ? parsed.delta : "";
@@ -24304,7 +24228,7 @@ function processResponsesStreamLine(line, state) {
24304
24228
  }];
24305
24229
  }
24306
24230
  if (type === "response.output_item.added") {
24307
- const item = isRecord$60(parsed.item) ? parsed.item : null;
24231
+ const item = isRecord$61(parsed.item) ? parsed.item : null;
24308
24232
  if (item === null || item.type !== "function_call") return [];
24309
24233
  return startResponsesToolCall(state, parsed, item);
24310
24234
  }
@@ -24328,11 +24252,11 @@ function processResponsesStreamLine(line, state) {
24328
24252
  return [];
24329
24253
  }
24330
24254
  if (type === "response.completed" || type === "response.incomplete") {
24331
- const response = isRecord$60(parsed.response) ? parsed.response : null;
24255
+ const response = isRecord$61(parsed.response) ? parsed.response : null;
24332
24256
  if (response !== null) {
24333
24257
  if (response.status === "failed") {
24334
24258
  state.done = true;
24335
- const errorObj = isRecord$60(response.error) ? response.error : null;
24259
+ const errorObj = isRecord$61(response.error) ? response.error : null;
24336
24260
  const detail = errorObj && typeof errorObj.message === "string" ? errorObj.message : typeof response.error === "string" ? response.error : "";
24337
24261
  state.streamError = {
24338
24262
  vocabulary: "responses",
@@ -24345,7 +24269,7 @@ function processResponsesStreamLine(line, state) {
24345
24269
  }
24346
24270
  state.done = true;
24347
24271
  if (type === "response.incomplete") {
24348
- const details = response && isRecord$60(response.incomplete_details) ? response.incomplete_details : null;
24272
+ const details = response && isRecord$61(response.incomplete_details) ? response.incomplete_details : null;
24349
24273
  const reason = details && typeof details.reason === "string" ? details.reason : "";
24350
24274
  state.finishReason = reason === "max_output_tokens" || reason === "length" || reason === "max_tokens" ? "length" : reason || "length";
24351
24275
  } else state.finishReason = "stop";
@@ -24353,8 +24277,8 @@ function processResponsesStreamLine(line, state) {
24353
24277
  }
24354
24278
  if (type === "response.failed" || type === "error") {
24355
24279
  state.done = true;
24356
- const errorObj = isRecord$60(parsed.error) ? parsed.error : isRecord$60(parsed.response) && isRecord$60(parsed.response.error) ? parsed.response.error : null;
24357
- const detail = (typeof parsed.message === "string" ? parsed.message : "") || (errorObj && typeof errorObj.message === "string" ? errorObj.message : "") || (isRecord$60(parsed.response) && typeof parsed.response.error === "string" ? parsed.response.error : typeof parsed.error === "string" ? parsed.error : "");
24280
+ const errorObj = isRecord$61(parsed.error) ? parsed.error : isRecord$61(parsed.response) && isRecord$61(parsed.response.error) ? parsed.response.error : null;
24281
+ const detail = (typeof parsed.message === "string" ? parsed.message : "") || (errorObj && typeof errorObj.message === "string" ? errorObj.message : "") || (isRecord$61(parsed.response) && typeof parsed.response.error === "string" ? parsed.response.error : typeof parsed.error === "string" ? parsed.error : "");
24358
24282
  state.streamError = {
24359
24283
  vocabulary: "responses",
24360
24284
  error: errorObj,
@@ -24442,15 +24366,15 @@ function responsesToolCall(state, key) {
24442
24366
  for (const call of state.toolCalls.values()) if (call.id === toToolCallId(key)) return call;
24443
24367
  }
24444
24368
  function readResponsesUsage(response, state) {
24445
- const usage = isRecord$60(response.usage) ? response.usage : null;
24369
+ const usage = isRecord$61(response.usage) ? response.usage : null;
24446
24370
  if (usage === null) return;
24447
- const cached = isRecord$60(usage.input_tokens_details) ? numberOrZero(usage.input_tokens_details.cached_tokens) : 0;
24448
- const written = isRecord$60(usage.input_tokens_details) ? numberOrZero(usage.input_tokens_details.cache_write_tokens) : 0;
24371
+ const cached = isRecord$61(usage.input_tokens_details) ? numberOrZero(usage.input_tokens_details.cached_tokens) : 0;
24372
+ const written = isRecord$61(usage.input_tokens_details) ? numberOrZero(usage.input_tokens_details.cache_write_tokens) : 0;
24449
24373
  state.inputTokens = Math.max(0, numberOrZero(usage.input_tokens) - cached - written);
24450
24374
  state.cacheReadTokens = cached;
24451
24375
  state.cacheWriteTokens = written;
24452
24376
  state.outputTokens = numberOrZero(usage.output_tokens);
24453
- const outputDetails = isRecord$60(usage.output_tokens_details) ? usage.output_tokens_details : null;
24377
+ const outputDetails = isRecord$61(usage.output_tokens_details) ? usage.output_tokens_details : null;
24454
24378
  if (outputDetails !== null) state.reasoningTokens = numberOrZero(outputDetails.reasoning_tokens);
24455
24379
  state.sawUsage = true;
24456
24380
  }
@@ -24538,7 +24462,7 @@ const ANTHROPIC_IN_BAND_STATUS = {
24538
24462
  * Anything not recognized keeps the mapper's verdict.
24539
24463
  */
24540
24464
  function inBandResponsesCode(error, message) {
24541
- const fields = isRecord$59(error) ? error : {};
24465
+ const fields = isRecord$60(error) ? error : {};
24542
24466
  const rawCode = (asString$25(fields.code) ?? asString$25(fields.type) ?? "").toLowerCase();
24543
24467
  const text = message.toLowerCase();
24544
24468
  if (text.includes("rate limit") || rawCode === "rate_limit" || rawCode === "rate_limit_exceeded") return "RATE_LIMIT";
@@ -24597,13 +24521,13 @@ function reclassifyInBandResponsesError(thrown, rawError, message, classify) {
24597
24521
  }
24598
24522
  /** The wire `error` object of an in-band event, read defensively. */
24599
24523
  function readErrorType(error) {
24600
- if (!isRecord$59(error)) return null;
24524
+ if (!isRecord$60(error)) return null;
24601
24525
  return typeof error.type === "string" ? error.type : null;
24602
24526
  }
24603
24527
  function asString$25(value) {
24604
24528
  return typeof value === "string" ? value : void 0;
24605
24529
  }
24606
- function isRecord$59(value) {
24530
+ function isRecord$60(value) {
24607
24531
  return typeof value === "object" && value !== null && !Array.isArray(value);
24608
24532
  }
24609
24533
  //#endregion
@@ -25209,7 +25133,7 @@ var CommandCodeAdapter = class extends LlmAdapter {
25209
25133
  }
25210
25134
  throw reclassified;
25211
25135
  }
25212
- throw error;
25136
+ throw streamFailure$1(error, signal);
25213
25137
  }
25214
25138
  } finally {
25215
25139
  reader.cancel().catch(() => void 0);
@@ -25217,6 +25141,18 @@ var CommandCodeAdapter = class extends LlmAdapter {
25217
25141
  }
25218
25142
  };
25219
25143
  /**
25144
+ * A body severed mid-stream arrives as undici's bare `TypeError: terminated`,
25145
+ * which the harness otherwise normalizes to non-retryable UNKNOWN. Preserve
25146
+ * existing LlmError verdicts and caller cancellation; classify every other
25147
+ * body-read failure as TRANSPORT and retain its cause chain in the message.
25148
+ */
25149
+ function streamFailure$1(error, signal) {
25150
+ if (error instanceof LlmError) return error;
25151
+ if (signal.aborted) return new LlmError("Command Code stream aborted", "ABORTED", { cause: error });
25152
+ const chain = errorChain(error).trim();
25153
+ return new LlmError(`Command Code stream failed: ${chain === "" ? "the response stream ended unexpectedly" : chain.slice(0, 500)}`, "TRANSPORT", { cause: error });
25154
+ }
25155
+ /**
25220
25156
  * The error one recorded in-band failure becomes, or the mapper's own verdict.
25221
25157
  *
25222
25158
  * Two rules, because this line speaks three in-band vocabularies and they do
@@ -27868,14 +27804,14 @@ const IN_BAND_SERVER = [
27868
27804
  function isAbort$2(error, signal) {
27869
27805
  return signal?.aborted === true || error instanceof Error && error.name === "AbortError";
27870
27806
  }
27871
- function isRecord$58(value) {
27807
+ function isRecord$59(value) {
27872
27808
  return typeof value === "object" && value !== null && !Array.isArray(value);
27873
27809
  }
27874
27810
  function asString$24(value) {
27875
27811
  return typeof value === "string" && value !== "" ? value : void 0;
27876
27812
  }
27877
27813
  function attachmentLabel$3(block) {
27878
- const attachment = isRecord$58(block.attachment) ? block.attachment : void 0;
27814
+ const attachment = isRecord$59(block.attachment) ? block.attachment : void 0;
27879
27815
  return asString$24(attachment?.name) || asString$24(attachment?.attachmentId);
27880
27816
  }
27881
27817
  function unavailableImageText$3(block) {
@@ -27911,7 +27847,7 @@ async function processMessageContent(content, model, attachments, signal) {
27911
27847
  textParts.push(part);
27912
27848
  continue;
27913
27849
  }
27914
- if (!isRecord$58(part)) continue;
27850
+ if (!isRecord$59(part)) continue;
27915
27851
  if (part.type === "text") {
27916
27852
  if (typeof part.text === "string" && part.text !== "") textParts.push(part.text);
27917
27853
  continue;
@@ -27940,7 +27876,7 @@ async function processMessageContent(content, model, attachments, signal) {
27940
27876
  continue;
27941
27877
  }
27942
27878
  const inline = part.source;
27943
- if (isRecord$58(inline)) {
27879
+ if (isRecord$59(inline)) {
27944
27880
  const data = inline.data;
27945
27881
  if (typeof data === "string" && data !== "") {
27946
27882
  images.push(encodeImage(data, asMediaType(inline.mediaType)));
@@ -27981,7 +27917,7 @@ async function toOllamaRequest(options, attachments, signal, declared) {
27981
27917
  const toolResultBlocks = message.content.filter((b) => b.type === "tool-result");
27982
27918
  if (toolResultBlocks.length > 0) {
27983
27919
  for (const block of toolResultBlocks) {
27984
- const toolCallId = String(block.toolCallId ?? (isRecord$58(message.source) ? message.source.callId : "") ?? "");
27920
+ const toolCallId = String(block.toolCallId ?? (isRecord$59(message.source) ? message.source.callId : "") ?? "");
27985
27921
  const processed = await processMessageContent(block.content, options.model, attachments, signal);
27986
27922
  messages.push({
27987
27923
  role: "tool",
@@ -32958,11 +32894,11 @@ const MODELS_PATH$2 = "/models";
32958
32894
  const USAGES_PATH = "/usages";
32959
32895
  /** The service reports money in fixed-point units of 1e-6 cents. */
32960
32896
  const FIXED_POINT_CENTS = 1e6;
32961
- function isRecord$57(value) {
32897
+ function isRecord$58(value) {
32962
32898
  return typeof value === "object" && value !== null && !Array.isArray(value);
32963
32899
  }
32964
32900
  function asRecord$14(value) {
32965
- return isRecord$57(value) ? value : void 0;
32901
+ return isRecord$58(value) ? value : void 0;
32966
32902
  }
32967
32903
  function asString$23(value) {
32968
32904
  if (typeof value === "string" && value.trim() !== "") return value;
@@ -34077,12 +34013,12 @@ async function testConnection$1(store, options = {}) {
34077
34013
  *
34078
34014
  * @module dsh-chatgpt-subscription/tool-schema
34079
34015
  */
34080
- function isRecord$56(value) {
34016
+ function isRecord$57(value) {
34081
34017
  return typeof value === "object" && value !== null && !Array.isArray(value);
34082
34018
  }
34083
34019
  function cloneJsonValue(value) {
34084
34020
  if (Array.isArray(value)) return value.map(cloneJsonValue);
34085
- if (isRecord$56(value)) {
34021
+ if (isRecord$57(value)) {
34086
34022
  const res = {};
34087
34023
  for (const [k, v] of Object.entries(value)) res[k] = cloneJsonValue(v);
34088
34024
  return res;
@@ -34097,7 +34033,7 @@ function resolveLocalJsonPointer(root, ref) {
34097
34033
  let current = root;
34098
34034
  for (const rawPart of ref.slice(2).split("/")) {
34099
34035
  const part = rawPart.replaceAll("~1", "/").replaceAll("~0", "~");
34100
- if (isRecord$56(current)) {
34036
+ if (isRecord$57(current)) {
34101
34037
  if (!Object.prototype.hasOwnProperty.call(current, part)) return { found: false };
34102
34038
  current = current[part];
34103
34039
  } else if (Array.isArray(current)) {
@@ -34113,7 +34049,7 @@ function resolveLocalJsonPointer(root, ref) {
34113
34049
  }
34114
34050
  function derefNode(node, root, visited) {
34115
34051
  if (Array.isArray(node)) return node.map((item) => derefNode(item, root, visited));
34116
- if (isRecord$56(node)) {
34052
+ if (isRecord$57(node)) {
34117
34053
  if (typeof node["$ref"] === "string" && (node["$ref"] === "#" || node["$ref"].startsWith("#/"))) {
34118
34054
  const ref = node["$ref"];
34119
34055
  if (visited.has(ref)) return node;
@@ -34122,7 +34058,7 @@ function derefNode(node, root, visited) {
34122
34058
  visited.add(ref);
34123
34059
  const inlined = derefNode(resolved.value, root, visited);
34124
34060
  visited.delete(ref);
34125
- if (isRecord$56(inlined)) {
34061
+ if (isRecord$57(inlined)) {
34126
34062
  const merged = { ...inlined };
34127
34063
  for (const [k, v] of Object.entries(node)) {
34128
34064
  if (k === "$ref") continue;
@@ -34142,7 +34078,7 @@ function derefNode(node, root, visited) {
34142
34078
  }
34143
34079
  function hasUnresolvedDefinitionRef(node, bucketKey) {
34144
34080
  if (Array.isArray(node)) return node.some((child) => hasUnresolvedDefinitionRef(child, bucketKey));
34145
- if (isRecord$56(node)) {
34081
+ if (isRecord$57(node)) {
34146
34082
  const ref = node["$ref"];
34147
34083
  if (typeof ref === "string" && ref.startsWith(`#/${bucketKey}/`)) return true;
34148
34084
  for (const [k, v] of Object.entries(node)) {
@@ -34173,19 +34109,19 @@ function inferTypeFromValues(values) {
34173
34109
  if (types.size === 1) return types.values().next().value;
34174
34110
  }
34175
34111
  function normalizeSchemaProperties(node) {
34176
- if (!isRecord$56(node)) return;
34177
- if (isRecord$56(node.properties)) {
34178
- for (const propSchema of Object.values(node.properties)) if (isRecord$56(propSchema)) {
34112
+ if (!isRecord$57(node)) return;
34113
+ if (isRecord$57(node.properties)) {
34114
+ for (const propSchema of Object.values(node.properties)) if (isRecord$57(propSchema)) {
34179
34115
  if (!propSchema.type && !propSchema.$ref) {
34180
34116
  if (Array.isArray(propSchema.enum) && propSchema.enum.length > 0) propSchema.type = inferTypeFromValues(propSchema.enum) ?? "string";
34181
34117
  else if (propSchema.const !== void 0) propSchema.type = inferValueType(propSchema.const) ?? "string";
34182
- else if (isRecord$56(propSchema.properties)) propSchema.type = "object";
34118
+ else if (isRecord$57(propSchema.properties)) propSchema.type = "object";
34183
34119
  else if (propSchema.items) propSchema.type = "array";
34184
34120
  }
34185
34121
  normalizeSchemaProperties(propSchema);
34186
34122
  }
34187
34123
  }
34188
- if (isRecord$56(node.items)) normalizeSchemaProperties(node.items);
34124
+ if (isRecord$57(node.items)) normalizeSchemaProperties(node.items);
34189
34125
  else if (Array.isArray(node.items)) for (const item of node.items) normalizeSchemaProperties(item);
34190
34126
  }
34191
34127
  /**
@@ -34193,7 +34129,7 @@ function normalizeSchemaProperties(node) {
34193
34129
  * inlining definitions ($defs/definitions/$ref), and ensuring property types for enums/consts.
34194
34130
  */
34195
34131
  function normalizeKimiToolSchema(schema) {
34196
- if (!isRecord$56(schema)) return {
34132
+ if (!isRecord$57(schema)) return {
34197
34133
  type: "object",
34198
34134
  properties: {}
34199
34135
  };
@@ -34211,7 +34147,7 @@ function stripMetaSchema$1(schema) {
34211
34147
  }
34212
34148
  //#endregion
34213
34149
  //#region src/host/common/prompt-estimate.ts
34214
- function isRecord$55(value) {
34150
+ function isRecord$56(value) {
34215
34151
  return typeof value === "object" && value !== null && !Array.isArray(value);
34216
34152
  }
34217
34153
  /** Tool-call arguments as the JSON string a wire carries, whatever shape they arrived in. */
@@ -34244,7 +34180,7 @@ function estimatedInputTokens(options) {
34244
34180
  const contentCharacters = (content) => {
34245
34181
  if (!Array.isArray(content)) return typeof content === "string" ? content.length : 0;
34246
34182
  return content.reduce((total, block) => {
34247
- if (!isRecord$55(block)) return total;
34183
+ if (!isRecord$56(block)) return total;
34248
34184
  if ((block.type === "text" || block.type === "reasoning") && typeof block.text === "string") return total + block.text.length;
34249
34185
  if (block.type === "tool-result") return total + contentCharacters(block.content);
34250
34186
  if (block.type === "tool-call") {
@@ -34387,7 +34323,7 @@ function videoOmissionText$1(reason, label) {
34387
34323
  }
34388
34324
  //#endregion
34389
34325
  //#region src/host/common/video-request.ts
34390
- function isRecord$54(value) {
34326
+ function isRecord$55(value) {
34391
34327
  return typeof value === "object" && value !== null && !Array.isArray(value);
34392
34328
  }
34393
34329
  function asString$22(value) {
@@ -34395,14 +34331,14 @@ function asString$22(value) {
34395
34331
  }
34396
34332
  function videoAttachmentOf(block) {
34397
34333
  const attachment = block.attachment;
34398
- if (!isRecord$54(attachment)) return void 0;
34334
+ if (!isRecord$55(attachment)) return void 0;
34399
34335
  if (typeof attachment.attachmentId !== "string") return void 0;
34400
34336
  return attachment;
34401
34337
  }
34402
34338
  function collectVideoRefs(content, refs) {
34403
34339
  if (!Array.isArray(content)) return;
34404
34340
  for (const block of content) {
34405
- if (!isRecord$54(block) || block.type !== "video") continue;
34341
+ if (!isRecord$55(block) || block.type !== "video") continue;
34406
34342
  const attachment = videoAttachmentOf(block);
34407
34343
  if (attachment) refs.set(attachment.attachmentId, attachment);
34408
34344
  }
@@ -34417,7 +34353,7 @@ function requestVideoBytes(block) {
34417
34353
  function collectRequestVideoBytes(content, lengths) {
34418
34354
  if (!Array.isArray(content)) return;
34419
34355
  for (const block of content) {
34420
- if (!isRecord$54(block) || block.type !== "video") continue;
34356
+ if (!isRecord$55(block) || block.type !== "video") continue;
34421
34357
  const bytes = requestVideoBytes(block);
34422
34358
  if (bytes !== void 0) lengths.push(bytes);
34423
34359
  }
@@ -34461,7 +34397,7 @@ function isAbortLike(error, signal) {
34461
34397
  }
34462
34398
  /** True when the request carries any video occurrence at all. */
34463
34399
  function requestHasVideo(options) {
34464
- return options.messages.some((message) => Array.isArray(message.content) && message.content.some((block) => isRecord$54(block) && block.type === "video"));
34400
+ return options.messages.some((message) => Array.isArray(message.content) && message.content.some((block) => isRecord$55(block) && block.type === "video"));
34465
34401
  }
34466
34402
  function omittedVideoText(omit, block) {
34467
34403
  return omit("unreadable", videoBlockLabel(block));
@@ -34496,7 +34432,7 @@ function offloadOldestRequestVideos(options, maxBytes) {
34496
34432
  if (remaining.count === 0 || !Array.isArray(message.content)) return message;
34497
34433
  let replaced = false;
34498
34434
  const content = message.content.map((block) => {
34499
- if (remaining.count === 0 || !isRecord$54(block) || block.type !== "video") return block;
34435
+ if (remaining.count === 0 || !isRecord$55(block) || block.type !== "video") return block;
34500
34436
  if (requestVideoBytes(block) === void 0) return block;
34501
34437
  remaining.count -= 1;
34502
34438
  replaced = true;
@@ -34569,6 +34505,47 @@ function toolArgumentLimit(toolName) {
34569
34505
  if (toolName === "write" || toolName === "edit" || toolName === "code_run" || toolName === "run_code") return LARGE_PROGRAM_ARGUMENT_LIMIT;
34570
34506
  return DEFAULT_ARGUMENT_LIMIT;
34571
34507
  }
34508
+ function isRecord$54(value) {
34509
+ return typeof value === "object" && value !== null && !Array.isArray(value);
34510
+ }
34511
+ /**
34512
+ * Repair only a complete ask_user_question call whose optional field names carry
34513
+ * surrounding whitespace. One unambiguous source key and the expected value type
34514
+ * are required; collisions, underscore variants, and all other tools stay intact
34515
+ * so the execution guard can still reject payloads whose meaning is unclear.
34516
+ */
34517
+ function repairAskUserQuestionArgumentWhitespace(toolName, argumentText) {
34518
+ if (toolName !== "ask_user_question") return argumentText;
34519
+ let parsed;
34520
+ try {
34521
+ parsed = JSON.parse(argumentText);
34522
+ } catch {
34523
+ return argumentText;
34524
+ }
34525
+ if (!isRecord$54(parsed) || !Array.isArray(parsed.questions)) return argumentText;
34526
+ let changed = false;
34527
+ const questions = parsed.questions.map((candidate) => {
34528
+ if (!isRecord$54(candidate)) return candidate;
34529
+ let repaired;
34530
+ for (const canonical of ["header", "options"]) {
34531
+ if (Object.prototype.hasOwnProperty.call(candidate, canonical)) continue;
34532
+ const sources = Object.keys(candidate).filter((key) => key !== canonical && key.trim() === canonical);
34533
+ if (sources.length !== 1) continue;
34534
+ const source = sources[0];
34535
+ const value = candidate[source];
34536
+ if (canonical === "header" ? typeof value !== "string" : !Array.isArray(value)) continue;
34537
+ repaired ??= { ...candidate };
34538
+ delete repaired[source];
34539
+ repaired[canonical] = value;
34540
+ changed = true;
34541
+ }
34542
+ return repaired ?? candidate;
34543
+ });
34544
+ return changed ? JSON.stringify({
34545
+ ...parsed,
34546
+ questions
34547
+ }) : argumentText;
34548
+ }
34572
34549
  /** Split `header_comment`, `header_unused`, and `header___` into one family. */
34573
34550
  function keyFamily(key) {
34574
34551
  const suffix = /_(?:comment|unused)$|_+$/.exec(key);
@@ -36415,6 +36392,10 @@ function appendGuardedArguments(state, call, delta) {
36415
36392
  call.guard ??= new KimiToolArgumentGuard(call.name);
36416
36393
  throwToolGuardViolation(state, call, call.guard.observe(delta));
36417
36394
  }
36395
+ function completedToolArguments(call) {
36396
+ const argumentText = call.arguments === "" ? "{}" : call.arguments;
36397
+ return repairAskUserQuestionArgumentWhitespace(call.name, argumentText);
36398
+ }
36418
36399
  function closeToolCalls$5(state) {
36419
36400
  const out = [];
36420
36401
  for (const [wireIndex, call] of [...state.toolCalls.entries()].sort((a, b) => a[0] - b[0])) {
@@ -36423,7 +36404,7 @@ function closeToolCalls$5(state) {
36423
36404
  type: "tool-call",
36424
36405
  id: toToolCallId(state.toolCallIds.normalize(call.id)),
36425
36406
  name: call.name,
36426
- arguments: call.arguments === "" ? "{}" : call.arguments
36407
+ arguments: completedToolArguments(call)
36427
36408
  };
36428
36409
  state.blocks[call.blockIndex] = block;
36429
36410
  out.push({
@@ -36562,7 +36543,7 @@ function applyOpenAIToolDelta(entry, state) {
36562
36543
  type: "tool-call",
36563
36544
  id: toToolCallId(state.toolCallIds.normalize(call.id)),
36564
36545
  name: call.name,
36565
- arguments: call.arguments === "" ? "{}" : call.arguments
36546
+ arguments: completedToolArguments(call)
36566
36547
  };
36567
36548
  state.blocks[call.blockIndex] = closedBlock;
36568
36549
  out.push({
@@ -36760,7 +36741,7 @@ function processAnthropicStreamLine(line, state) {
36760
36741
  type: "tool-call",
36761
36742
  id: toToolCallId(state.toolCallIds.normalize(pending.id)),
36762
36743
  name: pending.name,
36763
- arguments: pending.arguments === "" ? "{}" : pending.arguments
36744
+ arguments: completedToolArguments(pending)
36764
36745
  };
36765
36746
  state.blocks[pending.blockIndex] = block;
36766
36747
  out.push({
@@ -50329,7 +50310,7 @@ function createKimiToolArgumentRecoveryMessage(code) {
50329
50310
  return createUserMessage$1({
50330
50311
  content: [{
50331
50312
  type: "text",
50332
- text: repeated ? "The previous tool call was stopped because its JSON arguments contained a runaway repeated-key family. Do not resume, reuse, or repair that payload. If you still need a tool, make one fresh call with minimal valid JSON and only the exact property names in its schema. For ask_user_question, use only questions, id, question, header, options, label, description, and multi_select as applicable; never append documentation annotations or underscores to property names. If no tool call is necessary, continue with the evidence already available or explain the blocker in text." : "The previous tool call was stopped because its arguments exceeded the route byte budget. Do not resend the same payload. If the existing evidence is sufficient, finish in text. Otherwise make one fresh call with the smallest sufficient arguments; for a large file or program, use a legal smaller/chunked approach instead of repeating the oversized content."
50313
+ text: repeated ? "The previous tool call was stopped because its JSON arguments contained a runaway repeated-key family. Do not resume, reuse, or repair that payload. If you still need a tool, make one fresh call with minimal valid JSON and only the exact property names in its schema. For ask_user_question, use only questions, id, question, header, options, label, description, and multi_select as applicable. Property names are case-sensitive and must not carry surrounding whitespace, documentation annotations, or appended underscores. A minimal choices call is {\"questions\":[{\"id\":\"choice\",\"question\":\"Which choice?\",\"options\":[{\"label\":\"A\"}]}]}. If no tool call is necessary, continue with the evidence already available or explain the blocker in text." : "The previous tool call was stopped because its arguments exceeded the route byte budget. Do not resend the same payload. If the existing evidence is sufficient, finish in text. Otherwise make one fresh call with the smallest sufficient arguments; for a large file or program, use a legal smaller/chunked approach instead of repeating the oversized content."
50333
50314
  }],
50334
50315
  source: {
50335
50316
  kind: PLUGIN_MESSAGE_SOURCE_KIND,
@@ -71941,6 +71922,19 @@ async function probeConnection$2(accountPool, fetchFn, env) {
71941
71922
  }
71942
71923
  //#endregion
71943
71924
  //#region src/host/cline-pass/types.ts
71925
+ /**
71926
+ * Static facts about the Cline Pass subscription and its gateway.
71927
+ *
71928
+ * The upstream is an OpenAI-compatible `chat/completions` endpoint
71929
+ * (`https://api.cline.bot/api/v1`). Routing is always decided by that gateway;
71930
+ * this plugin does not send client-side provider selection fields.
71931
+ *
71932
+ * The model table below is transcribed from the Cline Pass subscription list and
71933
+ * the public `models.dev` catalog. It is a fallback, not a ceiling: a model the
71934
+ * live catalog scan discovers is described by what that scan published, and a
71935
+ * model this release has never heard of is adopted with conservative metadata
71936
+ * rather than hidden.
71937
+ */
71944
71938
  const PROVIDER_ID$5 = "cline-pass";
71945
71939
  const PROVIDER_NAME$5 = "Cline Pass";
71946
71940
  /** Default gateway. Overridable per deployment and per account. */
@@ -71951,39 +71945,16 @@ const RECOMMENDED_MODELS_URL = "https://api.cline.bot/api/v1/ai/cline/recommende
71951
71945
  const VERCEL_MODELS_URL = "https://ai-gateway.vercel.sh/v1/models";
71952
71946
  /** The community model registry, a metadata backstop. */
71953
71947
  const MODELS_DEV_URL = "https://models.dev/api.json";
71954
- /** OpenRouter's public API, used only for direct-pipeline endpoint detail. */
71955
- const OPENROUTER_API = "https://openrouter.ai/api/v1";
71956
71948
  /** Authenticated sub-paths on the gateway. */
71957
71949
  const USAGE_LIMITS_PATH = "/users/me/plan/usage-limits";
71958
71950
  /** Conservative context capacity for a model no catalog describes. */
71959
71951
  const DEFAULT_CONTEXT_WINDOW$2 = 128e3;
71960
- /**
71961
- * Per-request output budget when the caller states none.
71962
- *
71963
- * A budget, not a ceiling: the harness reserves it as completion room before it
71964
- * compacts, so this decides how much of the window stays available. 64k keeps
71965
- * the reserve far below the compaction ratio while leaving room for a
71966
- * tool-calling agent's longest turn.
71967
- */
71952
+ /** Per-request output budget when the caller states none. */
71968
71953
  const DEFAULT_MAX_TOKENS$1 = 64e3;
71969
- /**
71970
- * Idle budget for one Cline Pass stream — the default a fresh install starts
71971
- * from, overridable per account.
71972
- *
71973
- * Strictly inside the transport's own 300 s stream timeout; see
71974
- * `host/common/idle-watchdog.ts` for the measured basis.
71975
- */
71954
+ /** Idle budget for one Cline Pass stream, overridable per account. */
71976
71955
  const DEFAULT_STREAM_IDLE_TIMEOUT_MS$1 = 12e4;
71977
- /**
71978
- * How long one account-level refusal keeps an account out of the pool.
71979
- *
71980
- * Only the two refusals that are about the ACCOUNT are listed: a transient 429
71981
- * is answered by the channel retry, and standing an account down for it would
71982
- * cost capacity the request never proved was gone.
71983
- */
71956
+ /** How long one account-level refusal keeps an account out of the pool. */
71984
71957
  const POOL_COOLDOWN_MS = 15 * 6e4;
71985
- /** How many channels one model's list may hold. */
71986
- const MAX_UPSTREAMS = 64;
71987
71958
  /** Reasoning levels the gateway accepts for every reasoning-capable model. */
71988
71959
  const REASONING_EFFORTS = [
71989
71960
  {
@@ -72022,13 +71993,7 @@ const REASONING_EFFORTS = [
72022
71993
  description: "Reserve for the hardest quality-first tasks."
72023
71994
  }
72024
71995
  ];
72025
- /**
72026
- * Published metadata for the shipped Cline Pass models.
72027
- *
72028
- * `name` mirrors the provider's own label where one is published and falls back
72029
- * to the model id. `maxTokens` is the published output ceiling, used to clamp the
72030
- * configured request budget rather than taken as the budget itself.
72031
- */
71996
+ /** Published metadata for the shipped Cline Pass models. */
72032
71997
  const MODEL_CATALOG = Object.freeze({
72033
71998
  "cline-pass/deepseek-v4.1-flash-1017": {
72034
71999
  name: "DeepSeek V4.1 Flash 1017",
@@ -72041,8 +72006,7 @@ const MODEL_CATALOG = Object.freeze({
72041
72006
  "high",
72042
72007
  "max"
72043
72008
  ],
72044
- input: ["text", "image"],
72045
- gatewayHas: ["vision", "implicit-caching"]
72009
+ input: ["text", "image"]
72046
72010
  },
72047
72011
  "cline-pass/deepseek-v4.1-flash": {
72048
72012
  name: "DeepSeek V4.1 Flash",
@@ -72206,36 +72170,6 @@ const DEFAULT_MODELS = Object.freeze(Object.keys(MODEL_CATALOG));
72206
72170
  function catalogEntry(model) {
72207
72171
  return MODEL_CATALOG[model];
72208
72172
  }
72209
- /** The capability filter a model needs by default; empty for all others. */
72210
- function defaultGatewayHas(model) {
72211
- return [...catalogEntry(model)?.gatewayHas ?? []];
72212
- }
72213
- /**
72214
- * Bound one pin's capability filter, the way channels are bounded.
72215
- *
72216
- * Applied on read and again on the wire: `has` is copied into every chat request
72217
- * body, so a filter list is request payload on every turn, not a private note.
72218
- */
72219
- function capGatewayHas(names) {
72220
- const capped = [];
72221
- for (const name of names) {
72222
- const trimmed = name.trim();
72223
- if (trimmed === "" || trimmed.length > 64) continue;
72224
- if (!capped.includes(trimmed)) capped.push(trimmed);
72225
- if (capped.length >= 16) break;
72226
- }
72227
- return capped;
72228
- }
72229
- /** The default pin: automatic routing, no exclusions, model-default capabilities. */
72230
- function defaultPin(model = "") {
72231
- return {
72232
- upstreams: [],
72233
- exclude: [],
72234
- pinMode: "strict",
72235
- sort: "",
72236
- has: defaultGatewayHas(model)
72237
- };
72238
- }
72239
72173
  //#endregion
72240
72174
  //#region src/host/cline-pass/token-store.ts
72241
72175
  /** Cline's own clients send OAuth access tokens with this prefix. */
@@ -72383,27 +72317,6 @@ var FileCredentialStore$1 = class {
72383
72317
  await this.backend.clear();
72384
72318
  }
72385
72319
  };
72386
- /** One pin as stored, validated; a malformed row falls back to the default. */
72387
- function readPin(value, model) {
72388
- if (typeof value !== "object" || value === null || Array.isArray(value)) return defaultPin(model);
72389
- const record = value;
72390
- return {
72391
- upstreams: Array.isArray(record.upstreams) ? record.upstreams.filter((entry) => typeof entry === "string" && entry.length > 0) : [],
72392
- exclude: Array.isArray(record.exclude) ? record.exclude.filter((entry) => typeof entry === "string" && entry.length > 0) : [],
72393
- pinMode: record.pinMode === "preferred" ? "preferred" : "strict",
72394
- sort: typeof record.sort === "string" ? record.sort : "",
72395
- has: Array.isArray(record.has) ? capGatewayHas(record.has.filter((entry) => typeof entry === "string" && entry.trim().length > 0).map((entry) => entry.trim())) : defaultGatewayHas(model)
72396
- };
72397
- }
72398
- function readPins(value) {
72399
- if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
72400
- const pins = {};
72401
- for (const [model, pin] of Object.entries(value)) {
72402
- if (typeof model !== "string" || model.length === 0) continue;
72403
- pins[model] = readPin(pin, model);
72404
- }
72405
- return pins;
72406
- }
72407
72320
  function readNumberOverrides$1(value) {
72408
72321
  if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
72409
72322
  const overrides = {};
@@ -72461,14 +72374,13 @@ function promoteInUseCatalogRows(models, enabledModelIds, pins, contextWindowOve
72461
72374
  function parseClinePassModelSettings(value) {
72462
72375
  const record = typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
72463
72376
  const enabledModelIds = record.enabledModelIds === null ? null : Array.isArray(record.enabledModelIds) ? record.enabledModelIds.filter((id) => typeof id === "string") : null;
72464
- const pins = readPins(record.pins);
72377
+ const legacyPins = typeof record.pins === "object" && record.pins !== null && !Array.isArray(record.pins) ? record.pins : {};
72465
72378
  const contextWindowOverrides = readNumberOverrides$1(record.contextWindowOverrides);
72466
72379
  return {
72467
72380
  enabled: record.enabled !== false,
72468
72381
  baseURL: typeof record.baseURL === "string" && record.baseURL.trim() !== "" ? record.baseURL.trim() : DEFAULT_BASE_URL,
72469
72382
  enabledModelIds,
72470
- catalogModels: promoteInUseCatalogRows(readCatalogModels$1(record.catalogModels), enabledModelIds, pins, contextWindowOverrides),
72471
- pins,
72383
+ catalogModels: promoteInUseCatalogRows(readCatalogModels$1(record.catalogModels), enabledModelIds, legacyPins, contextWindowOverrides),
72472
72384
  hiddenModels: Array.isArray(record.hiddenModels) ? record.hiddenModels.filter((id) => typeof id === "string") : [],
72473
72385
  contextWindowOverrides,
72474
72386
  defaultContextWindow: positiveInteger$1(record.defaultContextWindow, DEFAULT_CONTEXT_WINDOW$2),
@@ -72477,7 +72389,6 @@ function parseClinePassModelSettings(value) {
72477
72389
  streamIdleTimeoutMs: positiveInteger$1(record.streamIdleTimeoutMs, DEFAULT_STREAM_IDLE_TIMEOUT_MS$1),
72478
72390
  historyLimit: positiveInteger$1(record.historyLimit, 100),
72479
72391
  exposeCatalog: record.exposeCatalog === true,
72480
- pinSpelling: typeof record.pinSpelling === "string" && record.pinSpelling.length > 0 ? record.pinSpelling : "both",
72481
72392
  exposeTools: record.exposeTools === true
72482
72393
  };
72483
72394
  }
@@ -72560,13 +72471,12 @@ var ClinePassModelSettingsStore = class {
72560
72471
  const next = {
72561
72472
  ...current,
72562
72473
  ...patch,
72563
- pins: patch.pins === void 0 ? current.pins : patch.pins,
72564
72474
  contextWindowOverrides: patch.contextWindowOverrides === void 0 ? current.contextWindowOverrides : patch.contextWindowOverrides
72565
72475
  };
72566
72476
  await this.write(next);
72567
72477
  return next;
72568
72478
  }
72569
- /** Record a catalog sync without touching the user's selection or pins. */
72479
+ /** Record a catalog sync without touching the user's selection. */
72570
72480
  async storeCatalog(models) {
72571
72481
  const current = await this.read();
72572
72482
  return await this.write({
@@ -72574,27 +72484,6 @@ var ClinePassModelSettingsStore = class {
72574
72484
  catalogModels: models
72575
72485
  });
72576
72486
  }
72577
- /** Store one model's pin; an empty pin list returns it to automatic routing. */
72578
- async setPin(model, pin) {
72579
- const current = await this.read();
72580
- return await this.write({
72581
- ...current,
72582
- pins: {
72583
- ...current.pins,
72584
- [model]: pin
72585
- }
72586
- });
72587
- }
72588
- /** Drop one model's pin entirely. */
72589
- async clearPin(model) {
72590
- const current = await this.read();
72591
- const pins = { ...current.pins };
72592
- delete pins[model];
72593
- return await this.write({
72594
- ...current,
72595
- pins
72596
- });
72597
- }
72598
72487
  /** Store or clear (null) one model's context-window override. */
72599
72488
  async setContextWindowOverride(model, contextWindow) {
72600
72489
  const current = await this.read();
@@ -73246,9 +73135,8 @@ function resolveModelInfo$1(model, options) {
73246
73135
  *
73247
73136
  * The line is API-key based: there is no OAuth flow, no token expiry, and no
73248
73137
  * per-account identity beyond the key and the alias a user gives it. What the
73249
- * card does render beyond the shared account facts is the routing observation
73250
- * this plugin makes about each model (pipeline, discovered channels, per-channel
73251
- * verdicts) and the per-model pin the user stores. None of it is a credential.
73138
+ * card does render beyond the shared account facts is response routing observed
73139
+ * from each model. None of it is a credential, and none of it controls routing.
73252
73140
  */
73253
73141
  const CLINE_PASS_PROVIDER_ID = "cline-pass";
73254
73142
  const CLINE_PASS_PROVIDER_NAME = "Cline Pass";
@@ -73259,8 +73147,8 @@ const CLINE_PASS_ROUTE_PREFIX = "/cline-pass/api";
73259
73147
  * When Cline routes a model id onto the VMC fallback net, the serving channel
73260
73148
  * reports itself as `openai-compatible-private` and the resolved slug moves
73261
73149
  * under `private/…-contributor`. Answers from it may be used for training and
73262
- * carry no zero-data-retention guarantee, so a pin landing there is a fact the
73263
- * user must see, not a channel like any other.
73150
+ * carry no zero-data-retention guarantee, so an answer served there is a fact
73151
+ * the user must see.
73264
73152
  */
73265
73153
  const CLINE_PASS_ANONYMOUS_UPSTREAMS = Object.freeze(["openai-compatible-private"]);
73266
73154
  /** Whether a channel name or resolved slug names the anonymous contributor route. */
@@ -73270,10 +73158,6 @@ function isClinePassAnonymousUpstream(name, canonicalSlug) {
73270
73158
  const slug = String(canonicalSlug ?? "").toLowerCase();
73271
73159
  return slug.startsWith("private/") || slug.includes("-contributor");
73272
73160
  }
73273
- /** Whether a submitted pin mode names one of the two accepted modes. */
73274
- function isClinePassPinMode(value) {
73275
- return value === "strict" || value === "preferred";
73276
- }
73277
73161
  /** Human label for the gateway's quota-window spelling. */
73278
73162
  function clinePassWindowLabel(type) {
73279
73163
  switch (type) {
@@ -73319,15 +73203,9 @@ function clinePassAccountQuota(reading) {
73319
73203
  //#endregion
73320
73204
  //#region src/host/cline-pass/protocol.ts
73321
73205
  /**
73322
- * Cline Pass wire protocol: pipeline detection, pin injection, failover
73323
- * expansion, and error classification. Every function here is pure.
73324
- *
73325
- * The two pipelines spell a pin differently:
73326
- * - **direct** (OpenRouter): top-level `provider.only/order/sort`.
73327
- * - **planner** (Vercel AI Gateway): only `providerOptions.gateway.*` survives.
73328
- *
73329
- * Ported from the MIT-licensed `dsh-cline-pass` plugin's protocol module, whose
73330
- * routing behavior reimplements the MIT-licensed `cline-pass-switcher` findings.
73206
+ * Cline Pass wire protocol: response routing observation and error parsing.
73207
+ * Client-side upstream selection is deliberately not part of this module; Cline
73208
+ * owns routing and every request uses its automatic route.
73331
73209
  *
73332
73210
  * @module dsh-chatgpt-subscription/cline-pass-protocol
73333
73211
  */
@@ -73392,24 +73270,13 @@ function parseRouting(json) {
73392
73270
  anonymous: isClinePassAnonymousUpstream(finalProvider ?? "", canonicalSlug ?? "")
73393
73271
  };
73394
73272
  }
73395
- /**
73396
- * Nodes one payload walk may visit before giving up.
73397
- *
73398
- * The hunts run per streamed frame, and a frame is small, but a pathological
73399
- * payload must not turn a cheap re-read into an unbounded walk.
73400
- */
73273
+ /** Nodes one payload walk may visit before giving up. */
73401
73274
  const HUNT_NODE_BUDGET = 4e3;
73402
73275
  /** `provider_metadata` of one node, when present. */
73403
73276
  function providerMetadataOf(node) {
73404
73277
  return isRecord$26(node.provider_metadata) ? node.provider_metadata : null;
73405
73278
  }
73406
- /**
73407
- * Depth-bounded hunt for the gateway's routing block anywhere in one payload.
73408
- *
73409
- * The fast paths (`message`/`delta`/`payload.provider_metadata.gateway`) are
73410
- * checked by the caller first; this walk covers the nestings between the shapes
73411
- * seen so far, so a frame the fast path does not know still yields its routing.
73412
- */
73279
+ /** Depth-bounded hunt for the gateway's routing block anywhere in one payload. */
73413
73280
  function huntRouting(node, depth = 0, budget = { left: HUNT_NODE_BUDGET }) {
73414
73281
  if (depth > 8 || budget.left <= 0 || node === null || typeof node !== "object") return null;
73415
73282
  budget.left -= 1;
@@ -73430,11 +73297,7 @@ function huntRouting(node, depth = 0, budget = { left: HUNT_NODE_BUDGET }) {
73430
73297
  }
73431
73298
  return null;
73432
73299
  }
73433
- /**
73434
- * Read the first-party DeepSeek fingerprint wherever `provider_metadata`
73435
- * carries it. Absent means the answer did not prove a first-party upstream —
73436
- * the anonymous contributor route carries no `deepseek` namespace at all.
73437
- */
73300
+ /** Read the first-party DeepSeek fingerprint wherever `provider_metadata` carries it. */
73438
73301
  function huntFingerprint(node, depth = 0, budget = { left: HUNT_NODE_BUDGET }) {
73439
73302
  if (depth > 8 || budget.left <= 0 || node === null || typeof node !== "object") return null;
73440
73303
  budget.left -= 1;
@@ -73461,282 +73324,6 @@ function huntFingerprint(node, depth = 0, budget = { left: HUNT_NODE_BUDGET }) {
73461
73324
  function slugify(value) {
73462
73325
  return String(value).toLowerCase().replace(/\s+/g, "-");
73463
73326
  }
73464
- /** OpenRouter's names for the three sort metrics. */
73465
- const OPENROUTER_SORT = Object.freeze({
73466
- cost: "price",
73467
- ttft: "latency",
73468
- tps: "throughput"
73469
- });
73470
- /**
73471
- * Channels the two routers spell differently, as `[planner, direct]` pairs.
73472
- *
73473
- * Z.AI is `zai` to the Vercel gateway and `z-ai` to OpenRouter. Writing one name
73474
- * into both spellings matters: a request that lands on the direct pipeline
73475
- * carries `provider.only` to OpenRouter, where an unknown provider is refused
73476
- * rather than ignored.
73477
- */
73478
- const CHANNEL_ALIASES = Object.freeze([["zai", "z-ai"]]);
73479
- /**
73480
- * Translate a channel name into the spelling one pipeline uses.
73481
- * @param name - the configured channel name, in either spelling.
73482
- * @param pipeline - `'planner'` or `'direct'`.
73483
- * @returns the name that pipeline expects; unknown names pass through.
73484
- */
73485
- function channelNameFor(name, pipeline) {
73486
- const needle = normalizeSlug(name);
73487
- for (const [planner, direct] of CHANNEL_ALIASES) {
73488
- if (normalizeSlug(planner) === needle) return pipeline === "direct" ? direct : planner;
73489
- if (normalizeSlug(direct) === needle) return pipeline === "planner" ? planner : direct;
73490
- }
73491
- return name;
73492
- }
73493
- /**
73494
- * Normalize a configured sort into a wire value or null.
73495
- *
73496
- * Two spellings mean "no sort" and both must be dropped before the request is
73497
- * built: the settings schema stores an empty string, and `none` is the
73498
- * documented "clear it" value. Neither is a metric, and the gateway rejects them
73499
- * with HTTP 400.
73500
- */
73501
- function normalizeSort(value) {
73502
- if (typeof value !== "string") return null;
73503
- const sort = value.trim();
73504
- return sort.length === 0 || sort === "none" ? null : sort;
73505
- }
73506
- /**
73507
- * Normalize a configured pin mode to the one value the router compares against.
73508
- * @param value - the configured pin mode, as stored.
73509
- * @returns `'strict'` or `'preferred'`.
73510
- */
73511
- function normalizePinMode(value) {
73512
- return String(value ?? "").trim().toLowerCase() === "preferred" ? "preferred" : "strict";
73513
- }
73514
- /**
73515
- * The channel vocabulary one spelling should be resolved against.
73516
- *
73517
- * The two pipelines sit behind different routers and publish different channel
73518
- * lists, so the merged list is the wrong basis for an allow-list.
73519
- */
73520
- function knownChannels(meta, pipeline) {
73521
- const scoped = meta?.channels?.[pipeline];
73522
- if (Array.isArray(scoped) && scoped.length > 0) return scoped;
73523
- return Array.isArray(meta?.upstreams) ? meta.upstreams : [];
73524
- }
73525
- /**
73526
- * Write one attempt's upstream preference into a request body.
73527
- *
73528
- * Excludes are compiled into an `only` allow-list because the gateway ignores
73529
- * the exclude/ignore fields.
73530
- *
73531
- * Both spellings are written by default. A pin is honored only by the pipeline
73532
- * that owns the spelling, and the pipeline a model runs on is decided by the
73533
- * gateway and can differ between calls, so writing just the spelling the last
73534
- * probe observed means the pin silently evaporates the moment that changes. Each
73535
- * pipeline ignores the other's field, which is what makes writing both safe.
73536
- * `spelling: 'detected'` restores the old single-spelling behavior.
73537
- *
73538
- * @returns a new body with the pin applied.
73539
- */
73540
- function injectPrefs(body, meta, attempt) {
73541
- const next = { ...body };
73542
- if (attempt === void 0) return next;
73543
- const upstream = attempt.upstream;
73544
- const orderRest = attempt.orderRest ?? [];
73545
- const excludeList = attempt.excludeList ?? [];
73546
- const strict = attempt.strict !== false;
73547
- const sort = normalizeSort(attempt.sort);
73548
- const has = capGatewayHas((attempt.has ?? []).filter((name) => typeof name === "string"));
73549
- const excluded = excludeList.filter((name) => normalizeSlug(name) !== normalizeSlug(upstream ?? ""));
73550
- const excludedIds = new Set(excluded.map(normalizeSlug));
73551
- const spell = (names, pipeline) => names.map((name) => channelNameFor(name, pipeline));
73552
- const gatewayAllow = excluded.length > 0 ? knownChannels(meta, "planner").filter((name) => !excludedIds.has(normalizeSlug(name))) : null;
73553
- const openRouterAllow = excluded.length > 0 ? knownChannels(meta, "direct").filter((name) => !excludedIds.has(normalizeSlug(name))) : null;
73554
- const pipeline = meta?.pipeline ?? null;
73555
- const both = attempt.spelling !== "detected";
73556
- const useGateway = both || pipeline === "planner" || pipeline === null;
73557
- const useOpenRouter = both || pipeline === "direct" || pipeline === null;
73558
- const gatewayUsable = useGateway && (upstream !== null || sort !== null || has.length > 0 || gatewayAllow !== null && gatewayAllow.length > 0);
73559
- const openRouterUsable = useOpenRouter && (upstream !== null || sort !== null || excluded.length > 0 || openRouterAllow !== null && openRouterAllow.length > 0);
73560
- if (!gatewayUsable && !openRouterUsable) return next;
73561
- if (gatewayUsable) {
73562
- const gateway = {};
73563
- if (upstream !== null) if (strict) gateway.only = spell([upstream], "planner");
73564
- else {
73565
- gateway.order = spell([upstream, ...orderRest], "planner");
73566
- if (gatewayAllow !== null && gatewayAllow.length > 0) gateway.only = spell(gatewayAllow, "planner");
73567
- }
73568
- else if (gatewayAllow !== null && gatewayAllow.length > 0) gateway.only = spell(gatewayAllow, "planner");
73569
- if (sort !== null) gateway.sort = sort;
73570
- if (has.length > 0) gateway.has = [...has];
73571
- const providerOptions = isRecord$26(next.providerOptions) ? next.providerOptions : {};
73572
- const currentGateway = isRecord$26(providerOptions.gateway) ? providerOptions.gateway : {};
73573
- next.providerOptions = {
73574
- ...providerOptions,
73575
- gateway: {
73576
- ...currentGateway,
73577
- ...gateway
73578
- }
73579
- };
73580
- }
73581
- if (openRouterUsable) {
73582
- const provider = isRecord$26(next.provider) ? { ...next.provider } : {};
73583
- if (upstream !== null) if (strict) provider.only = spell([upstream], "direct");
73584
- else {
73585
- provider.order = spell([upstream, ...orderRest], "direct");
73586
- if (openRouterAllow !== null && openRouterAllow.length > 0) provider.only = spell(openRouterAllow, "direct");
73587
- }
73588
- else if (openRouterAllow !== null && openRouterAllow.length > 0) provider.only = spell(openRouterAllow, "direct");
73589
- if (sort !== null) provider.sort = OPENROUTER_SORT[sort] ?? sort;
73590
- if (excluded.length > 0) provider.ignore = spell(excluded, "direct");
73591
- next.provider = provider;
73592
- }
73593
- return next;
73594
- }
73595
- /**
73596
- * Read back whether the router honored one attempt's pin.
73597
- *
73598
- * A 200 is not evidence that the pin was applied: an unknown or unavailable
73599
- * `only` value is dropped by the router, which then serves the request from
73600
- * another channel. The only honest test is the channel the response reports.
73601
- */
73602
- function pinAdherence(attempt, routing) {
73603
- const expected = attempt.upstream;
73604
- const excluded = (attempt.excludeList ?? []).filter((name) => normalizeSlug(name) !== normalizeSlug(expected ?? "")).map(normalizeSlug);
73605
- const raw = routing?.finalProvider ?? null;
73606
- const actual = raw === null || raw === void 0 || String(raw).length === 0 ? null : normalizeSlug(raw);
73607
- if (actual !== null && excluded.includes(actual)) return "violated";
73608
- if (expected === null || expected === void 0 || String(expected).length === 0) return "unresolved";
73609
- if (actual === null) return "unresolved";
73610
- if (actual === normalizeSlug(expected)) return "adopted";
73611
- if ((attempt.orderRest ?? []).map(normalizeSlug).includes(actual)) return "fallback";
73612
- return "not-adopted";
73613
- }
73614
- /** Whether an adherence reading means the pin was honored, or cannot be judged. */
73615
- function isAdherenceOk(adherence) {
73616
- return adherence === "adopted" || adherence === "fallback" || adherence === "unresolved";
73617
- }
73618
- /**
73619
- * Name the configuration problems that make a pin impossible to honor.
73620
- *
73621
- * Both cases used to produce a request with no pin fields at all — that is,
73622
- * "excluded" channels still in play, silently.
73623
- *
73624
- * @returns human-readable warnings, empty when the pin is expressible.
73625
- */
73626
- function pinWarnings(attempt, meta) {
73627
- const upstream = attempt.upstream ?? null;
73628
- const warnings = [];
73629
- if (upstream !== null && upstream !== void 0 && String(upstream).length > 0 && isClinePassAnonymousUpstream(upstream)) warnings.push(`anonymousUpstream: ${upstream} is the gateway's anonymous contributor route — answers from it may be used for training and carry no zero-data-retention guarantee; pin it only when that is acceptable`);
73630
- const known = Array.isArray(meta?.upstreams) ? meta.upstreams : [];
73631
- if (upstream !== null && upstream !== void 0 && String(upstream).length > 0 && !isClinePassAnonymousUpstream(upstream) && known.length > 0 && known.every((name) => isClinePassAnonymousUpstream(name))) warnings.push(`pinLikelyIgnored: every channel discovered for this model is the anonymous contributor route (${known.join(", ")}), which silently drops a pin and answers anyway — the request will likely be served by it regardless of ${upstream}`);
73632
- const excluded = (attempt.excludeList ?? []).filter((name) => normalizeSlug(name) !== normalizeSlug(upstream ?? ""));
73633
- const excludedIds = new Set(excluded.map(normalizeSlug));
73634
- if (excluded.length === 0) return warnings;
73635
- if (known.length === 0) return [...warnings, `excludeUnresolved: this model has no channel list yet, so ${excluded.join(", ")} could not be compiled into an allow-list — run cline_pass_probe for it`];
73636
- if (known.filter((name) => !excludedIds.has(normalizeSlug(name))).length === 0 && upstream === null) return [...warnings, `PIN_UNRESOLVED: every known channel is excluded (${known.join(", ")}), so the request falls back to the gateway's own routing`];
73637
- return warnings;
73638
- }
73639
- /**
73640
- * Expand one model's pin configuration into the ordered failover candidates.
73641
- *
73642
- * A model with a non-empty (post-exclusion) pin list is tried upstream by
73643
- * upstream; a model without one is a single automatic candidate whose excludes
73644
- * become an allow-list.
73645
- */
73646
- function buildAttempts(config) {
73647
- const listed = (config.upstreams ?? []).filter((name) => typeof name === "string" && name.length > 0);
73648
- const exclude = (config.exclude ?? []).filter((name) => typeof name === "string" && name.length > 0);
73649
- const excluded = new Set(exclude.map(normalizeSlug));
73650
- const wanted = listed.filter((name) => !excluded.has(normalizeSlug(name)));
73651
- const strict = normalizePinMode(config.pinMode) === "strict";
73652
- const base = {
73653
- strict,
73654
- sort: normalizeSort(config.sort),
73655
- excludeList: exclude
73656
- };
73657
- const has = (config.has ?? []).filter((name) => typeof name === "string" && name.trim().length > 0);
73658
- if (has.length > 0) base.has = [...has];
73659
- if (typeof config.spelling === "string" && config.spelling.length > 0) base.spelling = config.spelling;
73660
- if (wanted.length > 0) return wanted.map((upstream, index) => ({
73661
- ...base,
73662
- upstream,
73663
- orderRest: strict ? [] : wanted.filter((_, other) => other !== index)
73664
- }));
73665
- return [{
73666
- ...base,
73667
- upstream: null,
73668
- orderRest: []
73669
- }];
73670
- }
73671
- /**
73672
- * Classify a pinned-request failure into one upstream availability verdict.
73673
- * @returns `ok` (the channel answered), `limited`, `bad`, `auth`, or `unknown`.
73674
- */
73675
- function classifyUpstreamError(message) {
73676
- const text = String(message ?? "");
73677
- if (/empty response content/i.test(text)) return "ok";
73678
- if (/429|rate-?limited|temporarily rate/i.test(text)) return "limited";
73679
- if (/invalid_request|modelid|no allowed providers|no available providers|not found|unsupported/i.test(text)) return "bad";
73680
- if (isAuthenticationError$1(text)) return "auth";
73681
- return "unknown";
73682
- }
73683
- /**
73684
- * Recover the gateway's own upstream list from a routing-layer error.
73685
- *
73686
- * The probe channels an impossible `only` value, so the router fails before
73687
- * spending a token and names every provider it could have used.
73688
- */
73689
- function extractAvailableProviders(message, pipeline) {
73690
- const text = String(message ?? "");
73691
- if (pipeline === "planner") {
73692
- const match = /Available providers are:\s*([^.]+)/.exec(text);
73693
- if (match === null) return null;
73694
- const tokens = match[1].split(/,\s*/).map((token) => token.trim()).filter((token) => /^[a-z0-9][a-z0-9-]*$/.test(token));
73695
- return tokens.length > 0 ? tokens : null;
73696
- }
73697
- if (pipeline === "direct") {
73698
- const start = text.indexOf("{");
73699
- if (start < 0) return null;
73700
- try {
73701
- const list = JSON.parse(text.slice(start))?.error?.metadata?.available_providers;
73702
- return Array.isArray(list) && list.length > 0 ? list.map(String) : null;
73703
- } catch {
73704
- return null;
73705
- }
73706
- }
73707
- return null;
73708
- }
73709
- /**
73710
- * Read the tier-0 channel hint out of a planner's reasoning sentence.
73711
- * @param plan - `provider_metadata.gateway.routing.planningReasoning`.
73712
- */
73713
- function parseTier0(plan) {
73714
- const match = /([\w-]+) won tier 0 over ([^."]+)/.exec(String(plan ?? ""));
73715
- if (match === null) return [];
73716
- return [.../* @__PURE__ */ new Set([match[1], ...match[2].split(/,\s*|\s+and\s+/).map((part) => part.trim()).filter(Boolean)])];
73717
- }
73718
- /**
73719
- * Merge the upstream channels discovered by several means, keeping order and
73720
- * dropping duplicates.
73721
- * @param lists - candidate lists, highest confidence first.
73722
- * @returns the merged, de-duplicated upstream slugs (capped at MAX_UPSTREAMS).
73723
- */
73724
- function mergeUpstreams(...lists) {
73725
- const seen = [];
73726
- for (const list of lists) for (const name of list ?? []) {
73727
- const value = String(name);
73728
- if (value.length > 0 && !seen.includes(value)) seen.push(value);
73729
- }
73730
- return seen.slice(0, 64);
73731
- }
73732
- /**
73733
- * Normalize a model id for fuzzy OpenRouter catalog matching.
73734
- * @param value - either id.
73735
- * @returns the comparable form.
73736
- */
73737
- function normalizeSlug(value) {
73738
- return String(value).toLowerCase().replace(/[^a-z0-9]/g, "");
73739
- }
73740
73327
  /** Whether a value is a non-null object. */
73741
73328
  function isRecord$26(value) {
73742
73329
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -74371,11 +73958,10 @@ async function* translate(payloads) {
74371
73958
  //#region src/host/cline-pass/adapter.ts
74372
73959
  /**
74373
73960
  * The Cline Pass LLM adapter: an OpenAI-compatible `chat/completions` stream
74374
- * with upstream pinning, per-account rotation, and pre-first-token failover.
73961
+ * with per-account rotation and pre-first-token failover.
74375
73962
  *
74376
- * Transport and mapping live in `client.ts` / `mapper.ts`; account selection and
74377
- * probing live in `engine.ts`. This module owns the request loop: which account,
74378
- * which channel, and when an attempt is abandoned.
73963
+ * Transport and mapping live in `client.ts` / `mapper.ts`; account selection
73964
+ * lives in `engine.ts`. Cline always chooses the upstream automatically.
74379
73965
  *
74380
73966
  * @module dsh-chatgpt-subscription/cline-pass-adapter
74381
73967
  */
@@ -74408,8 +73994,8 @@ const ATTEMPT_TIMEOUT_MS$1 = 18e4;
74408
73994
  * Retries for a failure that happened BEFORE the request was sent.
74409
73995
  *
74410
73996
  * A TLS handshake to the gateway can fail intermittently on a network path
74411
- * where curl succeeds (the pinned upstream is never contacted: the body with
74412
- * `provider.only` has not left the host). Retrying is safe because no HTTP
73997
+ * where curl succeeds (the gateway is never contacted: the request has not
73998
+ * left the host). Retrying is safe because no HTTP
74413
73999
  * request reached the server, and it turns a one-in-two TLS failure into a rare
74414
74000
  * one. Errors after headers, or ambiguously mid-request, are never retried here.
74415
74001
  */
@@ -74550,11 +74136,8 @@ var ClinePassAdapter = class extends LlmAdapter {
74550
74136
  defaultContextWindow: settings.defaultContextWindow,
74551
74137
  maxTokens: settings.defaultMaxTokens,
74552
74138
  streamIdleTimeoutMs: settings.streamIdleTimeoutMs,
74553
- maxConcurrentRequests: settings.maxConcurrentRequests,
74554
- pinSpelling: settings.pinSpelling
74139
+ maxConcurrentRequests: settings.maxConcurrentRequests
74555
74140
  }, images);
74556
- const attempts = buildAttempts(this.engine.pinConfigFor(options.model));
74557
- const meta = this.store.metaOf(options.model);
74558
74141
  const startedAt = Date.now();
74559
74142
  const trace = [];
74560
74143
  const refused = /* @__PURE__ */ new Set();
@@ -74565,8 +74148,8 @@ var ClinePassAdapter = class extends LlmAdapter {
74565
74148
  let attemptIndex = 0;
74566
74149
  let usage;
74567
74150
  let emptyReplays = 0;
74568
- while (attemptIndex < attempts.length) {
74569
- const attempt = attempts[attemptIndex++];
74151
+ while (attemptIndex < 1) {
74152
+ attemptIndex += 1;
74570
74153
  let account;
74571
74154
  try {
74572
74155
  account = await this.engine.resolveAccount(refused);
@@ -74582,16 +74165,14 @@ var ClinePassAdapter = class extends LlmAdapter {
74582
74165
  if (signal.aborted) throw new LlmError("Cline Pass request aborted by caller", "ABORTED", { cause: error });
74583
74166
  throw error;
74584
74167
  }
74585
- const attemptStarted = Date.now();
74586
- const attemptLabel = attempt.upstream ?? "(auto)";
74168
+ const attemptLabel = "(auto)";
74587
74169
  try {
74588
- const pinned = injectPrefs(body, meta, attempt);
74589
74170
  let response;
74590
74171
  let transportError;
74591
74172
  for (let transportTry = 0; transportTry <= TRANSPORT_RETRIES$1; transportTry += 1) {
74592
74173
  const headerDeadline = withAttemptTimeout$1(upstream, this.options.headerTimeoutMs);
74593
74174
  try {
74594
- response = await this.engine.openStream(account, pinned, headerDeadline.signal);
74175
+ response = await this.engine.openStream(account, body, headerDeadline.signal);
74595
74176
  headerDeadline.clear();
74596
74177
  activity?.pulse();
74597
74178
  break;
@@ -74613,9 +74194,8 @@ var ClinePassAdapter = class extends LlmAdapter {
74613
74194
  }
74614
74195
  if (response === void 0) {
74615
74196
  const note = errorChain$2(transportError);
74616
- const hint = isPreConnectionFailure$1(transportError) ? ` The request never reached the gateway, so the pinned upstream was not contacted: ${account.baseURL} failed during TLS/connect. Check the network, proxy or TUN, or set a custom proxy in the plugin.` : "";
74197
+ const hint = isPreConnectionFailure$1(transportError) ? ` The request never reached the gateway: ${account.baseURL} failed during TLS/connect. Check the network, proxy or TUN, or set a custom proxy in the plugin.` : "";
74617
74198
  trace.push(attemptLabel);
74618
- this.store.learnUpstream(options.model, attempt.upstream, "unknown", note, Date.now() - attemptStarted);
74619
74199
  lastError = new LlmError(note + hint, "TRANSPORT", { cause: transportError });
74620
74200
  continue;
74621
74201
  }
@@ -74625,9 +74205,7 @@ var ClinePassAdapter = class extends LlmAdapter {
74625
74205
  try {
74626
74206
  detail = errorMessage(unwrapEnvelope(JSON.parse(raw))) || detail;
74627
74207
  } catch {}
74628
- const ms = Date.now() - attemptStarted;
74629
74208
  trace.push(attemptLabel);
74630
- this.store.learnUpstream(options.model, attempt.upstream, classifyVerdict(detail), detail, ms);
74631
74209
  const code = streamErrorCode$1(detail, response.status);
74632
74210
  lastError = new LlmError(`${detail || `HTTP ${response.status}`} [model=${options.model}]`, code, { status: response.status });
74633
74211
  if (code === "AUTH" || code === "QUOTA") {
@@ -74701,9 +74279,7 @@ var ClinePassAdapter = class extends LlmAdapter {
74701
74279
  if (signal.aborted) throw new LlmError("Cline Pass request aborted by caller", "ABORTED", { cause: error });
74702
74280
  const note = error instanceof LlmError ? error.message : errorChain$2(error);
74703
74281
  const code = error instanceof LlmError ? error.code : "TRANSPORT";
74704
- const ms = Date.now() - attemptStarted;
74705
74282
  trace.push(attemptLabel);
74706
- this.store.learnUpstream(options.model, attempt.upstream, classifyVerdict(note), note, ms);
74707
74283
  if (yielded) {
74708
74284
  this.store.record({
74709
74285
  model: options.model,
@@ -74768,19 +74344,12 @@ var ClinePassAdapter = class extends LlmAdapter {
74768
74344
  yield finishChunk;
74769
74345
  }
74770
74346
  delivered = true;
74771
- const adherence = pinAdherence(attempt, { finalProvider: observed.provider });
74772
- const warnings = pinWarnings({
74773
- upstream: attempt.upstream,
74774
- excludeList: attempt.excludeList
74775
- }, meta);
74776
- if (adherence === "not-adopted") warnings.push(`pinNotAdopted: the gateway served ${observed.provider ?? "(unknown)"} instead of the pinned ${attempt.upstream ?? "(auto)"}`);
74777
- else if (adherence === "violated") warnings.push(`pinViolated: an excluded channel served this request: ${observed.provider ?? "(unknown)"}`);
74347
+ const warnings = [];
74778
74348
  if (observed.anonymous) warnings.push(`anonymousServed: this answer came from the gateway's anonymous contributor route (${observed.provider ?? "openai-compatible-private"}) — it may be used for training and carries no zero-data-retention guarantee`);
74779
- const ms = Date.now() - attemptStarted;
74780
74349
  trace.push(attemptLabel);
74781
74350
  this.store.record({
74782
74351
  model: options.model,
74783
- provider: observed.provider ?? attempt.upstream ?? "",
74352
+ provider: observed.provider ?? "",
74784
74353
  canonical: observed.canonical ?? "",
74785
74354
  attempts: trace.map(String),
74786
74355
  ms: Date.now() - startedAt,
@@ -74790,7 +74359,6 @@ var ClinePassAdapter = class extends LlmAdapter {
74790
74359
  error: finishFailure?.message ?? "",
74791
74360
  code: finishFailure?.code ?? "",
74792
74361
  account: account.name,
74793
- adherence,
74794
74362
  fingerprint: observed.fingerprint ?? "",
74795
74363
  anonymous: observed.anonymous,
74796
74364
  warnings,
@@ -74802,14 +74370,13 @@ var ClinePassAdapter = class extends LlmAdapter {
74802
74370
  ...observed.fingerprint === null ? {} : { lastFingerprint: observed.fingerprint }
74803
74371
  });
74804
74372
  this.accountPool.recordModel(account.id, options.model);
74805
- if (finishFailure === null && attempt.upstream !== null && adherence === "adopted") this.store.learnUpstream(options.model, attempt.upstream, "ok", "", ms);
74806
74373
  return;
74807
74374
  } finally {
74808
74375
  release();
74809
74376
  }
74810
74377
  }
74811
74378
  if (!delivered) {
74812
- const message = lastError?.message ?? "no pinned upstream could serve the request";
74379
+ const message = lastError?.message ?? "the gateway could not serve the request";
74813
74380
  this.store.record({
74814
74381
  model: options.model,
74815
74382
  provider: "",
@@ -74912,14 +74479,6 @@ function errorMessage(payload) {
74912
74479
  if (isRecord$26(value) && typeof value.message === "string") return value.message;
74913
74480
  return "";
74914
74481
  }
74915
- /** One failed pin's verdict. */
74916
- function classifyVerdict(detail) {
74917
- if (/empty response content/i.test(detail)) return "ok";
74918
- if (/429|rate-?limited|temporarily rate/i.test(detail)) return "limited";
74919
- if (/invalid_request|modelid|no allowed providers|no available providers|not found|unsupported/i.test(detail)) return "bad";
74920
- if (/unauthorized|re\s*authenticate|invalid\s*(?:api\s*key|token)|\b401\b|\b403\b/i.test(detail)) return "auth";
74921
- return "unknown";
74922
- }
74923
74482
  /**
74924
74483
  * Report transport activity and the first byte without disturbing the stream.
74925
74484
  *
@@ -74967,7 +74526,6 @@ async function* tapRouting(payloads, observed) {
74967
74526
  * - `GET api.cline.bot/…/recommended-models` — official subscription list
74968
74527
  * - `GET models.dev/api.json` — community registry, a metadata backstop
74969
74528
  * - `GET ai-gateway.vercel.sh/v1/models` — the upstream's own catalog
74970
- * - `GET openrouter.ai/api/v1/…` — endpoint detail for direct-pipeline models
74971
74529
  *
74972
74530
  * @module dsh-chatgpt-subscription/cline-pass-client
74973
74531
  */
@@ -75244,87 +74802,19 @@ async function fetchOfficialModels({ fetchFn, signal, timeoutMs = 3e4 }) {
75244
74802
  sources
75245
74803
  };
75246
74804
  }
75247
- /** Resolve a canonical slug against OpenRouter's public catalog. */
75248
- async function resolveOpenRouterSlug(fetchFn, slug, { signal, timeoutMs = 3e4 } = {}) {
75249
- try {
75250
- const result = await sendJSON(fetchFn, `${OPENROUTER_API}/models`, {
75251
- signal,
75252
- timeoutMs
75253
- });
75254
- const ids = (isRecord$25(result.json) && Array.isArray(result.json.data) ? result.json.data : []).map((model) => isRecord$25(model) ? model.id : void 0).filter((id) => typeof id === "string");
75255
- const normalize = (value) => value.toLowerCase().replace(/[^a-z0-9]/g, "");
75256
- return ids.find((id) => id === slug) ?? ids.find((id) => normalize(id) === normalize(slug)) ?? null;
75257
- } catch {
75258
- return null;
75259
- }
75260
- }
75261
- /** Per-upstream endpoint detail (context length, recent uptime) for one model. */
75262
- async function openRouterEndpoints(fetchFn, slug, { signal, timeoutMs = 3e4 } = {}) {
75263
- const real = await resolveOpenRouterSlug(fetchFn, slug, {
75264
- signal,
75265
- timeoutMs
75266
- });
75267
- if (real === null) return {
75268
- slug,
75269
- endpoints: []
75270
- };
75271
- try {
75272
- const result = await sendJSON(fetchFn, `${OPENROUTER_API}/models/${real}/endpoints`, {
75273
- signal,
75274
- timeoutMs
75275
- });
75276
- const payload = isRecord$25(result.json) && isRecord$25(result.json.data) ? result.json.data : void 0;
75277
- const rows = payload !== void 0 && Array.isArray(payload.endpoints) ? payload.endpoints : [];
75278
- const detail = /* @__PURE__ */ new Map();
75279
- for (const entry of rows) {
75280
- if (!isRecord$25(entry)) continue;
75281
- const providerSlug = String(entry.tag ?? "").split("/")[0] || String(entry.provider_name ?? "").toLowerCase().replace(/\s+/g, "-");
75282
- if (providerSlug === "") continue;
75283
- const current = detail.get(providerSlug) ?? {
75284
- slug: providerSlug,
75285
- name: String(entry.provider_name ?? providerSlug),
75286
- endpoints: 0,
75287
- context: 0,
75288
- uptime: 0
75289
- };
75290
- current.endpoints += 1;
75291
- current.context = Math.max(current.context, Number(entry.context_length ?? 0));
75292
- current.uptime = Math.max(current.uptime, Math.round(Number(entry.uptime_last_30m ?? 0)));
75293
- detail.set(providerSlug, current);
75294
- }
75295
- return {
75296
- slug: real,
75297
- endpoints: [...detail.values()]
75298
- };
75299
- } catch {
75300
- return {
75301
- slug: real,
75302
- endpoints: []
75303
- };
75304
- }
75305
- }
75306
74805
  function isRecord$25(value) {
75307
74806
  return typeof value === "object" && value !== null && !Array.isArray(value);
75308
74807
  }
75309
74808
  //#endregion
75310
74809
  //#region src/host/cline-pass/engine.ts
75311
74810
  /**
75312
- * The Cline Pass engine: pinned request chains with pre-first-token failover,
75313
- * probing, validation, and account verification. It owns every probe network
75314
- * call, so the adapter, the settings routes and the management tools apply
75315
- * identical pinning semantics.
75316
- *
75317
- * Failover contract: a candidate is abandoned only while nothing has been
75318
- * delivered yet. A non-2xx, a transport failure, or an error payload before the
75319
- * first content delta moves to the next candidate; once a chunk has been
75320
- * produced the stream is the answer, and a later failure is reported as such.
74811
+ * The Cline Pass engine: ordinary model checks, account verification, catalog
74812
+ * reads and streaming transport. Cline owns model routing; no client-supplied
74813
+ * upstream pin or provider-options field is added to a request.
75321
74814
  *
75322
74815
  * @module dsh-chatgpt-subscription/cline-pass-engine
75323
74816
  */
75324
- /**
75325
- * The engine. All methods are safe to call while the pool is serving live
75326
- * traffic; probes take an account through the same rotation as a request.
75327
- */
74817
+ /** All methods are safe to call while the pool is serving live traffic. */
75328
74818
  var ClinePassEngine = class {
75329
74819
  options;
75330
74820
  constructor(options) {
@@ -75347,129 +74837,8 @@ var ClinePassEngine = class {
75347
74837
  baseURL: credentials.baseURL && credentials.baseURL.trim() !== "" ? credentials.baseURL.trim() : this.options.baseURL()
75348
74838
  };
75349
74839
  }
75350
- /** The pin plus the route-wide spelling policy, as a request will send it. */
75351
- pinConfigFor(model) {
75352
- return {
75353
- upstreams: this.pinOf(model).upstreams,
75354
- exclude: this.pinOf(model).exclude,
75355
- pinMode: this.pinOf(model).pinMode,
75356
- sort: this.pinOf(model).sort,
75357
- has: this.pinOf(model).has,
75358
- spelling: this.options.pinFor(model).spelling
75359
- };
75360
- }
75361
- /** The configured pin for one model, read through the live settings file. */
75362
- pinOf(model) {
75363
- const pin = this.options.pinFor(model);
75364
- return {
75365
- upstreams: (pin.upstreams ?? []).map(String),
75366
- exclude: (pin.exclude ?? []).map(String),
75367
- pinMode: pin.pinMode === "preferred" ? "preferred" : "strict",
75368
- sort: typeof pin.sort === "string" ? pin.sort : "",
75369
- has: Array.isArray(pin.has) ? pin.has.map(String) : defaultGatewayHas(model)
75370
- };
75371
- }
75372
- /**
75373
- * One pinned request, non-streaming.
75374
- * @returns the decoded payload plus the facts the pin was judged on.
75375
- */
75376
- async attemptChat(model, body, attempt, { signal, timeoutMs } = {}) {
75377
- const account = await this.resolveAccount();
75378
- const meta = this.store.metaOf(model);
75379
- const pinned = injectPrefs(body, meta, attempt);
75380
- const started = Date.now();
75381
- const result = await chatCompletion({
75382
- fetchFn: this.fetchFn,
75383
- baseURL: account.baseURL || "https://api.cline.bot/api/v1",
75384
- apiKey: account.key,
75385
- body: pinned,
75386
- signal,
75387
- timeoutMs: timeoutMs ?? this.options.attemptTimeoutMs ?? 18e4
75388
- });
75389
- const payload = unwrapEnvelope(result.json);
75390
- const failed = result.ok !== true || payload.error !== void 0 && payload.choices === void 0;
75391
- const routing = failed ? parseRouting({}) : parseRouting(payload);
75392
- return {
75393
- attempt,
75394
- account,
75395
- status: failed ? payload.error === void 0 ? result.status : 502 : 200,
75396
- ok: !failed,
75397
- json: payload,
75398
- text: result.text,
75399
- ms: Date.now() - started,
75400
- routing,
75401
- adherence: failed ? null : pinAdherence(attempt, routing),
75402
- warnings: pinWarnings({
75403
- upstream: attempt.upstream,
75404
- excludeList: attempt.excludeList
75405
- }, meta),
75406
- error: failed ? errorText$1(payload.error) || result.text.slice(0, 400) || `HTTP ${result.status}` : ""
75407
- };
75408
- }
75409
- /**
75410
- * Run one model's ordered candidate chain until an attempt is both answered
75411
- * and served by the channel the pin asked for.
75412
- *
75413
- * This is the diagnostic path (`cline_pass_test`), so it keeps looking past a
75414
- * candidate the router quietly ignored: the point of the call is to find out
75415
- * whether the pin works.
75416
- */
75417
- async runChain(model, body, pinConfig, { signal, timeoutMs } = {}) {
75418
- const trace = [];
75419
- let last = null;
75420
- for (const attempt of buildAttempts(pinConfig)) {
75421
- const outcome = await this.attemptChat(model, body, attempt, {
75422
- signal,
75423
- timeoutMs
75424
- });
75425
- const honored = outcome.ok && isAdherenceOk(outcome.adherence ?? "unresolved");
75426
- const note = !outcome.ok ? outcome.error : honored ? "ok" : `pin not adopted: served by ${outcome.routing.finalProvider ?? "(unknown)"}`;
75427
- trace.push({
75428
- upstream: attempt.upstream ?? "(auto)",
75429
- status: outcome.status,
75430
- ms: outcome.ms,
75431
- note: note.slice(0, 160)
75432
- });
75433
- last = outcome;
75434
- if (honored) return {
75435
- ok: true,
75436
- result: outcome,
75437
- trace,
75438
- error: "",
75439
- warnings: outcome.warnings
75440
- };
75441
- if (!outcome.ok) {
75442
- if (attempt.upstream !== null && outcome.error !== "") this.store.learnUpstream(model, attempt.upstream, classifyUpstreamError(outcome.error), outcome.error, outcome.ms);
75443
- if (attempt.upstream === null && attempt.excludeList.length > 0 && outcome.error !== "") this.learnFromError(model, outcome.error);
75444
- }
75445
- }
75446
- const failure = last === null ? "no candidate succeeded" : last.ok !== true ? last.error : last.adherence === "violated" ? `an excluded channel served the request: ${last.routing.finalProvider ?? "(unknown)"}` : `the gateway ignored the pin: served by ${last.routing.finalProvider ?? "(unknown)"}`;
75447
- const has = (pinConfig.has ?? []).filter((name) => typeof name === "string" && name.trim() !== "");
75448
- const error = has.length > 0 && /provider|capabilit|filter/i.test(failure) ? `${failure} (this pin also requires capabilities [${has.join(", ")}]; clear them in the pin editor to widen routing)` : failure;
75449
- return {
75450
- ok: false,
75451
- result: last,
75452
- trace,
75453
- error,
75454
- warnings: last?.warnings ?? []
75455
- };
75456
- }
75457
- /** Merge a gateway error's own provider list into the model's channel list. */
75458
- learnFromError(model, message) {
75459
- const match = /Available providers are:\s*([^.]+)/.exec(String(message ?? ""));
75460
- if (match === null) return;
75461
- const tokens = match[1].split(/,\s*/).map((token) => token.trim()).filter((token) => /^[a-z0-9][a-z0-9-]*$/.test(token));
75462
- if (tokens.length === 0) return;
75463
- const meta = this.store.metaOf(model);
75464
- const current = Array.isArray(meta.upstreams) ? meta.upstreams : [];
75465
- if (!tokens.some((token) => !current.includes(token))) return;
75466
- this.store.learn(model, { upstreams: mergeUpstreams(current, tokens) });
75467
- }
75468
- /**
75469
- * Probe one model: detect its pipeline, read back the upstream it used, and
75470
- * harvest the channel list each pipeline publishes. Costs two tiny requests.
75471
- */
75472
- async probe(model, { signal, timeoutMs } = {}) {
74840
+ /** Send one small, automatically routed request and report what served it. */
74841
+ async test(model, { signal } = {}) {
75473
74842
  const account = await this.resolveAccount();
75474
74843
  const started = Date.now();
75475
74844
  const result = await chatCompletion({
@@ -75485,343 +74854,49 @@ var ClinePassEngine = class {
75485
74854
  max_tokens: 256
75486
74855
  },
75487
74856
  signal,
75488
- timeoutMs: timeoutMs ?? this.options.attemptTimeoutMs ?? 18e4
74857
+ timeoutMs: 18e4
75489
74858
  });
75490
74859
  const payload = unwrapEnvelope(result.json);
75491
74860
  const ms = Date.now() - started;
75492
- if (!result.ok || payload.error !== void 0 && payload.choices === void 0 || !Array.isArray(payload.choices) || payload.choices.length === 0) {
75493
- const message = errorText$1(payload.error) || String(payload.message ?? "") || result.text.slice(0, 400) || (result.ok ? "gateway returned no completion" : `HTTP ${result.status}`);
75494
- this.store.learn(model, {
75495
- ok: false,
75496
- lastError: message,
75497
- lastMs: ms
75498
- });
75499
- return {
75500
- ok: false,
75501
- ms,
75502
- model,
75503
- error: message,
75504
- pipeline: "",
75505
- pinnable: false,
75506
- canonicalSlug: "",
75507
- lastProvider: "",
75508
- upstreams: [],
75509
- availableProviders: [],
75510
- tier0: [],
75511
- fingerprint: "",
75512
- anonymous: false
75513
- };
75514
- }
75515
- const routing = parseRouting(payload);
75516
- const pipeline = routing.pipeline;
75517
- const otherPipeline = pipeline === "planner" ? "direct" : pipeline === "direct" ? "planner" : null;
75518
- const has = this.pinOf(model).has;
75519
- let harvested = null;
75520
- if (pipeline !== null) harvested = await this.harvest(model, pipeline, account, {
75521
- signal,
75522
- timeoutMs: this.options.probeTimeoutMs,
75523
- has
75524
- });
75525
- let otherHarvested = null;
75526
- if (otherPipeline !== null) otherHarvested = await this.harvest(model, otherPipeline, account, {
75527
- signal,
75528
- timeoutMs: this.options.probeTimeoutMs,
75529
- has
75530
- });
75531
- let endpoints = [];
75532
- let openrouterSlug = null;
75533
- if (pipeline !== "planner" && typeof routing.canonicalSlug === "string") {
75534
- const detail = await openRouterEndpoints(this.fetchFn, routing.canonicalSlug, {
75535
- signal,
75536
- timeoutMs: this.options.probeTimeoutMs
75537
- });
75538
- endpoints = detail.endpoints;
75539
- openrouterSlug = detail.slug;
75540
- }
75541
- const previous = this.store.metaOf(model);
75542
- const upstreamDetail = { ...previous.upstreamDetail ?? {} };
75543
- for (const entry of endpoints) upstreamDetail[entry.slug] = entry;
75544
- const discovered = pipeline === "planner" ? mergeUpstreams(harvested, routing.fallbacks) : mergeUpstreams(routing.fallbacks, harvested, Object.keys(upstreamDetail));
75545
- const servedRaw = typeof routing.finalProvider === "string" && routing.finalProvider.length > 0 ? routing.finalProvider : null;
75546
- const served = servedRaw === null ? [] : [pipeline === null ? servedRaw : channelNameFor(servedRaw, pipeline)];
75547
- const combined = mergeUpstreams(served, discovered, otherHarvested);
75548
- const upstreams = combined.length > 0 ? combined : Array.isArray(previous.upstreams) ? previous.upstreams : [];
75549
- const channels = { ...previous.channels ?? {} };
75550
- if (pipeline !== null) {
75551
- const scoped = mergeUpstreams(served, harvested);
75552
- if (scoped.length > 0) channels[pipeline] = scoped;
75553
- }
75554
- if (otherPipeline !== null && Array.isArray(otherHarvested) && otherHarvested.length > 0) channels[otherPipeline] = otherHarvested;
75555
- const tier0 = [.../* @__PURE__ */ new Set([...previous.tier0 ?? [], ...parseTier0(routing.plan)])];
75556
- const meta = this.store.learn(model, {
75557
- ok: true,
75558
- pipeline,
75559
- pinnable: pipeline !== null,
75560
- availableProviders: harvested ?? previous.availableProviders ?? [],
75561
- canonicalSlug: routing.canonicalSlug ?? previous.canonicalSlug ?? null,
75562
- openrouterSlug: openrouterSlug ?? previous.openrouterSlug ?? null,
75563
- upstreamDetail,
75564
- upstreams,
75565
- channels,
75566
- staleAt: combined.length === 0 && upstreams.length > 0 ? Date.now() : 0,
75567
- tier0,
75568
- lastProvider: routing.finalProvider ?? previous.lastProvider ?? null,
75569
- lastFingerprint: routing.fingerprint ?? previous.lastFingerprint ?? null,
74861
+ const failed = !result.ok || payload.error !== void 0 && payload.choices === void 0;
74862
+ const routing = failed ? parseRouting({}) : parseRouting(payload);
74863
+ const error = failed ? errorText$1(payload.error) || result.text.slice(0, 400) || `HTTP ${result.status}` : "";
74864
+ const warnings = routing.anonymous ? [`anonymousServed: this answer came from the gateway's anonymous contributor route (${routing.finalProvider ?? "openai-compatible-private"}) — it may be used for training and carries no zero-data-retention guarantee`] : [];
74865
+ this.store.learn(model, {
74866
+ ok: !failed,
74867
+ pipeline: routing.pipeline,
74868
+ canonicalSlug: routing.canonicalSlug,
74869
+ lastProvider: routing.finalProvider,
74870
+ lastFingerprint: routing.fingerprint,
75570
74871
  lastMs: ms,
75571
- probedAt: Date.now(),
75572
- lastError: ""
74872
+ lastError: error
75573
74873
  });
75574
- return {
75575
- ok: true,
75576
- ms,
75577
- model,
75578
- error: "",
75579
- pipeline: meta.pipeline ?? "",
75580
- pinnable: meta.pinnable === true,
75581
- canonicalSlug: meta.canonicalSlug ?? "",
75582
- lastProvider: meta.lastProvider ?? "",
75583
- upstreams: meta.upstreams ?? [],
75584
- availableProviders: meta.availableProviders ?? [],
75585
- tier0: meta.tier0 ?? [],
75586
- fingerprint: meta.lastFingerprint ?? "",
75587
- anonymous: isClinePassAnonymousUpstream(meta.lastProvider ?? "", meta.canonicalSlug ?? "")
75588
- };
75589
- }
75590
- /**
75591
- * Harvest the exact channel list for one pipeline by pinning a channel that
75592
- * cannot exist: the router fails before spending a token and names every
75593
- * provider it could have used.
75594
- */
75595
- async harvest(model, pipeline, account, { signal, timeoutMs, has = [] }) {
75596
- const base = {
75597
- model,
75598
- messages: [{
75599
- role: "user",
75600
- content: "hi"
75601
- }],
75602
- max_tokens: 16
75603
- };
75604
- const body = pipeline === "planner" ? {
75605
- ...base,
75606
- providerOptions: { gateway: {
75607
- only: ["__probe__"],
75608
- ...has.length > 0 ? { has: [...has] } : {}
75609
- } }
75610
- } : {
75611
- ...base,
75612
- provider: { only: ["__probe__"] }
75613
- };
75614
- try {
75615
- const result = await chatCompletion({
75616
- fetchFn: this.fetchFn,
75617
- baseURL: account.baseURL || "https://api.cline.bot/api/v1",
75618
- apiKey: account.key,
75619
- body,
75620
- signal,
75621
- timeoutMs: timeoutMs ?? this.options.probeTimeoutMs
75622
- });
75623
- const payload = unwrapEnvelope(result.json);
75624
- const listed = extractAvailableProviders(errorText$1(payload.error) || result.text, pipeline);
75625
- if (listed !== null && listed.length > 0) return listed;
75626
- const routing = parseRouting(payload);
75627
- if (routing.finalProvider !== null && routing.finalProvider !== "") return [routing.finalProvider];
75628
- return listed;
75629
- } catch {
75630
- return null;
75631
- }
75632
- }
75633
- /**
75634
- * Test every known channel of a model once and record the verdicts.
75635
- *
75636
- * A channel counts as usable only when the response names it as the one that
75637
- * served the request; a payload carrying `choices` alone is not evidence the
75638
- * pin was honored.
75639
- */
75640
- async validate(model, { signal, timeoutMs } = {}) {
75641
- const meta = this.store.metaOf(model);
75642
- const list = Array.isArray(meta.upstreams) ? meta.upstreams : [];
75643
- const has = this.pinOf(model).has;
75644
- const results = [];
75645
- for (let index = 0; index < list.length; index += 5) {
75646
- if (signal?.aborted === true) break;
75647
- const batch = list.slice(index, index + 5);
75648
- const settled = await Promise.all(batch.map(async (upstream) => {
75649
- const started = Date.now();
75650
- const attempt = {
75651
- upstream,
75652
- strict: true,
75653
- sort: null,
75654
- orderRest: [],
75655
- excludeList: [],
75656
- has
75657
- };
75658
- const body = injectPrefs({
75659
- model,
75660
- messages: [{
75661
- role: "user",
75662
- content: "hi"
75663
- }],
75664
- max_tokens: 16
75665
- }, meta, attempt);
75666
- try {
75667
- const account = await this.resolveAccount();
75668
- const result = await chatCompletion({
75669
- fetchFn: this.fetchFn,
75670
- baseURL: account.baseURL || "https://api.cline.bot/api/v1",
75671
- apiKey: account.key,
75672
- body,
75673
- signal,
75674
- timeoutMs: timeoutMs ?? this.options.probeTimeoutMs
75675
- });
75676
- const payload = unwrapEnvelope(result.json);
75677
- const ms = Date.now() - started;
75678
- let status = "unknown";
75679
- let note = "";
75680
- if (!result.ok || payload.error !== void 0 && payload.choices === void 0) {
75681
- note = errorText$1(payload.error) || result.text || `HTTP ${result.status}`;
75682
- status = isAuthenticationError$1(note, result.status) ? "auth" : classifyUpstreamError(note);
75683
- } else if (payload.choices !== void 0) {
75684
- const routing = parseRouting(payload);
75685
- const adherence = pinAdherence(attempt, routing);
75686
- if (adherence === "adopted") status = "ok";
75687
- else if (adherence === "unresolved") note = "the response did not name the serving channel; the pin could not be verified";
75688
- else {
75689
- status = "not-adopted";
75690
- note = `pin not adopted: served by ${routing.finalProvider ?? "(unknown)"}`;
75691
- }
75692
- }
75693
- return {
75694
- upstream,
75695
- status,
75696
- ms,
75697
- note: note.slice(0, 160)
75698
- };
75699
- } catch (error) {
75700
- return {
75701
- upstream,
75702
- status: "unknown",
75703
- ms: Date.now() - started,
75704
- note: errorText$1(error).slice(0, 160)
75705
- };
75706
- }
75707
- }));
75708
- for (const result of settled) {
75709
- this.store.learnUpstream(model, result.upstream, result.status, result.note, result.ms, { includeUnknown: true });
75710
- results.push(result);
75711
- }
75712
- }
75713
- const summary = {
75714
- ok: 0,
75715
- limited: 0,
75716
- bad: 0,
75717
- auth: 0,
75718
- unknown: 0
75719
- };
75720
- for (const result of results) {
75721
- const bucket = result.status === "not-adopted" ? "bad" : result.status;
75722
- if (bucket === "ok" || bucket === "limited" || bucket === "bad" || bucket === "auth" || bucket === "unknown") summary[bucket] += 1;
75723
- }
75724
- this.store.learn(model, { validatedAt: Date.now() });
75725
- return {
75726
- results,
75727
- summary,
75728
- cancelled: signal?.aborted === true
75729
- };
75730
- }
75731
- /**
75732
- * Send one small chat through a (possibly temporary) pin configuration and
75733
- * report what served it. Nothing is persisted.
75734
- */
75735
- async test(model, { upstreams, exclude, has, signal } = {}) {
75736
- const stored = this.pinOf(model);
75737
- const pin = {
75738
- upstreams: Array.isArray(upstreams) ? upstreams : stored.upstreams,
75739
- exclude: Array.isArray(exclude) ? exclude : stored.exclude,
75740
- pinMode: stored.pinMode,
75741
- sort: stored.sort,
75742
- has: Array.isArray(has) ? has : stored.has,
75743
- spelling: this.options.pinFor(model).spelling
75744
- };
75745
- const started = Date.now();
75746
- const outcome = await this.runChain(model, {
75747
- model,
75748
- messages: [{
75749
- role: "user",
75750
- content: "Reply with the word OK"
75751
- }],
75752
- max_tokens: 256
75753
- }, pin, { signal });
75754
- const ms = Date.now() - started;
75755
- const warnings = outcome.warnings ?? [];
75756
- const targets = [...pin.upstreams ?? []];
75757
- const excluded = [...pin.exclude ?? []];
75758
- const routing = outcome.result?.routing;
75759
- const account = outcome.result?.account.name ?? "";
75760
- if (!outcome.ok) {
75761
- this.store.record({
75762
- model,
75763
- provider: routing?.finalProvider ?? "",
75764
- attempts: outcome.trace.map((row) => row.upstream),
75765
- ms,
75766
- stream: false,
75767
- error: outcome.error,
75768
- account
75769
- });
75770
- return {
75771
- ok: false,
75772
- ms,
75773
- model,
75774
- error: outcome.error,
75775
- targets: [...targets],
75776
- excluded: [...excluded],
75777
- trace: outcome.trace,
75778
- actual: routing?.finalProvider ?? "",
75779
- actualName: routing?.finalProviderName ?? "",
75780
- pipeline: routing?.pipeline ?? "",
75781
- pinnable: routing?.pipeline !== null && routing?.pipeline !== void 0,
75782
- canonicalSlug: routing?.canonicalSlug ?? "",
75783
- account,
75784
- content: "",
75785
- adopted: false,
75786
- adherence: outcome.result?.adherence ?? "",
75787
- plan: routing?.plan ?? "",
75788
- fingerprint: routing?.fingerprint ?? "",
75789
- anonymous: isClinePassAnonymousUpstream(routing?.finalProvider ?? "", routing?.canonicalSlug ?? ""),
75790
- has: [...pin.has ?? []],
75791
- warnings
75792
- };
75793
- }
75794
74874
  this.store.record({
75795
74875
  model,
75796
- provider: routing?.finalProvider ?? "",
75797
- canonical: routing?.canonicalSlug ?? "",
75798
- attempts: outcome.trace.map((row) => row.upstream),
74876
+ provider: routing.finalProvider ?? "",
74877
+ canonical: routing.canonicalSlug ?? "",
75799
74878
  ms,
75800
74879
  stream: false,
75801
- error: "",
75802
- account
74880
+ error,
74881
+ account: account.name,
74882
+ fingerprint: routing.fingerprint ?? "",
74883
+ anonymous: routing.anonymous,
74884
+ warnings
75803
74885
  });
75804
74886
  return {
75805
- ok: true,
74887
+ ok: !failed,
75806
74888
  ms,
75807
74889
  model,
75808
- error: "",
75809
- targets: [...targets],
75810
- excluded: [...excluded],
75811
- trace: outcome.trace,
75812
- actual: routing?.finalProvider ?? "",
75813
- actualName: routing?.finalProviderName ?? "",
75814
- pipeline: routing?.pipeline ?? "",
75815
- pinnable: routing?.pipeline !== null && routing?.pipeline !== void 0,
75816
- canonicalSlug: routing?.canonicalSlug ?? "",
75817
- account,
75818
- content: String(routing?.content ?? "").slice(0, 120),
75819
- adopted: outcome.result?.adherence === "adopted",
75820
- adherence: outcome.result?.adherence ?? "",
75821
- plan: routing?.plan ?? "",
75822
- fingerprint: routing?.fingerprint ?? "",
75823
- anonymous: isClinePassAnonymousUpstream(routing?.finalProvider ?? "", routing?.canonicalSlug ?? ""),
75824
- has: [...pin.has ?? []],
74890
+ error,
74891
+ actual: routing.finalProvider ?? "",
74892
+ actualName: routing.finalProviderName ?? "",
74893
+ pipeline: routing.pipeline ?? "",
74894
+ canonicalSlug: routing.canonicalSlug ?? "",
74895
+ account: account.name,
74896
+ content: failed ? "" : String(routing.content ?? "").slice(0, 120),
74897
+ plan: routing.plan,
74898
+ fingerprint: routing.fingerprint ?? "",
74899
+ anonymous: routing.anonymous,
75825
74900
  warnings
75826
74901
  };
75827
74902
  }
@@ -75832,7 +74907,7 @@ var ClinePassEngine = class {
75832
74907
  * burning `max_tokens` into an empty completion, for example) counts as
75833
74908
  * authorized: only a real authentication failure is reported as one.
75834
74909
  */
75835
- async testAccount({ key, baseURL, model, signal, timeoutMs = this.options.probeTimeoutMs ?? 6e4 }) {
74910
+ async testAccount({ key, baseURL, model, signal, timeoutMs = 6e4 }) {
75836
74911
  const started = Date.now();
75837
74912
  try {
75838
74913
  const result = await chatCompletion({
@@ -75913,7 +74988,7 @@ var ClinePassEngine = class {
75913
74988
  signal
75914
74989
  });
75915
74990
  }
75916
- /** Raise the engine's own error for a request that never reached a candidate. */
74991
+ /** Raise the engine's own error for a request that has no usable account. */
75917
74992
  noAccountError(error) {
75918
74993
  if (error instanceof LlmError) return error;
75919
74994
  return new LlmError(`Cline Pass has no usable account: ${error instanceof Error ? error.message : String(error)}`, "MISSING_CREDENTIAL");
@@ -76002,7 +75077,6 @@ function projectModels$1(settings, store) {
76002
75077
  const enabledSet = settings.enabledModelIds === null ? null : new Set(settings.enabledModelIds);
76003
75078
  return known.map((id) => {
76004
75079
  const meta = store.metaOf(id);
76005
- const pin = settings.pins[id] ?? defaultPin(id);
76006
75080
  const base = resolveModelInfo$1(id, {
76007
75081
  displayName: "Cline Pass",
76008
75082
  synced: settings.catalogModels,
@@ -76016,13 +75090,6 @@ function projectModels$1(settings, store) {
76016
75090
  defaultMaxTokens: settings.defaultMaxTokens,
76017
75091
  contextWindowOverride: settings.contextWindowOverrides[id]
76018
75092
  });
76019
- const verdicts = Object.entries(meta.upstreamStatus ?? {}).map(([upstream, verdict]) => ({
76020
- upstream,
76021
- status: verdict.status,
76022
- ms: Number(verdict.ms ?? 0),
76023
- note: firstLine$2(verdict.note, 160),
76024
- checkedAt: Number(verdict.checkedAt ?? 0)
76025
- })).sort((left, right) => (meta.upstreams ?? []).indexOf(left.upstream) - (meta.upstreams ?? []).indexOf(right.upstream));
76026
75093
  return {
76027
75094
  id,
76028
75095
  name: info.displayName,
@@ -76034,18 +75101,8 @@ function projectModels$1(settings, store) {
76034
75101
  input: [...info.input],
76035
75102
  enabled: (enabledSet === null || enabledSet.has(id)) && !hidden.has(id),
76036
75103
  pipeline: String(meta.pipeline ?? ""),
76037
- pinnable: meta.pinnable === true,
76038
- pinned: pin.upstreams,
76039
- excluded: pin.exclude,
76040
- pinMode: normalizePinMode(pin.pinMode),
76041
- sort: pin.sort,
76042
- has: [...pin.has],
76043
- upstreams: (meta.upstreams ?? []).map(String),
76044
- upstreamStatus: verdicts,
76045
75104
  lastProvider: String(meta.lastProvider ?? ""),
76046
75105
  lastMs: Number(meta.lastMs ?? 0),
76047
- probedAt: Number(meta.probedAt ?? 0),
76048
- validatedAt: Number(meta.validatedAt ?? 0),
76049
75106
  ...settings.contextWindowOverrides[id] === void 0 ? {} : { contextWindowOverride: settings.contextWindowOverrides[id] }
76050
75107
  };
76051
75108
  });
@@ -76103,8 +75160,7 @@ async function getClinePassWebStatus(options, quotaRefresh) {
76103
75160
  defaultMaxTokens: settings.defaultMaxTokens,
76104
75161
  maxConcurrentRequests: settings.maxConcurrentRequests,
76105
75162
  streamIdleTimeoutMs: settings.streamIdleTimeoutMs,
76106
- historyLimit: settings.historyLimit,
76107
- pinSpelling: settings.pinSpelling
75163
+ historyLimit: settings.historyLimit
76108
75164
  }
76109
75165
  };
76110
75166
  }
@@ -76117,10 +75173,6 @@ const CLINE_PASS_ROUTES = {
76117
75173
  "login/status": "GET",
76118
75174
  "login/cancel": "POST",
76119
75175
  models: "GET|POST",
76120
- "models/pin": "POST",
76121
- "models/reset": "POST",
76122
- "models/probe": "POST",
76123
- "models/validate": "POST",
76124
75176
  "models/test": "POST",
76125
75177
  "models/visibility": "POST",
76126
75178
  "models/visibility-all": "POST",
@@ -76272,7 +75324,6 @@ function registerClinePassRoutes(ctx, options) {
76272
75324
  }
76273
75325
  if (typeof body.exposeCatalog === "boolean") patch.exposeCatalog = body.exposeCatalog;
76274
75326
  if (typeof body.exposeTools === "boolean") patch.exposeTools = body.exposeTools;
76275
- if (typeof body.pinSpelling === "string") patch.pinSpelling = body.pinSpelling === "detected" ? "detected" : "both";
76276
75327
  let touched = false;
76277
75328
  if (Object.keys(patch).length > 0) {
76278
75329
  await settingsStore.update(patch);
@@ -76465,139 +75516,6 @@ function registerClinePassRoutes(ctx, options) {
76465
75516
  value: await status()
76466
75517
  });
76467
75518
  }
76468
- if (path === "models/pin") {
76469
- if (method !== "POST") return sendMethodNotAllowed$3(response);
76470
- if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
76471
- ok: false,
76472
- error: "Cross-origin request rejected."
76473
- });
76474
- const body = await readRequestJson$3(request).catch(() => ({}));
76475
- const model = typeof body.model === "string" ? body.model.trim() : "";
76476
- if (model === "") return sendJson$3(response, 400, {
76477
- ok: false,
76478
- error: "this action needs a model id"
76479
- });
76480
- const current = (await settingsStore.read()).pins[model] ?? defaultPin(model);
76481
- const next = {
76482
- upstreams: Array.isArray(body.upstreams) ? body.upstreams.map(String) : current.upstreams,
76483
- exclude: Array.isArray(body.exclude) ? body.exclude.map(String) : current.exclude,
76484
- pinMode: isClinePassPinMode(body.pinMode) ? body.pinMode : current.pinMode,
76485
- sort: body.sort === void 0 ? current.sort : body.sort === "none" ? "" : String(body.sort),
76486
- has: Array.isArray(body.has) ? body.has.map(String).map((name) => name.trim()).filter((name) => name !== "") : current.has
76487
- };
76488
- await settingsStore.setPin(model, next);
76489
- const meta = store.metaOf(model);
76490
- const known = Array.isArray(meta.upstreams) ? meta.upstreams : [];
76491
- const warnings = [...pinWarnings({
76492
- upstream: next.upstreams[0] ?? null,
76493
- excludeList: next.exclude
76494
- }, meta)];
76495
- const named = [...next.upstreams, ...next.exclude];
76496
- if (named.length > 0) if (known.length === 0) warnings.push(`unverifiedChannel: this model has no discovered channel list yet, so ${named.join(", ")} cannot be checked — probe it first`);
76497
- else {
76498
- const unknown = named.filter((name) => !known.includes(name));
76499
- if (unknown.length > 0) warnings.push(`unknownChannel: ${unknown.join(", ")} is not in this model's discovered channel list (${known.join(", ")}); confirm with a test, because the gateway ignores a channel it cannot use rather than failing`);
76500
- }
76501
- return sendJson$3(response, 200, {
76502
- ok: true,
76503
- value: {
76504
- pin: next,
76505
- warnings,
76506
- status: await status()
76507
- }
76508
- });
76509
- }
76510
- if (path === "models/reset") {
76511
- if (method !== "POST") return sendMethodNotAllowed$3(response);
76512
- if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
76513
- ok: false,
76514
- error: "Cross-origin request rejected."
76515
- });
76516
- const body = await readRequestJson$3(request).catch(() => ({}));
76517
- const model = typeof body.model === "string" ? body.model.trim() : "";
76518
- if (model === "") return sendJson$3(response, 400, {
76519
- ok: false,
76520
- error: "this action needs a model id"
76521
- });
76522
- await settingsStore.clearPin(model);
76523
- return sendJson$3(response, 200, {
76524
- ok: true,
76525
- value: { status: await status() }
76526
- });
76527
- }
76528
- if (path === "models/probe") {
76529
- if (method !== "POST") return sendMethodNotAllowed$3(response);
76530
- if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
76531
- ok: false,
76532
- error: "Cross-origin request rejected."
76533
- });
76534
- const body = await readRequestJson$3(request).catch(() => ({}));
76535
- const model = typeof body.model === "string" ? body.model.trim() : "";
76536
- if (model === "") return sendJson$3(response, 400, {
76537
- ok: false,
76538
- error: "this action needs a model id"
76539
- });
76540
- const result = await engine.probe(model);
76541
- return sendJson$3(response, 200, {
76542
- ok: true,
76543
- value: {
76544
- result: {
76545
- ok: result.ok,
76546
- model,
76547
- error: firstLine$2(result.error, 300),
76548
- ms: result.ms,
76549
- pipeline: result.pipeline,
76550
- pinnable: result.pinnable,
76551
- canonicalSlug: result.canonicalSlug,
76552
- lastProvider: result.lastProvider,
76553
- upstreams: result.upstreams,
76554
- availableProviders: result.availableProviders,
76555
- tier0: result.tier0,
76556
- fingerprint: result.fingerprint,
76557
- anonymous: result.anonymous
76558
- },
76559
- status: await status()
76560
- }
76561
- });
76562
- }
76563
- if (path === "models/validate") {
76564
- if (method !== "POST") return sendMethodNotAllowed$3(response);
76565
- if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
76566
- ok: false,
76567
- error: "Cross-origin request rejected."
76568
- });
76569
- const body = await readRequestJson$3(request).catch(() => ({}));
76570
- const model = typeof body.model === "string" ? body.model.trim() : "";
76571
- if (model === "") return sendJson$3(response, 400, {
76572
- ok: false,
76573
- error: "this action needs a model id"
76574
- });
76575
- const meta = store.metaOf(model);
76576
- if (!Array.isArray(meta.upstreams) || meta.upstreams.length === 0) return sendJson$3(response, 400, {
76577
- ok: false,
76578
- error: "no known channels yet: probe this model first"
76579
- });
76580
- const outcome = await engine.validate(model);
76581
- return sendJson$3(response, 200, {
76582
- ok: true,
76583
- value: {
76584
- result: {
76585
- ok: true,
76586
- model,
76587
- error: "",
76588
- summary: outcome.summary,
76589
- upstreams: (store.metaOf(model).upstreams ?? []).map(String),
76590
- results: outcome.results.map((result) => ({
76591
- upstream: result.upstream,
76592
- status: result.status,
76593
- ms: result.ms,
76594
- note: result.note
76595
- }))
76596
- },
76597
- status: await status()
76598
- }
76599
- });
76600
- }
76601
75519
  if (path === "models/test") {
76602
75520
  if (method !== "POST") return sendMethodNotAllowed$3(response);
76603
75521
  if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
@@ -76610,11 +75528,7 @@ function registerClinePassRoutes(ctx, options) {
76610
75528
  ok: false,
76611
75529
  error: "this action needs a model id"
76612
75530
  });
76613
- const result = await engine.test(model, {
76614
- upstreams: Array.isArray(body.upstreams) ? body.upstreams.map(String) : void 0,
76615
- exclude: Array.isArray(body.exclude) ? body.exclude.map(String) : void 0,
76616
- has: Array.isArray(body.has) ? body.has.map(String).map((name) => name.trim()).filter((name) => name !== "") : void 0
76617
- });
75531
+ const result = await engine.test(model);
76618
75532
  return sendJson$3(response, 200, {
76619
75533
  ok: true,
76620
75534
  value: {
@@ -76623,23 +75537,16 @@ function registerClinePassRoutes(ctx, options) {
76623
75537
  model,
76624
75538
  error: firstLine$2(result.error, 400),
76625
75539
  ms: result.ms,
76626
- targets: result.targets,
76627
- excluded: result.excluded,
76628
75540
  actual: result.actual,
76629
75541
  actualName: result.actualName,
76630
75542
  pipeline: result.pipeline,
76631
- pinnable: result.pinnable,
76632
75543
  canonicalSlug: result.canonicalSlug,
76633
75544
  account: result.account,
76634
75545
  content: result.content,
76635
- adopted: result.adopted,
76636
- adherence: result.adherence,
76637
75546
  plan: firstLine$2(result.plan, 300),
76638
75547
  fingerprint: result.fingerprint,
76639
75548
  anonymous: result.anonymous,
76640
- has: result.has,
76641
- warnings: result.warnings,
76642
- trace: result.trace
75549
+ warnings: result.warnings
76643
75550
  },
76644
75551
  status: await status()
76645
75552
  }
@@ -76907,7 +75814,6 @@ function registerClinePassRoutes(ctx, options) {
76907
75814
  },
76908
75815
  error: entry.error,
76909
75816
  attempts: entry.attempts,
76910
- adherence: entry.adherence,
76911
75817
  fingerprint: entry.fingerprint,
76912
75818
  anonymous: entry.anonymous,
76913
75819
  warnings: entry.warnings
@@ -76935,28 +75841,9 @@ function registerClinePassRoutes(ctx, options) {
76935
75841
  }
76936
75842
  //#endregion
76937
75843
  //#region src/host/cline-pass/store.ts
76938
- /**
76939
- * Runtime observation state: pipeline detection, discovered upstream channels,
76940
- * per-channel verdicts, the last catalog scan, the last quota reading, and
76941
- * request history.
76942
- *
76943
- * Configuration lives in the settings file instead (see `token-store.ts`).
76944
- * Everything here is derived data any probe can rebuild, so it is never
76945
- * persisted.
76946
- *
76947
- * @module dsh-chatgpt-subscription/cline-pass-store
76948
- */
76949
- function verdict(status, note, ms) {
76950
- return {
76951
- status,
76952
- note: String(note ?? "").slice(0, 200),
76953
- ms: Number(ms ?? 0),
76954
- checkedAt: Date.now()
76955
- };
76956
- }
76957
75844
  /** Create the observation store. */
76958
75845
  function createClinePassStore({ historyLimit = 100 } = {}) {
76959
- /** Model id -> discovered metadata. */
75846
+ /** Model id -> observed response metadata. */
76960
75847
  const models = /* @__PURE__ */ new Map();
76961
75848
  /** Newest first. */
76962
75849
  const history = [];
@@ -76973,45 +75860,26 @@ function createClinePassStore({ historyLimit = 100 } = {}) {
76973
75860
  fetchedAt: 0
76974
75861
  };
76975
75862
  return {
76976
- /** Discovered metadata for one model (never undefined). */
75863
+ /** Observed metadata for one model (never undefined). */
76977
75864
  metaOf(model) {
76978
75865
  return models.get(model) ?? {};
76979
75866
  },
76980
- /** Every model with discovered metadata. */
75867
+ /** Every model with observed metadata. */
76981
75868
  allMeta() {
76982
75869
  return [...models.entries()].map(([id, meta]) => ({
76983
75870
  id,
76984
75871
  ...meta
76985
75872
  }));
76986
75873
  },
76987
- /** Merge one discovery result into a model's metadata. */
75874
+ /** Merge one response observation into a model's metadata. */
76988
75875
  learn(model, patch) {
76989
- const current = models.get(model) ?? {};
76990
75876
  const next = {
76991
- ...current,
75877
+ ...models.get(model) ?? {},
76992
75878
  ...patch
76993
75879
  };
76994
- if (patch.upstreamStatus !== void 0) next.upstreamStatus = {
76995
- ...current.upstreamStatus ?? {},
76996
- ...patch.upstreamStatus
76997
- };
76998
- if (next.upstreams !== void 0) next.upstreams = [...new Set(next.upstreams.map(String).filter((name) => name.length > 0))].slice(0, 64);
76999
75880
  models.set(model, next);
77000
75881
  return next;
77001
75882
  },
77002
- /** Record a verdict; explicit validation also replaces stale results with unknown. */
77003
- learnUpstream(model, upstream, status, note, ms, { includeUnknown = false } = {}) {
77004
- if (upstream === void 0 || upstream === null || upstream === "") return;
77005
- if (status === "unknown" && !includeUnknown) return;
77006
- const current = models.get(model) ?? {};
77007
- models.set(model, {
77008
- ...current,
77009
- upstreamStatus: {
77010
- ...current.upstreamStatus ?? {},
77011
- [upstream]: verdict(status, note, ms)
77012
- }
77013
- });
77014
- },
77015
75883
  /** Append one request-history row (newest first, bounded). */
77016
75884
  record(entry) {
77017
75885
  historyRevision += 1;
@@ -77029,7 +75897,6 @@ function createClinePassStore({ historyLimit = 100 } = {}) {
77029
75897
  usage: entry.usage ?? null,
77030
75898
  error: entry.error ?? "",
77031
75899
  attempts: entry.attempts ?? [],
77032
- adherence: entry.adherence ?? "",
77033
75900
  fingerprint: entry.fingerprint ?? "",
77034
75901
  anonymous: entry.anonymous === true,
77035
75902
  warnings: entry.warnings ?? [],
@@ -77088,11 +75955,9 @@ function createClinePassStore({ historyLimit = 100 } = {}) {
77088
75955
  /**
77089
75956
  * The model-facing `cline_pass_*` management tools.
77090
75957
  *
77091
- * They read and write the same settings file the provider runs from, so a pin
77092
- * written here takes effect on the very next model call. Registration is
77093
- * optional and read at startup (see `exposeTools`): eight definitions are several
77094
- * kilobytes of schema riding in every request's tool list, and a conversation
77095
- * that never manages the route does not need them.
75958
+ * They manage accounts, model visibility and diagnostics. Registration is
75959
+ * optional and read at startup (see `exposeTools`) so a conversation that never
75960
+ * manages the route does not carry these schemas in every request's tool list.
77096
75961
  *
77097
75962
  * @module dsh-chatgpt-subscription/cline-pass-tools
77098
75963
  */
@@ -77105,16 +75970,6 @@ function text$2(value) {
77105
75970
  function firstLine$1(value, max = 200) {
77106
75971
  return String(value ?? "").replace(/\s+/g, " ").trim().slice(0, max);
77107
75972
  }
77108
- /** Human label for one upstream availability verdict. */
77109
- const STATUS_LABEL = {
77110
- ok: "available",
77111
- limited: "rate-limited",
77112
- bad: "not-pinnable",
77113
- auth: "auth-failed",
77114
- "not-adopted": "not-adopted",
77115
- unknown: "unknown"
77116
- };
77117
- const statusLabel = (status) => STATUS_LABEL[status] ?? String(status ?? "unknown");
77118
75973
  const ACCOUNT_SCHEMA = {
77119
75974
  type: "object",
77120
75975
  additionalProperties: false,
@@ -77139,50 +75994,6 @@ const ACCOUNT_SCHEMA = {
77139
75994
  authStatus: { type: "string" }
77140
75995
  }
77141
75996
  };
77142
- const TRACE_SCHEMA = {
77143
- type: "object",
77144
- additionalProperties: false,
77145
- properties: {
77146
- upstream: {
77147
- type: "string",
77148
- required: true
77149
- },
77150
- status: {
77151
- type: "integer",
77152
- required: true
77153
- },
77154
- ms: {
77155
- type: "integer",
77156
- required: true
77157
- },
77158
- note: {
77159
- type: "string",
77160
- required: true
77161
- }
77162
- }
77163
- };
77164
- const VALIDATE_RESULT_SCHEMA = {
77165
- type: "object",
77166
- additionalProperties: false,
77167
- properties: {
77168
- upstream: {
77169
- type: "string",
77170
- required: true
77171
- },
77172
- status: {
77173
- type: "string",
77174
- required: true
77175
- },
77176
- ms: {
77177
- type: "integer",
77178
- required: true
77179
- },
77180
- note: {
77181
- type: "string",
77182
- required: true
77183
- }
77184
- }
77185
- };
77186
75997
  const MODEL_SCHEMA = {
77187
75998
  type: "object",
77188
75999
  additionalProperties: false,
@@ -77199,72 +76010,10 @@ const MODEL_SCHEMA = {
77199
76010
  type: "string",
77200
76011
  required: true
77201
76012
  },
77202
- pinnable: {
77203
- type: "boolean",
77204
- required: true
77205
- },
77206
76013
  hidden: {
77207
76014
  type: "boolean",
77208
76015
  required: true
77209
76016
  },
77210
- pinMode: {
77211
- type: "string",
77212
- required: true
77213
- },
77214
- sort: {
77215
- type: "string",
77216
- required: true
77217
- },
77218
- has: {
77219
- type: "array",
77220
- required: true,
77221
- items: { type: "string" }
77222
- },
77223
- pinned: {
77224
- type: "array",
77225
- required: true,
77226
- items: { type: "string" }
77227
- },
77228
- excluded: {
77229
- type: "array",
77230
- required: true,
77231
- items: { type: "string" }
77232
- },
77233
- upstreams: {
77234
- type: "array",
77235
- required: true,
77236
- items: { type: "string" }
77237
- },
77238
- upstreamStatus: {
77239
- type: "array",
77240
- required: true,
77241
- items: {
77242
- type: "object",
77243
- additionalProperties: false,
77244
- properties: {
77245
- upstream: {
77246
- type: "string",
77247
- required: true
77248
- },
77249
- status: {
77250
- type: "string",
77251
- required: true
77252
- },
77253
- ms: {
77254
- type: "integer",
77255
- required: true
77256
- },
77257
- note: {
77258
- type: "string",
77259
- required: true
77260
- },
77261
- checkedAt: {
77262
- type: "integer",
77263
- required: true
77264
- }
77265
- }
77266
- }
77267
- },
77268
76017
  lastProvider: {
77269
76018
  type: "string",
77270
76019
  required: true
@@ -77272,14 +76021,6 @@ const MODEL_SCHEMA = {
77272
76021
  lastMs: {
77273
76022
  type: "integer",
77274
76023
  required: true
77275
- },
77276
- probedAt: {
77277
- type: "integer",
77278
- required: true
77279
- },
77280
- validatedAt: {
77281
- type: "integer",
77282
- required: true
77283
76024
  }
77284
76025
  }
77285
76026
  };
@@ -77291,25 +76032,9 @@ function projectModel(status, model) {
77291
76032
  id: entry.id,
77292
76033
  displayName: entry.name.replace(/^cline-pass\//, ""),
77293
76034
  pipeline: entry.pipeline,
77294
- pinnable: entry.pinnable,
77295
76035
  hidden: !entry.enabled,
77296
- pinMode: normalizePinMode(entry.pinMode),
77297
- sort: entry.sort,
77298
- has: entry.has,
77299
- pinned: entry.pinned,
77300
- excluded: entry.excluded,
77301
- upstreams: entry.upstreams,
77302
- upstreamStatus: entry.upstreamStatus.map((verdict) => ({
77303
- upstream: verdict.upstream,
77304
- status: verdict.status,
77305
- ms: Math.round(verdict.ms),
77306
- note: verdict.note,
77307
- checkedAt: Math.round(verdict.checkedAt)
77308
- })),
77309
76036
  lastProvider: entry.lastProvider,
77310
- lastMs: Math.round(entry.lastMs),
77311
- probedAt: Math.round(entry.probedAt),
77312
- validatedAt: Math.round(entry.validatedAt)
76037
+ lastMs: Math.round(entry.lastMs)
77313
76038
  };
77314
76039
  }
77315
76040
  /**
@@ -77319,10 +76044,9 @@ function projectModel(status, model) {
77319
76044
  function registerClinePassTools(ctx, options) {
77320
76045
  const { settings, accountPool, store, engine, status, serving } = options;
77321
76046
  const disposers = [];
77322
- const pinOf = async (model) => (await settings.read()).pins[model] ?? defaultPin(model);
77323
76047
  disposers.push(ctx.tools.register(defineTool({
77324
76048
  name: "cline_pass_status",
77325
- description: "Report the Cline Pass provider state: route, accounts and whether each key is stored, account mode, model and pin counts. Read-only and free. Check this first when a Cline Pass model fails.",
76049
+ description: "Report the Cline Pass provider state: route, accounts, account mode and model count. Read-only and free. Check this first when a Cline Pass model fails.",
77326
76050
  parameters: {},
77327
76051
  isConcurrencySafe: () => true,
77328
76052
  timeoutMs: 3e4,
@@ -77359,14 +76083,6 @@ function registerClinePassTools(ctx, options) {
77359
76083
  knownModels: {
77360
76084
  type: "integer",
77361
76085
  required: true
77362
- },
77363
- pinnedModels: {
77364
- type: "integer",
77365
- required: true
77366
- },
77367
- probedModels: {
77368
- type: "integer",
77369
- required: true
77370
76086
  }
77371
76087
  }
77372
76088
  },
@@ -77376,7 +76092,7 @@ function registerClinePassTools(ctx, options) {
77376
76092
  `accountMode=${value.accountMode}`,
77377
76093
  `accounts (${value.accounts.length}):`,
77378
76094
  ...value.accounts.map((account) => ` ${account.alias} (${account.id})${account.enabled ? "" : " (disabled)"}${account.authStatus ? ` [${account.authStatus}]` : ""}`),
77379
- `models: known=${value.knownModels} pinned=${value.pinnedModels} probed=${value.probedModels}`
76095
+ `models: known=${value.knownModels}`
77380
76096
  ].join("\n"))
77381
76097
  },
77382
76098
  async execute() {
@@ -77395,15 +76111,13 @@ function registerClinePassTools(ctx, options) {
77395
76111
  ...account.cooldownUntil === void 0 ? {} : { cooldownUntil: Math.round(account.cooldownUntil) },
77396
76112
  ...account.authStatus === void 0 ? {} : { authStatus: account.authStatus }
77397
76113
  })),
77398
- knownModels: current.models.length,
77399
- pinnedModels: current.models.filter((model) => model.pinned.length > 0).length,
77400
- probedModels: current.models.filter((model) => model.probedAt > 0).length
76114
+ knownModels: current.models.length
77401
76115
  };
77402
76116
  }
77403
76117
  })));
77404
76118
  disposers.push(ctx.tools.register(defineTool({
77405
76119
  name: "cline_pass_models",
77406
- description: "List the Cline Pass models with their pipeline, discovered channels, per-channel verdicts, visibility and stored pin. Pass `model` to filter by substring, `refresh: true` to rescan the official model list, `model` + `visible` to show/hide one model in every picker, or `mode` to show/hide them all at once. Free unless `refresh` is set.",
76120
+ description: "List Cline Pass models with visibility and observed response routing. Pass `model` to filter by substring, `refresh: true` to rescan the official model list, `model` + `visible` to show/hide one model, or `mode` to change them all. Free unless `refresh` is set.",
77407
76121
  parameters: {
77408
76122
  model: {
77409
76123
  type: "string",
@@ -77456,13 +76170,7 @@ function registerClinePassTools(ctx, options) {
77456
76170
  },
77457
76171
  render: (_args, value) => {
77458
76172
  const blocks = value.models.map((model) => {
77459
- const lines = [`${model.id} pipeline=${model.pipeline || "unknown"}${model.pinnable ? "" : " (not pinnable)"}${model.hidden ? " (hidden from pickers)" : ""}`, ` pinned=${model.pinned.length === 0 ? "(auto)" : model.pinned.join(" > ")} mode=${model.pinMode}${model.sort === "" ? "" : ` sort=${model.sort}`}${model.excluded.length === 0 ? "" : ` excluded=${model.excluded.join(",")}`}`];
77460
- if (model.upstreams.length > 0) {
77461
- const verdicts = new Map(model.upstreamStatus.map((entry) => [entry.upstream, entry.status]));
77462
- lines.push(` upstreams: ${model.upstreams.map((upstream) => `${upstream}[${statusLabel(verdicts.get(upstream) ?? "unknown")}]`).join(" ")}`);
77463
- } else lines.push(" upstreams: (unknown — run cline_pass_probe for this model)");
77464
- if (model.lastProvider !== "") lines.push(` last=${model.lastProvider} (${model.lastMs}ms)`);
77465
- return lines.join("\n");
76173
+ return [`${model.id} pipeline=${model.pipeline || "unknown"}${model.hidden ? " (hidden from pickers)" : ""}`, model.lastProvider === "" ? "" : ` last=${model.lastProvider} (${model.lastMs}ms)`].filter((line) => line !== "").join("\n");
77466
76174
  });
77467
76175
  return text$2([
77468
76176
  `${value.models.length} Cline Pass model(s); official catalog=${value.catalogCount}${value.catalogSources.length === 0 ? "" : ` via ${value.catalogSources.join(",")}`}`,
@@ -77538,221 +76246,13 @@ function registerClinePassTools(ctx, options) {
77538
76246
  }
77539
76247
  })));
77540
76248
  disposers.push(ctx.tools.register(defineTool({
77541
- name: "cline_pass_probe",
77542
- description: "Detect how one model is routed and harvest its pinnable upstream channels, with one tiny real request. Run it before pinning, and again when a pin that used to work stops working.",
77543
- parameters: { model: {
77544
- type: "string",
77545
- required: true,
77546
- description: "Model id, e.g. \"cline-pass/glm-5.2\"."
77547
- } },
77548
- timeoutMs: 6e5,
77549
- output: {
77550
- schema: {
77551
- type: "object",
77552
- additionalProperties: false,
77553
- properties: {
77554
- ok: {
77555
- type: "boolean",
77556
- required: true
77557
- },
77558
- model: {
77559
- type: "string",
77560
- required: true
77561
- },
77562
- error: {
77563
- type: "string",
77564
- required: true
77565
- },
77566
- ms: {
77567
- type: "integer",
77568
- required: true
77569
- },
77570
- pipeline: {
77571
- type: "string",
77572
- required: true
77573
- },
77574
- pinnable: {
77575
- type: "boolean",
77576
- required: true
77577
- },
77578
- canonicalSlug: {
77579
- type: "string",
77580
- required: true
77581
- },
77582
- lastProvider: {
77583
- type: "string",
77584
- required: true
77585
- },
77586
- upstreams: {
77587
- type: "array",
77588
- required: true,
77589
- items: { type: "string" }
77590
- },
77591
- availableProviders: {
77592
- type: "array",
77593
- required: true,
77594
- items: { type: "string" }
77595
- },
77596
- tier0: {
77597
- type: "array",
77598
- required: true,
77599
- items: { type: "string" }
77600
- }
77601
- }
77602
- },
77603
- render: (_args, value) => {
77604
- if (!value.ok) return text$2(`probe ${value.model} failed: ${value.error}`);
77605
- return text$2([
77606
- `probe ${value.model}: ok in ${value.ms}ms`,
77607
- `pipeline=${value.pipeline} pinnable=${value.pinnable} canonicalSlug=${value.canonicalSlug || "-"} lastProvider=${value.lastProvider || "-"}`,
77608
- value.upstreams.length === 0 ? "upstreams: (none discovered)" : `upstreams (${value.upstreams.length}): ${value.upstreams.join(", ")}`,
77609
- value.tier0.length === 0 ? "" : `tier0: ${value.tier0.join(", ")}`
77610
- ].filter((line) => line !== "").join("\n"));
77611
- }
77612
- },
77613
- async execute(args, exec) {
77614
- const model = String(args.model).trim();
77615
- const result = await engine.probe(model, { signal: exec.signal });
77616
- return {
77617
- ok: result.ok,
77618
- model,
77619
- error: firstLine$1(result.error, 400),
77620
- ms: Math.round(result.ms),
77621
- pipeline: result.pipeline,
77622
- pinnable: result.pinnable,
77623
- canonicalSlug: result.canonicalSlug,
77624
- lastProvider: result.lastProvider,
77625
- upstreams: result.upstreams,
77626
- availableProviders: result.availableProviders,
77627
- tier0: result.tier0
77628
- };
77629
- }
77630
- })));
77631
- disposers.push(ctx.tools.register(defineTool({
77632
- name: "cline_pass_validate",
77633
- description: "Test every known channel of one model, one tiny real request each, and report a verdict per channel: available, rate-limited, not-pinnable, or auth-failed. This is the ground truth behind a pin. Probe the model first so its channel list exists.",
76249
+ name: "cline_pass_test",
76250
+ description: "Send one small, automatically routed request and report which upstream served it. No client-side routing fields are sent.",
77634
76251
  parameters: { model: {
77635
76252
  type: "string",
77636
76253
  required: true,
77637
76254
  description: "Model id, e.g. \"cline-pass/glm-5.2\"."
77638
76255
  } },
77639
- timeoutMs: 18e5,
77640
- output: {
77641
- schema: {
77642
- type: "object",
77643
- additionalProperties: false,
77644
- properties: {
77645
- ok: {
77646
- type: "boolean",
77647
- required: true
77648
- },
77649
- model: {
77650
- type: "string",
77651
- required: true
77652
- },
77653
- error: {
77654
- type: "string",
77655
- required: true
77656
- },
77657
- summary: {
77658
- type: "object",
77659
- required: true,
77660
- additionalProperties: false,
77661
- properties: {
77662
- ok: {
77663
- type: "integer",
77664
- required: true
77665
- },
77666
- limited: {
77667
- type: "integer",
77668
- required: true
77669
- },
77670
- bad: {
77671
- type: "integer",
77672
- required: true
77673
- },
77674
- auth: {
77675
- type: "integer",
77676
- required: true
77677
- },
77678
- unknown: {
77679
- type: "integer",
77680
- required: true
77681
- }
77682
- }
77683
- },
77684
- results: {
77685
- type: "array",
77686
- required: true,
77687
- items: VALIDATE_RESULT_SCHEMA
77688
- }
77689
- }
77690
- },
77691
- render: (_args, value) => {
77692
- if (!value.ok) return text$2(`validate ${value.model} failed: ${value.error}`);
77693
- return text$2([
77694
- `validate ${value.model}: ${value.results.length} upstream(s)`,
77695
- `available=${value.summary.ok} rate-limited=${value.summary.limited} not-pinnable=${value.summary.bad} auth-failed=${value.summary.auth} unknown=${value.summary.unknown}`,
77696
- ...value.results.map((entry) => `${entry.upstream}: ${statusLabel(entry.status)} (${entry.ms}ms)${entry.note === "" ? "" : ` — ${entry.note}`}`)
77697
- ].join("\n"));
77698
- }
77699
- },
77700
- async execute(args, exec) {
77701
- const model = String(args.model).trim();
77702
- const meta = store.metaOf(model);
77703
- if (!Array.isArray(meta.upstreams) || meta.upstreams.length === 0) return {
77704
- ok: false,
77705
- model,
77706
- error: "no known upstream channels: run cline_pass_probe for this model first",
77707
- summary: {
77708
- ok: 0,
77709
- limited: 0,
77710
- bad: 0,
77711
- auth: 0,
77712
- unknown: 0
77713
- },
77714
- results: []
77715
- };
77716
- const outcome = await engine.validate(model, { signal: exec.signal });
77717
- return {
77718
- ok: true,
77719
- model,
77720
- error: "",
77721
- summary: outcome.summary,
77722
- results: outcome.results.map((result) => ({
77723
- upstream: result.upstream,
77724
- status: result.status,
77725
- ms: Math.round(result.ms),
77726
- note: result.note.slice(0, 160)
77727
- }))
77728
- };
77729
- }
77730
- })));
77731
- disposers.push(ctx.tools.register(defineTool({
77732
- name: "cline_pass_test",
77733
- description: "Send one small real request through a pin and report which upstream served it, with the failover trace. `upstreams` and `exclude` override the stored pin for this call only; omit both to exercise it as stored. Nothing is persisted.",
77734
- parameters: {
77735
- model: {
77736
- type: "string",
77737
- required: true,
77738
- description: "Model id, e.g. \"cline-pass/glm-5.2\"."
77739
- },
77740
- upstreams: {
77741
- type: "array",
77742
- items: { type: "string" },
77743
- description: "Ordered upstream candidates for this call only."
77744
- },
77745
- exclude: {
77746
- type: "array",
77747
- items: { type: "string" },
77748
- description: "Upstream channels to exclude for this call only."
77749
- },
77750
- has: {
77751
- type: "array",
77752
- items: { type: "string" },
77753
- description: "Vercel gateway capability filter for this call only."
77754
- }
77755
- },
77756
76256
  timeoutMs: 6e5,
77757
76257
  output: {
77758
76258
  schema: {
@@ -77787,45 +76287,18 @@ function registerClinePassTools(ctx, options) {
77787
76287
  type: "string",
77788
76288
  required: true
77789
76289
  },
77790
- adherence: {
77791
- type: "string",
77792
- required: true
77793
- },
77794
- has: {
77795
- type: "array",
77796
- required: true,
77797
- items: { type: "string" }
77798
- },
77799
76290
  warnings: {
77800
76291
  type: "array",
77801
76292
  required: true,
77802
76293
  items: { type: "string" }
77803
- },
77804
- trace: {
77805
- type: "array",
77806
- required: true,
77807
- items: TRACE_SCHEMA
77808
76294
  }
77809
76295
  }
77810
76296
  },
77811
- render: (_args, value) => {
77812
- const trace = value.trace.map((entry) => ` ${entry.upstream} -> HTTP ${entry.status} in ${entry.ms}ms${entry.note === "" ? "" : ` — ${entry.note}`}`);
77813
- return text$2([
77814
- value.ok ? `test ${value.model}: ok in ${value.ms}ms via ${value.actual || "(unknown)"}` : `test ${value.model}: FAILED — ${value.error}`,
77815
- ...value.warnings.map((warning) => `⚠ ${warning}`),
77816
- trace.length === 0 ? "" : `attempts (${trace.length}):`,
77817
- ...trace
77818
- ].filter((line) => line !== "").join("\n"));
77819
- }
76297
+ render: (_args, value) => text$2([value.ok ? `test ${value.model}: ok in ${value.ms}ms via ${value.actual || "(unknown)"}` : `test ${value.model}: FAILED — ${value.error}`, ...value.warnings.map((warning) => `⚠ ${warning}`)].join("\n"))
77820
76298
  },
77821
76299
  async execute(args, exec) {
77822
76300
  const model = String(args.model).trim();
77823
- const result = await engine.test(model, {
77824
- upstreams: Array.isArray(args.upstreams) ? args.upstreams.map(String) : void 0,
77825
- exclude: Array.isArray(args.exclude) ? args.exclude.map(String) : void 0,
77826
- has: Array.isArray(args.has) ? args.has.map(String) : void 0,
77827
- signal: exec.signal
77828
- });
76301
+ const result = await engine.test(model, { signal: exec.signal });
77829
76302
  return {
77830
76303
  ok: result.ok,
77831
76304
  model,
@@ -77834,142 +76307,7 @@ function registerClinePassTools(ctx, options) {
77834
76307
  actual: result.actual,
77835
76308
  pipeline: result.pipeline,
77836
76309
  account: result.account,
77837
- adherence: result.adherence,
77838
- has: result.has,
77839
- warnings: result.warnings,
77840
- trace: result.trace.map((entry) => ({
77841
- upstream: entry.upstream,
77842
- status: entry.status,
77843
- ms: Math.round(entry.ms),
77844
- note: entry.note.slice(0, 160)
77845
- }))
77846
- };
77847
- }
77848
- })));
77849
- disposers.push(ctx.tools.register(defineTool({
77850
- name: "cline_pass_pin",
77851
- description: "Persist one model's upstream pin. `upstreams` is the ordered candidate list, primary first (an empty array returns the model to automatic routing); `exclude` lists channels that must never be used, compiled into an allow-list on the wire because the gateway ignores an ignore-field; `pinMode` is \"strict\" or \"preferred\"; `sort` orders candidates by \"cost\", \"ttft\" or \"tps\" (\"none\" clears it). Only the fields you supply change. Returns `warnings` when a name cannot be checked or an exclusion cannot be expressed.",
77852
- parameters: {
77853
- model: {
77854
- type: "string",
77855
- required: true,
77856
- description: "Model id, e.g. \"cline-pass/glm-5.2\"."
77857
- },
77858
- upstreams: {
77859
- type: "array",
77860
- items: { type: "string" },
77861
- description: "Ordered pin list; an empty array clears pinning."
77862
- },
77863
- exclude: {
77864
- type: "array",
77865
- items: { type: "string" },
77866
- description: "Channels that must never be used."
77867
- },
77868
- pinMode: {
77869
- type: "string",
77870
- enum: ["strict", "preferred"],
77871
- description: "How strictly to honor the pin list."
77872
- },
77873
- sort: {
77874
- type: "string",
77875
- enum: [
77876
- "cost",
77877
- "ttft",
77878
- "tps",
77879
- "none"
77880
- ],
77881
- description: "Reorder candidates by this metric; \"none\" clears it."
77882
- },
77883
- has: {
77884
- type: "array",
77885
- items: { type: "string" },
77886
- description: "Vercel gateway capability filter; omit to keep the stored value, or pass an empty array to clear it."
77887
- }
77888
- },
77889
- timeoutMs: 3e4,
77890
- output: {
77891
- schema: {
77892
- type: "object",
77893
- additionalProperties: false,
77894
- properties: {
77895
- ok: {
77896
- type: "boolean",
77897
- required: true
77898
- },
77899
- model: {
77900
- type: "string",
77901
- required: true
77902
- },
77903
- pinned: {
77904
- type: "array",
77905
- required: true,
77906
- items: { type: "string" }
77907
- },
77908
- excluded: {
77909
- type: "array",
77910
- required: true,
77911
- items: { type: "string" }
77912
- },
77913
- pinMode: {
77914
- type: "string",
77915
- required: true
77916
- },
77917
- sort: {
77918
- type: "string",
77919
- required: true
77920
- },
77921
- has: {
77922
- type: "array",
77923
- required: true,
77924
- items: { type: "string" }
77925
- },
77926
- warnings: {
77927
- type: "array",
77928
- required: true,
77929
- items: { type: "string" }
77930
- }
77931
- }
77932
- },
77933
- render: (_args, value) => text$2([
77934
- `pinned ${value.model}`,
77935
- `upstreams: ${value.pinned.length === 0 ? "(auto)" : value.pinned.join(" > ")}`,
77936
- `exclude: ${value.excluded.length === 0 ? "(none)" : value.excluded.join(", ")}`,
77937
- `pinMode=${value.pinMode} sort=${value.sort === "" ? "none" : value.sort} has=${value.has.length === 0 ? "(none)" : value.has.join(",")}`,
77938
- ...value.warnings.map((warning) => `⚠ ${warning}`)
77939
- ].join("\n"))
77940
- },
77941
- async execute(args) {
77942
- const model = String(args.model).trim();
77943
- const current = await pinOf(model);
77944
- const next = {
77945
- upstreams: Array.isArray(args.upstreams) ? args.upstreams.map(String) : current.upstreams,
77946
- exclude: Array.isArray(args.exclude) ? args.exclude.map(String) : current.exclude,
77947
- pinMode: args.pinMode !== void 0 ? args.pinMode === "preferred" ? "preferred" : "strict" : current.pinMode,
77948
- sort: args.sort === void 0 ? current.sort : args.sort === "none" ? "" : String(args.sort),
77949
- has: Array.isArray(args.has) ? args.has.map(String).map((name) => name.trim()).filter((name) => name !== "") : current.has
77950
- };
77951
- await settings.setPin(model, next);
77952
- const meta = store.metaOf(model);
77953
- const known = Array.isArray(meta.upstreams) ? meta.upstreams.map(String) : [];
77954
- const warnings = [...pinWarnings({
77955
- upstream: next.upstreams[0] ?? null,
77956
- excludeList: next.exclude
77957
- }, meta)];
77958
- const named = [...next.upstreams, ...next.exclude];
77959
- if (named.length > 0) if (known.length === 0) warnings.push(`unverifiedChannel: this model has no discovered channel list yet, so ${named.join(", ")} cannot be checked — run cline_pass_probe for it`);
77960
- else {
77961
- const unknown = named.filter((name) => !known.includes(name));
77962
- if (unknown.length > 0) warnings.push(`unknownChannel: ${unknown.join(", ")} is not in this model's discovered channel list (${known.join(", ")}); confirm with cline_pass_test, because the gateway ignores a channel it cannot use rather than failing`);
77963
- }
77964
- return {
77965
- ok: true,
77966
- model,
77967
- pinned: next.upstreams,
77968
- excluded: next.exclude,
77969
- pinMode: normalizePinMode(next.pinMode),
77970
- sort: next.sort,
77971
- has: next.has,
77972
- warnings
76310
+ warnings: result.warnings
77973
76311
  };
77974
76312
  }
77975
76313
  })));
@@ -78232,10 +76570,6 @@ function createClinePassLine(ctx, options) {
78232
76570
  ...options.modelFetchFn === void 0 ? {} : { streamFetchFn: options.modelFetchFn },
78233
76571
  accountPool,
78234
76572
  store,
78235
- pinFor: (model) => ({
78236
- ...modelSettings.status().pins[model] ?? defaultPin(model),
78237
- spelling: modelSettings.status().pinSpelling
78238
- }),
78239
76573
  baseURL: () => modelSettings.status().baseURL,
78240
76574
  logger: ctx.logger
78241
76575
  });
@@ -95513,6 +93847,7 @@ const DISPATCH_PRESET = {
95513
93847
 
95514
93848
  [Coordinator Identity] You are the Lead & Dispatch Agent: converge requirements, plan architecture, select R1 topology (Lead-Core / Hybrid / Fan-out), orchestrate subagents where ROI is positive, and own final acceptance.
95515
93849
  [Execution Pipeline] R0 Triage -> (L2) R-G Interview -> R9 Plan -> R1 Topology -> (if delegating: R2 Routing -> R5 Brief -> R-W Wait) -> R6 Acceptance.
93850
+ [Dispatch Native Tool Whitelist] Top-level: only code_run, cache_warmup_result, dispatch_ledger, progress_update, and structured_output. Every task tool—including win_bash—is program-only: use await tools.<name>(...) inside code_run, never top-level. "One call" = ONE code_run with exactly one sub-call; approval = ONE code_run containing only tools.exit_plan_mode(...).
95516
93851
 
95517
93852
  [Agent Teams Board] A current harness adds exactly one Agent Teams surface beside this mode: the shared task board (team_task_create and its list/get/update siblings). It is bookkeeping, not a second dispatcher. The board tools stay declared whether or not the board is on - frozen declaration, not availability - so confirm with team_task_list before relying on it. When it is on, the dispatch ledger stays the dispatch authority and R5 briefs stay the task contract; publish cross-agent dependencies (blocked_by) and write scopes on one team task per brief, claimed and completed by the child that owns it; never start work because a task is ready, and never reassign a task to skip R6.
95518
93853
 
@@ -95527,7 +93862,7 @@ When in doubt, clarify before escalating; if complexity grows mid-task, stop, re
95527
93862
  ## R-G · Clarification Interview (L2 Only, Always Before Planning)
95528
93863
  - G1 Design Tree: Model requirements as a dependency tree of decisions; never list flat questions.
95529
93864
  - G2 Frontier & Rounds: Ask the entire current frontier (decisions whose prerequisites are settled) in one round, wait for answers, recompute the frontier, and repeat. Never ask one question per round, never ask dependent questions together.
95530
- - G3 Execution via Tool: Submit each round in a single ask_user_question call with stable ids, concise headers, and your recommended option first marked "(Recommended)", formatted as "Q1 — Title / Question body / Recommended answer". The same rule covers every decision stop outside the interview; see R-W.
93865
+ - G3 Execution via Tool: Submit each round in ONE code_run program that returns exactly one tools.ask_user_question(...) sub-call with stable ids, concise headers, and your recommended option first marked "(Recommended)", formatted as "Q1 — Title / Question body / Recommended answer". The same rule covers every decision stop outside the interview; see R-W. Copy argument property names verbatim from the schema: Q1/G4 are rule ids, never argument-key suffixes.
95531
93866
  - G4 Facts Are Yours, Decisions Are the User's: Never ask the user for repository facts verifiable by reading code or searching files; inspect read-only yourself or dispatch a read-only subagent per R2 (subagent model routes are provided directly by list_subagent_models) without blocking unrelated frontier questions. The same holds for any technical, naming, layout, or styling choice that an established reference in the repository or in AGENTS.md already settles: treat it as a repository fact (target_basis: existing-standard), follow the existing standard, and do not ask the user. Reserve ask_user_question strictly for unsettled product or design decisions with no established precedent.
95532
93867
  - G5 Convergence: End the interview only when the frontier is empty and the user explicitly confirms shared understanding.
95533
93868
  - G6 Prohibited: Answering your own questions, making product/design decisions for the user, skipping the interview, or treating a casual remark as full sign-off.
@@ -95556,19 +93891,19 @@ A subagent has full authority to plan, execute, and self-verify within its assig
95556
93891
  Every task brief covers six elements: Goal / Boundary (which files or modules may be touched) / Constraints / Limits (see below) / Acceptance Criteria / Required Evidence to Report.
95557
93892
  - [Compact Delta Brief] Standing default limits and the report schema already live in [Role Identification], so use a Compact Delta Brief by default: state Goal, original file/line Source Pointers (do not paraphrase code into long prose), Module-Interface Boundary, Constraints, Acceptance Criteria, and Required Evidence, and omit repeating standing limits unless overriding them.
95558
93893
  - [Limits] When overriding any standing limit, write one line per limit spelling out four things: **what it bounds, in what unit, the cap, and whether it accumulates**. Write explicit caps ("at most 3 attempts", "edits at most 5 files", "test runs: unlimited"), never ranges ("2–5 files"); where an override dimension is left unstated, silence is read as a limit of zero, and a quota that resets per cycle is lost, not banked.
95559
- - Do not ask the child to restate your rules back as a correctness check; if a limit is genuinely unclear, instruct the child to spend one minimal tool call to verify it. Dispatch independent tasks concurrently in one message (native calls; use code_run Promise.all for batch filter/MCP) only after the interview has converged.
93894
+ - Do not ask the child to restate your rules back as a correctness check; if a limit is genuinely unclear, instruct the child to spend one minimal tool call to verify it. Dispatch independent tasks concurrently through code_run Promise.all only after the interview has converged.
95560
93895
 
95561
93896
  ## R6 · Review & Acceptance
95562
93897
  Two layers: subagent self-check -> your independent review (reading diffs, running tests, checking each criterion). The completion notification is a post-hoc signal: it tells you a child stopped, not that the work passed.
95563
93898
  - Re-dispatch budget per brief: 1 first attempt + at most 2 re-dispatches = at most 3 runs total. Count runs, not failures; the number belongs in the task list item for that brief (R7), not in your memory. Only after the third run fails, transition to R8 Fallback.
95564
93899
  - [Non-Penalized hand_back] A subagent that stops cleanly before mutating any out-of-boundary file and reports status: hand_back with a valid hand_back_reason is a scope routing event, not an execution failure, and does not increment the brief’s 3-run failure counter. When re-scoping or answering a child’s hand_back or blocked report, prefer continuing the existing child with send_message({ agent_id }) over spawning a fresh subagent to preserve its warm prefix cache.
95565
- - [Noticed but not handled] Every defect found in review: the defect goes back out on a re-dispatch with evidence or go to the user via ask_user_question (R-W); on Lead-Core/Hybrid core, fix and re-verify before delivery. Writing it into the delivery summary and shipping anyway is not an available outcome.
93900
+ - [Noticed but not handled] Every defect found in review: the defect goes back out on a re-dispatch with evidence or go to the user via tools.ask_user_question inside code_run (R-W); on Lead-Core/Hybrid core, fix and re-verify before delivery. Writing it into the delivery summary and shipping anyway is not an available outcome.
95566
93901
  - [UI Visual Evidence Gate] For any task or subtask that changes visible UI or GUI layout, styling, or components, acceptance requires both Before and After visual evidence—screenshots or live DOM/rendered captures—taken under the same scenario, viewport, and theme. After-only evidence fails R6 review.
95567
93902
 
95568
93903
  ## R-W · Turn Boundary (Waiting / Goals / Questions)
95569
93904
  - [Waiting for Subagents] End your turn and let the subagent completion notification wake you. Treat it as "there is now something to review", never as "this passed". Never run sleep, polling loops, watch, or placeholder long commands to wait; only call job_output({ wait: true }) when genuinely blocked on an immediate collection. State who was dispatched, what you are waiting for, and what you will do next before ending the turn.
95570
93905
  - [Goals] Do not proactively create goals: never call create_goal or /goal unless the user asks; track tasks in todo_write.
95571
- - [Questions] Whenever a decision is missing, hand the question out with a single ask_user_question call. Only two exceptions: plan-mode approval still goes through exit_plan_mode, and a finished task asks nothing.
93906
+ - [Questions] Whenever a decision is missing, hand the question out with ONE code_run program containing exactly one tools.ask_user_question(...) sub-call. Only two exceptions: plan-mode approval still goes through tools.exit_plan_mode inside code_run, and a finished task asks nothing.
95572
93907
 
95573
93908
  ## R7 · Documentation
95574
93909
  Maintain the task list (in todo_write, not create_goal; see R-W), decision log, and interview conclusions; Each task item carries its own run count.
@@ -95579,8 +93914,8 @@ Maintain the task list (in todo_write, not create_goal; see R-W), decision log,
95579
93914
  Fallback is a task-scoped, non-session-wide exception for delegated briefs: it covers only the single task that triggered it. Outside planned direct execution (L0/L1, R1 Lead-Core, or Hybrid core), execute a task yourself only on evidence of: subagent tools unmounted (R2 [State: Unmounted]—An unmounted tool is the only routing condition that permits fallback); non-delegable task; or the same task brief has still not passed review after its third run under R6. Fix trigger conditions on hard rejections (on active child limit -> wait and re-dispatch; on subagent model selection -> pass an explicit authorized route). When the next task begins, always return to R0 to triage anew.
95580
93915
 
95581
93916
  ## R9 · Plan Pipeline (Converged Interview -> Plan Mode -> Plan -> Approval)
95582
- - Trigger: only for L2 once R-G has converged. Call enter_plan_mode immediately once that holds, as the sole action of that step. Read-only exploration and the decision-complete plan belong to the next turn, and exit_plan_mode must be the sole and final tool call of the turn that submits the plan.
95583
- - Rejection & Abandon: on "Keep planning", revise and resubmit via exit_plan_mode; call leave_plan_mode only when the user explicitly says no plan is wanted. When enter_plan_mode is absent, the degraded path is one ask_user_question asking the user to enter /plan.
93917
+ - Trigger: only for L2 once R-G has converged. Call tools.enter_plan_mode inside ONE code_run immediately once that holds, as the sole top-level action of that step. Read-only exploration and the decision-complete plan belong to the next turn, and ONE code_run containing only tools.exit_plan_mode must be the sole and final top-level tool call of the turn that submits the plan.
93918
+ - Rejection & Abandon: on "Keep planning", revise and resubmit via tools.exit_plan_mode inside code_run; call tools.leave_plan_mode inside code_run only when the user explicitly says no plan is wanted. When enter_plan_mode is absent, the degraded path is ONE code_run program containing exactly one tools.ask_user_question(...) sub-call asking the user to enter /plan.
95584
93919
  - Subagent: where the host exposes the live root set (agents.roots()), a call made by a live child is rejected with DELEGATED_CALLER, while an older generation cannot determine roots at all and the bridge lets the call through. Never rely on that rejection: it carries the open decision, including any request to enter Plan Mode, back to its dispatcher.
95585
93920
 
95586
93921
  ## Anti-Patterns (Any Occurrence Is a Violation)
@@ -95588,7 +93923,7 @@ Fallback is a task-scoped, non-session-wide exception for delegated briefs: it c
95588
93923
  2. Switching to teammate vocabulary to keep orchestrating, or Treating the team task board as a substitute for R1 topology, R2 routing, R5 briefs, R6 acceptance, or R-W waiting (R1, R6).
95589
93924
  3. Omitting provider/model under [State: Listed], Second-guessing list_subagent_models output by hunting through local config or source files just to check which subagent models are allowed, or Reporting a route as "authorized", or claiming per-task routing is in force, when the session recorded no allowlist (R2).
95590
93925
  4. Writing a task brief with a range where a cap belongs ("2–5 files", "a few attempts"), or Asking a subagent to restate its rules as a correctness check (R0, R5).
95591
- 5. Running sleep, polling loops, or placeholder long commands to wait, Proactively creating a goal at the start of a task, or Ending with a paragraph of prose to wait for user sign-off instead of calling ask_user_question (R-W).
93926
+ 5. Running sleep, polling loops, or placeholder long commands to wait, Proactively creating a goal at the start of a task, or Ending with a paragraph of prose to wait for user sign-off instead of asking through tools.ask_user_question inside code_run (R-W).
95592
93927
  6. Directly editing a subagent's module, declaring completion without verification, or Shipping a defect you already named in the review, on the grounds that it is recorded in the summary (R6).
95593
93928
  7. Carrying a one-off fallback forward as the default for the rest of the session, or Using a tool hard-rejection as a fallback excuse instead of fixing its trigger condition (R8).
95594
93929
  8. 23. Asking the user about an implementation detail an existing-standard in the repository already settles; 24. Penalizing a clean status: hand_back scope escalation as a failed run, or spawning a cold replacement subagent when send_message can continue the warm child session; 25. Accepting a visible UI change without Before & After comparison evidence (R-G, R6).
@@ -95647,13 +93982,13 @@ Fallback is a task-scoped, non-session-wide exception for delegated briefs: it c
95647
93982
  config: [{
95648
93983
  id: "plan-mode",
95649
93984
  name: "@eddyskywalker/dsh-chatgpt-subscription/plan-mode",
95650
- config: { section: `[Plan Mode] Plan Mode is active. Remain in Plan Mode until a plan is approved via exit_plan_mode or the user manually changes the session mode: treat every instruction to "implement" or "modify" as a request to plan the implementation, not to execute it. Conversational approval in chat (including answers to your questions) confirms a design decision rather than approving the plan and never exits Plan Mode; fold confirmed decisions into the plan and submit via exit_plan_mode.
93985
+ config: { section: `[Plan Mode] Plan Mode is active. Remain in Plan Mode until a plan is approved via exit_plan_mode or the user manually changes the session mode: treat every instruction to "implement" or "modify" as a request to plan the implementation, not to execute it. Conversational approval in chat (including answers to your questions) confirms a design decision rather than approving the plan and never exits Plan Mode; fold confirmed decisions into the plan and submit via tools.exit_plan_mode inside code_run.
95651
93986
 
95652
- [Read-Only Exploration & Clarification Interview] Inspect the repository first using non-mutating reads, searches, and static checks, preferring existing functions, utilities, and patterns; never edit or write files, mutate config, run formatters/codegen that rewrite tracked files, commit, or otherwise enact the plan. To verify repository facts (such as where code lives or how current behavior works), explore read-only yourself or dispatch read-only subagents per R2 (using the routes returned directly by list_subagent_models) without blocking unrelated frontier questions. Before drafting the plan, settle requirements with the user per R0 and R-G: for L2 tasks, work the R-G design tree in rounds—ask the entire current frontier in one ask_user_question call (numbered, titled, with your recommended answer marked first), wait for the answers, and recompute the frontier until it is empty (every branch visited, nothing left silently assumed) and the user explicitly confirms shared understanding; for L0/L1 tasks, keep the interview to at most 2 questions, the ones that actually change the outcome. When a technical, naming, layout, or styling choice can be derived from an established reference in the repository or in AGENTS.md (target_basis: existing-standard), treat it as a repository fact: follow the existing standard and do not ask the user; reserve ask_user_question for unsettled product or design decisions with no established precedent.
93987
+ [Read-Only Exploration & Clarification Interview] Inspect the repository first using non-mutating reads, searches, and static checks, preferring existing functions, utilities, and patterns; never edit or write files, mutate config, run formatters/codegen that rewrite tracked files, commit, or otherwise enact the plan. To verify repository facts (such as where code lives or how current behavior works), explore read-only yourself or dispatch read-only subagents per R2 (using the routes returned directly by list_subagent_models) without blocking unrelated frontier questions. Before drafting the plan, settle requirements with the user per R0 and R-G: for L2 tasks, work the R-G design tree in rounds—ask the entire current frontier in ONE code_run program containing exactly one tools.ask_user_question(...) sub-call (numbered, titled, with your recommended answer marked first), wait for the answers, and recompute the frontier until it is empty (every branch visited, nothing left silently assumed) and the user explicitly confirms shared understanding; for L0/L1 tasks, keep the interview to at most 2 questions, the ones that actually change the outcome. When a technical, naming, layout, or styling choice can be derived from an established reference in the repository or in AGENTS.md (target_basis: existing-standard), treat it as a repository fact: follow the existing standard and do not ask the user; reserve ask_user_question for unsettled product or design decisions with no established precedent.
95653
93988
 
95654
93989
  [Plan Completeness] Make the plan decision-complete: state the goal, success criteria, and R1 execution topology (Lead-Core, Hybrid, or Fan-out with subtask boundaries); group implementation changes by subsystem; specify public API, schema, and data-flow changes; and cover edge cases, failure modes, test strategy, acceptance criteria, and explicit assumptions. Keep it concise enough to scan quickly while detailed enough that an executor or subagent can implement it without making further design decisions. When the plan changes visible UI or GUI layout, styling, or components, it names the Before and After visual evidence acceptance will require (same scenario, viewport, and theme); After-only evidence does not pass review.
95655
93990
 
95656
- [Plan Approval] When ready, call exit_plan_mode with the complete plan Markdown starting with a # Title heading, making exit_plan_mode the sole and final tool call of that turn: implementation or dispatch happens only in subsequent turns after approval. Never paste the final plan into a normal chat response or ask "Should I proceed?" in prose or via ask_user_question. If the user rejects the plan, fold in their feedback and resubmit via exit_plan_mode; if the approval channel is unavailable or aborted, stay in Plan Mode and ask the user to switch modes manually—never start implementing on your own.` }
93991
+ [Plan Approval] When ready, make ONE code_run program whose only sub-call is tools.exit_plan_mode with the complete plan Markdown starting with a # Title heading; that code_run is the sole and final top-level tool call of that turn: implementation or dispatch happens only in subsequent turns after approval. Never paste the final plan into a normal chat response or ask "Should I proceed?" in prose or via tools.ask_user_question inside code_run. If the user rejects the plan, fold in their feedback and resubmit via tools.exit_plan_mode inside code_run; if the approval channel is unavailable or aborted, stay in Plan Mode and ask the user to switch modes manually—never start implementing on your own.` }
95657
93992
  }, {
95658
93993
  id: "plan-mode-pipeline",
95659
93994
  name: "@eddyskywalker/dsh-chatgpt-subscription/plan-mode-pipeline"
@@ -95783,7 +94118,16 @@ Fallback is a task-scoped, non-session-wide exception for delegated briefs: it c
95783
94118
  },
95784
94119
  {
95785
94120
  id: "code-mode",
95786
- name: CODEMODE_PACKAGE
94121
+ name: CODEMODE_PACKAGE,
94122
+ config: {
94123
+ nativeToolsOnly: true,
94124
+ nativeTools: [
94125
+ "cache_warmup_result",
94126
+ "dispatch_ledger",
94127
+ "progress_update",
94128
+ "structured_output"
94129
+ ]
94130
+ }
95787
94131
  },
95788
94132
  {
95789
94133
  id: "present",
@@ -106532,6 +104876,7 @@ const Config = z$1.object({
106532
104876
  planModePipeline: z$1.boolean().default(true).volatile().description("启用计划模式管线:允许调度模式在澄清访谈收敛后用 enter_plan_mode 进入计划模式,放弃规划时用 leave_plan_mode 退出。"),
106533
104877
  dispatchExecutionGuard: z$1.boolean().default(true).volatile().description("启用调度执行守卫:在执行期拦截子代理越权调用主控专用工具,并拦截等待子代理期间的纯 sleep 空等命令;不修改工具声明面,零损耗保护 Kimi 缓存。"),
106534
104878
  toolRunawayGuard: z$1.boolean().default(true).volatile().description("启用工具失控治理:重复调用同一工具与参数时分级提醒;Kimi 保留第 12 次强停,其他线路只提醒。"),
104879
+ mediaTools: z$1.boolean().default(true).volatile().description("注册图片/视频工具:Codex/Antigravity 生图、Kimi 视频挂载、MiniMax 视频生成与理解;默认开启。修改后重载插件或重启 DSH,Kimi 既有会话在工具表变化后会重建一次前缀缓存。"),
106535
104880
  teamPolicyCacheGuard: z$1.boolean().default(true).volatile().description("把内置 Agent Teams 的 team:policy 段从 system prompt 摘掉,改为开关切换时以尾部用户消息投递一次,避免中途开团队协作时刷掉整段前缀缓存;默认开启。"),
106536
104881
  cacheWarmup: z$1.boolean().default(true).volatile().description(CACHE_WARMUP_SETTING_DESCRIPTION),
106537
104882
  cacheWarmupProviders: z$1.array(z$1.string()).default(CONTROLLED_PROVIDERS).volatile().description("允许产生新结果预览的线路;默认覆盖全部受控线路,空数组表示关闭所有新投影。"),
@@ -107305,13 +105650,14 @@ function apply(ctx, pluginConfig = {}) {
107305
105650
  ]);
107306
105651
  const disposeUpdateRoutes = registerUpdateRoutes(ctx, { fetchFn: proxyFetch });
107307
105652
  const disposeAdapter = ctx.llm.registerAdapter([PROVIDER_ID$13], adapter);
107308
- const disposeImageTool = ctx.tools.register(createCodexImageTool(oauth, ctx.attachments, { fetchFn: proxyFetch }));
107309
- const disposeAntigravityImageTool = ctx.tools.register(createAntigravityImageTool(antigravityAccountPool, antigravityStore, ctx.attachments, {
105653
+ const mediaToolsEnabled = pluginConfig.mediaTools?.get() !== false;
105654
+ const disposeImageTool = mediaToolsEnabled ? ctx.tools.register(createCodexImageTool(oauth, ctx.attachments, { fetchFn: proxyFetch })) : () => void 0;
105655
+ const disposeAntigravityImageTool = mediaToolsEnabled ? ctx.tools.register(createAntigravityImageTool(antigravityAccountPool, antigravityStore, ctx.attachments, {
107310
105656
  fetchFn: antigravityProxyFetch,
107311
105657
  isEnabled: () => antigravityPreferences.status().enabled !== false
107312
- }));
107313
- const disposeVideoTool = ctx.tools.register(createKimiVideoTool(ctx, { fetchFn: proxyFetch }));
107314
- const minimaxMediaToolsEnabled = minimaxCodePreferences.status().enabled;
105658
+ })) : () => void 0;
105659
+ const disposeVideoTool = mediaToolsEnabled ? ctx.tools.register(createKimiVideoTool(ctx, { fetchFn: proxyFetch })) : () => void 0;
105660
+ const minimaxMediaToolsEnabled = mediaToolsEnabled && minimaxCodePreferences.status().enabled;
107315
105661
  const disposeMinimaxUnderstandVideoTool = minimaxMediaToolsEnabled ? ctx.tools.register(createMinimaxUnderstandVideoTool(ctx, {
107316
105662
  fetchFn: proxyFetch,
107317
105663
  pool: minimaxCodeAccountPool
@@ -107380,4 +105726,4 @@ function apply(ctx, pluginConfig = {}) {
107380
105726
  }, "dsh-chatgpt-subscription: adapter, routes, and lifecycle");
107381
105727
  }
107382
105728
  //#endregion
107383
- export { AccountPoolCore, AccountPoolStore, AntigravityAdapter, CHANNEL_ALIASES, ADOPTED_CREDENTIAL_EXPIRED_HINT as CLAUDE_ADOPTED_CREDENTIAL_EXPIRED_HINT, API_BASE as CLAUDE_API_BASE, DEFAULT_VISIBLE_MODEL_IDS as CLAUDE_DEFAULT_VISIBLE_MODELS, FALLBACK_MODELS as CLAUDE_FALLBACK_MODELS, MESSAGES_PATH as CLAUDE_MESSAGES_PATH, CLAUDE_MODELS, CLAUDE_MODEL_IDS, PROVIDER_ID as CLAUDE_PROVIDER_ID, PROVIDER_NAME as CLAUDE_PROVIDER_NAME, QUOTA_CACHE_TTL_MS as CLAUDE_QUOTA_CACHE_TTL_MS, CLAUDE_REASONING_EFFORTS, ROUTE_PREFIX as CLAUDE_ROUTE_PREFIX, CLINE_PASS_API_KEY_ENV, DEFAULT_BASE_URL as CLINE_PASS_DEFAULT_BASE_URL, DEFAULT_MODELS as CLINE_PASS_DEFAULT_MODELS, MAX_UPSTREAMS as CLINE_PASS_MAX_UPSTREAMS, MODEL_CATALOG as CLINE_PASS_MODEL_CATALOG, POOL_COOLDOWN_MS as CLINE_PASS_POOL_COOLDOWN_MS, REASONING_EFFORTS as CLINE_PASS_REASONING_EFFORTS, CLINE_PASS_ROUTES, CLINE_PASS_ROUTE_PREFIX, CLINE_PASS_PROVIDER_ID as CLINE_PASS_ROUTE_PROVIDER_ID, CLINE_PASS_PROVIDER_NAME as CLINE_PASS_ROUTE_PROVIDER_NAME, ClaudeAccountPool, ClaudeAdapter, FileCredentialStore as ClaudeCredentialStore, FileModelSettingsStore as ClaudeModelSettingsStore, ClinePassAccountPool, ClinePassAdapter, FileCredentialStore$1 as ClinePassCredentialStore, ClinePassEngine, ClinePassModelSettingsStore, CodexAccountPool, CodexChatGptAdapter, CommandCodeAccountPool, CommandCodeAdapter, FileCredentialStore$2 as CommandCodeCredentialStore, FileModelSettingsStore$1 as CommandCodeModelSettingsStore, Config, DEFAULT_GUARD_OPTIONS, DEFAULT_PARENT_FORK_TOOLS, DEFAULT_SUBAGENT_INHERIT_TOOLS, FileCredentialStore$3 as FileCredentialStore, FileModelSettingsStore$2 as FileModelSettingsStore, GLM_CODING_PLAN_PREFERENCES_NAMESPACE, QUOTA_WINDOW_MINUTES as GLM_CODING_PLAN_QUOTA_WINDOW_MINUTES, GLM_CODING_PLAN_RETRY_POLICY_CONFIG, PROVIDER_ID$1 as GLM_CODING_PLAN_ROUTE_PROVIDER_ID, PROVIDER_NAME$1 as GLM_CODING_PLAN_ROUTE_PROVIDER_NAME, GLM_MODEL_CATALOG, GLM_MODEL_IDS, GLM_POOL_COOLDOWN_MS, GlmAdoptedCredentialRefreshError, GlmCodingPlanAccountPool, GlmCodingPlanAdapter, GlmCodingPlanCredentialStore, GlmCodingPlanModelSettingsStore, KIMI_CODE_MODELS, KIMI_CODE_RETRY_POLICY_CONFIG, KimiCodeAccountPool, KimiCodeAdapter, FileCredentialStore$4 as KimiCodeCredentialStore, FileModelSettingsStore$3 as KimiCodeModelSettingsStore, LinuxFileTokenStore, AGENT_LLM_PREFIX as MINIMAX_CODE_AGENT_LLM_PREFIX, DEFAULT_MAX_MESSAGE_BODY_BYTES as MINIMAX_CODE_MAX_MESSAGE_BODY_BYTES, MESSAGES_PATH$1 as MINIMAX_CODE_MESSAGES_PATH, MINIMAX_CODE_MODELS, PROBE_MODEL as MINIMAX_CODE_PROBE_MODEL, MINIMAX_CODE_PROVIDER_ID, MINIMAX_CODE_PROVIDER_NAME, MINIMAX_CODE_REASONING_EFFORTS, REGION_HOSTS as MINIMAX_CODE_REGION_HOSTS, MINIMAX_CODE_RETRY_POLICY_CONFIG, MINIMAX_CODE_ROUTE_PREFIX, MacKeychainTokenStore, MinimaxCodeAccountPool, MinimaxCodeAdapter, MinimaxCodeCheckinService, MinimaxCodeCredentialStore, MinimaxCodeModelSettingsStore, OAuthService, OPENDESIGN_API_KEY_ENV, OPENDESIGN_CONSOLE_URL, DEFAULT_BASE_URL$1 as OPENDESIGN_DEFAULT_BASE_URL, DEFAULT_CONTEXT_WINDOW as OPENDESIGN_DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_CONCURRENT_REQUESTS as OPENDESIGN_DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_TOKENS as OPENDESIGN_DEFAULT_MAX_TOKENS, DEFAULT_MODELS$1 as OPENDESIGN_DEFAULT_MODELS, DEFAULT_STREAM_IDLE_TIMEOUT_MS as OPENDESIGN_DEFAULT_STREAM_IDLE_TIMEOUT_MS, PROVIDER_ID$2 as OPENDESIGN_HOST_PROVIDER_ID, PROVIDER_NAME$2 as OPENDESIGN_HOST_PROVIDER_NAME, MODEL_CATALOG$1 as OPENDESIGN_MODEL_CATALOG, MODEL_PRICES_URL as OPENDESIGN_MODEL_PRICES_URL, NO_ANSWER_PHRASE as OPENDESIGN_NO_ANSWER_PHRASE, POOL_COOLDOWN_MS$1 as OPENDESIGN_POOL_COOLDOWN_MS, OPENDESIGN_PROVIDER_ID, OPENDESIGN_PROVIDER_NAME, REASONING_EFFORT_IDS as OPENDESIGN_REASONING_EFFORT_IDS, OPENDESIGN_ROUTES, OPENDESIGN_ROUTE_PREFIX, OpenDesignAccountPool, OpenDesignAdapter, FileCredentialStore$5 as OpenDesignCredentialStore, OpenDesignModelSettingsStore, ProxyManager, QODER_POOL_COOLDOWN_MS, QODER_PROVIDER_ID, QODER_PROVIDER_NAME, QODER_REGIONS, QODER_RETRY_POLICY_CONFIG, QODER_ROUTE_PREFIX, QoderAccountPool, QoderAdapter, QoderCredentialStore, QoderModelSettingsStore, RELAY_PROBE_ENV, RELAY_PROBE_FILE_ENV, RELAY_PROBE_FILE_NAME, RELAY_PROBE_MAX_BYTES, RELAY_SOURCE_KINDS, RESUME_HINT, RESUME_HINT_STRICT, RelayProbe, ResponsesClient, STEP_CODE_POOL_COOLDOWN_MS, STEP_CODE_PROFILES, STEP_CODE_PROVIDER_ID, STEP_CODE_PROVIDER_NAME, STEP_CODE_RETRY_POLICY_CONFIG, STEP_CODE_ROUTE_PREFIX, SUBAGENT_MODEL_SELECTION_NAMESPACE, SUBAGENT_POLICY_EVENT, SearchProviderSwitcher, StepCodeAccountPool, StepCodeAdapter, StepCodeCredentialRefreshError, StepCodeCredentialStore, StepCodeModelSettingsStore, StepCodeQuotaCredentialStore, UsageService, FALLBACK_MODELS$1 as WORKBUDDY_MODELS, WORKBUDDY_MODEL_IDS, WindowsDpapiTokenStore, WorkBuddyAdapter, WorkBuddyCheckinService, FileCredentialStore$6 as WorkBuddyCredentialStore, FileModelSettingsStore$4 as WorkBuddyModelSettingsStore, adoptZcodeSignIn as adoptGlmZcodeSignIn, adoptedPoolAccountKey, apply, assertRequestBodyFits as assertMinimaxCodeBodyFits, assertStreamComplete as assertMinimaxCodeStreamComplete, auditChildRoutes, auditedRoutesOf, authorizedRoutesFor, beginLogin as beginClaudeLogin, beginWebLogin as beginKimiCodeLogin, beginWebLogin$1 as beginMinimaxCodeLogin, beginWebLogin$2 as beginWebLogin, buildAttempts, buildClaudeModelOptions, buildClinePassBody, buildGlmRequestPlan, buildMinimaxCodeModelOptions, buildMinimaxRequest, buildOpenDesignBody, cachedQoderModelCatalog, cachedStepCodeModelCatalog, cancelLogin as cancelClaudeLogin, cancelWebLogin as cancelMinimaxCodeLogin, catalogModelOptions, channelNameFor, childRoutesOf, clampOutputToContext as clampMinimaxCodeOutputToContext, classifyFailure as classifyClaudeFailure, classifyKimiFailure, classifyMinimaxFailure, classifyUpstreamError, classifyFailure$1 as classifyWorkBuddyFailure, claudeCliVersion, claudeCodeCredentialPaths, claudeCodeCredentialPresence, codeForFailure as claudeCodeForFailure, credentialPath as claudeCredentialPath, defaultContextWindowFor as claudeDefaultContextWindow, maxOutputTokensFor as claudeMaxOutputTokens, claudeModelCanDisableThinking, modelSettingsPath as claudeModelSettingsPath, claudeModelSupportsImage, claudeModelSupportsTemperature, claudePoolPath, claudeReasoningEfforts, claudeThinkingMode, toLlmError as claudeToLlmError, clearCachedQuota, clearCachedCatalog as clearClaudeCatalog, clearCachedQuota$1 as clearClaudeQuota, clearCachedQuota$2 as clearCommandCodeQuota, clearCachedQuota$3 as clearKimiCodeQuota, clearCachedQuota$4 as clearMinimaxCodeQuota, clearCachedCatalog$1 as clearWorkBuddyCatalog, clearCachedQuota$5 as clearWorkBuddyQuota, clinePassAccountKey, clinePassAccountQuota, catalogEntry as clinePassCatalogEntry, chatCompletion as clinePassChatCompletion, chatURL as clinePassChatURL, credentialPath$1 as clinePassCredentialPath, defaultPin as clinePassDefaultPin, clinePassKnownModelIds, modelSettingsPath$1 as clinePassModelSettingsPath, clinePassPoolPath, clinePassVisibleModelIds, clinePassWindowDurationMins, clinePassWindowLabel, closeMinimaxStream, codexPoolPath, collapseScore, commandCodeAccountKey, credentialPath$2 as commandCodeCredentialPath, modelSettingsPath$2 as commandCodeModelSettingsPath, commandCodePoolPath, contextWindowForModel, convergeGlmEffort, createAntigravityImageTool, createClinePassLine, createClinePassStore, createCodexFetchProvider, createCodexImageTool, createCodexSearchProvider, createFileRelayProbeSink, createMinimaxCodeAccountsHandler, createMessage as createMinimaxCodeMessage, createPkcePair as createMinimaxCodePkcePair, createStreamState as createMinimaxCodeStreamState, createOpenDesignLine, createPlatformTokenStore, createSubagentAuthorization, credentialPath$3 as credentialPath, credentialsFromAdopt, credentialsFromCliLogin, defaultOpenDesignModelSettings, delegationDenialReason, delegationModeOf, describeCredentials as describeMinimaxCodeCredentials, detectSystemProxy, dshHomeDir, effectiveAllowParentFork, effectiveRouteOf, ensureAccessToken as ensureClaudeAccessToken, ensureAccessToken$1 as ensureKimiCodeAccessToken, ensureAccessToken$2 as ensureMinimaxCodeAccessToken, extractAvailableProviders, fetchAccountQuota, fetchAccountQuota$1 as fetchClaudeQuota, fetchGatewayCatalog as fetchClinePassGatewayCatalog, fetchOfficialModels as fetchClinePassOfficialModels, fetchUsageLimits as fetchClinePassUsageLimits, fetchAccountQuota$2 as fetchCommandCodeQuota, fetchGlmQuota, fetchAccountQuota$3 as fetchKimiCodeQuota, fetchUserInfo as fetchKimiCodeUserInfo, fetchTokenPlanQuota as fetchMinimaxCodeQuota, fetchGatewayCatalog$1 as fetchOpenDesignGatewayCatalog, fetchAccountQuota$4 as fetchWorkBuddyQuota, getCachedQuota as getCachedGlmCodingPlanQuota, getCachedQuota$1 as getCachedQuota, getLoginStatus as getClaudeLoginStatus, getCachedQuota$2 as getClaudeQuota, getClaudeWebStatus, getClinePassWebStatus, getWebLoginStatus as getCommandCodeLoginStatus, getCachedQuota$3 as getCommandCodeQuota, getCommandCodeWebStatus, getGlmCodingPlanStatus, getWebLoginStatus$1 as getKimiCodeLoginStatus, getCachedQuota$4 as getKimiCodeQuota, getKimiCodeWebStatus, getWebLogin as getMinimaxCodeLogin, getCachedQuota$5 as getMinimaxCodeQuota, getMinimaxCodeWebStatus, getOpenDesignWebStatus, getQoderStatus, getStepCodeStatus, getCachedQuota$6 as getWorkBuddyQuota, getWorkBuddyWebStatus, glmCatalogSize, authorizeUrl as glmCodingPlanAuthorizeUrl, catalogSize as glmCodingPlanCatalogCount, credentialPath$4 as glmCodingPlanCredentialPath, modelSettingsPath$3 as glmCodingPlanModelSettingsPath, modelsForRegion as glmCodingPlanModelsForRegion, glmCodingPlanPoolIdentity, glmCodingPlanPoolPath, glmCodingPlanPoolQuota, glmCodingPlanPoolStatus, glmCodingPlanSettingsSource, glmCooldownDecision, glmSubPathOf, inheritOverrideReason, inheritRouteDenialReason, inheritedRouteOf, inject, injectPrefs, installReasoningCollapseGuard, installRelayProbe, installSubagentModelAuthorization, isAdherenceOk, isAdoptedClaudeCredential, isAdoptedCredentialExpired, isAdoptedCredential as isAdoptedGlmCodingPlanCredential, isAdoptedZcodeCredential as isAdoptedGlmZcodeCredential, isAdoptedPoolCredential, isClaudeReasoningEffort, isClinePassPinMode, isGlmReasoningEffort, isMinimaxCodeReasoningEffort, isRefreshTokenRejected as isMinimaxCodeRefreshTokenRejected, isAuthenticationError as isOpenDesignAuthenticationError, isThinkingDisabledEffort, credentialPath$5 as kimiCodeCredentialPath, kimiCodeModelDef, modelSettingsPath$4 as kimiCodeModelSettingsPath, kimiCodePoolPath, listModelIds as listMinimaxCodeModelIds, loadCatalog as loadClaudeCatalog, loadProviderModels as loadCommandCodeModels, loadCatalog$1 as loadGlmCodingPlanCatalog, loadProviderModels$1 as loadKimiCodeModels, loadConfigCatalog as loadWorkBuddyModels, loginAndSave, mapCodexUsage, mapFinishReason, mapFinishReason$1 as mapOpenDesignFinishReason, mapUsage as mapOpenDesignUsage, mapUsage$1 as mapUsage, mergeGlmCodingPlanSettings, mergeUpstreams, accountFromCredentials as minimaxCodeAccountFromCredentials, accountHost as minimaxCodeAccountHost, agentBaseUrl as minimaxCodeAgentBaseUrl, authJsonPath as minimaxCodeAuthJsonPath, authStateJsonPath as minimaxCodeAuthStateJsonPath, catalogSize$1 as minimaxCodeCatalogSize, credentialIsFresh as minimaxCodeCredentialIsFresh, effortForModel as minimaxCodeEffortForModel, minimaxHomeDir as minimaxCodeHomeDir, maxMessageBodyBytes as minimaxCodeMaxMessageBodyBytes, maxOutputTokensFor$1 as minimaxCodeMaxOutputTokens, messagesUrl as minimaxCodeMessagesUrl, minimaxCodeModelDef, minimaxCodeModelIds, minimaxCodeModelName, modelRequestHeaders as minimaxCodeModelRequestHeaders, modelSettingsPath$5 as minimaxCodeModelSettingsPath, outputConfigFor as minimaxCodeOutputConfig, pluginCredentialPath as minimaxCodePluginCredentialPath, minimaxCodePoolIdentity, minimaxCodePoolPath, minimaxCodePoolStatus, quotaHostCandidates as minimaxCodeQuotaHostCandidates, quotaRequestHeaders as minimaxCodeQuotaRequestHeaders, subPathOf as minimaxCodeSubPathOf, tokenPlanRemainsUrl as minimaxCodeTokenPlanRemainsUrl, modelSettingsPath$6 as modelSettingsPath, normalizeDelegationToolNames, normalizeRegion as normalizeGlmCodingPlanRegion, normalizeInheritToolNames, normalizePinMode, normalizeRotationStrategy, normalizeSort, openChatStream as openClinePassChatStream, bearerFor as openDesignBearerFor, catalogEntry$1 as openDesignCatalogEntry, chatURL$1 as openDesignChatURL, credentialPath$6 as openDesignCredentialPath, credentialsIdentity as openDesignCredentialsIdentity, firstMessage as openDesignFirstMessage, openDesignKnownModelIds, modelSettingsPath$7 as openDesignModelSettingsPath, modelsURL as openDesignModelsURL, reasoningOf as openDesignReasoningOf, streamErrorCode as openDesignStreamErrorCode, openDesignVisibleModelIds, openChatStream$1 as openOpenDesignChatStream, opendesignAccountKey, opendesignPoolPath, parseAllowedRoutes, parseClaudeCredentialDocument, parseClaudeCredentials, parseClaudePoolData, parseUsagePayload as parseClaudeUsagePayload, parseClinePassCredentials, parseClinePassModelSettings, parseClinePassPoolData, parseCodexPoolData, parseCodexUsage, parseCommandCodePoolData, parseGlmCodingPlanCredentials, parseGlmCodingPlanPoolData, parseKimiCodePoolData, parseMinimaxCodeCredentials, parseMinimaxCodePoolData, parseTokenPlanQuota as parseMinimaxCodeQuota, parseAnthropicUsage as parseMinimaxCodeUsage, parseOpenDesignCredentials, parseOpenDesignModelSettings, parseOpenDesignPoolData, parseServerSentEvents as parseOpenDesignServerSentEvents, parseQoderCredentials, parseResponsesStream, parseRouting, parseServerSentEvents$1 as parseServerSentEvents, parseTier0, parseBilling as parseWorkBuddyBilling, parseConfigModels as parseWorkBuddyConfigModels, parseCredentialFile as parseWorkBuddyCredential, pinAdherence, pinWarnings, policyRoutesOf, pollWebLogin as pollMinimaxCodeLogin, probeConnection as probeClaudeConnection, processMinimaxStreamLine, qoderCatalogSize, credentialPath$7 as qoderCredentialPath, qoderCredentialsExpireAt, qoderCredentialsNeedRefresh, modelSettingsPath$8 as qoderModelSettingsPath, qoderPoolIdentity, qoderPoolPath, qoderPoolQuota, qoderPoolStatus, qoderPoolStatusSlice, qoderRefreshFailureStatus, qoderSettingsSource, qoderSubPathOf, readChildDescriptor, readClaudeCodeCredentials, readGlmResetAt, readQoderCacheStats, readStepCodeCacheStats, reasoningOf$1 as reasoningOf, redactToken as redactMinimaxCodeToken, refreshAntigravityToken, refreshAccessToken as refreshClaudeToken, refreshAccessToken$1 as refreshKimiCodeToken, refreshAccessToken$2 as refreshMinimaxCodeToken, refreshCredentials as refreshWorkBuddyCredentials, registerClaudePreferenceStore, registerClaudeRoutes, registerClinePassRoutes, registerCommandCodePreferenceStore, registerCommandCodeRoutes, registerGlmCodingPlanPreferenceStore, registerGlmCodingPlanRoutes, registerKimiCodePreferenceStore, registerKimiCodeRoutes, registerMinimaxCodePreferenceStore, registerMinimaxCodeRoutes, registerOpenDesignRoutes, registerQoderPreferenceStore, registerQoderRoutes, registerStepCodePreferenceStore, registerStepCodeRoutes, registerWorkBuddyPreferenceStore, registerWorkBuddyRoutes, relayProbeEnabled, relayProbeEnvFile, relayProbeEnvValue, relayProbeLogPath, rememberQoderCacheUsage, rememberStepCodeCacheUsage, requestDeviceAuthorization as requestKimiCodeDeviceAuthorization, requestDeviceAuthorization$1 as requestMinimaxCodeDeviceAuthorization, resetWebLogins as resetMinimaxCodeLogins, resolveEnabledModelIds as resolveClaudeEnabledModelIds, resolveLoginInput as resolveClaudeLoginInput, resolveClaudeModel, resolveGlmModel, resolveGuardOptions, resolveRegion as resolveKimiCodeRegion, resolveMinimaxCodeEnabledModelIds, resolveMinimaxCodeModelId, resolveQuotaCounts as resolveMinimaxCodeQuotaCounts, resolveModelInfo as resolveOpenDesignModelInfo, resolveOutputBudget as resolveOpenDesignOutputBudget, resolveWorkBuddyModel, revokeToken as revokeMinimaxCodeToken, saveApiKey as saveCommandCodeApiKey, scanCredentials as scanWorkBuddyCredentials, sendJSON as sendClinePassJSON, sendJSON$1 as sendOpenDesignJSON, serializeMessages, serializeMessages$1 as serializeOpenDesignMessages, setClaudeCliVersion, beginWebLogin$3 as startCommandCodeLogin, stepCodeCatalogSize, credentialPath$8 as stepCodeCredentialPath, stepCodeModelCatalogFrom, modelSettingsPath$9 as stepCodeModelSettingsPath, stepCodePoolIdentity, stepCodePoolPath, stepCodePoolQuota, stepCodePoolStatus, stepCodePoolStatusSlice, quotaCredentialPath as stepCodeQuotaCredentialPath, stepCodeSettingsSource, stepCodeSubPathOf, streamErrorCode$1 as streamErrorCode, subagentModelSelectionPreference, submitLoginInput as submitClaudeLoginInput, summarizeFailureBody as summarizeMinimaxCodeFailureBody, testConnection as testMinimaxCodeConnection, testApiKey as testOpenDesignApiKey, translate, translate$1 as translateOpenDesignStream, trimBase as trimClinePassBase, trimBase$1 as trimOpenDesignBase, unauthorizedRouteReason, validateAuthorizationScope, validateDelegationToolNames, validateInheritToolNames, verifyCodingPlanKey as verifyGlmCodingPlanKey, violationText, warmQoderCatalogOnStartup, withTimeout as withOpenDesignTimeout, modelSettingsPath$10 as workBuddyModelSettingsPath, modelsForRegion$1 as workBuddyModelsForRegion, zcodeCredentialsPath };
105729
+ export { AccountPoolCore, AccountPoolStore, AntigravityAdapter, ADOPTED_CREDENTIAL_EXPIRED_HINT as CLAUDE_ADOPTED_CREDENTIAL_EXPIRED_HINT, API_BASE as CLAUDE_API_BASE, DEFAULT_VISIBLE_MODEL_IDS as CLAUDE_DEFAULT_VISIBLE_MODELS, FALLBACK_MODELS as CLAUDE_FALLBACK_MODELS, MESSAGES_PATH as CLAUDE_MESSAGES_PATH, CLAUDE_MODELS, CLAUDE_MODEL_IDS, PROVIDER_ID as CLAUDE_PROVIDER_ID, PROVIDER_NAME as CLAUDE_PROVIDER_NAME, QUOTA_CACHE_TTL_MS as CLAUDE_QUOTA_CACHE_TTL_MS, CLAUDE_REASONING_EFFORTS, ROUTE_PREFIX as CLAUDE_ROUTE_PREFIX, CLINE_PASS_API_KEY_ENV, DEFAULT_BASE_URL as CLINE_PASS_DEFAULT_BASE_URL, DEFAULT_MODELS as CLINE_PASS_DEFAULT_MODELS, MODEL_CATALOG as CLINE_PASS_MODEL_CATALOG, POOL_COOLDOWN_MS as CLINE_PASS_POOL_COOLDOWN_MS, REASONING_EFFORTS as CLINE_PASS_REASONING_EFFORTS, CLINE_PASS_ROUTES, CLINE_PASS_ROUTE_PREFIX, CLINE_PASS_PROVIDER_ID as CLINE_PASS_ROUTE_PROVIDER_ID, CLINE_PASS_PROVIDER_NAME as CLINE_PASS_ROUTE_PROVIDER_NAME, ClaudeAccountPool, ClaudeAdapter, FileCredentialStore as ClaudeCredentialStore, FileModelSettingsStore as ClaudeModelSettingsStore, ClinePassAccountPool, ClinePassAdapter, FileCredentialStore$1 as ClinePassCredentialStore, ClinePassEngine, ClinePassModelSettingsStore, CodexAccountPool, CodexChatGptAdapter, CommandCodeAccountPool, CommandCodeAdapter, FileCredentialStore$2 as CommandCodeCredentialStore, FileModelSettingsStore$1 as CommandCodeModelSettingsStore, Config, DEFAULT_GUARD_OPTIONS, DEFAULT_PARENT_FORK_TOOLS, DEFAULT_SUBAGENT_INHERIT_TOOLS, FileCredentialStore$3 as FileCredentialStore, FileModelSettingsStore$2 as FileModelSettingsStore, GLM_CODING_PLAN_PREFERENCES_NAMESPACE, QUOTA_WINDOW_MINUTES as GLM_CODING_PLAN_QUOTA_WINDOW_MINUTES, GLM_CODING_PLAN_RETRY_POLICY_CONFIG, PROVIDER_ID$1 as GLM_CODING_PLAN_ROUTE_PROVIDER_ID, PROVIDER_NAME$1 as GLM_CODING_PLAN_ROUTE_PROVIDER_NAME, GLM_MODEL_CATALOG, GLM_MODEL_IDS, GLM_POOL_COOLDOWN_MS, GlmAdoptedCredentialRefreshError, GlmCodingPlanAccountPool, GlmCodingPlanAdapter, GlmCodingPlanCredentialStore, GlmCodingPlanModelSettingsStore, KIMI_CODE_MODELS, KIMI_CODE_RETRY_POLICY_CONFIG, KimiCodeAccountPool, KimiCodeAdapter, FileCredentialStore$4 as KimiCodeCredentialStore, FileModelSettingsStore$3 as KimiCodeModelSettingsStore, LinuxFileTokenStore, AGENT_LLM_PREFIX as MINIMAX_CODE_AGENT_LLM_PREFIX, DEFAULT_MAX_MESSAGE_BODY_BYTES as MINIMAX_CODE_MAX_MESSAGE_BODY_BYTES, MESSAGES_PATH$1 as MINIMAX_CODE_MESSAGES_PATH, MINIMAX_CODE_MODELS, PROBE_MODEL as MINIMAX_CODE_PROBE_MODEL, MINIMAX_CODE_PROVIDER_ID, MINIMAX_CODE_PROVIDER_NAME, MINIMAX_CODE_REASONING_EFFORTS, REGION_HOSTS as MINIMAX_CODE_REGION_HOSTS, MINIMAX_CODE_RETRY_POLICY_CONFIG, MINIMAX_CODE_ROUTE_PREFIX, MacKeychainTokenStore, MinimaxCodeAccountPool, MinimaxCodeAdapter, MinimaxCodeCheckinService, MinimaxCodeCredentialStore, MinimaxCodeModelSettingsStore, OAuthService, OPENDESIGN_API_KEY_ENV, OPENDESIGN_CONSOLE_URL, DEFAULT_BASE_URL$1 as OPENDESIGN_DEFAULT_BASE_URL, DEFAULT_CONTEXT_WINDOW as OPENDESIGN_DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_CONCURRENT_REQUESTS as OPENDESIGN_DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_TOKENS as OPENDESIGN_DEFAULT_MAX_TOKENS, DEFAULT_MODELS$1 as OPENDESIGN_DEFAULT_MODELS, DEFAULT_STREAM_IDLE_TIMEOUT_MS as OPENDESIGN_DEFAULT_STREAM_IDLE_TIMEOUT_MS, PROVIDER_ID$2 as OPENDESIGN_HOST_PROVIDER_ID, PROVIDER_NAME$2 as OPENDESIGN_HOST_PROVIDER_NAME, MODEL_CATALOG$1 as OPENDESIGN_MODEL_CATALOG, MODEL_PRICES_URL as OPENDESIGN_MODEL_PRICES_URL, NO_ANSWER_PHRASE as OPENDESIGN_NO_ANSWER_PHRASE, POOL_COOLDOWN_MS$1 as OPENDESIGN_POOL_COOLDOWN_MS, OPENDESIGN_PROVIDER_ID, OPENDESIGN_PROVIDER_NAME, REASONING_EFFORT_IDS as OPENDESIGN_REASONING_EFFORT_IDS, OPENDESIGN_ROUTES, OPENDESIGN_ROUTE_PREFIX, OpenDesignAccountPool, OpenDesignAdapter, FileCredentialStore$5 as OpenDesignCredentialStore, OpenDesignModelSettingsStore, ProxyManager, QODER_POOL_COOLDOWN_MS, QODER_PROVIDER_ID, QODER_PROVIDER_NAME, QODER_REGIONS, QODER_RETRY_POLICY_CONFIG, QODER_ROUTE_PREFIX, QoderAccountPool, QoderAdapter, QoderCredentialStore, QoderModelSettingsStore, RELAY_PROBE_ENV, RELAY_PROBE_FILE_ENV, RELAY_PROBE_FILE_NAME, RELAY_PROBE_MAX_BYTES, RELAY_SOURCE_KINDS, RESUME_HINT, RESUME_HINT_STRICT, RelayProbe, ResponsesClient, STEP_CODE_POOL_COOLDOWN_MS, STEP_CODE_PROFILES, STEP_CODE_PROVIDER_ID, STEP_CODE_PROVIDER_NAME, STEP_CODE_RETRY_POLICY_CONFIG, STEP_CODE_ROUTE_PREFIX, SUBAGENT_MODEL_SELECTION_NAMESPACE, SUBAGENT_POLICY_EVENT, SearchProviderSwitcher, StepCodeAccountPool, StepCodeAdapter, StepCodeCredentialRefreshError, StepCodeCredentialStore, StepCodeModelSettingsStore, StepCodeQuotaCredentialStore, UsageService, FALLBACK_MODELS$1 as WORKBUDDY_MODELS, WORKBUDDY_MODEL_IDS, WindowsDpapiTokenStore, WorkBuddyAdapter, WorkBuddyCheckinService, FileCredentialStore$6 as WorkBuddyCredentialStore, FileModelSettingsStore$4 as WorkBuddyModelSettingsStore, adoptZcodeSignIn as adoptGlmZcodeSignIn, adoptedPoolAccountKey, apply, assertRequestBodyFits as assertMinimaxCodeBodyFits, assertStreamComplete as assertMinimaxCodeStreamComplete, auditChildRoutes, auditedRoutesOf, authorizedRoutesFor, beginLogin as beginClaudeLogin, beginWebLogin as beginKimiCodeLogin, beginWebLogin$1 as beginMinimaxCodeLogin, beginWebLogin$2 as beginWebLogin, buildClaudeModelOptions, buildClinePassBody, buildGlmRequestPlan, buildMinimaxCodeModelOptions, buildMinimaxRequest, buildOpenDesignBody, cachedQoderModelCatalog, cachedStepCodeModelCatalog, cancelLogin as cancelClaudeLogin, cancelWebLogin as cancelMinimaxCodeLogin, catalogModelOptions, childRoutesOf, clampOutputToContext as clampMinimaxCodeOutputToContext, classifyFailure as classifyClaudeFailure, classifyKimiFailure, classifyMinimaxFailure, classifyFailure$1 as classifyWorkBuddyFailure, claudeCliVersion, claudeCodeCredentialPaths, claudeCodeCredentialPresence, codeForFailure as claudeCodeForFailure, credentialPath as claudeCredentialPath, defaultContextWindowFor as claudeDefaultContextWindow, maxOutputTokensFor as claudeMaxOutputTokens, claudeModelCanDisableThinking, modelSettingsPath as claudeModelSettingsPath, claudeModelSupportsImage, claudeModelSupportsTemperature, claudePoolPath, claudeReasoningEfforts, claudeThinkingMode, toLlmError as claudeToLlmError, clearCachedQuota, clearCachedCatalog as clearClaudeCatalog, clearCachedQuota$1 as clearClaudeQuota, clearCachedQuota$2 as clearCommandCodeQuota, clearCachedQuota$3 as clearKimiCodeQuota, clearCachedQuota$4 as clearMinimaxCodeQuota, clearCachedCatalog$1 as clearWorkBuddyCatalog, clearCachedQuota$5 as clearWorkBuddyQuota, clinePassAccountKey, clinePassAccountQuota, catalogEntry as clinePassCatalogEntry, chatCompletion as clinePassChatCompletion, chatURL as clinePassChatURL, credentialPath$1 as clinePassCredentialPath, clinePassKnownModelIds, modelSettingsPath$1 as clinePassModelSettingsPath, clinePassPoolPath, clinePassVisibleModelIds, clinePassWindowDurationMins, clinePassWindowLabel, closeMinimaxStream, codexPoolPath, collapseScore, commandCodeAccountKey, credentialPath$2 as commandCodeCredentialPath, modelSettingsPath$2 as commandCodeModelSettingsPath, commandCodePoolPath, contextWindowForModel, convergeGlmEffort, createAntigravityImageTool, createClinePassLine, createClinePassStore, createCodexFetchProvider, createCodexImageTool, createCodexSearchProvider, createFileRelayProbeSink, createMinimaxCodeAccountsHandler, createMessage as createMinimaxCodeMessage, createPkcePair as createMinimaxCodePkcePair, createStreamState as createMinimaxCodeStreamState, createOpenDesignLine, createPlatformTokenStore, createSubagentAuthorization, credentialPath$3 as credentialPath, credentialsFromAdopt, credentialsFromCliLogin, defaultOpenDesignModelSettings, delegationDenialReason, delegationModeOf, describeCredentials as describeMinimaxCodeCredentials, detectSystemProxy, dshHomeDir, effectiveAllowParentFork, effectiveRouteOf, ensureAccessToken as ensureClaudeAccessToken, ensureAccessToken$1 as ensureKimiCodeAccessToken, ensureAccessToken$2 as ensureMinimaxCodeAccessToken, fetchAccountQuota, fetchAccountQuota$1 as fetchClaudeQuota, fetchGatewayCatalog as fetchClinePassGatewayCatalog, fetchOfficialModels as fetchClinePassOfficialModels, fetchUsageLimits as fetchClinePassUsageLimits, fetchAccountQuota$2 as fetchCommandCodeQuota, fetchGlmQuota, fetchAccountQuota$3 as fetchKimiCodeQuota, fetchUserInfo as fetchKimiCodeUserInfo, fetchTokenPlanQuota as fetchMinimaxCodeQuota, fetchGatewayCatalog$1 as fetchOpenDesignGatewayCatalog, fetchAccountQuota$4 as fetchWorkBuddyQuota, getCachedQuota as getCachedGlmCodingPlanQuota, getCachedQuota$1 as getCachedQuota, getLoginStatus as getClaudeLoginStatus, getCachedQuota$2 as getClaudeQuota, getClaudeWebStatus, getClinePassWebStatus, getWebLoginStatus as getCommandCodeLoginStatus, getCachedQuota$3 as getCommandCodeQuota, getCommandCodeWebStatus, getGlmCodingPlanStatus, getWebLoginStatus$1 as getKimiCodeLoginStatus, getCachedQuota$4 as getKimiCodeQuota, getKimiCodeWebStatus, getWebLogin as getMinimaxCodeLogin, getCachedQuota$5 as getMinimaxCodeQuota, getMinimaxCodeWebStatus, getOpenDesignWebStatus, getQoderStatus, getStepCodeStatus, getCachedQuota$6 as getWorkBuddyQuota, getWorkBuddyWebStatus, glmCatalogSize, authorizeUrl as glmCodingPlanAuthorizeUrl, catalogSize as glmCodingPlanCatalogCount, credentialPath$4 as glmCodingPlanCredentialPath, modelSettingsPath$3 as glmCodingPlanModelSettingsPath, modelsForRegion as glmCodingPlanModelsForRegion, glmCodingPlanPoolIdentity, glmCodingPlanPoolPath, glmCodingPlanPoolQuota, glmCodingPlanPoolStatus, glmCodingPlanSettingsSource, glmCooldownDecision, glmSubPathOf, inheritOverrideReason, inheritRouteDenialReason, inheritedRouteOf, inject, installReasoningCollapseGuard, installRelayProbe, installSubagentModelAuthorization, isAdoptedClaudeCredential, isAdoptedCredentialExpired, isAdoptedCredential as isAdoptedGlmCodingPlanCredential, isAdoptedZcodeCredential as isAdoptedGlmZcodeCredential, isAdoptedPoolCredential, isClaudeReasoningEffort, isGlmReasoningEffort, isMinimaxCodeReasoningEffort, isRefreshTokenRejected as isMinimaxCodeRefreshTokenRejected, isAuthenticationError as isOpenDesignAuthenticationError, isThinkingDisabledEffort, credentialPath$5 as kimiCodeCredentialPath, kimiCodeModelDef, modelSettingsPath$4 as kimiCodeModelSettingsPath, kimiCodePoolPath, listModelIds as listMinimaxCodeModelIds, loadCatalog as loadClaudeCatalog, loadProviderModels as loadCommandCodeModels, loadCatalog$1 as loadGlmCodingPlanCatalog, loadProviderModels$1 as loadKimiCodeModels, loadConfigCatalog as loadWorkBuddyModels, loginAndSave, mapCodexUsage, mapFinishReason, mapFinishReason$1 as mapOpenDesignFinishReason, mapUsage as mapOpenDesignUsage, mapUsage$1 as mapUsage, mergeGlmCodingPlanSettings, accountFromCredentials as minimaxCodeAccountFromCredentials, accountHost as minimaxCodeAccountHost, agentBaseUrl as minimaxCodeAgentBaseUrl, authJsonPath as minimaxCodeAuthJsonPath, authStateJsonPath as minimaxCodeAuthStateJsonPath, catalogSize$1 as minimaxCodeCatalogSize, credentialIsFresh as minimaxCodeCredentialIsFresh, effortForModel as minimaxCodeEffortForModel, minimaxHomeDir as minimaxCodeHomeDir, maxMessageBodyBytes as minimaxCodeMaxMessageBodyBytes, maxOutputTokensFor$1 as minimaxCodeMaxOutputTokens, messagesUrl as minimaxCodeMessagesUrl, minimaxCodeModelDef, minimaxCodeModelIds, minimaxCodeModelName, modelRequestHeaders as minimaxCodeModelRequestHeaders, modelSettingsPath$5 as minimaxCodeModelSettingsPath, outputConfigFor as minimaxCodeOutputConfig, pluginCredentialPath as minimaxCodePluginCredentialPath, minimaxCodePoolIdentity, minimaxCodePoolPath, minimaxCodePoolStatus, quotaHostCandidates as minimaxCodeQuotaHostCandidates, quotaRequestHeaders as minimaxCodeQuotaRequestHeaders, subPathOf as minimaxCodeSubPathOf, tokenPlanRemainsUrl as minimaxCodeTokenPlanRemainsUrl, modelSettingsPath$6 as modelSettingsPath, normalizeDelegationToolNames, normalizeRegion as normalizeGlmCodingPlanRegion, normalizeInheritToolNames, normalizeRotationStrategy, openChatStream as openClinePassChatStream, bearerFor as openDesignBearerFor, catalogEntry$1 as openDesignCatalogEntry, chatURL$1 as openDesignChatURL, credentialPath$6 as openDesignCredentialPath, credentialsIdentity as openDesignCredentialsIdentity, firstMessage as openDesignFirstMessage, openDesignKnownModelIds, modelSettingsPath$7 as openDesignModelSettingsPath, modelsURL as openDesignModelsURL, reasoningOf as openDesignReasoningOf, streamErrorCode as openDesignStreamErrorCode, openDesignVisibleModelIds, openChatStream$1 as openOpenDesignChatStream, opendesignAccountKey, opendesignPoolPath, parseAllowedRoutes, parseClaudeCredentialDocument, parseClaudeCredentials, parseClaudePoolData, parseUsagePayload as parseClaudeUsagePayload, parseClinePassCredentials, parseClinePassModelSettings, parseClinePassPoolData, parseCodexPoolData, parseCodexUsage, parseCommandCodePoolData, parseGlmCodingPlanCredentials, parseGlmCodingPlanPoolData, parseKimiCodePoolData, parseMinimaxCodeCredentials, parseMinimaxCodePoolData, parseTokenPlanQuota as parseMinimaxCodeQuota, parseAnthropicUsage as parseMinimaxCodeUsage, parseOpenDesignCredentials, parseOpenDesignModelSettings, parseOpenDesignPoolData, parseServerSentEvents as parseOpenDesignServerSentEvents, parseQoderCredentials, parseResponsesStream, parseRouting, parseServerSentEvents$1 as parseServerSentEvents, parseBilling as parseWorkBuddyBilling, parseConfigModels as parseWorkBuddyConfigModels, parseCredentialFile as parseWorkBuddyCredential, policyRoutesOf, pollWebLogin as pollMinimaxCodeLogin, probeConnection as probeClaudeConnection, processMinimaxStreamLine, qoderCatalogSize, credentialPath$7 as qoderCredentialPath, qoderCredentialsExpireAt, qoderCredentialsNeedRefresh, modelSettingsPath$8 as qoderModelSettingsPath, qoderPoolIdentity, qoderPoolPath, qoderPoolQuota, qoderPoolStatus, qoderPoolStatusSlice, qoderRefreshFailureStatus, qoderSettingsSource, qoderSubPathOf, readChildDescriptor, readClaudeCodeCredentials, readGlmResetAt, readQoderCacheStats, readStepCodeCacheStats, reasoningOf$1 as reasoningOf, redactToken as redactMinimaxCodeToken, refreshAntigravityToken, refreshAccessToken as refreshClaudeToken, refreshAccessToken$1 as refreshKimiCodeToken, refreshAccessToken$2 as refreshMinimaxCodeToken, refreshCredentials as refreshWorkBuddyCredentials, registerClaudePreferenceStore, registerClaudeRoutes, registerClinePassRoutes, registerCommandCodePreferenceStore, registerCommandCodeRoutes, registerGlmCodingPlanPreferenceStore, registerGlmCodingPlanRoutes, registerKimiCodePreferenceStore, registerKimiCodeRoutes, registerMinimaxCodePreferenceStore, registerMinimaxCodeRoutes, registerOpenDesignRoutes, registerQoderPreferenceStore, registerQoderRoutes, registerStepCodePreferenceStore, registerStepCodeRoutes, registerWorkBuddyPreferenceStore, registerWorkBuddyRoutes, relayProbeEnabled, relayProbeEnvFile, relayProbeEnvValue, relayProbeLogPath, rememberQoderCacheUsage, rememberStepCodeCacheUsage, requestDeviceAuthorization as requestKimiCodeDeviceAuthorization, requestDeviceAuthorization$1 as requestMinimaxCodeDeviceAuthorization, resetWebLogins as resetMinimaxCodeLogins, resolveEnabledModelIds as resolveClaudeEnabledModelIds, resolveLoginInput as resolveClaudeLoginInput, resolveClaudeModel, resolveGlmModel, resolveGuardOptions, resolveRegion as resolveKimiCodeRegion, resolveMinimaxCodeEnabledModelIds, resolveMinimaxCodeModelId, resolveQuotaCounts as resolveMinimaxCodeQuotaCounts, resolveModelInfo as resolveOpenDesignModelInfo, resolveOutputBudget as resolveOpenDesignOutputBudget, resolveWorkBuddyModel, revokeToken as revokeMinimaxCodeToken, saveApiKey as saveCommandCodeApiKey, scanCredentials as scanWorkBuddyCredentials, sendJSON as sendClinePassJSON, sendJSON$1 as sendOpenDesignJSON, serializeMessages, serializeMessages$1 as serializeOpenDesignMessages, setClaudeCliVersion, beginWebLogin$3 as startCommandCodeLogin, stepCodeCatalogSize, credentialPath$8 as stepCodeCredentialPath, stepCodeModelCatalogFrom, modelSettingsPath$9 as stepCodeModelSettingsPath, stepCodePoolIdentity, stepCodePoolPath, stepCodePoolQuota, stepCodePoolStatus, stepCodePoolStatusSlice, quotaCredentialPath as stepCodeQuotaCredentialPath, stepCodeSettingsSource, stepCodeSubPathOf, streamErrorCode$1 as streamErrorCode, subagentModelSelectionPreference, submitLoginInput as submitClaudeLoginInput, summarizeFailureBody as summarizeMinimaxCodeFailureBody, testConnection as testMinimaxCodeConnection, testApiKey as testOpenDesignApiKey, translate, translate$1 as translateOpenDesignStream, trimBase as trimClinePassBase, trimBase$1 as trimOpenDesignBase, unauthorizedRouteReason, validateAuthorizationScope, validateDelegationToolNames, validateInheritToolNames, verifyCodingPlanKey as verifyGlmCodingPlanKey, violationText, warmQoderCatalogOnStartup, withTimeout as withOpenDesignTimeout, modelSettingsPath$10 as workBuddyModelSettingsPath, modelsForRegion$1 as workBuddyModelsForRegion, zcodeCredentialsPath };