@xiaoso/dsh-tool-plus 0.1.0-beta.3 → 0.1.0-beta.4
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-D1_Z5Ut5.mjs +51 -0
- package/lib/abort-dIkZBV7Q.mjs +51 -0
- package/lib/amazon-bedrock-B0nxT06F.mjs +917 -0
- package/lib/amazon-bedrock-WQhvjHYu.mjs +917 -0
- package/lib/anthropic-CJCauvYz.mjs +3115 -0
- package/lib/anthropic-CZghe_9U.mjs +3115 -0
- package/lib/anthropic-sCMH7JID.mjs +262 -0
- package/lib/anthropic-tTntD8BD.mjs +262 -0
- package/lib/api-key-login-BzqNdM2y.mjs +157 -0
- package/lib/api-key-login-CWVwvHT1.mjs +157 -0
- package/lib/aws-credentials-CXryMobh.mjs +867 -0
- package/lib/aws-credentials-ChG79ey-.mjs +867 -0
- package/lib/azure-openai-responses-Cgmc-rbL.mjs +274 -0
- package/lib/azure-openai-responses-DuukbD0F.mjs +274 -0
- package/lib/bun-shim.mjs +81 -6
- package/lib/bundled-references-Cavaffah.mjs +55 -0
- package/lib/bundled-references-sLN0YdXU.mjs +55 -0
- package/lib/callback-server-CQ5Jo8F-.mjs +398 -0
- package/lib/callback-server-DDSrZ6l_.mjs +398 -0
- package/lib/client.js +1 -1
- package/lib/cursor-B3zg7EHj.mjs +273 -0
- package/lib/cursor-B6TUEmgP.mjs +135 -0
- package/lib/cursor-D8gvtTL3.mjs +135 -0
- package/lib/cursor-DkSX2h3H.mjs +5441 -0
- package/lib/cursor-aJrXeYCb.mjs +273 -0
- package/lib/cursor-mJQwUKXK.mjs +5441 -0
- package/lib/device-code-DBo3B5nh.mjs +51 -0
- package/lib/device-code-DIb0FU-H.mjs +51 -0
- package/lib/devin-BHZZyMhO.mjs +95 -0
- package/lib/devin-BK7DHeca.mjs +114 -0
- package/lib/devin-CfMp3cXS.mjs +95 -0
- package/lib/devin-D9zR5B_R.mjs +542 -0
- package/lib/devin-Q1yem3lp.mjs +114 -0
- package/lib/devin-vNZTNUON.mjs +542 -0
- package/lib/error-Dd8DIqs-.mjs +1449 -0
- package/lib/error-yCSG0mGC.mjs +1449 -0
- package/lib/event-stream-BbFZJy-z.mjs +151 -0
- package/lib/event-stream-loUa0s1T.mjs +151 -0
- package/lib/fs-promises-shim-Bx0fpxuk.mjs +57 -0
- package/lib/github-copilot-B1yiyVRh.mjs +104 -0
- package/lib/github-copilot-BWT3eAOF.mjs +208 -0
- package/lib/github-copilot-CYkjeTi3.mjs +208 -0
- package/lib/github-copilot-jscUZ8Hf.mjs +104 -0
- package/lib/gitlab-duo-CM7Ref1H.mjs +155 -0
- package/lib/gitlab-duo-gubO4FNw.mjs +155 -0
- package/lib/gitlab-duo-workflow-BGAF6JDw.mjs +91 -0
- package/lib/gitlab-duo-workflow-D78tdn8E.mjs +91 -0
- package/lib/google-BS4T25Pn.mjs +30 -0
- package/lib/google-TFe-7-of.mjs +30 -0
- package/lib/google-antigravity-DGmwC2KV.mjs +198 -0
- package/lib/google-antigravity-DNYhgTpA.mjs +198 -0
- package/lib/google-auth-B6gjsZvg.mjs +232 -0
- package/lib/google-auth-De7_s3eo.mjs +232 -0
- package/lib/google-gemini-cli-CWu8HvXW.mjs +211 -0
- package/lib/google-gemini-cli-Cb97bzQc.mjs +850 -0
- package/lib/google-gemini-cli-Cqds_Q5T.mjs +850 -0
- package/lib/google-gemini-cli-Dsztq0N5.mjs +211 -0
- package/lib/google-oauth-shared-CuEHaDDj.mjs +147 -0
- package/lib/google-oauth-shared-yqlyqPPC.mjs +147 -0
- package/lib/google-shared-CgKmmdO3.mjs +760 -0
- package/lib/google-shared-Dr-VG-ap.mjs +760 -0
- package/lib/google-vertex-BDN2tLaD.mjs +99 -0
- package/lib/google-vertex-DopVOQOG.mjs +99 -0
- package/lib/identity-Da1GPU9a.mjs +219 -0
- package/lib/identity-xRP7_eSR.mjs +219 -0
- package/lib/idle-iterator-Baoyn3Hp.mjs +366 -0
- package/lib/idle-iterator-DUjKQEGT.mjs +366 -0
- package/lib/index.mjs +1731 -1178
- package/lib/kimi--wUOWER5.mjs +236 -0
- package/lib/kimi-Dh0pv3WZ.mjs +236 -0
- package/lib/markit-BL3cH47U.mjs +1417 -0
- package/lib/markit-BNiNY6SE.mjs +1417 -0
- package/lib/minimax-code-DCbuA6Yk.mjs +53 -0
- package/lib/minimax-code-Uq8Qu9LW.mjs +53 -0
- package/lib/models-D_XnT6ay.mjs +104660 -0
- package/lib/models-SGASygJ3.mjs +104660 -0
- package/lib/ollama-DPzBmq89.mjs +589 -0
- package/lib/ollama-DoBz5SFm.mjs +589 -0
- package/lib/openai-codex-Bi-4S4PX.mjs +255 -0
- package/lib/openai-codex-Ch8CkT3p.mjs +255 -0
- package/lib/openai-codex-responses-CvxL_FMF.mjs +3144 -0
- package/lib/openai-codex-responses-pejZgdZo.mjs +3144 -0
- package/lib/openai-completions-CF8IyNtP.mjs +1360 -0
- package/lib/openai-completions-DIf361kF.mjs +1360 -0
- package/lib/openai-reasoning-fallback-Nj6yB2rY.mjs +286 -0
- package/lib/openai-reasoning-fallback-OdJREP1o.mjs +286 -0
- package/lib/openai-responses-BqXJInHX.mjs +867 -0
- package/lib/openai-responses-Db_a-U4-.mjs +867 -0
- package/lib/opencode-DhMolSoB.mjs +38 -0
- package/lib/opencode-Rq_Q2vAO.mjs +38 -0
- package/lib/perplexity-C4iLVMUj.mjs +194 -0
- package/lib/perplexity-Uu7Jzg5b.mjs +194 -0
- package/lib/proxy-DDqrmjjC.mjs +190 -0
- package/lib/proxy-pM_NIv-H.mjs +190 -0
- package/lib/request-debug-HJMoJncL.mjs +183 -0
- package/lib/sanitize-text-CfcXzw5X.mjs +33 -0
- package/lib/scrapers-BkFfcPHj.mjs +9198 -0
- package/lib/scrapers-CVptboMs.mjs +9198 -0
- package/lib/scrapers-nhQAvc8d.mjs +9198 -0
- package/lib/shell-snapshot-fn-env.sh +67 -43
- package/lib/src-BgpusnsB.mjs +5076 -0
- package/lib/src-lDmkSRbm.mjs +5006 -0
- package/lib/stream-BlldLkVq.mjs +10236 -0
- package/lib/stream-CRtexYLe.mjs +10236 -0
- package/lib/stream-markup-healing-DMsxBx1L.mjs +491 -0
- package/lib/stream-markup-healing-KMkiAA00.mjs +491 -0
- package/lib/turndown-DN7ByzEI.mjs +667 -0
- package/lib/types/config/settings.d.ts +9 -1
- package/lib/types/config/truncate.d.ts +9 -5
- package/lib/types/tools/bash/background.d.ts +1 -1
- package/lib/types/tools/bash/bash-executor.d.ts +4 -0
- package/lib/types/tools/bash/bash-interceptor.d.ts +10 -8
- package/lib/types/tools/bash/cd-workdir.d.ts +35 -0
- package/lib/types/tools/bash/non-interactive-env.d.ts +2 -0
- package/lib/types/tools/bash/render.d.ts +4 -3
- package/lib/types/tools/bash/sanitize-text.d.ts +5 -0
- package/lib/types/tools/bash/shell-snapshot.d.ts +4 -1
- package/lib/types/tools/bash/shell-tokenize.d.ts +60 -0
- package/lib/types/tools/bash/streaming-output.d.ts +12 -212
- package/lib/types/tools/bash/which.d.ts +20 -0
- package/lib/types/tools/bash/windows-shell.d.ts +31 -0
- package/lib/types/tools/edit/adapter/index.d.ts +25 -3
- package/lib/types/tools/edit/adapter/tools/auto-generated-guard.d.ts +7 -17
- package/lib/types/tools/glob/adapter/index.d.ts +27 -1
- package/lib/types/tools/grep/adapter/index.d.ts +29 -1
- package/lib/types/tools/omp/edit/dispatch.d.ts +43 -0
- package/lib/types/tools/omp/edit/hashline/noop-loop-guard.d.ts +3 -1
- package/lib/types/tools/omp/tools/auto-generated-guard.d.ts +20 -0
- package/lib/types/tools/omp/tools/write.d.ts +4 -4
- package/lib/types/tools/shared/auto-generated-guard.dsh.d.ts +16 -4
- package/lib/types/tools/shared/bun-shim.d.ts +4 -0
- package/lib/types/tools/shared/fs-promises-shim.d.ts +3 -1
- package/lib/types/tools/shared/omp-prompt.d.ts +13 -7
- package/lib/types/tools/shared/session-state.d.ts +9 -3
- package/lib/utils-Bw139LTz.mjs +8119 -0
- package/lib/utils-CZw4tVZQ.mjs +12315 -0
- package/lib/utils-CiGN7OHR.mjs +12315 -0
- package/lib/utils-Cp76gCyk.mjs +8119 -0
- package/lib/utils-D0GRDgAr.mjs +12315 -0
- package/lib/utils-D2YknRk4.mjs +51 -0
- package/lib/utils-DzXZDfYc.mjs +51 -0
- package/lib/vision-guard-01qSwFpf.mjs +92 -0
- package/lib/vision-guard-DzZGaOga.mjs +92 -0
- package/lib/wafer-CgtPHerf.mjs +17 -0
- package/lib/wafer-cBtrn6q9.mjs +17 -0
- package/lib/xai-oauth-Buk8XVvM.mjs +446 -0
- package/lib/xai-oauth-CMal8l1O.mjs +446 -0
- package/lib/xiaomi-CZgwvX2G.mjs +157 -0
- package/lib/xiaomi-D2qT5cAC.mjs +157 -0
- package/lib/zai-7DWMkEqM.mjs +203 -0
- package/lib/zai-C59YnomG.mjs +203 -0
- package/lib/zip-Cg9ANN_U.mjs +1316 -0
- package/lib/zip-D36ZKsP8.mjs +1316 -0
- package/package.json +1 -1
- package/presets/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { n as wrapFetchForExtraCa } from "./src-BgpusnsB.mjs";
|
|
4
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-catalog@17.3.5/node_modules/@oh-my-pi/pi-catalog/src/utils.ts
|
|
5
|
+
/**
|
|
6
|
+
* Fetch implementation for catalog discovery probes: the caller's override
|
|
7
|
+
* when given, otherwise global fetch wrapped for `NODE_EXTRA_CA_CERTS`.
|
|
8
|
+
*/
|
|
9
|
+
function discoveryFetch(override) {
|
|
10
|
+
return override ?? wrapFetchForExtraCa(fetch);
|
|
11
|
+
}
|
|
12
|
+
function toNumber(value) {
|
|
13
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
14
|
+
if (typeof value === "string" && value.trim()) {
|
|
15
|
+
const parsed = Number(value);
|
|
16
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function toPositiveNumber(value, fallback) {
|
|
20
|
+
const parsed = toNumber(value);
|
|
21
|
+
return parsed !== void 0 && parsed > 0 ? parsed : fallback;
|
|
22
|
+
}
|
|
23
|
+
function toBoolean(value) {
|
|
24
|
+
return typeof value === "boolean" ? value : void 0;
|
|
25
|
+
}
|
|
26
|
+
function isAnthropicOAuthToken(key) {
|
|
27
|
+
return key.includes("sk-ant-oat");
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Gateway author prefix ("OpenAI: ", "Z.ai: ", "Arcee AI: ") as emitted by
|
|
31
|
+
* aggregator catalogs (OpenRouter, Kilo, NanoGPT, ZenMux).
|
|
32
|
+
*/
|
|
33
|
+
const AUTHOR_PREFIX = /^[A-Za-z][A-Za-z0-9 .+&'-]{0,23}: /;
|
|
34
|
+
/**
|
|
35
|
+
* Model-extrinsic name decorations: alias markers ("(latest)"), provider
|
|
36
|
+
* attribution ("(Antigravity)"), price tiers ("($$$$)"), and promo/lifecycle
|
|
37
|
+
* tags ("(20% off)", "(retires Jun 5)"). Variant tags that map to distinct
|
|
38
|
+
* wire ids — "(Thinking)", "(free)", "(Fast)", dates, regions, sizes — stay.
|
|
39
|
+
*/
|
|
40
|
+
const NOISE_TAGS = /\s*\((?:latest|Antigravity|\$+|>?\d+% off|retires [^)]*)\)/g;
|
|
41
|
+
/**
|
|
42
|
+
* Normalize a model display name: drop the gateway author prefix and
|
|
43
|
+
* model-extrinsic decorations. Returns the input verbatim when nothing
|
|
44
|
+
* matches (or when stripping would leave an empty name).
|
|
45
|
+
*/
|
|
46
|
+
function cleanModelName(name) {
|
|
47
|
+
const cleaned = name.replace(AUTHOR_PREFIX, "").replace(NOISE_TAGS, "").replace(/ {2,}/g, " ").trim();
|
|
48
|
+
return cleaned.length > 0 ? cleaned : name;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { toNumber as a, toBoolean as i, discoveryFetch as n, toPositiveNumber as o, isAnthropicOAuthToken as r, cleanModelName as t };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { n as wrapFetchForExtraCa } from "./src-lDmkSRbm.mjs";
|
|
4
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-catalog@17.3.5/node_modules/@oh-my-pi/pi-catalog/src/utils.ts
|
|
5
|
+
/**
|
|
6
|
+
* Fetch implementation for catalog discovery probes: the caller's override
|
|
7
|
+
* when given, otherwise global fetch wrapped for `NODE_EXTRA_CA_CERTS`.
|
|
8
|
+
*/
|
|
9
|
+
function discoveryFetch(override) {
|
|
10
|
+
return override ?? wrapFetchForExtraCa(fetch);
|
|
11
|
+
}
|
|
12
|
+
function toNumber(value) {
|
|
13
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
14
|
+
if (typeof value === "string" && value.trim()) {
|
|
15
|
+
const parsed = Number(value);
|
|
16
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function toPositiveNumber(value, fallback) {
|
|
20
|
+
const parsed = toNumber(value);
|
|
21
|
+
return parsed !== void 0 && parsed > 0 ? parsed : fallback;
|
|
22
|
+
}
|
|
23
|
+
function toBoolean(value) {
|
|
24
|
+
return typeof value === "boolean" ? value : void 0;
|
|
25
|
+
}
|
|
26
|
+
function isAnthropicOAuthToken(key) {
|
|
27
|
+
return key.includes("sk-ant-oat");
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Gateway author prefix ("OpenAI: ", "Z.ai: ", "Arcee AI: ") as emitted by
|
|
31
|
+
* aggregator catalogs (OpenRouter, Kilo, NanoGPT, ZenMux).
|
|
32
|
+
*/
|
|
33
|
+
const AUTHOR_PREFIX = /^[A-Za-z][A-Za-z0-9 .+&'-]{0,23}: /;
|
|
34
|
+
/**
|
|
35
|
+
* Model-extrinsic name decorations: alias markers ("(latest)"), provider
|
|
36
|
+
* attribution ("(Antigravity)"), price tiers ("($$$$)"), and promo/lifecycle
|
|
37
|
+
* tags ("(20% off)", "(retires Jun 5)"). Variant tags that map to distinct
|
|
38
|
+
* wire ids — "(Thinking)", "(free)", "(Fast)", dates, regions, sizes — stay.
|
|
39
|
+
*/
|
|
40
|
+
const NOISE_TAGS = /\s*\((?:latest|Antigravity|\$+|>?\d+% off|retires [^)]*)\)/g;
|
|
41
|
+
/**
|
|
42
|
+
* Normalize a model display name: drop the gateway author prefix and
|
|
43
|
+
* model-extrinsic decorations. Returns the input verbatim when nothing
|
|
44
|
+
* matches (or when stripping would leave an empty name).
|
|
45
|
+
*/
|
|
46
|
+
function cleanModelName(name) {
|
|
47
|
+
const cleaned = name.replace(AUTHOR_PREFIX, "").replace(NOISE_TAGS, "").replace(/ {2,}/g, " ").trim();
|
|
48
|
+
return cleaned.length > 0 ? cleaned : name;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { toNumber as a, toBoolean as i, discoveryFetch as n, toPositiveNumber as o, isAnthropicOAuthToken as r, cleanModelName as t };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { M as isDashscopeCompatibleModeUrl, S as isQwenModelId, x as isOpenAIModelId } from "./models-SGASygJ3.mjs";
|
|
4
|
+
import "./identity-Da1GPU9a.mjs";
|
|
5
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/types.ts
|
|
6
|
+
/**
|
|
7
|
+
* Ceiling on the output-token count omp requests from any OpenAI-family endpoint
|
|
8
|
+
* (openai-responses, azure/xai responses, and openai-completions). Mirrors
|
|
9
|
+
* Anthropic's {@link CLAUDE_CODE_MAX_OUTPUT_TOKENS}.
|
|
10
|
+
*
|
|
11
|
+
* Catalog `maxTokens` frequently reflects a model's context window rather than a
|
|
12
|
+
* given upstream's real per-request output cap. OpenRouter, for instance,
|
|
13
|
+
* advertises 131072 output tokens for `z-ai/glm-4.7`, but the Cerebras upstream
|
|
14
|
+
* only allows ~131072 tokens total — so requesting the full ceiling overflows
|
|
15
|
+
* with a 400. Requested output is clamped to this value (and to `model.maxTokens`).
|
|
16
|
+
*/
|
|
17
|
+
const OPENAI_MAX_OUTPUT_TOKENS = 64e3;
|
|
18
|
+
function isOpenAIServiceTierApi(api) {
|
|
19
|
+
return api === "openai-completions" || api === "openai-responses" || api === "openai-codex-responses";
|
|
20
|
+
}
|
|
21
|
+
function excludesInferredOpenAIServiceTier(provider) {
|
|
22
|
+
return provider === "fireworks" || provider === "github-copilot";
|
|
23
|
+
}
|
|
24
|
+
function isOpenAIServiceTierModel(model) {
|
|
25
|
+
return !excludesInferredOpenAIServiceTier(model.provider) && isOpenAIServiceTierApi(model.api) && isOpenAIModelId(model.id);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* True when the tier should be sent on the wire as the provider's service-tier
|
|
29
|
+
* request field. `auto` is never forwarded — it is OpenAI's implicit default, so
|
|
30
|
+
* omitting `service_tier` is identical to requesting `auto`, and the Codex
|
|
31
|
+
* (ChatGPT OAuth) endpoint rejects an explicit `auto` outright. OpenAI /
|
|
32
|
+
* OpenAI-Codex accept every other {@link ServiceTier}; Google (Gemini API +
|
|
33
|
+
* Vertex) and OpenRouter accept `flex`/`priority`; Fireworks Serverless
|
|
34
|
+
* realizes only its Priority serving path. Anthropic is absent because it
|
|
35
|
+
* realizes `priority` via `speed: "fast"`.
|
|
36
|
+
*/
|
|
37
|
+
function shouldSendServiceTier(serviceTier, target) {
|
|
38
|
+
if (!serviceTier || serviceTier === "auto") return false;
|
|
39
|
+
const provider = typeof target === "string" ? target : target?.provider;
|
|
40
|
+
if (provider === "openai" || provider === "openai-codex") return true;
|
|
41
|
+
if (provider === "openrouter") return serviceTier === "flex" || serviceTier === "scale" || serviceTier === "priority";
|
|
42
|
+
if (typeof target !== "string" && target && isOpenAIServiceTierModel(target)) return true;
|
|
43
|
+
if (provider === "google") return serviceTier === "flex" || serviceTier === "priority";
|
|
44
|
+
if (provider === "google-vertex" || provider === "fireworks") return serviceTier === "priority";
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/providers/vision-guard.ts
|
|
49
|
+
const NON_VISION_IMAGE_PLACEHOLDER = "[image omitted: model does not support vision]";
|
|
50
|
+
function partitionVisionContent(content, supportsImages) {
|
|
51
|
+
const textBlocks = content.filter((block) => block.type === "text");
|
|
52
|
+
const imageBlocks = content.filter((block) => block.type === "image");
|
|
53
|
+
return {
|
|
54
|
+
textBlocks,
|
|
55
|
+
imageBlocks: supportsImages ? imageBlocks : [],
|
|
56
|
+
omittedImages: !supportsImages && imageBlocks.length > 0
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function joinTextWithImagePlaceholder(text, omittedImages) {
|
|
60
|
+
const parts = [];
|
|
61
|
+
if (text.length > 0) parts.push(text);
|
|
62
|
+
if (omittedImages) parts.push(NON_VISION_IMAGE_PLACEHOLDER);
|
|
63
|
+
return parts.join("\n");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Detect known text-only Qwen models served via Alibaba DashScope's consumer
|
|
67
|
+
* `compatible-mode` endpoint that the upstream chat-completions API rejects
|
|
68
|
+
* multimodal content arrays for. The compatible-mode endpoint also serves
|
|
69
|
+
* multimodal Qwen SKUs without `vl` in the id (e.g. `qwen3.7-plus`), so this
|
|
70
|
+
* guard only covers families verified to be text-only for issue #1859:
|
|
71
|
+
* `qwen*-coder*` and `qwen*-max` up to and including `qwen3.7-max`.
|
|
72
|
+
*
|
|
73
|
+
* Qwen-Max became multimodal at `qwen3.8-max` (image input, issue #8019), so
|
|
74
|
+
* `-max` SKUs at version 3.8 or newer are excluded — otherwise the override
|
|
75
|
+
* would strip images from a genuinely vision-capable flagship (issue #8305).
|
|
76
|
+
*
|
|
77
|
+
* Used as a defensive override in `convertMessages` so a misconfigured custom
|
|
78
|
+
* provider (issue #1859) can't drive the request into an unrecoverable 400.
|
|
79
|
+
*/
|
|
80
|
+
function isDashscopeCompatibleModeTextOnlyQwen(model) {
|
|
81
|
+
if (!isDashscopeCompatibleModeUrl(model.baseUrl)) return false;
|
|
82
|
+
if (!isQwenModelId(model.id)) return false;
|
|
83
|
+
const id = model.id.toLowerCase();
|
|
84
|
+
if (/\bqwen(?:[\d.]+)?-coder\b/.test(id)) return true;
|
|
85
|
+
const maxMatch = id.match(/\bqwen(?:(\d+)(?:\.(\d+))?)?-max\b/);
|
|
86
|
+
if (!maxMatch) return false;
|
|
87
|
+
const major = maxMatch[1] ? Number.parseInt(maxMatch[1], 10) : 0;
|
|
88
|
+
const minor = maxMatch[2] ? Number.parseInt(maxMatch[2], 10) : 0;
|
|
89
|
+
return major < 3 || major === 3 && minor < 8;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { OPENAI_MAX_OUTPUT_TOKENS as a, partitionVisionContent as i, isDashscopeCompatibleModeTextOnlyQwen as n, shouldSendServiceTier as o, joinTextWithImagePlaceholder as r, NON_VISION_IMAGE_PLACEHOLDER as t };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { M as isDashscopeCompatibleModeUrl, S as isQwenModelId, x as isOpenAIModelId } from "./models-D_XnT6ay.mjs";
|
|
4
|
+
import "./identity-xRP7_eSR.mjs";
|
|
5
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/types.ts
|
|
6
|
+
/**
|
|
7
|
+
* Ceiling on the output-token count omp requests from any OpenAI-family endpoint
|
|
8
|
+
* (openai-responses, azure/xai responses, and openai-completions). Mirrors
|
|
9
|
+
* Anthropic's {@link CLAUDE_CODE_MAX_OUTPUT_TOKENS}.
|
|
10
|
+
*
|
|
11
|
+
* Catalog `maxTokens` frequently reflects a model's context window rather than a
|
|
12
|
+
* given upstream's real per-request output cap. OpenRouter, for instance,
|
|
13
|
+
* advertises 131072 output tokens for `z-ai/glm-4.7`, but the Cerebras upstream
|
|
14
|
+
* only allows ~131072 tokens total — so requesting the full ceiling overflows
|
|
15
|
+
* with a 400. Requested output is clamped to this value (and to `model.maxTokens`).
|
|
16
|
+
*/
|
|
17
|
+
const OPENAI_MAX_OUTPUT_TOKENS = 64e3;
|
|
18
|
+
function isOpenAIServiceTierApi(api) {
|
|
19
|
+
return api === "openai-completions" || api === "openai-responses" || api === "openai-codex-responses";
|
|
20
|
+
}
|
|
21
|
+
function excludesInferredOpenAIServiceTier(provider) {
|
|
22
|
+
return provider === "fireworks" || provider === "github-copilot";
|
|
23
|
+
}
|
|
24
|
+
function isOpenAIServiceTierModel(model) {
|
|
25
|
+
return !excludesInferredOpenAIServiceTier(model.provider) && isOpenAIServiceTierApi(model.api) && isOpenAIModelId(model.id);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* True when the tier should be sent on the wire as the provider's service-tier
|
|
29
|
+
* request field. `auto` is never forwarded — it is OpenAI's implicit default, so
|
|
30
|
+
* omitting `service_tier` is identical to requesting `auto`, and the Codex
|
|
31
|
+
* (ChatGPT OAuth) endpoint rejects an explicit `auto` outright. OpenAI /
|
|
32
|
+
* OpenAI-Codex accept every other {@link ServiceTier}; Google (Gemini API +
|
|
33
|
+
* Vertex) and OpenRouter accept `flex`/`priority`; Fireworks Serverless
|
|
34
|
+
* realizes only its Priority serving path. Anthropic is absent because it
|
|
35
|
+
* realizes `priority` via `speed: "fast"`.
|
|
36
|
+
*/
|
|
37
|
+
function shouldSendServiceTier(serviceTier, target) {
|
|
38
|
+
if (!serviceTier || serviceTier === "auto") return false;
|
|
39
|
+
const provider = typeof target === "string" ? target : target?.provider;
|
|
40
|
+
if (provider === "openai" || provider === "openai-codex") return true;
|
|
41
|
+
if (provider === "openrouter") return serviceTier === "flex" || serviceTier === "scale" || serviceTier === "priority";
|
|
42
|
+
if (typeof target !== "string" && target && isOpenAIServiceTierModel(target)) return true;
|
|
43
|
+
if (provider === "google") return serviceTier === "flex" || serviceTier === "priority";
|
|
44
|
+
if (provider === "google-vertex" || provider === "fireworks") return serviceTier === "priority";
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/providers/vision-guard.ts
|
|
49
|
+
const NON_VISION_IMAGE_PLACEHOLDER = "[image omitted: model does not support vision]";
|
|
50
|
+
function partitionVisionContent(content, supportsImages) {
|
|
51
|
+
const textBlocks = content.filter((block) => block.type === "text");
|
|
52
|
+
const imageBlocks = content.filter((block) => block.type === "image");
|
|
53
|
+
return {
|
|
54
|
+
textBlocks,
|
|
55
|
+
imageBlocks: supportsImages ? imageBlocks : [],
|
|
56
|
+
omittedImages: !supportsImages && imageBlocks.length > 0
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function joinTextWithImagePlaceholder(text, omittedImages) {
|
|
60
|
+
const parts = [];
|
|
61
|
+
if (text.length > 0) parts.push(text);
|
|
62
|
+
if (omittedImages) parts.push(NON_VISION_IMAGE_PLACEHOLDER);
|
|
63
|
+
return parts.join("\n");
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Detect known text-only Qwen models served via Alibaba DashScope's consumer
|
|
67
|
+
* `compatible-mode` endpoint that the upstream chat-completions API rejects
|
|
68
|
+
* multimodal content arrays for. The compatible-mode endpoint also serves
|
|
69
|
+
* multimodal Qwen SKUs without `vl` in the id (e.g. `qwen3.7-plus`), so this
|
|
70
|
+
* guard only covers families verified to be text-only for issue #1859:
|
|
71
|
+
* `qwen*-coder*` and `qwen*-max` up to and including `qwen3.7-max`.
|
|
72
|
+
*
|
|
73
|
+
* Qwen-Max became multimodal at `qwen3.8-max` (image input, issue #8019), so
|
|
74
|
+
* `-max` SKUs at version 3.8 or newer are excluded — otherwise the override
|
|
75
|
+
* would strip images from a genuinely vision-capable flagship (issue #8305).
|
|
76
|
+
*
|
|
77
|
+
* Used as a defensive override in `convertMessages` so a misconfigured custom
|
|
78
|
+
* provider (issue #1859) can't drive the request into an unrecoverable 400.
|
|
79
|
+
*/
|
|
80
|
+
function isDashscopeCompatibleModeTextOnlyQwen(model) {
|
|
81
|
+
if (!isDashscopeCompatibleModeUrl(model.baseUrl)) return false;
|
|
82
|
+
if (!isQwenModelId(model.id)) return false;
|
|
83
|
+
const id = model.id.toLowerCase();
|
|
84
|
+
if (/\bqwen(?:[\d.]+)?-coder\b/.test(id)) return true;
|
|
85
|
+
const maxMatch = id.match(/\bqwen(?:(\d+)(?:\.(\d+))?)?-max\b/);
|
|
86
|
+
if (!maxMatch) return false;
|
|
87
|
+
const major = maxMatch[1] ? Number.parseInt(maxMatch[1], 10) : 0;
|
|
88
|
+
const minor = maxMatch[2] ? Number.parseInt(maxMatch[2], 10) : 0;
|
|
89
|
+
return major < 3 || major === 3 && minor < 8;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { OPENAI_MAX_OUTPUT_TOKENS as a, partitionVisionContent as i, isDashscopeCompatibleModeTextOnlyQwen as n, shouldSendServiceTier as o, joinTextWithImagePlaceholder as r, NON_VISION_IMAGE_PLACEHOLDER as t };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { t as createApiKeyLogin } from "./api-key-login-BzqNdM2y.mjs";
|
|
4
|
+
const loginWaferServerless = createApiKeyLogin({
|
|
5
|
+
providerLabel: "Wafer Serverless",
|
|
6
|
+
authUrl: "https://app.wafer.ai/usage",
|
|
7
|
+
instructions: "Create or copy your Wafer Serverless API key from the Wafer dashboard",
|
|
8
|
+
promptMessage: "Paste your Wafer Serverless API key",
|
|
9
|
+
placeholder: "wfr_...",
|
|
10
|
+
validation: {
|
|
11
|
+
kind: "models-endpoint",
|
|
12
|
+
provider: "Wafer Serverless",
|
|
13
|
+
modelsUrl: "https://pass.wafer.ai/v1/models"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { loginWaferServerless };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { t as createApiKeyLogin } from "./api-key-login-CWVwvHT1.mjs";
|
|
4
|
+
const loginWaferServerless = createApiKeyLogin({
|
|
5
|
+
providerLabel: "Wafer Serverless",
|
|
6
|
+
authUrl: "https://app.wafer.ai/usage",
|
|
7
|
+
instructions: "Create or copy your Wafer Serverless API key from the Wafer dashboard",
|
|
8
|
+
promptMessage: "Paste your Wafer Serverless API key",
|
|
9
|
+
placeholder: "wfr_...",
|
|
10
|
+
validation: {
|
|
11
|
+
kind: "models-endpoint",
|
|
12
|
+
provider: "Wafer Serverless",
|
|
13
|
+
modelsUrl: "https://pass.wafer.ai/v1/models"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { loginWaferServerless };
|