@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.
Files changed (109) hide show
  1. package/lib/{abort-DZ54CaKU.mjs → abort-BTblp0Rt.mjs} +2 -2
  2. package/lib/{alibaba-coding-plan-DODpkcqi.mjs → alibaba-coding-plan-t3R4YKCB.mjs} +3 -3
  3. package/lib/{alibaba-token-plan-C6lpKCda.mjs → alibaba-token-plan-CO4djG1y.mjs} +4 -4
  4. package/lib/{alibaba-token-plan-CHGyWOfX.mjs → alibaba-token-plan-CUjYJX0-.mjs} +1 -1
  5. package/lib/{anthropic-Dv_GGX6g.mjs → anthropic-nf7w6so1.mjs} +48 -21
  6. package/lib/{api-key-validation-MnMf_ihX.mjs → api-key-validation-C_tZ7Y9a.mjs} +2 -2
  7. package/lib/behavior-BwvTUtag.mjs +111 -0
  8. package/lib/{browser-render-BZXt548F.mjs → browser-render-BQaEVK_n.mjs} +4 -4
  9. package/lib/{reference-CtvM4zLU.mjs → bundled-references-CrQ4dQcT.mjs} +57 -4
  10. package/lib/cascade-BWjRTD1q.mjs +30265 -0
  11. package/lib/{cline-pass-BT9CBEOj.mjs → cline-pass-Bjm-O8GG.mjs} +2 -2
  12. package/lib/cloudflare-CKXRJ0l9.mjs +37 -0
  13. package/lib/{cloudflare-ai-gateway-DReN6ohJ.mjs → cloudflare-ai-gateway-BpnBSjwV.mjs} +8 -4
  14. package/lib/cloudflare-workers-ai-odj9XswL.mjs +32 -0
  15. package/lib/collapse-_nkb2dn7.mjs +1945 -0
  16. package/lib/{coreweave-C82HrLpb.mjs → coreweave-CGDZOD8-.mjs} +1 -1
  17. package/lib/{coreweave-C68UgRQO.mjs → coreweave-DwffcgW5.mjs} +4 -4
  18. package/lib/cursor-BgOuV7Qf.mjs +794 -0
  19. package/lib/{cursor-_gHHq-Dq.mjs → cursor-CF1iHHbv.mjs} +68 -19
  20. package/lib/{cursor-proto-Cr_WEMuv.mjs → cursor-proto-BuNTjX3L.mjs} +823 -23
  21. package/lib/{devin-QpfTSl9H.mjs → devin-7OEeEb80.mjs} +112 -31
  22. package/lib/{devin-proto-DYhp4Ty6.mjs → devin-proto-C-QreeAv.mjs} +71 -5
  23. package/lib/{dom-DG3sPESc.mjs → dom-BmbZv4v9.mjs} +598 -182
  24. package/lib/{error-O63pC8zg.mjs → error-8LVo7tug.mjs} +725 -104
  25. package/lib/factory-droid-ChhmsGWb.mjs +71 -0
  26. package/lib/{fs-promises-shim-B2YFWkcd.mjs → fs-promises-shim-CANAxFWh.mjs} +10 -1
  27. package/lib/{github-copilot-BMEcw8N1.mjs → github-copilot-QwevdT30.mjs} +4 -4
  28. package/lib/{github-copilot-headers-DnjGEbko.mjs → github-copilot-headers-CAUZ0rUD.mjs} +138 -26
  29. package/lib/{gitlab-duo-DnHqJjFY.mjs → gitlab-duo-DigV7k_o.mjs} +2 -2
  30. package/lib/{google-antigravity-B1mSckrK.mjs → google-antigravity-D-oe0r8A.mjs} +6 -7
  31. package/lib/{google-gemini-cli-DJwThCCn.mjs → google-gemini-cli-CQBHgGJT.mjs} +5 -6
  32. package/lib/{google-oauth-shared-BctLpVUN.mjs → google-oauth-shared-CvgVIUwJ.mjs} +2 -2
  33. package/lib/google-validation-CdvRj4ec.mjs +126 -0
  34. package/lib/id-EJwVLDHE.mjs +2548 -0
  35. package/lib/index.mjs +248 -258
  36. package/lib/{kilo-BEgEwMJQ.mjs → kilo-5r6OffCa.mjs} +2 -2
  37. package/lib/{kimi-T9NldEIJ.mjs → kimi-DOOtbXmm.mjs} +9 -10
  38. package/lib/{launch-BIWNyrBB.mjs → launch-DkAjib7h.mjs} +1 -1
  39. package/lib/{markit-Dvp2JPdT.mjs → markit-CCcyeAds.mjs} +359 -140
  40. package/lib/{models-DnXMYGcJ.mjs → models-DCpDT_im.mjs} +199203 -112275
  41. package/lib/{muse-code-CNvqqAp6.mjs → muse-code-CYf8zj_B.mjs} +5 -5
  42. package/lib/{openai-codex-D5-CyTxa.mjs → openai-codex-Cj-TvSFh.mjs} +13 -10
  43. package/lib/{perplexity-A2PEoGaC.mjs → perplexity-Dh_Qgsmx.mjs} +68 -25
  44. package/lib/{pkce-BYjmugmw.mjs → pkce-DO-jBJLV.mjs} +1 -1
  45. package/lib/pricing-DusBEhwm.mjs +593 -0
  46. package/lib/{readability-uGhqb4GC.mjs → readability-XHK0o3bv.mjs} +287 -27
  47. package/lib/{scrapers-C1ujjV8k.mjs → scrapers-B6PADOVm.mjs} +13 -13
  48. package/lib/slugify-ynYWBIA5.mjs +11 -0
  49. package/lib/snowflake-B_jap6lz.mjs +666 -0
  50. package/lib/snowflake-Cu1ZyOp6.mjs +151 -0
  51. package/lib/{src-AELUUb5U.mjs → src-BhinCSpi.mjs} +1172 -458
  52. package/lib/{stream-AVOoe5Hj.mjs → stream-D2ivg3GH.mjs} +3740 -5311
  53. package/lib/{turndown-D6fof1OX.mjs → turndown-Vya8SavL.mjs} +82 -30
  54. package/lib/types/tools/hashline/native/index.d.ts +2 -2
  55. package/lib/types/tools/hashline/native/policy.d.ts +19 -21
  56. package/lib/types/tools/omp/session/agent-storage.d.ts +3 -3
  57. package/lib/types/tools/shared/bun-named-shim.d.ts +5 -0
  58. package/lib/{types-BLrLohwK.mjs → types-tH1v9uRm.mjs} +2 -2
  59. package/lib/{utils-cZX3f_Ls.mjs → utils-C_Ncya1r.mjs} +1737 -509
  60. package/lib/utils-D2tK38xq.mjs +34006 -0
  61. package/lib/{utils-I4I8azHN.mjs → utils-DrDwmNtu.mjs} +8 -3
  62. package/lib/{xai-oauth-CbeldUSV.mjs → xai-oauth-DLLzX6my.mjs} +4 -4
  63. package/lib/{xiaomi-Dl3VSs04.mjs → xiaomi-CqK-KivK.mjs} +2 -2
  64. package/lib/{zai-FyjGSypr.mjs → zai-DoJ2xPIH.mjs} +2 -2
  65. package/lib/{zip-DRrycScC.mjs → zip-DG1mUV6X.mjs} +1 -1
  66. package/package.json +8 -8
  67. package/lib/amazon-bedrock-Dx0rr9dY.mjs +0 -996
  68. package/lib/anthropic-ClCw0PV_.mjs +0 -3624
  69. package/lib/anthropic-wire-lbGAFzYb.mjs +0 -927
  70. package/lib/azure-openai-responses-WE_bgFWp.mjs +0 -285
  71. package/lib/bundled-references-DY3EJxZV.mjs +0 -56
  72. package/lib/cloudflare-ai-gateway-CrMa97Ap.mjs +0 -44
  73. package/lib/collapse-CkMNRNr7.mjs +0 -2304
  74. package/lib/cursor-C6jaIJDg.mjs +0 -283
  75. package/lib/cursor-D-XZYDf_.mjs +0 -4544
  76. package/lib/deterministic-id-CUEIMSqR.mjs +0 -17
  77. package/lib/devin-ExGIghmx.mjs +0 -69
  78. package/lib/devin-u0ljw5P6.mjs +0 -628
  79. package/lib/effort-BdtQMN-_.mjs +0 -23
  80. package/lib/event-stream-BKEtb45Y.mjs +0 -167
  81. package/lib/gemini-headers-Co9cVvex.mjs +0 -54
  82. package/lib/google-auth-qAN-6DMW.mjs +0 -232
  83. package/lib/google-gemini-cli-B2Aw1S5w.mjs +0 -844
  84. package/lib/google-lTxuq28n.mjs +0 -38
  85. package/lib/google-shared-Y01j9xOr.mjs +0 -856
  86. package/lib/google-validation-BEkNs-Bx.mjs +0 -18
  87. package/lib/google-vertex-DcM-FRC5.mjs +0 -99
  88. package/lib/hosts-00rjRzUD.mjs +0 -203
  89. package/lib/id-AL5obQzR.mjs +0 -71
  90. package/lib/idle-iterator-D0ZXEcUq.mjs +0 -366
  91. package/lib/ollama-6R0oXZks.mjs +0 -574
  92. package/lib/openai-codex-responses-C8bnBWOe.mjs +0 -3232
  93. package/lib/openai-completions-DNr3mUsn.mjs +0 -1430
  94. package/lib/openai-configuration-update-xMYUjaK_.mjs +0 -150
  95. package/lib/openai-reasoning-fallback-Ju-5pSR8.mjs +0 -380
  96. package/lib/openai-responses-CjpafAEr.mjs +0 -861
  97. package/lib/protobuf-BMgDYu_U.mjs +0 -717
  98. package/lib/provider-response-SqKSkkUc.mjs +0 -22
  99. package/lib/proxy-DxvCQOCA.mjs +0 -230
  100. package/lib/request-debug-BwPOqN_j.mjs +0 -183
  101. package/lib/sanitize-text-BCf5KmCf.mjs +0 -33
  102. package/lib/sse-debug-B-tkLCPW.mjs +0 -11
  103. package/lib/stream-markup-healing-CN3RsqG9.mjs +0 -267
  104. package/lib/strict-tool-validation-CBTz1dAA.mjs +0 -105
  105. package/lib/taxonomy-DSIM99rS.mjs +0 -15392
  106. package/lib/thinking-ngMwf_1Y.mjs +0 -336
  107. package/lib/type-guards-CttAANEx.mjs +0 -11
  108. package/lib/utils-CE3DSebh.mjs +0 -11763
  109. package/lib/vision-guard-BCpXWUj3.mjs +0 -77
@@ -1,9 +1,9 @@
1
1
  import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
2
  __installBunShim();
3
- import { r as __exportAll } from "./fs-promises-shim-B2YFWkcd.mjs";
4
- import { f as OAuthError, t as ConfigurationError } from "./error-O63pC8zg.mjs";
3
+ import { i as __exportAll } from "./fs-promises-shim-CANAxFWh.mjs";
4
+ import { h as OAuthError, t as ConfigurationError } from "./error-8LVo7tug.mjs";
5
5
  import { type } from "@oh-my-pi/omptype";
6
- //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/muse-code.ts
6
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.12.6/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/muse-code.ts
7
7
  var muse_code_exports = /* @__PURE__ */ __exportAll({
8
8
  attachMuseCodeApiKey: () => attachMuseCodeApiKey,
9
9
  parseMuseCodeCredential: () => parseMuseCodeCredential,
@@ -30,8 +30,8 @@ const museCodeKeyResponseSchema = type({
30
30
  "user_email?": "string",
31
31
  "user_id?": "string",
32
32
  "is_subs_active?": "boolean",
33
- "subs_tier_id?": "string",
34
- "subs_tier_name?": "string",
33
+ "subs_tier_id?": "string | null",
34
+ "subs_tier_name?": "string | null",
35
35
  "subs_usage?": subscriptionUsageSchema.or("null")
36
36
  });
37
37
  const museCodeCredentialSchema = type({
@@ -1,9 +1,10 @@
1
1
  import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
2
  __installBunShim();
3
- import { f as OAuthError, m as LoginCancelledError } from "./error-O63pC8zg.mjs";
4
- import "./utils-cZX3f_Ls.mjs";
5
- import { n as isRecord } from "./type-guards-CttAANEx.mjs";
6
- //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/openai-codex.ts
3
+ import { _ as LoginCancelledError, h as OAuthError } from "./error-8LVo7tug.mjs";
4
+ import "./utils-C_Ncya1r.mjs";
5
+ import { h as isRecord } from "./cascade-BWjRTD1q.mjs";
6
+ import "./id-EJwVLDHE.mjs";
7
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.12.6/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/openai-codex.ts
7
8
  const CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
8
9
  const TOKEN_URL = "https://auth.openai.com/oauth/token";
9
10
  const JWT_CLAIM_PATH = "https://api.openai.com/auth";
@@ -64,7 +65,7 @@ function describeTokenEndpointValue(value) {
64
65
  const openAICodexProfileHook = async (credentials, context) => {
65
66
  const idToken = isRecord(context.raw) && typeof context.raw.id_token === "string" ? context.raw.id_token : void 0;
66
67
  const { accountId, email, planType } = getTokenProfile(credentials.access, idToken);
67
- if (context.phase === "login" && !accountId) throw new OAuthError("Failed to extract accountId from token", {
68
+ if (context.phase === "login" && !accountId && !email) throw new OAuthError("Failed to extract account identity from token", {
68
69
  kind: "validation",
69
70
  provider: context.provider
70
71
  });
@@ -119,15 +120,17 @@ async function exchangeCodeForToken(code, verifier, redirectUri, fetchImpl = fet
119
120
  const tokenData = await tokenResponse.json();
120
121
  if (!tokenData.access_token || !tokenData.refresh_token || typeof tokenData.expires_in !== "number") throw new OAuthError("Token response missing required fields", { kind: "validation" });
121
122
  const { accountId, email, planType } = getTokenProfile(tokenData.access_token, tokenData.id_token);
122
- if (!accountId) throw new OAuthError("Failed to extract accountId from token", { kind: "validation" });
123
+ if (!accountId && !email) throw new OAuthError("Failed to extract account identity from token", { kind: "validation" });
123
124
  return {
124
125
  access: tokenData.access_token,
125
126
  refresh: tokenData.refresh_token,
126
127
  expires: Date.now() + tokenData.expires_in * 1e3,
127
- accountId,
128
- email,
129
- orgId: accountId,
130
- orgName: planType
128
+ ...accountId ? {
129
+ accountId,
130
+ orgId: accountId
131
+ } : {},
132
+ ...email ? { email } : {},
133
+ ...planType ? { orgName: planType } : {}
131
134
  };
132
135
  }
133
136
  /**
@@ -1,21 +1,12 @@
1
1
  import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
2
  __installBunShim();
3
- import { E as CookieMap, N as $env, T as Cookie, w as $ } from "./src-AELUUb5U.mjs";
4
- import { V as ProviderHttpError, f as OAuthError, g as OnPromptRequiredError, m as LoginCancelledError } from "./error-O63pC8zg.mjs";
3
+ import { F as CookieMap, H as $env, N as $, P as Cookie } from "./src-BhinCSpi.mjs";
4
+ import { X as ProviderHttpError, _ as LoginCancelledError, h as OAuthError, y as OnPromptRequiredError } from "./error-8LVo7tug.mjs";
5
5
  import * as os from "node:os";
6
- //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/perplexity.ts
6
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.12.6/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/perplexity.ts
7
7
  /**
8
- * Perplexity login and token refresh.
9
- *
10
- * Login paths (in priority order):
11
- * 1. macOS native app: reads JWT from NSUserDefaults (`defaults read ai.perplexity.mac authToken`)
12
- * 2. HTTP email OTP: `GET /api/auth/csrf` → `POST /api/auth/signin-email` → `POST /api/auth/signin-otp`
13
- *
14
- * No browser or manual cookie paste required.
15
- * Refresh: Socket.IO `refreshJWT` RPC over authenticated WebSocket connection.
16
- *
17
- * Protocol: Engine.IO v4 + Socket.IO v4 over WebSocket (bypasses Cloudflare managed challenge).
18
- * Architecture reverse-engineered from Perplexity macOS app (ai.perplexity.mac).
8
+ * Perplexity login via legacy macOS session borrowing, host-managed browser SSO,
9
+ * or HTTP email OTP (including authenticator challenges).
19
10
  */
20
11
  const API_VERSION = "2.18";
21
12
  const NATIVE_APP_BUNDLE = "ai.perplexity.mac";
@@ -58,10 +49,7 @@ function jwtToCredentials(jwt, email) {
58
49
  email
59
50
  };
60
51
  }
61
- /**
62
- * Read the Perplexity JWT from the native macOS Catalyst app's UserDefaults.
63
- * Tokens are stored in NSUserDefaults (not Keychain), readable by any same-UID process.
64
- */
52
+ /** Read the legacy ai.perplexity.mac app's session; newer Mac apps use a restricted Keychain. */
65
53
  async function extractFromNativeApp() {
66
54
  if (os.platform() !== "darwin") return null;
67
55
  try {
@@ -214,23 +202,78 @@ async function httpEmailLogin(ctrl) {
214
202
  }
215
203
  return jwtToCredentials(token, trimmedEmail);
216
204
  }
217
- /**
218
- * Login to Perplexity.
219
- *
220
- * Tries auto-extraction from the desktop app, then runs HTTP email OTP login.
221
- *
222
- * No browser/manual token paste fallback is used.
223
- */
205
+ const SESSION_COOKIE_NAME = "__Secure-next-auth.session-token";
206
+ const PERPLEXITY_BASE_URL = "https://www.perplexity.ai";
207
+ async function browserSsoLogin(ctrl) {
208
+ if (!ctrl.onBrowserSession) throw new OAuthError("Browser SSO is unavailable in this client", {
209
+ kind: "validation",
210
+ provider: "perplexity"
211
+ });
212
+ ctrl.onProgress?.("Complete Perplexity sign-in in the browser window. Choose SSO for your organization.");
213
+ const token = (await ctrl.onBrowserSession({
214
+ url: `${PERPLEXITY_BASE_URL}/auth/signin`,
215
+ cookieNames: [SESSION_COOKIE_NAME, "next-auth.session-token"]
216
+ }, ctrl.signal)).trim();
217
+ if (ctrl.signal?.aborted) throw new LoginCancelledError();
218
+ if (!token || /[\s;]/.test(token)) throw new OAuthError("Perplexity SSO captured an invalid session cookie", {
219
+ kind: "validation",
220
+ provider: "perplexity"
221
+ });
222
+ ctrl.onProgress?.("Validating Perplexity session...");
223
+ const response = await (ctrl.fetch ?? fetch)(`${PERPLEXITY_BASE_URL}/api/auth/session`, {
224
+ headers: {
225
+ Cookie: `${SESSION_COOKIE_NAME}=${token}`,
226
+ "User-Agent": APP_USER_AGENT,
227
+ "X-App-ApiVersion": API_VERSION
228
+ },
229
+ redirect: "error",
230
+ signal: ctrl.signal
231
+ });
232
+ if (!response.ok) throw new ProviderHttpError(`Perplexity session validation failed (${response.status})`, response.status);
233
+ let email;
234
+ try {
235
+ email = (await response.json())?.user?.email;
236
+ } catch (error) {
237
+ if (ctrl.signal?.aborted) throw new LoginCancelledError();
238
+ if (!(error instanceof SyntaxError)) throw error;
239
+ throw new OAuthError("Perplexity returned an invalid session response", {
240
+ kind: "validation",
241
+ provider: "perplexity"
242
+ });
243
+ }
244
+ if (ctrl.signal?.aborted) throw new LoginCancelledError();
245
+ if (typeof email !== "string" || !email.trim()) throw new OAuthError("Perplexity session is invalid or expired. Sign in again.", {
246
+ kind: "validation",
247
+ provider: "perplexity"
248
+ });
249
+ return jwtToCredentials(token, email.trim());
250
+ }
251
+ /** Prefer legacy app borrowing, then offer browser SSO when the host supports it. */
224
252
  async function loginPerplexity(ctrl) {
225
253
  if (!ctrl.onPrompt) throw new OnPromptRequiredError("Perplexity");
254
+ if (ctrl.signal?.aborted) throw new LoginCancelledError();
226
255
  if (!$env.PI_AUTH_NO_BORROW) {
227
256
  ctrl.onProgress?.("Checking for Perplexity desktop app...");
228
257
  const nativeJwt = await extractFromNativeApp();
258
+ if (ctrl.signal?.aborted) throw new LoginCancelledError();
229
259
  if (nativeJwt) {
230
260
  ctrl.onProgress?.("Found Perplexity JWT from native app");
231
261
  return jwtToCredentials(nativeJwt);
232
262
  }
233
263
  }
264
+ if (ctrl.onBrowserSession) {
265
+ const method = (await ctrl.onPrompt({
266
+ message: "Login method: sso (browser) or email; blank for sso",
267
+ placeholder: "sso / email",
268
+ allowEmpty: true
269
+ })).trim().toLowerCase();
270
+ if (ctrl.signal?.aborted) throw new LoginCancelledError();
271
+ if (!method || method === "sso") return browserSsoLogin(ctrl);
272
+ if (method !== "email") throw new OAuthError("Choose sso or email for Perplexity login", {
273
+ kind: "validation",
274
+ provider: "perplexity"
275
+ });
276
+ }
234
277
  return httpEmailLogin(ctrl);
235
278
  }
236
279
  //#endregion
@@ -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@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/pkce.ts
3
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.12.6/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/pkce.ts
4
4
  /**
5
5
  * Generate PKCE code verifier and challenge.
6
6
  * Uses Web Crypto API for cross-platform compatibility.