@xiaoso/dsh-tool-plus 0.1.16 → 0.1.17-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{abort-DZ54CaKU.mjs → abort-BTblp0Rt.mjs} +2 -2
- package/lib/{alibaba-coding-plan-DODpkcqi.mjs → alibaba-coding-plan-t3R4YKCB.mjs} +3 -3
- package/lib/{alibaba-token-plan-C6lpKCda.mjs → alibaba-token-plan-CO4djG1y.mjs} +4 -4
- package/lib/{alibaba-token-plan-CHGyWOfX.mjs → alibaba-token-plan-CUjYJX0-.mjs} +1 -1
- package/lib/{anthropic-Dv_GGX6g.mjs → anthropic-nf7w6so1.mjs} +48 -21
- package/lib/{api-key-validation-MnMf_ihX.mjs → api-key-validation-C_tZ7Y9a.mjs} +2 -2
- package/lib/behavior-BwvTUtag.mjs +111 -0
- package/lib/{browser-render-BZXt548F.mjs → browser-render-BQaEVK_n.mjs} +4 -4
- package/lib/{reference-CtvM4zLU.mjs → bundled-references-CrQ4dQcT.mjs} +57 -4
- package/lib/cascade-BWjRTD1q.mjs +30265 -0
- package/lib/{cline-pass-BT9CBEOj.mjs → cline-pass-Bjm-O8GG.mjs} +2 -2
- package/lib/cloudflare-CKXRJ0l9.mjs +37 -0
- package/lib/{cloudflare-ai-gateway-DReN6ohJ.mjs → cloudflare-ai-gateway-BpnBSjwV.mjs} +8 -4
- package/lib/cloudflare-workers-ai-odj9XswL.mjs +32 -0
- package/lib/collapse-_nkb2dn7.mjs +1945 -0
- package/lib/{coreweave-C82HrLpb.mjs → coreweave-CGDZOD8-.mjs} +1 -1
- package/lib/{coreweave-C68UgRQO.mjs → coreweave-DwffcgW5.mjs} +4 -4
- package/lib/cursor-BgOuV7Qf.mjs +794 -0
- package/lib/{cursor-_gHHq-Dq.mjs → cursor-CF1iHHbv.mjs} +68 -19
- package/lib/{cursor-proto-Cr_WEMuv.mjs → cursor-proto-BuNTjX3L.mjs} +823 -23
- package/lib/{devin-QpfTSl9H.mjs → devin-7OEeEb80.mjs} +112 -31
- package/lib/{devin-proto-DYhp4Ty6.mjs → devin-proto-C-QreeAv.mjs} +71 -5
- package/lib/{dom-DG3sPESc.mjs → dom-BmbZv4v9.mjs} +598 -182
- package/lib/{error-O63pC8zg.mjs → error-8LVo7tug.mjs} +725 -104
- package/lib/factory-droid-ChhmsGWb.mjs +71 -0
- package/lib/{fs-promises-shim-B2YFWkcd.mjs → fs-promises-shim-CANAxFWh.mjs} +10 -1
- package/lib/{github-copilot-BMEcw8N1.mjs → github-copilot-QwevdT30.mjs} +4 -4
- package/lib/{github-copilot-headers-DnjGEbko.mjs → github-copilot-headers-CAUZ0rUD.mjs} +138 -26
- package/lib/{gitlab-duo-DnHqJjFY.mjs → gitlab-duo-DigV7k_o.mjs} +2 -2
- package/lib/{google-antigravity-B1mSckrK.mjs → google-antigravity-D-oe0r8A.mjs} +6 -7
- package/lib/{google-gemini-cli-DJwThCCn.mjs → google-gemini-cli-CQBHgGJT.mjs} +5 -6
- package/lib/{google-oauth-shared-BctLpVUN.mjs → google-oauth-shared-CvgVIUwJ.mjs} +2 -2
- package/lib/google-validation-CdvRj4ec.mjs +126 -0
- package/lib/id-EJwVLDHE.mjs +2548 -0
- package/lib/index.mjs +248 -258
- package/lib/{kilo-BEgEwMJQ.mjs → kilo-5r6OffCa.mjs} +2 -2
- package/lib/{kimi-T9NldEIJ.mjs → kimi-DOOtbXmm.mjs} +9 -10
- package/lib/{launch-BIWNyrBB.mjs → launch-DkAjib7h.mjs} +1 -1
- package/lib/{markit-Dvp2JPdT.mjs → markit-CCcyeAds.mjs} +359 -140
- package/lib/{models-DnXMYGcJ.mjs → models-DCpDT_im.mjs} +199203 -112275
- package/lib/{muse-code-CNvqqAp6.mjs → muse-code-CYf8zj_B.mjs} +5 -5
- package/lib/{openai-codex-D5-CyTxa.mjs → openai-codex-Cj-TvSFh.mjs} +13 -10
- package/lib/{perplexity-A2PEoGaC.mjs → perplexity-Dh_Qgsmx.mjs} +68 -25
- package/lib/{pkce-BYjmugmw.mjs → pkce-DO-jBJLV.mjs} +1 -1
- package/lib/pricing-DusBEhwm.mjs +593 -0
- package/lib/{readability-uGhqb4GC.mjs → readability-XHK0o3bv.mjs} +287 -27
- package/lib/{scrapers-C1ujjV8k.mjs → scrapers-B6PADOVm.mjs} +13 -13
- package/lib/slugify-ynYWBIA5.mjs +11 -0
- package/lib/snowflake-B_jap6lz.mjs +666 -0
- package/lib/snowflake-Cu1ZyOp6.mjs +151 -0
- package/lib/{src-AELUUb5U.mjs → src-BhinCSpi.mjs} +1172 -458
- package/lib/{stream-AVOoe5Hj.mjs → stream-D2ivg3GH.mjs} +3740 -5311
- package/lib/{turndown-D6fof1OX.mjs → turndown-Vya8SavL.mjs} +82 -30
- package/lib/types/tools/hashline/native/index.d.ts +2 -2
- package/lib/types/tools/hashline/native/policy.d.ts +19 -21
- package/lib/types/tools/omp/session/agent-storage.d.ts +3 -3
- package/lib/types/tools/shared/bun-named-shim.d.ts +5 -0
- package/lib/{types-BLrLohwK.mjs → types-tH1v9uRm.mjs} +2 -2
- package/lib/{utils-cZX3f_Ls.mjs → utils-C_Ncya1r.mjs} +1737 -509
- package/lib/utils-D2tK38xq.mjs +34006 -0
- package/lib/{utils-I4I8azHN.mjs → utils-DrDwmNtu.mjs} +8 -3
- package/lib/{xai-oauth-CbeldUSV.mjs → xai-oauth-DLLzX6my.mjs} +4 -4
- package/lib/{xiaomi-Dl3VSs04.mjs → xiaomi-CqK-KivK.mjs} +2 -2
- package/lib/{zai-FyjGSypr.mjs → zai-DoJ2xPIH.mjs} +2 -2
- package/lib/{zip-DRrycScC.mjs → zip-DG1mUV6X.mjs} +1 -1
- package/package.json +8 -8
- package/lib/amazon-bedrock-Dx0rr9dY.mjs +0 -996
- package/lib/anthropic-ClCw0PV_.mjs +0 -3624
- package/lib/anthropic-wire-lbGAFzYb.mjs +0 -927
- package/lib/azure-openai-responses-WE_bgFWp.mjs +0 -285
- package/lib/bundled-references-DY3EJxZV.mjs +0 -56
- package/lib/cloudflare-ai-gateway-CrMa97Ap.mjs +0 -44
- package/lib/collapse-CkMNRNr7.mjs +0 -2304
- package/lib/cursor-C6jaIJDg.mjs +0 -283
- package/lib/cursor-D-XZYDf_.mjs +0 -4544
- package/lib/deterministic-id-CUEIMSqR.mjs +0 -17
- package/lib/devin-ExGIghmx.mjs +0 -69
- package/lib/devin-u0ljw5P6.mjs +0 -628
- package/lib/effort-BdtQMN-_.mjs +0 -23
- package/lib/event-stream-BKEtb45Y.mjs +0 -167
- package/lib/gemini-headers-Co9cVvex.mjs +0 -54
- package/lib/google-auth-qAN-6DMW.mjs +0 -232
- package/lib/google-gemini-cli-B2Aw1S5w.mjs +0 -844
- package/lib/google-lTxuq28n.mjs +0 -38
- package/lib/google-shared-Y01j9xOr.mjs +0 -856
- package/lib/google-validation-BEkNs-Bx.mjs +0 -18
- package/lib/google-vertex-DcM-FRC5.mjs +0 -99
- package/lib/hosts-00rjRzUD.mjs +0 -203
- package/lib/id-AL5obQzR.mjs +0 -71
- package/lib/idle-iterator-D0ZXEcUq.mjs +0 -366
- package/lib/ollama-6R0oXZks.mjs +0 -574
- package/lib/openai-codex-responses-C8bnBWOe.mjs +0 -3232
- package/lib/openai-completions-DNr3mUsn.mjs +0 -1430
- package/lib/openai-configuration-update-xMYUjaK_.mjs +0 -150
- package/lib/openai-reasoning-fallback-Ju-5pSR8.mjs +0 -380
- package/lib/openai-responses-CjpafAEr.mjs +0 -861
- package/lib/protobuf-BMgDYu_U.mjs +0 -717
- package/lib/provider-response-SqKSkkUc.mjs +0 -22
- package/lib/proxy-DxvCQOCA.mjs +0 -230
- package/lib/request-debug-BwPOqN_j.mjs +0 -183
- package/lib/sanitize-text-BCf5KmCf.mjs +0 -33
- package/lib/sse-debug-B-tkLCPW.mjs +0 -11
- package/lib/stream-markup-healing-CN3RsqG9.mjs +0 -267
- package/lib/strict-tool-validation-CBTz1dAA.mjs +0 -105
- package/lib/taxonomy-DSIM99rS.mjs +0 -15392
- package/lib/thinking-ngMwf_1Y.mjs +0 -336
- package/lib/type-guards-CttAANEx.mjs +0 -11
- package/lib/utils-CE3DSebh.mjs +0 -11763
- package/lib/vision-guard-BCpXWUj3.mjs +0 -77
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import "./src-BhinCSpi.mjs";
|
|
4
|
+
import { _ as LoginCancelledError, h as OAuthError, y as OnPromptRequiredError } from "./error-8LVo7tug.mjs";
|
|
5
|
+
import { h as isRecord } from "./cascade-BWjRTD1q.mjs";
|
|
6
|
+
import { i as authPolicyFor, r as OAuthCallbackFlow, t as normalizeSnowflakeAccountUrl } from "./snowflake-B_jap6lz.mjs";
|
|
7
|
+
import { t as generatePKCE } from "./pkce-DO-jBJLV.mjs";
|
|
8
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.12.6/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/snowflake.ts
|
|
9
|
+
const SNOWFLAKE_OAUTH_CLIENT_ID = "LOCAL_APPLICATION";
|
|
10
|
+
function snowflakeCallbackPort() {
|
|
11
|
+
const port = authPolicyFor("snowflake")?.callbackPort;
|
|
12
|
+
if (port === void 0) throw new Error("Snowflake auth policy is missing callback-port");
|
|
13
|
+
return port;
|
|
14
|
+
}
|
|
15
|
+
async function parseTokenResponse(response, kind, signal) {
|
|
16
|
+
signal?.throwIfAborted();
|
|
17
|
+
if (!response.ok) throw new OAuthError(`Snowflake token ${kind === "token-exchange" ? "exchange" : "refresh"} failed (${response.status})`, {
|
|
18
|
+
kind,
|
|
19
|
+
provider: "snowflake",
|
|
20
|
+
status: response.status
|
|
21
|
+
});
|
|
22
|
+
let body;
|
|
23
|
+
try {
|
|
24
|
+
body = await response.json();
|
|
25
|
+
} catch (error) {
|
|
26
|
+
signal?.throwIfAborted();
|
|
27
|
+
if (error instanceof Error && error.name === "AbortError") throw error;
|
|
28
|
+
throw new OAuthError("Snowflake returned an invalid token response", {
|
|
29
|
+
kind: "validation",
|
|
30
|
+
provider: "snowflake"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
signal?.throwIfAborted();
|
|
34
|
+
if (!isRecord(body) || typeof body.access_token !== "string" || !body.access_token.trim() || typeof body.expires_in !== "number" || !Number.isFinite(body.expires_in) || body.expires_in <= 0 || body.refresh_token !== void 0 && (typeof body.refresh_token !== "string" || !body.refresh_token.trim())) throw new OAuthError("Snowflake returned an invalid token response", {
|
|
35
|
+
kind: "validation",
|
|
36
|
+
provider: "snowflake"
|
|
37
|
+
});
|
|
38
|
+
const lifetimeMs = body.expires_in * 1e3;
|
|
39
|
+
if (!Number.isFinite(lifetimeMs) || lifetimeMs <= 0) throw new OAuthError("Snowflake returned an invalid token lifetime", {
|
|
40
|
+
kind: "validation",
|
|
41
|
+
provider: "snowflake"
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
access: body.access_token,
|
|
45
|
+
refresh: body.refresh_token,
|
|
46
|
+
expires: Date.now() + lifetimeMs
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
var SnowflakeOAuthFlow = class extends OAuthCallbackFlow {
|
|
50
|
+
#accountUrl;
|
|
51
|
+
#verifier = "";
|
|
52
|
+
constructor(ctrl, accountUrl) {
|
|
53
|
+
super(ctrl, {
|
|
54
|
+
preferredPort: snowflakeCallbackPort(),
|
|
55
|
+
callbackPath: "/",
|
|
56
|
+
callbackHostname: "127.0.0.1"
|
|
57
|
+
});
|
|
58
|
+
this.#accountUrl = accountUrl;
|
|
59
|
+
}
|
|
60
|
+
async generateAuthUrl(state, redirectUri) {
|
|
61
|
+
const { verifier, challenge } = await generatePKCE();
|
|
62
|
+
this.#verifier = verifier;
|
|
63
|
+
const params = new URLSearchParams({
|
|
64
|
+
client_id: SNOWFLAKE_OAUTH_CLIENT_ID,
|
|
65
|
+
response_type: "code",
|
|
66
|
+
redirect_uri: redirectUri,
|
|
67
|
+
scope: "refresh_token",
|
|
68
|
+
state,
|
|
69
|
+
code_challenge: challenge,
|
|
70
|
+
code_challenge_method: "S256"
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
url: `${this.#accountUrl}/oauth/authorize?${params.toString()}`,
|
|
74
|
+
instructions: "Sign in to Snowflake in your browser and approve access for omp."
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async exchangeToken(code, _state, redirectUri) {
|
|
78
|
+
const signal = this.ctrl.signal;
|
|
79
|
+
const fetchImpl = this.ctrl.fetch ?? fetch;
|
|
80
|
+
let tokens;
|
|
81
|
+
try {
|
|
82
|
+
tokens = await parseTokenResponse(await fetchImpl(`${this.#accountUrl}/oauth/token-request`, {
|
|
83
|
+
method: "POST",
|
|
84
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
85
|
+
body: new URLSearchParams({
|
|
86
|
+
grant_type: "authorization_code",
|
|
87
|
+
code,
|
|
88
|
+
redirect_uri: redirectUri,
|
|
89
|
+
code_verifier: this.#verifier,
|
|
90
|
+
client_id: SNOWFLAKE_OAUTH_CLIENT_ID
|
|
91
|
+
}),
|
|
92
|
+
signal,
|
|
93
|
+
redirect: "error"
|
|
94
|
+
}), "token-exchange", signal);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (signal?.aborted) throw new LoginCancelledError();
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
...tokens,
|
|
101
|
+
refresh: tokens.refresh ?? "",
|
|
102
|
+
enterpriseUrl: this.#accountUrl
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
async function loginSnowflake(ctrl) {
|
|
107
|
+
if (!ctrl.onPrompt) throw new OnPromptRequiredError("Snowflake");
|
|
108
|
+
if (ctrl.signal?.aborted) throw new LoginCancelledError();
|
|
109
|
+
const account = await ctrl.onPrompt({
|
|
110
|
+
message: "Enter your Snowflake account identifier or URL",
|
|
111
|
+
placeholder: "myorg-myaccount"
|
|
112
|
+
});
|
|
113
|
+
if (ctrl.signal?.aborted) throw new LoginCancelledError();
|
|
114
|
+
return new SnowflakeOAuthFlow(ctrl, normalizeSnowflakeAccountUrl(account)).login();
|
|
115
|
+
}
|
|
116
|
+
async function refreshSnowflakeToken(credentials, signal) {
|
|
117
|
+
if (!credentials.refresh.trim()) {
|
|
118
|
+
if (Date.now() < credentials.expires) return credentials;
|
|
119
|
+
throw new OAuthError("Snowflake did not issue a refresh token; run /login snowflake again or use SNOWFLAKE_ACCOUNT and SNOWFLAKE_PAT", {
|
|
120
|
+
kind: "token-refresh",
|
|
121
|
+
provider: "snowflake"
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
let accountUrl;
|
|
125
|
+
try {
|
|
126
|
+
accountUrl = normalizeSnowflakeAccountUrl(credentials.enterpriseUrl ?? "");
|
|
127
|
+
} catch {
|
|
128
|
+
throw new OAuthError("Invalid Snowflake account; run /login snowflake again", {
|
|
129
|
+
kind: "validation",
|
|
130
|
+
provider: "snowflake"
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const tokens = await parseTokenResponse(await fetch(`${accountUrl}/oauth/token-request`, {
|
|
134
|
+
method: "POST",
|
|
135
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
136
|
+
body: new URLSearchParams({
|
|
137
|
+
grant_type: "refresh_token",
|
|
138
|
+
refresh_token: credentials.refresh,
|
|
139
|
+
client_id: SNOWFLAKE_OAUTH_CLIENT_ID
|
|
140
|
+
}),
|
|
141
|
+
signal,
|
|
142
|
+
redirect: "error"
|
|
143
|
+
}), "token-refresh", signal);
|
|
144
|
+
return {
|
|
145
|
+
...credentials,
|
|
146
|
+
...tokens,
|
|
147
|
+
refresh: tokens.refresh ?? credentials.refresh
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
export { loginSnowflake, refreshSnowflakeToken };
|