@xiaoso/dsh-tool-plus 0.1.6 → 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/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-Cg5w77td.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-C-dSORPa.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 +11 -11
- package/presets/package.json +1 -1
- package/presets/tool-plus-ptc/agent.cordis.yml +1 -1
- package/presets/tool-plus-standard/agent.cordis.yml +1 -1
- 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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { r as __exportAll } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
|
+
import { V as ProviderHttpError, f as OAuthError } from "./error-CORgGg5a.mjs";
|
|
5
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/claude-code-fingerprint.ts
|
|
6
|
+
/**
|
|
7
|
+
* Claude Code inference-fingerprint constants, kept in a leaf module so consumers
|
|
8
|
+
* outside the provider (`registry/oauth/anthropic`, `usage/claude`) don't
|
|
9
|
+
* import the heavy `providers/anthropic` module.
|
|
10
|
+
*
|
|
11
|
+
* That import edge was a live init cycle: `providers/anthropic` → `stream` →
|
|
12
|
+
* `registry` → `registry/oauth/anthropic` → back into the still-initializing
|
|
13
|
+
* provider module.
|
|
14
|
+
*/
|
|
15
|
+
/** Current Claude Code CLI version represented on the Anthropic wire. */
|
|
16
|
+
const claudeCodeVersion = "2.1.257";
|
|
17
|
+
/** `@anthropic-ai/sdk` version bundled by the current Claude Code release. */
|
|
18
|
+
const claudeCodeSdkVersion = "0.112.1";
|
|
19
|
+
/** User-Agent emitted by Claude Code's CLI inference entrypoint. */
|
|
20
|
+
const claudeCodeUserAgent = `claude-cli/${claudeCodeVersion} (external, cli)`;
|
|
21
|
+
/** Identity block prepended by Claude Code's CLI runtime. */
|
|
22
|
+
const claudeCodeSystemInstruction = "You are Claude Code, Anthropic's official CLI for Claude.";
|
|
23
|
+
/** Claude Code's per-request output-token ceiling. */
|
|
24
|
+
const CLAUDE_CODE_MAX_OUTPUT_TOKENS = 64e3;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/anthropic.ts
|
|
27
|
+
/**
|
|
28
|
+
* Anthropic (Claude Pro/Max) sign-in residue. The OAuth flow itself is
|
|
29
|
+
* declared in `rules/auth/anthropic.kdl`; this module supplies the
|
|
30
|
+
* `anthropic-identity` after-exchange hook that recovers account /
|
|
31
|
+
* organization identity from `/api/claude_cli/bootstrap` when the token
|
|
32
|
+
* response omits it.
|
|
33
|
+
*/
|
|
34
|
+
var anthropic_exports = /* @__PURE__ */ __exportAll({
|
|
35
|
+
ANTHROPIC_OAUTH_GRANT_TTL_MS: () => ANTHROPIC_OAUTH_GRANT_TTL_MS,
|
|
36
|
+
anthropicIdentityHook: () => anthropicIdentityHook,
|
|
37
|
+
fetchAnthropicBootstrapIdentity: () => fetchAnthropicBootstrapIdentity
|
|
38
|
+
});
|
|
39
|
+
const BOOTSTRAP_URL = "https://api.anthropic.com/api/claude_cli/bootstrap";
|
|
40
|
+
const CLAUDE_CODE_BOOTSTRAP_MODEL = "claude-opus-4-8";
|
|
41
|
+
const CLAUDE_CODE_BOOTSTRAP_USER_AGENT = `claude-code/${claudeCodeVersion}`;
|
|
42
|
+
function nonEmpty(value) {
|
|
43
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
44
|
+
}
|
|
45
|
+
/** Fetches the signed-in account/org identity Claude Code's CLI bootstrap reports. */
|
|
46
|
+
async function fetchAnthropicBootstrapIdentity(accessToken, fetchImpl) {
|
|
47
|
+
const url = `${BOOTSTRAP_URL}?entrypoint=cli&model=${encodeURIComponent(CLAUDE_CODE_BOOTSTRAP_MODEL)}`;
|
|
48
|
+
const response = await fetchImpl(url, {
|
|
49
|
+
method: "GET",
|
|
50
|
+
headers: {
|
|
51
|
+
Accept: "application/json, text/plain, */*",
|
|
52
|
+
Authorization: `Bearer ${accessToken}`,
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
"User-Agent": CLAUDE_CODE_BOOTSTRAP_USER_AGENT,
|
|
55
|
+
"anthropic-beta": "oauth-2025-04-20"
|
|
56
|
+
},
|
|
57
|
+
signal: AbortSignal.timeout(3e4)
|
|
58
|
+
});
|
|
59
|
+
const responseBody = await response.text();
|
|
60
|
+
if (!response.ok) throw new ProviderHttpError(`HTTP request failed. status=${response.status}; url=${url}; body=${responseBody}`, response.status);
|
|
61
|
+
let data;
|
|
62
|
+
try {
|
|
63
|
+
data = JSON.parse(responseBody);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
throw new OAuthError(`Anthropic bootstrap returned invalid JSON. url=${url}; body=${responseBody}`, {
|
|
66
|
+
kind: "validation",
|
|
67
|
+
provider: "anthropic",
|
|
68
|
+
cause: error
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
accountId: nonEmpty(data.oauth_account?.account_uuid),
|
|
73
|
+
email: nonEmpty(data.oauth_account?.account_email),
|
|
74
|
+
orgId: nonEmpty(data.oauth_account?.organization_uuid),
|
|
75
|
+
orgName: nonEmpty(data.oauth_account?.organization_name)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `anthropic-identity` hook: fills account (and, at login only, organization)
|
|
80
|
+
* identity from the bootstrap endpoint when the token response left it
|
|
81
|
+
* unset. The org an access token is scoped to is captured once at login and
|
|
82
|
+
* deliberately never refreshed — rewriting identity during background
|
|
83
|
+
* refreshes could silently re-key stored credentials.
|
|
84
|
+
*/
|
|
85
|
+
const anthropicIdentityHook = async (credentials, context) => {
|
|
86
|
+
const includeOrg = context.phase === "login";
|
|
87
|
+
const orgSatisfied = !includeOrg || credentials.orgId !== void 0;
|
|
88
|
+
if (credentials.accountId && credentials.email && orgSatisfied) return credentials;
|
|
89
|
+
try {
|
|
90
|
+
const bootstrap = await fetchAnthropicBootstrapIdentity(credentials.access, context.fetch);
|
|
91
|
+
return {
|
|
92
|
+
...credentials,
|
|
93
|
+
accountId: credentials.accountId ?? bootstrap.accountId,
|
|
94
|
+
email: credentials.email ?? bootstrap.email,
|
|
95
|
+
...includeOrg ? {
|
|
96
|
+
orgId: credentials.orgId ?? bootstrap.orgId,
|
|
97
|
+
orgName: credentials.orgName ?? bootstrap.orgName
|
|
98
|
+
} : {}
|
|
99
|
+
};
|
|
100
|
+
} catch {
|
|
101
|
+
return credentials;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
export { claudeCodeUserAgent as a, claudeCodeSystemInstruction as i, CLAUDE_CODE_MAX_OUTPUT_TOKENS as n, claudeCodeVersion as o, claudeCodeSdkVersion as r, anthropic_exports as t };
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import {
|
|
4
|
-
import { H as AwsCredentialsError } from "./error-
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
3
|
+
import { $ as isEnoent, F as $flag, N as $env, b as debug } from "./src-BwW51vA5.mjs";
|
|
4
|
+
import { H as AwsCredentialsError } from "./error-CORgGg5a.mjs";
|
|
5
|
+
import "./utils-CUPhpw9A.mjs";
|
|
6
|
+
import { n as isRecord } from "./type-guards-CttAANEx.mjs";
|
|
7
|
+
import { n as raceWithSignal } from "./abort-Caqff3M6.mjs";
|
|
8
|
+
import { r as isLocalOrMetadataHost } from "./proxy-5nWqRL1f.mjs";
|
|
9
|
+
import "./effort-BdtQMN-_.mjs";
|
|
7
10
|
import * as fs from "node:fs";
|
|
8
11
|
import * as path from "node:path";
|
|
9
12
|
import * as os from "node:os";
|
|
10
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
13
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/utils/aws-profile.ts
|
|
11
14
|
function parseAwsIni(text) {
|
|
12
15
|
const out = {};
|
|
13
16
|
let current = null;
|
|
@@ -84,8 +87,8 @@ function profileHasCredentialSource(profile, credentialsIni, configIni, seen) {
|
|
|
84
87
|
if (seen.has(profile)) return false;
|
|
85
88
|
seen.add(profile);
|
|
86
89
|
const merged = {
|
|
87
|
-
...configIni?.[profile]
|
|
88
|
-
...credentialsIni?.[profile]
|
|
90
|
+
...configIni?.[profile],
|
|
91
|
+
...credentialsIni?.[profile]
|
|
89
92
|
};
|
|
90
93
|
if (merged.role_arn) {
|
|
91
94
|
if (merged.web_identity_token_file) return true;
|
|
@@ -107,11 +110,11 @@ function profileHasCredentialSource(profile, credentialsIni, configIni, seen) {
|
|
|
107
110
|
return !!(session?.sso_start_url && session.sso_region);
|
|
108
111
|
}
|
|
109
112
|
//#endregion
|
|
110
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
113
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/types.ts
|
|
111
114
|
/** Credentials are resolved by the provider transport rather than used as a bearer string. */
|
|
112
115
|
const AUTHENTICATED_SENTINEL = "<authenticated>";
|
|
113
116
|
//#endregion
|
|
114
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
117
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/aws.ts
|
|
115
118
|
function isEc2Host() {
|
|
116
119
|
const checks = [
|
|
117
120
|
["/sys/hypervisor/uuid", (v) => v.startsWith("ec2")],
|
|
@@ -142,7 +145,7 @@ function resolveAwsBearerToken(apiKey, bearerToken) {
|
|
|
142
145
|
return bearerToken || (apiKey === "<authenticated>" ? void 0 : apiKey) || $env.AWS_BEARER_TOKEN_BEDROCK;
|
|
143
146
|
}
|
|
144
147
|
//#endregion
|
|
145
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
148
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/aws-sigv4.ts
|
|
146
149
|
const ALGORITHM = "AWS4-HMAC-SHA256";
|
|
147
150
|
const KEY_TYPE = "aws4_request";
|
|
148
151
|
const UNSIGNABLE = {
|
|
@@ -285,7 +288,7 @@ async function signRequest(params) {
|
|
|
285
288
|
return out;
|
|
286
289
|
}
|
|
287
290
|
//#endregion
|
|
288
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
291
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/aws-credentials.ts
|
|
289
292
|
/**
|
|
290
293
|
* AWS credential resolution for the Bedrock provider.
|
|
291
294
|
*
|
|
@@ -415,8 +418,8 @@ async function resolveProfileChain(profile, ctx, seen) {
|
|
|
415
418
|
if (seen.has(profile)) throw new AwsCredentialsError(`AWS profile role chain contains a cycle at '${profile}'.`, "profile");
|
|
416
419
|
seen.add(profile);
|
|
417
420
|
const merged = {
|
|
418
|
-
...ctx.configIni?.[profile]
|
|
419
|
-
...ctx.credentialsIni?.[profile]
|
|
421
|
+
...ctx.configIni?.[profile],
|
|
422
|
+
...ctx.credentialsIni?.[profile]
|
|
420
423
|
};
|
|
421
424
|
if (Object.keys(merged).length === 0) return void 0;
|
|
422
425
|
if (merged.role_arn) return assumeRoleFromProfile(profile, merged, ctx, seen);
|
|
@@ -864,4 +867,61 @@ function invalidateAwsCredentialCache(opts = {}) {
|
|
|
864
867
|
cache.delete(credentialCacheKey(profile, region, shouldLoadAwsSharedConfig(opts.profile)));
|
|
865
868
|
}
|
|
866
869
|
//#endregion
|
|
867
|
-
|
|
870
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-catalog@18.1.17/node_modules/@oh-my-pi/pi-catalog/src/model-thinking.ts
|
|
871
|
+
/**
|
|
872
|
+
* Returns the supported thinking efforts declared on the model metadata.
|
|
873
|
+
* Empty for non-reasoning models and for reasoning models without a
|
|
874
|
+
* controllable effort surface (`thinking: undefined`).
|
|
875
|
+
*/
|
|
876
|
+
function getSupportedEfforts(model) {
|
|
877
|
+
if (!model.reasoning) return [];
|
|
878
|
+
return model.thinking?.efforts ?? [];
|
|
879
|
+
}
|
|
880
|
+
function requireSupportedEffort(model, effort) {
|
|
881
|
+
if (!model.reasoning) throw new Error(`Model ${model.provider}/${model.id} does not support thinking`);
|
|
882
|
+
const levels = getSupportedEfforts(model);
|
|
883
|
+
if (!levels.includes(effort)) throw new Error(`Thinking effort ${effort} is not supported by ${model.provider}/${model.id}. Supported efforts: ${levels.join(", ")}`);
|
|
884
|
+
return effort;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Maps a normalized thinking effort to Anthropic adaptive effort values via
|
|
888
|
+
* the model's baked `thinking.effortMap` (identity for unmapped efforts).
|
|
889
|
+
*/
|
|
890
|
+
function mapEffortToAnthropicAdaptiveEffort(model, effort) {
|
|
891
|
+
const supported = requireSupportedEffort(model, effort);
|
|
892
|
+
return model.thinking?.effortMap?.[supported] ?? supported;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Resolves the upstream wire model id for a request at the given effort
|
|
896
|
+
* (`undefined` = thinking off). Collapsed effort-tier variants route through
|
|
897
|
+
* `thinking.effortRouting`; everything else falls back to
|
|
898
|
+
* `requestModelId ?? id`.
|
|
899
|
+
*/
|
|
900
|
+
function resolveWireModelId(model, effort) {
|
|
901
|
+
return model.thinking?.effortRouting?.[effort ?? "off"] ?? model.requestModelId ?? model.id;
|
|
902
|
+
}
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/anthropic-wire.ts
|
|
905
|
+
/** Beta enabling preserved-thinking block controls and transformation reports. */
|
|
906
|
+
const THINKING_BINDING_CONTROLS_BETA = "thinking-binding-controls-2026-08-01";
|
|
907
|
+
/** True when a block is complete Anthropic server-tool history omp can replay. */
|
|
908
|
+
function isAnthropicServerToolHistoryBlock(block) {
|
|
909
|
+
if (block.type === "server_tool_use") return (block.name === "web_search" || block.name === "tool_search_tool_regex" || block.name === "tool_search_tool_bm25") && typeof block.id === "string" && block.id.length > 0;
|
|
910
|
+
if (block.type === "web_search_tool_result" || block.type === "tool_search_tool_result") return typeof block.tool_use_id === "string" && block.tool_use_id.length > 0 && Object.hasOwn(block, "content");
|
|
911
|
+
return false;
|
|
912
|
+
}
|
|
913
|
+
/** Parse Anthropic's forward-compatible input transformation list. */
|
|
914
|
+
function parseAnthropicInputTransformations(value) {
|
|
915
|
+
if (!Array.isArray(value)) return [];
|
|
916
|
+
const transformations = [];
|
|
917
|
+
for (const entry of value) {
|
|
918
|
+
if (!isRecord(entry) || typeof entry.type !== "string") continue;
|
|
919
|
+
transformations.push({
|
|
920
|
+
...entry,
|
|
921
|
+
type: entry.type
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
return transformations;
|
|
925
|
+
}
|
|
926
|
+
//#endregion
|
|
927
|
+
export { mapEffortToAnthropicAdaptiveEffort as a, invalidateAwsCredentialCache as c, resolveAwsBearerToken as d, resolveAwsRegistryApiKey as f, resolveAwsRegion as h, getSupportedEfforts as i, resolveAwsCredentials as l, resolveAwsAmbientRegion as m, isAnthropicServerToolHistoryBlock as n, requireSupportedEffort as o, AUTHENTICATED_SENTINEL as p, parseAnthropicInputTransformations as r, resolveWireModelId as s, THINKING_BINDING_CONTROLS_BETA as t, signRequest as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import {
|
|
4
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
3
|
+
import { B as OpenAIHttpError, V as ProviderHttpError } from "./error-CORgGg5a.mjs";
|
|
4
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/api-key-validation.ts
|
|
5
5
|
const VALIDATION_TIMEOUT_MS = 15e3;
|
|
6
6
|
function normalizeAnthropicCompatibleBaseUrl(baseUrl) {
|
|
7
7
|
const trimmed = baseUrl.trim().replace(/\/+$/, "");
|
|
@@ -10,13 +10,30 @@ function normalizeAnthropicCompatibleBaseUrl(baseUrl) {
|
|
|
10
10
|
function resolveValidationHeaders(headers) {
|
|
11
11
|
return typeof headers === "function" ? headers() : headers;
|
|
12
12
|
}
|
|
13
|
-
async function
|
|
13
|
+
async function readErrorEnvelope(response) {
|
|
14
14
|
let details = "";
|
|
15
15
|
try {
|
|
16
16
|
details = (await response.text()).trim();
|
|
17
17
|
} catch {}
|
|
18
|
+
let bodyJson;
|
|
19
|
+
try {
|
|
20
|
+
bodyJson = details ? JSON.parse(details) : void 0;
|
|
21
|
+
} catch {
|
|
22
|
+
bodyJson = void 0;
|
|
23
|
+
}
|
|
24
|
+
const { code } = OpenAIHttpError.parseEnvelope(bodyJson, details);
|
|
25
|
+
return {
|
|
26
|
+
details,
|
|
27
|
+
code
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async function createApiKeyValidationError(provider, response, envelope) {
|
|
31
|
+
const { details, code } = envelope ?? await readErrorEnvelope(response);
|
|
18
32
|
const message = details ? `${provider} API key validation failed (${response.status}): ${details}` : `${provider} API key validation failed (${response.status})`;
|
|
19
|
-
return new ProviderHttpError(message, response.status, {
|
|
33
|
+
return new ProviderHttpError(message, response.status, {
|
|
34
|
+
headers: response.headers,
|
|
35
|
+
code
|
|
36
|
+
});
|
|
20
37
|
}
|
|
21
38
|
/**
|
|
22
39
|
* Validate an API key against an OpenAI-compatible chat completions endpoint.
|
|
@@ -38,13 +55,15 @@ async function validateOpenAICompatibleApiKey(options) {
|
|
|
38
55
|
role: "user",
|
|
39
56
|
content: "ping"
|
|
40
57
|
}],
|
|
41
|
-
max_tokens: 1,
|
|
58
|
+
[options.maxTokensField ?? "max_tokens"]: options.maxTokens ?? 1,
|
|
42
59
|
temperature: 0
|
|
43
60
|
}),
|
|
44
61
|
signal
|
|
45
62
|
});
|
|
46
63
|
if (response.ok) return;
|
|
47
|
-
|
|
64
|
+
const envelope = await readErrorEnvelope(response);
|
|
65
|
+
if (options.tolerateModelDenied && response.status === 401 && envelope.code === "invalid_model") return;
|
|
66
|
+
throw await createApiKeyValidationError(options.provider, response, envelope);
|
|
48
67
|
}
|
|
49
68
|
/**
|
|
50
69
|
* Validate an API key against an Anthropic-compatible messages endpoint.
|
|
@@ -85,7 +104,7 @@ async function validateApiKeyAgainstModelsEndpoint(options) {
|
|
|
85
104
|
const response = await (options.fetch ?? fetch)(options.modelsUrl, {
|
|
86
105
|
method: "GET",
|
|
87
106
|
headers: {
|
|
88
|
-
...resolveValidationHeaders(options.headers)
|
|
107
|
+
...resolveValidationHeaders(options.headers),
|
|
89
108
|
Authorization: `Bearer ${options.apiKey}`
|
|
90
109
|
},
|
|
91
110
|
signal
|
|
@@ -94,64 +113,4 @@ async function validateApiKeyAgainstModelsEndpoint(options) {
|
|
|
94
113
|
throw await createApiKeyValidationError(options.provider, response);
|
|
95
114
|
}
|
|
96
115
|
//#endregion
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Shared factory for API-key-paste "login" flows.
|
|
100
|
-
*
|
|
101
|
-
* Several providers (Cerebras, Synthetic, Moonshot, Together, NanoGPT, ZenMux)
|
|
102
|
-
* don't actually implement OAuth — they just ask the user to paste an API key,
|
|
103
|
-
* optionally validate it, and return the trimmed key.
|
|
104
|
-
*/
|
|
105
|
-
function createApiKeyLogin(config) {
|
|
106
|
-
return async function login(options) {
|
|
107
|
-
if (!options.onPrompt) throw new OnPromptRequiredError(config.providerLabel);
|
|
108
|
-
if (config.authUrl && config.instructions) options.onAuth?.({
|
|
109
|
-
url: config.authUrl,
|
|
110
|
-
instructions: config.instructions
|
|
111
|
-
});
|
|
112
|
-
const apiKey = config.emptyKeyFallback === void 0 ? await options.onPrompt({
|
|
113
|
-
message: config.promptMessage,
|
|
114
|
-
placeholder: config.placeholder
|
|
115
|
-
}) : await options.onPrompt({
|
|
116
|
-
message: config.promptMessage,
|
|
117
|
-
placeholder: config.placeholder,
|
|
118
|
-
allowEmpty: true
|
|
119
|
-
});
|
|
120
|
-
if (options.signal?.aborted) throw new LoginCancelledError();
|
|
121
|
-
const trimmed = apiKey.trim();
|
|
122
|
-
if (!trimmed) {
|
|
123
|
-
if (config.emptyKeyFallback !== void 0) return config.emptyKeyFallback;
|
|
124
|
-
throw new ApiKeyRequiredError();
|
|
125
|
-
}
|
|
126
|
-
if (config.validation) {
|
|
127
|
-
options.onProgress?.("Validating API key...");
|
|
128
|
-
if (config.validation.kind === "chat-completions") await validateOpenAICompatibleApiKey({
|
|
129
|
-
provider: config.validation.provider,
|
|
130
|
-
apiKey: trimmed,
|
|
131
|
-
baseUrl: config.validation.baseUrl,
|
|
132
|
-
model: config.validation.model,
|
|
133
|
-
signal: options.signal,
|
|
134
|
-
fetch: options.fetch
|
|
135
|
-
});
|
|
136
|
-
else if (config.validation.kind === "anthropic-messages") await validateAnthropicCompatibleApiKey({
|
|
137
|
-
provider: config.validation.provider,
|
|
138
|
-
apiKey: trimmed,
|
|
139
|
-
baseUrl: config.validation.baseUrl,
|
|
140
|
-
model: config.validation.model,
|
|
141
|
-
signal: options.signal,
|
|
142
|
-
fetch: options.fetch
|
|
143
|
-
});
|
|
144
|
-
else await validateApiKeyAgainstModelsEndpoint({
|
|
145
|
-
provider: config.validation.provider,
|
|
146
|
-
apiKey: trimmed,
|
|
147
|
-
modelsUrl: typeof config.validation.modelsUrl === "function" ? config.validation.modelsUrl() : config.validation.modelsUrl,
|
|
148
|
-
headers: config.validation.headers,
|
|
149
|
-
signal: options.signal,
|
|
150
|
-
fetch: options.fetch
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
return trimmed;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
//#endregion
|
|
157
|
-
export { validateApiKeyAgainstModelsEndpoint as n, validateOpenAICompatibleApiKey as r, createApiKeyLogin as t };
|
|
116
|
+
export { validateApiKeyAgainstModelsEndpoint as n, validateOpenAICompatibleApiKey as r, validateAnthropicCompatibleApiKey as t };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
3
|
import { r as __exportAll } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { B as OpenAIHttpError,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as createAbortSourceTracker } from "./abort-
|
|
9
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
10
|
-
import { n as getOpenAIStreamFirstEventTimeoutMs, o as iterateWithIdleTimeout, r as getOpenAIStreamIdleTimeoutMs } from "./idle-iterator-
|
|
11
|
-
import { c as postOpenAIStream, r as createOpenAIReasoningEffortFallbackKey, s as resolveOpenAIReasoningEffortFallback, t as applyOpenAIReasoningEffortFallback } from "./openai-reasoning-fallback-
|
|
12
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@
|
|
4
|
+
import { N as $env } from "./src-BwW51vA5.mjs";
|
|
5
|
+
import { B as OpenAIHttpError, _ as AbortError, c as finalize, h as MissingApiKeyError, n as StreamTimeoutError, s as ProviderResponseError, t as ConfigurationError } from "./error-CORgGg5a.mjs";
|
|
6
|
+
import { A as toolWireSchema, c as resolveCacheRetention, z as sanitizeSchemaForOpenAIResponses } from "./utils-CUPhpw9A.mjs";
|
|
7
|
+
import { At as withReplaySafeStreamRetry, Et as mapToOpenAIResponsesToolChoice, F as buildResponsesInput, V as createInitialResponsesAssistantMessage, dt as parseAzureDeploymentNameMap, et as getOpenAIPromptCacheKey, j as applyResponsesReasoningParams, n as getEnvApiKey, ot as isOpenAIResponsesProgressEvent, pt as processResponsesStream, w as applyCommonResponsesSamplingParams } from "./stream-B_7qN-bA.mjs";
|
|
8
|
+
import { t as createAbortSourceTracker } from "./abort-Caqff3M6.mjs";
|
|
9
|
+
import { t as AssistantMessageEventStream } from "./event-stream-ulcDenZD.mjs";
|
|
10
|
+
import { n as getOpenAIStreamFirstEventTimeoutMs, o as iterateWithIdleTimeout, r as getOpenAIStreamIdleTimeoutMs } from "./idle-iterator-DlUkEfzW.mjs";
|
|
11
|
+
import { c as postOpenAIStream, r as createOpenAIReasoningEffortFallbackKey, s as resolveOpenAIReasoningEffortFallback, t as applyOpenAIReasoningEffortFallback } from "./openai-reasoning-fallback-BdB3RCbj.mjs";
|
|
12
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/azure-openai-responses.ts
|
|
13
13
|
var azure_openai_responses_exports = /* @__PURE__ */ __exportAll({ streamAzureOpenAIResponses: () => streamAzureOpenAIResponses });
|
|
14
14
|
const DEFAULT_AZURE_API_VERSION = "v1";
|
|
15
15
|
const AZURE_OPENAI_RESPONSES_FIRST_EVENT_TIMEOUT_MESSAGE = "Azure OpenAI responses stream timed out while waiting for the first event";
|
|
@@ -17,11 +17,8 @@ function resolveDeploymentName(model, options) {
|
|
|
17
17
|
if (options?.azureDeploymentName) return options.azureDeploymentName;
|
|
18
18
|
return parseAzureDeploymentNameMap($env.AZURE_OPENAI_DEPLOYMENT_NAME_MAP).get(model.id) ?? model.id;
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
const streamAzureOpenAIResponses = (model, context, options) => {
|
|
24
|
-
if (options?.promptCache?.mode === "explicit" && resolveCacheRetention(options.cacheRetention) !== "none") throw new ConfigurationError(`OpenAI explicit prompt caching is unsupported for ${model.provider}/${model.id}; Azure Responses does not emit explicit cache controls.`);
|
|
20
|
+
/** Runs one Azure OpenAI Responses request and decodes its event stream. */
|
|
21
|
+
const streamAzureOpenAIResponsesOnce = (model, context, options) => {
|
|
25
22
|
const stream = new AssistantMessageEventStream();
|
|
26
23
|
(async () => {
|
|
27
24
|
const startTime = performance.now();
|
|
@@ -156,6 +153,19 @@ const streamAzureOpenAIResponses = (model, context, options) => {
|
|
|
156
153
|
})();
|
|
157
154
|
return stream;
|
|
158
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* Retries transient Azure stream failures only before assistant output commits
|
|
158
|
+
* the attempt. The unsupported explicit prompt-cache config is rejected
|
|
159
|
+
* synchronously here — callers of the direct entrypoint get the immediate
|
|
160
|
+
* `ConfigurationError` rather than a stream whose `.result()` rejects later.
|
|
161
|
+
*/
|
|
162
|
+
const streamAzureOpenAIResponses = (model, context, options) => {
|
|
163
|
+
if (options?.promptCache?.mode === "explicit" && resolveCacheRetention(options.cacheRetention) !== "none") throw new ConfigurationError(`OpenAI explicit prompt caching is unsupported for ${model.provider}/${model.id}; Azure Responses does not emit explicit cache controls.`);
|
|
164
|
+
return withReplaySafeStreamRetry(model, context, options, streamAzureOpenAIResponsesOnce, {
|
|
165
|
+
retryProviderErrors: true,
|
|
166
|
+
maxProviderErrorRetries: 1
|
|
167
|
+
});
|
|
168
|
+
};
|
|
159
169
|
function resolveAzureConfig(model, options) {
|
|
160
170
|
const apiVersion = options?.azureApiVersion || $env.AZURE_OPENAI_API_VERSION || DEFAULT_AZURE_API_VERSION;
|
|
161
171
|
const baseUrl = options?.azureBaseUrl?.trim() || $env.AZURE_OPENAI_BASE_URL?.trim() || void 0;
|
|
@@ -197,7 +207,7 @@ function buildAzureResponsesRequest(model, apiKey, options) {
|
|
|
197
207
|
}
|
|
198
208
|
const headers = {
|
|
199
209
|
"api-key": apiKey,
|
|
200
|
-
...model.headers
|
|
210
|
+
...model.headers
|
|
201
211
|
};
|
|
202
212
|
if (options?.headers) Object.assign(headers, options.headers);
|
|
203
213
|
const { baseUrl, apiVersion } = resolveAzureConfig(model, options);
|
|
@@ -223,7 +233,8 @@ function buildParams(model, context, options, deploymentName) {
|
|
|
223
233
|
},
|
|
224
234
|
includeThinkingSignatures: true,
|
|
225
235
|
developerStringContent: true,
|
|
226
|
-
preserveAssistantMessageIds: true
|
|
236
|
+
preserveAssistantMessageIds: true,
|
|
237
|
+
repairOrphanOutputs: true
|
|
227
238
|
}),
|
|
228
239
|
stream: true,
|
|
229
240
|
prompt_cache_key: getOpenAIPromptCacheKey(options),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { t as ensureChromiumExecutable } from "./launch-
|
|
4
|
-
import { l as htmlToBasicMarkdown } from "./types-
|
|
3
|
+
import { t as ensureChromiumExecutable } from "./launch-DKDH71En.mjs";
|
|
4
|
+
import { l as htmlToBasicMarkdown } from "./types-PVueGi9S.mjs";
|
|
5
5
|
//#region src/tools/omp/browser/readable.ts
|
|
6
6
|
/** Trim to non-empty string or undefined. */
|
|
7
7
|
function normalize(text) {
|
|
@@ -9,12 +9,12 @@ function normalize(text) {
|
|
|
9
9
|
}
|
|
10
10
|
let readabilityModule;
|
|
11
11
|
async function loadReadability() {
|
|
12
|
-
if (!readabilityModule) readabilityModule = await import("./readability-
|
|
12
|
+
if (!readabilityModule) readabilityModule = await import("./readability-uGhqb4GC.mjs");
|
|
13
13
|
return readabilityModule;
|
|
14
14
|
}
|
|
15
15
|
let domModule;
|
|
16
16
|
async function loadDom() {
|
|
17
|
-
if (!domModule) domModule = await import("./dom-
|
|
17
|
+
if (!domModule) domModule = await import("./dom-DG3sPESc.mjs");
|
|
18
18
|
return domModule;
|
|
19
19
|
}
|
|
20
20
|
/**
|
package/lib/bun-shim.mjs
CHANGED
|
@@ -4,6 +4,50 @@ import * as path from "node:path";
|
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
5
|
import { gzipSync } from "node:zlib";
|
|
6
6
|
import JSON5 from "json5";
|
|
7
|
+
//#region src/tools/bash/which.ts
|
|
8
|
+
/**
|
|
9
|
+
* Minimal PATH (+ PATHEXT on Windows) executable lookup — the plugin's single
|
|
10
|
+
* implementation of `Bun.which` semantics on the Node runtime.
|
|
11
|
+
*
|
|
12
|
+
* Two callers, one scanner: DSH code that must resolve executables the way OMP
|
|
13
|
+
* does (procmgr `resolveWindowsShell` for shell discovery, `REJECT_PROMPT_COMMAND`
|
|
14
|
+
* in non-interactive-env) calls `findOnPath` directly, and the bun-shim installs
|
|
15
|
+
* `Bun.which` on top of it — which is also how upstream pi-utils' `$which` lands
|
|
16
|
+
* here (@oh-my-pi/pi-utils src/which.ts:201 calls `Bun.which` on non-darwin).
|
|
17
|
+
* Single implementation — any new caller resolves executables through here,
|
|
18
|
+
* never hand-rolls a PATH walk.
|
|
19
|
+
* @module @xiaoso/dsh-tool-plus/bash/which
|
|
20
|
+
*/
|
|
21
|
+
/** Windows default extension order when PATHEXT is unset. */
|
|
22
|
+
const WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
23
|
+
/** True when `command` carries its own directory component. */
|
|
24
|
+
function hasPathSeparator(command) {
|
|
25
|
+
return command.includes("/") || command.includes("\\");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve `command` against PATH the way `Bun.which` would: absolute/relative
|
|
29
|
+
* candidates are returned as-is when they name an existing file; bare names
|
|
30
|
+
* are looked up in each PATH dir (appending PATHEXT extensions on win32, in
|
|
31
|
+
* order). Returns the first existing regular file, or `undefined`.
|
|
32
|
+
*/
|
|
33
|
+
function findOnPath(command, env = process.env) {
|
|
34
|
+
if (command.length === 0) return void 0;
|
|
35
|
+
if (hasPathSeparator(command)) try {
|
|
36
|
+
return fs.statSync(command).isFile() ? path.resolve(command) : void 0;
|
|
37
|
+
} catch {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const dirs = (env.PATH ?? "").split(path.delimiter).filter(Boolean);
|
|
41
|
+
const extensions = process.platform === "win32" ? (env.PATHEXT && env.PATHEXT.length > 0 ? env.PATHEXT : WIN32_DEFAULT_PATHEXT).split(";").filter(Boolean) : [];
|
|
42
|
+
const candidates = process.platform === "win32" ? [command, ...extensions.map((ext) => command + ext)] : [command];
|
|
43
|
+
for (const dir of dirs) for (const candidate of candidates) {
|
|
44
|
+
const full = path.join(dir, candidate);
|
|
45
|
+
try {
|
|
46
|
+
if (fs.statSync(full).isFile()) return full;
|
|
47
|
+
} catch {}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
7
51
|
//#region src/tools/shared/bun-shim.ts
|
|
8
52
|
/**
|
|
9
53
|
* DSH Bun compatibility shim — installs a Node implementation of the `Bun`
|
|
@@ -276,18 +320,35 @@ function xxHash64Core(bytes, seed) {
|
|
|
276
320
|
h ^= h >> 32n;
|
|
277
321
|
return h & MASK64;
|
|
278
322
|
}
|
|
279
|
-
|
|
323
|
+
/**
|
|
324
|
+
* `Bun.hash(input, seed?)` — FNV-1a 32-bit stand-in, seeded form included.
|
|
325
|
+
*
|
|
326
|
+
* The seed is load-bearing: pi-utils folds `command` → `cwd` → `PATH` into one
|
|
327
|
+
* cache key by re-seeding at each step (@oh-my-pi/pi-utils src/which.ts:207-209),
|
|
328
|
+
* so a shim that drops the seed collapses every command sharing a PATH onto a
|
|
329
|
+
* single `$which` cache slot (`$which("b")` returning `a`'s path). FNV steps are
|
|
330
|
+
* bijections mod 2^32, so distinct seeds stay distinct for equal input — exactly
|
|
331
|
+
* what a cache key needs. Single-argument values are unchanged (no seed → FNV
|
|
332
|
+
* offset basis).
|
|
333
|
+
*/
|
|
334
|
+
function bunHash(data, seed) {
|
|
280
335
|
let bytes;
|
|
281
336
|
if (typeof data === "string") bytes = new TextEncoder().encode(data);
|
|
282
337
|
else if (data instanceof ArrayBuffer) bytes = new Uint8Array(data);
|
|
283
338
|
else bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
284
|
-
let h =
|
|
339
|
+
let h = seedToBasis(seed);
|
|
285
340
|
for (const b of bytes) {
|
|
286
341
|
h ^= b;
|
|
287
342
|
h = Math.imul(h, 16777619) >>> 0;
|
|
288
343
|
}
|
|
289
344
|
return h >>> 0;
|
|
290
345
|
}
|
|
346
|
+
/** Seed → FNV-1a offset basis (non-finite numbers fall back to the default). */
|
|
347
|
+
function seedToBasis(seed) {
|
|
348
|
+
if (seed === void 0) return 2166136261;
|
|
349
|
+
if (typeof seed === "bigint") return Number(BigInt.asUintN(32, seed)) >>> 0;
|
|
350
|
+
return Number.isFinite(seed) ? Math.trunc(seed) >>> 0 : 2166136261;
|
|
351
|
+
}
|
|
291
352
|
function isWideChar(c) {
|
|
292
353
|
return c >= 4352 && (c <= 4447 || c === 9001 || c === 9002 || c >= 11904 && c <= 42191 && c !== 12351 || c >= 44032 && c <= 55203 || c >= 63744 && c <= 64255 || c >= 65040 && c <= 65049 || c >= 65072 && c <= 65135 || c >= 65280 && c <= 65376 || c >= 65504 && c <= 65510 || c >= 127744 && c <= 129791 || c >= 131072 && c <= 262141);
|
|
293
354
|
}
|
|
@@ -618,6 +679,13 @@ function bunStripANSI(text) {
|
|
|
618
679
|
}
|
|
619
680
|
return out;
|
|
620
681
|
}
|
|
682
|
+
function bunWhich(command, options) {
|
|
683
|
+
const cwd = options?.cwd;
|
|
684
|
+
return findOnPath(cwd !== void 0 && !path.isAbsolute(command) && (command.includes("/") || command.includes("\\")) ? path.resolve(cwd, command) : command, options?.PATH !== void 0 ? {
|
|
685
|
+
...process.env,
|
|
686
|
+
PATH: options.PATH
|
|
687
|
+
} : process.env) ?? null;
|
|
688
|
+
}
|
|
621
689
|
function installBunShim() {
|
|
622
690
|
patchBase64();
|
|
623
691
|
const g = globalThis;
|
|
@@ -626,6 +694,7 @@ function installBunShim() {
|
|
|
626
694
|
file: (p) => new BunFileShim(p),
|
|
627
695
|
write: bunWrite,
|
|
628
696
|
env: process.env,
|
|
697
|
+
which: bunWhich,
|
|
629
698
|
sleep: bunSleep,
|
|
630
699
|
hash: bunHash,
|
|
631
700
|
randomUUIDv7: bunRandomUUIDv7,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
2
|
__installBunShim();
|
|
3
|
-
import { i as getBundledProviders, r as getBundledModels } from "./models-
|
|
4
|
-
import {
|
|
5
|
-
//#region node_modules/.pnpm/@oh-my-pi+pi-catalog@
|
|
3
|
+
import { i as getBundledProviders, r as getBundledModels } from "./models-DnXMYGcJ.mjs";
|
|
4
|
+
import { n as isZeroCostXaiOAuthReference } from "./reference-CtvM4zLU.mjs";
|
|
5
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-catalog@18.1.17/node_modules/@oh-my-pi/pi-catalog/src/provider-models/bundled-references.ts
|
|
6
6
|
/**
|
|
7
7
|
* Project a built `Model` back to spec stage: `compat` becomes the verbatim
|
|
8
8
|
* sparse override record (`compatConfig`), never the resolved view. Discovery
|
|
@@ -10,9 +10,10 @@ import { r as isZeroCostXaiOAuthReference } from "./identity-HNO1Oe9B.mjs";
|
|
|
10
10
|
* manager, which rebuilds via `buildModel`.
|
|
11
11
|
*/
|
|
12
12
|
function toModelSpec(model) {
|
|
13
|
-
const { compat: _compat, compatConfig, ...rest } = model;
|
|
13
|
+
const { compat: _compat, compatConfig, supportsComputerUse: _derivedComputerUse, supportsComputerUseConfig, ...rest } = model;
|
|
14
14
|
return {
|
|
15
15
|
...rest,
|
|
16
|
+
...supportsComputerUseConfig !== void 0 ? { supportsComputerUse: supportsComputerUseConfig } : {},
|
|
16
17
|
compat: compatConfig
|
|
17
18
|
};
|
|
18
19
|
}
|
|
@@ -27,7 +28,7 @@ function getGlobalReferences() {
|
|
|
27
28
|
const references = /* @__PURE__ */ new Map();
|
|
28
29
|
for (const provider of getBundledProviders()) for (const model of getBundledModels(provider)) {
|
|
29
30
|
const candidate = model;
|
|
30
|
-
if (isZeroCostXaiOAuthReference(candidate)) continue;
|
|
31
|
+
if (candidate.provider === "cline-pass" || isZeroCostXaiOAuthReference(candidate)) continue;
|
|
31
32
|
const existing = references.get(candidate.id);
|
|
32
33
|
if (!existing) references.set(candidate.id, candidate);
|
|
33
34
|
else if (candidate.contextWindow !== existing.contextWindow) {
|