@xiaoso/dsh-tool-plus 0.1.5 → 0.1.7-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/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +9 -3
- package/lib/{abort-Cwwm4Err.mjs → abort-Caqff3M6.mjs} +2 -2
- package/lib/alibaba-coding-plan-DTupMiAi.mjs +73 -0
- package/lib/alibaba-token-plan-CHGyWOfX.mjs +46 -0
- package/lib/alibaba-token-plan-Dj3OZhEE.mjs +82 -0
- package/lib/{amazon-bedrock-TVMpUTRG.mjs → amazon-bedrock-DbFSYXfJ.mjs} +117 -38
- package/lib/{anthropic-BL6LFDQS.mjs → anthropic-CTJ3IQVa.mjs} +675 -166
- package/lib/anthropic-CXfWlp-x.mjs +105 -0
- package/lib/{aws-credentials-B20dliS7.mjs → anthropic-wire-CKuhDwZ1.mjs} +74 -14
- package/lib/{api-key-login-CIDnXeYd.mjs → api-key-validation-CGCJFbFr.mjs} +27 -68
- package/lib/{azure-openai-responses-BkhsLmN3.mjs → azure-openai-responses-ChFbWaGj.mjs} +27 -16
- package/lib/{browser-render-CmgvSNte.mjs → browser-render-9o0Rknop.mjs} +4 -4
- package/lib/bun-shim.mjs +71 -2
- package/lib/{bundled-references-ChZSPDFw.mjs → bundled-references-DY3EJxZV.mjs} +6 -5
- package/lib/cline-pass-Bwg3esu9.mjs +44 -0
- package/lib/cloudflare-ai-gateway-BupNXyKK.mjs +35 -0
- package/lib/cloudflare-ai-gateway-EWo0VkP5.mjs +44 -0
- package/lib/collapse-DOR8sOGf.mjs +2304 -0
- package/lib/coreweave-C82HrLpb.mjs +31 -0
- package/lib/coreweave-Ct8cF-da.mjs +14 -0
- package/lib/{cursor-B6HcmplF.mjs → cursor-B95LzVWV.mjs} +11 -3
- package/lib/{cursor-CRpLpaZ3.mjs → cursor-DJV_dcgB.mjs} +887 -1784
- package/lib/{cursor-B8m6SqAH.mjs → cursor-LKGjucn2.mjs} +48 -38
- package/lib/cursor-proto-B8Wj8bv9.mjs +10513 -0
- package/lib/{deterministic-id-D-yIV_eI.mjs → deterministic-id-CUEIMSqR.mjs} +1 -1
- package/lib/devin-BMTdx_hx.mjs +316 -0
- package/lib/{devin-DUAfvBsW.mjs → devin-DSp0Rw_E.mjs} +172 -86
- package/lib/devin-ExGIghmx.mjs +69 -0
- package/lib/devin-proto-Br8fdyNl.mjs +2888 -0
- package/lib/{dom-CawWi8fa.mjs → dom-DG3sPESc.mjs} +8 -8
- package/lib/effort-BdtQMN-_.mjs +23 -0
- package/lib/{error-C-f_Wnw4.mjs → error-CORgGg5a.mjs} +275 -154
- package/lib/{event-stream-Dh2guZxS.mjs → event-stream-ulcDenZD.mjs} +20 -4
- package/lib/{gemini-headers-DKUShltF.mjs → gemini-headers-Co9cVvex.mjs} +2 -2
- package/lib/{github-copilot-suDymKrx.mjs → github-copilot-Dstq1D3s.mjs} +69 -29
- package/lib/github-copilot-headers-DOh1gt_w.mjs +312 -0
- package/lib/gitlab-duo-DSCMrU0m.mjs +11 -0
- package/lib/google-CtsKkOQK.mjs +38 -0
- package/lib/google-antigravity-z-5KsEci.mjs +252 -0
- package/lib/{google-auth-DYJLM792.mjs → google-auth-ieLBaneO.mjs} +4 -4
- package/lib/{google-gemini-cli-8BT513Ul.mjs → google-gemini-cli-C6NE5mWz.mjs} +28 -54
- package/lib/{google-gemini-cli-D6cSmfvB.mjs → google-gemini-cli-CAIPSl7e.mjs} +23 -29
- package/lib/google-oauth-shared-DhMllAkt.mjs +53 -0
- package/lib/{google-shared-CVbHK5vZ.mjs → google-shared-B0aNCYEH.mjs} +140 -44
- package/lib/{google-validation-Cgbn3tWJ.mjs → google-validation-BEkNs-Bx.mjs} +1 -1
- package/lib/{google-vertex-Bui-ypAe.mjs → google-vertex-Bbd1tYNc.mjs} +8 -8
- package/lib/hosts-00rjRzUD.mjs +203 -0
- package/lib/id-AL5obQzR.mjs +71 -0
- package/lib/{idle-iterator-CYAxUkSD.mjs → idle-iterator-DlUkEfzW.mjs} +3 -3
- package/lib/index.mjs +587 -5266
- package/lib/kilo-ChJL54wq.mjs +81 -0
- package/lib/kimi-C2c_Zq8A.mjs +67 -0
- package/lib/{launch-BmgEUycu.mjs → launch-DKDH71En.mjs} +1 -1
- package/lib/markit-CmRfm4E2.mjs +9885 -0
- package/lib/models-DnXMYGcJ.mjs +381604 -0
- package/lib/muse-code-Di1VZmB1.mjs +143 -0
- package/lib/{ollama-Df9ce-Cp.mjs → ollama-B8ic3sEp.mjs} +15 -30
- package/lib/{openai-codex-CAVI3Me-.mjs → openai-codex-DuJNC99x.mjs} +29 -99
- package/lib/{openai-codex-responses-BcnOotRB.mjs → openai-codex-responses-BL29nh9K.mjs} +204 -116
- package/lib/{openai-completions-Bq4WT47M.mjs → openai-completions-BK2f2dBv.mjs} +152 -82
- package/lib/openai-configuration-update-xMYUjaK_.mjs +150 -0
- package/lib/{openai-reasoning-fallback-DXsfiSXO.mjs → openai-reasoning-fallback-BdB3RCbj.mjs} +106 -12
- package/lib/{openai-responses-Mq_-PjvE.mjs → openai-responses-CGQPlIIy.mjs} +76 -82
- package/lib/{perplexity-XgLF73E7.mjs → perplexity-TBjz3VMB.mjs} +52 -9
- package/lib/{pkce-BlQikGPu.mjs → pkce-BYjmugmw.mjs} +1 -1
- package/lib/protobuf-aab1UGVn.mjs +717 -0
- package/lib/{provider-response-C6vcbQyO.mjs → provider-response-SqKSkkUc.mjs} +1 -1
- package/lib/{proxy-D9lm7ONA.mjs → proxy-5nWqRL1f.mjs} +45 -5
- package/lib/{readability-Cpm-ocau.mjs → readability-uGhqb4GC.mjs} +2 -2
- package/lib/reference-CtvM4zLU.mjs +114 -0
- package/lib/{request-debug-HJMoJncL.mjs → request-debug-NQN0BjHH.mjs} +1 -1
- package/lib/{sanitize-text-CfcXzw5X.mjs → sanitize-text-BCf5KmCf.mjs} +1 -1
- package/lib/{scrapers-CE_qK1yk.mjs → scrapers-D8oWspgW.mjs} +12 -12
- package/lib/{src-BcD0_rQR.mjs → src-BwW51vA5.mjs} +979 -388
- package/lib/{sse-debug-CYdjOC96.mjs → sse-debug-B-tkLCPW.mjs} +1 -1
- package/lib/{stream-Bjq8wjfr.mjs → stream-B_7qN-bA.mjs} +3802 -2623
- package/lib/stream-markup-healing-DKT1lnkW.mjs +267 -0
- package/lib/{strict-tool-validation-imVLUcbI.mjs → strict-tool-validation-CBTz1dAA.mjs} +2 -2
- package/lib/taxonomy-DSIM99rS.mjs +15392 -0
- package/lib/{stream-markup-healing-DZ6bVDxH.mjs → thinking-CiLa2LFB.mjs} +31 -186
- package/lib/{turndown-DN7ByzEI.mjs → turndown-DrX1M4WG.mjs} +4 -4
- package/lib/{type-guards-B9VVjRDK.mjs → type-guards-CttAANEx.mjs} +1 -1
- package/lib/{types-DX_bvuus.mjs → types-PVueGi9S.mjs} +2 -2
- package/lib/{utils-APrc-TBB.mjs → utils-CCfhUQen.mjs} +2364 -2676
- package/lib/{utils-Cp2Mxf_U.mjs → utils-CUPhpw9A.mjs} +413 -134
- package/lib/{utils-CQHPEQ3W.mjs → utils-DeWqNWV8.mjs} +2 -2
- package/lib/{vision-guard-mBmtAHx0.mjs → vision-guard-_XwsL1DF.mjs} +14 -29
- package/lib/xai-oauth-CXhnz0gO.mjs +210 -0
- package/lib/{xiaomi-7mE345KX.mjs → xiaomi-psoUItal.mjs} +8 -37
- package/lib/{zai-CeNpMV3W.mjs → zai-ApJ8HBgT.mjs} +8 -71
- package/lib/{zip-BK7UHCwX.mjs → zip-Kd602XNe.mjs} +1 -1
- package/package.json +43 -41
- package/presets/package.json +1 -1
- package/presets/tool-plus-ptc/agent.cordis.yml +13 -4
- package/presets/tool-plus-standard/agent.cordis.yml +11 -3
- package/lib/agent_pb-Rizyt9Zg.mjs +0 -805
- package/lib/anthropic-CDmj476p.mjs +0 -262
- package/lib/api_server_pb-CDZgLMta.mjs +0 -252
- package/lib/callback-server-CFJK-jvK.mjs +0 -398
- package/lib/codex-P1dGpX7G.mjs +0 -54
- package/lib/device-code-CuXTWYwY.mjs +0 -51
- package/lib/devin-BcQwht1W.mjs +0 -114
- package/lib/devin-BvMfGevz.mjs +0 -95
- package/lib/github-copilot-B3kQl0g0.mjs +0 -104
- package/lib/gitlab-duo-BriUTP8k.mjs +0 -155
- package/lib/gitlab-duo-workflow-wK5Ljzmc.mjs +0 -91
- package/lib/google-CE5tFDod.mjs +0 -30
- package/lib/google-antigravity-C1jgNljz.mjs +0 -198
- package/lib/google-oauth-shared-BLVTvokk.mjs +0 -147
- package/lib/grammar-D-NqNUxQ.mjs +0 -49
- package/lib/identity-HNO1Oe9B.mjs +0 -219
- package/lib/kimi-DgcUpPtK.mjs +0 -236
- package/lib/markit-DtGoRE6M.mjs +0 -1417
- package/lib/minimax-code-Y3h5li9N.mjs +0 -53
- package/lib/models-DRA2c_8U.mjs +0 -104660
- package/lib/opencode-BsVw9rCD.mjs +0 -38
- package/lib/to-binary-B1BEBIPC.mjs +0 -6002
- package/lib/wafer-BlhWLweO.mjs +0 -17
- package/lib/xai-oauth-5pORHUrg.mjs +0 -446
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
3
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/utils/provider-response.ts
|
|
4
4
|
function normalizeProviderResponse(response, requestId, metadata) {
|
|
5
5
|
const headers = {};
|
|
6
6
|
response.headers.forEach((value, key) => {
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import {
|
|
3
|
+
import { b as debug } from "./src-BwW51vA5.mjs";
|
|
4
|
+
import { _ as AbortError, n as StreamTimeoutError, r as ValidationError } from "./error-CORgGg5a.mjs";
|
|
4
5
|
import * as tls from "node:tls";
|
|
5
6
|
import * as net from "node:net";
|
|
6
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
7
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/utils/proxy.ts
|
|
8
|
+
/**
|
|
9
|
+
* Host:port of a proxy URL for logging. Proxy URLs can carry basic-auth
|
|
10
|
+
* credentials, so never log the raw value.
|
|
11
|
+
*/
|
|
12
|
+
function proxyLogTarget(proxyUrl) {
|
|
13
|
+
try {
|
|
14
|
+
return new URL(proxyUrl).host;
|
|
15
|
+
} catch {
|
|
16
|
+
return "<unparseable>";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
7
19
|
/**
|
|
8
20
|
* Checks if a host is local or cloud metadata, which should always bypass the proxy
|
|
9
21
|
* (e.g. localhost, 127/8, ::1, 169.254.169.254, metadata.google.internal).
|
|
@@ -71,6 +83,11 @@ function getProxyForProvider(provider) {
|
|
|
71
83
|
const envKey = `PI_PROXY_${provider.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`;
|
|
72
84
|
const value = Bun.env[envKey] || Bun.env.PI_PROXY;
|
|
73
85
|
proxyCache.set(provider, value);
|
|
86
|
+
debug("provider proxy resolved", {
|
|
87
|
+
provider,
|
|
88
|
+
source: Bun.env[envKey] ? envKey : value ? "PI_PROXY" : "none",
|
|
89
|
+
proxy: value ? proxyLogTarget(value) : void 0
|
|
90
|
+
});
|
|
74
91
|
return value;
|
|
75
92
|
}
|
|
76
93
|
/** Resolves provider-specific and standard proxy variables for a target URL, honoring NO_PROXY. */
|
|
@@ -94,7 +111,6 @@ async function connectProxiedSocket(proxyUrlStr, targetUrlStr, options) {
|
|
|
94
111
|
const targetHost = targetUrl.hostname;
|
|
95
112
|
const { promise, resolve, reject } = Promise.withResolvers();
|
|
96
113
|
const readyEvent = useProxySsl ? "secureConnect" : "connect";
|
|
97
|
-
let rawSocket;
|
|
98
114
|
let tunnelSocket;
|
|
99
115
|
let timeout;
|
|
100
116
|
let responseData = "";
|
|
@@ -120,6 +136,12 @@ async function connectProxiedSocket(proxyUrlStr, targetUrlStr, options) {
|
|
|
120
136
|
settled = true;
|
|
121
137
|
cleanup();
|
|
122
138
|
destroyInProgress();
|
|
139
|
+
debug("proxy tunnel failed", {
|
|
140
|
+
proxy: `${proxyHost}:${proxyPort}`,
|
|
141
|
+
target: `${targetHost}:${targetPort}`,
|
|
142
|
+
error: String(error),
|
|
143
|
+
code: "code" in error ? String(error.code) : void 0
|
|
144
|
+
});
|
|
123
145
|
reject(error);
|
|
124
146
|
};
|
|
125
147
|
const resolveOnce = (socket) => {
|
|
@@ -133,6 +155,14 @@ async function connectProxiedSocket(proxyUrlStr, targetUrlStr, options) {
|
|
|
133
155
|
const onTunnelError = (error) => rejectOnce(error);
|
|
134
156
|
const onTunnelReady = () => {
|
|
135
157
|
if (!tunnelSocket) return;
|
|
158
|
+
debug("proxy tunnel established", {
|
|
159
|
+
proxy: `${proxyHost}:${proxyPort}`,
|
|
160
|
+
target: `${targetHost}:${targetPort}`,
|
|
161
|
+
peer: `${rawSocket?.remoteAddress ?? "?"}:${rawSocket?.remotePort ?? "?"}`,
|
|
162
|
+
localPort: rawSocket?.localPort,
|
|
163
|
+
alpn: tunnelSocket.alpnProtocol,
|
|
164
|
+
authorized: tunnelSocket.authorized
|
|
165
|
+
});
|
|
136
166
|
resolveOnce(tunnelSocket);
|
|
137
167
|
};
|
|
138
168
|
const onProxyData = (chunk) => {
|
|
@@ -142,6 +172,11 @@ async function connectProxiedSocket(proxyUrlStr, targetUrlStr, options) {
|
|
|
142
172
|
rawSocket.off("data", onProxyData);
|
|
143
173
|
rawSocket.off("error", onRawError);
|
|
144
174
|
const firstLine = responseData.split("\r\n")[0];
|
|
175
|
+
debug("proxy tunnel CONNECT reply", {
|
|
176
|
+
proxy: `${proxyHost}:${proxyPort}`,
|
|
177
|
+
target: `${targetHost}:${targetPort}`,
|
|
178
|
+
reply: firstLine
|
|
179
|
+
});
|
|
145
180
|
if (!firstLine.includes(" 200 ")) {
|
|
146
181
|
rejectOnce(new ValidationError(`Proxy tunnel failed: ${firstLine}`));
|
|
147
182
|
return;
|
|
@@ -166,6 +201,11 @@ async function connectProxiedSocket(proxyUrlStr, targetUrlStr, options) {
|
|
|
166
201
|
connectReq += "\r\n";
|
|
167
202
|
rawSocket.write(connectReq);
|
|
168
203
|
rawSocket.on("data", onProxyData);
|
|
204
|
+
debug("proxy tunnel CONNECT sent", {
|
|
205
|
+
proxy: `${proxyHost}:${proxyPort}`,
|
|
206
|
+
target: `${targetHost}:${targetPort}`,
|
|
207
|
+
peer: `${rawSocket.remoteAddress ?? "?"}:${rawSocket.remotePort ?? "?"}`
|
|
208
|
+
});
|
|
169
209
|
};
|
|
170
210
|
options?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
171
211
|
if (options?.timeoutMs !== void 0 && Number.isFinite(options.timeoutMs) && options.timeoutMs > 0) {
|
|
@@ -175,7 +215,7 @@ async function connectProxiedSocket(proxyUrlStr, targetUrlStr, options) {
|
|
|
175
215
|
}, timeoutMs);
|
|
176
216
|
timeout.unref?.();
|
|
177
217
|
}
|
|
178
|
-
rawSocket = useProxySsl ? tls.connect({
|
|
218
|
+
const rawSocket = useProxySsl ? tls.connect({
|
|
179
219
|
host: proxyHost,
|
|
180
220
|
port: proxyPort
|
|
181
221
|
}) : net.connect({
|
|
@@ -187,4 +227,4 @@ async function connectProxiedSocket(proxyUrlStr, targetUrlStr, options) {
|
|
|
187
227
|
return promise;
|
|
188
228
|
}
|
|
189
229
|
//#endregion
|
|
190
|
-
export {
|
|
230
|
+
export { getProxyForUrl as n, isLocalOrMetadataHost as r, connectProxiedSocket as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@
|
|
3
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@18.1.17/node_modules/@oh-my-pi/pi-utils/src/readability/readability.ts
|
|
4
4
|
const UNLIKELY$1 = /-ad-|ai2html|banner|breadcrumbs|comment|community|combx|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup/i;
|
|
5
5
|
const POSSIBLE$1 = /and|article|body|column|content|main|shadow/i;
|
|
6
6
|
const POSITIVE = /article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i;
|
|
@@ -423,7 +423,7 @@ var Readability = class {
|
|
|
423
423
|
}
|
|
424
424
|
};
|
|
425
425
|
//#endregion
|
|
426
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@
|
|
426
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@18.1.17/node_modules/@oh-my-pi/pi-utils/src/readability/readerable.ts
|
|
427
427
|
const UNLIKELY = /-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|footer|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i;
|
|
428
428
|
const POSSIBLE = /and|article|body|column|content|main|shadow/i;
|
|
429
429
|
/** Estimates whether a document contains enough prose for article extraction. */
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { a as discoveryVocabulary, i as collapseVocabulary } from "./taxonomy-DSIM99rS.mjs";
|
|
4
|
+
import { i as getModelLikeIdSegments, n as getBracketStrippedModelIdCandidates, r as getLongestModelLikeIdSegment } from "./id-AL5obQzR.mjs";
|
|
5
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-catalog@18.1.17/node_modules/@oh-my-pi/pi-catalog/src/identity/reference.ts
|
|
6
|
+
/**
|
|
7
|
+
* Proxy/reseller reference lookup: given a custom model id served through a
|
|
8
|
+
* proxy (`[Kiro] claude-opus-4-8`, `gpt-5.4:cloud`, `vendor/claude-sonnet-4-6-thinking`),
|
|
9
|
+
* find the bundled upstream model so missing pricing/capability metadata can be
|
|
10
|
+
* inherited while keeping the custom transport.
|
|
11
|
+
*
|
|
12
|
+
* Kept separate from canonical-id resolution (`./equivalence`): this lookup
|
|
13
|
+
* may strip `search`-style markers and prefers cache-pricing-complete
|
|
14
|
+
* references, both of which would be wrong for canonical coalescing.
|
|
15
|
+
*/
|
|
16
|
+
const REFERENCE_MARKER_SUFFIXES = (() => {
|
|
17
|
+
const discovery = discoveryVocabulary();
|
|
18
|
+
const suffixes = [];
|
|
19
|
+
for (const marker of discovery.trailingMarkers) suffixes.push(`-${marker}`, `:${marker}`);
|
|
20
|
+
for (const marker of discovery.referenceOnlyTrailingMarkers) suffixes.push(`-${marker}`, `:${marker}`);
|
|
21
|
+
return suffixes;
|
|
22
|
+
})();
|
|
23
|
+
function isZeroCostXaiOAuthReference(candidate) {
|
|
24
|
+
return candidate.provider === "xai-oauth" && candidate.cost.input === 0 && candidate.cost.output === 0 && candidate.cost.cacheRead === 0 && candidate.cost.cacheWrite === 0;
|
|
25
|
+
}
|
|
26
|
+
function shouldReplaceReference(existing, candidate) {
|
|
27
|
+
if (!existing) return true;
|
|
28
|
+
if (candidate.contextWindow !== existing.contextWindow) return (candidate.contextWindow ?? 0) > (existing.contextWindow ?? 0);
|
|
29
|
+
if (candidate.maxTokens !== existing.maxTokens) return (candidate.maxTokens ?? 0) > (existing.maxTokens ?? 0);
|
|
30
|
+
const existingHasCachePricing = existing.cost.cacheRead > 0 || existing.cost.cacheWrite > 0;
|
|
31
|
+
const candidateHasCachePricing = candidate.cost.cacheRead > 0 || candidate.cost.cacheWrite > 0;
|
|
32
|
+
if (candidateHasCachePricing !== existingHasCachePricing) return candidateHasCachePricing;
|
|
33
|
+
return existing.provider !== "openai" && candidate.provider === "openai";
|
|
34
|
+
}
|
|
35
|
+
function normalizeReferenceKey(value) {
|
|
36
|
+
return value.trim().toLowerCase();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Build a reference index from a model catalog (typically the bundled models).
|
|
40
|
+
* Pure: callers are responsible for memoizing the result.
|
|
41
|
+
*/
|
|
42
|
+
function buildModelReferenceIndex(models) {
|
|
43
|
+
const exact = /* @__PURE__ */ new Map();
|
|
44
|
+
for (const candidate of models) {
|
|
45
|
+
if (isZeroCostXaiOAuthReference(candidate)) continue;
|
|
46
|
+
const key = normalizeReferenceKey(candidate.id);
|
|
47
|
+
if (shouldReplaceReference(exact.get(key), candidate)) exact.set(key, candidate);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
exact,
|
|
51
|
+
suffixAlias: buildSuffixAliasMap(exact)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function buildSuffixAliasMap(exactReferences) {
|
|
55
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
56
|
+
for (const reference of exactReferences.values()) {
|
|
57
|
+
const slashIndex = reference.id.lastIndexOf("/");
|
|
58
|
+
if (slashIndex === -1) continue;
|
|
59
|
+
const suffix = reference.id.slice(slashIndex + 1);
|
|
60
|
+
const alias = getLongestModelLikeIdSegment(suffix);
|
|
61
|
+
if (!alias) continue;
|
|
62
|
+
if (shouldReplaceReference(aliases.get(alias), reference)) aliases.set(alias, reference);
|
|
63
|
+
}
|
|
64
|
+
return aliases;
|
|
65
|
+
}
|
|
66
|
+
function stripReferenceTrailingMarker(candidate) {
|
|
67
|
+
const lower = candidate.toLowerCase();
|
|
68
|
+
let suffixLength = 0;
|
|
69
|
+
const discovery = discoveryVocabulary();
|
|
70
|
+
for (const suffix of discovery.billingVariantSuffixes) if (lower.endsWith(suffix) && suffix.length > suffixLength) suffixLength = suffix.length;
|
|
71
|
+
for (const suffix of REFERENCE_MARKER_SUFFIXES) if (lower.endsWith(suffix) && suffix.length > suffixLength) suffixLength = suffix.length;
|
|
72
|
+
const collapse = collapseVocabulary();
|
|
73
|
+
for (const rule of collapse.suffixes) if (lower.endsWith(rule.suffix) && rule.suffix.length > suffixLength) suffixLength = rule.suffix.length;
|
|
74
|
+
for (const rule of collapse.routingVariants) if (lower.endsWith(rule.suffix) && rule.suffix.length > suffixLength) suffixLength = rule.suffix.length;
|
|
75
|
+
return suffixLength > 0 && suffixLength < candidate.length ? candidate.slice(0, -suffixLength) : void 0;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Expand a proxied/affixed model id into the ids it may be catalogued under,
|
|
79
|
+
* least-stripped first: bracket affixes, model-like segments, `:cloud`,
|
|
80
|
+
* namespace prefix, `:`→`-`, lowercase, and declared trailing markers.
|
|
81
|
+
* Shared by reference recovery and catalog-metric matching (`./metrics`).
|
|
82
|
+
*/
|
|
83
|
+
function getReferenceCandidateIds(modelId) {
|
|
84
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
85
|
+
const queue = [modelId];
|
|
86
|
+
for (let index = 0; index < queue.length; index += 1) {
|
|
87
|
+
const candidate = queue[index]?.trim();
|
|
88
|
+
if (!candidate || candidates.has(candidate)) continue;
|
|
89
|
+
candidates.add(candidate);
|
|
90
|
+
for (const stripped of getBracketStrippedModelIdCandidates(candidate)) queue.push(stripped);
|
|
91
|
+
for (const segment of getModelLikeIdSegments(candidate)) queue.push(segment);
|
|
92
|
+
for (const suffix of [":cloud", "-cloud"]) if (candidate.toLowerCase().endsWith(suffix)) queue.push(candidate.slice(0, -suffix.length));
|
|
93
|
+
const slashIndex = candidate.lastIndexOf("/");
|
|
94
|
+
if (slashIndex !== -1) queue.push(candidate.slice(slashIndex + 1));
|
|
95
|
+
const colonToDash = candidate.replace(/:/g, "-");
|
|
96
|
+
if (colonToDash !== candidate) queue.push(colonToDash);
|
|
97
|
+
const lowercased = candidate.toLowerCase();
|
|
98
|
+
if (lowercased !== candidate) queue.push(lowercased);
|
|
99
|
+
const strippedMarker = stripReferenceTrailingMarker(candidate);
|
|
100
|
+
if (strippedMarker) queue.push(strippedMarker);
|
|
101
|
+
}
|
|
102
|
+
return [...candidates];
|
|
103
|
+
}
|
|
104
|
+
/** Resolve a (possibly proxied/affixed) model id to its bundled upstream reference. */
|
|
105
|
+
function resolveModelReference(modelId, index) {
|
|
106
|
+
if (modelId.startsWith("@")) return void 0;
|
|
107
|
+
for (const candidate of getReferenceCandidateIds(modelId)) {
|
|
108
|
+
const key = normalizeReferenceKey(candidate);
|
|
109
|
+
const reference = index.exact.get(key) ?? index.suffixAlias.get(key);
|
|
110
|
+
if (reference) return reference;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { isZeroCostXaiOAuthReference as n, resolveModelReference as r, buildModelReferenceIndex as t };
|
|
@@ -2,7 +2,7 @@ import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
|
2
2
|
__installBunShim();
|
|
3
3
|
import { n as fs_promises_shim_exports } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
4
|
import "node:buffer";
|
|
5
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
5
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/utils/request-debug.ts
|
|
6
6
|
const REQUEST_DEBUG_ENV = "PI_REQ_DEBUG";
|
|
7
7
|
const textEncoder = new TextEncoder();
|
|
8
8
|
new TextDecoder("utf-8", { fatal: true });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@
|
|
3
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@18.1.17/node_modules/@oh-my-pi/pi-utils/src/sanitize-text.ts
|
|
4
4
|
/**
|
|
5
5
|
* Strip ANSI escape sequences, remove control characters / lone surrogates,
|
|
6
6
|
* and normalize line endings.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
3
|
import { n as fs_promises_shim_exports } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
|
-
import { B as USER_AGENT,
|
|
5
|
-
import {
|
|
6
|
-
import { a as fetchBinary, c as getParallelExtractContent, i as convertWithMarkit, l as ensureTool, m as settings, n as asRecord, o as extractWithParallel, r as asString, s as findParallelApiKey, t as asNumber } from "./utils-
|
|
7
|
-
import { n as isRecord } from "./type-guards-
|
|
4
|
+
import { $ as isEnoent, B as USER_AGENT, C as warn, G as getDocsRsCacheDir, N as $env, c as combineSignals, j as formatNumber, k as formatBytes, l as exec, s as Snowflake, y as parseFrontmatter } from "./src-BwW51vA5.mjs";
|
|
5
|
+
import { W as tryParseJson } from "./utils-CUPhpw9A.mjs";
|
|
6
|
+
import { a as fetchBinary, c as getParallelExtractContent, i as convertWithMarkit, l as ensureTool, m as settings, n as asRecord, o as extractWithParallel, r as asString, s as findParallelApiKey, t as asNumber } from "./utils-CCfhUQen.mjs";
|
|
7
|
+
import { n as isRecord } from "./type-guards-CttAANEx.mjs";
|
|
8
8
|
import { r as throwIfAborted, t as ToolAbortError } from "./tool-errors-DoyxivAR.mjs";
|
|
9
|
-
import { c as getLocalizedText, d as looksLikeHtml, i as decodeHtmlEntities, l as htmlToBasicMarkdown, o as formatIsoDate, r as buildResult, s as formatMediaDuration, u as loadPage } from "./types-
|
|
9
|
+
import { c as getLocalizedText, d as looksLikeHtml, i as decodeHtmlEntities, l as htmlToBasicMarkdown, o as formatIsoDate, r as buildResult, s as formatMediaDuration, u as loadPage } from "./types-PVueGi9S.mjs";
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
import * as os from "node:os";
|
|
12
12
|
import { gunzipSync } from "node:zlib";
|
|
13
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@
|
|
13
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-utils@18.1.17/node_modules/@oh-my-pi/pi-utils/src/version.ts
|
|
14
14
|
const DIGITS = /^\d+$/;
|
|
15
15
|
/**
|
|
16
16
|
* Compare two version strings.
|
|
@@ -222,7 +222,7 @@ const handleArxiv = async (url, timeout, signal) => {
|
|
|
222
222
|
signal
|
|
223
223
|
});
|
|
224
224
|
if (!result.ok) return null;
|
|
225
|
-
const { parseHTML } = await import("./dom-
|
|
225
|
+
const { parseHTML } = await import("./dom-DG3sPESc.mjs");
|
|
226
226
|
const entry = parseHTML(result.content).document.querySelector("entry");
|
|
227
227
|
if (!entry) return null;
|
|
228
228
|
const title = entry.querySelector("title")?.textContent?.trim()?.replace(/\s+/g, " ");
|
|
@@ -3527,7 +3527,7 @@ const handleGoPkg = async (url, timeout, signal) => {
|
|
|
3527
3527
|
notes: ["error"],
|
|
3528
3528
|
contentType: "text/plain"
|
|
3529
3529
|
});
|
|
3530
|
-
const { parseHTML } = await import("./dom-
|
|
3530
|
+
const { parseHTML } = await import("./dom-DG3sPESc.mjs");
|
|
3531
3531
|
const doc = parseHTML(pageResult.content).document;
|
|
3532
3532
|
const breadcrumb = doc.querySelector(".go-Breadcrumb");
|
|
3533
3533
|
if (breadcrumb) {
|
|
@@ -4183,7 +4183,7 @@ const handleIacr = async (url, timeout, signal) => {
|
|
|
4183
4183
|
signal
|
|
4184
4184
|
});
|
|
4185
4185
|
if (!result.ok) return null;
|
|
4186
|
-
const { parseHTML } = await import("./dom-
|
|
4186
|
+
const { parseHTML } = await import("./dom-DG3sPESc.mjs");
|
|
4187
4187
|
const doc = parseHTML(result.content).document;
|
|
4188
4188
|
const title = doc.querySelector("h3.mb-3")?.textContent?.trim() || doc.querySelector("meta[name=\"citation_title\"]")?.getAttribute("content");
|
|
4189
4189
|
const authors = Array.from(doc.querySelectorAll("meta[name=\"citation_author\"]")).map((m) => m.getAttribute("content")).filter((author) => Boolean(author));
|
|
@@ -6608,7 +6608,7 @@ const handleReadTheDocs = async (url, timeout, signal) => {
|
|
|
6608
6608
|
truncated: false,
|
|
6609
6609
|
notes
|
|
6610
6610
|
};
|
|
6611
|
-
const { parseHTML } = await import("./dom-
|
|
6611
|
+
const { parseHTML } = await import("./dom-DG3sPESc.mjs");
|
|
6612
6612
|
const root = parseHTML(result.content).document;
|
|
6613
6613
|
let mainContent = root.querySelector(".document") || root.querySelector("[role=\"main\"]") || root.querySelector("main") || root.querySelector(".rst-content") || root.querySelector(".body");
|
|
6614
6614
|
if (!mainContent) {
|
|
@@ -8239,7 +8239,7 @@ const handleTwitter = async (url, timeout, signal) => {
|
|
|
8239
8239
|
signal
|
|
8240
8240
|
});
|
|
8241
8241
|
if (result.ok && result.content.length > 500) {
|
|
8242
|
-
const { parseHTML } = await import("./dom-
|
|
8242
|
+
const { parseHTML } = await import("./dom-DG3sPESc.mjs");
|
|
8243
8243
|
const doc = parseHTML(result.content).document;
|
|
8244
8244
|
const tweetContent = doc.querySelector(".tweet-content")?.textContent?.trim();
|
|
8245
8245
|
const fullname = doc.querySelector(".fullname")?.textContent?.trim();
|
|
@@ -8860,7 +8860,7 @@ const handleWikipedia = async (url, timeout, signal) => {
|
|
|
8860
8860
|
signal
|
|
8861
8861
|
});
|
|
8862
8862
|
if (contentResult.ok) {
|
|
8863
|
-
const { parseHTML } = await import("./dom-
|
|
8863
|
+
const { parseHTML } = await import("./dom-DG3sPESc.mjs");
|
|
8864
8864
|
const sections = parseHTML(contentResult.content).document.querySelectorAll("section");
|
|
8865
8865
|
for (const section of sections) {
|
|
8866
8866
|
const heading = section.querySelector("h2, h3, h4");
|