@xiaoso/dsh-tool-plus 0.1.16 → 0.1.17-beta.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/lib/{abort-DZ54CaKU.mjs → abort-BTblp0Rt.mjs} +2 -2
- package/lib/{alibaba-coding-plan-DODpkcqi.mjs → alibaba-coding-plan-t3R4YKCB.mjs} +3 -3
- package/lib/{alibaba-token-plan-C6lpKCda.mjs → alibaba-token-plan-CO4djG1y.mjs} +4 -4
- package/lib/{alibaba-token-plan-CHGyWOfX.mjs → alibaba-token-plan-CUjYJX0-.mjs} +1 -1
- package/lib/{anthropic-Dv_GGX6g.mjs → anthropic-nf7w6so1.mjs} +48 -21
- package/lib/{api-key-validation-MnMf_ihX.mjs → api-key-validation-C_tZ7Y9a.mjs} +2 -2
- package/lib/behavior-BwvTUtag.mjs +111 -0
- package/lib/{browser-render-BZXt548F.mjs → browser-render-BQaEVK_n.mjs} +4 -4
- package/lib/{reference-CtvM4zLU.mjs → bundled-references-CrQ4dQcT.mjs} +57 -4
- package/lib/cascade-BWjRTD1q.mjs +30265 -0
- package/lib/{cline-pass-BT9CBEOj.mjs → cline-pass-Bjm-O8GG.mjs} +2 -2
- package/lib/cloudflare-CKXRJ0l9.mjs +37 -0
- package/lib/{cloudflare-ai-gateway-DReN6ohJ.mjs → cloudflare-ai-gateway-BpnBSjwV.mjs} +8 -4
- package/lib/cloudflare-workers-ai-odj9XswL.mjs +32 -0
- package/lib/collapse-_nkb2dn7.mjs +1945 -0
- package/lib/{coreweave-C82HrLpb.mjs → coreweave-CGDZOD8-.mjs} +1 -1
- package/lib/{coreweave-C68UgRQO.mjs → coreweave-DwffcgW5.mjs} +4 -4
- package/lib/cursor-BgOuV7Qf.mjs +794 -0
- package/lib/{cursor-_gHHq-Dq.mjs → cursor-CF1iHHbv.mjs} +68 -19
- package/lib/{cursor-proto-Cr_WEMuv.mjs → cursor-proto-BuNTjX3L.mjs} +823 -23
- package/lib/{devin-QpfTSl9H.mjs → devin-7OEeEb80.mjs} +112 -31
- package/lib/{devin-proto-DYhp4Ty6.mjs → devin-proto-C-QreeAv.mjs} +71 -5
- package/lib/{dom-DG3sPESc.mjs → dom-BmbZv4v9.mjs} +598 -182
- package/lib/{error-O63pC8zg.mjs → error-8LVo7tug.mjs} +725 -104
- package/lib/factory-droid-ChhmsGWb.mjs +71 -0
- package/lib/{fs-promises-shim-B2YFWkcd.mjs → fs-promises-shim-CANAxFWh.mjs} +10 -1
- package/lib/{github-copilot-BMEcw8N1.mjs → github-copilot-QwevdT30.mjs} +4 -4
- package/lib/{github-copilot-headers-DnjGEbko.mjs → github-copilot-headers-CAUZ0rUD.mjs} +138 -26
- package/lib/{gitlab-duo-DnHqJjFY.mjs → gitlab-duo-DigV7k_o.mjs} +2 -2
- package/lib/{google-antigravity-B1mSckrK.mjs → google-antigravity-D-oe0r8A.mjs} +6 -7
- package/lib/{google-gemini-cli-DJwThCCn.mjs → google-gemini-cli-CQBHgGJT.mjs} +5 -6
- package/lib/{google-oauth-shared-BctLpVUN.mjs → google-oauth-shared-CvgVIUwJ.mjs} +2 -2
- package/lib/google-validation-CdvRj4ec.mjs +126 -0
- package/lib/id-EJwVLDHE.mjs +2548 -0
- package/lib/index.mjs +248 -258
- package/lib/{kilo-BEgEwMJQ.mjs → kilo-5r6OffCa.mjs} +2 -2
- package/lib/{kimi-T9NldEIJ.mjs → kimi-DOOtbXmm.mjs} +9 -10
- package/lib/{launch-BIWNyrBB.mjs → launch-DkAjib7h.mjs} +1 -1
- package/lib/{markit-Dvp2JPdT.mjs → markit-CCcyeAds.mjs} +359 -140
- package/lib/{models-DnXMYGcJ.mjs → models-DCpDT_im.mjs} +199203 -112275
- package/lib/{muse-code-CNvqqAp6.mjs → muse-code-CYf8zj_B.mjs} +5 -5
- package/lib/{openai-codex-D5-CyTxa.mjs → openai-codex-Cj-TvSFh.mjs} +13 -10
- package/lib/{perplexity-A2PEoGaC.mjs → perplexity-Dh_Qgsmx.mjs} +68 -25
- package/lib/{pkce-BYjmugmw.mjs → pkce-DO-jBJLV.mjs} +1 -1
- package/lib/pricing-DusBEhwm.mjs +593 -0
- package/lib/{readability-uGhqb4GC.mjs → readability-XHK0o3bv.mjs} +287 -27
- package/lib/{scrapers-C1ujjV8k.mjs → scrapers-B6PADOVm.mjs} +13 -13
- package/lib/slugify-ynYWBIA5.mjs +11 -0
- package/lib/snowflake-B_jap6lz.mjs +666 -0
- package/lib/snowflake-Cu1ZyOp6.mjs +151 -0
- package/lib/{src-AELUUb5U.mjs → src-BhinCSpi.mjs} +1172 -458
- package/lib/{stream-AVOoe5Hj.mjs → stream-D2ivg3GH.mjs} +3740 -5311
- package/lib/{turndown-D6fof1OX.mjs → turndown-Vya8SavL.mjs} +82 -30
- package/lib/types/tools/hashline/native/index.d.ts +2 -2
- package/lib/types/tools/hashline/native/policy.d.ts +19 -21
- package/lib/types/tools/omp/session/agent-storage.d.ts +3 -3
- package/lib/types/tools/shared/bun-named-shim.d.ts +5 -0
- package/lib/{types-BLrLohwK.mjs → types-tH1v9uRm.mjs} +2 -2
- package/lib/{utils-cZX3f_Ls.mjs → utils-C_Ncya1r.mjs} +1737 -509
- package/lib/utils-D2tK38xq.mjs +34006 -0
- package/lib/{utils-I4I8azHN.mjs → utils-DrDwmNtu.mjs} +8 -3
- package/lib/{xai-oauth-CbeldUSV.mjs → xai-oauth-DLLzX6my.mjs} +4 -4
- package/lib/{xiaomi-Dl3VSs04.mjs → xiaomi-CqK-KivK.mjs} +2 -2
- package/lib/{zai-FyjGSypr.mjs → zai-DoJ2xPIH.mjs} +2 -2
- package/lib/{zip-DRrycScC.mjs → zip-DG1mUV6X.mjs} +1 -1
- package/package.json +8 -8
- package/lib/amazon-bedrock-Dx0rr9dY.mjs +0 -996
- package/lib/anthropic-ClCw0PV_.mjs +0 -3624
- package/lib/anthropic-wire-lbGAFzYb.mjs +0 -927
- package/lib/azure-openai-responses-WE_bgFWp.mjs +0 -285
- package/lib/bundled-references-DY3EJxZV.mjs +0 -56
- package/lib/cloudflare-ai-gateway-CrMa97Ap.mjs +0 -44
- package/lib/collapse-CkMNRNr7.mjs +0 -2304
- package/lib/cursor-C6jaIJDg.mjs +0 -283
- package/lib/cursor-D-XZYDf_.mjs +0 -4544
- package/lib/deterministic-id-CUEIMSqR.mjs +0 -17
- package/lib/devin-ExGIghmx.mjs +0 -69
- package/lib/devin-u0ljw5P6.mjs +0 -628
- package/lib/effort-BdtQMN-_.mjs +0 -23
- package/lib/event-stream-BKEtb45Y.mjs +0 -167
- package/lib/gemini-headers-Co9cVvex.mjs +0 -54
- package/lib/google-auth-qAN-6DMW.mjs +0 -232
- package/lib/google-gemini-cli-B2Aw1S5w.mjs +0 -844
- package/lib/google-lTxuq28n.mjs +0 -38
- package/lib/google-shared-Y01j9xOr.mjs +0 -856
- package/lib/google-validation-BEkNs-Bx.mjs +0 -18
- package/lib/google-vertex-DcM-FRC5.mjs +0 -99
- package/lib/hosts-00rjRzUD.mjs +0 -203
- package/lib/id-AL5obQzR.mjs +0 -71
- package/lib/idle-iterator-D0ZXEcUq.mjs +0 -366
- package/lib/ollama-6R0oXZks.mjs +0 -574
- package/lib/openai-codex-responses-C8bnBWOe.mjs +0 -3232
- package/lib/openai-completions-DNr3mUsn.mjs +0 -1430
- package/lib/openai-configuration-update-xMYUjaK_.mjs +0 -150
- package/lib/openai-reasoning-fallback-Ju-5pSR8.mjs +0 -380
- package/lib/openai-responses-CjpafAEr.mjs +0 -861
- package/lib/protobuf-BMgDYu_U.mjs +0 -717
- package/lib/provider-response-SqKSkkUc.mjs +0 -22
- package/lib/proxy-DxvCQOCA.mjs +0 -230
- package/lib/request-debug-BwPOqN_j.mjs +0 -183
- package/lib/sanitize-text-BCf5KmCf.mjs +0 -33
- package/lib/sse-debug-B-tkLCPW.mjs +0 -11
- package/lib/stream-markup-healing-CN3RsqG9.mjs +0 -267
- package/lib/strict-tool-validation-CBTz1dAA.mjs +0 -105
- package/lib/taxonomy-DSIM99rS.mjs +0 -15392
- package/lib/thinking-ngMwf_1Y.mjs +0 -336
- package/lib/type-guards-CttAANEx.mjs +0 -11
- package/lib/utils-CE3DSebh.mjs +0 -11763
- package/lib/vision-guard-BCpXWUj3.mjs +0 -77
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
-
__installBunShim();
|
|
3
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/utils/google-validation.ts
|
|
4
|
-
function extractGoogleValidationUrl(errorBody) {
|
|
5
|
-
if (!errorBody.includes("VALIDATION_REQUIRED")) return void 0;
|
|
6
|
-
const start = errorBody.indexOf("{");
|
|
7
|
-
if (start === -1) return void 0;
|
|
8
|
-
try {
|
|
9
|
-
return (JSON.parse(errorBody.slice(start)).error?.details?.find((d) => d.reason === "VALIDATION_REQUIRED" && typeof d.metadata?.validation_url === "string"))?.metadata?.validation_url;
|
|
10
|
-
} catch {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function formatGoogleValidationRequiredMessage(validationUrl, nextAction, email) {
|
|
15
|
-
return `Account verification required${email ? ` for ${email}` : ""}. Visit ${validationUrl} to continue, then ${nextAction}.`;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { formatGoogleValidationRequiredMessage as n, extractGoogleValidationUrl as t };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
-
__installBunShim();
|
|
3
|
-
import { N as $env } from "./src-AELUUb5U.mjs";
|
|
4
|
-
import { t as ConfigurationError } from "./error-O63pC8zg.mjs";
|
|
5
|
-
import { i as resolveVertexEndpointHost } from "./hosts-00rjRzUD.mjs";
|
|
6
|
-
import { t as getVertexAccessToken } from "./google-auth-qAN-6DMW.mjs";
|
|
7
|
-
import { p as streamGoogleGenAI, t as buildGoogleGenerateContentParams } from "./google-shared-Y01j9xOr.mjs";
|
|
8
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/google-vertex.ts
|
|
9
|
-
const API_VERSION = "v1";
|
|
10
|
-
const streamGoogleVertex = (model, context, options) => {
|
|
11
|
-
return streamGoogleGenAI({
|
|
12
|
-
model,
|
|
13
|
-
options,
|
|
14
|
-
api: "google-vertex",
|
|
15
|
-
retainTextSignature: true,
|
|
16
|
-
prepare: async () => {
|
|
17
|
-
const apiKey = resolveApiKey(options);
|
|
18
|
-
const params = buildGoogleGenerateContentParams(model, context, options ?? {});
|
|
19
|
-
params.config ||= {};
|
|
20
|
-
if (!params.config.safetySettings) params.config.safetySettings = [
|
|
21
|
-
{
|
|
22
|
-
category: "HARM_CATEGORY_HATE_SPEECH",
|
|
23
|
-
threshold: "OFF"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
category: "HARM_CATEGORY_DANGEROUS_CONTENT",
|
|
27
|
-
threshold: "OFF"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
category: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
|
31
|
-
threshold: "OFF"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
category: "HARM_CATEGORY_HARASSMENT",
|
|
35
|
-
threshold: "OFF"
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
const baseHeaders = {
|
|
39
|
-
...model.headers,
|
|
40
|
-
...options?.headers
|
|
41
|
-
};
|
|
42
|
-
if (options?.serviceTier === "priority") baseHeaders["X-Vertex-AI-LLM-Shared-Request-Type"] = "priority";
|
|
43
|
-
if (apiKey) {
|
|
44
|
-
const explicitLocation = options?.location;
|
|
45
|
-
const location = explicitLocation ?? resolveAmbientLocation() ?? "global";
|
|
46
|
-
const host = resolveVertexEndpointHost(location);
|
|
47
|
-
const path = `${API_VERSION}/publishers/google/models/${model.id}:streamGenerateContent?alt=sse`;
|
|
48
|
-
const useGlobalFallback = !explicitLocation && host !== "aiplatform.googleapis.com";
|
|
49
|
-
return {
|
|
50
|
-
params,
|
|
51
|
-
url: `https://${host}/${path}`,
|
|
52
|
-
fallbackUrl: useGlobalFallback ? `https://aiplatform.googleapis.com/${path}` : void 0,
|
|
53
|
-
headers: {
|
|
54
|
-
...baseHeaders,
|
|
55
|
-
"x-goog-api-key": apiKey
|
|
56
|
-
},
|
|
57
|
-
fetch: options?.fetch
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
const project = resolveProject(options);
|
|
61
|
-
const location = resolveLocation(options);
|
|
62
|
-
const accessToken = await getVertexAccessToken({
|
|
63
|
-
signal: options?.signal,
|
|
64
|
-
fetch: options?.fetch
|
|
65
|
-
});
|
|
66
|
-
return {
|
|
67
|
-
params,
|
|
68
|
-
url: `https://${resolveVertexEndpointHost(location)}/${API_VERSION}/projects/${project}/locations/${location}/publishers/google/models/${model.id}:streamGenerateContent?alt=sse`,
|
|
69
|
-
headers: {
|
|
70
|
-
...baseHeaders,
|
|
71
|
-
Authorization: `Bearer ${accessToken}`
|
|
72
|
-
},
|
|
73
|
-
fetch: options?.fetch
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
function resolveApiKey(options) {
|
|
79
|
-
const optKey = options?.apiKey;
|
|
80
|
-
return (optKey && !optKey.startsWith("<") && optKey !== "N/A" ? optKey : void 0) || $env.GOOGLE_CLOUD_API_KEY;
|
|
81
|
-
}
|
|
82
|
-
function resolveProject(options) {
|
|
83
|
-
const project = options?.project || $env.GOOGLE_CLOUD_PROJECT || $env.GCP_PROJECT || $env.GCLOUD_PROJECT;
|
|
84
|
-
if (!project) throw new ConfigurationError("Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCP_PROJECT/GCLOUD_PROJECT or pass project in options.");
|
|
85
|
-
return project;
|
|
86
|
-
}
|
|
87
|
-
function resolveAmbientLocation() {
|
|
88
|
-
return $env.GOOGLE_VERTEX_LOCATION || $env.GOOGLE_CLOUD_LOCATION || $env.VERTEX_LOCATION || void 0;
|
|
89
|
-
}
|
|
90
|
-
function resolveOptionalLocation(options) {
|
|
91
|
-
return options?.location || resolveAmbientLocation();
|
|
92
|
-
}
|
|
93
|
-
function resolveLocation(options) {
|
|
94
|
-
const location = resolveOptionalLocation(options);
|
|
95
|
-
if (!location) throw new ConfigurationError("Vertex AI requires a location. Set GOOGLE_VERTEX_LOCATION/GOOGLE_CLOUD_LOCATION/VERTEX_LOCATION or pass location in options.");
|
|
96
|
-
return location;
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
export { streamGoogleVertex };
|
package/lib/hosts-00rjRzUD.mjs
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
-
__installBunShim();
|
|
3
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-catalog@18.1.17/node_modules/@oh-my-pi/pi-catalog/src/hosts.ts
|
|
4
|
-
const KNOWN_HOSTS = {
|
|
5
|
-
openai: {
|
|
6
|
-
providers: ["openai"],
|
|
7
|
-
urlMarkers: ["api.openai.com"]
|
|
8
|
-
},
|
|
9
|
-
azureOpenAI: {
|
|
10
|
-
providers: ["azure"],
|
|
11
|
-
urlMarkers: [
|
|
12
|
-
".openai.azure.com",
|
|
13
|
-
"azure.com/openai",
|
|
14
|
-
"models.inference.ai.azure.com"
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
openrouter: {
|
|
18
|
-
providers: ["openrouter"],
|
|
19
|
-
urlMarkers: ["openrouter.ai"]
|
|
20
|
-
},
|
|
21
|
-
vercelAIGateway: {
|
|
22
|
-
providers: ["vercel-ai-gateway"],
|
|
23
|
-
urlMarkers: ["ai-gateway.vercel.sh"]
|
|
24
|
-
},
|
|
25
|
-
githubCopilot: {
|
|
26
|
-
providers: ["github-copilot"],
|
|
27
|
-
urlMarkers: ["githubcopilot.com", "copilot-api."]
|
|
28
|
-
},
|
|
29
|
-
anthropic: {
|
|
30
|
-
providers: ["anthropic"],
|
|
31
|
-
urlMarkers: ["api.anthropic.com"]
|
|
32
|
-
},
|
|
33
|
-
/** DeepSeek's first-party API only — gates direct-API quirks (max_tokens field, thinking extraBody). */
|
|
34
|
-
deepseekDirect: {
|
|
35
|
-
providers: ["deepseek"],
|
|
36
|
-
urlMarkers: ["api.deepseek.com"]
|
|
37
|
-
},
|
|
38
|
-
/** Any DeepSeek-operated host (first-party API, web-chat fronts). Wider than `deepseekDirect` on purpose. */
|
|
39
|
-
deepseekFamily: {
|
|
40
|
-
providers: ["deepseek"],
|
|
41
|
-
urlMarkers: ["deepseek.com"]
|
|
42
|
-
},
|
|
43
|
-
cerebras: {
|
|
44
|
-
providers: ["cerebras"],
|
|
45
|
-
urlMarkers: ["cerebras.ai"]
|
|
46
|
-
},
|
|
47
|
-
zai: {
|
|
48
|
-
providers: ["zai"],
|
|
49
|
-
urlMarkers: ["api.z.ai"]
|
|
50
|
-
},
|
|
51
|
-
zhipu: {
|
|
52
|
-
providers: ["zhipu-coding-plan"],
|
|
53
|
-
urlMarkers: ["open.bigmodel.cn"]
|
|
54
|
-
},
|
|
55
|
-
kilo: {
|
|
56
|
-
providers: ["kilo"],
|
|
57
|
-
urlMarkers: ["api.kilo.ai"]
|
|
58
|
-
},
|
|
59
|
-
alibabaDashscope: {
|
|
60
|
-
providers: ["alibaba-coding-plan", "alibaba-token-plan"],
|
|
61
|
-
urlMarkers: ["dashscope", "token-plan."]
|
|
62
|
-
},
|
|
63
|
-
umans: {
|
|
64
|
-
providers: ["umans"],
|
|
65
|
-
urlMarkers: ["api.code.umans.ai"]
|
|
66
|
-
},
|
|
67
|
-
xiaomi: {
|
|
68
|
-
providers: ["xiaomi"],
|
|
69
|
-
providerPrefixes: ["xiaomi-token-plan-"],
|
|
70
|
-
urlMarkers: ["xiaomimimo.com"]
|
|
71
|
-
},
|
|
72
|
-
xai: {
|
|
73
|
-
providers: ["xai", "xai-oauth"],
|
|
74
|
-
urlMarkers: ["api.x.ai"]
|
|
75
|
-
},
|
|
76
|
-
mistral: {
|
|
77
|
-
providers: ["mistral"],
|
|
78
|
-
urlMarkers: ["mistral.ai"]
|
|
79
|
-
},
|
|
80
|
-
together: {
|
|
81
|
-
providers: ["together"],
|
|
82
|
-
urlMarkers: ["api.together.xyz"]
|
|
83
|
-
},
|
|
84
|
-
baseten: {
|
|
85
|
-
providers: ["baseten"],
|
|
86
|
-
urlMarkers: ["baseten.co"]
|
|
87
|
-
},
|
|
88
|
-
/** URL-only on purpose: the `fireworks`/`firepass` providers route per-model and not every model is Fireworks-shaped. */
|
|
89
|
-
fireworks: { urlMarkers: ["fireworks.ai"] },
|
|
90
|
-
groq: {
|
|
91
|
-
providers: ["groq"],
|
|
92
|
-
urlMarkers: ["api.groq.com"]
|
|
93
|
-
},
|
|
94
|
-
minimax: {
|
|
95
|
-
providers: [
|
|
96
|
-
"minimax",
|
|
97
|
-
"minimax-code",
|
|
98
|
-
"minimax-code-cn"
|
|
99
|
-
],
|
|
100
|
-
urlMarkers: ["api.minimax.io", "api.minimaxi.com"]
|
|
101
|
-
},
|
|
102
|
-
qwenPortal: {
|
|
103
|
-
providers: ["qwen-portal"],
|
|
104
|
-
urlMarkers: ["portal.qwen.ai"]
|
|
105
|
-
},
|
|
106
|
-
/** NVIDIA NIM (`integrate.api.nvidia.com`). Qwen NIM endpoints take `chat_template_kwargs.enable_thinking`, never top-level `enable_thinking`. */
|
|
107
|
-
nvidia: {
|
|
108
|
-
providers: ["nvidia"],
|
|
109
|
-
urlMarkers: ["integrate.api.nvidia.com"]
|
|
110
|
-
},
|
|
111
|
-
/** Venice AI (`api.venice.ai`). OpenAI-compatible; drives reasoning via top-level `reasoning_effort` (and `venice_parameters.disable_thinking`), and rejects DashScope's top-level `enable_thinking` with a 400 (`additionalProperties: false` request schema). */
|
|
112
|
-
venice: {
|
|
113
|
-
providers: ["venice"],
|
|
114
|
-
urlMarkers: ["api.venice.ai"]
|
|
115
|
-
},
|
|
116
|
-
moonshotNative: {
|
|
117
|
-
providers: ["moonshot", "kimi-code"],
|
|
118
|
-
urlMarkers: ["api.moonshot.ai", "api.kimi.com"]
|
|
119
|
-
},
|
|
120
|
-
/** Google AI Studio's OpenAI-compatible shim (`/v1beta/openai`) — a subset of chat-completions; rejects `store` with a 400. Native Gemini uses `google-generative-ai` api instead. */
|
|
121
|
-
googleAistudio: {
|
|
122
|
-
providers: [],
|
|
123
|
-
urlMarkers: ["generativelanguage.googleapis.com"]
|
|
124
|
-
},
|
|
125
|
-
opencode: {
|
|
126
|
-
providers: ["opencode-go", "opencode-zen"],
|
|
127
|
-
urlMarkers: ["opencode.ai"]
|
|
128
|
-
},
|
|
129
|
-
/** ZenMux's Anthropic-compatible proxy (`zenmux.ai/api/anthropic`) forwards to signature-enforcing Anthropic. */
|
|
130
|
-
zenmux: {
|
|
131
|
-
providers: ["zenmux"],
|
|
132
|
-
urlMarkers: ["zenmux.ai"]
|
|
133
|
-
},
|
|
134
|
-
chutes: { urlMarkers: ["chutes.ai"] }
|
|
135
|
-
};
|
|
136
|
-
const MAX_URL_HOST_MATCHES = 512;
|
|
137
|
-
const urlHostMatches = /* @__PURE__ */ new Map();
|
|
138
|
-
function getUrlHostMatches(baseUrl) {
|
|
139
|
-
let matches = urlHostMatches.get(baseUrl);
|
|
140
|
-
if (matches !== void 0) return matches;
|
|
141
|
-
if (urlHostMatches.size === MAX_URL_HOST_MATCHES) urlHostMatches.clear();
|
|
142
|
-
matches = /* @__PURE__ */ new Map();
|
|
143
|
-
urlHostMatches.set(baseUrl, matches);
|
|
144
|
-
return matches;
|
|
145
|
-
}
|
|
146
|
-
/** URL-only host check (for call sites that have no provider id, e.g. raw env config). */
|
|
147
|
-
function hostMatchesUrl(baseUrl, host) {
|
|
148
|
-
if (!baseUrl) return false;
|
|
149
|
-
const matches = getUrlHostMatches(baseUrl);
|
|
150
|
-
const cached = matches.get(host);
|
|
151
|
-
if (cached !== void 0) return cached;
|
|
152
|
-
const spec = KNOWN_HOSTS[host];
|
|
153
|
-
for (const marker of spec.urlMarkers) if (includesAsciiCaseInsensitive(baseUrl, marker)) {
|
|
154
|
-
matches.set(host, true);
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
matches.set(host, false);
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
/** Provider-or-URL host check — the canonical `provider === id || baseUrl.includes(marker)` idiom. */
|
|
161
|
-
function modelMatchesHost(model, host) {
|
|
162
|
-
const spec = KNOWN_HOSTS[host];
|
|
163
|
-
if (spec.providers) {
|
|
164
|
-
for (const provider of spec.providers) if (model.provider === provider) return true;
|
|
165
|
-
}
|
|
166
|
-
if (spec.providerPrefixes) {
|
|
167
|
-
for (const prefix of spec.providerPrefixes) if (model.provider.startsWith(prefix)) return true;
|
|
168
|
-
}
|
|
169
|
-
return hostMatchesUrl(model.baseUrl, host);
|
|
170
|
-
}
|
|
171
|
-
function includesAsciiCaseInsensitive(value, lowerNeedle) {
|
|
172
|
-
const needleLength = lowerNeedle.length;
|
|
173
|
-
const end = value.length - needleLength;
|
|
174
|
-
for (let start = 0; start <= end; start++) {
|
|
175
|
-
let offset = 0;
|
|
176
|
-
for (; offset < needleLength; offset++) if ((value.charCodeAt(start + offset) | 32) !== lowerNeedle.charCodeAt(offset)) break;
|
|
177
|
-
if (offset === needleLength) return true;
|
|
178
|
-
}
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Hostname for a Vertex AI GenerateContent / rawPredict / OpenAI-compat
|
|
183
|
-
* request for the given location.
|
|
184
|
-
*
|
|
185
|
-
* - `global` → global endpoint (`aiplatform.googleapis.com`)
|
|
186
|
-
* - `eu` / `us` multi-regions → REP endpoints (`aiplatform.{eu|us}.rep.googleapis.com`)
|
|
187
|
-
* - every other location → regional (`{location}-aiplatform.googleapis.com`)
|
|
188
|
-
*
|
|
189
|
-
* Multi-region codes do NOT follow the regional `{location}-aiplatform` pattern;
|
|
190
|
-
* interpolating them that way yields hosts like `eu-aiplatform.googleapis.com`
|
|
191
|
-
* that 404.
|
|
192
|
-
*/
|
|
193
|
-
function resolveVertexEndpointHost(location) {
|
|
194
|
-
if (location === "global") return "aiplatform.googleapis.com";
|
|
195
|
-
if (location === "eu" || location === "us") return `aiplatform.${location}.rep.googleapis.com`;
|
|
196
|
-
return `${location}-aiplatform.googleapis.com`;
|
|
197
|
-
}
|
|
198
|
-
/** Vertex AI Anthropic raw-predict endpoints (`:streamRawPredict` / `:rawPredict`). */
|
|
199
|
-
function isVertexRawPredictUrl(baseUrl) {
|
|
200
|
-
return baseUrl.includes(":streamRawPredict") || baseUrl.includes(":rawPredict");
|
|
201
|
-
}
|
|
202
|
-
//#endregion
|
|
203
|
-
export { resolveVertexEndpointHost as i, isVertexRawPredictUrl as n, modelMatchesHost as r, hostMatchesUrl as t };
|
package/lib/id-AL5obQzR.mjs
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
-
__installBunShim();
|
|
3
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-catalog@18.1.17/node_modules/@oh-my-pi/pi-catalog/src/identity/id.ts
|
|
4
|
-
const LEADING_BRACKETED_AFFIX_PATTERN = /^(?:\s*(?:\[|【)[^\]】]+(?:\]|】)\s*)+/u;
|
|
5
|
-
const TRAILING_BRACKETED_AFFIX_PATTERN = /(?:\s*(?:\[|【)[^\]】]+(?:\]|】)\s*)+$/u;
|
|
6
|
-
/** Strip a provider namespace prefix (`openai/gpt-5.4` → `gpt-5.4`). */
|
|
7
|
-
const bareModelIdCache = /* @__PURE__ */ new Map();
|
|
8
|
-
function bareModelId(modelId) {
|
|
9
|
-
const cached = bareModelIdCache.get(modelId);
|
|
10
|
-
if (cached !== void 0) return cached;
|
|
11
|
-
const separator = modelId.lastIndexOf("/");
|
|
12
|
-
const result = separator === -1 ? modelId : modelId.slice(separator + 1);
|
|
13
|
-
bareModelIdCache.set(modelId, result);
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
const MODEL_ID_SEGMENT_PATTERN = /[a-z0-9.:-]+/g;
|
|
17
|
-
const MODEL_FAMILY_PREFIX_PATTERN = /^(claude|gemini|gpt|grok|glm|qwen|deepseek|kimi|mimo|doubao|ernie|gpt-oss|gemma|minimax|step|command|jamba|llama|o[1345])/i;
|
|
18
|
-
function normalizeModelIdWhitespace(value) {
|
|
19
|
-
return value.trim().replace(/\s+/g, " ");
|
|
20
|
-
}
|
|
21
|
-
/** Ordering for model-like segments: longest first, ties broken lexicographically. */
|
|
22
|
-
function compareSegmentPreference(left, right) {
|
|
23
|
-
return left.length !== right.length ? right.length - left.length : left.localeCompare(right);
|
|
24
|
-
}
|
|
25
|
-
function getModelLikeIdSegments(modelId) {
|
|
26
|
-
const matches = normalizeModelIdWhitespace(modelId).toLowerCase().match(MODEL_ID_SEGMENT_PATTERN);
|
|
27
|
-
if (!matches) return [];
|
|
28
|
-
const segments = /* @__PURE__ */ new Set();
|
|
29
|
-
for (const segment of matches) if (MODEL_FAMILY_PREFIX_PATTERN.test(segment) && /\d/.test(segment)) segments.add(segment);
|
|
30
|
-
return [...segments].sort(compareSegmentPreference);
|
|
31
|
-
}
|
|
32
|
-
function getLongestModelLikeIdSegment(modelId) {
|
|
33
|
-
const matches = normalizeModelIdWhitespace(modelId).toLowerCase().match(MODEL_ID_SEGMENT_PATTERN);
|
|
34
|
-
if (!matches) return void 0;
|
|
35
|
-
let best;
|
|
36
|
-
for (const segment of matches) if (MODEL_FAMILY_PREFIX_PATTERN.test(segment) && /\d/.test(segment) && (best === void 0 || compareSegmentPreference(segment, best) < 0)) best = segment;
|
|
37
|
-
return best;
|
|
38
|
-
}
|
|
39
|
-
function hasBracketAffixMarker(value) {
|
|
40
|
-
for (let index = 0; index < value.length; index++) {
|
|
41
|
-
const code = value.charCodeAt(index);
|
|
42
|
-
if (code === 91 || code === 93 || code === 12304 || code === 12305) return true;
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Strip reseller / wrapper tags that are injected as bracketed affixes around an
|
|
48
|
-
* upstream model id, e.g.
|
|
49
|
-
* "[Kiro] claude-opus-4-8" -> "claude-opus-4-8"
|
|
50
|
-
* "[gcli转] gemini-3.1-pro-preview [假流]" -> "gemini-3.1-pro-preview"
|
|
51
|
-
*
|
|
52
|
-
* Candidates are returned most-stripped first: both ends, then leading-only, then trailing-only.
|
|
53
|
-
*/
|
|
54
|
-
function getBracketStrippedModelIdCandidates(modelId) {
|
|
55
|
-
if (!hasBracketAffixMarker(modelId)) return [];
|
|
56
|
-
const normalized = normalizeModelIdWhitespace(modelId);
|
|
57
|
-
if (!normalized) return [];
|
|
58
|
-
const strippedLeading = normalized.replace(LEADING_BRACKETED_AFFIX_PATTERN, "");
|
|
59
|
-
const withoutLeading = normalizeModelIdWhitespace(strippedLeading);
|
|
60
|
-
const withoutTrailing = normalizeModelIdWhitespace(normalized.replace(TRAILING_BRACKETED_AFFIX_PATTERN, ""));
|
|
61
|
-
const withoutBoth = normalizeModelIdWhitespace(strippedLeading.replace(TRAILING_BRACKETED_AFFIX_PATTERN, ""));
|
|
62
|
-
const candidates = /* @__PURE__ */ new Set();
|
|
63
|
-
for (const candidate of [
|
|
64
|
-
withoutBoth,
|
|
65
|
-
withoutLeading,
|
|
66
|
-
withoutTrailing
|
|
67
|
-
]) if (candidate && candidate !== normalized) candidates.add(candidate);
|
|
68
|
-
return [...candidates];
|
|
69
|
-
}
|
|
70
|
-
//#endregion
|
|
71
|
-
export { getModelLikeIdSegments as i, getBracketStrippedModelIdCandidates as n, getLongestModelLikeIdSegment as r, bareModelId as t };
|