@eddyskywalker/dsh-chatgpt-subscription 0.67.0 → 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 (44) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/lib/client.js +54 -631
  4. package/lib/client.js.map +1 -1
  5. package/lib/index.js +146 -1869
  6. package/lib/types/client/cline-pass/ClinePassSection.d.ts +1 -1
  7. package/lib/types/client/cline-pass/ClinePassSection.d.ts.map +1 -1
  8. package/lib/types/client/cline-pass/api.d.ts +2 -36
  9. package/lib/types/client/cline-pass/api.d.ts.map +1 -1
  10. package/lib/types/client/cline-pass/locales.d.ts +30 -264
  11. package/lib/types/client/cline-pass/locales.d.ts.map +1 -1
  12. package/lib/types/client/cline-pass/styles.d.ts +2 -2
  13. package/lib/types/client/cline-pass/styles.d.ts.map +1 -1
  14. package/lib/types/client/locales-ru/cline-pass.d.ts.map +1 -1
  15. package/lib/types/compat.d.ts +1 -1
  16. package/lib/types/host/antigravity/adapter.d.ts.map +1 -1
  17. package/lib/types/host/antigravity/client-version.d.ts.map +1 -1
  18. package/lib/types/host/antigravity/types.d.ts +5 -5
  19. package/lib/types/host/antigravity/types.d.ts.map +1 -1
  20. package/lib/types/host/cline-pass/adapter.d.ts +3 -4
  21. package/lib/types/host/cline-pass/adapter.d.ts.map +1 -1
  22. package/lib/types/host/cline-pass/client.d.ts +0 -22
  23. package/lib/types/host/cline-pass/client.d.ts.map +1 -1
  24. package/lib/types/host/cline-pass/engine.d.ts +9 -147
  25. package/lib/types/host/cline-pass/engine.d.ts.map +1 -1
  26. package/lib/types/host/cline-pass/line.d.ts.map +1 -1
  27. package/lib/types/host/cline-pass/mapper.d.ts +1 -3
  28. package/lib/types/host/cline-pass/mapper.d.ts.map +1 -1
  29. package/lib/types/host/cline-pass/protocol.d.ts +1 -161
  30. package/lib/types/host/cline-pass/protocol.d.ts.map +1 -1
  31. package/lib/types/host/cline-pass/routes.d.ts +2 -7
  32. package/lib/types/host/cline-pass/routes.d.ts.map +1 -1
  33. package/lib/types/host/cline-pass/store.d.ts +11 -35
  34. package/lib/types/host/cline-pass/store.d.ts.map +1 -1
  35. package/lib/types/host/cline-pass/token-store.d.ts +1 -10
  36. package/lib/types/host/cline-pass/token-store.d.ts.map +1 -1
  37. package/lib/types/host/cline-pass/tools.d.ts.map +1 -1
  38. package/lib/types/host/cline-pass/types.d.ts +7 -76
  39. package/lib/types/host/cline-pass/types.d.ts.map +1 -1
  40. package/lib/types/index.d.ts +4 -4
  41. package/lib/types/index.d.ts.map +1 -1
  42. package/lib/types/shared/cline-pass-contracts.d.ts +6 -92
  43. package/lib/types/shared/cline-pass-contracts.d.ts.map +1 -1
  44. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -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.67.0";
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`;
@@ -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.
@@ -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);
@@ -71998,6 +71922,19 @@ async function probeConnection$2(accountPool, fetchFn, env) {
71998
71922
  }
71999
71923
  //#endregion
72000
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
+ */
72001
71938
  const PROVIDER_ID$5 = "cline-pass";
72002
71939
  const PROVIDER_NAME$5 = "Cline Pass";
72003
71940
  /** Default gateway. Overridable per deployment and per account. */
@@ -72008,39 +71945,16 @@ const RECOMMENDED_MODELS_URL = "https://api.cline.bot/api/v1/ai/cline/recommende
72008
71945
  const VERCEL_MODELS_URL = "https://ai-gateway.vercel.sh/v1/models";
72009
71946
  /** The community model registry, a metadata backstop. */
72010
71947
  const MODELS_DEV_URL = "https://models.dev/api.json";
72011
- /** OpenRouter's public API, used only for direct-pipeline endpoint detail. */
72012
- const OPENROUTER_API = "https://openrouter.ai/api/v1";
72013
71948
  /** Authenticated sub-paths on the gateway. */
72014
71949
  const USAGE_LIMITS_PATH = "/users/me/plan/usage-limits";
72015
71950
  /** Conservative context capacity for a model no catalog describes. */
72016
71951
  const DEFAULT_CONTEXT_WINDOW$2 = 128e3;
72017
- /**
72018
- * Per-request output budget when the caller states none.
72019
- *
72020
- * A budget, not a ceiling: the harness reserves it as completion room before it
72021
- * compacts, so this decides how much of the window stays available. 64k keeps
72022
- * the reserve far below the compaction ratio while leaving room for a
72023
- * tool-calling agent's longest turn.
72024
- */
71952
+ /** Per-request output budget when the caller states none. */
72025
71953
  const DEFAULT_MAX_TOKENS$1 = 64e3;
72026
- /**
72027
- * Idle budget for one Cline Pass stream — the default a fresh install starts
72028
- * from, overridable per account.
72029
- *
72030
- * Strictly inside the transport's own 300 s stream timeout; see
72031
- * `host/common/idle-watchdog.ts` for the measured basis.
72032
- */
71954
+ /** Idle budget for one Cline Pass stream, overridable per account. */
72033
71955
  const DEFAULT_STREAM_IDLE_TIMEOUT_MS$1 = 12e4;
72034
- /**
72035
- * How long one account-level refusal keeps an account out of the pool.
72036
- *
72037
- * Only the two refusals that are about the ACCOUNT are listed: a transient 429
72038
- * is answered by the channel retry, and standing an account down for it would
72039
- * cost capacity the request never proved was gone.
72040
- */
71956
+ /** How long one account-level refusal keeps an account out of the pool. */
72041
71957
  const POOL_COOLDOWN_MS = 15 * 6e4;
72042
- /** How many channels one model's list may hold. */
72043
- const MAX_UPSTREAMS = 64;
72044
71958
  /** Reasoning levels the gateway accepts for every reasoning-capable model. */
72045
71959
  const REASONING_EFFORTS = [
72046
71960
  {
@@ -72079,13 +71993,7 @@ const REASONING_EFFORTS = [
72079
71993
  description: "Reserve for the hardest quality-first tasks."
72080
71994
  }
72081
71995
  ];
72082
- /**
72083
- * Published metadata for the shipped Cline Pass models.
72084
- *
72085
- * `name` mirrors the provider's own label where one is published and falls back
72086
- * to the model id. `maxTokens` is the published output ceiling, used to clamp the
72087
- * configured request budget rather than taken as the budget itself.
72088
- */
71996
+ /** Published metadata for the shipped Cline Pass models. */
72089
71997
  const MODEL_CATALOG = Object.freeze({
72090
71998
  "cline-pass/deepseek-v4.1-flash-1017": {
72091
71999
  name: "DeepSeek V4.1 Flash 1017",
@@ -72098,8 +72006,7 @@ const MODEL_CATALOG = Object.freeze({
72098
72006
  "high",
72099
72007
  "max"
72100
72008
  ],
72101
- input: ["text", "image"],
72102
- gatewayHas: ["vision", "implicit-caching"]
72009
+ input: ["text", "image"]
72103
72010
  },
72104
72011
  "cline-pass/deepseek-v4.1-flash": {
72105
72012
  name: "DeepSeek V4.1 Flash",
@@ -72263,36 +72170,6 @@ const DEFAULT_MODELS = Object.freeze(Object.keys(MODEL_CATALOG));
72263
72170
  function catalogEntry(model) {
72264
72171
  return MODEL_CATALOG[model];
72265
72172
  }
72266
- /** The capability filter a model needs by default; empty for all others. */
72267
- function defaultGatewayHas(model) {
72268
- return [...catalogEntry(model)?.gatewayHas ?? []];
72269
- }
72270
- /**
72271
- * Bound one pin's capability filter, the way channels are bounded.
72272
- *
72273
- * Applied on read and again on the wire: `has` is copied into every chat request
72274
- * body, so a filter list is request payload on every turn, not a private note.
72275
- */
72276
- function capGatewayHas(names) {
72277
- const capped = [];
72278
- for (const name of names) {
72279
- const trimmed = name.trim();
72280
- if (trimmed === "" || trimmed.length > 64) continue;
72281
- if (!capped.includes(trimmed)) capped.push(trimmed);
72282
- if (capped.length >= 16) break;
72283
- }
72284
- return capped;
72285
- }
72286
- /** The default pin: automatic routing, no exclusions, model-default capabilities. */
72287
- function defaultPin(model = "") {
72288
- return {
72289
- upstreams: [],
72290
- exclude: [],
72291
- pinMode: "strict",
72292
- sort: "",
72293
- has: defaultGatewayHas(model)
72294
- };
72295
- }
72296
72173
  //#endregion
72297
72174
  //#region src/host/cline-pass/token-store.ts
72298
72175
  /** Cline's own clients send OAuth access tokens with this prefix. */
@@ -72440,27 +72317,6 @@ var FileCredentialStore$1 = class {
72440
72317
  await this.backend.clear();
72441
72318
  }
72442
72319
  };
72443
- /** One pin as stored, validated; a malformed row falls back to the default. */
72444
- function readPin(value, model) {
72445
- if (typeof value !== "object" || value === null || Array.isArray(value)) return defaultPin(model);
72446
- const record = value;
72447
- return {
72448
- upstreams: Array.isArray(record.upstreams) ? record.upstreams.filter((entry) => typeof entry === "string" && entry.length > 0) : [],
72449
- exclude: Array.isArray(record.exclude) ? record.exclude.filter((entry) => typeof entry === "string" && entry.length > 0) : [],
72450
- pinMode: record.pinMode === "preferred" ? "preferred" : "strict",
72451
- sort: typeof record.sort === "string" ? record.sort : "",
72452
- has: Array.isArray(record.has) ? capGatewayHas(record.has.filter((entry) => typeof entry === "string" && entry.trim().length > 0).map((entry) => entry.trim())) : defaultGatewayHas(model)
72453
- };
72454
- }
72455
- function readPins(value) {
72456
- if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
72457
- const pins = {};
72458
- for (const [model, pin] of Object.entries(value)) {
72459
- if (typeof model !== "string" || model.length === 0) continue;
72460
- pins[model] = readPin(pin, model);
72461
- }
72462
- return pins;
72463
- }
72464
72320
  function readNumberOverrides$1(value) {
72465
72321
  if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
72466
72322
  const overrides = {};
@@ -72518,14 +72374,13 @@ function promoteInUseCatalogRows(models, enabledModelIds, pins, contextWindowOve
72518
72374
  function parseClinePassModelSettings(value) {
72519
72375
  const record = typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
72520
72376
  const enabledModelIds = record.enabledModelIds === null ? null : Array.isArray(record.enabledModelIds) ? record.enabledModelIds.filter((id) => typeof id === "string") : null;
72521
- const pins = readPins(record.pins);
72377
+ const legacyPins = typeof record.pins === "object" && record.pins !== null && !Array.isArray(record.pins) ? record.pins : {};
72522
72378
  const contextWindowOverrides = readNumberOverrides$1(record.contextWindowOverrides);
72523
72379
  return {
72524
72380
  enabled: record.enabled !== false,
72525
72381
  baseURL: typeof record.baseURL === "string" && record.baseURL.trim() !== "" ? record.baseURL.trim() : DEFAULT_BASE_URL,
72526
72382
  enabledModelIds,
72527
- catalogModels: promoteInUseCatalogRows(readCatalogModels$1(record.catalogModels), enabledModelIds, pins, contextWindowOverrides),
72528
- pins,
72383
+ catalogModels: promoteInUseCatalogRows(readCatalogModels$1(record.catalogModels), enabledModelIds, legacyPins, contextWindowOverrides),
72529
72384
  hiddenModels: Array.isArray(record.hiddenModels) ? record.hiddenModels.filter((id) => typeof id === "string") : [],
72530
72385
  contextWindowOverrides,
72531
72386
  defaultContextWindow: positiveInteger$1(record.defaultContextWindow, DEFAULT_CONTEXT_WINDOW$2),
@@ -72534,7 +72389,6 @@ function parseClinePassModelSettings(value) {
72534
72389
  streamIdleTimeoutMs: positiveInteger$1(record.streamIdleTimeoutMs, DEFAULT_STREAM_IDLE_TIMEOUT_MS$1),
72535
72390
  historyLimit: positiveInteger$1(record.historyLimit, 100),
72536
72391
  exposeCatalog: record.exposeCatalog === true,
72537
- pinSpelling: typeof record.pinSpelling === "string" && record.pinSpelling.length > 0 ? record.pinSpelling : "both",
72538
72392
  exposeTools: record.exposeTools === true
72539
72393
  };
72540
72394
  }
@@ -72617,13 +72471,12 @@ var ClinePassModelSettingsStore = class {
72617
72471
  const next = {
72618
72472
  ...current,
72619
72473
  ...patch,
72620
- pins: patch.pins === void 0 ? current.pins : patch.pins,
72621
72474
  contextWindowOverrides: patch.contextWindowOverrides === void 0 ? current.contextWindowOverrides : patch.contextWindowOverrides
72622
72475
  };
72623
72476
  await this.write(next);
72624
72477
  return next;
72625
72478
  }
72626
- /** Record a catalog sync without touching the user's selection or pins. */
72479
+ /** Record a catalog sync without touching the user's selection. */
72627
72480
  async storeCatalog(models) {
72628
72481
  const current = await this.read();
72629
72482
  return await this.write({
@@ -72631,27 +72484,6 @@ var ClinePassModelSettingsStore = class {
72631
72484
  catalogModels: models
72632
72485
  });
72633
72486
  }
72634
- /** Store one model's pin; an empty pin list returns it to automatic routing. */
72635
- async setPin(model, pin) {
72636
- const current = await this.read();
72637
- return await this.write({
72638
- ...current,
72639
- pins: {
72640
- ...current.pins,
72641
- [model]: pin
72642
- }
72643
- });
72644
- }
72645
- /** Drop one model's pin entirely. */
72646
- async clearPin(model) {
72647
- const current = await this.read();
72648
- const pins = { ...current.pins };
72649
- delete pins[model];
72650
- return await this.write({
72651
- ...current,
72652
- pins
72653
- });
72654
- }
72655
72487
  /** Store or clear (null) one model's context-window override. */
72656
72488
  async setContextWindowOverride(model, contextWindow) {
72657
72489
  const current = await this.read();
@@ -73303,9 +73135,8 @@ function resolveModelInfo$1(model, options) {
73303
73135
  *
73304
73136
  * The line is API-key based: there is no OAuth flow, no token expiry, and no
73305
73137
  * per-account identity beyond the key and the alias a user gives it. What the
73306
- * card does render beyond the shared account facts is the routing observation
73307
- * this plugin makes about each model (pipeline, discovered channels, per-channel
73308
- * 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.
73309
73140
  */
73310
73141
  const CLINE_PASS_PROVIDER_ID = "cline-pass";
73311
73142
  const CLINE_PASS_PROVIDER_NAME = "Cline Pass";
@@ -73316,8 +73147,8 @@ const CLINE_PASS_ROUTE_PREFIX = "/cline-pass/api";
73316
73147
  * When Cline routes a model id onto the VMC fallback net, the serving channel
73317
73148
  * reports itself as `openai-compatible-private` and the resolved slug moves
73318
73149
  * under `private/…-contributor`. Answers from it may be used for training and
73319
- * carry no zero-data-retention guarantee, so a pin landing there is a fact the
73320
- * 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.
73321
73152
  */
73322
73153
  const CLINE_PASS_ANONYMOUS_UPSTREAMS = Object.freeze(["openai-compatible-private"]);
73323
73154
  /** Whether a channel name or resolved slug names the anonymous contributor route. */
@@ -73327,10 +73158,6 @@ function isClinePassAnonymousUpstream(name, canonicalSlug) {
73327
73158
  const slug = String(canonicalSlug ?? "").toLowerCase();
73328
73159
  return slug.startsWith("private/") || slug.includes("-contributor");
73329
73160
  }
73330
- /** Whether a submitted pin mode names one of the two accepted modes. */
73331
- function isClinePassPinMode(value) {
73332
- return value === "strict" || value === "preferred";
73333
- }
73334
73161
  /** Human label for the gateway's quota-window spelling. */
73335
73162
  function clinePassWindowLabel(type) {
73336
73163
  switch (type) {
@@ -73376,15 +73203,9 @@ function clinePassAccountQuota(reading) {
73376
73203
  //#endregion
73377
73204
  //#region src/host/cline-pass/protocol.ts
73378
73205
  /**
73379
- * Cline Pass wire protocol: pipeline detection, pin injection, failover
73380
- * expansion, and error classification. Every function here is pure.
73381
- *
73382
- * The two pipelines spell a pin differently:
73383
- * - **direct** (OpenRouter): top-level `provider.only/order/sort`.
73384
- * - **planner** (Vercel AI Gateway): only `providerOptions.gateway.*` survives.
73385
- *
73386
- * Ported from the MIT-licensed `dsh-cline-pass` plugin's protocol module, whose
73387
- * 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.
73388
73209
  *
73389
73210
  * @module dsh-chatgpt-subscription/cline-pass-protocol
73390
73211
  */
@@ -73449,24 +73270,13 @@ function parseRouting(json) {
73449
73270
  anonymous: isClinePassAnonymousUpstream(finalProvider ?? "", canonicalSlug ?? "")
73450
73271
  };
73451
73272
  }
73452
- /**
73453
- * Nodes one payload walk may visit before giving up.
73454
- *
73455
- * The hunts run per streamed frame, and a frame is small, but a pathological
73456
- * payload must not turn a cheap re-read into an unbounded walk.
73457
- */
73273
+ /** Nodes one payload walk may visit before giving up. */
73458
73274
  const HUNT_NODE_BUDGET = 4e3;
73459
73275
  /** `provider_metadata` of one node, when present. */
73460
73276
  function providerMetadataOf(node) {
73461
73277
  return isRecord$26(node.provider_metadata) ? node.provider_metadata : null;
73462
73278
  }
73463
- /**
73464
- * Depth-bounded hunt for the gateway's routing block anywhere in one payload.
73465
- *
73466
- * The fast paths (`message`/`delta`/`payload.provider_metadata.gateway`) are
73467
- * checked by the caller first; this walk covers the nestings between the shapes
73468
- * seen so far, so a frame the fast path does not know still yields its routing.
73469
- */
73279
+ /** Depth-bounded hunt for the gateway's routing block anywhere in one payload. */
73470
73280
  function huntRouting(node, depth = 0, budget = { left: HUNT_NODE_BUDGET }) {
73471
73281
  if (depth > 8 || budget.left <= 0 || node === null || typeof node !== "object") return null;
73472
73282
  budget.left -= 1;
@@ -73487,11 +73297,7 @@ function huntRouting(node, depth = 0, budget = { left: HUNT_NODE_BUDGET }) {
73487
73297
  }
73488
73298
  return null;
73489
73299
  }
73490
- /**
73491
- * Read the first-party DeepSeek fingerprint wherever `provider_metadata`
73492
- * carries it. Absent means the answer did not prove a first-party upstream —
73493
- * the anonymous contributor route carries no `deepseek` namespace at all.
73494
- */
73300
+ /** Read the first-party DeepSeek fingerprint wherever `provider_metadata` carries it. */
73495
73301
  function huntFingerprint(node, depth = 0, budget = { left: HUNT_NODE_BUDGET }) {
73496
73302
  if (depth > 8 || budget.left <= 0 || node === null || typeof node !== "object") return null;
73497
73303
  budget.left -= 1;
@@ -73518,282 +73324,6 @@ function huntFingerprint(node, depth = 0, budget = { left: HUNT_NODE_BUDGET }) {
73518
73324
  function slugify(value) {
73519
73325
  return String(value).toLowerCase().replace(/\s+/g, "-");
73520
73326
  }
73521
- /** OpenRouter's names for the three sort metrics. */
73522
- const OPENROUTER_SORT = Object.freeze({
73523
- cost: "price",
73524
- ttft: "latency",
73525
- tps: "throughput"
73526
- });
73527
- /**
73528
- * Channels the two routers spell differently, as `[planner, direct]` pairs.
73529
- *
73530
- * Z.AI is `zai` to the Vercel gateway and `z-ai` to OpenRouter. Writing one name
73531
- * into both spellings matters: a request that lands on the direct pipeline
73532
- * carries `provider.only` to OpenRouter, where an unknown provider is refused
73533
- * rather than ignored.
73534
- */
73535
- const CHANNEL_ALIASES = Object.freeze([["zai", "z-ai"]]);
73536
- /**
73537
- * Translate a channel name into the spelling one pipeline uses.
73538
- * @param name - the configured channel name, in either spelling.
73539
- * @param pipeline - `'planner'` or `'direct'`.
73540
- * @returns the name that pipeline expects; unknown names pass through.
73541
- */
73542
- function channelNameFor(name, pipeline) {
73543
- const needle = normalizeSlug(name);
73544
- for (const [planner, direct] of CHANNEL_ALIASES) {
73545
- if (normalizeSlug(planner) === needle) return pipeline === "direct" ? direct : planner;
73546
- if (normalizeSlug(direct) === needle) return pipeline === "planner" ? planner : direct;
73547
- }
73548
- return name;
73549
- }
73550
- /**
73551
- * Normalize a configured sort into a wire value or null.
73552
- *
73553
- * Two spellings mean "no sort" and both must be dropped before the request is
73554
- * built: the settings schema stores an empty string, and `none` is the
73555
- * documented "clear it" value. Neither is a metric, and the gateway rejects them
73556
- * with HTTP 400.
73557
- */
73558
- function normalizeSort(value) {
73559
- if (typeof value !== "string") return null;
73560
- const sort = value.trim();
73561
- return sort.length === 0 || sort === "none" ? null : sort;
73562
- }
73563
- /**
73564
- * Normalize a configured pin mode to the one value the router compares against.
73565
- * @param value - the configured pin mode, as stored.
73566
- * @returns `'strict'` or `'preferred'`.
73567
- */
73568
- function normalizePinMode(value) {
73569
- return String(value ?? "").trim().toLowerCase() === "preferred" ? "preferred" : "strict";
73570
- }
73571
- /**
73572
- * The channel vocabulary one spelling should be resolved against.
73573
- *
73574
- * The two pipelines sit behind different routers and publish different channel
73575
- * lists, so the merged list is the wrong basis for an allow-list.
73576
- */
73577
- function knownChannels(meta, pipeline) {
73578
- const scoped = meta?.channels?.[pipeline];
73579
- if (Array.isArray(scoped) && scoped.length > 0) return scoped;
73580
- return Array.isArray(meta?.upstreams) ? meta.upstreams : [];
73581
- }
73582
- /**
73583
- * Write one attempt's upstream preference into a request body.
73584
- *
73585
- * Excludes are compiled into an `only` allow-list because the gateway ignores
73586
- * the exclude/ignore fields.
73587
- *
73588
- * Both spellings are written by default. A pin is honored only by the pipeline
73589
- * that owns the spelling, and the pipeline a model runs on is decided by the
73590
- * gateway and can differ between calls, so writing just the spelling the last
73591
- * probe observed means the pin silently evaporates the moment that changes. Each
73592
- * pipeline ignores the other's field, which is what makes writing both safe.
73593
- * `spelling: 'detected'` restores the old single-spelling behavior.
73594
- *
73595
- * @returns a new body with the pin applied.
73596
- */
73597
- function injectPrefs(body, meta, attempt) {
73598
- const next = { ...body };
73599
- if (attempt === void 0) return next;
73600
- const upstream = attempt.upstream;
73601
- const orderRest = attempt.orderRest ?? [];
73602
- const excludeList = attempt.excludeList ?? [];
73603
- const strict = attempt.strict !== false;
73604
- const sort = normalizeSort(attempt.sort);
73605
- const has = capGatewayHas((attempt.has ?? []).filter((name) => typeof name === "string"));
73606
- const excluded = excludeList.filter((name) => normalizeSlug(name) !== normalizeSlug(upstream ?? ""));
73607
- const excludedIds = new Set(excluded.map(normalizeSlug));
73608
- const spell = (names, pipeline) => names.map((name) => channelNameFor(name, pipeline));
73609
- const gatewayAllow = excluded.length > 0 ? knownChannels(meta, "planner").filter((name) => !excludedIds.has(normalizeSlug(name))) : null;
73610
- const openRouterAllow = excluded.length > 0 ? knownChannels(meta, "direct").filter((name) => !excludedIds.has(normalizeSlug(name))) : null;
73611
- const pipeline = meta?.pipeline ?? null;
73612
- const both = attempt.spelling !== "detected";
73613
- const useGateway = both || pipeline === "planner" || pipeline === null;
73614
- const useOpenRouter = both || pipeline === "direct" || pipeline === null;
73615
- const gatewayUsable = useGateway && (upstream !== null || sort !== null || has.length > 0 || gatewayAllow !== null && gatewayAllow.length > 0);
73616
- const openRouterUsable = useOpenRouter && (upstream !== null || sort !== null || excluded.length > 0 || openRouterAllow !== null && openRouterAllow.length > 0);
73617
- if (!gatewayUsable && !openRouterUsable) return next;
73618
- if (gatewayUsable) {
73619
- const gateway = {};
73620
- if (upstream !== null) if (strict) gateway.only = spell([upstream], "planner");
73621
- else {
73622
- gateway.order = spell([upstream, ...orderRest], "planner");
73623
- if (gatewayAllow !== null && gatewayAllow.length > 0) gateway.only = spell(gatewayAllow, "planner");
73624
- }
73625
- else if (gatewayAllow !== null && gatewayAllow.length > 0) gateway.only = spell(gatewayAllow, "planner");
73626
- if (sort !== null) gateway.sort = sort;
73627
- if (has.length > 0) gateway.has = [...has];
73628
- const providerOptions = isRecord$26(next.providerOptions) ? next.providerOptions : {};
73629
- const currentGateway = isRecord$26(providerOptions.gateway) ? providerOptions.gateway : {};
73630
- next.providerOptions = {
73631
- ...providerOptions,
73632
- gateway: {
73633
- ...currentGateway,
73634
- ...gateway
73635
- }
73636
- };
73637
- }
73638
- if (openRouterUsable) {
73639
- const provider = isRecord$26(next.provider) ? { ...next.provider } : {};
73640
- if (upstream !== null) if (strict) provider.only = spell([upstream], "direct");
73641
- else {
73642
- provider.order = spell([upstream, ...orderRest], "direct");
73643
- if (openRouterAllow !== null && openRouterAllow.length > 0) provider.only = spell(openRouterAllow, "direct");
73644
- }
73645
- else if (openRouterAllow !== null && openRouterAllow.length > 0) provider.only = spell(openRouterAllow, "direct");
73646
- if (sort !== null) provider.sort = OPENROUTER_SORT[sort] ?? sort;
73647
- if (excluded.length > 0) provider.ignore = spell(excluded, "direct");
73648
- next.provider = provider;
73649
- }
73650
- return next;
73651
- }
73652
- /**
73653
- * Read back whether the router honored one attempt's pin.
73654
- *
73655
- * A 200 is not evidence that the pin was applied: an unknown or unavailable
73656
- * `only` value is dropped by the router, which then serves the request from
73657
- * another channel. The only honest test is the channel the response reports.
73658
- */
73659
- function pinAdherence(attempt, routing) {
73660
- const expected = attempt.upstream;
73661
- const excluded = (attempt.excludeList ?? []).filter((name) => normalizeSlug(name) !== normalizeSlug(expected ?? "")).map(normalizeSlug);
73662
- const raw = routing?.finalProvider ?? null;
73663
- const actual = raw === null || raw === void 0 || String(raw).length === 0 ? null : normalizeSlug(raw);
73664
- if (actual !== null && excluded.includes(actual)) return "violated";
73665
- if (expected === null || expected === void 0 || String(expected).length === 0) return "unresolved";
73666
- if (actual === null) return "unresolved";
73667
- if (actual === normalizeSlug(expected)) return "adopted";
73668
- if ((attempt.orderRest ?? []).map(normalizeSlug).includes(actual)) return "fallback";
73669
- return "not-adopted";
73670
- }
73671
- /** Whether an adherence reading means the pin was honored, or cannot be judged. */
73672
- function isAdherenceOk(adherence) {
73673
- return adherence === "adopted" || adherence === "fallback" || adherence === "unresolved";
73674
- }
73675
- /**
73676
- * Name the configuration problems that make a pin impossible to honor.
73677
- *
73678
- * Both cases used to produce a request with no pin fields at all — that is,
73679
- * "excluded" channels still in play, silently.
73680
- *
73681
- * @returns human-readable warnings, empty when the pin is expressible.
73682
- */
73683
- function pinWarnings(attempt, meta) {
73684
- const upstream = attempt.upstream ?? null;
73685
- const warnings = [];
73686
- 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`);
73687
- const known = Array.isArray(meta?.upstreams) ? meta.upstreams : [];
73688
- 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}`);
73689
- const excluded = (attempt.excludeList ?? []).filter((name) => normalizeSlug(name) !== normalizeSlug(upstream ?? ""));
73690
- const excludedIds = new Set(excluded.map(normalizeSlug));
73691
- if (excluded.length === 0) return warnings;
73692
- 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`];
73693
- 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`];
73694
- return warnings;
73695
- }
73696
- /**
73697
- * Expand one model's pin configuration into the ordered failover candidates.
73698
- *
73699
- * A model with a non-empty (post-exclusion) pin list is tried upstream by
73700
- * upstream; a model without one is a single automatic candidate whose excludes
73701
- * become an allow-list.
73702
- */
73703
- function buildAttempts(config) {
73704
- const listed = (config.upstreams ?? []).filter((name) => typeof name === "string" && name.length > 0);
73705
- const exclude = (config.exclude ?? []).filter((name) => typeof name === "string" && name.length > 0);
73706
- const excluded = new Set(exclude.map(normalizeSlug));
73707
- const wanted = listed.filter((name) => !excluded.has(normalizeSlug(name)));
73708
- const strict = normalizePinMode(config.pinMode) === "strict";
73709
- const base = {
73710
- strict,
73711
- sort: normalizeSort(config.sort),
73712
- excludeList: exclude
73713
- };
73714
- const has = (config.has ?? []).filter((name) => typeof name === "string" && name.trim().length > 0);
73715
- if (has.length > 0) base.has = [...has];
73716
- if (typeof config.spelling === "string" && config.spelling.length > 0) base.spelling = config.spelling;
73717
- if (wanted.length > 0) return wanted.map((upstream, index) => ({
73718
- ...base,
73719
- upstream,
73720
- orderRest: strict ? [] : wanted.filter((_, other) => other !== index)
73721
- }));
73722
- return [{
73723
- ...base,
73724
- upstream: null,
73725
- orderRest: []
73726
- }];
73727
- }
73728
- /**
73729
- * Classify a pinned-request failure into one upstream availability verdict.
73730
- * @returns `ok` (the channel answered), `limited`, `bad`, `auth`, or `unknown`.
73731
- */
73732
- function classifyUpstreamError(message) {
73733
- const text = String(message ?? "");
73734
- if (/empty response content/i.test(text)) return "ok";
73735
- if (/429|rate-?limited|temporarily rate/i.test(text)) return "limited";
73736
- if (/invalid_request|modelid|no allowed providers|no available providers|not found|unsupported/i.test(text)) return "bad";
73737
- if (isAuthenticationError$1(text)) return "auth";
73738
- return "unknown";
73739
- }
73740
- /**
73741
- * Recover the gateway's own upstream list from a routing-layer error.
73742
- *
73743
- * The probe channels an impossible `only` value, so the router fails before
73744
- * spending a token and names every provider it could have used.
73745
- */
73746
- function extractAvailableProviders(message, pipeline) {
73747
- const text = String(message ?? "");
73748
- if (pipeline === "planner") {
73749
- const match = /Available providers are:\s*([^.]+)/.exec(text);
73750
- if (match === null) return null;
73751
- const tokens = match[1].split(/,\s*/).map((token) => token.trim()).filter((token) => /^[a-z0-9][a-z0-9-]*$/.test(token));
73752
- return tokens.length > 0 ? tokens : null;
73753
- }
73754
- if (pipeline === "direct") {
73755
- const start = text.indexOf("{");
73756
- if (start < 0) return null;
73757
- try {
73758
- const list = JSON.parse(text.slice(start))?.error?.metadata?.available_providers;
73759
- return Array.isArray(list) && list.length > 0 ? list.map(String) : null;
73760
- } catch {
73761
- return null;
73762
- }
73763
- }
73764
- return null;
73765
- }
73766
- /**
73767
- * Read the tier-0 channel hint out of a planner's reasoning sentence.
73768
- * @param plan - `provider_metadata.gateway.routing.planningReasoning`.
73769
- */
73770
- function parseTier0(plan) {
73771
- const match = /([\w-]+) won tier 0 over ([^."]+)/.exec(String(plan ?? ""));
73772
- if (match === null) return [];
73773
- return [.../* @__PURE__ */ new Set([match[1], ...match[2].split(/,\s*|\s+and\s+/).map((part) => part.trim()).filter(Boolean)])];
73774
- }
73775
- /**
73776
- * Merge the upstream channels discovered by several means, keeping order and
73777
- * dropping duplicates.
73778
- * @param lists - candidate lists, highest confidence first.
73779
- * @returns the merged, de-duplicated upstream slugs (capped at MAX_UPSTREAMS).
73780
- */
73781
- function mergeUpstreams(...lists) {
73782
- const seen = [];
73783
- for (const list of lists) for (const name of list ?? []) {
73784
- const value = String(name);
73785
- if (value.length > 0 && !seen.includes(value)) seen.push(value);
73786
- }
73787
- return seen.slice(0, 64);
73788
- }
73789
- /**
73790
- * Normalize a model id for fuzzy OpenRouter catalog matching.
73791
- * @param value - either id.
73792
- * @returns the comparable form.
73793
- */
73794
- function normalizeSlug(value) {
73795
- return String(value).toLowerCase().replace(/[^a-z0-9]/g, "");
73796
- }
73797
73327
  /** Whether a value is a non-null object. */
73798
73328
  function isRecord$26(value) {
73799
73329
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -74428,11 +73958,10 @@ async function* translate(payloads) {
74428
73958
  //#region src/host/cline-pass/adapter.ts
74429
73959
  /**
74430
73960
  * The Cline Pass LLM adapter: an OpenAI-compatible `chat/completions` stream
74431
- * with upstream pinning, per-account rotation, and pre-first-token failover.
73961
+ * with per-account rotation and pre-first-token failover.
74432
73962
  *
74433
- * Transport and mapping live in `client.ts` / `mapper.ts`; account selection and
74434
- * probing live in `engine.ts`. This module owns the request loop: which account,
74435
- * 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.
74436
73965
  *
74437
73966
  * @module dsh-chatgpt-subscription/cline-pass-adapter
74438
73967
  */
@@ -74465,8 +73994,8 @@ const ATTEMPT_TIMEOUT_MS$1 = 18e4;
74465
73994
  * Retries for a failure that happened BEFORE the request was sent.
74466
73995
  *
74467
73996
  * A TLS handshake to the gateway can fail intermittently on a network path
74468
- * where curl succeeds (the pinned upstream is never contacted: the body with
74469
- * `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
74470
73999
  * request reached the server, and it turns a one-in-two TLS failure into a rare
74471
74000
  * one. Errors after headers, or ambiguously mid-request, are never retried here.
74472
74001
  */
@@ -74607,11 +74136,8 @@ var ClinePassAdapter = class extends LlmAdapter {
74607
74136
  defaultContextWindow: settings.defaultContextWindow,
74608
74137
  maxTokens: settings.defaultMaxTokens,
74609
74138
  streamIdleTimeoutMs: settings.streamIdleTimeoutMs,
74610
- maxConcurrentRequests: settings.maxConcurrentRequests,
74611
- pinSpelling: settings.pinSpelling
74139
+ maxConcurrentRequests: settings.maxConcurrentRequests
74612
74140
  }, images);
74613
- const attempts = buildAttempts(this.engine.pinConfigFor(options.model));
74614
- const meta = this.store.metaOf(options.model);
74615
74141
  const startedAt = Date.now();
74616
74142
  const trace = [];
74617
74143
  const refused = /* @__PURE__ */ new Set();
@@ -74622,8 +74148,8 @@ var ClinePassAdapter = class extends LlmAdapter {
74622
74148
  let attemptIndex = 0;
74623
74149
  let usage;
74624
74150
  let emptyReplays = 0;
74625
- while (attemptIndex < attempts.length) {
74626
- const attempt = attempts[attemptIndex++];
74151
+ while (attemptIndex < 1) {
74152
+ attemptIndex += 1;
74627
74153
  let account;
74628
74154
  try {
74629
74155
  account = await this.engine.resolveAccount(refused);
@@ -74639,16 +74165,14 @@ var ClinePassAdapter = class extends LlmAdapter {
74639
74165
  if (signal.aborted) throw new LlmError("Cline Pass request aborted by caller", "ABORTED", { cause: error });
74640
74166
  throw error;
74641
74167
  }
74642
- const attemptStarted = Date.now();
74643
- const attemptLabel = attempt.upstream ?? "(auto)";
74168
+ const attemptLabel = "(auto)";
74644
74169
  try {
74645
- const pinned = injectPrefs(body, meta, attempt);
74646
74170
  let response;
74647
74171
  let transportError;
74648
74172
  for (let transportTry = 0; transportTry <= TRANSPORT_RETRIES$1; transportTry += 1) {
74649
74173
  const headerDeadline = withAttemptTimeout$1(upstream, this.options.headerTimeoutMs);
74650
74174
  try {
74651
- response = await this.engine.openStream(account, pinned, headerDeadline.signal);
74175
+ response = await this.engine.openStream(account, body, headerDeadline.signal);
74652
74176
  headerDeadline.clear();
74653
74177
  activity?.pulse();
74654
74178
  break;
@@ -74670,9 +74194,8 @@ var ClinePassAdapter = class extends LlmAdapter {
74670
74194
  }
74671
74195
  if (response === void 0) {
74672
74196
  const note = errorChain$2(transportError);
74673
- 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.` : "";
74674
74198
  trace.push(attemptLabel);
74675
- this.store.learnUpstream(options.model, attempt.upstream, "unknown", note, Date.now() - attemptStarted);
74676
74199
  lastError = new LlmError(note + hint, "TRANSPORT", { cause: transportError });
74677
74200
  continue;
74678
74201
  }
@@ -74682,9 +74205,7 @@ var ClinePassAdapter = class extends LlmAdapter {
74682
74205
  try {
74683
74206
  detail = errorMessage(unwrapEnvelope(JSON.parse(raw))) || detail;
74684
74207
  } catch {}
74685
- const ms = Date.now() - attemptStarted;
74686
74208
  trace.push(attemptLabel);
74687
- this.store.learnUpstream(options.model, attempt.upstream, classifyVerdict(detail), detail, ms);
74688
74209
  const code = streamErrorCode$1(detail, response.status);
74689
74210
  lastError = new LlmError(`${detail || `HTTP ${response.status}`} [model=${options.model}]`, code, { status: response.status });
74690
74211
  if (code === "AUTH" || code === "QUOTA") {
@@ -74758,9 +74279,7 @@ var ClinePassAdapter = class extends LlmAdapter {
74758
74279
  if (signal.aborted) throw new LlmError("Cline Pass request aborted by caller", "ABORTED", { cause: error });
74759
74280
  const note = error instanceof LlmError ? error.message : errorChain$2(error);
74760
74281
  const code = error instanceof LlmError ? error.code : "TRANSPORT";
74761
- const ms = Date.now() - attemptStarted;
74762
74282
  trace.push(attemptLabel);
74763
- this.store.learnUpstream(options.model, attempt.upstream, classifyVerdict(note), note, ms);
74764
74283
  if (yielded) {
74765
74284
  this.store.record({
74766
74285
  model: options.model,
@@ -74825,19 +74344,12 @@ var ClinePassAdapter = class extends LlmAdapter {
74825
74344
  yield finishChunk;
74826
74345
  }
74827
74346
  delivered = true;
74828
- const adherence = pinAdherence(attempt, { finalProvider: observed.provider });
74829
- const warnings = pinWarnings({
74830
- upstream: attempt.upstream,
74831
- excludeList: attempt.excludeList
74832
- }, meta);
74833
- if (adherence === "not-adopted") warnings.push(`pinNotAdopted: the gateway served ${observed.provider ?? "(unknown)"} instead of the pinned ${attempt.upstream ?? "(auto)"}`);
74834
- else if (adherence === "violated") warnings.push(`pinViolated: an excluded channel served this request: ${observed.provider ?? "(unknown)"}`);
74347
+ const warnings = [];
74835
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`);
74836
- const ms = Date.now() - attemptStarted;
74837
74349
  trace.push(attemptLabel);
74838
74350
  this.store.record({
74839
74351
  model: options.model,
74840
- provider: observed.provider ?? attempt.upstream ?? "",
74352
+ provider: observed.provider ?? "",
74841
74353
  canonical: observed.canonical ?? "",
74842
74354
  attempts: trace.map(String),
74843
74355
  ms: Date.now() - startedAt,
@@ -74847,7 +74359,6 @@ var ClinePassAdapter = class extends LlmAdapter {
74847
74359
  error: finishFailure?.message ?? "",
74848
74360
  code: finishFailure?.code ?? "",
74849
74361
  account: account.name,
74850
- adherence,
74851
74362
  fingerprint: observed.fingerprint ?? "",
74852
74363
  anonymous: observed.anonymous,
74853
74364
  warnings,
@@ -74859,14 +74370,13 @@ var ClinePassAdapter = class extends LlmAdapter {
74859
74370
  ...observed.fingerprint === null ? {} : { lastFingerprint: observed.fingerprint }
74860
74371
  });
74861
74372
  this.accountPool.recordModel(account.id, options.model);
74862
- if (finishFailure === null && attempt.upstream !== null && adherence === "adopted") this.store.learnUpstream(options.model, attempt.upstream, "ok", "", ms);
74863
74373
  return;
74864
74374
  } finally {
74865
74375
  release();
74866
74376
  }
74867
74377
  }
74868
74378
  if (!delivered) {
74869
- const message = lastError?.message ?? "no pinned upstream could serve the request";
74379
+ const message = lastError?.message ?? "the gateway could not serve the request";
74870
74380
  this.store.record({
74871
74381
  model: options.model,
74872
74382
  provider: "",
@@ -74969,14 +74479,6 @@ function errorMessage(payload) {
74969
74479
  if (isRecord$26(value) && typeof value.message === "string") return value.message;
74970
74480
  return "";
74971
74481
  }
74972
- /** One failed pin's verdict. */
74973
- function classifyVerdict(detail) {
74974
- if (/empty response content/i.test(detail)) return "ok";
74975
- if (/429|rate-?limited|temporarily rate/i.test(detail)) return "limited";
74976
- if (/invalid_request|modelid|no allowed providers|no available providers|not found|unsupported/i.test(detail)) return "bad";
74977
- if (/unauthorized|re\s*authenticate|invalid\s*(?:api\s*key|token)|\b401\b|\b403\b/i.test(detail)) return "auth";
74978
- return "unknown";
74979
- }
74980
74482
  /**
74981
74483
  * Report transport activity and the first byte without disturbing the stream.
74982
74484
  *
@@ -75024,7 +74526,6 @@ async function* tapRouting(payloads, observed) {
75024
74526
  * - `GET api.cline.bot/…/recommended-models` — official subscription list
75025
74527
  * - `GET models.dev/api.json` — community registry, a metadata backstop
75026
74528
  * - `GET ai-gateway.vercel.sh/v1/models` — the upstream's own catalog
75027
- * - `GET openrouter.ai/api/v1/…` — endpoint detail for direct-pipeline models
75028
74529
  *
75029
74530
  * @module dsh-chatgpt-subscription/cline-pass-client
75030
74531
  */
@@ -75301,87 +74802,19 @@ async function fetchOfficialModels({ fetchFn, signal, timeoutMs = 3e4 }) {
75301
74802
  sources
75302
74803
  };
75303
74804
  }
75304
- /** Resolve a canonical slug against OpenRouter's public catalog. */
75305
- async function resolveOpenRouterSlug(fetchFn, slug, { signal, timeoutMs = 3e4 } = {}) {
75306
- try {
75307
- const result = await sendJSON(fetchFn, `${OPENROUTER_API}/models`, {
75308
- signal,
75309
- timeoutMs
75310
- });
75311
- 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");
75312
- const normalize = (value) => value.toLowerCase().replace(/[^a-z0-9]/g, "");
75313
- return ids.find((id) => id === slug) ?? ids.find((id) => normalize(id) === normalize(slug)) ?? null;
75314
- } catch {
75315
- return null;
75316
- }
75317
- }
75318
- /** Per-upstream endpoint detail (context length, recent uptime) for one model. */
75319
- async function openRouterEndpoints(fetchFn, slug, { signal, timeoutMs = 3e4 } = {}) {
75320
- const real = await resolveOpenRouterSlug(fetchFn, slug, {
75321
- signal,
75322
- timeoutMs
75323
- });
75324
- if (real === null) return {
75325
- slug,
75326
- endpoints: []
75327
- };
75328
- try {
75329
- const result = await sendJSON(fetchFn, `${OPENROUTER_API}/models/${real}/endpoints`, {
75330
- signal,
75331
- timeoutMs
75332
- });
75333
- const payload = isRecord$25(result.json) && isRecord$25(result.json.data) ? result.json.data : void 0;
75334
- const rows = payload !== void 0 && Array.isArray(payload.endpoints) ? payload.endpoints : [];
75335
- const detail = /* @__PURE__ */ new Map();
75336
- for (const entry of rows) {
75337
- if (!isRecord$25(entry)) continue;
75338
- const providerSlug = String(entry.tag ?? "").split("/")[0] || String(entry.provider_name ?? "").toLowerCase().replace(/\s+/g, "-");
75339
- if (providerSlug === "") continue;
75340
- const current = detail.get(providerSlug) ?? {
75341
- slug: providerSlug,
75342
- name: String(entry.provider_name ?? providerSlug),
75343
- endpoints: 0,
75344
- context: 0,
75345
- uptime: 0
75346
- };
75347
- current.endpoints += 1;
75348
- current.context = Math.max(current.context, Number(entry.context_length ?? 0));
75349
- current.uptime = Math.max(current.uptime, Math.round(Number(entry.uptime_last_30m ?? 0)));
75350
- detail.set(providerSlug, current);
75351
- }
75352
- return {
75353
- slug: real,
75354
- endpoints: [...detail.values()]
75355
- };
75356
- } catch {
75357
- return {
75358
- slug: real,
75359
- endpoints: []
75360
- };
75361
- }
75362
- }
75363
74805
  function isRecord$25(value) {
75364
74806
  return typeof value === "object" && value !== null && !Array.isArray(value);
75365
74807
  }
75366
74808
  //#endregion
75367
74809
  //#region src/host/cline-pass/engine.ts
75368
74810
  /**
75369
- * The Cline Pass engine: pinned request chains with pre-first-token failover,
75370
- * probing, validation, and account verification. It owns every probe network
75371
- * call, so the adapter, the settings routes and the management tools apply
75372
- * identical pinning semantics.
75373
- *
75374
- * Failover contract: a candidate is abandoned only while nothing has been
75375
- * delivered yet. A non-2xx, a transport failure, or an error payload before the
75376
- * first content delta moves to the next candidate; once a chunk has been
75377
- * 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.
75378
74814
  *
75379
74815
  * @module dsh-chatgpt-subscription/cline-pass-engine
75380
74816
  */
75381
- /**
75382
- * The engine. All methods are safe to call while the pool is serving live
75383
- * traffic; probes take an account through the same rotation as a request.
75384
- */
74817
+ /** All methods are safe to call while the pool is serving live traffic. */
75385
74818
  var ClinePassEngine = class {
75386
74819
  options;
75387
74820
  constructor(options) {
@@ -75404,129 +74837,8 @@ var ClinePassEngine = class {
75404
74837
  baseURL: credentials.baseURL && credentials.baseURL.trim() !== "" ? credentials.baseURL.trim() : this.options.baseURL()
75405
74838
  };
75406
74839
  }
75407
- /** The pin plus the route-wide spelling policy, as a request will send it. */
75408
- pinConfigFor(model) {
75409
- return {
75410
- upstreams: this.pinOf(model).upstreams,
75411
- exclude: this.pinOf(model).exclude,
75412
- pinMode: this.pinOf(model).pinMode,
75413
- sort: this.pinOf(model).sort,
75414
- has: this.pinOf(model).has,
75415
- spelling: this.options.pinFor(model).spelling
75416
- };
75417
- }
75418
- /** The configured pin for one model, read through the live settings file. */
75419
- pinOf(model) {
75420
- const pin = this.options.pinFor(model);
75421
- return {
75422
- upstreams: (pin.upstreams ?? []).map(String),
75423
- exclude: (pin.exclude ?? []).map(String),
75424
- pinMode: pin.pinMode === "preferred" ? "preferred" : "strict",
75425
- sort: typeof pin.sort === "string" ? pin.sort : "",
75426
- has: Array.isArray(pin.has) ? pin.has.map(String) : defaultGatewayHas(model)
75427
- };
75428
- }
75429
- /**
75430
- * One pinned request, non-streaming.
75431
- * @returns the decoded payload plus the facts the pin was judged on.
75432
- */
75433
- async attemptChat(model, body, attempt, { signal, timeoutMs } = {}) {
75434
- const account = await this.resolveAccount();
75435
- const meta = this.store.metaOf(model);
75436
- const pinned = injectPrefs(body, meta, attempt);
75437
- const started = Date.now();
75438
- const result = await chatCompletion({
75439
- fetchFn: this.fetchFn,
75440
- baseURL: account.baseURL || "https://api.cline.bot/api/v1",
75441
- apiKey: account.key,
75442
- body: pinned,
75443
- signal,
75444
- timeoutMs: timeoutMs ?? this.options.attemptTimeoutMs ?? 18e4
75445
- });
75446
- const payload = unwrapEnvelope(result.json);
75447
- const failed = result.ok !== true || payload.error !== void 0 && payload.choices === void 0;
75448
- const routing = failed ? parseRouting({}) : parseRouting(payload);
75449
- return {
75450
- attempt,
75451
- account,
75452
- status: failed ? payload.error === void 0 ? result.status : 502 : 200,
75453
- ok: !failed,
75454
- json: payload,
75455
- text: result.text,
75456
- ms: Date.now() - started,
75457
- routing,
75458
- adherence: failed ? null : pinAdherence(attempt, routing),
75459
- warnings: pinWarnings({
75460
- upstream: attempt.upstream,
75461
- excludeList: attempt.excludeList
75462
- }, meta),
75463
- error: failed ? errorText$1(payload.error) || result.text.slice(0, 400) || `HTTP ${result.status}` : ""
75464
- };
75465
- }
75466
- /**
75467
- * Run one model's ordered candidate chain until an attempt is both answered
75468
- * and served by the channel the pin asked for.
75469
- *
75470
- * This is the diagnostic path (`cline_pass_test`), so it keeps looking past a
75471
- * candidate the router quietly ignored: the point of the call is to find out
75472
- * whether the pin works.
75473
- */
75474
- async runChain(model, body, pinConfig, { signal, timeoutMs } = {}) {
75475
- const trace = [];
75476
- let last = null;
75477
- for (const attempt of buildAttempts(pinConfig)) {
75478
- const outcome = await this.attemptChat(model, body, attempt, {
75479
- signal,
75480
- timeoutMs
75481
- });
75482
- const honored = outcome.ok && isAdherenceOk(outcome.adherence ?? "unresolved");
75483
- const note = !outcome.ok ? outcome.error : honored ? "ok" : `pin not adopted: served by ${outcome.routing.finalProvider ?? "(unknown)"}`;
75484
- trace.push({
75485
- upstream: attempt.upstream ?? "(auto)",
75486
- status: outcome.status,
75487
- ms: outcome.ms,
75488
- note: note.slice(0, 160)
75489
- });
75490
- last = outcome;
75491
- if (honored) return {
75492
- ok: true,
75493
- result: outcome,
75494
- trace,
75495
- error: "",
75496
- warnings: outcome.warnings
75497
- };
75498
- if (!outcome.ok) {
75499
- if (attempt.upstream !== null && outcome.error !== "") this.store.learnUpstream(model, attempt.upstream, classifyUpstreamError(outcome.error), outcome.error, outcome.ms);
75500
- if (attempt.upstream === null && attempt.excludeList.length > 0 && outcome.error !== "") this.learnFromError(model, outcome.error);
75501
- }
75502
- }
75503
- 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)"}`;
75504
- const has = (pinConfig.has ?? []).filter((name) => typeof name === "string" && name.trim() !== "");
75505
- 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;
75506
- return {
75507
- ok: false,
75508
- result: last,
75509
- trace,
75510
- error,
75511
- warnings: last?.warnings ?? []
75512
- };
75513
- }
75514
- /** Merge a gateway error's own provider list into the model's channel list. */
75515
- learnFromError(model, message) {
75516
- const match = /Available providers are:\s*([^.]+)/.exec(String(message ?? ""));
75517
- if (match === null) return;
75518
- const tokens = match[1].split(/,\s*/).map((token) => token.trim()).filter((token) => /^[a-z0-9][a-z0-9-]*$/.test(token));
75519
- if (tokens.length === 0) return;
75520
- const meta = this.store.metaOf(model);
75521
- const current = Array.isArray(meta.upstreams) ? meta.upstreams : [];
75522
- if (!tokens.some((token) => !current.includes(token))) return;
75523
- this.store.learn(model, { upstreams: mergeUpstreams(current, tokens) });
75524
- }
75525
- /**
75526
- * Probe one model: detect its pipeline, read back the upstream it used, and
75527
- * harvest the channel list each pipeline publishes. Costs two tiny requests.
75528
- */
75529
- async probe(model, { signal, timeoutMs } = {}) {
74840
+ /** Send one small, automatically routed request and report what served it. */
74841
+ async test(model, { signal } = {}) {
75530
74842
  const account = await this.resolveAccount();
75531
74843
  const started = Date.now();
75532
74844
  const result = await chatCompletion({
@@ -75542,343 +74854,49 @@ var ClinePassEngine = class {
75542
74854
  max_tokens: 256
75543
74855
  },
75544
74856
  signal,
75545
- timeoutMs: timeoutMs ?? this.options.attemptTimeoutMs ?? 18e4
74857
+ timeoutMs: 18e4
75546
74858
  });
75547
74859
  const payload = unwrapEnvelope(result.json);
75548
74860
  const ms = Date.now() - started;
75549
- if (!result.ok || payload.error !== void 0 && payload.choices === void 0 || !Array.isArray(payload.choices) || payload.choices.length === 0) {
75550
- const message = errorText$1(payload.error) || String(payload.message ?? "") || result.text.slice(0, 400) || (result.ok ? "gateway returned no completion" : `HTTP ${result.status}`);
75551
- this.store.learn(model, {
75552
- ok: false,
75553
- lastError: message,
75554
- lastMs: ms
75555
- });
75556
- return {
75557
- ok: false,
75558
- ms,
75559
- model,
75560
- error: message,
75561
- pipeline: "",
75562
- pinnable: false,
75563
- canonicalSlug: "",
75564
- lastProvider: "",
75565
- upstreams: [],
75566
- availableProviders: [],
75567
- tier0: [],
75568
- fingerprint: "",
75569
- anonymous: false
75570
- };
75571
- }
75572
- const routing = parseRouting(payload);
75573
- const pipeline = routing.pipeline;
75574
- const otherPipeline = pipeline === "planner" ? "direct" : pipeline === "direct" ? "planner" : null;
75575
- const has = this.pinOf(model).has;
75576
- let harvested = null;
75577
- if (pipeline !== null) harvested = await this.harvest(model, pipeline, account, {
75578
- signal,
75579
- timeoutMs: this.options.probeTimeoutMs,
75580
- has
75581
- });
75582
- let otherHarvested = null;
75583
- if (otherPipeline !== null) otherHarvested = await this.harvest(model, otherPipeline, account, {
75584
- signal,
75585
- timeoutMs: this.options.probeTimeoutMs,
75586
- has
75587
- });
75588
- let endpoints = [];
75589
- let openrouterSlug = null;
75590
- if (pipeline !== "planner" && typeof routing.canonicalSlug === "string") {
75591
- const detail = await openRouterEndpoints(this.fetchFn, routing.canonicalSlug, {
75592
- signal,
75593
- timeoutMs: this.options.probeTimeoutMs
75594
- });
75595
- endpoints = detail.endpoints;
75596
- openrouterSlug = detail.slug;
75597
- }
75598
- const previous = this.store.metaOf(model);
75599
- const upstreamDetail = { ...previous.upstreamDetail ?? {} };
75600
- for (const entry of endpoints) upstreamDetail[entry.slug] = entry;
75601
- const discovered = pipeline === "planner" ? mergeUpstreams(harvested, routing.fallbacks) : mergeUpstreams(routing.fallbacks, harvested, Object.keys(upstreamDetail));
75602
- const servedRaw = typeof routing.finalProvider === "string" && routing.finalProvider.length > 0 ? routing.finalProvider : null;
75603
- const served = servedRaw === null ? [] : [pipeline === null ? servedRaw : channelNameFor(servedRaw, pipeline)];
75604
- const combined = mergeUpstreams(served, discovered, otherHarvested);
75605
- const upstreams = combined.length > 0 ? combined : Array.isArray(previous.upstreams) ? previous.upstreams : [];
75606
- const channels = { ...previous.channels ?? {} };
75607
- if (pipeline !== null) {
75608
- const scoped = mergeUpstreams(served, harvested);
75609
- if (scoped.length > 0) channels[pipeline] = scoped;
75610
- }
75611
- if (otherPipeline !== null && Array.isArray(otherHarvested) && otherHarvested.length > 0) channels[otherPipeline] = otherHarvested;
75612
- const tier0 = [.../* @__PURE__ */ new Set([...previous.tier0 ?? [], ...parseTier0(routing.plan)])];
75613
- const meta = this.store.learn(model, {
75614
- ok: true,
75615
- pipeline,
75616
- pinnable: pipeline !== null,
75617
- availableProviders: harvested ?? previous.availableProviders ?? [],
75618
- canonicalSlug: routing.canonicalSlug ?? previous.canonicalSlug ?? null,
75619
- openrouterSlug: openrouterSlug ?? previous.openrouterSlug ?? null,
75620
- upstreamDetail,
75621
- upstreams,
75622
- channels,
75623
- staleAt: combined.length === 0 && upstreams.length > 0 ? Date.now() : 0,
75624
- tier0,
75625
- lastProvider: routing.finalProvider ?? previous.lastProvider ?? null,
75626
- 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,
75627
74871
  lastMs: ms,
75628
- probedAt: Date.now(),
75629
- lastError: ""
74872
+ lastError: error
75630
74873
  });
75631
- return {
75632
- ok: true,
75633
- ms,
75634
- model,
75635
- error: "",
75636
- pipeline: meta.pipeline ?? "",
75637
- pinnable: meta.pinnable === true,
75638
- canonicalSlug: meta.canonicalSlug ?? "",
75639
- lastProvider: meta.lastProvider ?? "",
75640
- upstreams: meta.upstreams ?? [],
75641
- availableProviders: meta.availableProviders ?? [],
75642
- tier0: meta.tier0 ?? [],
75643
- fingerprint: meta.lastFingerprint ?? "",
75644
- anonymous: isClinePassAnonymousUpstream(meta.lastProvider ?? "", meta.canonicalSlug ?? "")
75645
- };
75646
- }
75647
- /**
75648
- * Harvest the exact channel list for one pipeline by pinning a channel that
75649
- * cannot exist: the router fails before spending a token and names every
75650
- * provider it could have used.
75651
- */
75652
- async harvest(model, pipeline, account, { signal, timeoutMs, has = [] }) {
75653
- const base = {
75654
- model,
75655
- messages: [{
75656
- role: "user",
75657
- content: "hi"
75658
- }],
75659
- max_tokens: 16
75660
- };
75661
- const body = pipeline === "planner" ? {
75662
- ...base,
75663
- providerOptions: { gateway: {
75664
- only: ["__probe__"],
75665
- ...has.length > 0 ? { has: [...has] } : {}
75666
- } }
75667
- } : {
75668
- ...base,
75669
- provider: { only: ["__probe__"] }
75670
- };
75671
- try {
75672
- const result = await chatCompletion({
75673
- fetchFn: this.fetchFn,
75674
- baseURL: account.baseURL || "https://api.cline.bot/api/v1",
75675
- apiKey: account.key,
75676
- body,
75677
- signal,
75678
- timeoutMs: timeoutMs ?? this.options.probeTimeoutMs
75679
- });
75680
- const payload = unwrapEnvelope(result.json);
75681
- const listed = extractAvailableProviders(errorText$1(payload.error) || result.text, pipeline);
75682
- if (listed !== null && listed.length > 0) return listed;
75683
- const routing = parseRouting(payload);
75684
- if (routing.finalProvider !== null && routing.finalProvider !== "") return [routing.finalProvider];
75685
- return listed;
75686
- } catch {
75687
- return null;
75688
- }
75689
- }
75690
- /**
75691
- * Test every known channel of a model once and record the verdicts.
75692
- *
75693
- * A channel counts as usable only when the response names it as the one that
75694
- * served the request; a payload carrying `choices` alone is not evidence the
75695
- * pin was honored.
75696
- */
75697
- async validate(model, { signal, timeoutMs } = {}) {
75698
- const meta = this.store.metaOf(model);
75699
- const list = Array.isArray(meta.upstreams) ? meta.upstreams : [];
75700
- const has = this.pinOf(model).has;
75701
- const results = [];
75702
- for (let index = 0; index < list.length; index += 5) {
75703
- if (signal?.aborted === true) break;
75704
- const batch = list.slice(index, index + 5);
75705
- const settled = await Promise.all(batch.map(async (upstream) => {
75706
- const started = Date.now();
75707
- const attempt = {
75708
- upstream,
75709
- strict: true,
75710
- sort: null,
75711
- orderRest: [],
75712
- excludeList: [],
75713
- has
75714
- };
75715
- const body = injectPrefs({
75716
- model,
75717
- messages: [{
75718
- role: "user",
75719
- content: "hi"
75720
- }],
75721
- max_tokens: 16
75722
- }, meta, attempt);
75723
- try {
75724
- const account = await this.resolveAccount();
75725
- const result = await chatCompletion({
75726
- fetchFn: this.fetchFn,
75727
- baseURL: account.baseURL || "https://api.cline.bot/api/v1",
75728
- apiKey: account.key,
75729
- body,
75730
- signal,
75731
- timeoutMs: timeoutMs ?? this.options.probeTimeoutMs
75732
- });
75733
- const payload = unwrapEnvelope(result.json);
75734
- const ms = Date.now() - started;
75735
- let status = "unknown";
75736
- let note = "";
75737
- if (!result.ok || payload.error !== void 0 && payload.choices === void 0) {
75738
- note = errorText$1(payload.error) || result.text || `HTTP ${result.status}`;
75739
- status = isAuthenticationError$1(note, result.status) ? "auth" : classifyUpstreamError(note);
75740
- } else if (payload.choices !== void 0) {
75741
- const routing = parseRouting(payload);
75742
- const adherence = pinAdherence(attempt, routing);
75743
- if (adherence === "adopted") status = "ok";
75744
- else if (adherence === "unresolved") note = "the response did not name the serving channel; the pin could not be verified";
75745
- else {
75746
- status = "not-adopted";
75747
- note = `pin not adopted: served by ${routing.finalProvider ?? "(unknown)"}`;
75748
- }
75749
- }
75750
- return {
75751
- upstream,
75752
- status,
75753
- ms,
75754
- note: note.slice(0, 160)
75755
- };
75756
- } catch (error) {
75757
- return {
75758
- upstream,
75759
- status: "unknown",
75760
- ms: Date.now() - started,
75761
- note: errorText$1(error).slice(0, 160)
75762
- };
75763
- }
75764
- }));
75765
- for (const result of settled) {
75766
- this.store.learnUpstream(model, result.upstream, result.status, result.note, result.ms, { includeUnknown: true });
75767
- results.push(result);
75768
- }
75769
- }
75770
- const summary = {
75771
- ok: 0,
75772
- limited: 0,
75773
- bad: 0,
75774
- auth: 0,
75775
- unknown: 0
75776
- };
75777
- for (const result of results) {
75778
- const bucket = result.status === "not-adopted" ? "bad" : result.status;
75779
- if (bucket === "ok" || bucket === "limited" || bucket === "bad" || bucket === "auth" || bucket === "unknown") summary[bucket] += 1;
75780
- }
75781
- this.store.learn(model, { validatedAt: Date.now() });
75782
- return {
75783
- results,
75784
- summary,
75785
- cancelled: signal?.aborted === true
75786
- };
75787
- }
75788
- /**
75789
- * Send one small chat through a (possibly temporary) pin configuration and
75790
- * report what served it. Nothing is persisted.
75791
- */
75792
- async test(model, { upstreams, exclude, has, signal } = {}) {
75793
- const stored = this.pinOf(model);
75794
- const pin = {
75795
- upstreams: Array.isArray(upstreams) ? upstreams : stored.upstreams,
75796
- exclude: Array.isArray(exclude) ? exclude : stored.exclude,
75797
- pinMode: stored.pinMode,
75798
- sort: stored.sort,
75799
- has: Array.isArray(has) ? has : stored.has,
75800
- spelling: this.options.pinFor(model).spelling
75801
- };
75802
- const started = Date.now();
75803
- const outcome = await this.runChain(model, {
75804
- model,
75805
- messages: [{
75806
- role: "user",
75807
- content: "Reply with the word OK"
75808
- }],
75809
- max_tokens: 256
75810
- }, pin, { signal });
75811
- const ms = Date.now() - started;
75812
- const warnings = outcome.warnings ?? [];
75813
- const targets = [...pin.upstreams ?? []];
75814
- const excluded = [...pin.exclude ?? []];
75815
- const routing = outcome.result?.routing;
75816
- const account = outcome.result?.account.name ?? "";
75817
- if (!outcome.ok) {
75818
- this.store.record({
75819
- model,
75820
- provider: routing?.finalProvider ?? "",
75821
- attempts: outcome.trace.map((row) => row.upstream),
75822
- ms,
75823
- stream: false,
75824
- error: outcome.error,
75825
- account
75826
- });
75827
- return {
75828
- ok: false,
75829
- ms,
75830
- model,
75831
- error: outcome.error,
75832
- targets: [...targets],
75833
- excluded: [...excluded],
75834
- trace: outcome.trace,
75835
- actual: routing?.finalProvider ?? "",
75836
- actualName: routing?.finalProviderName ?? "",
75837
- pipeline: routing?.pipeline ?? "",
75838
- pinnable: routing?.pipeline !== null && routing?.pipeline !== void 0,
75839
- canonicalSlug: routing?.canonicalSlug ?? "",
75840
- account,
75841
- content: "",
75842
- adopted: false,
75843
- adherence: outcome.result?.adherence ?? "",
75844
- plan: routing?.plan ?? "",
75845
- fingerprint: routing?.fingerprint ?? "",
75846
- anonymous: isClinePassAnonymousUpstream(routing?.finalProvider ?? "", routing?.canonicalSlug ?? ""),
75847
- has: [...pin.has ?? []],
75848
- warnings
75849
- };
75850
- }
75851
74874
  this.store.record({
75852
74875
  model,
75853
- provider: routing?.finalProvider ?? "",
75854
- canonical: routing?.canonicalSlug ?? "",
75855
- attempts: outcome.trace.map((row) => row.upstream),
74876
+ provider: routing.finalProvider ?? "",
74877
+ canonical: routing.canonicalSlug ?? "",
75856
74878
  ms,
75857
74879
  stream: false,
75858
- error: "",
75859
- account
74880
+ error,
74881
+ account: account.name,
74882
+ fingerprint: routing.fingerprint ?? "",
74883
+ anonymous: routing.anonymous,
74884
+ warnings
75860
74885
  });
75861
74886
  return {
75862
- ok: true,
74887
+ ok: !failed,
75863
74888
  ms,
75864
74889
  model,
75865
- error: "",
75866
- targets: [...targets],
75867
- excluded: [...excluded],
75868
- trace: outcome.trace,
75869
- actual: routing?.finalProvider ?? "",
75870
- actualName: routing?.finalProviderName ?? "",
75871
- pipeline: routing?.pipeline ?? "",
75872
- pinnable: routing?.pipeline !== null && routing?.pipeline !== void 0,
75873
- canonicalSlug: routing?.canonicalSlug ?? "",
75874
- account,
75875
- content: String(routing?.content ?? "").slice(0, 120),
75876
- adopted: outcome.result?.adherence === "adopted",
75877
- adherence: outcome.result?.adherence ?? "",
75878
- plan: routing?.plan ?? "",
75879
- fingerprint: routing?.fingerprint ?? "",
75880
- anonymous: isClinePassAnonymousUpstream(routing?.finalProvider ?? "", routing?.canonicalSlug ?? ""),
75881
- 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,
75882
74900
  warnings
75883
74901
  };
75884
74902
  }
@@ -75889,7 +74907,7 @@ var ClinePassEngine = class {
75889
74907
  * burning `max_tokens` into an empty completion, for example) counts as
75890
74908
  * authorized: only a real authentication failure is reported as one.
75891
74909
  */
75892
- async testAccount({ key, baseURL, model, signal, timeoutMs = this.options.probeTimeoutMs ?? 6e4 }) {
74910
+ async testAccount({ key, baseURL, model, signal, timeoutMs = 6e4 }) {
75893
74911
  const started = Date.now();
75894
74912
  try {
75895
74913
  const result = await chatCompletion({
@@ -75970,7 +74988,7 @@ var ClinePassEngine = class {
75970
74988
  signal
75971
74989
  });
75972
74990
  }
75973
- /** 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. */
75974
74992
  noAccountError(error) {
75975
74993
  if (error instanceof LlmError) return error;
75976
74994
  return new LlmError(`Cline Pass has no usable account: ${error instanceof Error ? error.message : String(error)}`, "MISSING_CREDENTIAL");
@@ -76059,7 +75077,6 @@ function projectModels$1(settings, store) {
76059
75077
  const enabledSet = settings.enabledModelIds === null ? null : new Set(settings.enabledModelIds);
76060
75078
  return known.map((id) => {
76061
75079
  const meta = store.metaOf(id);
76062
- const pin = settings.pins[id] ?? defaultPin(id);
76063
75080
  const base = resolveModelInfo$1(id, {
76064
75081
  displayName: "Cline Pass",
76065
75082
  synced: settings.catalogModels,
@@ -76073,13 +75090,6 @@ function projectModels$1(settings, store) {
76073
75090
  defaultMaxTokens: settings.defaultMaxTokens,
76074
75091
  contextWindowOverride: settings.contextWindowOverrides[id]
76075
75092
  });
76076
- const verdicts = Object.entries(meta.upstreamStatus ?? {}).map(([upstream, verdict]) => ({
76077
- upstream,
76078
- status: verdict.status,
76079
- ms: Number(verdict.ms ?? 0),
76080
- note: firstLine$2(verdict.note, 160),
76081
- checkedAt: Number(verdict.checkedAt ?? 0)
76082
- })).sort((left, right) => (meta.upstreams ?? []).indexOf(left.upstream) - (meta.upstreams ?? []).indexOf(right.upstream));
76083
75093
  return {
76084
75094
  id,
76085
75095
  name: info.displayName,
@@ -76091,18 +75101,8 @@ function projectModels$1(settings, store) {
76091
75101
  input: [...info.input],
76092
75102
  enabled: (enabledSet === null || enabledSet.has(id)) && !hidden.has(id),
76093
75103
  pipeline: String(meta.pipeline ?? ""),
76094
- pinnable: meta.pinnable === true,
76095
- pinned: pin.upstreams,
76096
- excluded: pin.exclude,
76097
- pinMode: normalizePinMode(pin.pinMode),
76098
- sort: pin.sort,
76099
- has: [...pin.has],
76100
- upstreams: (meta.upstreams ?? []).map(String),
76101
- upstreamStatus: verdicts,
76102
75104
  lastProvider: String(meta.lastProvider ?? ""),
76103
75105
  lastMs: Number(meta.lastMs ?? 0),
76104
- probedAt: Number(meta.probedAt ?? 0),
76105
- validatedAt: Number(meta.validatedAt ?? 0),
76106
75106
  ...settings.contextWindowOverrides[id] === void 0 ? {} : { contextWindowOverride: settings.contextWindowOverrides[id] }
76107
75107
  };
76108
75108
  });
@@ -76160,8 +75160,7 @@ async function getClinePassWebStatus(options, quotaRefresh) {
76160
75160
  defaultMaxTokens: settings.defaultMaxTokens,
76161
75161
  maxConcurrentRequests: settings.maxConcurrentRequests,
76162
75162
  streamIdleTimeoutMs: settings.streamIdleTimeoutMs,
76163
- historyLimit: settings.historyLimit,
76164
- pinSpelling: settings.pinSpelling
75163
+ historyLimit: settings.historyLimit
76165
75164
  }
76166
75165
  };
76167
75166
  }
@@ -76174,10 +75173,6 @@ const CLINE_PASS_ROUTES = {
76174
75173
  "login/status": "GET",
76175
75174
  "login/cancel": "POST",
76176
75175
  models: "GET|POST",
76177
- "models/pin": "POST",
76178
- "models/reset": "POST",
76179
- "models/probe": "POST",
76180
- "models/validate": "POST",
76181
75176
  "models/test": "POST",
76182
75177
  "models/visibility": "POST",
76183
75178
  "models/visibility-all": "POST",
@@ -76329,7 +75324,6 @@ function registerClinePassRoutes(ctx, options) {
76329
75324
  }
76330
75325
  if (typeof body.exposeCatalog === "boolean") patch.exposeCatalog = body.exposeCatalog;
76331
75326
  if (typeof body.exposeTools === "boolean") patch.exposeTools = body.exposeTools;
76332
- if (typeof body.pinSpelling === "string") patch.pinSpelling = body.pinSpelling === "detected" ? "detected" : "both";
76333
75327
  let touched = false;
76334
75328
  if (Object.keys(patch).length > 0) {
76335
75329
  await settingsStore.update(patch);
@@ -76522,139 +75516,6 @@ function registerClinePassRoutes(ctx, options) {
76522
75516
  value: await status()
76523
75517
  });
76524
75518
  }
76525
- if (path === "models/pin") {
76526
- if (method !== "POST") return sendMethodNotAllowed$3(response);
76527
- if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
76528
- ok: false,
76529
- error: "Cross-origin request rejected."
76530
- });
76531
- const body = await readRequestJson$3(request).catch(() => ({}));
76532
- const model = typeof body.model === "string" ? body.model.trim() : "";
76533
- if (model === "") return sendJson$3(response, 400, {
76534
- ok: false,
76535
- error: "this action needs a model id"
76536
- });
76537
- const current = (await settingsStore.read()).pins[model] ?? defaultPin(model);
76538
- const next = {
76539
- upstreams: Array.isArray(body.upstreams) ? body.upstreams.map(String) : current.upstreams,
76540
- exclude: Array.isArray(body.exclude) ? body.exclude.map(String) : current.exclude,
76541
- pinMode: isClinePassPinMode(body.pinMode) ? body.pinMode : current.pinMode,
76542
- sort: body.sort === void 0 ? current.sort : body.sort === "none" ? "" : String(body.sort),
76543
- has: Array.isArray(body.has) ? body.has.map(String).map((name) => name.trim()).filter((name) => name !== "") : current.has
76544
- };
76545
- await settingsStore.setPin(model, next);
76546
- const meta = store.metaOf(model);
76547
- const known = Array.isArray(meta.upstreams) ? meta.upstreams : [];
76548
- const warnings = [...pinWarnings({
76549
- upstream: next.upstreams[0] ?? null,
76550
- excludeList: next.exclude
76551
- }, meta)];
76552
- const named = [...next.upstreams, ...next.exclude];
76553
- 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`);
76554
- else {
76555
- const unknown = named.filter((name) => !known.includes(name));
76556
- 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`);
76557
- }
76558
- return sendJson$3(response, 200, {
76559
- ok: true,
76560
- value: {
76561
- pin: next,
76562
- warnings,
76563
- status: await status()
76564
- }
76565
- });
76566
- }
76567
- if (path === "models/reset") {
76568
- if (method !== "POST") return sendMethodNotAllowed$3(response);
76569
- if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
76570
- ok: false,
76571
- error: "Cross-origin request rejected."
76572
- });
76573
- const body = await readRequestJson$3(request).catch(() => ({}));
76574
- const model = typeof body.model === "string" ? body.model.trim() : "";
76575
- if (model === "") return sendJson$3(response, 400, {
76576
- ok: false,
76577
- error: "this action needs a model id"
76578
- });
76579
- await settingsStore.clearPin(model);
76580
- return sendJson$3(response, 200, {
76581
- ok: true,
76582
- value: { status: await status() }
76583
- });
76584
- }
76585
- if (path === "models/probe") {
76586
- if (method !== "POST") return sendMethodNotAllowed$3(response);
76587
- if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
76588
- ok: false,
76589
- error: "Cross-origin request rejected."
76590
- });
76591
- const body = await readRequestJson$3(request).catch(() => ({}));
76592
- const model = typeof body.model === "string" ? body.model.trim() : "";
76593
- if (model === "") return sendJson$3(response, 400, {
76594
- ok: false,
76595
- error: "this action needs a model id"
76596
- });
76597
- const result = await engine.probe(model);
76598
- return sendJson$3(response, 200, {
76599
- ok: true,
76600
- value: {
76601
- result: {
76602
- ok: result.ok,
76603
- model,
76604
- error: firstLine$2(result.error, 300),
76605
- ms: result.ms,
76606
- pipeline: result.pipeline,
76607
- pinnable: result.pinnable,
76608
- canonicalSlug: result.canonicalSlug,
76609
- lastProvider: result.lastProvider,
76610
- upstreams: result.upstreams,
76611
- availableProviders: result.availableProviders,
76612
- tier0: result.tier0,
76613
- fingerprint: result.fingerprint,
76614
- anonymous: result.anonymous
76615
- },
76616
- status: await status()
76617
- }
76618
- });
76619
- }
76620
- if (path === "models/validate") {
76621
- if (method !== "POST") return sendMethodNotAllowed$3(response);
76622
- if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
76623
- ok: false,
76624
- error: "Cross-origin request rejected."
76625
- });
76626
- const body = await readRequestJson$3(request).catch(() => ({}));
76627
- const model = typeof body.model === "string" ? body.model.trim() : "";
76628
- if (model === "") return sendJson$3(response, 400, {
76629
- ok: false,
76630
- error: "this action needs a model id"
76631
- });
76632
- const meta = store.metaOf(model);
76633
- if (!Array.isArray(meta.upstreams) || meta.upstreams.length === 0) return sendJson$3(response, 400, {
76634
- ok: false,
76635
- error: "no known channels yet: probe this model first"
76636
- });
76637
- const outcome = await engine.validate(model);
76638
- return sendJson$3(response, 200, {
76639
- ok: true,
76640
- value: {
76641
- result: {
76642
- ok: true,
76643
- model,
76644
- error: "",
76645
- summary: outcome.summary,
76646
- upstreams: (store.metaOf(model).upstreams ?? []).map(String),
76647
- results: outcome.results.map((result) => ({
76648
- upstream: result.upstream,
76649
- status: result.status,
76650
- ms: result.ms,
76651
- note: result.note
76652
- }))
76653
- },
76654
- status: await status()
76655
- }
76656
- });
76657
- }
76658
75519
  if (path === "models/test") {
76659
75520
  if (method !== "POST") return sendMethodNotAllowed$3(response);
76660
75521
  if (!isSameOriginMutation(request)) return sendJson$3(response, 403, {
@@ -76667,11 +75528,7 @@ function registerClinePassRoutes(ctx, options) {
76667
75528
  ok: false,
76668
75529
  error: "this action needs a model id"
76669
75530
  });
76670
- const result = await engine.test(model, {
76671
- upstreams: Array.isArray(body.upstreams) ? body.upstreams.map(String) : void 0,
76672
- exclude: Array.isArray(body.exclude) ? body.exclude.map(String) : void 0,
76673
- has: Array.isArray(body.has) ? body.has.map(String).map((name) => name.trim()).filter((name) => name !== "") : void 0
76674
- });
75531
+ const result = await engine.test(model);
76675
75532
  return sendJson$3(response, 200, {
76676
75533
  ok: true,
76677
75534
  value: {
@@ -76680,23 +75537,16 @@ function registerClinePassRoutes(ctx, options) {
76680
75537
  model,
76681
75538
  error: firstLine$2(result.error, 400),
76682
75539
  ms: result.ms,
76683
- targets: result.targets,
76684
- excluded: result.excluded,
76685
75540
  actual: result.actual,
76686
75541
  actualName: result.actualName,
76687
75542
  pipeline: result.pipeline,
76688
- pinnable: result.pinnable,
76689
75543
  canonicalSlug: result.canonicalSlug,
76690
75544
  account: result.account,
76691
75545
  content: result.content,
76692
- adopted: result.adopted,
76693
- adherence: result.adherence,
76694
75546
  plan: firstLine$2(result.plan, 300),
76695
75547
  fingerprint: result.fingerprint,
76696
75548
  anonymous: result.anonymous,
76697
- has: result.has,
76698
- warnings: result.warnings,
76699
- trace: result.trace
75549
+ warnings: result.warnings
76700
75550
  },
76701
75551
  status: await status()
76702
75552
  }
@@ -76964,7 +75814,6 @@ function registerClinePassRoutes(ctx, options) {
76964
75814
  },
76965
75815
  error: entry.error,
76966
75816
  attempts: entry.attempts,
76967
- adherence: entry.adherence,
76968
75817
  fingerprint: entry.fingerprint,
76969
75818
  anonymous: entry.anonymous,
76970
75819
  warnings: entry.warnings
@@ -76992,28 +75841,9 @@ function registerClinePassRoutes(ctx, options) {
76992
75841
  }
76993
75842
  //#endregion
76994
75843
  //#region src/host/cline-pass/store.ts
76995
- /**
76996
- * Runtime observation state: pipeline detection, discovered upstream channels,
76997
- * per-channel verdicts, the last catalog scan, the last quota reading, and
76998
- * request history.
76999
- *
77000
- * Configuration lives in the settings file instead (see `token-store.ts`).
77001
- * Everything here is derived data any probe can rebuild, so it is never
77002
- * persisted.
77003
- *
77004
- * @module dsh-chatgpt-subscription/cline-pass-store
77005
- */
77006
- function verdict(status, note, ms) {
77007
- return {
77008
- status,
77009
- note: String(note ?? "").slice(0, 200),
77010
- ms: Number(ms ?? 0),
77011
- checkedAt: Date.now()
77012
- };
77013
- }
77014
75844
  /** Create the observation store. */
77015
75845
  function createClinePassStore({ historyLimit = 100 } = {}) {
77016
- /** Model id -> discovered metadata. */
75846
+ /** Model id -> observed response metadata. */
77017
75847
  const models = /* @__PURE__ */ new Map();
77018
75848
  /** Newest first. */
77019
75849
  const history = [];
@@ -77030,45 +75860,26 @@ function createClinePassStore({ historyLimit = 100 } = {}) {
77030
75860
  fetchedAt: 0
77031
75861
  };
77032
75862
  return {
77033
- /** Discovered metadata for one model (never undefined). */
75863
+ /** Observed metadata for one model (never undefined). */
77034
75864
  metaOf(model) {
77035
75865
  return models.get(model) ?? {};
77036
75866
  },
77037
- /** Every model with discovered metadata. */
75867
+ /** Every model with observed metadata. */
77038
75868
  allMeta() {
77039
75869
  return [...models.entries()].map(([id, meta]) => ({
77040
75870
  id,
77041
75871
  ...meta
77042
75872
  }));
77043
75873
  },
77044
- /** Merge one discovery result into a model's metadata. */
75874
+ /** Merge one response observation into a model's metadata. */
77045
75875
  learn(model, patch) {
77046
- const current = models.get(model) ?? {};
77047
75876
  const next = {
77048
- ...current,
75877
+ ...models.get(model) ?? {},
77049
75878
  ...patch
77050
75879
  };
77051
- if (patch.upstreamStatus !== void 0) next.upstreamStatus = {
77052
- ...current.upstreamStatus ?? {},
77053
- ...patch.upstreamStatus
77054
- };
77055
- if (next.upstreams !== void 0) next.upstreams = [...new Set(next.upstreams.map(String).filter((name) => name.length > 0))].slice(0, 64);
77056
75880
  models.set(model, next);
77057
75881
  return next;
77058
75882
  },
77059
- /** Record a verdict; explicit validation also replaces stale results with unknown. */
77060
- learnUpstream(model, upstream, status, note, ms, { includeUnknown = false } = {}) {
77061
- if (upstream === void 0 || upstream === null || upstream === "") return;
77062
- if (status === "unknown" && !includeUnknown) return;
77063
- const current = models.get(model) ?? {};
77064
- models.set(model, {
77065
- ...current,
77066
- upstreamStatus: {
77067
- ...current.upstreamStatus ?? {},
77068
- [upstream]: verdict(status, note, ms)
77069
- }
77070
- });
77071
- },
77072
75883
  /** Append one request-history row (newest first, bounded). */
77073
75884
  record(entry) {
77074
75885
  historyRevision += 1;
@@ -77086,7 +75897,6 @@ function createClinePassStore({ historyLimit = 100 } = {}) {
77086
75897
  usage: entry.usage ?? null,
77087
75898
  error: entry.error ?? "",
77088
75899
  attempts: entry.attempts ?? [],
77089
- adherence: entry.adherence ?? "",
77090
75900
  fingerprint: entry.fingerprint ?? "",
77091
75901
  anonymous: entry.anonymous === true,
77092
75902
  warnings: entry.warnings ?? [],
@@ -77145,11 +75955,9 @@ function createClinePassStore({ historyLimit = 100 } = {}) {
77145
75955
  /**
77146
75956
  * The model-facing `cline_pass_*` management tools.
77147
75957
  *
77148
- * They read and write the same settings file the provider runs from, so a pin
77149
- * written here takes effect on the very next model call. Registration is
77150
- * optional and read at startup (see `exposeTools`): eight definitions are several
77151
- * kilobytes of schema riding in every request's tool list, and a conversation
77152
- * 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.
77153
75961
  *
77154
75962
  * @module dsh-chatgpt-subscription/cline-pass-tools
77155
75963
  */
@@ -77162,16 +75970,6 @@ function text$2(value) {
77162
75970
  function firstLine$1(value, max = 200) {
77163
75971
  return String(value ?? "").replace(/\s+/g, " ").trim().slice(0, max);
77164
75972
  }
77165
- /** Human label for one upstream availability verdict. */
77166
- const STATUS_LABEL = {
77167
- ok: "available",
77168
- limited: "rate-limited",
77169
- bad: "not-pinnable",
77170
- auth: "auth-failed",
77171
- "not-adopted": "not-adopted",
77172
- unknown: "unknown"
77173
- };
77174
- const statusLabel = (status) => STATUS_LABEL[status] ?? String(status ?? "unknown");
77175
75973
  const ACCOUNT_SCHEMA = {
77176
75974
  type: "object",
77177
75975
  additionalProperties: false,
@@ -77196,50 +75994,6 @@ const ACCOUNT_SCHEMA = {
77196
75994
  authStatus: { type: "string" }
77197
75995
  }
77198
75996
  };
77199
- const TRACE_SCHEMA = {
77200
- type: "object",
77201
- additionalProperties: false,
77202
- properties: {
77203
- upstream: {
77204
- type: "string",
77205
- required: true
77206
- },
77207
- status: {
77208
- type: "integer",
77209
- required: true
77210
- },
77211
- ms: {
77212
- type: "integer",
77213
- required: true
77214
- },
77215
- note: {
77216
- type: "string",
77217
- required: true
77218
- }
77219
- }
77220
- };
77221
- const VALIDATE_RESULT_SCHEMA = {
77222
- type: "object",
77223
- additionalProperties: false,
77224
- properties: {
77225
- upstream: {
77226
- type: "string",
77227
- required: true
77228
- },
77229
- status: {
77230
- type: "string",
77231
- required: true
77232
- },
77233
- ms: {
77234
- type: "integer",
77235
- required: true
77236
- },
77237
- note: {
77238
- type: "string",
77239
- required: true
77240
- }
77241
- }
77242
- };
77243
75997
  const MODEL_SCHEMA = {
77244
75998
  type: "object",
77245
75999
  additionalProperties: false,
@@ -77256,72 +76010,10 @@ const MODEL_SCHEMA = {
77256
76010
  type: "string",
77257
76011
  required: true
77258
76012
  },
77259
- pinnable: {
77260
- type: "boolean",
77261
- required: true
77262
- },
77263
76013
  hidden: {
77264
76014
  type: "boolean",
77265
76015
  required: true
77266
76016
  },
77267
- pinMode: {
77268
- type: "string",
77269
- required: true
77270
- },
77271
- sort: {
77272
- type: "string",
77273
- required: true
77274
- },
77275
- has: {
77276
- type: "array",
77277
- required: true,
77278
- items: { type: "string" }
77279
- },
77280
- pinned: {
77281
- type: "array",
77282
- required: true,
77283
- items: { type: "string" }
77284
- },
77285
- excluded: {
77286
- type: "array",
77287
- required: true,
77288
- items: { type: "string" }
77289
- },
77290
- upstreams: {
77291
- type: "array",
77292
- required: true,
77293
- items: { type: "string" }
77294
- },
77295
- upstreamStatus: {
77296
- type: "array",
77297
- required: true,
77298
- items: {
77299
- type: "object",
77300
- additionalProperties: false,
77301
- properties: {
77302
- upstream: {
77303
- type: "string",
77304
- required: true
77305
- },
77306
- status: {
77307
- type: "string",
77308
- required: true
77309
- },
77310
- ms: {
77311
- type: "integer",
77312
- required: true
77313
- },
77314
- note: {
77315
- type: "string",
77316
- required: true
77317
- },
77318
- checkedAt: {
77319
- type: "integer",
77320
- required: true
77321
- }
77322
- }
77323
- }
77324
- },
77325
76017
  lastProvider: {
77326
76018
  type: "string",
77327
76019
  required: true
@@ -77329,14 +76021,6 @@ const MODEL_SCHEMA = {
77329
76021
  lastMs: {
77330
76022
  type: "integer",
77331
76023
  required: true
77332
- },
77333
- probedAt: {
77334
- type: "integer",
77335
- required: true
77336
- },
77337
- validatedAt: {
77338
- type: "integer",
77339
- required: true
77340
76024
  }
77341
76025
  }
77342
76026
  };
@@ -77348,25 +76032,9 @@ function projectModel(status, model) {
77348
76032
  id: entry.id,
77349
76033
  displayName: entry.name.replace(/^cline-pass\//, ""),
77350
76034
  pipeline: entry.pipeline,
77351
- pinnable: entry.pinnable,
77352
76035
  hidden: !entry.enabled,
77353
- pinMode: normalizePinMode(entry.pinMode),
77354
- sort: entry.sort,
77355
- has: entry.has,
77356
- pinned: entry.pinned,
77357
- excluded: entry.excluded,
77358
- upstreams: entry.upstreams,
77359
- upstreamStatus: entry.upstreamStatus.map((verdict) => ({
77360
- upstream: verdict.upstream,
77361
- status: verdict.status,
77362
- ms: Math.round(verdict.ms),
77363
- note: verdict.note,
77364
- checkedAt: Math.round(verdict.checkedAt)
77365
- })),
77366
76036
  lastProvider: entry.lastProvider,
77367
- lastMs: Math.round(entry.lastMs),
77368
- probedAt: Math.round(entry.probedAt),
77369
- validatedAt: Math.round(entry.validatedAt)
76037
+ lastMs: Math.round(entry.lastMs)
77370
76038
  };
77371
76039
  }
77372
76040
  /**
@@ -77376,10 +76044,9 @@ function projectModel(status, model) {
77376
76044
  function registerClinePassTools(ctx, options) {
77377
76045
  const { settings, accountPool, store, engine, status, serving } = options;
77378
76046
  const disposers = [];
77379
- const pinOf = async (model) => (await settings.read()).pins[model] ?? defaultPin(model);
77380
76047
  disposers.push(ctx.tools.register(defineTool({
77381
76048
  name: "cline_pass_status",
77382
- 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.",
77383
76050
  parameters: {},
77384
76051
  isConcurrencySafe: () => true,
77385
76052
  timeoutMs: 3e4,
@@ -77416,14 +76083,6 @@ function registerClinePassTools(ctx, options) {
77416
76083
  knownModels: {
77417
76084
  type: "integer",
77418
76085
  required: true
77419
- },
77420
- pinnedModels: {
77421
- type: "integer",
77422
- required: true
77423
- },
77424
- probedModels: {
77425
- type: "integer",
77426
- required: true
77427
76086
  }
77428
76087
  }
77429
76088
  },
@@ -77433,7 +76092,7 @@ function registerClinePassTools(ctx, options) {
77433
76092
  `accountMode=${value.accountMode}`,
77434
76093
  `accounts (${value.accounts.length}):`,
77435
76094
  ...value.accounts.map((account) => ` ${account.alias} (${account.id})${account.enabled ? "" : " (disabled)"}${account.authStatus ? ` [${account.authStatus}]` : ""}`),
77436
- `models: known=${value.knownModels} pinned=${value.pinnedModels} probed=${value.probedModels}`
76095
+ `models: known=${value.knownModels}`
77437
76096
  ].join("\n"))
77438
76097
  },
77439
76098
  async execute() {
@@ -77452,15 +76111,13 @@ function registerClinePassTools(ctx, options) {
77452
76111
  ...account.cooldownUntil === void 0 ? {} : { cooldownUntil: Math.round(account.cooldownUntil) },
77453
76112
  ...account.authStatus === void 0 ? {} : { authStatus: account.authStatus }
77454
76113
  })),
77455
- knownModels: current.models.length,
77456
- pinnedModels: current.models.filter((model) => model.pinned.length > 0).length,
77457
- probedModels: current.models.filter((model) => model.probedAt > 0).length
76114
+ knownModels: current.models.length
77458
76115
  };
77459
76116
  }
77460
76117
  })));
77461
76118
  disposers.push(ctx.tools.register(defineTool({
77462
76119
  name: "cline_pass_models",
77463
- 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.",
77464
76121
  parameters: {
77465
76122
  model: {
77466
76123
  type: "string",
@@ -77513,13 +76170,7 @@ function registerClinePassTools(ctx, options) {
77513
76170
  },
77514
76171
  render: (_args, value) => {
77515
76172
  const blocks = value.models.map((model) => {
77516
- 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(",")}`}`];
77517
- if (model.upstreams.length > 0) {
77518
- const verdicts = new Map(model.upstreamStatus.map((entry) => [entry.upstream, entry.status]));
77519
- lines.push(` upstreams: ${model.upstreams.map((upstream) => `${upstream}[${statusLabel(verdicts.get(upstream) ?? "unknown")}]`).join(" ")}`);
77520
- } else lines.push(" upstreams: (unknown — run cline_pass_probe for this model)");
77521
- if (model.lastProvider !== "") lines.push(` last=${model.lastProvider} (${model.lastMs}ms)`);
77522
- 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");
77523
76174
  });
77524
76175
  return text$2([
77525
76176
  `${value.models.length} Cline Pass model(s); official catalog=${value.catalogCount}${value.catalogSources.length === 0 ? "" : ` via ${value.catalogSources.join(",")}`}`,
@@ -77595,221 +76246,13 @@ function registerClinePassTools(ctx, options) {
77595
76246
  }
77596
76247
  })));
77597
76248
  disposers.push(ctx.tools.register(defineTool({
77598
- name: "cline_pass_probe",
77599
- 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.",
77600
- parameters: { model: {
77601
- type: "string",
77602
- required: true,
77603
- description: "Model id, e.g. \"cline-pass/glm-5.2\"."
77604
- } },
77605
- timeoutMs: 6e5,
77606
- output: {
77607
- schema: {
77608
- type: "object",
77609
- additionalProperties: false,
77610
- properties: {
77611
- ok: {
77612
- type: "boolean",
77613
- required: true
77614
- },
77615
- model: {
77616
- type: "string",
77617
- required: true
77618
- },
77619
- error: {
77620
- type: "string",
77621
- required: true
77622
- },
77623
- ms: {
77624
- type: "integer",
77625
- required: true
77626
- },
77627
- pipeline: {
77628
- type: "string",
77629
- required: true
77630
- },
77631
- pinnable: {
77632
- type: "boolean",
77633
- required: true
77634
- },
77635
- canonicalSlug: {
77636
- type: "string",
77637
- required: true
77638
- },
77639
- lastProvider: {
77640
- type: "string",
77641
- required: true
77642
- },
77643
- upstreams: {
77644
- type: "array",
77645
- required: true,
77646
- items: { type: "string" }
77647
- },
77648
- availableProviders: {
77649
- type: "array",
77650
- required: true,
77651
- items: { type: "string" }
77652
- },
77653
- tier0: {
77654
- type: "array",
77655
- required: true,
77656
- items: { type: "string" }
77657
- }
77658
- }
77659
- },
77660
- render: (_args, value) => {
77661
- if (!value.ok) return text$2(`probe ${value.model} failed: ${value.error}`);
77662
- return text$2([
77663
- `probe ${value.model}: ok in ${value.ms}ms`,
77664
- `pipeline=${value.pipeline} pinnable=${value.pinnable} canonicalSlug=${value.canonicalSlug || "-"} lastProvider=${value.lastProvider || "-"}`,
77665
- value.upstreams.length === 0 ? "upstreams: (none discovered)" : `upstreams (${value.upstreams.length}): ${value.upstreams.join(", ")}`,
77666
- value.tier0.length === 0 ? "" : `tier0: ${value.tier0.join(", ")}`
77667
- ].filter((line) => line !== "").join("\n"));
77668
- }
77669
- },
77670
- async execute(args, exec) {
77671
- const model = String(args.model).trim();
77672
- const result = await engine.probe(model, { signal: exec.signal });
77673
- return {
77674
- ok: result.ok,
77675
- model,
77676
- error: firstLine$1(result.error, 400),
77677
- ms: Math.round(result.ms),
77678
- pipeline: result.pipeline,
77679
- pinnable: result.pinnable,
77680
- canonicalSlug: result.canonicalSlug,
77681
- lastProvider: result.lastProvider,
77682
- upstreams: result.upstreams,
77683
- availableProviders: result.availableProviders,
77684
- tier0: result.tier0
77685
- };
77686
- }
77687
- })));
77688
- disposers.push(ctx.tools.register(defineTool({
77689
- name: "cline_pass_validate",
77690
- 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.",
77691
76251
  parameters: { model: {
77692
76252
  type: "string",
77693
76253
  required: true,
77694
76254
  description: "Model id, e.g. \"cline-pass/glm-5.2\"."
77695
76255
  } },
77696
- timeoutMs: 18e5,
77697
- output: {
77698
- schema: {
77699
- type: "object",
77700
- additionalProperties: false,
77701
- properties: {
77702
- ok: {
77703
- type: "boolean",
77704
- required: true
77705
- },
77706
- model: {
77707
- type: "string",
77708
- required: true
77709
- },
77710
- error: {
77711
- type: "string",
77712
- required: true
77713
- },
77714
- summary: {
77715
- type: "object",
77716
- required: true,
77717
- additionalProperties: false,
77718
- properties: {
77719
- ok: {
77720
- type: "integer",
77721
- required: true
77722
- },
77723
- limited: {
77724
- type: "integer",
77725
- required: true
77726
- },
77727
- bad: {
77728
- type: "integer",
77729
- required: true
77730
- },
77731
- auth: {
77732
- type: "integer",
77733
- required: true
77734
- },
77735
- unknown: {
77736
- type: "integer",
77737
- required: true
77738
- }
77739
- }
77740
- },
77741
- results: {
77742
- type: "array",
77743
- required: true,
77744
- items: VALIDATE_RESULT_SCHEMA
77745
- }
77746
- }
77747
- },
77748
- render: (_args, value) => {
77749
- if (!value.ok) return text$2(`validate ${value.model} failed: ${value.error}`);
77750
- return text$2([
77751
- `validate ${value.model}: ${value.results.length} upstream(s)`,
77752
- `available=${value.summary.ok} rate-limited=${value.summary.limited} not-pinnable=${value.summary.bad} auth-failed=${value.summary.auth} unknown=${value.summary.unknown}`,
77753
- ...value.results.map((entry) => `${entry.upstream}: ${statusLabel(entry.status)} (${entry.ms}ms)${entry.note === "" ? "" : ` — ${entry.note}`}`)
77754
- ].join("\n"));
77755
- }
77756
- },
77757
- async execute(args, exec) {
77758
- const model = String(args.model).trim();
77759
- const meta = store.metaOf(model);
77760
- if (!Array.isArray(meta.upstreams) || meta.upstreams.length === 0) return {
77761
- ok: false,
77762
- model,
77763
- error: "no known upstream channels: run cline_pass_probe for this model first",
77764
- summary: {
77765
- ok: 0,
77766
- limited: 0,
77767
- bad: 0,
77768
- auth: 0,
77769
- unknown: 0
77770
- },
77771
- results: []
77772
- };
77773
- const outcome = await engine.validate(model, { signal: exec.signal });
77774
- return {
77775
- ok: true,
77776
- model,
77777
- error: "",
77778
- summary: outcome.summary,
77779
- results: outcome.results.map((result) => ({
77780
- upstream: result.upstream,
77781
- status: result.status,
77782
- ms: Math.round(result.ms),
77783
- note: result.note.slice(0, 160)
77784
- }))
77785
- };
77786
- }
77787
- })));
77788
- disposers.push(ctx.tools.register(defineTool({
77789
- name: "cline_pass_test",
77790
- 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.",
77791
- parameters: {
77792
- model: {
77793
- type: "string",
77794
- required: true,
77795
- description: "Model id, e.g. \"cline-pass/glm-5.2\"."
77796
- },
77797
- upstreams: {
77798
- type: "array",
77799
- items: { type: "string" },
77800
- description: "Ordered upstream candidates for this call only."
77801
- },
77802
- exclude: {
77803
- type: "array",
77804
- items: { type: "string" },
77805
- description: "Upstream channels to exclude for this call only."
77806
- },
77807
- has: {
77808
- type: "array",
77809
- items: { type: "string" },
77810
- description: "Vercel gateway capability filter for this call only."
77811
- }
77812
- },
77813
76256
  timeoutMs: 6e5,
77814
76257
  output: {
77815
76258
  schema: {
@@ -77844,45 +76287,18 @@ function registerClinePassTools(ctx, options) {
77844
76287
  type: "string",
77845
76288
  required: true
77846
76289
  },
77847
- adherence: {
77848
- type: "string",
77849
- required: true
77850
- },
77851
- has: {
77852
- type: "array",
77853
- required: true,
77854
- items: { type: "string" }
77855
- },
77856
76290
  warnings: {
77857
76291
  type: "array",
77858
76292
  required: true,
77859
76293
  items: { type: "string" }
77860
- },
77861
- trace: {
77862
- type: "array",
77863
- required: true,
77864
- items: TRACE_SCHEMA
77865
76294
  }
77866
76295
  }
77867
76296
  },
77868
- render: (_args, value) => {
77869
- const trace = value.trace.map((entry) => ` ${entry.upstream} -> HTTP ${entry.status} in ${entry.ms}ms${entry.note === "" ? "" : ` — ${entry.note}`}`);
77870
- return text$2([
77871
- value.ok ? `test ${value.model}: ok in ${value.ms}ms via ${value.actual || "(unknown)"}` : `test ${value.model}: FAILED — ${value.error}`,
77872
- ...value.warnings.map((warning) => `⚠ ${warning}`),
77873
- trace.length === 0 ? "" : `attempts (${trace.length}):`,
77874
- ...trace
77875
- ].filter((line) => line !== "").join("\n"));
77876
- }
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"))
77877
76298
  },
77878
76299
  async execute(args, exec) {
77879
76300
  const model = String(args.model).trim();
77880
- const result = await engine.test(model, {
77881
- upstreams: Array.isArray(args.upstreams) ? args.upstreams.map(String) : void 0,
77882
- exclude: Array.isArray(args.exclude) ? args.exclude.map(String) : void 0,
77883
- has: Array.isArray(args.has) ? args.has.map(String) : void 0,
77884
- signal: exec.signal
77885
- });
76301
+ const result = await engine.test(model, { signal: exec.signal });
77886
76302
  return {
77887
76303
  ok: result.ok,
77888
76304
  model,
@@ -77891,142 +76307,7 @@ function registerClinePassTools(ctx, options) {
77891
76307
  actual: result.actual,
77892
76308
  pipeline: result.pipeline,
77893
76309
  account: result.account,
77894
- adherence: result.adherence,
77895
- has: result.has,
77896
- warnings: result.warnings,
77897
- trace: result.trace.map((entry) => ({
77898
- upstream: entry.upstream,
77899
- status: entry.status,
77900
- ms: Math.round(entry.ms),
77901
- note: entry.note.slice(0, 160)
77902
- }))
77903
- };
77904
- }
77905
- })));
77906
- disposers.push(ctx.tools.register(defineTool({
77907
- name: "cline_pass_pin",
77908
- 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.",
77909
- parameters: {
77910
- model: {
77911
- type: "string",
77912
- required: true,
77913
- description: "Model id, e.g. \"cline-pass/glm-5.2\"."
77914
- },
77915
- upstreams: {
77916
- type: "array",
77917
- items: { type: "string" },
77918
- description: "Ordered pin list; an empty array clears pinning."
77919
- },
77920
- exclude: {
77921
- type: "array",
77922
- items: { type: "string" },
77923
- description: "Channels that must never be used."
77924
- },
77925
- pinMode: {
77926
- type: "string",
77927
- enum: ["strict", "preferred"],
77928
- description: "How strictly to honor the pin list."
77929
- },
77930
- sort: {
77931
- type: "string",
77932
- enum: [
77933
- "cost",
77934
- "ttft",
77935
- "tps",
77936
- "none"
77937
- ],
77938
- description: "Reorder candidates by this metric; \"none\" clears it."
77939
- },
77940
- has: {
77941
- type: "array",
77942
- items: { type: "string" },
77943
- description: "Vercel gateway capability filter; omit to keep the stored value, or pass an empty array to clear it."
77944
- }
77945
- },
77946
- timeoutMs: 3e4,
77947
- output: {
77948
- schema: {
77949
- type: "object",
77950
- additionalProperties: false,
77951
- properties: {
77952
- ok: {
77953
- type: "boolean",
77954
- required: true
77955
- },
77956
- model: {
77957
- type: "string",
77958
- required: true
77959
- },
77960
- pinned: {
77961
- type: "array",
77962
- required: true,
77963
- items: { type: "string" }
77964
- },
77965
- excluded: {
77966
- type: "array",
77967
- required: true,
77968
- items: { type: "string" }
77969
- },
77970
- pinMode: {
77971
- type: "string",
77972
- required: true
77973
- },
77974
- sort: {
77975
- type: "string",
77976
- required: true
77977
- },
77978
- has: {
77979
- type: "array",
77980
- required: true,
77981
- items: { type: "string" }
77982
- },
77983
- warnings: {
77984
- type: "array",
77985
- required: true,
77986
- items: { type: "string" }
77987
- }
77988
- }
77989
- },
77990
- render: (_args, value) => text$2([
77991
- `pinned ${value.model}`,
77992
- `upstreams: ${value.pinned.length === 0 ? "(auto)" : value.pinned.join(" > ")}`,
77993
- `exclude: ${value.excluded.length === 0 ? "(none)" : value.excluded.join(", ")}`,
77994
- `pinMode=${value.pinMode} sort=${value.sort === "" ? "none" : value.sort} has=${value.has.length === 0 ? "(none)" : value.has.join(",")}`,
77995
- ...value.warnings.map((warning) => `⚠ ${warning}`)
77996
- ].join("\n"))
77997
- },
77998
- async execute(args) {
77999
- const model = String(args.model).trim();
78000
- const current = await pinOf(model);
78001
- const next = {
78002
- upstreams: Array.isArray(args.upstreams) ? args.upstreams.map(String) : current.upstreams,
78003
- exclude: Array.isArray(args.exclude) ? args.exclude.map(String) : current.exclude,
78004
- pinMode: args.pinMode !== void 0 ? args.pinMode === "preferred" ? "preferred" : "strict" : current.pinMode,
78005
- sort: args.sort === void 0 ? current.sort : args.sort === "none" ? "" : String(args.sort),
78006
- has: Array.isArray(args.has) ? args.has.map(String).map((name) => name.trim()).filter((name) => name !== "") : current.has
78007
- };
78008
- await settings.setPin(model, next);
78009
- const meta = store.metaOf(model);
78010
- const known = Array.isArray(meta.upstreams) ? meta.upstreams.map(String) : [];
78011
- const warnings = [...pinWarnings({
78012
- upstream: next.upstreams[0] ?? null,
78013
- excludeList: next.exclude
78014
- }, meta)];
78015
- const named = [...next.upstreams, ...next.exclude];
78016
- 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`);
78017
- else {
78018
- const unknown = named.filter((name) => !known.includes(name));
78019
- 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`);
78020
- }
78021
- return {
78022
- ok: true,
78023
- model,
78024
- pinned: next.upstreams,
78025
- excluded: next.exclude,
78026
- pinMode: normalizePinMode(next.pinMode),
78027
- sort: next.sort,
78028
- has: next.has,
78029
- warnings
76310
+ warnings: result.warnings
78030
76311
  };
78031
76312
  }
78032
76313
  })));
@@ -78289,10 +76570,6 @@ function createClinePassLine(ctx, options) {
78289
76570
  ...options.modelFetchFn === void 0 ? {} : { streamFetchFn: options.modelFetchFn },
78290
76571
  accountPool,
78291
76572
  store,
78292
- pinFor: (model) => ({
78293
- ...modelSettings.status().pins[model] ?? defaultPin(model),
78294
- spelling: modelSettings.status().pinSpelling
78295
- }),
78296
76573
  baseURL: () => modelSettings.status().baseURL,
78297
76574
  logger: ctx.logger
78298
76575
  });
@@ -107449,4 +105726,4 @@ function apply(ctx, pluginConfig = {}) {
107449
105726
  }, "dsh-chatgpt-subscription: adapter, routes, and lifecycle");
107450
105727
  }
107451
105728
  //#endregion
107452
- 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 };