@eddyskywalker/dsh-chatgpt-subscription 0.75.2 → 0.76.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.
- package/CHANGELOG.md +26 -0
- package/README.md +1 -1
- package/lib/client.js +978 -789
- package/lib/client.js.map +1 -1
- package/lib/index.js +555 -288
- package/lib/types/client/CodexSubscriptionSection.d.ts.map +1 -1
- package/lib/types/client/antigravity-acp/AntigravityAcpSection.d.ts.map +1 -1
- package/lib/types/client/antigravity-acp/locales.d.ts +6 -0
- package/lib/types/client/antigravity-acp/locales.d.ts.map +1 -1
- package/lib/types/client/claude/ClaudeSection.d.ts.map +1 -1
- package/lib/types/client/cline-pass/ClinePassSection.d.ts.map +1 -1
- package/lib/types/client/command-code/CommandCodeSection.d.ts.map +1 -1
- package/lib/types/client/common/LineProxySection.d.ts +78 -0
- package/lib/types/client/common/LineProxySection.d.ts.map +1 -0
- package/lib/types/client/glm-coding-plan/GlmCodingPlanSection.d.ts.map +1 -1
- package/lib/types/client/kimi-code/KimiCodeSection.d.ts.map +1 -1
- package/lib/types/client/locales-ru/antigravity-acp.d.ts.map +1 -1
- package/lib/types/client/locales-ru/hub.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +15 -3
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/minimax-code/MinimaxCodeSection.d.ts.map +1 -1
- package/lib/types/client/ollama/OllamaSection.d.ts.map +1 -1
- package/lib/types/client/opendesign/OpenDesignSection.d.ts.map +1 -1
- package/lib/types/client/qoder/QoderSection.d.ts.map +1 -1
- package/lib/types/client/step-code/StepCodeSection.d.ts.map +1 -1
- package/lib/types/client/workbuddy/WorkBuddySection.d.ts.map +1 -1
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/host/preferences.d.ts.map +1 -1
- package/lib/types/host/proxy-manager.d.ts +37 -3
- package/lib/types/host/proxy-manager.d.ts.map +1 -1
- package/lib/types/host/routes.d.ts.map +1 -1
- package/lib/types/host/workbuddy/model-catalog.d.ts +20 -10
- package/lib/types/host/workbuddy/model-catalog.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/contracts.d.ts +53 -0
- package/lib/types/shared/contracts.d.ts.map +1 -1
- package/lib/types/shared/preferences.d.ts +51 -1
- package/lib/types/shared/preferences.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -817,7 +817,7 @@ const ROUTE_PREFIX$5 = "/api/dsh-chatgpt-subscription";
|
|
|
817
817
|
* `test/responses-client.test.ts` asserts the two agree, so a release that
|
|
818
818
|
* forgets this constant fails the suite instead of shipping quietly.
|
|
819
819
|
*/
|
|
820
|
-
const PLUGIN_VERSION = "0.
|
|
820
|
+
const PLUGIN_VERSION = "0.76.0";
|
|
821
821
|
const CODEX_CHATGPT_PROVIDER_ID = "codex-chatgpt";
|
|
822
822
|
const CODEX_API_BASE = "https://chatgpt.com/backend-api/codex";
|
|
823
823
|
const CODEX_RESPONSES_URL = `${CODEX_API_BASE}/responses`;
|
|
@@ -6692,6 +6692,337 @@ function isSource(value) {
|
|
|
6692
6692
|
return value !== null;
|
|
6693
6693
|
}
|
|
6694
6694
|
//#endregion
|
|
6695
|
+
//#region src/shared/contracts.ts
|
|
6696
|
+
/**
|
|
6697
|
+
* Every provider line a proxy choice can be stored for.
|
|
6698
|
+
*
|
|
6699
|
+
* The ids are the LLM route ids this plugin registers, not the shorthand some
|
|
6700
|
+
* host tables use: model request control spells the Claude line `claude` while
|
|
6701
|
+
* its route id is `claude-subscription`, and it never lists `opendesign` or
|
|
6702
|
+
* `workbuddy-subscription` under those names. Keeping one list here means the
|
|
6703
|
+
* card, the store and the fetch wiring cannot drift apart.
|
|
6704
|
+
*/
|
|
6705
|
+
const LINE_PROXY_PROVIDER_IDS = [
|
|
6706
|
+
"codex-chatgpt",
|
|
6707
|
+
"claude-subscription",
|
|
6708
|
+
"kimi-code",
|
|
6709
|
+
"minimax-code",
|
|
6710
|
+
"command-code",
|
|
6711
|
+
"ollama",
|
|
6712
|
+
"glm-coding-plan",
|
|
6713
|
+
"step-code",
|
|
6714
|
+
"cline-pass",
|
|
6715
|
+
"qoder",
|
|
6716
|
+
"opendesign",
|
|
6717
|
+
"workbuddy-subscription",
|
|
6718
|
+
"antigravity-acp"
|
|
6719
|
+
];
|
|
6720
|
+
//#endregion
|
|
6721
|
+
//#region src/shared/compaction-route.ts
|
|
6722
|
+
/** Runtime membership test for one stored target. */
|
|
6723
|
+
function isCompactionRouteTarget(value) {
|
|
6724
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
6725
|
+
const record = value;
|
|
6726
|
+
return isNonEmptyString(record.provider) && isNonEmptyString(record.model);
|
|
6727
|
+
}
|
|
6728
|
+
function isNonEmptyString(value) {
|
|
6729
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
6730
|
+
}
|
|
6731
|
+
/**
|
|
6732
|
+
* Decide whether the payload is admissible on the target.
|
|
6733
|
+
*
|
|
6734
|
+
* An undisclosed modality list is unknown, not negative: the harness documents
|
|
6735
|
+
* absence as "not disclosed", so refusing on it would disable the feature on
|
|
6736
|
+
* every route that simply does not advertise. The request still runs, and a
|
|
6737
|
+
* real rejection falls back the same way an error does.
|
|
6738
|
+
*
|
|
6739
|
+
* @param facts - what the directory says about the target.
|
|
6740
|
+
* @param needs - what the payload contains.
|
|
6741
|
+
* @returns the refusal reason, or `undefined` when the target may take it.
|
|
6742
|
+
*/
|
|
6743
|
+
function compactionSkipReason(facts, needs) {
|
|
6744
|
+
const modalities = facts.modalities;
|
|
6745
|
+
if (modalities === void 0) return void 0;
|
|
6746
|
+
const accepts = new Set(modalities);
|
|
6747
|
+
if (needs.video && !accepts.has("video")) return "target-accepts-no-video";
|
|
6748
|
+
}
|
|
6749
|
+
/**
|
|
6750
|
+
* Whether the target can carry images inline.
|
|
6751
|
+
*
|
|
6752
|
+
* Used for the recorded outcome only: an image the target cannot take is
|
|
6753
|
+
* replaced by a placeholder during projection, so the summary is still produced
|
|
6754
|
+
* but may describe a screenshot it never saw.
|
|
6755
|
+
*
|
|
6756
|
+
* @param facts - what the directory says about the target.
|
|
6757
|
+
* @returns false only when the target discloses image support and omits it.
|
|
6758
|
+
*/
|
|
6759
|
+
function compactionRoutesImages(facts) {
|
|
6760
|
+
const modalities = facts.modalities;
|
|
6761
|
+
if (modalities === void 0) return true;
|
|
6762
|
+
return modalities.includes("image");
|
|
6763
|
+
}
|
|
6764
|
+
//#endregion
|
|
6765
|
+
//#region src/shared/preferences.ts
|
|
6766
|
+
const PREFERENCES_NAMESPACE = "dsh-chatgpt-subscription";
|
|
6767
|
+
const DEFAULT_PREFERENCES = {
|
|
6768
|
+
enabled: true,
|
|
6769
|
+
quickQuotaVisible: false,
|
|
6770
|
+
fastMode: false,
|
|
6771
|
+
outputVerbosity: null,
|
|
6772
|
+
reasoningSummary: null,
|
|
6773
|
+
visibleModelIds: [...DEFAULT_VISIBLE_CODEX_MODEL_IDS],
|
|
6774
|
+
searchProvider: "dsh",
|
|
6775
|
+
contextWindowOverrides: {},
|
|
6776
|
+
proxyMode: "auto",
|
|
6777
|
+
customProxyUrl: null,
|
|
6778
|
+
noProxy: null,
|
|
6779
|
+
lineProxies: {},
|
|
6780
|
+
compactionRoute: null,
|
|
6781
|
+
subagentDefaultModels: [],
|
|
6782
|
+
subagentModelsByMainModel: {},
|
|
6783
|
+
subagentDefaultAllowParentFork: false,
|
|
6784
|
+
subagentAllowParentForkByMainModel: {}
|
|
6785
|
+
};
|
|
6786
|
+
const SEARCH_PROVIDER_CODEX = "codex";
|
|
6787
|
+
function isSearchProviderPreference(value) {
|
|
6788
|
+
return value === "dsh" || value === "codex";
|
|
6789
|
+
}
|
|
6790
|
+
function isCodexOutputVerbosity(value) {
|
|
6791
|
+
return value === "low" || value === "medium" || value === "high";
|
|
6792
|
+
}
|
|
6793
|
+
function isCodexReasoningSummary(value) {
|
|
6794
|
+
return value === "auto" || value === "concise" || value === "detailed" || value === "none";
|
|
6795
|
+
}
|
|
6796
|
+
function isProxyMode(value) {
|
|
6797
|
+
return value === "auto" || value === "custom" || value === "direct";
|
|
6798
|
+
}
|
|
6799
|
+
/** The shipped per-line proxy: system proxy, exactly like the old shared setting. */
|
|
6800
|
+
const DEFAULT_LINE_PROXY = {
|
|
6801
|
+
mode: "auto",
|
|
6802
|
+
customProxyUrl: null
|
|
6803
|
+
};
|
|
6804
|
+
/**
|
|
6805
|
+
* One custom proxy URL in the shape the transport accepts.
|
|
6806
|
+
*
|
|
6807
|
+
* Mirrors the shared preference store's own normalization: a bare `host:port`
|
|
6808
|
+
* gains `http://`, and a blank URL is `null` (which makes a `custom` line fall
|
|
6809
|
+
* back to a direct connection, the same reading the global setting had).
|
|
6810
|
+
* @param value - Raw URL from a card or a stored document.
|
|
6811
|
+
* @returns the normalized URL, or null when there is none.
|
|
6812
|
+
*/
|
|
6813
|
+
function normalizeLineProxyUrl(value) {
|
|
6814
|
+
if (typeof value !== "string") return null;
|
|
6815
|
+
const trimmed = value.trim();
|
|
6816
|
+
if (trimmed.length === 0) return null;
|
|
6817
|
+
if (/^https?:\/\//i.test(trimmed) || /^socks5?:\/\//i.test(trimmed)) return trimmed;
|
|
6818
|
+
return `http://${trimmed}`;
|
|
6819
|
+
}
|
|
6820
|
+
/**
|
|
6821
|
+
* Normalize one line's proxy entry.
|
|
6822
|
+
* @param value - Candidate entry from a card or a stored document.
|
|
6823
|
+
* @returns the normalized entry, or null when the value is not a usable one.
|
|
6824
|
+
*/
|
|
6825
|
+
function normalizeLineProxyConfig(value) {
|
|
6826
|
+
const record = asRecord$24(value);
|
|
6827
|
+
if (record === void 0) return null;
|
|
6828
|
+
const mode = record["mode"];
|
|
6829
|
+
if (!isProxyMode(mode)) return null;
|
|
6830
|
+
const customProxyUrl = normalizeLineProxyUrl(record["customProxyUrl"]);
|
|
6831
|
+
return {
|
|
6832
|
+
mode,
|
|
6833
|
+
customProxyUrl: mode === "custom" ? customProxyUrl : null
|
|
6834
|
+
};
|
|
6835
|
+
}
|
|
6836
|
+
/**
|
|
6837
|
+
* Merge a per-line proxy patch into the stored map.
|
|
6838
|
+
*
|
|
6839
|
+
* A merge, not a replace: saving one card must not rewrite the other twelve,
|
|
6840
|
+
* and `null` is how one line returns to the shipped `auto` default. Unknown
|
|
6841
|
+
* provider ids are refused rather than stored, because a typo would otherwise
|
|
6842
|
+
* look like a saved setting that never takes effect.
|
|
6843
|
+
* @param current - Map already stored in the preferences document.
|
|
6844
|
+
* @param patch - Incoming patch from a settings card or a route body.
|
|
6845
|
+
* @returns the merged map, or null when any key or value is malformed.
|
|
6846
|
+
*/
|
|
6847
|
+
function mergeLineProxies(current, patch) {
|
|
6848
|
+
const record = asRecord$24(patch);
|
|
6849
|
+
if (record === void 0) return null;
|
|
6850
|
+
const merged = { ...current };
|
|
6851
|
+
for (const [rawKey, rawValue] of Object.entries(record)) {
|
|
6852
|
+
const key = rawKey.trim();
|
|
6853
|
+
if (!isLineProxyProviderId(key)) return null;
|
|
6854
|
+
if (rawValue === null) {
|
|
6855
|
+
delete merged[key];
|
|
6856
|
+
continue;
|
|
6857
|
+
}
|
|
6858
|
+
const normalized = normalizeLineProxyConfig(rawValue);
|
|
6859
|
+
if (normalized === null) return null;
|
|
6860
|
+
merged[key] = normalized;
|
|
6861
|
+
}
|
|
6862
|
+
return merged;
|
|
6863
|
+
}
|
|
6864
|
+
/**
|
|
6865
|
+
* Whether one id names a provider line a proxy can be stored for.
|
|
6866
|
+
* @param value - Candidate provider id.
|
|
6867
|
+
* @returns whether the id is in {@link LINE_PROXY_PROVIDER_IDS}.
|
|
6868
|
+
*/
|
|
6869
|
+
function isLineProxyProviderId(value) {
|
|
6870
|
+
return typeof value === "string" && LINE_PROXY_PROVIDER_IDS.includes(value);
|
|
6871
|
+
}
|
|
6872
|
+
/**
|
|
6873
|
+
* Canonical form of one `NO_PROXY`-style bypass list.
|
|
6874
|
+
*
|
|
6875
|
+
* Entries may be separated by commas or whitespace, because a list pasted from
|
|
6876
|
+
* a README or a shell export is usually one or the other. Each entry is trimmed
|
|
6877
|
+
* and the list is deduplicated case-insensitively on first spelling and order:
|
|
6878
|
+
* the card shows the user's own arrangement back to them, while a host named
|
|
6879
|
+
* twice can never produce two matcher entries.
|
|
6880
|
+
* @param value - Raw list from the card, the environment, or a document.
|
|
6881
|
+
* @returns the canonical comma-separated list; an empty string when none.
|
|
6882
|
+
*/
|
|
6883
|
+
function normalizeNoProxyList(value) {
|
|
6884
|
+
const entries = [];
|
|
6885
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6886
|
+
for (const raw of value.split(/[,\s]+/)) {
|
|
6887
|
+
const entry = raw.trim();
|
|
6888
|
+
if (entry.length === 0) continue;
|
|
6889
|
+
const key = entry.toLowerCase();
|
|
6890
|
+
if (seen.has(key)) continue;
|
|
6891
|
+
seen.add(key);
|
|
6892
|
+
entries.push(entry);
|
|
6893
|
+
}
|
|
6894
|
+
return entries.join(", ");
|
|
6895
|
+
}
|
|
6896
|
+
function asRecord$24(value) {
|
|
6897
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
6898
|
+
}
|
|
6899
|
+
/**
|
|
6900
|
+
* Read one non-empty trimmed string field.
|
|
6901
|
+
* @param value - Candidate field value from stored JSON.
|
|
6902
|
+
* @returns the trimmed string, or undefined when it is not a non-empty string.
|
|
6903
|
+
*/
|
|
6904
|
+
function trimmedString(value) {
|
|
6905
|
+
if (typeof value !== "string") return void 0;
|
|
6906
|
+
const trimmed = value.trim();
|
|
6907
|
+
return trimmed.length === 0 ? void 0 : trimmed;
|
|
6908
|
+
}
|
|
6909
|
+
/**
|
|
6910
|
+
* Whether one value is a complete `{ provider, model }` route.
|
|
6911
|
+
*
|
|
6912
|
+
* Both halves are trimmed and must be non-empty: a route with a blank provider
|
|
6913
|
+
* names no adapter, and a blank model names no model, so neither can ever be
|
|
6914
|
+
* authorized. Stored documents are untrusted JSON, which is why this narrows
|
|
6915
|
+
* rather than asserts.
|
|
6916
|
+
* @param value - Candidate route.
|
|
6917
|
+
* @returns whether the value is a usable route.
|
|
6918
|
+
*/
|
|
6919
|
+
function isSubagentModelRoute(value) {
|
|
6920
|
+
const record = asRecord$24(value);
|
|
6921
|
+
if (record === void 0) return false;
|
|
6922
|
+
return trimmedString(record["provider"]) !== void 0 && trimmedString(record["model"]) !== void 0;
|
|
6923
|
+
}
|
|
6924
|
+
/**
|
|
6925
|
+
* Normalize one route list, deduplicating it without reordering.
|
|
6926
|
+
*
|
|
6927
|
+
* Order is preserved because it is the order the settings card shows and the
|
|
6928
|
+
* order `list_subagent_models` prints: a set would silently reshuffle the list
|
|
6929
|
+
* a user arranged.
|
|
6930
|
+
* @param value - Candidate route list from stored JSON.
|
|
6931
|
+
* @returns the trimmed, deduplicated routes, or null when the value is not an
|
|
6932
|
+
* array of well-formed routes.
|
|
6933
|
+
*/
|
|
6934
|
+
function normalizeSubagentModelRoutes(value) {
|
|
6935
|
+
if (!Array.isArray(value)) return null;
|
|
6936
|
+
const routes = [];
|
|
6937
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6938
|
+
for (const entry of value) {
|
|
6939
|
+
if (!isSubagentModelRoute(entry)) return null;
|
|
6940
|
+
const provider = entry.provider.trim();
|
|
6941
|
+
const model = entry.model.trim();
|
|
6942
|
+
const key = `${provider}/${model}`;
|
|
6943
|
+
if (seen.has(key)) continue;
|
|
6944
|
+
seen.add(key);
|
|
6945
|
+
routes.push({
|
|
6946
|
+
provider,
|
|
6947
|
+
model
|
|
6948
|
+
});
|
|
6949
|
+
}
|
|
6950
|
+
return routes;
|
|
6951
|
+
}
|
|
6952
|
+
/**
|
|
6953
|
+
* Whether one key names a main agent route as `provider/model`.
|
|
6954
|
+
*
|
|
6955
|
+
* The split is at the FIRST slash, so a model id that legally contains a slash
|
|
6956
|
+
* (`command-code` + `deepseek/deepseek-v4.1-flash`) still round-trips: the
|
|
6957
|
+
* provider half ends at the first separator and the model half keeps the rest.
|
|
6958
|
+
* @param key - Candidate map key.
|
|
6959
|
+
* @returns whether the key carries a non-empty provider and a non-empty model.
|
|
6960
|
+
*/
|
|
6961
|
+
function isValidMainModelKey(key) {
|
|
6962
|
+
if (typeof key !== "string") return false;
|
|
6963
|
+
const trimmed = key.trim();
|
|
6964
|
+
const separator = trimmed.indexOf("/");
|
|
6965
|
+
if (separator <= 0) return false;
|
|
6966
|
+
return trimmed.slice(separator + 1).length > 0;
|
|
6967
|
+
}
|
|
6968
|
+
/**
|
|
6969
|
+
* Merge one `subagentModelsByMainModel` patch into the stored map.
|
|
6970
|
+
*
|
|
6971
|
+
* A merge rather than a replace, so the card can clear or set one main model
|
|
6972
|
+
* without resending every other entry — and `null` (or `[]`) is how one entry
|
|
6973
|
+
* is cleared, since a stored map has no other way to say "no override".
|
|
6974
|
+
* @param current - Map already stored in the preferences document.
|
|
6975
|
+
* @param patch - Incoming patch from a settings card or a route body.
|
|
6976
|
+
* @returns the merged map, or null when any key or value is malformed.
|
|
6977
|
+
*/
|
|
6978
|
+
function mergeSubagentModelsByMainModel(current, patch) {
|
|
6979
|
+
const patchRecord = asRecord$24(patch);
|
|
6980
|
+
if (patchRecord === void 0) return null;
|
|
6981
|
+
const merged = { ...current };
|
|
6982
|
+
for (const [rawKey, rawRoutes] of Object.entries(patchRecord)) {
|
|
6983
|
+
const key = rawKey.trim();
|
|
6984
|
+
if (!isValidMainModelKey(key)) return null;
|
|
6985
|
+
if (rawRoutes === null || Array.isArray(rawRoutes) && rawRoutes.length === 0) {
|
|
6986
|
+
delete merged[key];
|
|
6987
|
+
continue;
|
|
6988
|
+
}
|
|
6989
|
+
const routes = normalizeSubagentModelRoutes(rawRoutes);
|
|
6990
|
+
if (routes === null) return null;
|
|
6991
|
+
merged[key] = routes;
|
|
6992
|
+
}
|
|
6993
|
+
return merged;
|
|
6994
|
+
}
|
|
6995
|
+
/**
|
|
6996
|
+
* Merge one `subagentAllowParentForkByMainModel` patch into the stored map.
|
|
6997
|
+
*
|
|
6998
|
+
* `null` clears one key so that main model falls back to
|
|
6999
|
+
* `subagentDefaultAllowParentFork`; a boolean sets an explicit per-main-model
|
|
7000
|
+
* override (`true` OR `false`, since overriding a `true` global default back to
|
|
7001
|
+
* `false` for one main model is legitimate).
|
|
7002
|
+
* @param current - Map already stored in the preferences document.
|
|
7003
|
+
* @param patch - Incoming patch from a settings card or a route body.
|
|
7004
|
+
* @returns the merged map, or null when any key or value is malformed.
|
|
7005
|
+
*/
|
|
7006
|
+
function mergeSubagentAllowParentForkByMainModel(current, patch) {
|
|
7007
|
+
const patchRecord = asRecord$24(patch);
|
|
7008
|
+
if (patchRecord === void 0) return null;
|
|
7009
|
+
const merged = {};
|
|
7010
|
+
if (current !== void 0) {
|
|
7011
|
+
for (const [k, v] of Object.entries(current)) if (typeof v === "boolean" && isValidMainModelKey(k)) merged[k.trim()] = v;
|
|
7012
|
+
}
|
|
7013
|
+
for (const [rawKey, rawValue] of Object.entries(patchRecord)) {
|
|
7014
|
+
const key = rawKey.trim();
|
|
7015
|
+
if (!isValidMainModelKey(key)) return null;
|
|
7016
|
+
if (rawValue === null) {
|
|
7017
|
+
delete merged[key];
|
|
7018
|
+
continue;
|
|
7019
|
+
}
|
|
7020
|
+
if (typeof rawValue !== "boolean") return null;
|
|
7021
|
+
merged[key] = rawValue;
|
|
7022
|
+
}
|
|
7023
|
+
return merged;
|
|
7024
|
+
}
|
|
7025
|
+
//#endregion
|
|
6695
7026
|
//#region src/host/proxy-manager.ts
|
|
6696
7027
|
const SYSTEM_PROXY_CACHE_TTL_MS = 5e3;
|
|
6697
7028
|
/**
|
|
@@ -6727,8 +7058,8 @@ function proxyAgentOptions(uri, allowH2, headersTimeoutMs) {
|
|
|
6727
7058
|
};
|
|
6728
7059
|
}
|
|
6729
7060
|
/** One pool per (proxy, protocol policy, credential): neither policy nor identity may be shared. */
|
|
6730
|
-
function agentCacheKey(proxyUrl, allowH2, poolKey, headersTimeoutMs) {
|
|
6731
|
-
return `${poolKey ?? "shared"}:${allowH2 === false ? "h1" : "auto"}:${headersTimeoutMs ?? "default"}:${proxyUrl}`;
|
|
7061
|
+
function agentCacheKey(proxyUrl, allowH2, poolKey, headersTimeoutMs, line) {
|
|
7062
|
+
return `${line ?? "shared"}:${poolKey ?? "shared"}:${allowH2 === false ? "h1" : "auto"}:${headersTimeoutMs ?? "default"}:${proxyUrl}`;
|
|
6732
7063
|
}
|
|
6733
7064
|
/** The key of the dispatcher that serves one credential's unproxied traffic. */
|
|
6734
7065
|
function directAgentKey(poolKey, allowH2, omitAlpn, headersTimeoutMs) {
|
|
@@ -7169,21 +7500,34 @@ var ProxyManager = class {
|
|
|
7169
7500
|
/**
|
|
7170
7501
|
* The active `NO_PROXY` list, re-read at most once per TTL.
|
|
7171
7502
|
*
|
|
7503
|
+
* Two sources, one answer: the deployment list from {@link ProxyFetchOptions.noProxyReader}
|
|
7504
|
+
* and the list the settings card stores in `getPreferences().noProxy`. Neither
|
|
7505
|
+
* replaces the other, because the card is the discoverable place and the
|
|
7506
|
+
* environment file is the deployment-level place.
|
|
7507
|
+
*
|
|
7172
7508
|
* A reader that throws (an unreadable `$DSH_HOME/.env`) reads as "no bypass
|
|
7173
7509
|
* list", never as "bypass everything": the wrong guess in that direction would
|
|
7174
|
-
* take an active proxy away from every line at once.
|
|
7510
|
+
* take an active proxy away from every line at once. The same applies to one
|
|
7511
|
+
* source failing: the other source still answers.
|
|
7175
7512
|
*/
|
|
7176
7513
|
getNoProxyList(force = false) {
|
|
7177
7514
|
const now = Date.now();
|
|
7178
7515
|
if (!force && now - this.lastNoProxyCheck < SYSTEM_PROXY_CACHE_TTL_MS) return this.cachedNoProxy;
|
|
7179
7516
|
this.lastNoProxyCheck = now;
|
|
7180
|
-
|
|
7181
|
-
this.cachedNoProxy = this.noProxyReader().trim();
|
|
7182
|
-
} catch {
|
|
7183
|
-
this.cachedNoProxy = "";
|
|
7184
|
-
}
|
|
7517
|
+
this.cachedNoProxy = this.readNoProxyList();
|
|
7185
7518
|
return this.cachedNoProxy;
|
|
7186
7519
|
}
|
|
7520
|
+
/** Both bypass sources, canonicalized and concatenated; each failure reads as empty. */
|
|
7521
|
+
readNoProxyList() {
|
|
7522
|
+
const parts = [];
|
|
7523
|
+
try {
|
|
7524
|
+
parts.push(this.noProxyReader());
|
|
7525
|
+
} catch {}
|
|
7526
|
+
try {
|
|
7527
|
+
parts.push(this.getPreferences().noProxy ?? "");
|
|
7528
|
+
} catch {}
|
|
7529
|
+
return normalizeNoProxyList(parts.join(","));
|
|
7530
|
+
}
|
|
7187
7531
|
/**
|
|
7188
7532
|
* Observe the system proxy becoming known.
|
|
7189
7533
|
*
|
|
@@ -7200,15 +7544,30 @@ var ProxyManager = class {
|
|
|
7200
7544
|
this.proxyListeners.delete(listener);
|
|
7201
7545
|
};
|
|
7202
7546
|
}
|
|
7203
|
-
|
|
7547
|
+
/**
|
|
7548
|
+
* The proxy one provider line actually uses.
|
|
7549
|
+
*
|
|
7550
|
+
* With a `line`, that line's own entry decides: an absent entry is the
|
|
7551
|
+
* shipped `auto` default, so a fresh install keeps following the machine and
|
|
7552
|
+
* a line a user never opened is not silently forced direct. Without a
|
|
7553
|
+
* `line`, the retired shared pair answers — kept only so an older caller (or
|
|
7554
|
+
* a deployment pinning the old field) still resolves to what it always did.
|
|
7555
|
+
*
|
|
7556
|
+
* @param line - Provider id whose entry should decide, or undefined for the
|
|
7557
|
+
* legacy shared setting.
|
|
7558
|
+
* @returns the proxy URL in force, or null for a direct connection.
|
|
7559
|
+
*/
|
|
7560
|
+
resolveActiveProxyUrl(line) {
|
|
7204
7561
|
const prefs = this.getPreferences();
|
|
7205
|
-
const
|
|
7562
|
+
const entry = line === void 0 ? void 0 : (prefs.lineProxies ?? {})[line];
|
|
7563
|
+
const mode = entry?.mode ?? (line === void 0 ? prefs.proxyMode ?? "auto" : DEFAULT_LINE_PROXY.mode);
|
|
7564
|
+
const customUrl = line === void 0 ? prefs.customProxyUrl : entry?.customProxyUrl ?? null;
|
|
7206
7565
|
if (mode === "direct") return null;
|
|
7207
|
-
if (mode === "custom") return
|
|
7566
|
+
if (mode === "custom") return customUrl ? normalizeProxyUrl(customUrl) : null;
|
|
7208
7567
|
return this.getSystemProxy();
|
|
7209
7568
|
}
|
|
7210
|
-
getOrCreateAgent(proxyUrl, allowH2, poolKey, headersTimeoutMs) {
|
|
7211
|
-
const key = agentCacheKey(proxyUrl, allowH2, poolKey, headersTimeoutMs);
|
|
7569
|
+
getOrCreateAgent(proxyUrl, allowH2, poolKey, headersTimeoutMs, line) {
|
|
7570
|
+
const key = agentCacheKey(proxyUrl, allowH2, poolKey, headersTimeoutMs, line);
|
|
7212
7571
|
const existing = this.agents.get(key);
|
|
7213
7572
|
if (existing instanceof ProxyAgent) return existing;
|
|
7214
7573
|
const agent = new ProxyAgent(proxyAgentOptions(proxyUrl, allowH2, headersTimeoutMs));
|
|
@@ -7280,15 +7639,15 @@ var ProxyManager = class {
|
|
|
7280
7639
|
};
|
|
7281
7640
|
return async (input, init) => {
|
|
7282
7641
|
const poolKey = overrides?.credentialPools === true ? credentialPoolKey(init) : void 0;
|
|
7283
|
-
const activeProxy = this.resolveActiveProxyUrl();
|
|
7642
|
+
const activeProxy = this.resolveActiveProxyUrl(overrides?.line);
|
|
7284
7643
|
if (!activeProxy) return poolKey === void 0 && overrides?.headersTimeoutMs === void 0 ? this.baseFetch(input, init) : this.dispatchWith(input, init, shape(this.getOrCreateDirectAgent(poolKey ?? "shared", overrides)));
|
|
7285
7644
|
if (shouldBypassProxy(requestTarget(input), this.getNoProxyList())) return poolKey === void 0 && overrides?.headersTimeoutMs === void 0 ? this.baseFetch(input, init) : this.dispatchWith(input, init, shape(this.getOrCreateDirectAgent(poolKey ?? "shared", overrides)));
|
|
7286
7645
|
for (let attempt = 0;; attempt += 1) try {
|
|
7287
|
-
const agent = shape(this.getOrCreateAgent(activeProxy, overrides?.allowH2, poolKey, overrides?.headersTimeoutMs));
|
|
7646
|
+
const agent = shape(this.getOrCreateAgent(activeProxy, overrides?.allowH2, poolKey, overrides?.headersTimeoutMs, overrides?.line));
|
|
7288
7647
|
return await this.dispatchWith(input, init, agent);
|
|
7289
7648
|
} catch (error) {
|
|
7290
7649
|
if (attempt === 0 && isDestroyedClientError(error)) {
|
|
7291
|
-
this.agents.delete(agentCacheKey(activeProxy, overrides?.allowH2, poolKey, overrides?.headersTimeoutMs));
|
|
7650
|
+
this.agents.delete(agentCacheKey(activeProxy, overrides?.allowH2, poolKey, overrides?.headersTimeoutMs, overrides?.line));
|
|
7292
7651
|
continue;
|
|
7293
7652
|
}
|
|
7294
7653
|
throw error;
|
|
@@ -8693,212 +9052,6 @@ var FilePreferencesStore = class {
|
|
|
8693
9052
|
}
|
|
8694
9053
|
};
|
|
8695
9054
|
//#endregion
|
|
8696
|
-
//#region src/shared/compaction-route.ts
|
|
8697
|
-
/** Runtime membership test for one stored target. */
|
|
8698
|
-
function isCompactionRouteTarget(value) {
|
|
8699
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
8700
|
-
const record = value;
|
|
8701
|
-
return isNonEmptyString(record.provider) && isNonEmptyString(record.model);
|
|
8702
|
-
}
|
|
8703
|
-
function isNonEmptyString(value) {
|
|
8704
|
-
return typeof value === "string" && value.trim().length > 0;
|
|
8705
|
-
}
|
|
8706
|
-
/**
|
|
8707
|
-
* Decide whether the payload is admissible on the target.
|
|
8708
|
-
*
|
|
8709
|
-
* An undisclosed modality list is unknown, not negative: the harness documents
|
|
8710
|
-
* absence as "not disclosed", so refusing on it would disable the feature on
|
|
8711
|
-
* every route that simply does not advertise. The request still runs, and a
|
|
8712
|
-
* real rejection falls back the same way an error does.
|
|
8713
|
-
*
|
|
8714
|
-
* @param facts - what the directory says about the target.
|
|
8715
|
-
* @param needs - what the payload contains.
|
|
8716
|
-
* @returns the refusal reason, or `undefined` when the target may take it.
|
|
8717
|
-
*/
|
|
8718
|
-
function compactionSkipReason(facts, needs) {
|
|
8719
|
-
const modalities = facts.modalities;
|
|
8720
|
-
if (modalities === void 0) return void 0;
|
|
8721
|
-
const accepts = new Set(modalities);
|
|
8722
|
-
if (needs.video && !accepts.has("video")) return "target-accepts-no-video";
|
|
8723
|
-
}
|
|
8724
|
-
/**
|
|
8725
|
-
* Whether the target can carry images inline.
|
|
8726
|
-
*
|
|
8727
|
-
* Used for the recorded outcome only: an image the target cannot take is
|
|
8728
|
-
* replaced by a placeholder during projection, so the summary is still produced
|
|
8729
|
-
* but may describe a screenshot it never saw.
|
|
8730
|
-
*
|
|
8731
|
-
* @param facts - what the directory says about the target.
|
|
8732
|
-
* @returns false only when the target discloses image support and omits it.
|
|
8733
|
-
*/
|
|
8734
|
-
function compactionRoutesImages(facts) {
|
|
8735
|
-
const modalities = facts.modalities;
|
|
8736
|
-
if (modalities === void 0) return true;
|
|
8737
|
-
return modalities.includes("image");
|
|
8738
|
-
}
|
|
8739
|
-
//#endregion
|
|
8740
|
-
//#region src/shared/preferences.ts
|
|
8741
|
-
const PREFERENCES_NAMESPACE = "dsh-chatgpt-subscription";
|
|
8742
|
-
const DEFAULT_PREFERENCES = {
|
|
8743
|
-
enabled: true,
|
|
8744
|
-
quickQuotaVisible: false,
|
|
8745
|
-
fastMode: false,
|
|
8746
|
-
outputVerbosity: null,
|
|
8747
|
-
reasoningSummary: null,
|
|
8748
|
-
visibleModelIds: [...DEFAULT_VISIBLE_CODEX_MODEL_IDS],
|
|
8749
|
-
searchProvider: "dsh",
|
|
8750
|
-
contextWindowOverrides: {},
|
|
8751
|
-
proxyMode: "auto",
|
|
8752
|
-
customProxyUrl: null,
|
|
8753
|
-
compactionRoute: null,
|
|
8754
|
-
subagentDefaultModels: [],
|
|
8755
|
-
subagentModelsByMainModel: {},
|
|
8756
|
-
subagentDefaultAllowParentFork: false,
|
|
8757
|
-
subagentAllowParentForkByMainModel: {}
|
|
8758
|
-
};
|
|
8759
|
-
const SEARCH_PROVIDER_CODEX = "codex";
|
|
8760
|
-
function isSearchProviderPreference(value) {
|
|
8761
|
-
return value === "dsh" || value === "codex";
|
|
8762
|
-
}
|
|
8763
|
-
function isCodexOutputVerbosity(value) {
|
|
8764
|
-
return value === "low" || value === "medium" || value === "high";
|
|
8765
|
-
}
|
|
8766
|
-
function isCodexReasoningSummary(value) {
|
|
8767
|
-
return value === "auto" || value === "concise" || value === "detailed" || value === "none";
|
|
8768
|
-
}
|
|
8769
|
-
function isProxyMode(value) {
|
|
8770
|
-
return value === "auto" || value === "custom" || value === "direct";
|
|
8771
|
-
}
|
|
8772
|
-
function asRecord$24(value) {
|
|
8773
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
8774
|
-
}
|
|
8775
|
-
/**
|
|
8776
|
-
* Read one non-empty trimmed string field.
|
|
8777
|
-
* @param value - Candidate field value from stored JSON.
|
|
8778
|
-
* @returns the trimmed string, or undefined when it is not a non-empty string.
|
|
8779
|
-
*/
|
|
8780
|
-
function trimmedString(value) {
|
|
8781
|
-
if (typeof value !== "string") return void 0;
|
|
8782
|
-
const trimmed = value.trim();
|
|
8783
|
-
return trimmed.length === 0 ? void 0 : trimmed;
|
|
8784
|
-
}
|
|
8785
|
-
/**
|
|
8786
|
-
* Whether one value is a complete `{ provider, model }` route.
|
|
8787
|
-
*
|
|
8788
|
-
* Both halves are trimmed and must be non-empty: a route with a blank provider
|
|
8789
|
-
* names no adapter, and a blank model names no model, so neither can ever be
|
|
8790
|
-
* authorized. Stored documents are untrusted JSON, which is why this narrows
|
|
8791
|
-
* rather than asserts.
|
|
8792
|
-
* @param value - Candidate route.
|
|
8793
|
-
* @returns whether the value is a usable route.
|
|
8794
|
-
*/
|
|
8795
|
-
function isSubagentModelRoute(value) {
|
|
8796
|
-
const record = asRecord$24(value);
|
|
8797
|
-
if (record === void 0) return false;
|
|
8798
|
-
return trimmedString(record["provider"]) !== void 0 && trimmedString(record["model"]) !== void 0;
|
|
8799
|
-
}
|
|
8800
|
-
/**
|
|
8801
|
-
* Normalize one route list, deduplicating it without reordering.
|
|
8802
|
-
*
|
|
8803
|
-
* Order is preserved because it is the order the settings card shows and the
|
|
8804
|
-
* order `list_subagent_models` prints: a set would silently reshuffle the list
|
|
8805
|
-
* a user arranged.
|
|
8806
|
-
* @param value - Candidate route list from stored JSON.
|
|
8807
|
-
* @returns the trimmed, deduplicated routes, or null when the value is not an
|
|
8808
|
-
* array of well-formed routes.
|
|
8809
|
-
*/
|
|
8810
|
-
function normalizeSubagentModelRoutes(value) {
|
|
8811
|
-
if (!Array.isArray(value)) return null;
|
|
8812
|
-
const routes = [];
|
|
8813
|
-
const seen = /* @__PURE__ */ new Set();
|
|
8814
|
-
for (const entry of value) {
|
|
8815
|
-
if (!isSubagentModelRoute(entry)) return null;
|
|
8816
|
-
const provider = entry.provider.trim();
|
|
8817
|
-
const model = entry.model.trim();
|
|
8818
|
-
const key = `${provider}/${model}`;
|
|
8819
|
-
if (seen.has(key)) continue;
|
|
8820
|
-
seen.add(key);
|
|
8821
|
-
routes.push({
|
|
8822
|
-
provider,
|
|
8823
|
-
model
|
|
8824
|
-
});
|
|
8825
|
-
}
|
|
8826
|
-
return routes;
|
|
8827
|
-
}
|
|
8828
|
-
/**
|
|
8829
|
-
* Whether one key names a main agent route as `provider/model`.
|
|
8830
|
-
*
|
|
8831
|
-
* The split is at the FIRST slash, so a model id that legally contains a slash
|
|
8832
|
-
* (`command-code` + `deepseek/deepseek-v4.1-flash`) still round-trips: the
|
|
8833
|
-
* provider half ends at the first separator and the model half keeps the rest.
|
|
8834
|
-
* @param key - Candidate map key.
|
|
8835
|
-
* @returns whether the key carries a non-empty provider and a non-empty model.
|
|
8836
|
-
*/
|
|
8837
|
-
function isValidMainModelKey(key) {
|
|
8838
|
-
if (typeof key !== "string") return false;
|
|
8839
|
-
const trimmed = key.trim();
|
|
8840
|
-
const separator = trimmed.indexOf("/");
|
|
8841
|
-
if (separator <= 0) return false;
|
|
8842
|
-
return trimmed.slice(separator + 1).length > 0;
|
|
8843
|
-
}
|
|
8844
|
-
/**
|
|
8845
|
-
* Merge one `subagentModelsByMainModel` patch into the stored map.
|
|
8846
|
-
*
|
|
8847
|
-
* A merge rather than a replace, so the card can clear or set one main model
|
|
8848
|
-
* without resending every other entry — and `null` (or `[]`) is how one entry
|
|
8849
|
-
* is cleared, since a stored map has no other way to say "no override".
|
|
8850
|
-
* @param current - Map already stored in the preferences document.
|
|
8851
|
-
* @param patch - Incoming patch from a settings card or a route body.
|
|
8852
|
-
* @returns the merged map, or null when any key or value is malformed.
|
|
8853
|
-
*/
|
|
8854
|
-
function mergeSubagentModelsByMainModel(current, patch) {
|
|
8855
|
-
const patchRecord = asRecord$24(patch);
|
|
8856
|
-
if (patchRecord === void 0) return null;
|
|
8857
|
-
const merged = { ...current };
|
|
8858
|
-
for (const [rawKey, rawRoutes] of Object.entries(patchRecord)) {
|
|
8859
|
-
const key = rawKey.trim();
|
|
8860
|
-
if (!isValidMainModelKey(key)) return null;
|
|
8861
|
-
if (rawRoutes === null || Array.isArray(rawRoutes) && rawRoutes.length === 0) {
|
|
8862
|
-
delete merged[key];
|
|
8863
|
-
continue;
|
|
8864
|
-
}
|
|
8865
|
-
const routes = normalizeSubagentModelRoutes(rawRoutes);
|
|
8866
|
-
if (routes === null) return null;
|
|
8867
|
-
merged[key] = routes;
|
|
8868
|
-
}
|
|
8869
|
-
return merged;
|
|
8870
|
-
}
|
|
8871
|
-
/**
|
|
8872
|
-
* Merge one `subagentAllowParentForkByMainModel` patch into the stored map.
|
|
8873
|
-
*
|
|
8874
|
-
* `null` clears one key so that main model falls back to
|
|
8875
|
-
* `subagentDefaultAllowParentFork`; a boolean sets an explicit per-main-model
|
|
8876
|
-
* override (`true` OR `false`, since overriding a `true` global default back to
|
|
8877
|
-
* `false` for one main model is legitimate).
|
|
8878
|
-
* @param current - Map already stored in the preferences document.
|
|
8879
|
-
* @param patch - Incoming patch from a settings card or a route body.
|
|
8880
|
-
* @returns the merged map, or null when any key or value is malformed.
|
|
8881
|
-
*/
|
|
8882
|
-
function mergeSubagentAllowParentForkByMainModel(current, patch) {
|
|
8883
|
-
const patchRecord = asRecord$24(patch);
|
|
8884
|
-
if (patchRecord === void 0) return null;
|
|
8885
|
-
const merged = {};
|
|
8886
|
-
if (current !== void 0) {
|
|
8887
|
-
for (const [k, v] of Object.entries(current)) if (typeof v === "boolean" && isValidMainModelKey(k)) merged[k.trim()] = v;
|
|
8888
|
-
}
|
|
8889
|
-
for (const [rawKey, rawValue] of Object.entries(patchRecord)) {
|
|
8890
|
-
const key = rawKey.trim();
|
|
8891
|
-
if (!isValidMainModelKey(key)) return null;
|
|
8892
|
-
if (rawValue === null) {
|
|
8893
|
-
delete merged[key];
|
|
8894
|
-
continue;
|
|
8895
|
-
}
|
|
8896
|
-
if (typeof rawValue !== "boolean") return null;
|
|
8897
|
-
merged[key] = rawValue;
|
|
8898
|
-
}
|
|
8899
|
-
return merged;
|
|
8900
|
-
}
|
|
8901
|
-
//#endregion
|
|
8902
9055
|
//#region src/host/common/legacy-preferences.ts
|
|
8903
9056
|
/**
|
|
8904
9057
|
* One-time import of the preferences earlier releases kept in the harness's own
|
|
@@ -9143,6 +9296,15 @@ function registerPreferenceStore(settings) {
|
|
|
9143
9296
|
z$1.const("direct")
|
|
9144
9297
|
]).default(DEFAULT_PREFERENCES.proxyMode),
|
|
9145
9298
|
customProxyUrl: z$1.union([z$1.string(), z$1.const(null)]).default(DEFAULT_PREFERENCES.customProxyUrl),
|
|
9299
|
+
noProxy: z$1.union([z$1.string(), z$1.const(null)]).default(DEFAULT_PREFERENCES.noProxy ?? null),
|
|
9300
|
+
lineProxies: z$1.dict(z$1.object({
|
|
9301
|
+
mode: z$1.union([
|
|
9302
|
+
z$1.const("auto"),
|
|
9303
|
+
z$1.const("custom"),
|
|
9304
|
+
z$1.const("direct")
|
|
9305
|
+
]),
|
|
9306
|
+
customProxyUrl: z$1.union([z$1.string(), z$1.const(null)])
|
|
9307
|
+
})).default(DEFAULT_PREFERENCES.lineProxies ?? {}),
|
|
9146
9308
|
compactionRoute: z$1.union([z$1.object({
|
|
9147
9309
|
provider: z$1.string(),
|
|
9148
9310
|
model: z$1.string()
|
|
@@ -9161,6 +9323,17 @@ function registerPreferenceStore(settings) {
|
|
|
9161
9323
|
var SettingsPreferenceStore = class {
|
|
9162
9324
|
scope;
|
|
9163
9325
|
load;
|
|
9326
|
+
/** One-shot load plus the one-time per-line proxy migration it triggers. */
|
|
9327
|
+
hydrated;
|
|
9328
|
+
/**
|
|
9329
|
+
* True while the one-time migration writes.
|
|
9330
|
+
*
|
|
9331
|
+
* That write is bookkeeping, not a user change: waking the preference
|
|
9332
|
+
* watchers with it would restart the web provider selection during the
|
|
9333
|
+
* profile composition window, which is exactly the startup race those
|
|
9334
|
+
* watchers' deferral exists to avoid.
|
|
9335
|
+
*/
|
|
9336
|
+
migrating = false;
|
|
9164
9337
|
/**
|
|
9165
9338
|
* @param scope - Namespace scope, or the plugin-owned file store standing in for one.
|
|
9166
9339
|
* @param load - One-shot load of that file store; absent for a settings scope.
|
|
@@ -9170,7 +9343,39 @@ var SettingsPreferenceStore = class {
|
|
|
9170
9343
|
this.load = load;
|
|
9171
9344
|
}
|
|
9172
9345
|
hydrate() {
|
|
9173
|
-
|
|
9346
|
+
this.hydrated ??= this.load().then(() => this.migrateLineProxies());
|
|
9347
|
+
return this.hydrated;
|
|
9348
|
+
}
|
|
9349
|
+
/**
|
|
9350
|
+
* Copy the retired shared proxy setting onto every provider line, once.
|
|
9351
|
+
*
|
|
9352
|
+
* Before per-line proxies there was one `proxyMode`/`customProxyUrl` pair that
|
|
9353
|
+
* every line shared. Leaving those values where they are would be a silent
|
|
9354
|
+
* behaviour change at upgrade: the fields stay for export compatibility, but
|
|
9355
|
+
* nothing reads them any more, so every line would quietly fall back to
|
|
9356
|
+
* `auto`. The migration makes each line state the value it was already using.
|
|
9357
|
+
*
|
|
9358
|
+
* Idempotent by construction: a document that carries ANY per-line entry has
|
|
9359
|
+
* already been migrated (or has been edited since), and is never touched —
|
|
9360
|
+
* re-running this on a user's own choices would silently undo them.
|
|
9361
|
+
*/
|
|
9362
|
+
async migrateLineProxies() {
|
|
9363
|
+
const current = this.scope.get();
|
|
9364
|
+
if (Object.keys(current.lineProxies ?? {}).length > 0) return;
|
|
9365
|
+
const legacy = {
|
|
9366
|
+
mode: current.proxyMode ?? DEFAULT_LINE_PROXY.mode,
|
|
9367
|
+
customProxyUrl: normalizeLineProxyUrl(current.customProxyUrl)
|
|
9368
|
+
};
|
|
9369
|
+
const lineProxies = Object.fromEntries(LINE_PROXY_PROVIDER_IDS.map((line) => [line, {
|
|
9370
|
+
mode: legacy.mode,
|
|
9371
|
+
customProxyUrl: legacy.mode === "custom" ? legacy.customProxyUrl : null
|
|
9372
|
+
}]));
|
|
9373
|
+
this.migrating = true;
|
|
9374
|
+
try {
|
|
9375
|
+
await this.scope.update({ lineProxies });
|
|
9376
|
+
} catch {} finally {
|
|
9377
|
+
this.migrating = false;
|
|
9378
|
+
}
|
|
9174
9379
|
}
|
|
9175
9380
|
status() {
|
|
9176
9381
|
return withWritable(this.scope.get());
|
|
@@ -9227,6 +9432,16 @@ var SettingsPreferenceStore = class {
|
|
|
9227
9432
|
if (merged === null) throw new PreferenceError("Unsupported subagentAllowParentForkByMainModel preference.");
|
|
9228
9433
|
normalized.subagentAllowParentForkByMainModel = merged;
|
|
9229
9434
|
}
|
|
9435
|
+
if (patch.lineProxies !== void 0) {
|
|
9436
|
+
const merged = mergeLineProxies(this.scope.get().lineProxies, patch.lineProxies);
|
|
9437
|
+
if (merged === null) throw new PreferenceError("Unsupported lineProxies preference.");
|
|
9438
|
+
normalized.lineProxies = merged;
|
|
9439
|
+
}
|
|
9440
|
+
if (patch.noProxy !== void 0) {
|
|
9441
|
+
if (patch.noProxy !== null && typeof patch.noProxy !== "string") throw new PreferenceError("Unsupported noProxy preference.");
|
|
9442
|
+
const normalizedList = patch.noProxy === null ? "" : normalizeNoProxyList(patch.noProxy);
|
|
9443
|
+
normalized.noProxy = normalizedList.length === 0 ? null : normalizedList;
|
|
9444
|
+
}
|
|
9230
9445
|
if (patch.customProxyUrl !== void 0) if (patch.customProxyUrl !== null) {
|
|
9231
9446
|
const trimmed = patch.customProxyUrl.trim();
|
|
9232
9447
|
if (trimmed.length > 0 && !/^https?:\/\//i.test(trimmed) && !/^socks5?:\/\//i.test(trimmed)) normalized.customProxyUrl = `http://${trimmed}`;
|
|
@@ -9236,7 +9451,10 @@ var SettingsPreferenceStore = class {
|
|
|
9236
9451
|
return this.status();
|
|
9237
9452
|
}
|
|
9238
9453
|
watch(callback) {
|
|
9239
|
-
return this.scope.watch((next, prev) =>
|
|
9454
|
+
return this.scope.watch((next, prev) => {
|
|
9455
|
+
if (this.migrating) return void 0;
|
|
9456
|
+
return callback(withWritable(next), withWritable(prev));
|
|
9457
|
+
});
|
|
9240
9458
|
}
|
|
9241
9459
|
};
|
|
9242
9460
|
var PreferenceError = class extends Error {
|
|
@@ -12372,12 +12590,26 @@ function registerRoutes(ctx, oauth, usage, preferences, proxyManager, searchSwit
|
|
|
12372
12590
|
codexCliSignInPath,
|
|
12373
12591
|
detectedProxy: proxyManager?.getSystemProxy() ?? null,
|
|
12374
12592
|
activeProxy: proxyManager?.resolveActiveProxyUrl() ?? null,
|
|
12593
|
+
activeProxies: proxyManager === void 0 ? void 0 : Object.fromEntries(LINE_PROXY_PROVIDER_IDS.map((line) => [line, maskProxyUrl(proxyManager.resolveActiveProxyUrl(line))])),
|
|
12375
12594
|
switcher: searchSwitcher?.status() ?? null,
|
|
12376
12595
|
fetchConfiguration
|
|
12377
12596
|
}
|
|
12378
12597
|
});
|
|
12379
12598
|
return;
|
|
12380
12599
|
}
|
|
12600
|
+
if (request.method === "GET" && url.pathname === `/api/dsh-chatgpt-subscription/proxy`) {
|
|
12601
|
+
const prefs = preferences.status();
|
|
12602
|
+
json(response, {
|
|
12603
|
+
ok: true,
|
|
12604
|
+
value: {
|
|
12605
|
+
lineProxies: prefs.lineProxies ?? {},
|
|
12606
|
+
noProxy: prefs.noProxy ?? null,
|
|
12607
|
+
detectedProxy: proxyManager?.getSystemProxy() ?? null,
|
|
12608
|
+
activeProxies: proxyManager === void 0 ? {} : Object.fromEntries(LINE_PROXY_PROVIDER_IDS.map((line) => [line, maskProxyUrl(proxyManager.resolveActiveProxyUrl(line))]))
|
|
12609
|
+
}
|
|
12610
|
+
});
|
|
12611
|
+
return;
|
|
12612
|
+
}
|
|
12381
12613
|
if (request.method === "GET" && url.pathname === `/api/dsh-chatgpt-subscription/subagent-route-audit`) {
|
|
12382
12614
|
const sessionId = url.searchParams.get("sessionId");
|
|
12383
12615
|
if (sessionId === null || sessionId.length === 0) {
|
|
@@ -12746,6 +12978,28 @@ async function compactionCandidates(ctx) {
|
|
|
12746
12978
|
};
|
|
12747
12979
|
}))).filter((provider) => provider.models.length > 0) };
|
|
12748
12980
|
}
|
|
12981
|
+
/**
|
|
12982
|
+
* A proxy URL with any credential half removed.
|
|
12983
|
+
*
|
|
12984
|
+
* The status route reports which proxy a line uses, and a custom proxy may carry
|
|
12985
|
+
* `user:pass@`. The card only needs to say WHICH proxy answered, so the user
|
|
12986
|
+
* half never travels: a settings page is not a place to re-display a secret
|
|
12987
|
+
* that was typed once.
|
|
12988
|
+
* @param value - Resolved proxy URL, or null for a direct connection.
|
|
12989
|
+
* @returns the URL without credentials, or null.
|
|
12990
|
+
*/
|
|
12991
|
+
function maskProxyUrl(value) {
|
|
12992
|
+
if (value === null) return null;
|
|
12993
|
+
try {
|
|
12994
|
+
const url = new URL(value);
|
|
12995
|
+
if (url.username === "" && url.password === "") return value;
|
|
12996
|
+
url.username = "";
|
|
12997
|
+
url.password = "";
|
|
12998
|
+
return url.toString();
|
|
12999
|
+
} catch {
|
|
13000
|
+
return null;
|
|
13001
|
+
}
|
|
13002
|
+
}
|
|
12749
13003
|
function isRecord$64(value) {
|
|
12750
13004
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12751
13005
|
}
|
|
@@ -12821,6 +13075,15 @@ function readPreferencesUpdate(value, current) {
|
|
|
12821
13075
|
if (value.proxyMode !== "auto" && value.proxyMode !== "custom" && value.proxyMode !== "direct") throw new PreferenceError("proxyMode must be auto, custom, or direct.");
|
|
12822
13076
|
patch.proxyMode = value.proxyMode;
|
|
12823
13077
|
}
|
|
13078
|
+
if ("lineProxies" in value) {
|
|
13079
|
+
if (mergeLineProxies(current.lineProxies, value.lineProxies) === null) throw new PreferenceError("lineProxies must map known provider ids to { mode, customProxyUrl }, or null to clear one.");
|
|
13080
|
+
patch.lineProxies = value.lineProxies;
|
|
13081
|
+
}
|
|
13082
|
+
if ("noProxy" in value) {
|
|
13083
|
+
if (value.noProxy !== null && typeof value.noProxy !== "string") throw new PreferenceError("noProxy must be a string or null.");
|
|
13084
|
+
patch.noProxy = value.noProxy === null ? null : normalizeNoProxyList(value.noProxy);
|
|
13085
|
+
if (patch.noProxy === "") patch.noProxy = null;
|
|
13086
|
+
}
|
|
12824
13087
|
if ("customProxyUrl" in value) {
|
|
12825
13088
|
if (value.customProxyUrl !== null && typeof value.customProxyUrl !== "string") throw new PreferenceError("customProxyUrl must be a string or null.");
|
|
12826
13089
|
patch.customProxyUrl = value.customProxyUrl;
|
|
@@ -97886,7 +98149,7 @@ function refreshSourceForDomain(domain) {
|
|
|
97886
98149
|
* with that list — so a row living only in the fallback would drop out of the
|
|
97887
98150
|
* picker the moment the catalog loaded.
|
|
97888
98151
|
*
|
|
97889
|
-
* The list is empty as of the 2026-11-
|
|
98152
|
+
* The list is empty as of the 2026-11-16 read: all three ids are published now,
|
|
97890
98153
|
* with figures measured on the wire, and their rows therefore live in
|
|
97891
98154
|
* {@link FALLBACK_MODELS} like any other. The seam stays rather than being
|
|
97892
98155
|
* deleted because the gap it covers belongs to the gateway, not to those three
|
|
@@ -97897,7 +98160,7 @@ const UNPUBLISHED_MODELS = [];
|
|
|
97897
98160
|
/**
|
|
97898
98161
|
* Offline fallback catalog, transcribed from a live `/v3/config` read.
|
|
97899
98162
|
*
|
|
97900
|
-
* Last transcribed 2026-11-
|
|
98163
|
+
* Last transcribed 2026-11-16 from both backends. Used when the gateway cannot
|
|
97901
98164
|
* be reached (first run before sign-in, or a network failure); a reachable
|
|
97902
98165
|
* gateway always wins.
|
|
97903
98166
|
*/
|
|
@@ -97988,7 +98251,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
97988
98251
|
],
|
|
97989
98252
|
defaultReasoningEffort: "high",
|
|
97990
98253
|
canDisableThinking: false,
|
|
97991
|
-
description: "DeepSeek
|
|
98254
|
+
description: "DeepSeek · 修订版 1017 · 原生多模态模型,支持 1M 上下文"
|
|
97992
98255
|
},
|
|
97993
98256
|
{
|
|
97994
98257
|
id: "deepseek-v4.1-flash-sg",
|
|
@@ -98027,7 +98290,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98027
98290
|
],
|
|
98028
98291
|
defaultReasoningEffort: "high",
|
|
98029
98292
|
canDisableThinking: false,
|
|
98030
|
-
description: "原生多模态模型,擅长视觉理解与专业任务"
|
|
98293
|
+
description: "Z.ai · 原生多模态模型,擅长视觉理解与专业任务"
|
|
98031
98294
|
},
|
|
98032
98295
|
{
|
|
98033
98296
|
id: "gpt-6-astra",
|
|
@@ -98069,11 +98332,8 @@ const FALLBACK_MODELS$1 = [
|
|
|
98069
98332
|
contextWindow: 192e3,
|
|
98070
98333
|
maxContextWindow: 192e3,
|
|
98071
98334
|
maxTokens: 64e3,
|
|
98072
|
-
regions: ["intl"
|
|
98073
|
-
credits: {
|
|
98074
|
-
cn: "0.00",
|
|
98075
|
-
intl: "0.00"
|
|
98076
|
-
},
|
|
98335
|
+
regions: ["intl"],
|
|
98336
|
+
credits: { intl: "0.00" },
|
|
98077
98337
|
supportsImage: true,
|
|
98078
98338
|
reasoningEfforts: ["low", "high"],
|
|
98079
98339
|
defaultReasoningEffort: "high",
|
|
@@ -98197,7 +98457,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98197
98457
|
],
|
|
98198
98458
|
defaultReasoningEffort: "high",
|
|
98199
98459
|
canDisableThinking: false,
|
|
98200
|
-
description: "
|
|
98460
|
+
description: "Z.ai · 旗舰模型,擅长复杂软件工程与长程智能体任务"
|
|
98201
98461
|
},
|
|
98202
98462
|
{
|
|
98203
98463
|
id: "glm-5.2",
|
|
@@ -98214,7 +98474,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98214
98474
|
reasoningEfforts: ["high"],
|
|
98215
98475
|
defaultReasoningEffort: "high",
|
|
98216
98476
|
canDisableThinking: false,
|
|
98217
|
-
description: "1M 上下文,擅长长程任务"
|
|
98477
|
+
description: "Z.ai · 支持 1M 上下文,擅长长程任务"
|
|
98218
98478
|
},
|
|
98219
98479
|
{
|
|
98220
98480
|
id: "minimax-m3.1-flash",
|
|
@@ -98237,7 +98497,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98237
98497
|
],
|
|
98238
98498
|
defaultReasoningEffort: "max",
|
|
98239
98499
|
canDisableThinking: false,
|
|
98240
|
-
description: "
|
|
98500
|
+
description: "MiniMax · 原生多模态,擅长办公、智能体与编程任务,推理速度优异"
|
|
98241
98501
|
},
|
|
98242
98502
|
{
|
|
98243
98503
|
id: "kimi-k3.1-pro",
|
|
@@ -98258,7 +98518,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98258
98518
|
],
|
|
98259
98519
|
defaultReasoningEffort: "high",
|
|
98260
98520
|
canDisableThinking: false,
|
|
98261
|
-
description: "
|
|
98521
|
+
description: "Moonshot AI · 新一代旗舰,办公、编程、3D 创作、金融研究与建模及长程智能体任务"
|
|
98262
98522
|
},
|
|
98263
98523
|
{
|
|
98264
98524
|
id: "kimi-k3.1-pro-highspeed",
|
|
@@ -98420,7 +98680,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98420
98680
|
],
|
|
98421
98681
|
defaultReasoningEffort: "high",
|
|
98422
98682
|
canDisableThinking: false,
|
|
98423
|
-
description: ""
|
|
98683
|
+
description: "DeepSeek · 旗舰模型,支持 1M 上下文"
|
|
98424
98684
|
},
|
|
98425
98685
|
{
|
|
98426
98686
|
id: "deepseek-v4-flash",
|
|
@@ -98492,7 +98752,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98492
98752
|
],
|
|
98493
98753
|
defaultReasoningEffort: "high",
|
|
98494
98754
|
canDisableThinking: false,
|
|
98495
|
-
description: ""
|
|
98755
|
+
description: "MiniMax · 软件工程与办公工作流,涵盖调试与重构"
|
|
98496
98756
|
},
|
|
98497
98757
|
{
|
|
98498
98758
|
id: "glm-5.0",
|
|
@@ -98588,7 +98848,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98588
98848
|
],
|
|
98589
98849
|
defaultReasoningEffort: "high",
|
|
98590
98850
|
canDisableThinking: false,
|
|
98591
|
-
description: "
|
|
98851
|
+
description: "Moonshot AI · 擅长大型代码库开发与复杂长程自主任务,前端开发、知识工作与科研推理突出(前代模型)"
|
|
98592
98852
|
},
|
|
98593
98853
|
{
|
|
98594
98854
|
id: "kimi-k2.8-preview",
|
|
@@ -98644,24 +98904,6 @@ const FALLBACK_MODELS$1 = [
|
|
|
98644
98904
|
canDisableThinking: false,
|
|
98645
98905
|
description: ""
|
|
98646
98906
|
},
|
|
98647
|
-
{
|
|
98648
|
-
id: "hy3-x",
|
|
98649
|
-
name: "Hy3",
|
|
98650
|
-
contextWindow: 192e3,
|
|
98651
|
-
maxContextWindow: 192e3,
|
|
98652
|
-
maxTokens: 64e3,
|
|
98653
|
-
regions: ["cn"],
|
|
98654
|
-
credits: { cn: "0.05" },
|
|
98655
|
-
supportsImage: true,
|
|
98656
|
-
reasoningEfforts: [
|
|
98657
|
-
"low",
|
|
98658
|
-
"high",
|
|
98659
|
-
"max"
|
|
98660
|
-
],
|
|
98661
|
-
defaultReasoningEffort: "high",
|
|
98662
|
-
canDisableThinking: false,
|
|
98663
|
-
description: "混元思考模型,具有增强的推理能力"
|
|
98664
|
-
},
|
|
98665
98907
|
{
|
|
98666
98908
|
id: "hy4-preview-x",
|
|
98667
98909
|
name: "Hy4 preview",
|
|
@@ -98708,7 +98950,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98708
98950
|
],
|
|
98709
98951
|
defaultReasoningEffort: "max",
|
|
98710
98952
|
canDisableThinking: false,
|
|
98711
|
-
description: "
|
|
98953
|
+
description: "匿名模型 · 推理速度极快,编码能力强劲,支持原生多模态输入"
|
|
98712
98954
|
},
|
|
98713
98955
|
{
|
|
98714
98956
|
id: "step-5-preview",
|
|
@@ -98726,7 +98968,7 @@ const FALLBACK_MODELS$1 = [
|
|
|
98726
98968
|
],
|
|
98727
98969
|
defaultReasoningEffort: "high",
|
|
98728
98970
|
canDisableThinking: false,
|
|
98729
|
-
description: "
|
|
98971
|
+
description: "StepFun · 新一代旗舰,编程、专业知识工作与多步骤智能体任务,支持 1M 上下文"
|
|
98730
98972
|
},
|
|
98731
98973
|
{
|
|
98732
98974
|
id: "mimo-v2.6-pro",
|
|
@@ -98747,8 +98989,22 @@ const FALLBACK_MODELS$1 = [
|
|
|
98747
98989
|
description: "Xiaomi · 旗舰推理模型,面向专业、复杂长程工作流,兼顾高阶科研与网络安全"
|
|
98748
98990
|
},
|
|
98749
98991
|
{
|
|
98750
|
-
id: "
|
|
98751
|
-
name: "Hy4
|
|
98992
|
+
id: "hy4std",
|
|
98993
|
+
name: "Hy4",
|
|
98994
|
+
contextWindow: 1e6,
|
|
98995
|
+
maxContextWindow: 1e6,
|
|
98996
|
+
maxTokens: 64e3,
|
|
98997
|
+
regions: ["cn"],
|
|
98998
|
+
credits: { cn: "0.29" },
|
|
98999
|
+
supportsImage: true,
|
|
99000
|
+
reasoningEfforts: ["high"],
|
|
99001
|
+
defaultReasoningEffort: "high",
|
|
99002
|
+
canDisableThinking: false,
|
|
99003
|
+
description: "Tencent · 最新旗舰模型,擅长智能体任务与多模态理解,最大输入 960K"
|
|
99004
|
+
},
|
|
99005
|
+
{
|
|
99006
|
+
id: "hy4flash-free",
|
|
99007
|
+
name: "Hy4 Flash Free",
|
|
98752
99008
|
contextWindow: 1e6,
|
|
98753
99009
|
maxContextWindow: 1e6,
|
|
98754
99010
|
maxTokens: 64e3,
|
|
@@ -98758,21 +99014,21 @@ const FALLBACK_MODELS$1 = [
|
|
|
98758
99014
|
reasoningEfforts: ["high"],
|
|
98759
99015
|
defaultReasoningEffort: "high",
|
|
98760
99016
|
canDisableThinking: false,
|
|
98761
|
-
description: "
|
|
99017
|
+
description: "更轻量、更高效的日常主力模型。适合日常办公等高频、规模化场景"
|
|
98762
99018
|
},
|
|
98763
99019
|
{
|
|
98764
|
-
id: "
|
|
98765
|
-
name: "Hy4",
|
|
99020
|
+
id: "hy4flash",
|
|
99021
|
+
name: "Hy4 Flash",
|
|
98766
99022
|
contextWindow: 1e6,
|
|
98767
99023
|
maxContextWindow: 1e6,
|
|
98768
99024
|
maxTokens: 64e3,
|
|
98769
99025
|
regions: ["cn"],
|
|
98770
|
-
credits: { cn: "0.
|
|
99026
|
+
credits: { cn: "0.03" },
|
|
98771
99027
|
supportsImage: true,
|
|
98772
99028
|
reasoningEfforts: ["high"],
|
|
98773
99029
|
defaultReasoningEffort: "high",
|
|
98774
99030
|
canDisableThinking: false,
|
|
98775
|
-
description: "
|
|
99031
|
+
description: "更轻量、更高效的日常主力模型。适合日常办公等高频、规模化场景"
|
|
98776
99032
|
}
|
|
98777
99033
|
];
|
|
98778
99034
|
/**
|
|
@@ -105853,10 +106109,21 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
105853
106109
|
getPreferences: () => preferences.status(),
|
|
105854
106110
|
logger: ctx.logger
|
|
105855
106111
|
});
|
|
105856
|
-
const
|
|
105857
|
-
const
|
|
106112
|
+
const lineProxyFetches = /* @__PURE__ */ new Map();
|
|
106113
|
+
const proxyFetchFor = (line) => {
|
|
106114
|
+
let fetchForLine = lineProxyFetches.get(line);
|
|
106115
|
+
if (fetchForLine === void 0) {
|
|
106116
|
+
fetchForLine = proxyManager.createFetch({
|
|
106117
|
+
line,
|
|
106118
|
+
...line === "kimi-code" ? { headersTimeoutMs: TRANSPORT_HEADERS_TIMEOUT_MS } : {}
|
|
106119
|
+
});
|
|
106120
|
+
lineProxyFetches.set(line, fetchForLine);
|
|
106121
|
+
}
|
|
106122
|
+
return fetchForLine;
|
|
106123
|
+
};
|
|
106124
|
+
const proxyFetch = proxyFetchFor("codex-chatgpt");
|
|
105858
106125
|
const providerLimits = readModelRequestLimits();
|
|
105859
|
-
const baseFetchFor = (provider) => provider === "
|
|
106126
|
+
const baseFetchFor = (provider) => proxyFetchFor(provider === "claude" ? "claude-subscription" : provider);
|
|
105860
106127
|
const modelFetch = Object.fromEntries(CONTROLLED_PROVIDERS.map((provider) => [provider, createControlledModelFetch(createDiagnosticFetch(baseFetchFor(provider), {
|
|
105861
106128
|
provider,
|
|
105862
106129
|
onRecord: (record) => ctx.logger.info("[provider-diagnostics] " + JSON.stringify(record))
|
|
@@ -105865,7 +106132,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
105865
106132
|
limits: providerLimits
|
|
105866
106133
|
})]));
|
|
105867
106134
|
const disposeCommandCodeRoutes = registerCommandCodeRoutes(ctx, commandCodeStore, commandCodeModelSettings, commandCodePreferences, {
|
|
105868
|
-
fetchFn:
|
|
106135
|
+
fetchFn: proxyFetchFor("command-code"),
|
|
105869
106136
|
serving: () => commandCodeClaim.serving(),
|
|
105870
106137
|
conflict: () => commandCodeClaim.conflict()
|
|
105871
106138
|
}, commandCodeAccountPool);
|
|
@@ -105942,7 +106209,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
105942
106209
|
const disposeOllamaRoutes = registerOllamaRoutes(ctx, {
|
|
105943
106210
|
accountPool: ollamaAccountPool,
|
|
105944
106211
|
modelSettings: ollamaModelSettings,
|
|
105945
|
-
fetchFn:
|
|
106212
|
+
fetchFn: proxyFetchFor("ollama")
|
|
105946
106213
|
});
|
|
105947
106214
|
const antigravityAcpClaim = claimProviderRoute(ctx, {
|
|
105948
106215
|
providerId: PROVIDER_ID$10,
|
|
@@ -106006,7 +106273,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106006
106273
|
adapter: commandCodeAdapter
|
|
106007
106274
|
});
|
|
106008
106275
|
const disposeKimiCodeRoutes = registerKimiCodeRoutes(ctx, kimiCodeStore, kimiCodeModelSettings, kimiCodePreferences, {
|
|
106009
|
-
fetchFn:
|
|
106276
|
+
fetchFn: proxyFetchFor("kimi-code"),
|
|
106010
106277
|
serving: () => kimiCodeClaim.serving(),
|
|
106011
106278
|
conflict: () => kimiCodeClaim.conflict()
|
|
106012
106279
|
}, kimiCodeAccountPool);
|
|
@@ -106020,7 +106287,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106020
106287
|
})
|
|
106021
106288
|
});
|
|
106022
106289
|
const disposeGlmCodingPlanRoutes = registerGlmCodingPlanRoutes(ctx, glmCodingPlanSettingsSource(glmCodingPlanPreferences, glmCodingPlanModelSettings), {
|
|
106023
|
-
fetchFn:
|
|
106290
|
+
fetchFn: proxyFetchFor("glm-coding-plan"),
|
|
106024
106291
|
serving: () => glmCodingPlanClaim.serving(),
|
|
106025
106292
|
conflict: () => glmCodingPlanClaim.conflict(),
|
|
106026
106293
|
accountPool: glmCodingPlanAccountPool
|
|
@@ -106043,7 +106310,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106043
106310
|
minimaxCodeAppVersion = void 0;
|
|
106044
106311
|
}
|
|
106045
106312
|
const minimaxCodeCheckin = new MinimaxCodeCheckinService(minimaxCodeAccountPool, {
|
|
106046
|
-
fetchFn:
|
|
106313
|
+
fetchFn: proxyFetchFor("minimax-code"),
|
|
106047
106314
|
settings: () => minimaxCodePreferences.status().checkin ?? { enabled: true },
|
|
106048
106315
|
ready: () => minimaxCodePreferences.ready(),
|
|
106049
106316
|
...minimaxCodeAppVersion === void 0 ? {} : { appVersion: minimaxCodeAppVersion },
|
|
@@ -106057,7 +106324,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106057
106324
|
const minimaxCodeCheckinTimer = setInterval(minimaxCodeCheckinTick, CHECKIN_TICK_MS$1);
|
|
106058
106325
|
minimaxCodeCheckinTick();
|
|
106059
106326
|
const disposeMinimaxCodeRoutes = registerMinimaxCodeRoutes(ctx, minimaxCodeStore, {
|
|
106060
|
-
fetchFn:
|
|
106327
|
+
fetchFn: proxyFetchFor("minimax-code"),
|
|
106061
106328
|
serving: () => minimaxCodeClaim.serving(),
|
|
106062
106329
|
conflict: () => minimaxCodeClaim.conflict(),
|
|
106063
106330
|
accountPool: minimaxCodeAccountPool,
|
|
@@ -106074,7 +106341,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106074
106341
|
})
|
|
106075
106342
|
});
|
|
106076
106343
|
const disposeClaudeRoutes = registerClaudeRoutes(ctx, claudeStore, claudeModelSettings, claudePreferences, {
|
|
106077
|
-
fetchFn:
|
|
106344
|
+
fetchFn: proxyFetchFor("claude-subscription"),
|
|
106078
106345
|
serving: () => claudeClaim.serving(),
|
|
106079
106346
|
conflict: () => claudeClaim.conflict(),
|
|
106080
106347
|
accountPool: claudeAccountPool
|
|
@@ -106090,14 +106357,14 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106090
106357
|
})
|
|
106091
106358
|
});
|
|
106092
106359
|
const disposeStepCodeRoutes = registerStepCodeRoutes(ctx, stepCodeSettingsSource(stepCodePreferences, stepCodeModelSettings), {
|
|
106093
|
-
fetchFn:
|
|
106360
|
+
fetchFn: proxyFetchFor("step-code"),
|
|
106094
106361
|
serving: () => stepCodeClaim.serving(),
|
|
106095
106362
|
conflict: () => stepCodeClaim.conflict(),
|
|
106096
106363
|
accountPool: stepCodeAccountPool,
|
|
106097
106364
|
promptCache: promptCacheOverrides["step-code"]
|
|
106098
106365
|
});
|
|
106099
106366
|
const clinePassLine = createClinePassLine(ctx, {
|
|
106100
|
-
fetchFn:
|
|
106367
|
+
fetchFn: proxyFetchFor("cline-pass"),
|
|
106101
106368
|
modelFetchFn: modelFetch["cline-pass"],
|
|
106102
106369
|
attachments: ctx.attachments
|
|
106103
106370
|
});
|
|
@@ -106111,17 +106378,17 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106111
106378
|
})
|
|
106112
106379
|
});
|
|
106113
106380
|
const disposeQoderRoutes = registerQoderRoutes(ctx, qoderSettingsSource(qoderPreferences, qoderModelSettings), {
|
|
106114
|
-
fetchFn:
|
|
106381
|
+
fetchFn: proxyFetchFor("qoder"),
|
|
106115
106382
|
serving: () => qoderClaim.serving(),
|
|
106116
106383
|
conflict: () => qoderClaim.conflict(),
|
|
106117
106384
|
accountPool: qoderAccountPool
|
|
106118
106385
|
});
|
|
106119
106386
|
warmQoderCatalogOnStartup(ctx, {
|
|
106120
|
-
fetchFn:
|
|
106387
|
+
fetchFn: proxyFetchFor("qoder"),
|
|
106121
106388
|
accountPool: qoderAccountPool
|
|
106122
106389
|
}).catch(() => void 0);
|
|
106123
106390
|
const openDesignLine = createOpenDesignLine(ctx, {
|
|
106124
|
-
fetchFn:
|
|
106391
|
+
fetchFn: proxyFetchFor("opendesign"),
|
|
106125
106392
|
modelFetchFn: modelFetch["opendesign"],
|
|
106126
106393
|
attachments: ctx.attachments
|
|
106127
106394
|
});
|
|
@@ -106136,7 +106403,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106136
106403
|
})
|
|
106137
106404
|
});
|
|
106138
106405
|
const workBuddyCheckin = new WorkBuddyCheckinService(workBuddyStore, {
|
|
106139
|
-
fetchFn:
|
|
106406
|
+
fetchFn: proxyFetchFor("workbuddy-subscription"),
|
|
106140
106407
|
settings: () => workBuddyPreferences.status().checkin,
|
|
106141
106408
|
ready: () => workBuddyPreferences.ready(),
|
|
106142
106409
|
logger: ctx.logger
|
|
@@ -106149,7 +106416,7 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106149
106416
|
const workBuddyCheckinTimer = setInterval(workBuddyCheckinTick, CHECKIN_TICK_MS);
|
|
106150
106417
|
workBuddyCheckinTick();
|
|
106151
106418
|
const disposeWorkBuddyRoutes = registerWorkBuddyRoutes(ctx, workBuddyStore, workBuddyModelSettings, workBuddyPreferences, {
|
|
106152
|
-
fetchFn:
|
|
106419
|
+
fetchFn: proxyFetchFor("workbuddy-subscription"),
|
|
106153
106420
|
serving: () => workBuddyClaim.serving(),
|
|
106154
106421
|
conflict: () => workBuddyClaim.conflict(),
|
|
106155
106422
|
accountPool: workBuddyAccountPool,
|
|
@@ -106474,14 +106741,14 @@ function apply(ctx, pluginConfig = {}) {
|
|
|
106474
106741
|
const disposeAdapter = ctx.llm.registerAdapter([PROVIDER_ID$13], adapter);
|
|
106475
106742
|
const mediaToolsEnabled = pluginConfig.mediaTools?.get() !== false;
|
|
106476
106743
|
const disposeImageTool = mediaToolsEnabled ? ctx.tools.register(createCodexImageTool(oauth, ctx.attachments, { fetchFn: proxyFetch })) : () => void 0;
|
|
106477
|
-
const disposeVideoTool = mediaToolsEnabled ? ctx.tools.register(createKimiVideoTool(ctx, { fetchFn:
|
|
106744
|
+
const disposeVideoTool = mediaToolsEnabled ? ctx.tools.register(createKimiVideoTool(ctx, { fetchFn: proxyFetchFor("kimi-code") })) : () => void 0;
|
|
106478
106745
|
const minimaxMediaToolsEnabled = mediaToolsEnabled && minimaxCodePreferences.status().enabled;
|
|
106479
106746
|
const disposeMinimaxUnderstandVideoTool = minimaxMediaToolsEnabled ? ctx.tools.register(createMinimaxUnderstandVideoTool(ctx, {
|
|
106480
|
-
fetchFn:
|
|
106747
|
+
fetchFn: proxyFetchFor("minimax-code"),
|
|
106481
106748
|
pool: minimaxCodeAccountPool
|
|
106482
106749
|
})) : () => void 0;
|
|
106483
106750
|
const disposeMinimaxGenerateVideoTool = minimaxMediaToolsEnabled ? ctx.tools.register(createMinimaxGenerateVideoTool(ctx, {
|
|
106484
|
-
fetchFn:
|
|
106751
|
+
fetchFn: proxyFetchFor("minimax-code"),
|
|
106485
106752
|
pool: minimaxCodeAccountPool
|
|
106486
106753
|
})) : () => void 0;
|
|
106487
106754
|
ctx.inject(["web"], (ctx) => {
|