@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.
Files changed (120) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.md +9 -3
  3. package/lib/{abort-Cwwm4Err.mjs → abort-Caqff3M6.mjs} +2 -2
  4. package/lib/alibaba-coding-plan-DTupMiAi.mjs +73 -0
  5. package/lib/alibaba-token-plan-CHGyWOfX.mjs +46 -0
  6. package/lib/alibaba-token-plan-Dj3OZhEE.mjs +82 -0
  7. package/lib/{amazon-bedrock-TVMpUTRG.mjs → amazon-bedrock-DbFSYXfJ.mjs} +117 -38
  8. package/lib/{anthropic-BL6LFDQS.mjs → anthropic-CTJ3IQVa.mjs} +675 -166
  9. package/lib/anthropic-CXfWlp-x.mjs +105 -0
  10. package/lib/{aws-credentials-B20dliS7.mjs → anthropic-wire-CKuhDwZ1.mjs} +74 -14
  11. package/lib/{api-key-login-CIDnXeYd.mjs → api-key-validation-CGCJFbFr.mjs} +27 -68
  12. package/lib/{azure-openai-responses-BkhsLmN3.mjs → azure-openai-responses-ChFbWaGj.mjs} +27 -16
  13. package/lib/{browser-render-CmgvSNte.mjs → browser-render-9o0Rknop.mjs} +4 -4
  14. package/lib/bun-shim.mjs +71 -2
  15. package/lib/{bundled-references-ChZSPDFw.mjs → bundled-references-DY3EJxZV.mjs} +6 -5
  16. package/lib/cline-pass-Bwg3esu9.mjs +44 -0
  17. package/lib/cloudflare-ai-gateway-BupNXyKK.mjs +35 -0
  18. package/lib/cloudflare-ai-gateway-EWo0VkP5.mjs +44 -0
  19. package/lib/collapse-DOR8sOGf.mjs +2304 -0
  20. package/lib/coreweave-C82HrLpb.mjs +31 -0
  21. package/lib/coreweave-Ct8cF-da.mjs +14 -0
  22. package/lib/{cursor-B6HcmplF.mjs → cursor-B95LzVWV.mjs} +11 -3
  23. package/lib/{cursor-CRpLpaZ3.mjs → cursor-DJV_dcgB.mjs} +887 -1784
  24. package/lib/{cursor-B8m6SqAH.mjs → cursor-LKGjucn2.mjs} +48 -38
  25. package/lib/cursor-proto-B8Wj8bv9.mjs +10513 -0
  26. package/lib/{deterministic-id-D-yIV_eI.mjs → deterministic-id-CUEIMSqR.mjs} +1 -1
  27. package/lib/devin-BMTdx_hx.mjs +316 -0
  28. package/lib/{devin-DUAfvBsW.mjs → devin-DSp0Rw_E.mjs} +172 -86
  29. package/lib/devin-ExGIghmx.mjs +69 -0
  30. package/lib/devin-proto-Br8fdyNl.mjs +2888 -0
  31. package/lib/{dom-CawWi8fa.mjs → dom-DG3sPESc.mjs} +8 -8
  32. package/lib/effort-BdtQMN-_.mjs +23 -0
  33. package/lib/{error-C-f_Wnw4.mjs → error-CORgGg5a.mjs} +275 -154
  34. package/lib/{event-stream-Dh2guZxS.mjs → event-stream-ulcDenZD.mjs} +20 -4
  35. package/lib/{gemini-headers-DKUShltF.mjs → gemini-headers-Co9cVvex.mjs} +2 -2
  36. package/lib/{github-copilot-suDymKrx.mjs → github-copilot-Dstq1D3s.mjs} +69 -29
  37. package/lib/github-copilot-headers-DOh1gt_w.mjs +312 -0
  38. package/lib/gitlab-duo-DSCMrU0m.mjs +11 -0
  39. package/lib/google-CtsKkOQK.mjs +38 -0
  40. package/lib/google-antigravity-z-5KsEci.mjs +252 -0
  41. package/lib/{google-auth-DYJLM792.mjs → google-auth-ieLBaneO.mjs} +4 -4
  42. package/lib/{google-gemini-cli-8BT513Ul.mjs → google-gemini-cli-C6NE5mWz.mjs} +28 -54
  43. package/lib/{google-gemini-cli-D6cSmfvB.mjs → google-gemini-cli-CAIPSl7e.mjs} +23 -29
  44. package/lib/google-oauth-shared-DhMllAkt.mjs +53 -0
  45. package/lib/{google-shared-CVbHK5vZ.mjs → google-shared-B0aNCYEH.mjs} +140 -44
  46. package/lib/{google-validation-Cgbn3tWJ.mjs → google-validation-BEkNs-Bx.mjs} +1 -1
  47. package/lib/{google-vertex-Bui-ypAe.mjs → google-vertex-Bbd1tYNc.mjs} +8 -8
  48. package/lib/hosts-00rjRzUD.mjs +203 -0
  49. package/lib/id-AL5obQzR.mjs +71 -0
  50. package/lib/{idle-iterator-CYAxUkSD.mjs → idle-iterator-DlUkEfzW.mjs} +3 -3
  51. package/lib/index.mjs +587 -5266
  52. package/lib/kilo-ChJL54wq.mjs +81 -0
  53. package/lib/kimi-C2c_Zq8A.mjs +67 -0
  54. package/lib/{launch-BmgEUycu.mjs → launch-DKDH71En.mjs} +1 -1
  55. package/lib/markit-CmRfm4E2.mjs +9885 -0
  56. package/lib/models-DnXMYGcJ.mjs +381604 -0
  57. package/lib/muse-code-Di1VZmB1.mjs +143 -0
  58. package/lib/{ollama-Df9ce-Cp.mjs → ollama-B8ic3sEp.mjs} +15 -30
  59. package/lib/{openai-codex-CAVI3Me-.mjs → openai-codex-DuJNC99x.mjs} +29 -99
  60. package/lib/{openai-codex-responses-BcnOotRB.mjs → openai-codex-responses-BL29nh9K.mjs} +204 -116
  61. package/lib/{openai-completions-Bq4WT47M.mjs → openai-completions-BK2f2dBv.mjs} +152 -82
  62. package/lib/openai-configuration-update-xMYUjaK_.mjs +150 -0
  63. package/lib/{openai-reasoning-fallback-DXsfiSXO.mjs → openai-reasoning-fallback-BdB3RCbj.mjs} +106 -12
  64. package/lib/{openai-responses-Mq_-PjvE.mjs → openai-responses-CGQPlIIy.mjs} +76 -82
  65. package/lib/{perplexity-XgLF73E7.mjs → perplexity-TBjz3VMB.mjs} +52 -9
  66. package/lib/{pkce-BlQikGPu.mjs → pkce-BYjmugmw.mjs} +1 -1
  67. package/lib/protobuf-aab1UGVn.mjs +717 -0
  68. package/lib/{provider-response-C6vcbQyO.mjs → provider-response-SqKSkkUc.mjs} +1 -1
  69. package/lib/{proxy-D9lm7ONA.mjs → proxy-5nWqRL1f.mjs} +45 -5
  70. package/lib/{readability-Cpm-ocau.mjs → readability-uGhqb4GC.mjs} +2 -2
  71. package/lib/reference-CtvM4zLU.mjs +114 -0
  72. package/lib/{request-debug-HJMoJncL.mjs → request-debug-NQN0BjHH.mjs} +1 -1
  73. package/lib/{sanitize-text-CfcXzw5X.mjs → sanitize-text-BCf5KmCf.mjs} +1 -1
  74. package/lib/{scrapers-CE_qK1yk.mjs → scrapers-D8oWspgW.mjs} +12 -12
  75. package/lib/{src-BcD0_rQR.mjs → src-BwW51vA5.mjs} +979 -388
  76. package/lib/{sse-debug-CYdjOC96.mjs → sse-debug-B-tkLCPW.mjs} +1 -1
  77. package/lib/{stream-Bjq8wjfr.mjs → stream-B_7qN-bA.mjs} +3802 -2623
  78. package/lib/stream-markup-healing-DKT1lnkW.mjs +267 -0
  79. package/lib/{strict-tool-validation-imVLUcbI.mjs → strict-tool-validation-CBTz1dAA.mjs} +2 -2
  80. package/lib/taxonomy-DSIM99rS.mjs +15392 -0
  81. package/lib/{stream-markup-healing-DZ6bVDxH.mjs → thinking-CiLa2LFB.mjs} +31 -186
  82. package/lib/{turndown-DN7ByzEI.mjs → turndown-DrX1M4WG.mjs} +4 -4
  83. package/lib/{type-guards-B9VVjRDK.mjs → type-guards-CttAANEx.mjs} +1 -1
  84. package/lib/{types-DX_bvuus.mjs → types-PVueGi9S.mjs} +2 -2
  85. package/lib/{utils-APrc-TBB.mjs → utils-CCfhUQen.mjs} +2364 -2676
  86. package/lib/{utils-Cp2Mxf_U.mjs → utils-CUPhpw9A.mjs} +413 -134
  87. package/lib/{utils-CQHPEQ3W.mjs → utils-DeWqNWV8.mjs} +2 -2
  88. package/lib/{vision-guard-mBmtAHx0.mjs → vision-guard-_XwsL1DF.mjs} +14 -29
  89. package/lib/xai-oauth-CXhnz0gO.mjs +210 -0
  90. package/lib/{xiaomi-7mE345KX.mjs → xiaomi-psoUItal.mjs} +8 -37
  91. package/lib/{zai-CeNpMV3W.mjs → zai-ApJ8HBgT.mjs} +8 -71
  92. package/lib/{zip-BK7UHCwX.mjs → zip-Kd602XNe.mjs} +1 -1
  93. package/package.json +43 -41
  94. package/presets/package.json +1 -1
  95. package/presets/tool-plus-ptc/agent.cordis.yml +13 -4
  96. package/presets/tool-plus-standard/agent.cordis.yml +11 -3
  97. package/lib/agent_pb-Rizyt9Zg.mjs +0 -805
  98. package/lib/anthropic-CDmj476p.mjs +0 -262
  99. package/lib/api_server_pb-CDZgLMta.mjs +0 -252
  100. package/lib/callback-server-CFJK-jvK.mjs +0 -398
  101. package/lib/codex-P1dGpX7G.mjs +0 -54
  102. package/lib/device-code-CuXTWYwY.mjs +0 -51
  103. package/lib/devin-BcQwht1W.mjs +0 -114
  104. package/lib/devin-BvMfGevz.mjs +0 -95
  105. package/lib/github-copilot-B3kQl0g0.mjs +0 -104
  106. package/lib/gitlab-duo-BriUTP8k.mjs +0 -155
  107. package/lib/gitlab-duo-workflow-wK5Ljzmc.mjs +0 -91
  108. package/lib/google-CE5tFDod.mjs +0 -30
  109. package/lib/google-antigravity-C1jgNljz.mjs +0 -198
  110. package/lib/google-oauth-shared-BLVTvokk.mjs +0 -147
  111. package/lib/grammar-D-NqNUxQ.mjs +0 -49
  112. package/lib/identity-HNO1Oe9B.mjs +0 -219
  113. package/lib/kimi-DgcUpPtK.mjs +0 -236
  114. package/lib/markit-DtGoRE6M.mjs +0 -1417
  115. package/lib/minimax-code-Y3h5li9N.mjs +0 -53
  116. package/lib/models-DRA2c_8U.mjs +0 -104660
  117. package/lib/opencode-BsVw9rCD.mjs +0 -38
  118. package/lib/to-binary-B1BEBIPC.mjs +0 -6002
  119. package/lib/wafer-BlhWLweO.mjs +0 -17
  120. package/lib/xai-oauth-5pORHUrg.mjs +0 -446
@@ -0,0 +1,252 @@
1
+ import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
+ __installBunShim();
3
+ import { f as OAuthError, m as LoginCancelledError } from "./error-CORgGg5a.mjs";
4
+ import { n as raceWithSignal } from "./abort-Caqff3M6.mjs";
5
+ import { n as getAntigravityUserAgent } from "./gemini-headers-Co9cVvex.mjs";
6
+ import { n as formatGoogleValidationRequiredMessage, t as extractGoogleValidationUrl } from "./google-validation-BEkNs-Bx.mjs";
7
+ import { n as throwIfLoginCancelled, t as oauthFetch } from "./google-oauth-shared-DhMllAkt.mjs";
8
+ import { type } from "@oh-my-pi/omptype";
9
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/google-antigravity.ts
10
+ /**
11
+ * Antigravity OAuth flow (Gemini 3, Claude, GPT-OSS via Google Cloud)
12
+ * Uses different OAuth credentials than google-gemini-cli for access to additional models.
13
+ */
14
+ const CLOUD_CODE_ASSIST_ENDPOINT = "https://daily-cloudcode-pa.googleapis.com";
15
+ const LOAD_CODE_ASSIST_URL = `${CLOUD_CODE_ASSIST_ENDPOINT}/v1internal:loadCodeAssist`;
16
+ const ONBOARD_USER_URL = `${CLOUD_CODE_ASSIST_ENDPOINT}/v1internal:onboardUser`;
17
+ const OPERATIONS_URL = `${CLOUD_CODE_ASSIST_ENDPOINT}/v1internal`;
18
+ const FREE_TIER_ID = "free-tier";
19
+ const ONBOARD_TIMEOUT_MS = 3e4;
20
+ const ONBOARD_POLL_INTERVAL_MS = 1e3;
21
+ const PROVIDER = "google-antigravity";
22
+ /** Cloud Code Assist metadata sent by native Antigravity control-plane requests. */
23
+ const ANTIGRAVITY_LOAD_CODE_ASSIST_METADATA = Object.freeze({ ideType: "ANTIGRAVITY" });
24
+ const userTierSchema = type({ "id?": "string" });
25
+ const ineligibleTierSchema = type({
26
+ "tierId?": "string",
27
+ "reasonMessage?": "string",
28
+ "validationUrl?": "string"
29
+ });
30
+ const loadCodeAssistResponseSchema = type({
31
+ "currentTier?": userTierSchema.or("null"),
32
+ "paidTier?": userTierSchema.or("null"),
33
+ "allowedTiers?": userTierSchema.array(),
34
+ "ineligibleTiers?": ineligibleTierSchema.array(),
35
+ "cloudaicompanionProject?": "string"
36
+ });
37
+ const operationErrorSchema = type({
38
+ "code?": "number",
39
+ "message?": "string"
40
+ });
41
+ const onboardUserResponseSchema = type({
42
+ "@type": "string",
43
+ "cloudaicompanionProject?": "string"
44
+ });
45
+ const onboardOperationSchema = type({
46
+ "name?": "string",
47
+ "done?": "boolean",
48
+ "error?": operationErrorSchema.or("null"),
49
+ "response?": onboardUserResponseSchema.or("null")
50
+ });
51
+ function parseLoadCodeAssistResponse(payload) {
52
+ const result = loadCodeAssistResponseSchema(payload);
53
+ if (result instanceof type.errors) throw new OAuthError(`failed to unmarshal LoadCodeAssistResponse: ${result.summary}`, {
54
+ kind: "provisioning",
55
+ provider: PROVIDER
56
+ });
57
+ return result;
58
+ }
59
+ function parseOnboardOperation(payload) {
60
+ const result = onboardOperationSchema(payload);
61
+ if (result instanceof type.errors) throw new OAuthError(`failed to unmarshal OnboardUser operation: ${result.summary}`, {
62
+ kind: "provisioning",
63
+ provider: PROVIDER
64
+ });
65
+ return result;
66
+ }
67
+ function extractProjectId(payload) {
68
+ const projectId = payload.cloudaicompanionProject;
69
+ return projectId && projectId.length > 0 ? projectId : void 0;
70
+ }
71
+ function hasMessageField(payload, field) {
72
+ return payload[field] !== void 0 && payload[field] !== null;
73
+ }
74
+ function isFreeTierAllowed(payload) {
75
+ return payload.allowedTiers?.some((tier) => tier.id === FREE_TIER_ID) === true;
76
+ }
77
+ function getFreeTierIneligibility(payload) {
78
+ const tier = payload.ineligibleTiers?.find((candidate) => candidate.tierId === FREE_TIER_ID);
79
+ if (!tier?.reasonMessage) return void 0;
80
+ return {
81
+ reasonMessage: tier.reasonMessage,
82
+ validationUrl: tier.validationUrl && tier.validationUrl.length > 0 ? tier.validationUrl : void 0
83
+ };
84
+ }
85
+ function assertFreeTierEligible(payload) {
86
+ if (isFreeTierAllowed(payload)) return;
87
+ const ineligibility = getFreeTierIneligibility(payload);
88
+ if (!ineligibility) return;
89
+ const validation = ineligibility.validationUrl ? `\n${ineligibility.validationUrl}` : "";
90
+ throw new OAuthError(`${ineligibility.reasonMessage}${validation}`, {
91
+ kind: "provisioning",
92
+ provider: PROVIDER
93
+ });
94
+ }
95
+ async function requestCloudCodeAssist({ label, url, method, headers, body, signal, timeoutMs }) {
96
+ throwIfLoginCancelled(signal);
97
+ const response = await oauthFetch(url, body === void 0 ? {
98
+ method,
99
+ headers
100
+ } : {
101
+ method,
102
+ headers,
103
+ body
104
+ }, {
105
+ provider: PROVIDER,
106
+ signal,
107
+ timeoutMs
108
+ });
109
+ if (response.status !== 200) {
110
+ const errorText = await response.text();
111
+ throw new OAuthError(`${label} failed: ${response.status} ${response.statusText}: ${errorText}`, {
112
+ kind: "provisioning",
113
+ provider: PROVIDER,
114
+ status: response.status
115
+ });
116
+ }
117
+ return response.json();
118
+ }
119
+ async function postLoadCodeAssist(context, body) {
120
+ return parseLoadCodeAssistResponse(await requestCloudCodeAssist({
121
+ ...context,
122
+ label: "loadCodeAssist",
123
+ url: LOAD_CODE_ASSIST_URL,
124
+ method: "POST",
125
+ body: JSON.stringify(body)
126
+ }));
127
+ }
128
+ async function loadCodeAssist(context) {
129
+ let payload = await postLoadCodeAssist(context, { metadata: ANTIGRAVITY_LOAD_CODE_ASSIST_METADATA });
130
+ const projectId = extractProjectId(payload);
131
+ if (!hasMessageField(payload, "paidTier") && projectId) payload = await postLoadCodeAssist(context, {
132
+ cloudaicompanionProject: projectId,
133
+ metadata: ANTIGRAVITY_LOAD_CODE_ASSIST_METADATA
134
+ });
135
+ return payload;
136
+ }
137
+ function remainingOnboardTime(deadline) {
138
+ const remaining = deadline - Date.now();
139
+ if (remaining > 0) return remaining;
140
+ throw new OAuthError(`onboardUser timed out after ${ONBOARD_TIMEOUT_MS}ms`, {
141
+ kind: "timeout",
142
+ provider: PROVIDER
143
+ });
144
+ }
145
+ function describeOperationError(error) {
146
+ if (error.message) return typeof error.code === "number" ? `${error.code}: ${error.message}` : error.message;
147
+ return JSON.stringify(error) ?? String(error);
148
+ }
149
+ async function onboardUser(context) {
150
+ const deadline = Date.now() + ONBOARD_TIMEOUT_MS;
151
+ let operation = parseOnboardOperation(await requestCloudCodeAssist({
152
+ ...context,
153
+ label: "onboardUser",
154
+ url: ONBOARD_USER_URL,
155
+ method: "POST",
156
+ body: JSON.stringify({
157
+ tierId: FREE_TIER_ID,
158
+ metadata: ANTIGRAVITY_LOAD_CODE_ASSIST_METADATA
159
+ }),
160
+ timeoutMs: remainingOnboardTime(deadline)
161
+ }));
162
+ while (true) {
163
+ if (operation.done === true) {
164
+ if (operation.error !== void 0 && operation.error !== null) throw new OAuthError(`OnboardUser operation failed: ${describeOperationError(operation.error)}`, {
165
+ kind: "provisioning",
166
+ provider: PROVIDER
167
+ });
168
+ if (operation.response === void 0 || operation.response === null) throw new OAuthError("failed to unmarshal OnboardUserResponse", {
169
+ kind: "provisioning",
170
+ provider: PROVIDER
171
+ });
172
+ return;
173
+ }
174
+ await raceWithSignal(Bun.sleep(Math.min(ONBOARD_POLL_INTERVAL_MS, remainingOnboardTime(deadline))), context.signal);
175
+ throwIfLoginCancelled(context.signal);
176
+ const operationName = operation.name ?? "";
177
+ if (operationName.length === 0) throw new OAuthError("onboardUser returned an operation without a name", {
178
+ kind: "provisioning",
179
+ provider: PROVIDER
180
+ });
181
+ operation = parseOnboardOperation(await requestCloudCodeAssist({
182
+ ...context,
183
+ label: "onboardUser operation",
184
+ url: `${OPERATIONS_URL}/${operationName}`,
185
+ method: "GET",
186
+ timeoutMs: remainingOnboardTime(deadline)
187
+ }));
188
+ }
189
+ }
190
+ async function discoverProject(accessToken, onProgress, signal) {
191
+ const context = {
192
+ headers: {
193
+ Authorization: `Bearer ${accessToken}`,
194
+ "Content-Type": "application/json",
195
+ "User-Agent": getAntigravityUserAgent()
196
+ },
197
+ signal
198
+ };
199
+ onProgress?.("Checking Cloud Code Assist account status...");
200
+ try {
201
+ const initial = await loadCodeAssist(context);
202
+ assertFreeTierEligible(initial);
203
+ if (!hasMessageField(initial, "currentTier")) {
204
+ onProgress?.("Provisioning the Antigravity free tier...");
205
+ await onboardUser(context);
206
+ }
207
+ onProgress?.("Refreshing Cloud Code Assist project...");
208
+ const projectId = extractProjectId(await loadCodeAssist(context));
209
+ if (projectId) return projectId;
210
+ throw new OAuthError("loadCodeAssist did not return a cloudaicompanionProject", {
211
+ kind: "provisioning",
212
+ provider: PROVIDER
213
+ });
214
+ } catch (error) {
215
+ throwIfLoginCancelled(signal);
216
+ if (error instanceof LoginCancelledError || error instanceof OAuthError) throw error;
217
+ throw new OAuthError(`Could not discover an Antigravity project. ${error instanceof Error ? error.message : String(error)}`, {
218
+ kind: "discovery",
219
+ provider: PROVIDER,
220
+ cause: error
221
+ });
222
+ }
223
+ }
224
+ /** Resolves the Antigravity project after login and preserves it across refresh responses. */
225
+ const googleAntigravityProjectHook = async (credentials, context) => {
226
+ if (context.phase === "refresh") return context.stored?.projectId ? {
227
+ ...credentials,
228
+ projectId: context.stored.projectId
229
+ } : credentials;
230
+ const raw = context.raw;
231
+ if (raw === null || typeof raw !== "object" || typeof raw.refresh_token !== "string" || raw.refresh_token === "") throw new OAuthError("No refresh token received. Please try again.", {
232
+ kind: "validation",
233
+ provider: context.provider
234
+ });
235
+ let projectId;
236
+ try {
237
+ projectId = await discoverProject(credentials.access, context.onProgress, context.signal);
238
+ } catch (error) {
239
+ const validationUrl = extractGoogleValidationUrl(error instanceof Error ? error.message : String(error));
240
+ if (!validationUrl) throw error;
241
+ throw new OAuthError(formatGoogleValidationRequiredMessage(validationUrl, "sign in again", credentials.email), {
242
+ kind: "validation",
243
+ provider: context.provider
244
+ });
245
+ }
246
+ return {
247
+ ...credentials,
248
+ projectId
249
+ };
250
+ };
251
+ //#endregion
252
+ export { googleAntigravityProjectHook };
@@ -1,12 +1,12 @@
1
1
  import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
2
  __installBunShim();
3
- import { F as $envpos, S as debug, y as isEnoent } from "./src-BcD0_rQR.mjs";
4
- import { c as OAuthError, g as MissingApiKeyError, t as ConfigurationError } from "./error-C-f_Wnw4.mjs";
5
- import { n as raceWithSignal } from "./abort-Cwwm4Err.mjs";
3
+ import { $ as isEnoent, P as $envpos, b as debug } from "./src-BwW51vA5.mjs";
4
+ import { f as OAuthError, h as MissingApiKeyError, t as ConfigurationError } from "./error-CORgGg5a.mjs";
5
+ import { n as raceWithSignal } from "./abort-Caqff3M6.mjs";
6
6
  import * as path from "node:path";
7
7
  import * as os from "node:os";
8
8
  import { Buffer } from "node:buffer";
9
- //#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/providers/google-auth.ts
9
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/google-auth.ts
10
10
  /**
11
11
  * Application Default Credentials (ADC) resolution for Vertex AI.
12
12
  *
@@ -1,26 +1,15 @@
1
1
  import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
2
  __installBunShim();
3
- import { P as $env } from "./src-BcD0_rQR.mjs";
4
- import { c as OAuthError } from "./error-C-f_Wnw4.mjs";
5
- import { i as getGeminiCliHeaders } from "./gemini-headers-DKUShltF.mjs";
6
- import { n as runGoogleOAuthLogin, r as throwIfLoginCancelled, t as oauthFetch } from "./google-oauth-shared-BLVTvokk.mjs";
7
- //#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/google-gemini-cli.ts
3
+ import { N as $env } from "./src-BwW51vA5.mjs";
4
+ import { f as OAuthError } from "./error-CORgGg5a.mjs";
5
+ import { r as getGeminiCliHeaders } from "./gemini-headers-Co9cVvex.mjs";
6
+ import { n as formatGoogleValidationRequiredMessage, t as extractGoogleValidationUrl } from "./google-validation-BEkNs-Bx.mjs";
7
+ import { n as throwIfLoginCancelled, t as oauthFetch } from "./google-oauth-shared-DhMllAkt.mjs";
8
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/registry/oauth/google-gemini-cli.ts
8
9
  /**
9
10
  * Gemini CLI OAuth flow (Google Cloud Code Assist)
10
11
  * Standard Gemini models only (gemini-2.0-flash, gemini-2.5-*)
11
12
  */
12
- const decode = (s) => atob(s);
13
- const CLIENT_ID = decode("NjgxMjU1ODA5Mzk1LW9vOGZ0Mm9wcmRybnA5ZTNhcWY2YXYzaG1kaWIxMzVqLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29t");
14
- const CLIENT_SECRET = decode("R09DU1BYLTR1SGdNUG0tMW83U2stZ2VWNkN1NWNsWEZzeGw=");
15
- const CALLBACK_PORT = 8085;
16
- const CALLBACK_PATH = "/oauth2callback";
17
- const SCOPES = [
18
- "https://www.googleapis.com/auth/cloud-platform",
19
- "https://www.googleapis.com/auth/userinfo.email",
20
- "https://www.googleapis.com/auth/userinfo.profile"
21
- ];
22
- const AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
23
- const TOKEN_URL = "https://oauth2.googleapis.com/token";
24
13
  const CODE_ASSIST_ENDPOINT = "https://cloudcode-pa.googleapis.com";
25
14
  const TIER_FREE = "free-tier";
26
15
  const TIER_LEGACY = "legacy-tier";
@@ -165,47 +154,32 @@ async function discoverProject(accessToken, onProgress, signal) {
165
154
  provider: "google-gemini-cli"
166
155
  });
167
156
  }
168
- async function loginGeminiCli(ctrl) {
169
- return runGoogleOAuthLogin(ctrl, {
170
- provider: "google-gemini-cli",
171
- clientId: CLIENT_ID,
172
- clientSecret: CLIENT_SECRET,
173
- authUrl: AUTH_URL,
174
- tokenUrl: TOKEN_URL,
175
- scopes: SCOPES,
176
- callbackPort: CALLBACK_PORT,
177
- callbackPath: CALLBACK_PATH,
178
- discoverProject
179
- });
180
- }
181
- /**
182
- * Refresh Google Cloud Code Assist token
183
- */
184
- async function refreshGoogleCloudToken(refreshToken, projectId) {
185
- const response = await fetch(TOKEN_URL, {
186
- method: "POST",
187
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
188
- body: new URLSearchParams({
189
- client_id: CLIENT_ID,
190
- client_secret: CLIENT_SECRET,
191
- refresh_token: refreshToken,
192
- grant_type: "refresh_token"
193
- })
157
+ /** Resolves the project after login and preserves it across refresh responses. */
158
+ const googleGeminiCliProjectHook = async (credentials, context) => {
159
+ if (context.phase === "refresh") return context.stored?.projectId ? {
160
+ ...credentials,
161
+ projectId: context.stored.projectId
162
+ } : credentials;
163
+ const raw = context.raw;
164
+ if (raw === null || typeof raw !== "object" || typeof raw.refresh_token !== "string" || raw.refresh_token === "") throw new OAuthError("No refresh token received. Please try again.", {
165
+ kind: "validation",
166
+ provider: context.provider
194
167
  });
195
- if (!response.ok) {
196
- const error = await response.text();
197
- throw new OAuthError(`Google Cloud token refresh failed: ${error}`, {
198
- kind: "token-refresh",
199
- provider: "google-gemini-cli"
168
+ let projectId;
169
+ try {
170
+ projectId = await discoverProject(credentials.access, context.onProgress, context.signal);
171
+ } catch (error) {
172
+ const validationUrl = extractGoogleValidationUrl(error instanceof Error ? error.message : String(error));
173
+ if (!validationUrl) throw error;
174
+ throw new OAuthError(formatGoogleValidationRequiredMessage(validationUrl, "sign in again", credentials.email), {
175
+ kind: "validation",
176
+ provider: context.provider
200
177
  });
201
178
  }
202
- const data = await response.json();
203
179
  return {
204
- refresh: data.refresh_token || refreshToken,
205
- access: data.access_token,
206
- expires: Date.now() + data.expires_in * 1e3 - 3e5,
180
+ ...credentials,
207
181
  projectId
208
182
  };
209
- }
183
+ };
210
184
  //#endregion
211
- export { loginGeminiCli, refreshGoogleCloudToken };
185
+ export { googleGeminiCliProjectHook };
@@ -1,22 +1,22 @@
1
1
  import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
2
  __installBunShim();
3
- import { o as readSseJson } from "./src-BcD0_rQR.mjs";
4
- import { G as fetchWithRetry, L as GeminiCliApiError, S as classify, W as extractHttpStatusFromError, a as isTransientStatus, c as OAuthError, j as retriable, l as finalize, n as StreamTimeoutError, r as ValidationError, s as ProviderResponseError, t as ConfigurationError, v as AbortError } from "./error-C-f_Wnw4.mjs";
5
- import { M as normalizeSchemaForCCA, a as normalizeSystemPrompts } from "./utils-Cp2Mxf_U.mjs";
6
- import { t as calculateCost } from "./models-DRA2c_8U.mjs";
7
- import { t as AssistantMessageEventStream } from "./event-stream-Dh2guZxS.mjs";
8
- import { i as getGeminiCliHeaders, n as getAntigravityUserAgent, t as getAntigravityModelWireProfile } from "./gemini-headers-DKUShltF.mjs";
9
- import { i as getStreamFirstEventTimeoutMs, o as iterateWithIdleTimeout, t as armPreResponseTimeout } from "./idle-iterator-CYAxUkSD.mjs";
10
- import { t as StreamMarkupHealing } from "./stream-markup-healing-DZ6bVDxH.mjs";
11
- import { n as formatGoogleValidationRequiredMessage, t as extractGoogleValidationUrl } from "./google-validation-Cgbn3tWJ.mjs";
12
- import { a as isThinkingPart, c as nextToolCallId, d as retainThoughtSignature, f as startTextOrThinkingBlock, i as hasMeaningfulGoogleContent, l as pushBlockEndEvent, n as convertMessages, o as mapStopReasonString, r as convertTools, s as mapToolChoice, u as pushToolCallEvents } from "./google-shared-CVbHK5vZ.mjs";
3
+ import { o as readSseJson } from "./src-BwW51vA5.mjs";
4
+ import { C as classify, G as fetchWithRetry, L as GeminiCliApiError, W as extractHttpStatusFromError, _ as AbortError, a as isTransientStatus, c as finalize, f as OAuthError, j as retriable, n as StreamTimeoutError, r as ValidationError, s as ProviderResponseError, t as ConfigurationError } from "./error-CORgGg5a.mjs";
5
+ import { N as normalizeSchemaForCCA, o as normalizeSystemPrompts } from "./utils-CUPhpw9A.mjs";
6
+ import { t as calculateCost } from "./models-DnXMYGcJ.mjs";
7
+ import { t as AssistantMessageEventStream } from "./event-stream-ulcDenZD.mjs";
8
+ import { n as getAntigravityUserAgent, r as getGeminiCliHeaders, t as getAntigravityModelWireProfile } from "./gemini-headers-Co9cVvex.mjs";
9
+ import { i as getStreamFirstEventTimeoutMs, o as iterateWithIdleTimeout, t as armPreResponseTimeout } from "./idle-iterator-DlUkEfzW.mjs";
10
+ import { t as StreamMarkupHealing } from "./stream-markup-healing-DKT1lnkW.mjs";
11
+ import { n as formatGoogleValidationRequiredMessage, t as extractGoogleValidationUrl } from "./google-validation-BEkNs-Bx.mjs";
12
+ import { a as isThinkingPart, c as nextToolCallId, d as retainThoughtSignature, f as startTextOrThinkingBlock, i as hasMeaningfulGoogleContent, l as pushBlockEndEvent, n as convertMessages, o as mapStopReasonString, r as convertTools, s as mapToolChoice, u as pushToolCallEvents } from "./google-shared-B0aNCYEH.mjs";
13
13
  import { scheduler } from "node:timers/promises";
14
14
  import { createHash, randomBytes, randomUUID } from "node:crypto";
15
15
  import { type } from "@oh-my-pi/omptype";
16
- //#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/providers/google-antigravity-forced-tool.md
16
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/google-antigravity-forced-tool.md
17
17
  var google_antigravity_forced_tool_default = "TOOL-ONLY TURN. This turn accepts a tool call and nothing else; a text reply here is discarded unread and you will be re-prompted. Emit the tool call now.\n";
18
18
  //#endregion
19
- //#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/providers/google-gemini-cli.ts
19
+ //#region node_modules/.pnpm/@oh-my-pi+pi-ai@18.1.17/node_modules/@oh-my-pi/pi-ai/src/providers/google-gemini-cli.ts
20
20
  /**
21
21
  * Google Gemini CLI / Antigravity provider.
22
22
  * Shared implementation for both google-gemini-cli and google-antigravity providers.
@@ -168,19 +168,12 @@ const ANTIGRAVITY_DAILY_ENDPOINT = "https://daily-cloudcode-pa.googleapis.com";
168
168
  const ANTIGRAVITY_SANDBOX_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
169
169
  const ANTIGRAVITY_ENDPOINT_FALLBACKS = [ANTIGRAVITY_DAILY_ENDPOINT, ANTIGRAVITY_SANDBOX_ENDPOINT];
170
170
  const BASE_DELAY_MS = 1e3;
171
- const FLASH_FIRST_EVENT_TIMEOUT_MS = 6e4;
172
171
  const DEFAULT_FIRST_EVENT_TIMEOUT_MS = 3e5;
173
172
  const FIRST_EVENT_TIMEOUT_ERROR = "Cloud Code Assist stream timed out while waiting for the first event";
174
173
  const RATE_LIMIT_BUDGET_MS = 3e5;
175
174
  const CLAUDE_THINKING_BETA_HEADER = "interleaved-thinking-2025-05-14";
176
175
  const GOOGLE_GEMINI_REFRESH_SKEW_MS = 6e4;
177
176
  const ANTIGRAVITY_REFRESH_SKEW_MS = 6e4;
178
- function isClaudeModel(modelId) {
179
- return modelId.toLowerCase().includes("claude");
180
- }
181
- function needsClaudeThinkingBetaHeader(model) {
182
- return model.provider === "google-antigravity" && model.id.startsWith("claude-") && model.reasoning;
183
- }
184
177
  const optionalCredentialString = type("unknown").pipe((raw) => {
185
178
  const out = type("string")(raw);
186
179
  return out instanceof type.errors ? void 0 : out;
@@ -308,8 +301,8 @@ const streamGoogleGeminiCli = (model, context, options) => {
308
301
  "Content-Type": "application/json",
309
302
  Accept: "text/event-stream",
310
303
  ...headers,
311
- ...needsClaudeThinkingBetaHeader(model) ? { "anthropic-beta": CLAUDE_THINKING_BETA_HEADER } : {},
312
- ...options?.headers ?? {}
304
+ ...model.compat.claudeThinkingBetaHeader && model.identity.class === "anthropic" && model.reasoning ? { "anthropic-beta": CLAUDE_THINKING_BETA_HEADER } : {},
305
+ ...options?.headers
313
306
  };
314
307
  const requestBodyJson = JSON.stringify(requestBody);
315
308
  rawRequestDump = {
@@ -320,10 +313,10 @@ const streamGoogleGeminiCli = (model, context, options) => {
320
313
  body: requestBody,
321
314
  headers: requestHeaders
322
315
  };
323
- const firstEventTimeoutMs = options?.streamFirstEventTimeoutMs ?? getStreamFirstEventTimeoutMs(void 0, model.id.includes("flash") ? FLASH_FIRST_EVENT_TIMEOUT_MS : DEFAULT_FIRST_EVENT_TIMEOUT_MS);
316
+ const firstEventTimeoutMs = options?.streamFirstEventTimeoutMs ?? getStreamFirstEventTimeoutMs(void 0, model.compat.streamFirstEventTimeoutMs ?? DEFAULT_FIRST_EVENT_TIMEOUT_MS);
324
317
  const callerSignal = options?.signal;
325
318
  const toolNames = new Set(context.tools?.map((t) => t.name) ?? []);
326
- const isFlashLeakModel = model.id.includes("flash");
319
+ const isFlashLeakModel = model.compat.flashStreamLeakWorkaround;
327
320
  let started = false;
328
321
  let sawFinishReason = false;
329
322
  let lastResponseId;
@@ -547,7 +540,7 @@ const streamGoogleGeminiCli = (model, context, options) => {
547
540
  total: 0
548
541
  }
549
542
  };
550
- calculateCost(model, output.usage);
543
+ calculateCost(model, output.usage, output.timestamp);
551
544
  }
552
545
  }
553
546
  if (isBuffering && textBuffer !== "") {
@@ -761,15 +754,16 @@ function buildAntigravityRequestEnvelope(model, context, wireModelId, state) {
761
754
  const sessionId = state?.sessionId ?? deriveAntigravitySessionId(context);
762
755
  const step = state?.stepIndex ?? 2;
763
756
  const requestId = `agent/${agentId}/${Date.now()}/${trajectoryId}/${step}`;
764
- const isClaude = isClaudeModel(model.id);
757
+ const isClaude = model.identity.class === "anthropic";
765
758
  const profile = getAntigravityModelWireProfile(wireModelId);
766
759
  const labels = {};
767
760
  if (state?.lastExecutionId) labels.last_execution_id = state.lastExecutionId;
768
761
  labels.last_step_index = String(step - 1);
769
762
  if (profile?.modelEnum !== void 0) labels.model_enum = profile.modelEnum;
770
763
  labels.trajectory_id = trajectoryId;
771
- labels.used_claude = String(isClaude);
772
- labels.used_claude_conservative = String(isClaude);
764
+ const usageLabel = model.compat.antigravityUsageLabel ?? String(isClaude);
765
+ labels.used_claude = usageLabel;
766
+ labels.used_claude_conservative = usageLabel;
773
767
  return {
774
768
  sessionId,
775
769
  requestId,
@@ -814,14 +808,14 @@ function buildRequest(model, context, projectId, options = {}, isAntigravity = f
814
808
  mode: "ANY",
815
809
  allowedFunctionNames: [...choice.allowedFunctionNames]
816
810
  } };
817
- if (isAntigravity && !isClaudeModel(model.id) && request.toolConfig?.functionCallingConfig.mode === "ANY") contents.push({
811
+ if (isAntigravity && model.identity.class !== "anthropic" && request.toolConfig?.functionCallingConfig.mode === "ANY") contents.push({
818
812
  role: "user",
819
813
  parts: [{ text: google_antigravity_forced_tool_default }]
820
814
  });
821
815
  }
822
816
  if (isAntigravity && !request.toolConfig) request.toolConfig = { functionCallingConfig: { mode: "VALIDATED" } };
823
817
  }
824
- if (isAntigravity && isClaudeModel(model.id)) request.toolConfig = { functionCallingConfig: { mode: "VALIDATED" } };
818
+ if (isAntigravity && model.identity.class === "anthropic" && model.compat.antigravityClaudeToolMode) request.toolConfig = { functionCallingConfig: { mode: "VALIDATED" } };
825
819
  const wireModelId = options.requestModelId ?? model.requestModelId ?? model.id;
826
820
  if (isAntigravity) {
827
821
  const profile = getAntigravityModelWireProfile(wireModelId);
@@ -0,0 +1,53 @@
1
+ import { installBunShim as __installBunShim } from "./bun-shim.mjs";
2
+ __installBunShim();
3
+ import { f as OAuthError, m as LoginCancelledError } 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/oauth/google-oauth-shared.ts
5
+ /**
6
+ * Shared OAuth flow for Google-style providers (Gemini CLI, Antigravity).
7
+ *
8
+ * Both providers use the same authorization-code flow shape; only the client
9
+ * credentials, scopes, endpoint constants, and project-discovery logic differ.
10
+ */
11
+ /**
12
+ * Per-request timeout for the post-callback provisioning phase (token exchange,
13
+ * user-info, project discovery/onboarding, LRO polling). These Cloud Code
14
+ * Assist calls normally settle in well under this window; a longer stall means
15
+ * a hung endpoint that must surface a login error instead of hanging forever.
16
+ * The callback server's own 300s deadline covers only the browser-callback wait
17
+ * ({@link OAuthCallbackFlow}) and does not gate this phase.
18
+ */
19
+ const OAUTH_REQUEST_TIMEOUT_MS = 3e4;
20
+ /**
21
+ * Throw {@link AIError.LoginCancelledError} when the controller signal has
22
+ * already aborted. Gates each provisioning round-trip, which the callback-wait
23
+ * cancellation checks in {@link OAuthCallbackFlow} do not reach.
24
+ */
25
+ function throwIfLoginCancelled(signal) {
26
+ if (signal?.aborted) throw new LoginCancelledError(`OAuth login cancelled: ${String(signal.reason)}`);
27
+ }
28
+ /**
29
+ * `fetch` for the provisioning phase: composes the controller signal with a
30
+ * per-request timeout so a stalled endpoint aborts instead of hanging login,
31
+ * and user cancellation aborts the in-flight request. Cancellation surfaces as
32
+ * {@link AIError.LoginCancelledError}; a timeout surfaces as an
33
+ * {@link AIError.OAuthError} with `kind: "timeout"`.
34
+ */
35
+ async function oauthFetch(url, init, { provider, signal, timeoutMs = OAUTH_REQUEST_TIMEOUT_MS }) {
36
+ const timeoutSignal = AbortSignal.timeout(timeoutMs);
37
+ const requestSignal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
38
+ try {
39
+ return await fetch(url, {
40
+ ...init,
41
+ signal: requestSignal
42
+ });
43
+ } catch (err) {
44
+ if (signal?.aborted) throw new LoginCancelledError(`OAuth login cancelled: ${String(signal.reason)}`);
45
+ if (timeoutSignal.aborted) throw new OAuthError(`Timed out after ${timeoutMs}ms waiting for ${url}`, {
46
+ kind: "timeout",
47
+ provider
48
+ });
49
+ throw err;
50
+ }
51
+ }
52
+ //#endregion
53
+ export { throwIfLoginCancelled as n, oauthFetch as t };