@herbertgao/pi-extensions 2026.11.11 → 2026.11.12
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/README.md +10 -10
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +3 -4
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +3 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +22 -15
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +22 -8
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +0 -29
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +5 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +60 -39
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +3 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +0 -40
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-parse.ts +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +21 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +15 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
- package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
- package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +2 -2
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/adapt.md +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/animate.md +17 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique-rubric.md +496 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/critique.md +12 -504
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/motion-reviewer.md +29 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +3 -3
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-comp.md +24 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work-world.md +20 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +5 -34
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/typeset.md +6 -0
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
- package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +17 -18
- package/node_modules/pi-antigravity/README.md +58 -9
- package/node_modules/pi-antigravity/docs/reader-guarantees.md +35 -0
- package/node_modules/pi-antigravity/package.json +15 -6
- package/node_modules/pi-antigravity/src/client/client.ts +63 -14
- package/node_modules/pi-antigravity/src/client/enterprise.ts +150 -0
- package/node_modules/pi-antigravity/src/client/index.ts +1 -0
- package/node_modules/pi-antigravity/src/diagnostics/diagnostics.ts +7 -0
- package/node_modules/pi-antigravity/src/features/generate-image.ts +56 -2
- package/node_modules/pi-antigravity/src/features/read-url-content.ts +124 -0
- package/node_modules/pi-antigravity/src/image/image.ts +16 -2
- package/node_modules/pi-antigravity/src/index.ts +145 -2
- package/node_modules/pi-antigravity/src/models/discovery.ts +3 -4
- package/node_modules/pi-antigravity/src/models/grouping.ts +39 -15
- package/node_modules/pi-antigravity/src/models/models.ts +126 -14
- package/node_modules/pi-antigravity/src/stream/stream.ts +189 -30
- package/node_modules/pi-antigravity/src/types/types.ts +30 -1
- package/node_modules/pi-antigravity/src/usage/usage.ts +58 -0
- package/node_modules/pi-antigravity/src/utils/address.ts +180 -0
- package/node_modules/pi-antigravity/src/utils/credits.ts +149 -0
- package/node_modules/pi-antigravity/src/utils/html.ts +31 -0
- package/node_modules/pi-antigravity/src/utils/index.ts +2 -0
- package/node_modules/pi-antigravity/src/utils/security.ts +172 -13
- package/node_modules/pi-antigravity/src/utils/text.ts +66 -0
- package/node_modules/pi-antigravity/src/utils/util.ts +5 -4
- package/node_modules/pi-antigravity/src/web-fetch/document.ts +83 -0
- package/node_modules/pi-antigravity/src/web-fetch/fences.ts +24 -0
- package/node_modules/pi-antigravity/src/web-fetch/header.ts +97 -0
- package/node_modules/pi-antigravity/src/web-fetch/index.ts +3 -0
- package/node_modules/pi-antigravity/src/web-fetch/inspect.ts +328 -0
- package/node_modules/pi-antigravity/src/web-fetch/limits.ts +4 -0
- package/node_modules/pi-antigravity/src/web-fetch/markdown.ts +744 -0
- package/node_modules/pi-antigravity/src/web-fetch/mdn.ts +164 -0
- package/node_modules/pi-antigravity/src/web-fetch/media.ts +11 -0
- package/node_modules/pi-antigravity/src/web-fetch/metadata.ts +9 -0
- package/node_modules/pi-antigravity/src/web-fetch/representation.ts +93 -0
- package/node_modules/pi-antigravity/src/web-fetch/save.ts +71 -0
- package/node_modules/pi-antigravity/src/web-fetch/sites.ts +138 -0
- package/node_modules/pi-antigravity/src/web-fetch/vendor.d.ts +9 -0
- package/node_modules/pi-antigravity/src/web-fetch/web-fetch.ts +957 -0
- package/node_modules/pi-antigravity/tsconfig.json +2 -2
- package/node_modules/pi-commandcode-provider/CHANGELOG.md +10 -0
- package/node_modules/pi-commandcode-provider/README.md +2 -2
- package/node_modules/pi-commandcode-provider/package.json +1 -1
- package/node_modules/pi-commandcode-provider/src/commandcode-catalog.ts +15 -9
- package/node_modules/pi-commandcode-provider/src/oauth.ts +69 -12
- package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
- package/node_modules/pi-lens/CHANGELOG.md +172 -0
- package/node_modules/pi-lens/README.md +103 -217
- package/node_modules/pi-lens/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
- package/node_modules/pi-lens/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
- package/node_modules/pi-lens/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
- package/node_modules/pi-lens/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
- package/node_modules/pi-lens/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
- package/node_modules/pi-lens/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
- package/node_modules/pi-lens/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-5YJXF2IS.js +56 -0
- package/node_modules/pi-lens/dist/{chunk-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
- package/node_modules/pi-lens/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
- package/node_modules/pi-lens/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
- package/node_modules/pi-lens/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
- package/node_modules/pi-lens/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
- package/node_modules/pi-lens/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
- package/node_modules/pi-lens/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
- package/node_modules/pi-lens/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
- package/node_modules/pi-lens/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
- package/node_modules/pi-lens/dist/chunk-GCSDF5IE.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
- package/node_modules/pi-lens/dist/chunk-HBX55MWO.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
- package/node_modules/pi-lens/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
- package/node_modules/pi-lens/dist/chunk-JOIKBUQN.js +88 -0
- package/node_modules/pi-lens/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
- package/node_modules/pi-lens/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
- package/node_modules/pi-lens/dist/{chunk-OVPR3GQ6.js → chunk-LGH2HHZG.js} +24 -6
- package/node_modules/pi-lens/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
- package/node_modules/pi-lens/dist/chunk-LVLPA32Q.js +810 -0
- package/node_modules/pi-lens/dist/chunk-M2YMBT5G.js +73 -0
- package/node_modules/pi-lens/dist/{chunk-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
- package/node_modules/pi-lens/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
- package/node_modules/pi-lens/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
- package/node_modules/pi-lens/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
- package/node_modules/pi-lens/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
- package/node_modules/pi-lens/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
- package/node_modules/pi-lens/dist/chunk-PKWEBMCA.js +2957 -0
- package/node_modules/pi-lens/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
- package/node_modules/pi-lens/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
- package/node_modules/pi-lens/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
- package/node_modules/pi-lens/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
- package/node_modules/pi-lens/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
- package/node_modules/pi-lens/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
- package/node_modules/pi-lens/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
- package/node_modules/pi-lens/dist/chunk-TFKN5EIR.js +27 -0
- package/node_modules/pi-lens/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
- package/node_modules/pi-lens/dist/chunk-TQWRH25U.js +35 -0
- package/node_modules/pi-lens/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
- package/node_modules/pi-lens/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
- package/node_modules/pi-lens/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
- package/node_modules/pi-lens/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
- package/node_modules/pi-lens/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
- package/node_modules/pi-lens/dist/index.js +6508 -5413
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +9 -9
- package/node_modules/pi-lens/dist/mcp/cli.js +39 -38
- package/node_modules/pi-lens/dist/mcp/server.js +602 -345
- package/node_modules/pi-lens/dist/mcp/worker.js +57 -58
- package/node_modules/pi-lens/dist/probes/installer.js +19 -17
- package/node_modules/pi-lens/docs/architecture.md +113 -0
- package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +2 -2
- package/node_modules/pi-lens/docs/ci.md +18 -4
- package/node_modules/pi-lens/docs/defect-shapes.md +41 -3
- package/node_modules/pi-lens/docs/dependencies.md +10 -10
- package/node_modules/pi-lens/docs/features.md +3 -3
- package/node_modules/pi-lens/docs/invariants/dispatch-runners.md +13 -1
- package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +19 -0
- package/node_modules/pi-lens/docs/language-coverage.md +39 -0
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +10 -4
- package/node_modules/pi-lens/docs/lsp-idle-eviction.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +4 -0
- package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +1 -1
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +4 -5
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +5 -2
- package/node_modules/pi-lens/docs/prose-standard.md +112 -0
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
- package/node_modules/pi-lens/docs/usage.md +50 -0
- package/node_modules/pi-lens/package.json +1 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
- package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
- package/node_modules/pi-lens/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
- package/node_modules/pi-web-access/CHANGELOG.md +29 -0
- package/node_modules/pi-web-access/README.md +35 -15
- package/node_modules/pi-web-access/anysearch.ts +7 -3
- package/node_modules/pi-web-access/autom.ts +196 -0
- package/node_modules/pi-web-access/cloro.ts +254 -0
- package/node_modules/pi-web-access/curator-page.ts +7 -1
- package/node_modules/pi-web-access/curator-server.ts +3 -0
- package/node_modules/pi-web-access/dist/index.js +12931 -12111
- package/node_modules/pi-web-access/dist/mcp-cli.js +1188 -416
- package/node_modules/pi-web-access/domain-filter-normalization.ts +30 -0
- package/node_modules/pi-web-access/duckduckgo-rate-limit.ts +144 -34
- package/node_modules/pi-web-access/duckduckgo.ts +11 -3
- package/node_modules/pi-web-access/extract.ts +60 -4
- package/node_modules/pi-web-access/gemini-search.ts +25 -5
- package/node_modules/pi-web-access/index.ts +9 -1
- package/node_modules/pi-web-access/package.json +2 -2
- package/node_modules/pi-web-access/page-query.ts +12 -3
- package/node_modules/pi-web-access/specstream.ts +276 -0
- package/node_modules/pi-web-access/tool-activation.ts +21 -6
- package/node_modules/pi-web-access/utils.ts +4 -0
- package/node_modules/pi-web-access/video-extract.ts +2 -2
- package/node_modules/pi-web-access/web-tool-core.ts +24 -5
- package/node_modules/pi-web-access/youtube-extract.ts +2 -2
- package/package.json +10 -7
- package/node_modules/pi-lens/dist/chunk-3VWEZ6H2.js +0 -72
- package/node_modules/pi-lens/dist/chunk-7KWI5UHL.js +0 -28
- package/node_modules/pi-lens/dist/chunk-7M64NTAK.js +0 -38
- package/node_modules/pi-lens/dist/chunk-BEIPWPVR.js +0 -1037
- package/node_modules/pi-lens/dist/chunk-D7OEGXDX.js +0 -2417
- package/node_modules/pi-lens/dist/chunk-KUDUKKQE.js +0 -89
- package/node_modules/pi-lens/dist/chunk-TM3A3K7T.js +0 -28
- package/node_modules/pi-lens/dist/chunk-VD7MQFEV.js +0 -56
- package/node_modules/pi-lens/dist/chunk-YLHJWAQS.js +0 -256
- package/node_modules/pi-lens/dist/chunk-YULIERZW.js +0 -27
|
@@ -24,6 +24,11 @@ import {
|
|
|
24
24
|
parseApiKey,
|
|
25
25
|
resolveProjectId,
|
|
26
26
|
} from "../client/client.js";
|
|
27
|
+
import {
|
|
28
|
+
enterpriseStreamUrl,
|
|
29
|
+
resolveEnterpriseTarget,
|
|
30
|
+
toEnterpriseGenerateBody,
|
|
31
|
+
} from "../client/enterprise.js";
|
|
27
32
|
import {
|
|
28
33
|
getCurrentAvailableModels,
|
|
29
34
|
getCurrentEndpoint,
|
|
@@ -50,6 +55,7 @@ import {
|
|
|
50
55
|
import {
|
|
51
56
|
getCurrentAntigravityRouting,
|
|
52
57
|
getMaxOutputTokens,
|
|
58
|
+
advertisedSiblingRuntimes,
|
|
53
59
|
getAntigravityRequestModelId,
|
|
54
60
|
getFallbackRuntimeModel,
|
|
55
61
|
getThinkingConfig,
|
|
@@ -79,6 +85,7 @@ import {
|
|
|
79
85
|
resolveSessionTrajectory,
|
|
80
86
|
sanitizeText,
|
|
81
87
|
} from "../utils/util.js";
|
|
88
|
+
import { isCreditsEnabled } from "../utils/credits.js";
|
|
82
89
|
import { antigravityFetch, prewarmConnection } from "../utils/http.js";
|
|
83
90
|
|
|
84
91
|
export { ANTIGRAVITY_API };
|
|
@@ -88,7 +95,7 @@ const ANTIGRAVITY_SYSTEM_INSTRUCTION =
|
|
|
88
95
|
"You are pair programming with a user to solve coding tasks. Be concise, practical, and tool-aware.";
|
|
89
96
|
|
|
90
97
|
const ANTIGRAVITY_NO_PREAMBLE_INSTRUCTION =
|
|
91
|
-
'CRITICAL: NEVER output rule checks, formatting guidelines, constraint checklists (e.g. "No emdashes"),
|
|
98
|
+
'CRITICAL: NEVER output rule checks, formatting guidelines, constraint checklists (e.g. "No emdashes"), internal thinking/reasoning preambles, or fake "[Observation from ...]" tool logs in the final response. When calling a tool, emit a real functionCall; never simulate tool calls or tool observations in plain text. Output only the final response.';
|
|
92
99
|
|
|
93
100
|
const CONTINUATION_TEXT = "Continue the active task using the available instructions and context.";
|
|
94
101
|
let toolCallCounter = 0;
|
|
@@ -310,9 +317,19 @@ export function convertMessages(
|
|
|
310
317
|
context: Context,
|
|
311
318
|
runtimeModel: string,
|
|
312
319
|
): GeminiContent[] {
|
|
320
|
+
return convertMessagesWithMetadata(model, context, runtimeModel).contents;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function convertMessagesWithMetadata(
|
|
324
|
+
model: Model<Api>,
|
|
325
|
+
context: Context,
|
|
326
|
+
runtimeModel: string,
|
|
327
|
+
): { contents: GeminiContent[]; hasDegradedToolObservations: boolean } {
|
|
313
328
|
const contents: GeminiContent[] = [];
|
|
329
|
+
let hasDegradedToolObservations = false;
|
|
314
330
|
const requiresSig = geminiRequiresThoughtSignature(runtimeModel);
|
|
315
331
|
const droppedToolCallIds = new Map<string, string>();
|
|
332
|
+
const droppedEmptyToolCalls = new Map<string, string[]>();
|
|
316
333
|
for (const msg of context.messages) {
|
|
317
334
|
if ((msg.role as string) === "system") continue;
|
|
318
335
|
if (msg.role === "user") {
|
|
@@ -347,6 +364,9 @@ export function convertMessages(
|
|
|
347
364
|
});
|
|
348
365
|
} else if (block.type === "thinking" && String(block.thinking || "").trim()) {
|
|
349
366
|
if (!isSameModel) continue;
|
|
367
|
+
if (requiresSig && !isValidThoughtSignature(block.thinkingSignature) && !groupIsSigned) {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
350
370
|
parts.push({
|
|
351
371
|
thought: true,
|
|
352
372
|
text: sanitizeText(block.thinking),
|
|
@@ -364,11 +384,17 @@ export function convertMessages(
|
|
|
364
384
|
})();
|
|
365
385
|
if (rawId) {
|
|
366
386
|
droppedToolCallIds.set(rawId, argsText);
|
|
367
|
-
droppedToolCallIds.set(sanitizeToolCallId(rawId, block.name), argsText);
|
|
368
387
|
} else {
|
|
369
|
-
|
|
388
|
+
const queue = droppedEmptyToolCalls.get(block.name) ?? [];
|
|
389
|
+
queue.push(argsText);
|
|
390
|
+
droppedEmptyToolCalls.set(block.name, queue);
|
|
370
391
|
}
|
|
371
392
|
} else {
|
|
393
|
+
// Tool call IDs can be reused later in a session; a replayable call
|
|
394
|
+
// must not inherit the dropped status of an earlier call.
|
|
395
|
+
const rawId = block.id || "";
|
|
396
|
+
if (rawId) droppedToolCallIds.delete(rawId);
|
|
397
|
+
else droppedEmptyToolCalls.delete(block.name);
|
|
372
398
|
parts.push({
|
|
373
399
|
functionCall: {
|
|
374
400
|
name: block.name,
|
|
@@ -382,6 +408,11 @@ export function convertMessages(
|
|
|
382
408
|
}
|
|
383
409
|
}
|
|
384
410
|
}
|
|
411
|
+
// Keep a boundary between the human's message and flattened tool results.
|
|
412
|
+
// A real functionCall cannot be replayed without the required signature.
|
|
413
|
+
if (!parts.length && requiresSig && !groupIsSigned && toolCalls.length > 0) {
|
|
414
|
+
parts.push({ text: "[Earlier tool call omitted because its signature is unavailable.]" });
|
|
415
|
+
}
|
|
385
416
|
appendTurn(contents, GeminiRole.Model, parts);
|
|
386
417
|
} else if (msg.role === "toolResult") {
|
|
387
418
|
const text = msg.content
|
|
@@ -394,12 +425,35 @@ export function convertMessages(
|
|
|
394
425
|
const sanitizedId = toolCallIdNeeded(model.id, runtimeModel)
|
|
395
426
|
? sanitizeToolCallId(rawId, msg.toolName)
|
|
396
427
|
: rawId;
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
428
|
+
let droppedId = rawId;
|
|
429
|
+
let droppedArgs = requiresSig
|
|
430
|
+
? rawId
|
|
431
|
+
? droppedToolCallIds.get(rawId)
|
|
432
|
+
: droppedEmptyToolCalls.get(msg.toolName)?.[0]
|
|
401
433
|
: undefined;
|
|
434
|
+
if (
|
|
435
|
+
requiresSig &&
|
|
436
|
+
rawId &&
|
|
437
|
+
droppedArgs === undefined &&
|
|
438
|
+
toolCallIdNeeded(model.id, runtimeModel)
|
|
439
|
+
) {
|
|
440
|
+
const matches = [...droppedToolCallIds.entries()].filter(
|
|
441
|
+
([id]) => sanitizeToolCallId(id, msg.toolName) === sanitizedId,
|
|
442
|
+
);
|
|
443
|
+
if (matches.length > 1) {
|
|
444
|
+
throw new Error("Ambiguous sanitized tool call ID in historical tool results.");
|
|
445
|
+
}
|
|
446
|
+
if (matches[0]) [droppedId, droppedArgs] = matches[0];
|
|
447
|
+
}
|
|
402
448
|
if (droppedArgs !== undefined) {
|
|
449
|
+
if (rawId) {
|
|
450
|
+
droppedToolCallIds.delete(droppedId);
|
|
451
|
+
} else {
|
|
452
|
+
const queue = droppedEmptyToolCalls.get(msg.toolName);
|
|
453
|
+
queue?.shift();
|
|
454
|
+
if (queue && queue.length === 0) droppedEmptyToolCalls.delete(msg.toolName);
|
|
455
|
+
}
|
|
456
|
+
hasDegradedToolObservations = true;
|
|
403
457
|
const label =
|
|
404
458
|
droppedArgs === "{}" ? `\`${msg.toolName}\`` : `\`${msg.toolName}\` (${droppedArgs})`;
|
|
405
459
|
appendTurn(contents, GeminiRole.User, [
|
|
@@ -467,7 +521,7 @@ export function convertMessages(
|
|
|
467
521
|
appendTurn(contents, GeminiRole.User, [{ text: CONTINUATION_TEXT }]);
|
|
468
522
|
}
|
|
469
523
|
|
|
470
|
-
return contents;
|
|
524
|
+
return { contents, hasDegradedToolObservations };
|
|
471
525
|
}
|
|
472
526
|
|
|
473
527
|
type SchemaReferenceIssue = {
|
|
@@ -880,6 +934,28 @@ function mapToolChoiceMode(
|
|
|
880
934
|
return GeminiToolCallingMode.Auto;
|
|
881
935
|
}
|
|
882
936
|
|
|
937
|
+
/**
|
|
938
|
+
* Neutralize system prompt phrases that trigger false 429 RESOURCE_EXHAUSTED
|
|
939
|
+
* responses from the Antigravity proxy when paired with `requestType: "agent"`.
|
|
940
|
+
*/
|
|
941
|
+
export function sanitizeSystemPrompt(text: string): string {
|
|
942
|
+
return text
|
|
943
|
+
.replace(
|
|
944
|
+
/running inside pi,\s*a coding agent harness/gi,
|
|
945
|
+
"running inside your development environment",
|
|
946
|
+
)
|
|
947
|
+
.replace(/inside pi,\s*a coding agent harness/gi, "inside your development environment")
|
|
948
|
+
.replace(
|
|
949
|
+
/(coding assistant )running inside pi(?=[.,!?;:\s]|$)(?!\.\w)/gi,
|
|
950
|
+
"$1running inside your development environment",
|
|
951
|
+
)
|
|
952
|
+
.replace(
|
|
953
|
+
/(coding agent )inside pi(?=[.,!?;:\s]|$)(?!\.\w)/gi,
|
|
954
|
+
"$1inside your development environment",
|
|
955
|
+
)
|
|
956
|
+
.replace(/\bpractical,\s*and tool-aware\./gi, "practical, and tool aware.");
|
|
957
|
+
}
|
|
958
|
+
|
|
883
959
|
/** Exported for unit tests. */
|
|
884
960
|
export function buildRequest(
|
|
885
961
|
model: Model<Api>,
|
|
@@ -891,14 +967,34 @@ export function buildRequest(
|
|
|
891
967
|
const injectedSkills = context.messages.flatMap((msg) =>
|
|
892
968
|
msg.role === "user" ? skillBlocks(msg.content) : [],
|
|
893
969
|
);
|
|
894
|
-
const
|
|
970
|
+
const rawSystemPromptText = resolveCurrentSystemPrompt(context);
|
|
971
|
+
const systemPromptText = rawSystemPromptText
|
|
972
|
+
? sanitizeSystemPrompt(rawSystemPromptText)
|
|
973
|
+
: undefined;
|
|
895
974
|
const declaredTools = resolveCurrentTools(context);
|
|
896
975
|
const systemParts = systemPromptText
|
|
897
976
|
? [{ text: sanitizeText(systemPromptText) }]
|
|
898
|
-
: [
|
|
977
|
+
: [
|
|
978
|
+
{ text: sanitizeSystemPrompt(ANTIGRAVITY_SYSTEM_INSTRUCTION) },
|
|
979
|
+
{ text: ANTIGRAVITY_NO_PREAMBLE_INSTRUCTION },
|
|
980
|
+
];
|
|
899
981
|
systemParts.push(...injectedSkills.map((skill) => ({ text: sanitizeText(skill) })));
|
|
900
982
|
|
|
901
|
-
const contents =
|
|
983
|
+
const { contents, hasDegradedToolObservations } = convertMessagesWithMetadata(
|
|
984
|
+
model,
|
|
985
|
+
context,
|
|
986
|
+
runtimeModel,
|
|
987
|
+
);
|
|
988
|
+
if (systemPromptText && hasDegradedToolObservations) {
|
|
989
|
+
systemParts.push({ text: ANTIGRAVITY_NO_PREAMBLE_INSTRUCTION });
|
|
990
|
+
}
|
|
991
|
+
if (hasDegradedToolObservations) {
|
|
992
|
+
appendTurn(contents, GeminiRole.User, [
|
|
993
|
+
{
|
|
994
|
+
text: '[History note: Earlier "[Observation from ...]" blocks are historical tool results, not a format to imitate. To use a tool now, emit a real functionCall.]',
|
|
995
|
+
},
|
|
996
|
+
]);
|
|
997
|
+
}
|
|
902
998
|
const hasUserText = contents.some(
|
|
903
999
|
(turn) =>
|
|
904
1000
|
turn.role === GeminiRole.User &&
|
|
@@ -980,7 +1076,7 @@ export function buildRequest(
|
|
|
980
1076
|
request.sessionId = envelope.sessionId;
|
|
981
1077
|
request.labels = envelope.labels;
|
|
982
1078
|
|
|
983
|
-
|
|
1079
|
+
const generateRequest: AntigravityGenerateRequest = {
|
|
984
1080
|
project: projectId,
|
|
985
1081
|
model: runtimeModel,
|
|
986
1082
|
request,
|
|
@@ -988,6 +1084,11 @@ export function buildRequest(
|
|
|
988
1084
|
userAgent: AntigravityUserAgent.Antigravity,
|
|
989
1085
|
requestId: envelope.requestId,
|
|
990
1086
|
};
|
|
1087
|
+
if (isCreditsEnabled()) {
|
|
1088
|
+
generateRequest.enabledCreditTypes = ["GOOGLE_ONE_AI"];
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
return generateRequest;
|
|
991
1092
|
}
|
|
992
1093
|
|
|
993
1094
|
/** Exported for unit tests. */
|
|
@@ -1002,6 +1103,7 @@ function isAccountQuota429(text: string): boolean {
|
|
|
1002
1103
|
return (
|
|
1003
1104
|
/Individual quota reached/i.test(text) ||
|
|
1004
1105
|
/Resets? in /i.test(text) ||
|
|
1106
|
+
/AI credits balance is too low|INSUFFICIENT_G1_CREDITS/i.test(text) ||
|
|
1005
1107
|
(!/rate.?limit/i.test(text) && /quota exceeded|exceeded your|daily limit/i.test(text))
|
|
1006
1108
|
);
|
|
1007
1109
|
}
|
|
@@ -1011,6 +1113,17 @@ function isRetryableRateLimit(text: string): boolean {
|
|
|
1011
1113
|
return /rate.?limit|too many requests/i.test(text);
|
|
1012
1114
|
}
|
|
1013
1115
|
|
|
1116
|
+
/**
|
|
1117
|
+
* Generic capacity 429 with no reset hint. Dead tiers and live-but-throttled
|
|
1118
|
+
* tiers share this body (#89, #122, #125). Callers decide whether to walk
|
|
1119
|
+
* endpoints and sibling tiers; the public error stays non-retryable for Pi
|
|
1120
|
+
* once those attempts are exhausted.
|
|
1121
|
+
*/
|
|
1122
|
+
export function isGenericResourceExhausted(text: string): boolean {
|
|
1123
|
+
if (isAccountQuota429(text) || isRetryableRateLimit(text)) return false;
|
|
1124
|
+
return /resource has been exhausted|RESOURCE_EXHAUSTED/i.test(text);
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1014
1127
|
/**
|
|
1015
1128
|
* Keep the numeric status out of non-retryable errors. Pi treats the digits 429 as a
|
|
1016
1129
|
* retryable provider error even when the friendly text says the model is unavailable.
|
|
@@ -1064,6 +1177,9 @@ export function friendlyAntigravityError(status: number | undefined, text: strin
|
|
|
1064
1177
|
const verifyHint = verifyUrl
|
|
1065
1178
|
? ` Open this link in a browser signed in to the same Google account to verify: ${verifyUrl}`
|
|
1066
1179
|
: "";
|
|
1180
|
+
if (/#3501|do not have a valid license of this product/i.test(msg)) {
|
|
1181
|
+
return "This account's Gemini Enterprise license was not accepted on the consumer endpoint. Next: set ANTIGRAVITY_LOCATION to eu, us, or global, plus ANTIGRAVITY_ENTERPRISE_PROJECT and ANTIGRAVITY_USER_TIER from the license selector, then retry. A regional location is not sent to cloudcode-pa.";
|
|
1182
|
+
}
|
|
1067
1183
|
if (/permission|forbidden|access/i.test(msg) && !verifyUrl) {
|
|
1068
1184
|
return "Antigravity access was denied for this account or project. Next: try another model, re-login, or use an account with access.";
|
|
1069
1185
|
}
|
|
@@ -1080,9 +1196,15 @@ export function friendlyAntigravityError(status: number | undefined, text: strin
|
|
|
1080
1196
|
return "Antigravity reported a conflict for this request. Next: retry once or start a new chat session.";
|
|
1081
1197
|
}
|
|
1082
1198
|
if (status === 429) {
|
|
1199
|
+
if (/AI credits balance is too low|INSUFFICIENT_G1_CREDITS/i.test(msg)) {
|
|
1200
|
+
return "Your AI credits balance is exhausted. Please refill credits in Google One or wait for your regular quota to reset. Next: switch models or retry later.";
|
|
1201
|
+
}
|
|
1083
1202
|
const wait = msg.match(/Resets? in ([^.\n]+)/i)?.[1]?.trim();
|
|
1084
1203
|
if (/Individual quota reached/i.test(msg)) {
|
|
1085
|
-
|
|
1204
|
+
const hint = isCreditsEnabled()
|
|
1205
|
+
? " (AI credits overage active; credit balance may be depleted)"
|
|
1206
|
+
: " (Enable AI credits fallback with /antigravity.credits on)";
|
|
1207
|
+
return `Quota reached. Please wait ${wait || "for reset"}.${hint} Next: switch models or try again after reset.`;
|
|
1086
1208
|
}
|
|
1087
1209
|
// Google answers a real quota wall with a "Resets in …" hint, but uses generic
|
|
1088
1210
|
// RESOURCE_EXHAUSTED ("Resource has been exhausted (e.g. check quota).") for
|
|
@@ -1095,7 +1217,10 @@ export function friendlyAntigravityError(status: number | undefined, text: strin
|
|
|
1095
1217
|
(!/rate.?limit/i.test(msg) &&
|
|
1096
1218
|
/quota exceeded|exceeded your|limit reached|reached your|daily limit/i.test(msg));
|
|
1097
1219
|
if (hardLimit) {
|
|
1098
|
-
|
|
1220
|
+
const hint = isCreditsEnabled()
|
|
1221
|
+
? " (AI credits overage active; credit balance may be depleted)"
|
|
1222
|
+
: " (Enable AI credits fallback with /antigravity.credits on)";
|
|
1223
|
+
return `Quota reached.${wait ? ` Please wait ${wait}.` : ""}${hint} Next: switch models or retry later.`;
|
|
1099
1224
|
}
|
|
1100
1225
|
if (/rate.?limit|too many requests/i.test(msg)) {
|
|
1101
1226
|
return "Rate limited by Antigravity (429 ResourceExhausted). Next: retrying automatically; if it persists, switch models.";
|
|
@@ -1562,7 +1687,8 @@ export function streamAntigravity(
|
|
|
1562
1687
|
try {
|
|
1563
1688
|
let creds = parseApiKey(opts.apiKey);
|
|
1564
1689
|
const triedAccessTokens = new Set<string>([creds.token]);
|
|
1565
|
-
const
|
|
1690
|
+
const enterpriseTarget = resolveEnterpriseTarget();
|
|
1691
|
+
const primaryEndpoint = enterpriseTarget?.host ?? endpointCandidates()[0];
|
|
1566
1692
|
if (primaryEndpoint) prewarmConnection(primaryEndpoint);
|
|
1567
1693
|
// Skip loadCodeAssist roundtrip when credentials already carry a projectId.
|
|
1568
1694
|
const warmedProject = creds.projectId ? null : await loadCodeAssist(creds.token);
|
|
@@ -1594,7 +1720,16 @@ export function streamAntigravity(
|
|
|
1594
1720
|
runtimeCandidates.push(fallback);
|
|
1595
1721
|
}
|
|
1596
1722
|
|
|
1597
|
-
|
|
1723
|
+
const headersFor = (token: string): Record<string, string> => {
|
|
1724
|
+
const headers = antigravityHeaders(token);
|
|
1725
|
+
if (!enterpriseTarget) return headers;
|
|
1726
|
+
const userAgent = headers["User-Agent"] || "";
|
|
1727
|
+
return {
|
|
1728
|
+
...headers,
|
|
1729
|
+
"User-Agent": userAgent.replace("auth_method=consumer", "auth_method=gcp"),
|
|
1730
|
+
};
|
|
1731
|
+
};
|
|
1732
|
+
let requestHeaders = headersFor(creds.token);
|
|
1598
1733
|
|
|
1599
1734
|
// Turn identity mirrors buildRequest's requestIndex (count of successful
|
|
1600
1735
|
// assistant messages): it stays constant across retries of one turn and
|
|
@@ -1623,26 +1758,37 @@ export function streamAntigravity(
|
|
|
1623
1758
|
recordStaticRouteDiagnostics(runtimeModel);
|
|
1624
1759
|
response = undefined;
|
|
1625
1760
|
let lastEndpointError: Error | undefined;
|
|
1626
|
-
|
|
1761
|
+
const endpoints = enterpriseTarget ? [enterpriseTarget.host] : endpointCandidates();
|
|
1762
|
+
for (const endpoint of endpoints) {
|
|
1627
1763
|
setLastEndpoint(endpoint);
|
|
1628
1764
|
// Every POST after the first for this turn replays under a fresh
|
|
1629
1765
|
// upstream session/trajectory so it cannot queue behind the crashed
|
|
1630
1766
|
// attempt's server-side generation (see retrySessionSeed).
|
|
1631
1767
|
const nonce = nextRequestNonce(turnKey);
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
runtimeModel,
|
|
1641
|
-
),
|
|
1768
|
+
const attemptOptions =
|
|
1769
|
+
nonce === 0 ? opts : { ...opts, sessionId: retrySessionSeed(opts.sessionId, nonce) };
|
|
1770
|
+
let payload: unknown = buildRequest(
|
|
1771
|
+
model,
|
|
1772
|
+
context,
|
|
1773
|
+
enterpriseTarget?.projectId || projectId,
|
|
1774
|
+
attemptOptions,
|
|
1775
|
+
runtimeModel,
|
|
1642
1776
|
);
|
|
1777
|
+
if (enterpriseTarget) {
|
|
1778
|
+
payload = toEnterpriseGenerateBody(
|
|
1779
|
+
payload as AntigravityGenerateRequest,
|
|
1780
|
+
enterpriseTarget,
|
|
1781
|
+
);
|
|
1782
|
+
}
|
|
1783
|
+
const rewritten = await opts.onPayload?.(payload, model);
|
|
1784
|
+
if (rewritten !== undefined) payload = rewritten;
|
|
1785
|
+
const body = JSON.stringify(payload);
|
|
1786
|
+
const url = enterpriseTarget
|
|
1787
|
+
? enterpriseStreamUrl(enterpriseTarget)
|
|
1788
|
+
: `${endpoint}/v1internal:streamGenerateContent?alt=sse`;
|
|
1643
1789
|
try {
|
|
1644
1790
|
response = await fetchWithHeaderDeadline(
|
|
1645
|
-
|
|
1791
|
+
url,
|
|
1646
1792
|
{
|
|
1647
1793
|
method: "POST",
|
|
1648
1794
|
headers: requestHeaders,
|
|
@@ -1665,7 +1811,10 @@ export function streamAntigravity(
|
|
|
1665
1811
|
if (response.ok) break;
|
|
1666
1812
|
lastText = await response.text();
|
|
1667
1813
|
if (response.status === 429 && isAccountQuota429(lastText)) break;
|
|
1668
|
-
// Generic
|
|
1814
|
+
// Generic RESOURCE_EXHAUSTED is capacity pressure when another endpoint
|
|
1815
|
+
// or same-generation tier might still be live (#122, #125). A model
|
|
1816
|
+
// that fails every one of those still uses the non-retryable #89 message.
|
|
1817
|
+
if (response.status === 429 && isGenericResourceExhausted(lastText)) continue;
|
|
1669
1818
|
if (response.status === 429 && !isRetryableRateLimit(lastText)) break;
|
|
1670
1819
|
if (![403, 404, 429, 500, 502, 503, 504].includes(response.status)) break;
|
|
1671
1820
|
}
|
|
@@ -1696,6 +1845,16 @@ export function streamAntigravity(
|
|
|
1696
1845
|
}
|
|
1697
1846
|
}
|
|
1698
1847
|
}
|
|
1848
|
+
if (response?.status === 429 && isGenericResourceExhausted(lastText)) {
|
|
1849
|
+
const nextSibling = advertisedSiblingRuntimes(runtimeModel).find(
|
|
1850
|
+
(id) => !runtimeCandidates.includes(id),
|
|
1851
|
+
);
|
|
1852
|
+
if (nextSibling && runtimeCandidates.length < 4) {
|
|
1853
|
+
// Same-generation tiers before a cross-generation compatibility fallback.
|
|
1854
|
+
runtimeCandidates.splice(candIdx + 1, 0, nextSibling);
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1699
1858
|
break;
|
|
1700
1859
|
}
|
|
1701
1860
|
|
|
@@ -1736,7 +1895,7 @@ export function streamAntigravity(
|
|
|
1736
1895
|
if (next) {
|
|
1737
1896
|
triedAccessTokens.add(next.token);
|
|
1738
1897
|
creds = next;
|
|
1739
|
-
requestHeaders =
|
|
1898
|
+
requestHeaders = headersFor(creds.token);
|
|
1740
1899
|
const switchedProject = creds.projectId ? null : await loadCodeAssist(creds.token);
|
|
1741
1900
|
projectId = resolveProjectId({
|
|
1742
1901
|
token: creds.token,
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
ThinkingContent,
|
|
7
7
|
ToolCall,
|
|
8
8
|
} from "@earendil-works/pi-ai";
|
|
9
|
+
import type { ProviderModelConfig } from "@earendil-works/pi-coding-agent";
|
|
9
10
|
import type { GeminiRole, GeminiToolCallingMode, ThinkingEffort, ToolChoice } from "./enums.js";
|
|
10
11
|
|
|
11
12
|
// OAuth & Auth Types
|
|
@@ -34,6 +35,8 @@ export type CallbackServer = {
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
// Model Types
|
|
38
|
+
export type AntigravityModelConfig = Extract<ProviderModelConfig, { maxTokens: number }>;
|
|
39
|
+
|
|
37
40
|
export type AntigravityRouting = {
|
|
38
41
|
off?: string;
|
|
39
42
|
routing?: Partial<Record<ThinkingEffort, string>>;
|
|
@@ -44,8 +47,9 @@ export type AntigravityRouting = {
|
|
|
44
47
|
export const ANTIGRAVITY_API = "antigravity-api" as const;
|
|
45
48
|
export type AntigravityApi = typeof ANTIGRAVITY_API;
|
|
46
49
|
|
|
47
|
-
export type AntigravityStreamOptions = Omit<SimpleStreamOptions, "toolChoice"> & {
|
|
50
|
+
export type AntigravityStreamOptions = Omit<SimpleStreamOptions, "toolChoice" | "reasoning"> & {
|
|
48
51
|
toolChoice?: ToolChoice;
|
|
52
|
+
reasoning?: ThinkingEffort;
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
export type GeminiTextPart = { text: string; thoughtSignature?: string };
|
|
@@ -126,6 +130,7 @@ export type AntigravityGenerateRequest = {
|
|
|
126
130
|
requestType: "agent";
|
|
127
131
|
userAgent: "antigravity";
|
|
128
132
|
requestId: string;
|
|
133
|
+
enabledCreditTypes?: string[];
|
|
129
134
|
};
|
|
130
135
|
|
|
131
136
|
export type StreamPart = {
|
|
@@ -162,6 +167,8 @@ export type StreamResponseData = {
|
|
|
162
167
|
export type StreamChunk = StreamResponseData & {
|
|
163
168
|
error?: { message?: string; code?: number };
|
|
164
169
|
response?: StreamResponseData;
|
|
170
|
+
consumedCredits?: unknown;
|
|
171
|
+
remainingCredits?: unknown;
|
|
165
172
|
};
|
|
166
173
|
|
|
167
174
|
export type LooseImageBlock = {
|
|
@@ -205,10 +212,17 @@ export type ModelQuotaRow = {
|
|
|
205
212
|
recommended?: boolean;
|
|
206
213
|
};
|
|
207
214
|
|
|
215
|
+
export type CreditBalanceInfo = {
|
|
216
|
+
creditType?: string;
|
|
217
|
+
creditAmount?: number;
|
|
218
|
+
minimumCreditAmountForUsage?: number;
|
|
219
|
+
};
|
|
220
|
+
|
|
208
221
|
export type TierInfo = {
|
|
209
222
|
id?: string;
|
|
210
223
|
name?: string;
|
|
211
224
|
description?: string;
|
|
225
|
+
availableCredits?: CreditBalanceInfo[];
|
|
212
226
|
};
|
|
213
227
|
|
|
214
228
|
export type AccountUsage = {
|
|
@@ -218,6 +232,7 @@ export type AccountUsage = {
|
|
|
218
232
|
productTier?: TierInfo;
|
|
219
233
|
paidTier?: TierInfo;
|
|
220
234
|
planLabel?: string;
|
|
235
|
+
availableCredits?: CreditBalanceInfo[];
|
|
221
236
|
groups: QuotaGroup[];
|
|
222
237
|
groupDescription?: string;
|
|
223
238
|
/** Set when the (subscription-gated) quota-summary RPC was unavailable, e.g. free-tier SUBSCRIPTION_REQUIRED. */
|
|
@@ -266,6 +281,7 @@ export type ModelInfoRaw = {
|
|
|
266
281
|
supportsThinking?: unknown;
|
|
267
282
|
supportsImages?: unknown;
|
|
268
283
|
recommended?: unknown;
|
|
284
|
+
disabled?: unknown;
|
|
269
285
|
quotaInfo?: {
|
|
270
286
|
remainingFraction?: unknown;
|
|
271
287
|
resetTime?: unknown;
|
|
@@ -288,13 +304,26 @@ export type AvailableModelsRaw = {
|
|
|
288
304
|
agentModelSorts?: AgentModelSort[];
|
|
289
305
|
};
|
|
290
306
|
|
|
307
|
+
export type CreditEntryRaw = {
|
|
308
|
+
creditType?: unknown;
|
|
309
|
+
credit_type?: unknown;
|
|
310
|
+
creditAmount?: unknown;
|
|
311
|
+
credit_amount?: unknown;
|
|
312
|
+
minimumCreditAmountForUsage?: unknown;
|
|
313
|
+
minimum_credit_amount_for_usage?: unknown;
|
|
314
|
+
};
|
|
315
|
+
|
|
291
316
|
export type TierRaw = {
|
|
292
317
|
id?: unknown;
|
|
293
318
|
name?: unknown;
|
|
294
319
|
description?: unknown;
|
|
320
|
+
availableCredits?: CreditEntryRaw[];
|
|
321
|
+
available_credits?: CreditEntryRaw[];
|
|
295
322
|
};
|
|
296
323
|
|
|
297
324
|
export type LoadCodeAssistRaw = {
|
|
298
325
|
currentTier?: TierRaw;
|
|
299
326
|
paidTier?: TierRaw;
|
|
327
|
+
availableCredits?: CreditEntryRaw[];
|
|
328
|
+
available_credits?: CreditEntryRaw[];
|
|
300
329
|
};
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
setLastStatus,
|
|
15
15
|
} from "../diagnostics/diagnostics.js";
|
|
16
16
|
import { isRecord } from "../utils/util.js";
|
|
17
|
+
import { getCreditsStatus } from "../utils/credits.js";
|
|
17
18
|
import { safeError } from "../utils/security.js";
|
|
18
19
|
import { antigravityFetch } from "../utils/http.js";
|
|
19
20
|
import { extractRecommendedModelIds } from "../models/grouping.js";
|
|
@@ -21,6 +22,7 @@ import type {
|
|
|
21
22
|
AccountUsage,
|
|
22
23
|
ApiErrorBody,
|
|
23
24
|
AvailableModelsRaw,
|
|
25
|
+
CreditBalanceInfo,
|
|
24
26
|
LoadCodeAssistRaw,
|
|
25
27
|
ModelQuotaRow,
|
|
26
28
|
QuotaBucket,
|
|
@@ -187,14 +189,37 @@ function parseModels(data: unknown): {
|
|
|
187
189
|
};
|
|
188
190
|
}
|
|
189
191
|
|
|
192
|
+
export function parseCredits(list: unknown): CreditBalanceInfo[] | undefined {
|
|
193
|
+
if (!Array.isArray(list)) return undefined;
|
|
194
|
+
const result: CreditBalanceInfo[] = [];
|
|
195
|
+
for (const item of list) {
|
|
196
|
+
if (!item || !isRecord(item)) continue;
|
|
197
|
+
const amt = item.creditAmount ?? item.credit_amount;
|
|
198
|
+
const min = item.minimumCreditAmountForUsage ?? item.minimum_credit_amount_for_usage;
|
|
199
|
+
const typ = item.creditType ?? item.credit_type;
|
|
200
|
+
const num = typeof amt === "number" ? amt : typeof amt === "string" ? Number(amt) : undefined;
|
|
201
|
+
if (num !== undefined && Number.isFinite(num)) {
|
|
202
|
+
result.push({
|
|
203
|
+
creditType: typeof typ === "string" ? typ : "GOOGLE_ONE_AI",
|
|
204
|
+
creditAmount: num,
|
|
205
|
+
minimumCreditAmountForUsage:
|
|
206
|
+
typeof min === "number" ? min : typeof min === "string" ? Number(min) : undefined,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return result.length ? result : undefined;
|
|
211
|
+
}
|
|
212
|
+
|
|
190
213
|
function parseTier(value: unknown): TierInfo | undefined {
|
|
191
214
|
if (!isRecord(value)) return undefined;
|
|
192
215
|
const tier = value as TierRaw;
|
|
193
216
|
if (!tier.id && !tier.name) return undefined;
|
|
217
|
+
const credits = parseCredits(tier.availableCredits ?? tier.available_credits);
|
|
194
218
|
return {
|
|
195
219
|
id: tier.id ? String(tier.id) : undefined,
|
|
196
220
|
name: tier.name ? String(tier.name) : undefined,
|
|
197
221
|
description: tier.description ? String(tier.description) : undefined,
|
|
222
|
+
availableCredits: credits,
|
|
198
223
|
};
|
|
199
224
|
}
|
|
200
225
|
|
|
@@ -269,6 +294,10 @@ export async function fetchAccountUsage(apiKeyRaw?: string): Promise<AccountUsag
|
|
|
269
294
|
const assistData = (isRecord(assistResult?.data) ? assistResult.data : {}) as LoadCodeAssistRaw;
|
|
270
295
|
const productTier = parseTier(assistData.currentTier);
|
|
271
296
|
const paidTier = parseTier(assistData.paidTier);
|
|
297
|
+
const availableCredits =
|
|
298
|
+
paidTier?.availableCredits ??
|
|
299
|
+
productTier?.availableCredits ??
|
|
300
|
+
parseCredits(assistData.availableCredits ?? assistData.available_credits);
|
|
272
301
|
|
|
273
302
|
// Google returns currentTier=free-tier even for Google AI Pro accounts.
|
|
274
303
|
// The real subscription lives in paidTier (e.g. g1-pro-tier / Google AI Pro).
|
|
@@ -284,6 +313,7 @@ export async function fetchAccountUsage(apiKeyRaw?: string): Promise<AccountUsag
|
|
|
284
313
|
productTier,
|
|
285
314
|
paidTier,
|
|
286
315
|
planLabel,
|
|
316
|
+
availableCredits,
|
|
287
317
|
groups,
|
|
288
318
|
groupDescription: description,
|
|
289
319
|
quotaSummaryError,
|
|
@@ -329,6 +359,34 @@ export function formatUsageSummary(usage: AccountUsage): string {
|
|
|
329
359
|
return lines.join("\n").trimEnd();
|
|
330
360
|
}
|
|
331
361
|
|
|
362
|
+
export async function fetchRemainingCredits(apiKeyRaw?: string): Promise<{
|
|
363
|
+
availableCredits?: CreditBalanceInfo[];
|
|
364
|
+
overagesEnabled: boolean;
|
|
365
|
+
planLabel?: string;
|
|
366
|
+
}> {
|
|
367
|
+
const creds = parseApiKey(apiKeyRaw);
|
|
368
|
+
const assistResult = await loadCodeAssistSafe(creds.token);
|
|
369
|
+
const assistData = (isRecord(assistResult?.data) ? assistResult.data : {}) as LoadCodeAssistRaw;
|
|
370
|
+
const productTier = parseTier(assistData.currentTier);
|
|
371
|
+
const paidTier = parseTier(assistData.paidTier);
|
|
372
|
+
const availableCredits =
|
|
373
|
+
paidTier?.availableCredits ??
|
|
374
|
+
productTier?.availableCredits ??
|
|
375
|
+
parseCredits(assistData.availableCredits ?? assistData.available_credits);
|
|
376
|
+
const status = getCreditsStatus();
|
|
377
|
+
const planLabel = paidTier?.name
|
|
378
|
+
? `${paidTier.name}${paidTier.id ? ` (${paidTier.id})` : ""}`
|
|
379
|
+
: productTier?.name
|
|
380
|
+
? `${productTier.name}${productTier.id ? ` (${productTier.id})` : ""}`
|
|
381
|
+
: undefined;
|
|
382
|
+
|
|
383
|
+
return {
|
|
384
|
+
availableCredits,
|
|
385
|
+
overagesEnabled: status.enabled,
|
|
386
|
+
planLabel,
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
332
390
|
export function formatModelsList(usage: AccountUsage, opts?: { all?: boolean }): string {
|
|
333
391
|
const lines: string[] = [];
|
|
334
392
|
lines.push("Antigravity available models");
|