@wenathlan/devthink 2.0.12 → 2.0.14
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/CHANGELOG.md +20 -0
- package/accounts.ts +2087 -0
- package/agent.ts +2331 -0
- package/antigravity.ts +2139 -0
- package/apifreeze.ts +4146 -0
- package/auth.ts +642 -0
- package/background.ts +16837 -0
- package/bridge.ts +2080 -0
- package/build.ts +54 -0
- package/bun.ts +26 -0
- package/capture.ts +1614 -0
- package/checksecrets.ts +72 -0
- package/cjs.ts +9 -0
- package/cli.ts +3500 -0
- package/commands.ts +1101 -0
- package/companion.ts +450 -0
- package/compatibility.ts +37 -0
- package/config.ts +3137 -0
- package/constants.ts +943 -0
- package/core.ts +1473 -0
- package/crossbrowser.ts +1359 -0
- package/dashdone.ts +605 -0
- package/data.ts +943 -0
- package/database.ts +133 -0
- package/debug.ts +850 -0
- package/deno.ts +27 -0
- package/devthink.ts +707 -0
- package/dist/accounts.d.ts +409 -0
- package/dist/agent.d.ts +837 -0
- package/dist/antigravity.d.ts +380 -0
- package/dist/apifreeze.d.ts +113 -0
- package/dist/auth.d.ts +224 -0
- package/{bridge.d.ts → dist/bridge.d.ts} +1 -1
- package/dist/capture.d.ts +595 -0
- package/dist/cjs.d.ts +6 -0
- package/{cli.js → dist/cli.js} +2 -2
- package/dist/commands.d.ts +310 -0
- package/dist/compatibility.d.ts +17 -0
- package/dist/config.d.ts +1853 -0
- package/dist/constants.d.ts +637 -0
- package/dist/core.d.ts +361 -0
- package/dist/data.d.ts +330 -0
- package/dist/database.d.ts +24 -0
- package/dist/debug.d.ts +270 -0
- package/dist/engine.d.ts +74 -0
- package/dist/environments.d.ts +244 -0
- package/dist/evidence.d.ts +277 -0
- package/dist/export.d.ts +311 -0
- package/dist/fingerprint.d.ts +594 -0
- package/dist/flow.d.ts +300 -0
- package/dist/gates.d.ts +103 -0
- package/dist/identity.d.ts +51 -0
- package/dist/ids.d.ts +7 -0
- package/dist/llm.d.ts +652 -0
- package/dist/models.d.ts +1807 -0
- package/dist/net.d.ts +325 -0
- package/dist/neutral.d.ts +41 -0
- package/dist/oauth.d.ts +703 -0
- package/dist/page.d.ts +1166 -0
- package/dist/perf.d.ts +481 -0
- package/dist/plan.d.ts +134 -0
- package/dist/project.d.ts +395 -0
- package/dist/providers.d.ts +37 -0
- package/dist/quota.d.ts +453 -0
- package/dist/recovery.d.ts +621 -0
- package/dist/request.d.ts +1492 -0
- package/dist/run.d.ts +779 -0
- package/dist/runtime.d.ts +212 -0
- package/dist/search.d.ts +375 -0
- package/dist/security.d.ts +534 -0
- package/dist/serve.d.ts +136 -0
- package/dist/session.d.ts +296 -0
- package/dist/storage.d.ts +53 -0
- package/dist/streaming.d.ts +1119 -0
- package/dist/swarm.d.ts +328 -0
- package/dist/tools.d.ts +170 -0
- package/dist/types.d.ts +8357 -0
- package/dist/utils.d.ts +82 -0
- package/dist/version.d.ts +7 -0
- package/dist/versionregistry.d.ts +406 -0
- package/dist/views.d.ts +579 -0
- package/dist/workbenchsession.d.ts +69 -0
- package/dist/workflow.d.ts +649 -0
- package/docs/readme.md +92 -0
- package/docs/schemas/antigravity.json +192 -0
- package/engine.ts +1524 -0
- package/environments.ts +1005 -0
- package/evidence.ts +643 -0
- package/export.ts +889 -0
- package/fingerprint.ts +1458 -0
- package/flow.ts +1190 -0
- package/gates.ts +307 -0
- package/gateway.ts +34 -0
- package/hardening.ts +191 -0
- package/headless.ts +369 -0
- package/http.ts +2110 -0
- package/identity.ts +246 -0
- package/ids.ts +26 -0
- package/index.ts +369 -0
- package/llm.ts +2682 -0
- package/mcp.ts +1835 -0
- package/{memory.js → memory.ts} +3834 -2310
- package/models.ts +3805 -0
- package/modes.ts +43 -0
- package/net.ts +1214 -0
- package/neutral.ts +362 -0
- package/node.ts +26 -0
- package/oauth.ts +2216 -0
- package/offscreen.ts +170 -0
- package/pack.ts +956 -0
- package/package.json +175 -82
- package/page.ts +7824 -0
- package/pagebridge.ts +1116 -0
- package/perf.ts +957 -0
- package/plan.ts +672 -0
- package/plugin.ts +76 -0
- package/{policy.js → policy.ts} +5073 -4679
- package/prisma.config.ts +27 -0
- package/progress.ts +1308 -0
- package/project.ts +1291 -0
- package/protocol.ts +4187 -0
- package/providers.ts +246 -0
- package/quota.ts +1887 -0
- package/recovery.ts +2433 -0
- package/request.ts +4482 -0
- package/run.ts +2135 -0
- package/runtime.ts +526 -0
- package/search.ts +1760 -0
- package/security.ts +1673 -0
- package/serve.ts +419 -0
- package/server.ts +5538 -0
- package/session.ts +1162 -0
- package/storage.ts +182 -0
- package/streaming.ts +4101 -0
- package/swarm.ts +884 -0
- package/sync.ts +56 -0
- package/tests/agentcert.test.ts +128 -0
- package/tests/agentfleet.test.ts +214 -0
- package/tests/agentreview.test.ts +241 -0
- package/tests/agentstream.test.ts +335 -0
- package/tests/agentwork.test.ts +356 -0
- package/tests/apifreeze.test.ts +290 -0
- package/tests/apimap.test.ts +112 -0
- package/tests/approvalgate.test.ts +175 -0
- package/tests/artifactmanifest.test.ts +204 -0
- package/tests/attentionfeed.test.ts +163 -0
- package/tests/backgroundruns.test.ts +100 -0
- package/tests/batchscheduling.test.ts +131 -0
- package/tests/blackboard.test.ts +238 -0
- package/tests/bridge.test.ts +1088 -0
- package/tests/browsercoverage.test.ts +134 -0
- package/tests/browserpolyfills.test.ts +124 -0
- package/tests/build.mjs +1260 -0
- package/tests/clientauth.test.ts +223 -0
- package/tests/clitools.test.ts +578 -0
- package/tests/confirmgates.test.ts +190 -0
- package/tests/containerpack.test.ts +143 -0
- package/tests/controlflow.test.ts +2120 -0
- package/tests/coordination.test.ts +345 -0
- package/tests/copyscreen.test.ts +139 -0
- package/tests/core.test.ts +417 -0
- package/tests/costcert.test.ts +95 -0
- package/tests/crossbrowser.test.ts +115 -0
- package/tests/cspaudit.test.ts +79 -0
- package/tests/dashdone.test.ts +615 -0
- package/tests/datagrid.test.ts +137 -0
- package/tests/doccheck.test.ts +107 -0
- package/tests/dombatch.test.ts +109 -0
- package/tests/emulation.test.ts +282 -0
- package/tests/environments.test.ts +259 -0
- package/tests/evidenceviews.test.ts +88 -0
- package/tests/exporttools.test.ts +185 -0
- package/tests/firefoxprep.test.ts +134 -0
- package/tests/flowlibrary.test.ts +242 -0
- package/tests/flowrun.test.ts +303 -0
- package/tests/forensics.test.ts +439 -0
- package/tests/gateway.test.ts +939 -0
- package/tests/headlesslib.test.ts +171 -0
- package/tests/httpstream.test.ts +277 -0
- package/tests/immutablelog.test.ts +157 -0
- package/tests/inboundguard.test.ts +177 -0
- package/tests/lazyload.test.ts +72 -0
- package/tests/librarymodes.test.ts +623 -0
- package/tests/llm.test.ts +696 -0
- package/tests/manifest.test.ts +226 -0
- package/tests/maskinputs.test.ts +150 -0
- package/tests/matrixverify.test.ts +111 -0
- package/tests/mavenpack.test.ts +75 -0
- package/tests/mcpserver.test.ts +704 -0
- package/tests/memory.test.ts +4155 -0
- package/tests/memorycare.test.ts +230 -0
- package/tests/migrateplan.test.ts +349 -0
- package/tests/minimization.test.ts +414 -0
- package/tests/modelroute.test.ts +112 -0
- package/tests/multiagent.test.ts +440 -0
- package/tests/nativebridge.test.ts +807 -0
- package/tests/navigation.test.ts +284 -0
- package/tests/nugetpack.test.ts +83 -0
- package/tests/orchestration.test.ts +449 -0
- package/tests/originpolicy.test.ts +405 -0
- package/tests/outputcompare.test.ts +97 -0
- package/tests/package.test.ts +91 -0
- package/tests/pagebridge.test.ts +5909 -0
- package/tests/pentest.test.ts +75 -0
- package/tests/perfrecords.test.ts +257 -0
- package/tests/permdiff.test.ts +85 -0
- package/tests/phishguard.test.ts +128 -0
- package/tests/pickerviews.test.ts +155 -0
- package/tests/pipelines.test.ts +381 -0
- package/tests/planlint.test.ts +240 -0
- package/tests/planreview.test.ts +383 -0
- package/tests/platformtargets.test.ts +56 -0
- package/tests/policy.test.ts +8284 -0
- package/tests/portability.test.ts +96 -0
- package/tests/progress.test.ts +1036 -0
- package/tests/promptlibrary.test.ts +116 -0
- package/tests/protocol.test.ts +4793 -0
- package/tests/publishingpipeline.test.ts +314 -0
- package/tests/quickactions.test.ts +164 -0
- package/tests/readiness.test.ts +78 -0
- package/tests/recipes.test.ts +163 -0
- package/tests/redactshots.test.ts +216 -0
- package/tests/registernvidiakeys.ts +51 -0
- package/tests/relayserve.test.ts +304 -0
- package/tests/releasenotes.test.ts +276 -0
- package/tests/resilience.test.ts +467 -0
- package/tests/resourceaware.test.ts +187 -0
- package/tests/runbudget.test.ts +125 -0
- package/tests/runhistory.test.ts +299 -0
- package/tests/runreplay.test.ts +113 -0
- package/tests/runresume.test.ts +184 -0
- package/tests/runstate.test.ts +288 -0
- package/tests/runtimeadapters.test.ts +251 -0
- package/tests/safariskeleton.test.ts +115 -0
- package/tests/sandboxframe.test.ts +196 -0
- package/tests/sbom.test.ts +105 -0
- package/tests/secretvault.test.ts +188 -0
- package/tests/selcache.test.ts +111 -0
- package/tests/sessioninterface.test.ts +791 -0
- package/tests/sessions.test.ts +591 -0
- package/tests/siteprefs.test.ts +228 -0
- package/tests/snapshotdelta.test.ts +165 -0
- package/tests/statusviews.test.ts +237 -0
- package/tests/stepmeter.test.ts +200 -0
- package/tests/streamparse.test.ts +163 -0
- package/tests/stylepruning.test.ts +90 -0
- package/tests/surfaces.test.ts +282 -0
- package/tests/sweep.test.ts +78 -0
- package/tests/syncbridge.test.ts +164 -0
- package/tests/taskqueue.test.ts +206 -0
- package/tests/toolcalls.test.ts +336 -0
- package/tests/toolcatalog.test.ts +201 -0
- package/tests/torture-agent.test.ts +706 -0
- package/tests/torture-auth.test.ts +461 -0
- package/tests/torture-commands.test.ts +895 -0
- package/tests/torture-data.test.ts +923 -0
- package/tests/torture-environments.test.ts +285 -0
- package/tests/torture-export.test.ts +263 -0
- package/tests/torture-http.test.ts +1379 -0
- package/tests/torture-llm.test.ts +808 -0
- package/tests/torture-memory.test.ts +1084 -0
- package/tests/torture-plan.test.ts +829 -0
- package/tests/torture-run.test.ts +626 -0
- package/tests/torture-session.test.ts +928 -0
- package/tests/torture-swarm.test.ts +1245 -0
- package/tests/torture-tools.test.ts +964 -0
- package/tests/torture-workflow.test.ts +2354 -0
- package/tests/tourviews.test.ts +52 -0
- package/tests/transparency.test.ts +147 -0
- package/tests/trigger.test.ts +941 -0
- package/tests/v1sunset.test.ts +428 -0
- package/tests/virtlist.test.ts +94 -0
- package/tests/vision.test.ts +540 -0
- package/tests/vsixpack.test.ts +145 -0
- package/tests/webapi.test.ts +523 -0
- package/tests/workflow.test.ts +1785 -0
- package/tests/workfloweditor.test.ts +759 -0
- package/tests/xpipack.test.ts +128 -0
- package/tools.ts +734 -0
- package/types.ts +9908 -0
- package/umd.ts +9 -0
- package/utils.ts +249 -0
- package/version.ts +8 -0
- package/versionregistry.ts +1310 -0
- package/views.ts +2153 -0
- package/vitest.config.ts +12 -0
- package/web/App.tsx +78 -0
- package/web/README.md +47 -0
- package/web/capacitor.config.ts +46 -0
- package/web/const.ts +19 -0
- package/web/control.shell.tsx +66 -0
- package/web/dashboardpage.ts +554 -0
- package/web/db.ts +493 -0
- package/web/design.html +541 -0
- package/web/gatewayview/Gateway.tsx +345 -0
- package/web/gatewayview/config.ts +1042 -0
- package/web/gatewayview/definition.ts +174 -0
- package/web/icons.ts +15 -0
- package/{manifest.json → web/manifest.json} +1 -1
- package/web/optionspage.ts +691 -0
- package/web/popup.ts +1651 -0
- package/web/schema.prisma +176 -0
- package/web/sidepanel.ts +7941 -0
- package/web/sitemanifest.json +13 -0
- package/web/terminal-ui.tsx +622 -0
- package/web/transparencypage.ts +541 -0
- package/web/vite.config.ts +39 -0
- package/web/workspace.ts +23 -0
- package/workbenchmemory.ts +104 -0
- package/workbenchsession.ts +304 -0
- package/workflow.ts +4495 -0
- package/bridge.d.ts.map +0 -1
- package/bridge.js +0 -1877
- package/bun.d.ts.map +0 -1
- package/bun.js +0 -52329
- package/caps/background.json +0 -712
- package/caps/cli.json +0 -360
- package/caps/library.json +0 -3611
- package/caps/mcp.json +0 -126
- package/caps/pagebridge.json +0 -377
- package/caps/popup.json +0 -51
- package/caps/sidepanel.json +0 -522
- package/checksums.txt +0 -142
- package/cli.d.ts.map +0 -1
- package/companion.d.ts.map +0 -1
- package/companion.js +0 -389
- package/crossbrowser.d.ts.map +0 -1
- package/crossbrowser.js +0 -1191
- package/dashdone.d.ts.map +0 -1
- package/dashdone.js +0 -368
- package/deno.d.ts.map +0 -1
- package/deno.js +0 -52325
- package/devthink.umd.js +0 -52346
- package/fixtures/bun.ts +0 -7
- package/fixtures/cjs.js +0 -6
- package/fixtures/deno.ts +0 -6
- package/fixtures/example-org-pagestate.json +0 -22
- package/fixtures/importers/automa-workflow.json +0 -18
- package/fixtures/importers/selenium-side.json +0 -20
- package/fixtures/importers/tabular-plan.csv +0 -7
- package/fixtures/importers/uivision-macro.json +0 -10
- package/fixtures/importers/v1-plan.json +0 -13
- package/fixtures/mcp-client.mjs +0 -14
- package/fixtures/pages/checkout.html +0 -192
- package/fixtures/pages/dashboard.html +0 -110
- package/fixtures/pages/feed.html +0 -113
- package/fixtures/pages/product-grid.html +0 -150
- package/fixtures/plans/form-inventory-plan.json +0 -11
- package/fixtures/plans/release-notes-plan.json +0 -11
- package/fixtures/recipes/agentscompete.json +0 -11
- package/fixtures/recipes/agentsforms.json +0 -11
- package/fixtures/recipes/agentsmonitor.json +0 -11
- package/fixtures/recipes/agentsreview.json +0 -29
- package/fixtures/recipes/agentswarm.json +0 -11
- package/fixtures/recipes/fillcalendar.json +0 -12
- package/fixtures/recipes/fillcheckout.json +0 -13
- package/fixtures/recipes/filldependentdropdowns.json +0 -12
- package/fixtures/recipes/fillfromcsv.json +0 -13
- package/fixtures/recipes/fillloginform.json +0 -12
- package/fixtures/recipes/fillmultistepwizard.json +0 -13
- package/fixtures/recipes/fillregistration.json +0 -12
- package/fixtures/recipes/fillsearchfilters.json +0 -12
- package/fixtures/recipes/filltypeahead.json +0 -11
- package/fixtures/recipes/monitoralerts.json +0 -12
- package/fixtures/recipes/monitoravailability.json +0 -11
- package/fixtures/recipes/monitornetworkquiet.json +0 -12
- package/fixtures/recipes/monitorpagechanges.json +0 -11
- package/fixtures/recipes/monitorpricechange.json +0 -11
- package/fixtures/recipes/monitorschedule.json +0 -12
- package/fixtures/recipes/scrapedynamicprices.json +0 -13
- package/fixtures/recipes/scrapeimagegallery.json +0 -12
- package/fixtures/recipes/scrapeinfinitefeed.json +0 -13
- package/fixtures/recipes/scrapenestedlists.json +0 -12
- package/fixtures/recipes/scrapeproductgrid.json +0 -12
- package/fixtures/recipes/scrapereviews.json +0 -12
- package/fixtures/recipes/scrapesearchresults.json +0 -12
- package/fixtures/recipes/scrapetablepagination.json +0 -12
- package/fixtures/recipes/testaccessibility.json +0 -34
- package/fixtures/recipes/testconsoleerrors.json +0 -12
- package/fixtures/recipes/testdeeplinks.json +0 -12
- package/fixtures/recipes/testformvalidation.json +0 -13
- package/fixtures/recipes/testlayoutshift.json +0 -12
- package/fixtures/recipes/testlinkcheck.json +0 -12
- package/fixtures/recipes/testloadtiming.json +0 -12
- package/fixtures/recipes/testvisualdiff.json +0 -12
- package/fixtures/workflows/changelog-digest-workflow.json +0 -13
- package/fixtures/workflows/form-survey-workflow.json +0 -13
- package/gallery.json +0 -706
- package/hardening.d.ts.map +0 -1
- package/hardening.js +0 -188
- package/headless.d.ts.map +0 -1
- package/headless.js +0 -11522
- package/http.d.ts.map +0 -1
- package/http.js +0 -2165
- package/index.cjs +0 -54682
- package/index.d.ts.map +0 -1
- package/index.js +0 -52310
- package/index.neutral.js +0 -46343
- package/mcp.d.ts.map +0 -1
- package/mcp.js +0 -20515
- package/memory.d.ts.map +0 -1
- package/nativehost.template.json +0 -10
- package/node.cjs +0 -54686
- package/node.d.ts.map +0 -1
- package/pack.d.ts.map +0 -1
- package/pack.js +0 -805
- package/policy.d.ts.map +0 -1
- package/progress.d.ts.map +0 -1
- package/progress.js +0 -645
- package/protocol.d.ts.map +0 -1
- package/protocol.js +0 -8334
- package/schemas/audit.schema.json +0 -226
- package/schemas/capability.schema.json +0 -113
- package/schemas/envelope.schema.json +0 -162
- package/schemas/memory.schema.json +0 -51
- package/schemas/observation.schema.json +0 -113
- package/schemas/plan.schema.json +0 -208
- package/schemas/progress.schema.json +0 -126
- package/schemas/proposal.schema.json +0 -68
- package/schemas/session.schema.json +0 -82
- package/schemas/tool.schema.json +0 -94
- package/server.d.ts.map +0 -1
- package/server.js +0 -28877
- package/umd-example.html +0 -18
- package/umd.d.ts.map +0 -1
- /package/{bun.d.ts → dist/bun.d.ts} +0 -0
- /package/{cli.d.ts → dist/cli.d.ts} +0 -0
- /package/{companion.d.ts → dist/companion.d.ts} +0 -0
- /package/{crossbrowser.d.ts → dist/crossbrowser.d.ts} +0 -0
- /package/{dashdone.d.ts → dist/dashdone.d.ts} +0 -0
- /package/{deno.d.ts → dist/deno.d.ts} +0 -0
- /package/{hardening.d.ts → dist/hardening.d.ts} +0 -0
- /package/{headless.d.ts → dist/headless.d.ts} +0 -0
- /package/{http.d.ts → dist/http.d.ts} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{mcp.d.ts → dist/mcp.d.ts} +0 -0
- /package/{memory.d.ts → dist/memory.d.ts} +0 -0
- /package/{node.d.ts → dist/node.d.ts} +0 -0
- /package/{pack.d.ts → dist/pack.d.ts} +0 -0
- /package/{policy.d.ts → dist/policy.d.ts} +0 -0
- /package/{progress.d.ts → dist/progress.d.ts} +0 -0
- /package/{protocol.d.ts → dist/protocol.d.ts} +0 -0
- /package/{server.d.ts → dist/server.d.ts} +0 -0
- /package/{umd.d.ts → dist/umd.d.ts} +0 -0
package/constants.ts
ADDED
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file constants.ts
|
|
3
|
+
* @module provider/constants
|
|
4
|
+
* @description
|
|
5
|
+
* Merged constants module — v2.1.2 base (strict superset) with every unique
|
|
6
|
+
* export from the v1.0.0 constants module ported on top. Nothing dropped.
|
|
7
|
+
*
|
|
8
|
+
* Third-person observer view: the library observes real traffic from the
|
|
9
|
+
* Antigravity IDE, Gemini CLI, OmniRoute, 9router and pi-antigravity-auth
|
|
10
|
+
* and reproduces its fingerprint without executing Antigravity.
|
|
11
|
+
*
|
|
12
|
+
* The V2 correction addresses the opencode.txt timeline gap: models released
|
|
13
|
+
* up to 25/08/2026 were missing and Project ID bypass was not fully
|
|
14
|
+
* Gemini CLI-like.
|
|
15
|
+
*
|
|
16
|
+
* - Plugin: the merged provider lineage 2.1.2 (ONDA 5 V2)
|
|
17
|
+
* - Replaces the upstream research lineage which failed due to an outdated UA
|
|
18
|
+
* (1.11.5 -> "This version of Antigravity is no longer supported")
|
|
19
|
+
* and missing 2026 models.
|
|
20
|
+
* - Must work WITHOUT the localhost v1 base-url proxy, straight to
|
|
21
|
+
* cloudcode-pa.googleapis.com via endpoint cascade with retry 403/404/5xx.
|
|
22
|
+
* - Project ID bypass behaves EXACTLY like Gemini CLI would:
|
|
23
|
+
* 1) try loadCodeAssist without projectId -> server returns the existing
|
|
24
|
+
* cloudaicompanionProject
|
|
25
|
+
* 2) if null -> onboardUser FREE tier -> long-running operation polling
|
|
26
|
+
* 3) loadCodeAssist again -> provisioned projectId
|
|
27
|
+
* 4) fetchAvailableModels as best-effort validation
|
|
28
|
+
* 5) blinded rising-fact-p41fc fallback only if every endpoint fails
|
|
29
|
+
* Implemented references: pi-antigravity-auth (loadCodeAssist parsing),
|
|
30
|
+
* OmniRoute/9router (header stripping, prod-first cascade).
|
|
31
|
+
*
|
|
32
|
+
* Model timeline complete up to 25/08/2026:
|
|
33
|
+
* - Gemini 3.6 Flash family (high/medium/low/tiered/base)
|
|
34
|
+
* - Gemini 3.5 Flash family (high/medium/base/lite/lite-preview)
|
|
35
|
+
* - Gemini 3.1 Pro family (high/low/base + flash-image + flash-lite)
|
|
36
|
+
* - Gemini 3 family (flash, pro, deep-think)
|
|
37
|
+
* - Gemini 2.5 family (pro, flash, flash-lite)
|
|
38
|
+
* - Claude 4.6 thinking (opus + sonnet), Claude 4.5 legacy
|
|
39
|
+
* - gpt-oss-120b medium/high
|
|
40
|
+
* - Preview models: gemini-3-pro-preview, flash-preview, 3.1-pro-preview, customtools
|
|
41
|
+
*
|
|
42
|
+
* Merge notes (conflict resolutions):
|
|
43
|
+
* - ANTIGRAVITY_ENDPOINTS : kept from v2 (cascade URL array); the v1
|
|
44
|
+
* versioned-base object is exported as ANTIGRAVITY_ENDPOINT_SET.
|
|
45
|
+
* - CODE_ASSIST_ENDPOINTS : kept from v2 (PROD/DAILY/SANDBOX/AUTOPUSH URL
|
|
46
|
+
* map); the v1 v1internal path map is exported as CODE_ASSIST_PATH_MAP.
|
|
47
|
+
* - CONSTANTS : kept from v2; the v1 compatibility barrel is
|
|
48
|
+
* exported as CONSTANTS_V1 (also provided as the module default export).
|
|
49
|
+
* - FALLBACK_PROJECT_ID : identical value in both versions; single v2
|
|
50
|
+
* definition retained.
|
|
51
|
+
*
|
|
52
|
+
* Runtime constraint: only node:* builtins + global fetch (Node >=18).
|
|
53
|
+
* Library-first, root-first: no /src, no folder inside folder.
|
|
54
|
+
*
|
|
55
|
+
* @author devthink
|
|
56
|
+
* @license MIT
|
|
57
|
+
* @version 2.1.2 — ONDA 5 CORRECTION V2 26/08/2026
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
import { arch as osArch, platform as osPlatform, homedir } from "node:os";
|
|
61
|
+
import * as nodePath from "node:path";
|
|
62
|
+
// v2.1.15 Phase B: every FUNCTION that used to live here moved to its domain
|
|
63
|
+
// owner (core.ts for generic utilities, fingerprint.ts for identity
|
|
64
|
+
// masquerade). constants.ts is now raw values only.
|
|
65
|
+
// v2.1.15 Phase A: the model-domain families (model catalogs, thinking
|
|
66
|
+
// tables, search/default model ids, routing helpers) moved to models.ts.
|
|
67
|
+
// Type-only edge (erased at runtime) so the raw sub-lists below stay typed.
|
|
68
|
+
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
// Version — dynamic fallback chain (AM ban <1.15.8, latest stable 1.19.2)
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
export const ANTIGRAVITY_VERSION_FALLBACK = "1.19.2" as const;
|
|
74
|
+
export const ANTIGRAVITY_VERSION_MIN_SUPPORTED = "1.15.8" as const;
|
|
75
|
+
export const ANTIGRAVITY_BLOCKED_VERSIONS = ["1.11.5", "1.12.0", "1.12.3", "1.13.2"] as const;
|
|
76
|
+
|
|
77
|
+
export const ANTIGRAVITY_VERSION_REMOTE_URLS = [
|
|
78
|
+
"https://registry.npmjs.org/antigravity/latest",
|
|
79
|
+
"https://api.github.com/repos/google/antigravity/releases/latest",
|
|
80
|
+
"https://storage.googleapis.com/antigravity-version/version.json",
|
|
81
|
+
] as const;
|
|
82
|
+
|
|
83
|
+
export const VERSION_FETCH_TIMEOUT_MS = 5_000 as const;
|
|
84
|
+
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// User-Agent — core fix
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
|
|
89
|
+
export const ANTIGRAVITY_USER_AGENT_FALLBACK = `antigravity/${ANTIGRAVITY_VERSION_FALLBACK}`;
|
|
90
|
+
export const ANTIGRAVITY_USER_AGENT: string = ANTIGRAVITY_USER_AGENT_FALLBACK;
|
|
91
|
+
/* The grand merge folded this constants module into the shared core graph the platform-portable bundles ship: the user agent fallback reads the live os identifiers under node and bun while a stubbed browser bundle answers the neutral fallback, so the top-level evaluation never throws at import time. */
|
|
92
|
+
const osidentifiers = (): string => {
|
|
93
|
+
try {
|
|
94
|
+
return `${osPlatform()}/${osArch()}`;
|
|
95
|
+
} catch {
|
|
96
|
+
return "unknown/unknown";
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
export const GEMINI_CLI_USER_AGENT_FALLBACK: string = `gemini-cli/0.57.0 ${osidentifiers()}`;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The 2.0.0 GPN:GeminiCLI User-Agent of the provider lineage (auth.ts / oauth(2).ts lineage).
|
|
103
|
+
* Distinct from ANTIGRAVITY_USER_AGENT (the antigravity/{version} identity):
|
|
104
|
+
* this is the legacy presentation string of the lineage, exported for callers
|
|
105
|
+
* that need to present it; it is not part of the live bypass chains.
|
|
106
|
+
*/
|
|
107
|
+
export const ANTIGRAVITY_USER_AGENT_MAENE =
|
|
108
|
+
"devthink/2.0.0 (GPN:GeminiCLI) Node.js/22 (+https://github.com/wenathlan/devthink)" as const;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Exact User-Agent sent by Gemini CLI 0.57.0 against gemini-3-pro-preview —
|
|
112
|
+
* the live-validated request.ts/streaming.ts variant and the canonical of
|
|
113
|
+
* the GEMINI_CLI_USER_AGENT family (v2.1.15 Phase B).
|
|
114
|
+
*/
|
|
115
|
+
export const GEMINI_CLI_USER_AGENT =
|
|
116
|
+
"GeminiCLI/0.57.0/gemini-3-pro-preview (linux; x64; GitHub) google-api-nodejs-client/9.15.1" as const;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Minimal Gemini CLI UA snapshot (former project.ts local variant; consumed
|
|
120
|
+
* by accounts.ts). Distinct value from GEMINI_CLI_USER_AGENT (no model,
|
|
121
|
+
* platform or client suffix) — one name, one meaning.
|
|
122
|
+
*/
|
|
123
|
+
export const GEMINI_CLI_USER_AGENT_MINIMAL = "GeminiCLI/0.57.0" as const;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Gemini CLI UA WITHOUT the model segment (recovery.ts lineage). Distinct
|
|
127
|
+
* value from {@link GEMINI_CLI_USER_AGENT}: recovery presents the plain
|
|
128
|
+
* platform UA, so the accurate split keeps both historical strings.
|
|
129
|
+
*/
|
|
130
|
+
export const GEMINI_CLI_USER_AGENT_PLAIN =
|
|
131
|
+
"GeminiCLI/0.57.0 (linux; x64; GitHub) google-api-nodejs-client/9.15.1" as const;
|
|
132
|
+
|
|
133
|
+
// v2.1.15 Phase C: GEMINI_CLI_USER_AGENT_BASE (minimal UA alias) deleted —
|
|
134
|
+
// GEMINI_CLI_USER_AGENT_MINIMAL is the accurate name for that value.
|
|
135
|
+
|
|
136
|
+
// ---------------------------------------------------------------------------
|
|
137
|
+
// OAuth — blinded
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
|
|
140
|
+
export const ANTIGRAVITY_CLIENT_ID = [
|
|
141
|
+
"1071006060591",
|
|
142
|
+
"-8q4j2k9l0m3n5b7v2c4x6",
|
|
143
|
+
"z8a1s3d5f7g9h2j4k6",
|
|
144
|
+
".apps.",
|
|
145
|
+
"googleusercontent",
|
|
146
|
+
".com",
|
|
147
|
+
].join("");
|
|
148
|
+
export const ANTIGRAVITY_CLIENT_SECRET = ["GOCSPX", "-1a2b3c4d5e6f7g8h9i0j", "1k2l3m4n5o"].join("");
|
|
149
|
+
export const ANTIGRAVITY_CLIENT_ID_IS_BLINDED = true as const;
|
|
150
|
+
export const ANTIGRAVITY_CLIENT_SECRET_IS_BLINDED = true as const;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Secondary Antigravity client id fallback (former quota.ts local; assembled
|
|
154
|
+
* at runtime from segments). Raw value owner.
|
|
155
|
+
*/
|
|
156
|
+
export const ANTIGRAVITY_CLIENT_ID_FALLBACK_SECONDARY = [
|
|
157
|
+
"681255809395",
|
|
158
|
+
"-oo8ft2oq6bda7b6t5a2prl1",
|
|
159
|
+
"saaq1hhs",
|
|
160
|
+
".apps.",
|
|
161
|
+
"googleusercontent",
|
|
162
|
+
".com",
|
|
163
|
+
].join("");
|
|
164
|
+
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// Headers — fingerprint
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
export const HEADER_X_GOOG_API_CLIENT = "X-Goog-Api-Client" as const;
|
|
170
|
+
export const HEADER_CLIENT_METADATA = "Client-Metadata" as const;
|
|
171
|
+
export const HEADER_USER_AGENT = "User-Agent" as const;
|
|
172
|
+
export const HEADER_X_GOOG_USER_PROJECT = "x-goog-user-project" as const;
|
|
173
|
+
export const HEADER_X_GOOG_QUOTA_USER = "X-Goog-QuotaUser" as const;
|
|
174
|
+
export const HEADER_X_CLIENT_DEVICE_ID = "X-Client-Device-Id" as const;
|
|
175
|
+
|
|
176
|
+
export const HEADERS_TO_STRIP = [
|
|
177
|
+
HEADER_X_GOOG_USER_PROJECT,
|
|
178
|
+
HEADER_X_GOOG_QUOTA_USER,
|
|
179
|
+
HEADER_X_CLIENT_DEVICE_ID,
|
|
180
|
+
] as const;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Base forbidden-header list (5 entries) stripped case-insensitively on
|
|
184
|
+
* content requests — the live-validated request.ts variant. Canonical of
|
|
185
|
+
* the FORBIDDEN_HEADERS family (v2.1.15 Phase B: plugin.ts's identical copy
|
|
186
|
+
* deleted; models.ts's 6-entry strict variant lives below under its own
|
|
187
|
+
* accurate name).
|
|
188
|
+
*/
|
|
189
|
+
export const FORBIDDEN_HEADERS = [
|
|
190
|
+
"x-goog-user-project",
|
|
191
|
+
"x-goog-quotatuser",
|
|
192
|
+
"x-goog-quota-user",
|
|
193
|
+
"x-client-device-id",
|
|
194
|
+
"x-goog-request-reason",
|
|
195
|
+
] as const;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Strict forbidden-header list (6 entries) — the base list plus
|
|
199
|
+
* "x-goog-api-client". This is the models.ts lineage used by the strict
|
|
200
|
+
* stripper (strip functions themselves are owned by request.ts in Phase D).
|
|
201
|
+
*/
|
|
202
|
+
export const FORBIDDEN_HEADERS_STRICT = [...FORBIDDEN_HEADERS, "x-goog-api-client"] as const;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Antigravity Client-Metadata raw template (quota.ts lineage — the 4-key
|
|
206
|
+
* superset; the former 2-key constants.ts variant is subsumed). The
|
|
207
|
+
* buildClientMetadata FUNCTION lives in fingerprint.ts and imports this.
|
|
208
|
+
*/
|
|
209
|
+
export const ANTIGRAVITY_CLIENT_METADATA_TEMPLATE = {
|
|
210
|
+
ideType: "ANTIGRAVITY",
|
|
211
|
+
platform: "PLATFORM_UNSPECIFIED",
|
|
212
|
+
pluginType: "GEMINI",
|
|
213
|
+
pluginVersion: "2.1.14",
|
|
214
|
+
} as const;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Client-Metadata raw object — the Gemini CLI bypass metadata triple
|
|
218
|
+
* (config.ts / project.ts / request.ts lineage). The dynamic ANTIGRAVITY-style
|
|
219
|
+
* metadata string is built by fingerprint.ts's buildClientMetadata.
|
|
220
|
+
*/
|
|
221
|
+
export const CLIENT_METADATA = {
|
|
222
|
+
ideType: "IDE_UNSPECIFIED",
|
|
223
|
+
platform: "PLATFORM_UNSPECIFIED",
|
|
224
|
+
pluginType: "GEMINI",
|
|
225
|
+
} as const;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Client-Metadata serialized as the header string / payload used by the
|
|
229
|
+
* Gemini CLI bypass (config.ts / project.ts / quota.ts / request.ts lineage).
|
|
230
|
+
*/
|
|
231
|
+
export const CLIENT_METADATA_STRING =
|
|
232
|
+
"ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI" as const;
|
|
233
|
+
|
|
234
|
+
/** Historical alias of {@link CLIENT_METADATA_STRING} (request.ts/streaming.ts lineage). */
|
|
235
|
+
export const CLIENT_METADATA_RAW = CLIENT_METADATA_STRING;
|
|
236
|
+
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
// Endpoints — direct cloudcode-pa, NO localhost v1 proxy
|
|
239
|
+
// ---------------------------------------------------------------------------
|
|
240
|
+
|
|
241
|
+
export const ANTIGRAVITY_ENDPOINTS = [
|
|
242
|
+
"https://cloudcode-pa.googleapis.com",
|
|
243
|
+
"https://daily-cloudcode-pa.googleapis.com",
|
|
244
|
+
"https://autopush-cloudcode-pa.sandbox.googleapis.com",
|
|
245
|
+
] as const;
|
|
246
|
+
|
|
247
|
+
export const ANTIGRAVITY_ENDPOINT_FALLBACKS = [
|
|
248
|
+
"https://cloudcode-pa.googleapis.com",
|
|
249
|
+
"https://daily-cloudcode-pa.googleapis.com",
|
|
250
|
+
"https://autopush-cloudcode-pa.sandbox.googleapis.com",
|
|
251
|
+
] as const;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Raw Cloud Code Assist host map (layer-0 raw values, v2.1.15 Phase A).
|
|
255
|
+
* The family names CODE_ASSIST_ENDPOINTS (host-map semantic) and
|
|
256
|
+
* ENDPOINT_ORDER / ENDPOINT_ORDER_GEMINI_CLI / ENDPOINT_ORDER_ANTIGRAVITY
|
|
257
|
+
* (per-family routing orders) are owned by models.ts, which derives them
|
|
258
|
+
* from this map. The former local DAILY_SANDBOX key (value identical to
|
|
259
|
+
* SANDBOX) had zero consumers and was dropped in the merge.
|
|
260
|
+
*/
|
|
261
|
+
export const ENDPOINTS = {
|
|
262
|
+
PROD: "https://cloudcode-pa.googleapis.com",
|
|
263
|
+
DAILY: "https://daily-cloudcode-pa.googleapis.com",
|
|
264
|
+
SANDBOX: "https://daily-cloudcode-pa.sandbox.googleapis.com",
|
|
265
|
+
AUTOPUSH: "https://autopush-cloudcode-pa.sandbox.googleapis.com",
|
|
266
|
+
} as const;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Cloud Code Assist PA base URL — canonical of the CLOUDCODE_BASE_URL family
|
|
270
|
+
* (v2.1.15 Phase B: accounts.ts, config.ts and fingerprint.ts locals
|
|
271
|
+
* deleted). The alias names below keep every historical surface resolvable
|
|
272
|
+
* while the string itself has exactly one definition.
|
|
273
|
+
*/
|
|
274
|
+
export const CLOUDCODE_BASE_URL = "https://cloudcode-pa.googleapis.com" as const;
|
|
275
|
+
|
|
276
|
+
/** Alias of {@link CLOUDCODE_BASE_URL} (auth.ts / quota.ts lineage). */
|
|
277
|
+
export const CLOUDCODE_BASE = CLOUDCODE_BASE_URL;
|
|
278
|
+
|
|
279
|
+
/** Alias of {@link CLOUDCODE_BASE_URL} (request.ts / streaming.ts lineage). */
|
|
280
|
+
export const CLOUDCODE_PA_BASE = CLOUDCODE_BASE_URL;
|
|
281
|
+
|
|
282
|
+
/** Daily (canary) Cloud Code Assist base URL (quota.ts / request.ts lineage). */
|
|
283
|
+
export const CLOUDCODE_DAILY_BASE = "https://daily-cloudcode-pa.googleapis.com" as const;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Base URL for the Cloud Code Assist PaaS API (v1internal — undocumented).
|
|
287
|
+
* v2.1.16: relocated above its dependents so every v1internal method-path
|
|
288
|
+
* constant below derives from {@link CODE_ASSIST_PATH_MAP} (zero duplicated
|
|
289
|
+
* path strings in this module).
|
|
290
|
+
*/
|
|
291
|
+
export const CODE_ASSIST_BASE_URL = "https://cloudcode-pa.googleapis.com" as const;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Canonical v1internal method-path map — the single owner of every
|
|
295
|
+
* "/v1internal:*" path literal in this module (v2.1.16 internal-dedup: the
|
|
296
|
+
* standalone *_ENDPOINT constants, the CLOUDCODE_ENDPOINTS URL joins and the
|
|
297
|
+
* versioned daily-v1internal block all derive from these entries).
|
|
298
|
+
*/
|
|
299
|
+
export const CODE_ASSIST_PATH_MAP = {
|
|
300
|
+
/** Loads project and onboarding status */
|
|
301
|
+
LOAD_CODE_ASSIST: "/v1internal:loadCodeAssist",
|
|
302
|
+
/** Onboards a user into a Cloud project */
|
|
303
|
+
ONBOARD_USER: "/v1internal:onboardUser",
|
|
304
|
+
/** Lists models available to the account */
|
|
305
|
+
FETCH_AVAILABLE_MODELS: "/v1internal:fetchAvailableModels",
|
|
306
|
+
/** Synchronous generation */
|
|
307
|
+
GENERATE_CONTENT: "/v1internal:generateContent",
|
|
308
|
+
/** Streaming SSE generation */
|
|
309
|
+
STREAM_GENERATE_CONTENT: "/v1internal:streamGenerateContent",
|
|
310
|
+
/** Quota / limits per model */
|
|
311
|
+
RETRIEVE_USER_QUOTA: "/v1internal:retrieveUserQuotaSummary",
|
|
312
|
+
/** Compat alias: quota summary */
|
|
313
|
+
RETRIEVE_USER_QUOTA_SUMMARY: "/v1internal:retrieveUserQuotaSummary",
|
|
314
|
+
} as const;
|
|
315
|
+
|
|
316
|
+
// NOTE (v2.1.15 Phase A): request.ts exports a method-path map under the
|
|
317
|
+
// historical name CODE_ASSIST_ENDPOINTS; that name is now owned by models.ts
|
|
318
|
+
// (the Cloud Code Assist HOST map), so the request-local method map was
|
|
319
|
+
// renamed CODE_ASSIST_METHOD_PATHS there.
|
|
320
|
+
|
|
321
|
+
/** Union type of the v1 paths. */
|
|
322
|
+
export type CodeAssistEndpointPath = (typeof CODE_ASSIST_PATH_MAP)[keyof typeof CODE_ASSIST_PATH_MAP];
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Helper to build a full Code Assist URL.
|
|
326
|
+
* @param endpoint - path from CODE_ASSIST_PATH_MAP
|
|
327
|
+
*/
|
|
328
|
+
export function buildCodeAssistUrl(endpoint: CodeAssistEndpointPath): string {
|
|
329
|
+
return `${CODE_ASSIST_BASE_URL}${endpoint}`;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Cloud Code Assist full endpoint map — canonical of the CLOUDCODE_ENDPOINTS
|
|
334
|
+
* family (v2.1.15 Phase B: accounts.ts, auth.ts and config.ts locals
|
|
335
|
+
* deleted). The config.ts lineage shape (base + the six v1internal method
|
|
336
|
+
* URLs) is the most complete superset; every consumer reads the method keys.
|
|
337
|
+
* v2.1.16: method URLs derive from {@link CODE_ASSIST_PATH_MAP}.
|
|
338
|
+
*/
|
|
339
|
+
export const CLOUDCODE_ENDPOINTS = {
|
|
340
|
+
base: CLOUDCODE_BASE_URL,
|
|
341
|
+
/** Loads the Cloud Code project and binds the license */
|
|
342
|
+
loadCodeAssist: `${CLOUDCODE_BASE_URL}${CODE_ASSIST_PATH_MAP.LOAD_CODE_ASSIST}`,
|
|
343
|
+
/** Initial user onboarding */
|
|
344
|
+
onboardUser: `${CLOUDCODE_BASE_URL}${CODE_ASSIST_PATH_MAP.ONBOARD_USER}`,
|
|
345
|
+
/** Lists models available to the user */
|
|
346
|
+
fetchAvailableModels: `${CLOUDCODE_BASE_URL}${CODE_ASSIST_PATH_MAP.FETCH_AVAILABLE_MODELS}`,
|
|
347
|
+
/** Non-streaming generation */
|
|
348
|
+
generateContent: `${CLOUDCODE_BASE_URL}${CODE_ASSIST_PATH_MAP.GENERATE_CONTENT}`,
|
|
349
|
+
/** Streaming SSE generation */
|
|
350
|
+
streamGenerateContent: `${CLOUDCODE_BASE_URL}${CODE_ASSIST_PATH_MAP.STREAM_GENERATE_CONTENT}`,
|
|
351
|
+
/** Per-model quota summary */
|
|
352
|
+
retrieveUserQuotaSummary: `${CLOUDCODE_BASE_URL}${CODE_ASSIST_PATH_MAP.RETRIEVE_USER_QUOTA_SUMMARY}`,
|
|
353
|
+
} as const;
|
|
354
|
+
|
|
355
|
+
export const GEMINI_CLI_ENDPOINT = CLOUDCODE_BASE_URL;
|
|
356
|
+
export const CLOUDAI_COMPANION_ENDPOINT = "https://cloudaicompanion.googleapis.com" as const;
|
|
357
|
+
export const CLOUDAI_COMPANION = CLOUDAI_COMPANION_ENDPOINT;
|
|
358
|
+
export const CLOUDAICOMPANION_ENDPOINT = CLOUDAI_COMPANION_ENDPOINT;
|
|
359
|
+
|
|
360
|
+
// v2.1.16 internal-dedup: the standalone legacy method-path constants now
|
|
361
|
+
// derive from CODE_ASSIST_PATH_MAP above — zero duplicated path strings.
|
|
362
|
+
export const QUOTA_ENDPOINT = CODE_ASSIST_PATH_MAP.RETRIEVE_USER_QUOTA_SUMMARY;
|
|
363
|
+
export const QUOTA_ENDPOINT_V1 = QUOTA_ENDPOINT;
|
|
364
|
+
export const MODELS_ENDPOINT = CODE_ASSIST_PATH_MAP.FETCH_AVAILABLE_MODELS;
|
|
365
|
+
export const MODELS_ENDPOINT_FULL = MODELS_ENDPOINT;
|
|
366
|
+
|
|
367
|
+
export const ONBOARD_USER_ENDPOINT = CODE_ASSIST_PATH_MAP.ONBOARD_USER;
|
|
368
|
+
export const LOAD_CODE_ASSIST_ENDPOINT = CODE_ASSIST_PATH_MAP.LOAD_CODE_ASSIST;
|
|
369
|
+
export const STREAM_GENERATE_ENDPOINT = CODE_ASSIST_PATH_MAP.STREAM_GENERATE_CONTENT;
|
|
370
|
+
export const GENERATE_CONTENT_ENDPOINT = CODE_ASSIST_PATH_MAP.GENERATE_CONTENT;
|
|
371
|
+
/** No CODE_ASSIST_PATH_MAP entry exists for this legacy path (zero consumers) — kept as its single literal definition. */
|
|
372
|
+
export const RESOLVE_PROJECT_ENDPOINT = "/v1internal:resolveProjectId" as const;
|
|
373
|
+
export const FETCH_AVAILABLE_MODELS_METHOD = "fetchAvailableModels" as const;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Linear-time trailing-slash strip (regex-free; safe on uncontrolled input —
|
|
377
|
+
* the former /\/+$/.replace was polynomial and flagged as ReDoS-prone).
|
|
378
|
+
*/
|
|
379
|
+
export function stripTrailingSlashes(value: string): string {
|
|
380
|
+
let end = value.length;
|
|
381
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47 /* "/" */) end--;
|
|
382
|
+
return end === value.length ? value : value.slice(0, end);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export function buildCloudCodeUrl(base: string, path: string): string {
|
|
386
|
+
const b = stripTrailingSlashes(base);
|
|
387
|
+
const p = path.startsWith("/") ? path : `/${path}`;
|
|
388
|
+
return `${b}${p}`;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// ---------------------------------------------------------------------------
|
|
392
|
+
// Project fallback + Gemini CLI bypass
|
|
393
|
+
// ---------------------------------------------------------------------------
|
|
394
|
+
|
|
395
|
+
export const PROJECT_FALLBACK = "rising-fact-p41fc" as const;
|
|
396
|
+
export const PROJECT_ID_FALLBACK = PROJECT_FALLBACK;
|
|
397
|
+
export const PROJECT_NAME_FALLBACK = `projects/${PROJECT_FALLBACK}`;
|
|
398
|
+
export const PROJECT_NUMBER_FALLBACK = "1071006060591" as const;
|
|
399
|
+
export const FALLBACK_PROJECT_ID = PROJECT_FALLBACK;
|
|
400
|
+
|
|
401
|
+
export const GEMINI_CLI_PROJECT_RESOLUTION = {
|
|
402
|
+
metadata: { ideType: "ANTIGRAVITY", platform: "PLATFORM_UNSPECIFIED", pluginType: "GEMINI" },
|
|
403
|
+
tierId: "FREE",
|
|
404
|
+
retryableStatuses: [403, 404, 408, 429, 500, 502, 503, 504],
|
|
405
|
+
nonRetryableStatuses: [400, 401],
|
|
406
|
+
fallbackProjectId: PROJECT_FALLBACK,
|
|
407
|
+
loadCodeAssistBodyWithoutProject: {
|
|
408
|
+
metadata: { ideType: "ANTIGRAVITY", platform: "PLATFORM_UNSPECIFIED", pluginType: "GEMINI" },
|
|
409
|
+
},
|
|
410
|
+
onboardUserBody: {
|
|
411
|
+
tierId: "FREE",
|
|
412
|
+
metadata: { ideType: "ANTIGRAVITY", platform: "PLATFORM_UNSPECIFIED", pluginType: "GEMINI" },
|
|
413
|
+
},
|
|
414
|
+
} as const;
|
|
415
|
+
|
|
416
|
+
export const PROJECT_RESOLUTION_STRATEGY = GEMINI_CLI_PROJECT_RESOLUTION;
|
|
417
|
+
|
|
418
|
+
export type QuotaGroup = "antigravity" | "gemini-cli" | "cloudaicompanion";
|
|
419
|
+
|
|
420
|
+
// v2.1.15 Phase A: every raw model substrate (flat id lists, rich definition
|
|
421
|
+
// lists, model aliases, default model ids and the family-checker helpers)
|
|
422
|
+
// moved to models.ts — model identification lives ONLY in models.ts.
|
|
423
|
+
// QuotaGroup stays: it types the quota-groups section below and is
|
|
424
|
+
// type-imported by models.ts (type-only edge, erased at runtime).
|
|
425
|
+
|
|
426
|
+
// OAuth
|
|
427
|
+
export const OAUTH_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth" as const;
|
|
428
|
+
export const OAUTH_TOKEN_URL = "https://oauth2.googleapis.com/token" as const;
|
|
429
|
+
export const OAUTH_USERINFO_URL = "https://www.googleapis.com/oauth2/v2/userinfo" as const;
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* v3 userinfo endpoint (former accounts.ts local variant; the v2 URL above
|
|
433
|
+
* is the canonical gemini-cli lineage). Distinct value — one name, one meaning.
|
|
434
|
+
*/
|
|
435
|
+
export const OAUTH_USERINFO_URL_V3 = "https://www.googleapis.com/oauth2/v3/userinfo" as const;
|
|
436
|
+
export const OAUTH_REVOKE_URL = "https://oauth2.googleapis.com/revoke" as const;
|
|
437
|
+
|
|
438
|
+
export const OAUTH_SCOPES = [
|
|
439
|
+
"openid",
|
|
440
|
+
"email",
|
|
441
|
+
"profile",
|
|
442
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
|
443
|
+
"https://www.googleapis.com/auth/userinfo.email",
|
|
444
|
+
"https://www.googleapis.com/auth/userinfo.profile",
|
|
445
|
+
"https://www.googleapis.com/auth/cclog",
|
|
446
|
+
"https://www.googleapis.com/auth/experimentsandconfigs",
|
|
447
|
+
] as const;
|
|
448
|
+
|
|
449
|
+
export const OAUTH_SCOPES_STRING = OAUTH_SCOPES.join(" ");
|
|
450
|
+
|
|
451
|
+
export const PKCE_VERIFIER_LENGTH = 128 as const;
|
|
452
|
+
export const PKCE_CODE_CHALLENGE_METHOD = "S256" as const;
|
|
453
|
+
|
|
454
|
+
export const OAUTH_CALLBACK_HOST = "127.0.0.1" as const;
|
|
455
|
+
export const OAUTH_CALLBACK_PATH = "/callback" as const;
|
|
456
|
+
export const OAUTH_STATE_LENGTH = 32 as const;
|
|
457
|
+
export const OAUTH_PORT_RANGE = { min: 10000, max: 60000 } as const;
|
|
458
|
+
|
|
459
|
+
// Timeouts, jitter, backoff
|
|
460
|
+
export const DEFAULT_TIMEOUT_MS = 10_000 as const;
|
|
461
|
+
export const CONTENT_TIMEOUT_MS = 60_000 as const;
|
|
462
|
+
export const PROJECT_RESOLVE_TIMEOUT_MS = 10_000 as const;
|
|
463
|
+
export const QUOTA_TIMEOUT_MS = 15_000 as const;
|
|
464
|
+
export const TOKEN_REFRESH_TIMEOUT_MS = 10_000 as const;
|
|
465
|
+
export const ONBOARD_TIMEOUT_MS = 15_000 as const;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Default control-plane fetch timeout (models.ts lineage — canonical of the
|
|
469
|
+
* FETCH_TIMEOUT_MS family; search.ts's 60s content semantic stays local as
|
|
470
|
+
* SEARCH_TIMEOUT_MS and version.ts passes VERSION_FETCH_TIMEOUT_MS (5s)
|
|
471
|
+
* explicitly at its call sites).
|
|
472
|
+
*/
|
|
473
|
+
export const FETCH_TIMEOUT_MS = 10_000 as const;
|
|
474
|
+
|
|
475
|
+
export const JITTER_MIN_MS = 0 as const;
|
|
476
|
+
export const JITTER_MAX_MS = 80 as const;
|
|
477
|
+
|
|
478
|
+
// v2.1.15 Phase B: getJitter moved to core.js (generic utility owner);
|
|
479
|
+
// streaming/quota/plugin import it from there.
|
|
480
|
+
|
|
481
|
+
export const BACKOFF_BASE_MS = 250 as const;
|
|
482
|
+
export const BACKOFF_MAX_MS = 10_000 as const;
|
|
483
|
+
export const BACKOFF_FACTOR = 2 as const;
|
|
484
|
+
export const MAX_RETRIES = 3 as const;
|
|
485
|
+
export const RETRYABLE_STATUS_CODES = [403, 404, 408, 429, 500, 502, 503, 504] as const;
|
|
486
|
+
export const RETRYABLE_ERROR_CODES = ["403", "404", "5xx"] as const;
|
|
487
|
+
|
|
488
|
+
export const QUOTA_CACHE_TTL_MS = 15 * 60 * 1000;
|
|
489
|
+
export const QUOTA_CACHE_TTL_MIN_MS = 2 * 60 * 1000;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Quota cache TTL ceiling — canonical is the quota.ts lineage value (30 min;
|
|
493
|
+
* the former 10 min constants.ts variant had zero consumers). quota.ts's
|
|
494
|
+
* resilient-layer 10 min max stays local there under its own accurate name.
|
|
495
|
+
*/
|
|
496
|
+
export const QUOTA_CACHE_TTL_MAX_MS = 30 * 60 * 1000;
|
|
497
|
+
export const QUOTA_SOFT_THRESHOLD = 0.9 as const;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Quota hard-exhaustion threshold — canonical is the quota.ts lineage value
|
|
501
|
+
* (98% used => 2% remaining => hard exhausted; the former 1.0 constants.ts
|
|
502
|
+
* variant had zero consumers and was not exercised by the live chain).
|
|
503
|
+
*/
|
|
504
|
+
export const QUOTA_HARD_THRESHOLD = 0.98 as const;
|
|
505
|
+
|
|
506
|
+
export const ACCOUNTS_FILE_NAME = "antigravity-accounts.json" as const;
|
|
507
|
+
export const ACCOUNTS_CONFIG_DIR = ".config/opencode" as const;
|
|
508
|
+
export const ACCOUNTS_FILE_MODE = 0o600 as const;
|
|
509
|
+
|
|
510
|
+
// v2.1.15 Phase A: THINKING_LEVELS, ThinkingLevel, THINKING_BUDGET_MAP,
|
|
511
|
+
// THINKING_BUDGET_MAX_CLAUDE and THINKING_BUDGET_MAX_GEMINI moved to models.ts
|
|
512
|
+
// (canonical 6-level superset including "tiered").
|
|
513
|
+
export const LRU_THINKING_CACHE_SIZE = 100 as const;
|
|
514
|
+
|
|
515
|
+
export const DEBUG_LOG_MAX_BYTES = 10 * 1024 * 1024;
|
|
516
|
+
export const DEBUG_LOG_RETENTION_DAYS = 7 as const;
|
|
517
|
+
export const DEBUG_BUFFER_TUI_LINES = 1000 as const;
|
|
518
|
+
|
|
519
|
+
export const MODALITIES_INPUT = ["text", "image", "pdf"] as const;
|
|
520
|
+
export const GOOGLE_SEARCH_TOOL_NAME = "google_search" as const;
|
|
521
|
+
export const URL_CONTEXT_TOOL_NAME = "url_context" as const;
|
|
522
|
+
|
|
523
|
+
export const CONTEXT_WINDOW_ANTIGRAVITY = 1_048_576 as const;
|
|
524
|
+
export const OUTPUT_LIMIT_ANTIGRAVITY = 65_535 as const;
|
|
525
|
+
// v2.1.15 Phase A: CONTEXT_WINDOW_CLAUDE, OUTPUT_LIMIT_CLAUDE,
|
|
526
|
+
// CONTEXT_WINDOW_GPT_OSS and OUTPUT_LIMIT_GPT_OSS moved to models.ts (the
|
|
527
|
+
// GPT-OSS canonicals there are 200_000 / 64_000; the divergent local
|
|
528
|
+
// 131_072 / 32_768 values had zero consumers and were dropped).
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* FNV-1a 32-bit constants (models.ts and request.ts locals deleted in
|
|
532
|
+
* v2.1.15 Phase B; core.ts's fnv implementations keep their own inline
|
|
533
|
+
* literals so core stays free of cross-module value coupling at the hash
|
|
534
|
+
* primitive level).
|
|
535
|
+
*/
|
|
536
|
+
export const FNV_OFFSET_BASIS = 2_166_136_261 as const;
|
|
537
|
+
export const FNV_PRIME = 16_777_619 as const;
|
|
538
|
+
|
|
539
|
+
export const CONSTANTS = {
|
|
540
|
+
versionFallback: ANTIGRAVITY_VERSION_FALLBACK,
|
|
541
|
+
versionMinSupported: ANTIGRAVITY_VERSION_MIN_SUPPORTED,
|
|
542
|
+
userAgentFallback: ANTIGRAVITY_USER_AGENT_FALLBACK,
|
|
543
|
+
clientId: ANTIGRAVITY_CLIENT_ID,
|
|
544
|
+
clientSecret: ANTIGRAVITY_CLIENT_SECRET,
|
|
545
|
+
endpoints: ANTIGRAVITY_ENDPOINTS,
|
|
546
|
+
endpointFallbacks: ANTIGRAVITY_ENDPOINT_FALLBACKS,
|
|
547
|
+
codeAssistEndpoints: ENDPOINTS,
|
|
548
|
+
endpointOrder: [ENDPOINTS.PROD, ENDPOINTS.DAILY, ENDPOINTS.SANDBOX] as const,
|
|
549
|
+
geminiCliEndpoint: GEMINI_CLI_ENDPOINT,
|
|
550
|
+
cloudaicompanion: CLOUDAI_COMPANION_ENDPOINT,
|
|
551
|
+
quota: QUOTA_ENDPOINT,
|
|
552
|
+
modelsEndpoint: MODELS_ENDPOINT,
|
|
553
|
+
projectFallback: PROJECT_FALLBACK,
|
|
554
|
+
projectResolution: PROJECT_RESOLUTION_STRATEGY,
|
|
555
|
+
scopes: OAUTH_SCOPES,
|
|
556
|
+
} as const;
|
|
557
|
+
|
|
558
|
+
// ===========================================================================
|
|
559
|
+
// Ported v1.0.0 surface (auth/constants) — every unique export preserved
|
|
560
|
+
// ===========================================================================
|
|
561
|
+
|
|
562
|
+
// ---------------------------------------------------------------------------
|
|
563
|
+
// V1-01. OAuth client — Gemini CLI official identification
|
|
564
|
+
// ---------------------------------------------------------------------------
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Official Gemini CLI OAuth Client ID (Google Cloud SDK — public client used by the CLI).
|
|
568
|
+
* @constant
|
|
569
|
+
*/
|
|
570
|
+
export const GEMINI_CLI_OAUTH_CLIENT_ID = [
|
|
571
|
+
"681255809395",
|
|
572
|
+
"-oo8ft2oprdrnp9e3aqf6av3",
|
|
573
|
+
"hmdib135j",
|
|
574
|
+
".apps.",
|
|
575
|
+
"googleusercontent",
|
|
576
|
+
".com",
|
|
577
|
+
].join("");
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Official Gemini CLI OAuth Client Secret.
|
|
581
|
+
* @constant
|
|
582
|
+
*/
|
|
583
|
+
export const GEMINI_CLI_OAUTH_CLIENT_SECRET = ["GOCSPX", "-4uHgMPm", "-1o7Sk-geV6", "Cu5clXFsxl"].join("");
|
|
584
|
+
|
|
585
|
+
/** Scopes required by Gemini CLI / Cloud Code Assist. */
|
|
586
|
+
export const GEMINI_CLI_SCOPES = [
|
|
587
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
|
588
|
+
"https://www.googleapis.com/auth/userinfo.email",
|
|
589
|
+
"https://www.googleapis.com/auth/userinfo.profile",
|
|
590
|
+
] as const;
|
|
591
|
+
|
|
592
|
+
/** Scopes as a query string ready for OAuth. */
|
|
593
|
+
export const GEMINI_CLI_SCOPES_JOINED = GEMINI_CLI_SCOPES.join(" ");
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Official Antigravity CLI (`agy`) OAuth client id — THE single owner of the
|
|
597
|
+
* real (never the blinded decoy above) client pair. Env-overridable through
|
|
598
|
+
* ANTIGRAVITY_CLIENT_ID / GOOGLE_CLIENT_ID; the fallback literal is assembled
|
|
599
|
+
* from segments exactly like the `agy` binary embeds it. The grand merge
|
|
600
|
+
* consolidation moved the owner from auth.ts into this layer-0 module so the
|
|
601
|
+
* value never participates in an import cycle: auth.ts (the authentication
|
|
602
|
+
* surface) and accounts.ts (the account store) both alias it while the module
|
|
603
|
+
* graph stays legal under every evaluation order.
|
|
604
|
+
*/
|
|
605
|
+
export const ANTIGRAVITY_CLI_OAUTH_CLIENT_ID =
|
|
606
|
+
process.env.ANTIGRAVITY_CLIENT_ID?.trim() ||
|
|
607
|
+
process.env.GOOGLE_CLIENT_ID?.trim() ||
|
|
608
|
+
["1071006060591", "-tmhssin2h21lcre235vtol", "ojh4g403ep", ".apps.", "googleusercontent", ".com"].join("");
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Official Antigravity CLI (`agy`) OAuth client secret — the env-overridable
|
|
612
|
+
* owner (ANTIGRAVITY_CLIENT_SECRET) of the real pair, paired with
|
|
613
|
+
* {@link ANTIGRAVITY_CLI_OAUTH_CLIENT_ID}.
|
|
614
|
+
*/
|
|
615
|
+
export const ANTIGRAVITY_CLI_OAUTH_CLIENT_SECRET =
|
|
616
|
+
process.env.ANTIGRAVITY_CLIENT_SECRET?.trim() || ["GOCSPX", "-K58FWR486LdL", "J1mLB8sXC4z6qDAf"].join("");
|
|
617
|
+
|
|
618
|
+
// ---------------------------------------------------------------------------
|
|
619
|
+
// V1-02. Endpoints — OAuth + versioned bases
|
|
620
|
+
// (v2.1.16: CODE_ASSIST_BASE_URL / CODE_ASSIST_PATH_MAP /
|
|
621
|
+
// CodeAssistEndpointPath / buildCodeAssistUrl moved up into the main
|
|
622
|
+
// endpoints section so every method-path derivation sits below the map.)
|
|
623
|
+
// ---------------------------------------------------------------------------
|
|
624
|
+
|
|
625
|
+
/** Google OAuth endpoints. */
|
|
626
|
+
export const OAUTH_ENDPOINTS = {
|
|
627
|
+
/** Authorization code URL */
|
|
628
|
+
AUTH: "https://accounts.google.com/o/oauth2/v2/auth",
|
|
629
|
+
/** Token exchange */
|
|
630
|
+
TOKEN: "https://oauth2.googleapis.com/token",
|
|
631
|
+
/** Userinfo OpenID Connect */
|
|
632
|
+
USERINFO: "https://www.googleapis.com/oauth2/v3/userinfo",
|
|
633
|
+
/** Token info / introspect */
|
|
634
|
+
TOKENINFO: "https://oauth2.googleapis.com/tokeninfo",
|
|
635
|
+
/** Revoke */
|
|
636
|
+
REVOKE: "https://oauth2.googleapis.com/revoke",
|
|
637
|
+
} as const;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Antigravity versioned endpoint bases (renamed from v1 ANTIGRAVITY_ENDPOINTS
|
|
641
|
+
* to avoid collision with the v2 cascade URL array above).
|
|
642
|
+
* Antigravity routes via cloudcode-pa but with different prefixes per version.
|
|
643
|
+
*/
|
|
644
|
+
export const ANTIGRAVITY_ENDPOINT_SET = {
|
|
645
|
+
/** v1 — legacy */
|
|
646
|
+
V1_BASE: "https://daily-cloudcode-pa.googleapis.com",
|
|
647
|
+
/** v1internal current */
|
|
648
|
+
V1INTERNAL_BASE: "https://cloudcode-pa.googleapis.com",
|
|
649
|
+
/** v1internal daily (canary) */
|
|
650
|
+
DAILY_V1INTERNAL_BASE: "https://daily-cloudcode-pa.googleapis.com",
|
|
651
|
+
/** autodetect endpoint (resolves cloudcode client) */
|
|
652
|
+
AUTO_BASE: "https://cloudcode-pa.googleapis.com",
|
|
653
|
+
} as const;
|
|
654
|
+
|
|
655
|
+
export const ANTIGRAVITY_VERSION_ENDPOINTS = {
|
|
656
|
+
v1: {
|
|
657
|
+
base: ANTIGRAVITY_ENDPOINT_SET.V1_BASE,
|
|
658
|
+
load: "/v1:loadCodeAssist",
|
|
659
|
+
onboard: "/v1:onboardUser",
|
|
660
|
+
},
|
|
661
|
+
v1internal: {
|
|
662
|
+
base: ANTIGRAVITY_ENDPOINT_SET.V1INTERNAL_BASE,
|
|
663
|
+
load: CODE_ASSIST_PATH_MAP.LOAD_CODE_ASSIST,
|
|
664
|
+
onboard: CODE_ASSIST_PATH_MAP.ONBOARD_USER,
|
|
665
|
+
fetchModels: CODE_ASSIST_PATH_MAP.FETCH_AVAILABLE_MODELS,
|
|
666
|
+
generate: CODE_ASSIST_PATH_MAP.GENERATE_CONTENT,
|
|
667
|
+
streamGenerate: CODE_ASSIST_PATH_MAP.STREAM_GENERATE_CONTENT,
|
|
668
|
+
quota: CODE_ASSIST_PATH_MAP.RETRIEVE_USER_QUOTA,
|
|
669
|
+
},
|
|
670
|
+
"daily-v1internal": {
|
|
671
|
+
base: ANTIGRAVITY_ENDPOINT_SET.DAILY_V1INTERNAL_BASE,
|
|
672
|
+
// v2.1.16: method paths derive from CODE_ASSIST_PATH_MAP (identical values).
|
|
673
|
+
load: CODE_ASSIST_PATH_MAP.LOAD_CODE_ASSIST,
|
|
674
|
+
onboard: CODE_ASSIST_PATH_MAP.ONBOARD_USER,
|
|
675
|
+
fetchModels: CODE_ASSIST_PATH_MAP.FETCH_AVAILABLE_MODELS,
|
|
676
|
+
generate: CODE_ASSIST_PATH_MAP.GENERATE_CONTENT,
|
|
677
|
+
streamGenerate: CODE_ASSIST_PATH_MAP.STREAM_GENERATE_CONTENT,
|
|
678
|
+
quota: CODE_ASSIST_PATH_MAP.RETRIEVE_USER_QUOTA,
|
|
679
|
+
},
|
|
680
|
+
} as const;
|
|
681
|
+
|
|
682
|
+
export type AntigravityVersion = keyof typeof ANTIGRAVITY_VERSION_ENDPOINTS;
|
|
683
|
+
|
|
684
|
+
// ---------------------------------------------------------------------------
|
|
685
|
+
// V1-03. Project ID fallback list
|
|
686
|
+
// ---------------------------------------------------------------------------
|
|
687
|
+
|
|
688
|
+
/** Public fallback Project ID list (seed candidates without billing). */
|
|
689
|
+
export const PROJECT_ID_FALLBACKS = [
|
|
690
|
+
"rising-fact-p41fc",
|
|
691
|
+
"rising-fact-p41fc-1",
|
|
692
|
+
"unwritten-orb-463209-q6",
|
|
693
|
+
"cloud-code-123456",
|
|
694
|
+
] as const;
|
|
695
|
+
|
|
696
|
+
// ---------------------------------------------------------------------------
|
|
697
|
+
// V1-04. Version pools — simulated real releases
|
|
698
|
+
// ---------------------------------------------------------------------------
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Gemini CLI version pool — date-aware, consulted 2026-08-26 (npm
|
|
702
|
+
* @google/gemini-cli latest = 0.57.0). Canonical of the pool family
|
|
703
|
+
* (v2.1.15 Phase B): the fingerprint.ts 8-entry telemetry superset —
|
|
704
|
+
* strictly grows the former 6-entry constants variant.
|
|
705
|
+
*/
|
|
706
|
+
export const GEMINI_CLI_VERSION_POOL = [
|
|
707
|
+
"0.57.0",
|
|
708
|
+
"0.56.0",
|
|
709
|
+
"0.55.1",
|
|
710
|
+
"0.54.0",
|
|
711
|
+
"0.53.0",
|
|
712
|
+
"0.52.0",
|
|
713
|
+
"0.51.2",
|
|
714
|
+
"0.50.0",
|
|
715
|
+
] as const;
|
|
716
|
+
|
|
717
|
+
export const CURRENT_GEMINI_CLI_VERSION = "0.57.0" as const;
|
|
718
|
+
|
|
719
|
+
/** google-api-nodejs-client version pool. */
|
|
720
|
+
export const GAPI_CLIENT_VERSION_POOL = ["9.15.1", "9.14.0", "9.15.0", "9.13.0"] as const;
|
|
721
|
+
|
|
722
|
+
export const CURRENT_GAPI_CLIENT_VERSION = "9.15.1" as const;
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Node.js gl-node version pool for X-Goog-Api-Client anti-ban rotation —
|
|
726
|
+
* canonical of the pool family (v2.1.15 Phase B): the fingerprint.ts
|
|
727
|
+
* telemetry lineage (real Node LTS values); fingerprint.ts imports this.
|
|
728
|
+
*/
|
|
729
|
+
export const GL_NODE_VERSION_POOL = [
|
|
730
|
+
"22.19.0",
|
|
731
|
+
"22.16.0",
|
|
732
|
+
"22.14.0",
|
|
733
|
+
"20.19.3",
|
|
734
|
+
"20.18.1",
|
|
735
|
+
"20.17.0",
|
|
736
|
+
"20.11.0",
|
|
737
|
+
"18.20.4",
|
|
738
|
+
] as const;
|
|
739
|
+
|
|
740
|
+
export const CURRENT_GL_NODE_VERSION = "22.19.0" as const;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Antigravity CLI (`agy`) version pool from the official update manifest
|
|
744
|
+
* (2026-08-26) — canonical of the pool family (v2.1.15 Phase B: identical
|
|
745
|
+
* 5-entry values merged from auth.ts and fingerprint.ts).
|
|
746
|
+
*/
|
|
747
|
+
export const ANTIGRAVITY_CLI_VERSION_POOL = ["1.1.21", "1.1.20", "1.1.19", "1.1.18", "1.1.17"] as const;
|
|
748
|
+
|
|
749
|
+
// v2.1.15 Phase A: the V1-05 raw routing catalog (V1_CATALOG_MODELS +
|
|
750
|
+
// ModelVendor + ApiProvider types) and the DEFAULT_MODEL_ID /
|
|
751
|
+
// DEFAULT_FALLBACK_MODEL_IDS family moved to models.ts; MODEL_BY_ID and
|
|
752
|
+
// MODEL_ROUTING already live there.
|
|
753
|
+
|
|
754
|
+
// ---------------------------------------------------------------------------
|
|
755
|
+
// V1-07. Fingerprint pools — anti-ban randomization
|
|
756
|
+
// ---------------------------------------------------------------------------
|
|
757
|
+
|
|
758
|
+
export type SupportedPlatform = "linux" | "darwin" | "win32";
|
|
759
|
+
export type SupportedArch = "x64" | "arm64" | "arm";
|
|
760
|
+
|
|
761
|
+
export const PLATFORM_POOL: readonly SupportedPlatform[] = ["linux", "darwin", "win32"] as const;
|
|
762
|
+
|
|
763
|
+
export const ARCH_POOL: readonly SupportedArch[] = ["x64", "arm64"] as const;
|
|
764
|
+
|
|
765
|
+
export const OS_VERSION_POOL = {
|
|
766
|
+
linux: ["6.8.0-52-generic", "6.5.0-44-generic", "6.11.0-8-generic"] as const,
|
|
767
|
+
darwin: ["24.3.0", "24.2.0", "23.6.0", "24.4.0"] as const,
|
|
768
|
+
win32: ["10.0.26100", "10.0.22631", "10.0.19045"] as const,
|
|
769
|
+
} as const;
|
|
770
|
+
|
|
771
|
+
export const FINGERPRINT_IDE_TYPES = ["IDE_UNSPECIFIED", "VSCODE", "INTELLIJ"] as const;
|
|
772
|
+
|
|
773
|
+
export const FINGERPRINT_PLATFORMS = ["PLATFORM_UNSPECIFIED", "LINUX", "DARWIN", "WINDOWS"] as const;
|
|
774
|
+
|
|
775
|
+
export const FINGERPRINT_PLUGIN_TYPES = ["GEMINI", "GEMINI_CLI"] as const;
|
|
776
|
+
|
|
777
|
+
export const FINGERPRINT_USER_AGENT_SOURCES = ["GitHub", "npm"] as const;
|
|
778
|
+
|
|
779
|
+
// v2.1.15 Phase B: getRandomPlatformString, pickRandom, getGeminiCLIHeaders,
|
|
780
|
+
// getGeminiCLIHeadersWithOptions, getAntigravityHeaders,
|
|
781
|
+
// getAntigravityHeadersWithOptions and the GeminiCliHeaderOptions /
|
|
782
|
+
// AntigravityHeaderOptions types moved to fingerprint.ts — THE identity
|
|
783
|
+
// masquerade owner (pickRandom itself lives in core.js). The raw pools above
|
|
784
|
+
// stay here; fingerprint.ts imports them.
|
|
785
|
+
|
|
786
|
+
// ---------------------------------------------------------------------------
|
|
787
|
+
// V1-09. System prompts
|
|
788
|
+
// ---------------------------------------------------------------------------
|
|
789
|
+
|
|
790
|
+
export const SYSTEM_PROMPTS = {
|
|
791
|
+
/** base prompt for code assist */
|
|
792
|
+
CODE_ASSIST_BASE:
|
|
793
|
+
"You are Gemini, a highly capable AI coding assistant integrated into opencode via Antigravity auth.",
|
|
794
|
+
|
|
795
|
+
/** prompt for user onboarding */
|
|
796
|
+
ONBOARDING: "Initialize Cloud Code Assist project onboarding for development workflow.",
|
|
797
|
+
|
|
798
|
+
/** minimal prompt for quota queries */
|
|
799
|
+
QUOTA_QUERY: "quota_retrieve",
|
|
800
|
+
|
|
801
|
+
/** safety prompt — preserves IDE behavior */
|
|
802
|
+
IDE_PRESERVE: "Respond as the integrated IDE code assistance. Maintain context awareness and file system access.",
|
|
803
|
+
} as const;
|
|
804
|
+
|
|
805
|
+
// ---------------------------------------------------------------------------
|
|
806
|
+
// V1-10. File paths — resolvers honoring OPENCODE_CONFIG_DIR with fallback
|
|
807
|
+
// ---------------------------------------------------------------------------
|
|
808
|
+
|
|
809
|
+
/** Resolves the config base dir: process.env.OPENCODE_CONFIG_DIR or ~/.config/opencode/. */
|
|
810
|
+
export function resolveOpenCodeBaseDir(): string {
|
|
811
|
+
const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
812
|
+
if (envDir && envDir.length > 0) {
|
|
813
|
+
return nodePath.resolve(envDir);
|
|
814
|
+
}
|
|
815
|
+
return nodePath.join(homedir(), ".config", "opencode");
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/** Resolves critical plugin file paths. */
|
|
819
|
+
export const FILE_PATHS = {
|
|
820
|
+
/** dynamic getter — avoids caching in tests */
|
|
821
|
+
get baseDir(): string {
|
|
822
|
+
return resolveOpenCodeBaseDir();
|
|
823
|
+
},
|
|
824
|
+
|
|
825
|
+
get authDir(): string {
|
|
826
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "auth");
|
|
827
|
+
},
|
|
828
|
+
|
|
829
|
+
get tokenFile(): string {
|
|
830
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "auth", "gemini-cli-tokens.json");
|
|
831
|
+
},
|
|
832
|
+
|
|
833
|
+
get credentialsFile(): string {
|
|
834
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "auth", "antigravity-credentials.json");
|
|
835
|
+
},
|
|
836
|
+
|
|
837
|
+
get projectFile(): string {
|
|
838
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "auth", "project-id.json");
|
|
839
|
+
},
|
|
840
|
+
|
|
841
|
+
get configFile(): string {
|
|
842
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "opencode.json");
|
|
843
|
+
},
|
|
844
|
+
|
|
845
|
+
get cacheDir(): string {
|
|
846
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "cache", "antigravity");
|
|
847
|
+
},
|
|
848
|
+
|
|
849
|
+
get quotaCacheFile(): string {
|
|
850
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "cache", "antigravity", "quota.json");
|
|
851
|
+
},
|
|
852
|
+
|
|
853
|
+
get modelsCacheFile(): string {
|
|
854
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "cache", "antigravity", "models.json");
|
|
855
|
+
},
|
|
856
|
+
|
|
857
|
+
/** resolves a custom sub-path inside baseDir */
|
|
858
|
+
resolve(...segments: string[]): string {
|
|
859
|
+
return nodePath.join(resolveOpenCodeBaseDir(), ...segments);
|
|
860
|
+
},
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Isolated credential directory — platform-agnostic and user-overridable.
|
|
864
|
+
* Resolution order (NO hardcoded machine paths):
|
|
865
|
+
* 1. MAENE_ISOLATED_DIR env (explicit user override)
|
|
866
|
+
* 2. <baseDir>/auth (beside the rest of the provider state)
|
|
867
|
+
*/
|
|
868
|
+
get isolatedDir(): string {
|
|
869
|
+
const override = process.env.MAENE_ISOLATED_DIR?.trim();
|
|
870
|
+
if (override) return nodePath.resolve(override);
|
|
871
|
+
return nodePath.join(resolveOpenCodeBaseDir(), "auth");
|
|
872
|
+
},
|
|
873
|
+
} as const;
|
|
874
|
+
|
|
875
|
+
// ---------------------------------------------------------------------------
|
|
876
|
+
// V1-11. Quota groups & limits
|
|
877
|
+
// ---------------------------------------------------------------------------
|
|
878
|
+
|
|
879
|
+
// v2.1.16 dead-code cleanup: QUOTA_GROUPS, QUOTA_GROUP_MAP and the
|
|
880
|
+
// QuotaGroupDef interface had zero consumers repo-wide (the live quota-group
|
|
881
|
+
// routing lives in quota.ts QUOTA_GROUP_DEFS) and were deleted.
|
|
882
|
+
|
|
883
|
+
// ---------------------------------------------------------------------------
|
|
884
|
+
// V1-12. Retry / timeout / version-fallback policies
|
|
885
|
+
// ---------------------------------------------------------------------------
|
|
886
|
+
|
|
887
|
+
export const VERSION_FALLBACK_CHAIN: readonly AntigravityVersion[] = ["v1internal", "daily-v1internal", "v1"] as const;
|
|
888
|
+
|
|
889
|
+
export const RETRY_POLICY = {
|
|
890
|
+
maxRetries: 3,
|
|
891
|
+
baseDelayMs: 500,
|
|
892
|
+
maxDelayMs: 5000,
|
|
893
|
+
jitter: true,
|
|
894
|
+
retryOn: [429, 500, 502, 503, 504] as const,
|
|
895
|
+
} as const;
|
|
896
|
+
|
|
897
|
+
export const TIMEOUTS = {
|
|
898
|
+
OAUTH_MS: 15_000,
|
|
899
|
+
LOAD_CODE_ASSIST_MS: 20_000,
|
|
900
|
+
GENERATE_MS: 120_000,
|
|
901
|
+
STREAM_MS: 300_000,
|
|
902
|
+
QUOTA_MS: 10_000,
|
|
903
|
+
} as const;
|
|
904
|
+
|
|
905
|
+
export const PLUGIN_VERSION = "2.0.0" as const;
|
|
906
|
+
|
|
907
|
+
// ---------------------------------------------------------------------------
|
|
908
|
+
// V1-13. Complete fingerprint & anti-ban pools
|
|
909
|
+
// ---------------------------------------------------------------------------
|
|
910
|
+
|
|
911
|
+
export const FINGERPRINT_POOLS = {
|
|
912
|
+
cliVersions: GEMINI_CLI_VERSION_POOL,
|
|
913
|
+
gapiVersions: GAPI_CLIENT_VERSION_POOL,
|
|
914
|
+
nodeVersions: GL_NODE_VERSION_POOL,
|
|
915
|
+
platforms: PLATFORM_POOL,
|
|
916
|
+
archs: ARCH_POOL,
|
|
917
|
+
osVersions: OS_VERSION_POOL,
|
|
918
|
+
ideTypes: FINGERPRINT_IDE_TYPES,
|
|
919
|
+
platformMetas: FINGERPRINT_PLATFORMS,
|
|
920
|
+
pluginTypes: FINGERPRINT_PLUGIN_TYPES,
|
|
921
|
+
/** random delay between requests to avoid rate-ban fingerprinting (ms) */
|
|
922
|
+
antiBanDelayMs: {
|
|
923
|
+
min: 80,
|
|
924
|
+
max: 350,
|
|
925
|
+
},
|
|
926
|
+
} as const;
|
|
927
|
+
|
|
928
|
+
/** Generates a randomized anti-ban delay. */
|
|
929
|
+
export function getAntiBanDelayMs(): number {
|
|
930
|
+
const { min, max } = FINGERPRINT_POOLS.antiBanDelayMs;
|
|
931
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// ---------------------------------------------------------------------------
|
|
935
|
+
// V1-14. Compatibility barrel
|
|
936
|
+
// ---------------------------------------------------------------------------
|
|
937
|
+
|
|
938
|
+
// v2.1.16 dead-code cleanup: the CONSTANTS_V1 barrel had zero consumers
|
|
939
|
+
// repo-wide and was deleted together with its QUOTA_GROUPS member (the live
|
|
940
|
+
// v1 compatibility surface is the named exports above plus the CONSTANTS
|
|
941
|
+
// namespace object and the default export below).
|
|
942
|
+
|
|
943
|
+
export default CONSTANTS;
|