@iowarp/clio-coder 0.4.2 → 0.4.3
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 +35 -0
- package/CONTRIBUTING.md +86 -19
- package/README.md +35 -6
- package/dist/{acp-TMDQZDIG.js → acp-H2NGRPWO.js} +11 -11
- package/dist/{agents-5N5NG3XG.js → agents-TL5LLUQP.js} +54 -53
- package/dist/assets/codewiki.json +1 -1
- package/dist/{auth-Z5CCBXKQ.js → auth-E5SW4HMS.js} +19 -16
- package/dist/{builtins-K6TNDT24.js → builtins-IA7V7FUC.js} +9 -4
- package/dist/{chunk-ZW4HH5JJ.js → chunk-2APPQIER.js} +6 -6
- package/dist/{chunk-72GZI5EV.js → chunk-2JH2WHGE.js} +2 -2
- package/dist/{chunk-UBRFI4HS.js → chunk-2UG5F4C5.js} +127 -47
- package/dist/{chunk-UH632ZYL.js → chunk-2UH2KFUP.js} +2 -2
- package/dist/{chunk-3F7VUY77.js → chunk-2VIKGWFZ.js} +2 -2
- package/dist/{chunk-I66EAJFY.js → chunk-2WZ546HR.js} +267 -232
- package/dist/{chunk-RKSR6VSF.js → chunk-4IUZQIJ3.js} +29 -1
- package/dist/{chunk-2X4RYJTJ.js → chunk-4UVU7BJ5.js} +2 -2
- package/dist/{chunk-M2DAX4F6.js → chunk-4WR7VSYB.js} +2 -2
- package/dist/{chunk-5KW52TEP.js → chunk-54CBCGIR.js} +5 -5
- package/dist/{chunk-3KIPBMUA.js → chunk-5ICU3EUH.js} +2 -2
- package/dist/{chunk-77QIVUZB.js → chunk-5MEZN6CB.js} +4 -4
- package/dist/{chunk-O42A54GG.js → chunk-5OIVVPHF.js} +2 -2
- package/dist/{chunk-LJID3DYZ.js → chunk-64I3JVYM.js} +2 -2
- package/dist/{chunk-4JDLP6ZS.js → chunk-6PTFB5VS.js} +7 -7
- package/dist/{chunk-VN3SHNBN.js → chunk-7DICMOS6.js} +2 -2
- package/dist/{chunk-HLAFFSEK.js → chunk-7DRAWPTZ.js} +2 -2
- package/dist/chunk-7E7I3WLS.js +3762 -0
- package/dist/{chunk-YJISEZKC.js → chunk-7ZYNNDKC.js} +6 -6
- package/dist/{chunk-I66ZTYNP.js → chunk-AF4YM7Z4.js} +236 -101
- package/dist/{chunk-2HFQNRV3.js → chunk-AX2THNSA.js} +12 -12
- package/dist/{chunk-PGF63K6I.js → chunk-B4OAX3SI.js} +65 -3
- package/dist/{chunk-W6NIE6OW.js → chunk-B4VEBZKF.js} +3 -3
- package/dist/{chunk-JBCS7CRR.js → chunk-BEPZRGGU.js} +10 -10
- package/dist/{chunk-XGDPUNND.js → chunk-CE5AX47J.js} +2 -2
- package/dist/{chunk-I64IFBLB.js → chunk-DWUOQKRU.js} +17 -10
- package/dist/{chunk-DZAW46HP.js → chunk-E3TPLWFX.js} +3 -3
- package/dist/{chunk-HIICAHCJ.js → chunk-EKCHAPYA.js} +2 -2
- package/dist/{chunk-XE3PCIXH.js → chunk-F5JHEYZM.js} +7 -7
- package/dist/{chunk-5PFYMY2V.js → chunk-FTMGRKEF.js} +2 -2
- package/dist/{chunk-ZNT2M6TG.js → chunk-G76U63X4.js} +17 -17
- package/dist/{chunk-34BHNEE3.js → chunk-GHS5EBTQ.js} +58 -7
- package/dist/{chunk-2NHR3NAY.js → chunk-GI7YYQ3F.js} +40 -34
- package/dist/{chunk-DYHAXKHD.js → chunk-GWZNEVM2.js} +12 -8
- package/dist/chunk-GYV6VZOC.js +26 -0
- package/dist/{chunk-MQXIVJ35.js → chunk-HAXOFFRH.js} +5 -5
- package/dist/{chunk-W4YEMFBX.js → chunk-HEQY7ZFI.js} +2 -2
- package/dist/{chunk-IKOZFYBN.js → chunk-I7ZPNEJM.js} +145 -102
- package/dist/{chunk-WNP7O5WZ.js → chunk-ID64D7PE.js} +4 -4
- package/dist/{chunk-XQRY4DTA.js → chunk-IGLP3ODT.js} +10 -10
- package/dist/chunk-IJNZMHLA.js +101 -0
- package/dist/{chunk-JWJGP5DQ.js → chunk-INY6HTFL.js} +7 -7
- package/dist/{chunk-PBP4B7XR.js → chunk-IUE3Y34X.js} +2 -2
- package/dist/{chunk-B74PXLU7.js → chunk-IWT4SF4R.js} +3 -3
- package/dist/{chunk-B7HM5Z7T.js → chunk-JDAY6FIL.js} +5 -5
- package/dist/{chunk-PJX3WQUQ.js → chunk-JEQ3XTHC.js} +2 -2
- package/dist/{chunk-FSP7CMNU.js → chunk-JGRC33J2.js} +50 -4
- package/dist/{chunk-X7IARSHT.js → chunk-JKKCYP3C.js} +9 -9
- package/dist/{chunk-HJWWJ6IL.js → chunk-JSC3U7TI.js} +16 -4
- package/dist/{chunk-SSEYRH53.js → chunk-KK4JZPBQ.js} +19 -140
- package/dist/{chunk-IHXBNWMM.js → chunk-KXDSS5WJ.js} +7 -3
- package/dist/{chunk-Q4XWMHX6.js → chunk-L47TF46W.js} +2 -2
- package/dist/{chunk-O3YUNJZ2.js → chunk-LDJG7DW3.js} +81 -24
- package/dist/{chunk-CDNVLKUX.js → chunk-LLDJM5XK.js} +13 -7
- package/dist/{chunk-F2I26BDK.js → chunk-MUW2BDDH.js} +4 -4
- package/dist/{chunk-HKMD33FO.js → chunk-MWUZBSAQ.js} +79 -76
- package/dist/{chunk-QQLGQY2A.js → chunk-N2Z7HLVY.js} +20 -20
- package/dist/{chunk-DZEK6CJN.js → chunk-NIQJ66N4.js} +19 -19
- package/dist/{chunk-CWVRRIEI.js → chunk-NZMNUPZZ.js} +2 -2
- package/dist/{chunk-462T4EGZ.js → chunk-O5CVSAG5.js} +2 -2
- package/dist/{chunk-TPEQIQIE.js → chunk-OML5D5V5.js} +8 -8
- package/dist/{chunk-IKSLQ4XV.js → chunk-PAJQJ7BS.js} +558 -216
- package/dist/{chunk-ZW55JB7N.js → chunk-PUVDKJ2Y.js} +2 -2
- package/dist/{chunk-UH347SHR.js → chunk-QWGDJJYJ.js} +11 -11
- package/dist/chunk-R6Q67RJH.js +134 -0
- package/dist/{chunk-CRFOIAX3.js → chunk-RRNP2ANY.js} +6 -6
- package/dist/{chunk-IDNA72AH.js → chunk-RSJ25QSL.js} +2 -2
- package/dist/chunk-SKHCAU7K.js +385 -0
- package/dist/{chunk-RLYRBIYQ.js → chunk-TM6LQDI3.js} +20 -12
- package/dist/chunk-UOIZ7DA4.js +41 -0
- package/dist/{chunk-P75RZCJW.js → chunk-UPZU6GE4.js} +3 -3
- package/dist/{chunk-MCMZMDAC.js → chunk-V2ANDPVT.js} +4 -4
- package/dist/{chunk-AK5XEFVZ.js → chunk-VA5FNYMT.js} +26 -13
- package/dist/{chunk-IMXMHHMQ.js → chunk-VW6DOEDG.js} +332 -57
- package/dist/{chunk-XOXV5GKE.js → chunk-W6RRQCPQ.js} +16 -7
- package/dist/{chunk-CYZW7JHJ.js → chunk-WBKFA554.js} +8 -8
- package/dist/{chunk-BO7Y52RY.js → chunk-WCXUNS7U.js} +7 -7
- package/dist/{chunk-ZGNYYXQ6.js → chunk-WRBAGUNF.js} +3 -3
- package/dist/{chunk-FVDGR2ZL.js → chunk-XIVNBFZS.js} +85 -30
- package/dist/{chunk-BYMNWQ7O.js → chunk-XPWWI35G.js} +299 -58
- package/dist/{chunk-KPXDY6QF.js → chunk-XRZT5WY5.js} +2 -2
- package/dist/{chunk-AZ4WMN4W.js → chunk-Y3CBHOR6.js} +2 -2
- package/dist/{chunk-VXMFAE2W.js → chunk-YPC6ZR5L.js} +19 -6
- package/dist/{chunk-54ODD65L.js → chunk-YQWYVTMC.js} +4 -4
- package/dist/{chunk-M2WXEHER.js → chunk-ZA4VCIGV.js} +2 -2
- package/dist/{chunk-7BHIY2MW.js → chunk-ZDN3Y73Y.js} +6 -6
- package/dist/{chunk-E7GT7O5N.js → chunk-ZWPRK62N.js} +7 -4
- package/dist/cli/index.js +38 -37
- package/dist/{clio-7VB377CC.js → clio-CMMK4KRR.js} +7 -7
- package/dist/{code-nav-YVLCYA7V.js → code-nav-MDZNQS33.js} +7 -7
- package/dist/{components-UBWCQSRW.js → components-UCUQ4QXW.js} +4 -4
- package/dist/{config-4HVOS65E.js → config-SVM5P5YI.js} +76 -74
- package/dist/{configure-PIWO7B24.js → configure-LE3IK2TJ.js} +26 -24
- package/dist/{context-IYEHL3WQ.js → context-2OHRKS42.js} +66 -63
- package/dist/{context-N6ZE3LGJ.js → context-E3VC7RX5.js} +15 -11
- package/dist/{context-KQYIWPWT.js → context-VNCR7KAG.js} +60 -45
- package/dist/{context-clear-G4OGZJDS.js → context-clear-BW4O37TG.js} +61 -59
- package/dist/context-map-COB37XXN.js +505 -0
- package/dist/{context-working-set-BWLF6LJP.js → context-working-set-VDS25HXZ.js} +17 -16
- package/dist/{dispatch-runner-2QQAITS3.js → dispatch-runner-5AHT53RF.js} +85 -74
- package/dist/{doctor-LHBD36VU.js → doctor-WNNVO6FY.js} +37 -37
- package/dist/{eval-C45FYRJ6.js → eval-7G7SGAYO.js} +285 -114
- package/dist/{eval-inventory-6DEJPLBF.js → eval-inventory-Y6QRFOH5.js} +4 -4
- package/dist/{evidence-6SHONYAF.js → evidence-VD6736FQ.js} +63 -62
- package/dist/{evolve-KRKMV72X.js → evolve-AL3NGVRL.js} +62 -61
- package/dist/{extensions-KPZ2UHBB.js → extensions-MOVJ32NM.js} +7 -7
- package/dist/{fleet-IVTCKDHT.js → fleet-QZHUMAGI.js} +110 -108
- package/dist/{fleet-commands-EDWL3IT7.js → fleet-commands-BAYT5FJZ.js} +10 -10
- package/dist/{fleet-decisions-YP3YEFGK.js → fleet-decisions-IREVMRU4.js} +7 -6
- package/dist/{fleet-graph-ZFWKHY2M.js → fleet-graph-YCTT3HTI.js} +19 -18
- package/dist/{fleet-inspect-FVUNCBML.js → fleet-inspect-QVJTDAVB.js} +55 -54
- package/dist/{fleet-preflight-UN5XED4R.js → fleet-preflight-25QAFPK4.js} +4 -4
- package/dist/{fleet-validate-XOWC4HSX.js → fleet-validate-5O57AAJ7.js} +23 -22
- package/dist/{fleet-verify-UN3SODEL.js → fleet-verify-CPH2W2T6.js} +56 -55
- package/dist/{fleet-view-TWHJKCN6.js → fleet-view-SWBR3VGQ.js} +55 -54
- package/dist/{init-T2QORQ3Y.js → init-J477LKZH.js} +78 -76
- package/dist/{interop-IN5I2A66.js → interop-3FCM6XLG.js} +11 -11
- package/dist/{library-LSCATDLZ.js → library-QUQEIUG6.js} +28 -27
- package/dist/{memory-HYOKAGGJ.js → memory-SGGSEP65.js} +64 -63
- package/dist/{models-2GPMFYCM.js → models-HEKUAXXK.js} +49 -43
- package/dist/{monitor-E4ASVUJH.js → monitor-HKU57TYQ.js} +61 -60
- package/dist/{orchestrator-DDMPR3PY.js → orchestrator-VDFAEFAI.js} +919 -546
- package/dist/{panes-E3RUXOW5.js → panes-DN2SSFOH.js} +3 -3
- package/dist/{panes-IXKLOKA2.js → panes-TALGNPZT.js} +8 -8
- package/dist/{paths-L7LGY6RN.js → paths-NBMFAIEZ.js} +5 -5
- package/dist/reset-EAJFFJVB.js +344 -0
- package/dist/{resources-OTRSN34L.js → resources-OVKSEFVE.js} +27 -20
- package/dist/{run-5DEYH5QK.js → run-7DP7ZF2J.js} +113 -109
- package/dist/{share-IHWTLO3M.js → share-WML67FT3.js} +26 -25
- package/dist/{skills-IYMXMKW4.js → skills-SG662R2K.js} +39 -31
- package/dist/{skills-eval-DROHSJAR.js → skills-eval-VVZEUU46.js} +74 -73
- package/dist/{skills-inventory-D7X4L4ZX.js → skills-inventory-I2E23GET.js} +21 -20
- package/dist/{slash-commands-QBM7UZ3B.js → slash-commands-S7MBJDQK.js} +35 -34
- package/dist/{steer-Z5DO23FJ.js → steer-2LQOMCPB.js} +3 -3
- package/dist/{support-U7QOWY26.js → support-CC2UJBJ6.js} +6 -6
- package/dist/{targets-P2FUC4IL.js → targets-4QC3HIEW.js} +48 -45
- package/dist/{terminal-lease-YREJ3JX2.js → terminal-lease-TUHIJ6Y2.js} +2 -2
- package/dist/{tools-5B7RO6MV.js → tools-TFGJICCU.js} +8 -8
- package/dist/{trace-YMGMUM6A.js → trace-FXMXUZUF.js} +7 -7
- package/dist/uninstall-5PEVOE5B.js +408 -0
- package/dist/upgrade-M4WXY6KN.js +303 -0
- package/dist/{usage-ME5MPXGX.js → usage-N7ZNVLEM.js} +147 -102
- package/dist/{verifiers-BVZ7IWOO.js → verifiers-DJTP4XX6.js} +15 -15
- package/dist/{verify-5K7ZKQFC.js → verify-RWE4PPEK.js} +9 -9
- package/dist/{wiki-generate-F5W5QTYY.js → wiki-generate-C7IQOXSP.js} +84 -82
- package/dist/{with-panes-BYOJCLAM.js → with-panes-4GCGSL7J.js} +9 -9
- package/dist/worker/entry.js +61 -60
- package/docs/architecture/artifact-placement.md +1 -0
- package/docs/architecture/artifact-versions.md +1 -1
- package/docs/architecture/context-engine.md +4 -0
- package/docs/architecture/middleware-and-components.md +1 -1
- package/docs/architecture/model-catalog.md +21 -10
- package/docs/architecture/observability.md +12 -1
- package/docs/architecture/prompt-envelope-and-tools.md +2 -0
- package/docs/architecture/provider-adapter-cookbook.md +63 -0
- package/docs/architecture/safety-model.md +15 -5
- package/docs/guide/built-in-agents.md +17 -3
- package/docs/guide/commands-and-modes.md +1 -1
- package/docs/guide/configuration-and-targets.md +97 -9
- package/docs/guide/configuration-reference.md +7 -2
- package/docs/guide/environment-variables.md +2 -0
- package/docs/guide/installation-and-lifecycle.md +37 -4
- package/docs/guide/proactive-memory.md +66 -55
- package/docs/guide/skills-marketplace.md +18 -0
- package/docs/process/development-pipeline.md +34 -1
- package/docs/process/eval-runner.md +67 -3
- package/evals/behavioral-model.yaml +3 -2
- package/package.json +2 -2
- package/skills/README.md +7 -5
- package/skills/coding/ast-grep/SKILL.md +101 -30
- package/skills/coding/ast-grep/evals.md +26 -0
- package/skills/coding/coding-standards/SKILL.md +40 -5
- package/skills/coding/coding-standards/evals.md +23 -0
- package/skills/coding/prototype/SKILL.md +87 -28
- package/skills/coding/prototype/evals.md +19 -0
- package/skills/coding/tdd/SKILL.md +80 -53
- package/skills/coding/tdd/evals.md +20 -0
- package/skills/context/context-handoff/SKILL.md +43 -2
- package/skills/context/context-handoff/evals.md +44 -0
- package/skills/context/context-prime/SKILL.md +45 -15
- package/skills/context/context-prime/evals.md +45 -0
- package/skills/git/branch-closeout/SKILL.md +132 -0
- package/skills/git/branch-closeout/evals.md +133 -0
- package/skills/git/branch-closeout/references/closeout-checklist.md +81 -0
- package/skills/git/file-ticket/SKILL.md +77 -63
- package/skills/git/file-ticket/assets/issue-template.md +22 -0
- package/skills/git/file-ticket/evals.md +31 -26
- package/skills/git/file-ticket/references/issue-discovery.md +49 -0
- package/skills/git/fix-issue/SKILL.md +87 -64
- package/skills/git/fix-issue/evals.md +35 -31
- package/skills/git/fix-issue/references/diagnosis-and-rca.md +46 -0
- package/skills/git/resolve-merge-conflicts/SKILL.md +100 -51
- package/skills/git/resolve-merge-conflicts/evals.md +52 -25
- package/skills/git/resolve-merge-conflicts/references/conflict-matrix.md +126 -0
- package/skills/git/ship/SKILL.md +103 -67
- package/skills/git/ship/assets/pr-template.md +21 -0
- package/skills/git/ship/evals.md +44 -28
- package/skills/git/ship/references/remote-and-branch-policy.md +62 -0
- package/skills/git/worktree-create/SKILL.md +80 -50
- package/skills/git/worktree-create/evals.md +40 -33
- package/skills/git/worktree-create/references/worktree-setup.md +62 -66
- package/skills/git/worktree-merge/SKILL.md +112 -65
- package/skills/git/worktree-merge/evals.md +42 -34
- package/skills/git/worktree-merge/references/merge-strategies.md +52 -0
- package/skills/planning/archify/SKILL.md +196 -0
- package/skills/planning/archify/evals.md +65 -0
- package/skills/planning/architecture/SKILL.md +61 -12
- package/skills/planning/architecture/evals.md +65 -0
- package/skills/planning/backlog/SKILL.md +130 -14
- package/skills/planning/backlog/evals.md +142 -0
- package/skills/planning/prd/SKILL.md +46 -6
- package/skills/planning/prd/evals.md +54 -0
- package/skills/planning/product-intent/SKILL.md +57 -2
- package/skills/planning/product-intent/evals.md +70 -0
- package/skills/planning/tech-spec/SKILL.md +53 -2
- package/skills/planning/tech-spec/evals.md +73 -0
- package/skills/registry.yaml +58 -50
- package/skills/remote.yaml +13 -0
- package/skills/research/arxiv-literature/SKILL.md +76 -18
- package/skills/research/arxiv-literature/evals.md +50 -0
- package/skills/research/experiment-protocol/SKILL.md +20 -1
- package/skills/research/experiment-protocol/evals.md +23 -0
- package/skills/research/scientific-debugging/SKILL.md +23 -1
- package/skills/research/scientific-debugging/evals.md +18 -0
- package/skills/research/scientific-modernization/SKILL.md +26 -1
- package/skills/research/scientific-modernization/evals.md +27 -0
- package/skills/skill-marketplace.json +63 -28
- package/skills/workflow/cut-it/SKILL.md +65 -5
- package/skills/workflow/cut-it/evals.md +101 -0
- package/skills/workflow/design-council/SKILL.md +117 -27
- package/skills/workflow/design-council/evals.md +161 -0
- package/skills/workflow/grill-me/SKILL.md +86 -10
- package/skills/workflow/grill-me/evals.md +153 -0
- package/skills/workflow/workflow-distiller/SKILL.md +76 -17
- package/skills/workflow/workflow-distiller/evals.md +118 -0
- package/src/cli/configure-interop.ts +105 -13
- package/src/cli/configure-oauth.ts +57 -0
- package/src/cli/configure-onboarding.ts +980 -0
- package/src/cli/configure-target.ts +594 -0
- package/src/cli/configure.ts +1082 -528
- package/src/cli/context-map.ts +114 -0
- package/src/cli/context.ts +4 -0
- package/src/cli/index.ts +1 -0
- package/src/cli/lifecycle-presenter.ts +436 -0
- package/src/cli/models.ts +10 -2
- package/src/cli/modes/print.ts +5 -1
- package/src/cli/reset.ts +228 -106
- package/src/cli/run.ts +7 -2
- package/src/cli/select.ts +664 -0
- package/src/cli/skills.ts +9 -2
- package/src/cli/targets.ts +3 -0
- package/src/cli/uninstall.ts +233 -165
- package/src/cli/upgrade.ts +204 -149
- package/src/cli/usage.ts +86 -27
- package/src/cli/validate-model.ts +3 -3
- package/src/core/config.ts +56 -0
- package/src/core/external-diagnostic.ts +44 -0
- package/src/core/gateway-routing.ts +157 -0
- package/src/core/safe-exec.ts +17 -2
- package/src/core/skill-activation.ts +89 -2
- package/src/domains/agents/builtins/world-knowledge.md +31 -0
- package/src/domains/agents/catalog.ts +1 -1
- package/src/domains/agents/result-contract.ts +70 -0
- package/src/domains/context/wiki/map-seed.ts +589 -0
- package/src/domains/context/wiki/plan.ts +2 -2
- package/src/domains/dispatch/admission.ts +29 -0
- package/src/domains/dispatch/agent-candidates.ts +10 -0
- package/src/domains/dispatch/budget-envelope.ts +86 -1
- package/src/domains/dispatch/capability-match.ts +1 -0
- package/src/domains/dispatch/capacity-lease.ts +17 -0
- package/src/domains/dispatch/contract.ts +11 -1
- package/src/domains/dispatch/extension.ts +134 -29
- package/src/domains/dispatch/types.ts +3 -0
- package/src/domains/dispatch/worker-model-metadata.ts +38 -0
- package/src/domains/eval/metrics/call-ledger-stream.ts +34 -11
- package/src/domains/eval/metrics/token-stream.ts +201 -31
- package/src/domains/eval/metrics/tracked.ts +40 -4
- package/src/domains/eval/runners/clio-run.ts +5 -2
- package/src/domains/eval/schema/suite.ts +28 -0
- package/src/domains/eval/schema/verdict.ts +2 -2
- package/src/domains/eval/suites/resolve.ts +13 -1
- package/src/domains/eval/suites/run.ts +24 -3
- package/src/domains/interop/registry.ts +6 -2
- package/src/domains/interop/types.ts +4 -0
- package/src/domains/lifecycle/migrations/index.ts +4 -0
- package/src/domains/memory/task-memory-policy.ts +70 -26
- package/src/domains/memory/task-memory-telemetry.ts +1 -0
- package/src/domains/middleware/index.ts +0 -1
- package/src/domains/middleware/marketplace-offer.ts +3 -35
- package/src/domains/middleware/memory-intervention.ts +127 -32
- package/src/domains/middleware/memory-step-endpoint.ts +3 -2
- package/src/domains/middleware/skills-reminder.ts +31 -2
- package/src/domains/observability/compaction-usage.ts +118 -0
- package/src/domains/observability/cost.ts +1 -1
- package/src/domains/observability/extension.ts +6 -1
- package/src/domains/observability/out-of-turn-usage.ts +52 -21
- package/src/domains/providers/contract.ts +4 -1
- package/src/domains/providers/extension.ts +40 -9
- package/src/domains/providers/model-capabilities.ts +9 -0
- package/src/domains/providers/model-discovery.ts +2 -0
- package/src/domains/providers/model-runtime-capabilities.ts +15 -5
- package/src/domains/providers/models/local-models/clio-coder-local-coding-targets.yaml +32 -12
- package/src/domains/providers/runtimes/antigravity/antigravity-code.ts +225 -45
- package/src/domains/providers/runtimes/common/lmstudio-http.ts +6 -2
- package/src/domains/providers/runtimes/common/local-synth.ts +2 -0
- package/src/domains/providers/runtimes/protocol/litellm.ts +119 -29
- package/src/domains/providers/support.ts +11 -5
- package/src/domains/providers/target-model-cache.ts +25 -2
- package/src/domains/providers/types/capability-flags.ts +2 -0
- package/src/domains/providers/types/runtime-descriptor.ts +20 -1
- package/src/domains/providers/types/target-descriptor.ts +19 -0
- package/src/domains/resources/index.ts +3 -0
- package/src/domains/resources/skills/install.ts +72 -7
- package/src/domains/resources/skills/loader.ts +7 -0
- package/src/domains/resources/skills/marketplace.ts +63 -11
- package/src/domains/safety/autonomy.ts +15 -0
- package/src/domains/safety/index.ts +1 -0
- package/src/domains/safety/path-policy.ts +1 -1
- package/src/domains/safety/policy-engine.ts +34 -11
- package/src/domains/safety/protected-artifacts.ts +191 -88
- package/src/domains/safety/run-effects.ts +2 -22
- package/src/domains/safety/skill-authority.ts +55 -0
- package/src/domains/session/compaction/compact.ts +72 -22
- package/src/domains/session/entries.ts +6 -0
- package/src/domains/session/usage.ts +3 -3
- package/src/engine/agent.ts +13 -3
- package/src/engine/ai.ts +26 -8
- package/src/engine/antigravity/subprocess-runtime.ts +386 -120
- package/src/engine/api-registry.ts +3 -0
- package/src/engine/apis/openai-completions.ts +117 -14
- package/src/engine/external-subprocess.ts +114 -6
- package/src/entry/background-model-metadata.ts +18 -0
- package/src/entry/compaction-prompt.ts +57 -0
- package/src/entry/orchestrator.ts +405 -216
- package/src/entry/task-memory-lifecycle.ts +35 -0
- package/src/interactive/chat-loop-messages.ts +13 -4
- package/src/interactive/chat-loop.ts +65 -2
- package/src/interactive/chat-renderer.ts +1 -0
- package/src/interactive/cost-overlay.ts +26 -2
- package/src/interactive/interactive-slash-runtime.ts +2 -1
- package/src/interactive/renderers/worker-entry.ts +32 -0
- package/src/interactive/slash-commands.ts +24 -6
- package/src/interactive/theme/labels.ts +19 -13
- package/src/interactive/turn-context.ts +9 -5
- package/src/interactive/turn-recovery.ts +8 -0
- package/src/interactive/turn-runtime.ts +27 -11
- package/src/interactive/turn-state.ts +7 -0
- package/src/interactive/worker-receipts.ts +1 -0
- package/src/interactive/worker-stream.ts +6 -1
- package/src/tools/context/index.ts +30 -9
- package/src/tools/dispatch-arguments.ts +1 -0
- package/src/tools/dispatch-event-text.ts +10 -0
- package/src/tools/dispatch-plan.ts +1 -0
- package/src/tools/dispatch-runner.ts +12 -0
- package/src/tools/registry.ts +11 -5
- package/src/tools/worker-evidence.ts +3 -1
- package/src/worker/spec-contract.ts +4 -0
- package/dist/chunk-2Z2IKEXI.js +0 -1554
- package/dist/reset-OAQP3W4O.js +0 -230
- package/dist/uninstall-N34PCTGJ.js +0 -331
- package/dist/upgrade-PXK3S2YM.js +0 -325
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
parseRoutingIntent,
|
|
7
7
|
routePriorForLatencyClass,
|
|
8
8
|
sameRouteIdentity
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EKCHAPYA.js";
|
|
10
10
|
import {
|
|
11
11
|
hashToolCall,
|
|
12
12
|
typedValidationSummary
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RSJ25QSL.js";
|
|
14
14
|
import {
|
|
15
15
|
describeCallAction
|
|
16
16
|
} from "./chunk-NEDJ26B5.js";
|
|
@@ -29,14 +29,27 @@ import {
|
|
|
29
29
|
resolveReadPath
|
|
30
30
|
} from "./chunk-OQE5J4C6.js";
|
|
31
31
|
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
PATH_BOUNDARY_MAX_ENTRIES,
|
|
33
|
+
PathBoundaryError,
|
|
34
|
+
asDirectoryPathBoundary,
|
|
35
|
+
normalizePathBoundaryEntry,
|
|
36
|
+
pathBoundaryCovers,
|
|
37
|
+
resolvePathBoundary
|
|
38
|
+
} from "./chunk-HHV2GANA.js";
|
|
39
|
+
import {
|
|
40
|
+
AGENT_AUTOMATION_AUTHORITIES,
|
|
41
|
+
COUNCIL_BALLOT_SHAPE,
|
|
42
|
+
COUNCIL_BALLOT_VERDICT_MAX_BYTES,
|
|
43
|
+
agentSpecFingerprint,
|
|
44
|
+
classify
|
|
45
|
+
} from "./chunk-B4OAX3SI.js";
|
|
46
|
+
import {
|
|
47
|
+
commandArgumentSegments,
|
|
48
|
+
detectValidationCommand,
|
|
49
|
+
extractCommandDeleteTargets,
|
|
50
|
+
extractCommandWriteTargets,
|
|
51
|
+
toolMutationPaths
|
|
52
|
+
} from "./chunk-I7ZPNEJM.js";
|
|
40
53
|
import {
|
|
41
54
|
DEFAULT_MAX_LINES,
|
|
42
55
|
DEFAULT_TOOL_RESULT_MAX_BYTES,
|
|
@@ -52,7 +65,7 @@ import {
|
|
|
52
65
|
toolResultDigestFor,
|
|
53
66
|
truncateHead,
|
|
54
67
|
truncateTail
|
|
55
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-JDAY6FIL.js";
|
|
56
69
|
import {
|
|
57
70
|
formatSize
|
|
58
71
|
} from "./chunk-OZNBF4L3.js";
|
|
@@ -60,56 +73,47 @@ import {
|
|
|
60
73
|
byteLength,
|
|
61
74
|
truncateUtf8
|
|
62
75
|
} from "./chunk-6XLNIQDB.js";
|
|
63
|
-
import {
|
|
64
|
-
BASH_HARD_CAP_BYTES,
|
|
65
|
-
combineBashOutput,
|
|
66
|
-
runBashCommand
|
|
67
|
-
} from "./chunk-NMJXSHBJ.js";
|
|
68
|
-
import {
|
|
69
|
-
PATH_BOUNDARY_MAX_ENTRIES,
|
|
70
|
-
PathBoundaryError,
|
|
71
|
-
asDirectoryPathBoundary,
|
|
72
|
-
normalizePathBoundaryEntry,
|
|
73
|
-
pathBoundaryCovers,
|
|
74
|
-
resolvePathBoundary
|
|
75
|
-
} from "./chunk-HHV2GANA.js";
|
|
76
|
-
import {
|
|
77
|
-
AGENT_AUTOMATION_AUTHORITIES,
|
|
78
|
-
COUNCIL_BALLOT_SHAPE,
|
|
79
|
-
COUNCIL_BALLOT_VERDICT_MAX_BYTES,
|
|
80
|
-
agentSpecFingerprint,
|
|
81
|
-
classify
|
|
82
|
-
} from "./chunk-PGF63K6I.js";
|
|
83
|
-
import {
|
|
84
|
-
detectValidationCommand,
|
|
85
|
-
extractCommandDeleteTargets,
|
|
86
|
-
extractCommandWriteTargets,
|
|
87
|
-
tokenizeShellLike,
|
|
88
|
-
toolMutationPaths
|
|
89
|
-
} from "./chunk-IKOZFYBN.js";
|
|
90
76
|
import {
|
|
91
77
|
typebox_exports
|
|
92
78
|
} from "./chunk-5B2AEOW5.js";
|
|
79
|
+
import {
|
|
80
|
+
DEFAULT_AUTONOMY_EXPOSURE,
|
|
81
|
+
DEFAULT_AUTONOMY_LEVEL,
|
|
82
|
+
autonomyAskRejection,
|
|
83
|
+
autonomyDenyRejection,
|
|
84
|
+
evaluateSkillToolSurface,
|
|
85
|
+
isAutonomyLevel,
|
|
86
|
+
mapAutonomy
|
|
87
|
+
} from "./chunk-JGRC33J2.js";
|
|
93
88
|
import {
|
|
94
89
|
ToolNames
|
|
95
90
|
} from "./chunk-K6BSR66V.js";
|
|
96
91
|
import {
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
BASH_HARD_CAP_BYTES,
|
|
93
|
+
combineBashOutput,
|
|
94
|
+
runBashCommand
|
|
95
|
+
} from "./chunk-NMJXSHBJ.js";
|
|
96
|
+
import {
|
|
97
|
+
boundedExternalDiagnostic
|
|
98
|
+
} from "./chunk-VW6DOEDG.js";
|
|
99
99
|
import {
|
|
100
100
|
THINKING_LEVELS
|
|
101
101
|
} from "./chunk-UXCU4E3T.js";
|
|
102
|
+
import {
|
|
103
|
+
buildSafeToolEnv,
|
|
104
|
+
resolveSafeCwd
|
|
105
|
+
} from "./chunk-JSC3U7TI.js";
|
|
102
106
|
import {
|
|
103
107
|
GUARDRAIL_DEFAULTS,
|
|
104
108
|
isWorkerToolCallCapExceededReason,
|
|
105
109
|
resolveGuardrail
|
|
106
110
|
} from "./chunk-S66XZJOF.js";
|
|
111
|
+
import {
|
|
112
|
+
StringEnum
|
|
113
|
+
} from "./chunk-YPC6ZR5L.js";
|
|
107
114
|
import {
|
|
108
115
|
clioStateDir
|
|
109
116
|
} from "./chunk-BYP5D4HI.js";
|
|
110
|
-
import {
|
|
111
|
-
StringEnum
|
|
112
|
-
} from "./chunk-VXMFAE2W.js";
|
|
113
117
|
import {
|
|
114
118
|
init_esm_shims
|
|
115
119
|
} from "./chunk-3R73A4XB.js";
|
|
@@ -1326,6 +1330,14 @@ function normalizeDispatchIntent(raw, checks) {
|
|
|
1326
1330
|
|
|
1327
1331
|
// src/domains/dispatch/budget-envelope.ts
|
|
1328
1332
|
init_esm_shims();
|
|
1333
|
+
var NATIVE_CLIO_CONTROLS = ["tool-calls", "read-reserve", "synthesis", "attempt-cap"];
|
|
1334
|
+
var EXTERNAL_CLIO_CONTROLS = [
|
|
1335
|
+
"single-launch",
|
|
1336
|
+
"wall-clock",
|
|
1337
|
+
"output-cap",
|
|
1338
|
+
"cancellation",
|
|
1339
|
+
"result-contract"
|
|
1340
|
+
];
|
|
1329
1341
|
var BudgetAdmissionError = class extends Error {
|
|
1330
1342
|
code;
|
|
1331
1343
|
constructor(code, message) {
|
|
@@ -1368,6 +1380,8 @@ function cloneDispatchBudgetRequest(value, prefix = "budget") {
|
|
|
1368
1380
|
return { ...phase, ...retryRevision === void 0 ? {} : { retryRevision } };
|
|
1369
1381
|
}
|
|
1370
1382
|
function freezeEnvelope(envelope) {
|
|
1383
|
+
Object.freeze(envelope.enforcement.clioControls);
|
|
1384
|
+
Object.freeze(envelope.enforcement);
|
|
1371
1385
|
Object.freeze(envelope.policy.default);
|
|
1372
1386
|
Object.freeze(envelope.policy.maximum);
|
|
1373
1387
|
Object.freeze(envelope.policy);
|
|
@@ -1506,6 +1520,15 @@ function resolveToolBudgetEnvelope(input) {
|
|
|
1506
1520
|
const authoredMaximum = input.policy.maximum ?? input.policy;
|
|
1507
1521
|
return freezeEnvelope({
|
|
1508
1522
|
version: 1,
|
|
1523
|
+
enforcement: input.enforcement === "external-one-shot" ? {
|
|
1524
|
+
classification: "external-one-shot",
|
|
1525
|
+
perTool: "unobserved-not-enforced",
|
|
1526
|
+
clioControls: [...EXTERNAL_CLIO_CONTROLS]
|
|
1527
|
+
} : {
|
|
1528
|
+
classification: "native-per-tool",
|
|
1529
|
+
perTool: "enforced",
|
|
1530
|
+
clioControls: [...NATIVE_CLIO_CONTROLS]
|
|
1531
|
+
},
|
|
1509
1532
|
policy: {
|
|
1510
1533
|
recipeId: input.recipeId,
|
|
1511
1534
|
default: {
|
|
@@ -1541,7 +1564,8 @@ function formatBudgetRequest(envelope) {
|
|
|
1541
1564
|
function formatEffectiveBudget(envelope) {
|
|
1542
1565
|
const budget = envelope.effective;
|
|
1543
1566
|
const revision = budget.revision ? `, result revision ${budget.revision.toolCalls}/${budget.revision.readReserve}` : "";
|
|
1544
|
-
|
|
1567
|
+
const enforcement = envelope.enforcement.classification === "external-one-shot" ? "external one-shot; per-tool unobserved/not enforced" : "native per-tool enforced";
|
|
1568
|
+
return `${budget.toolCalls}/${budget.readReserve}${revision}, lifetime cap ${budget.hardCap}, synthesis=${budget.synthesis ? "on" : "off"}; ${enforcement}`;
|
|
1545
1569
|
}
|
|
1546
1570
|
function formatBudgetReasons(envelope) {
|
|
1547
1571
|
return envelope.reasons.length === 0 ? "none" : envelope.reasons.map((reason) => reason.code).join(",");
|
|
@@ -1555,6 +1579,9 @@ var BUDGET_REASON_CODES = /* @__PURE__ */ new Set([
|
|
|
1555
1579
|
"revision-growth-authorized",
|
|
1556
1580
|
"revision-growth-denied"
|
|
1557
1581
|
]);
|
|
1582
|
+
function isExactStringArray(value, expected) {
|
|
1583
|
+
return value.length === expected.length && value.every((item, index) => item === expected[index]);
|
|
1584
|
+
}
|
|
1558
1585
|
function cloneRunToolBudgetEnvelope(value) {
|
|
1559
1586
|
try {
|
|
1560
1587
|
if (!isRecord3(value) || value.version !== 1 || !isRecord3(value.policy) || !isRecord3(value.effective)) {
|
|
@@ -1589,8 +1616,40 @@ function cloneRunToolBudgetEnvelope(value) {
|
|
|
1589
1616
|
}
|
|
1590
1617
|
reasons.push({ code: reason.code, detail: reason.detail });
|
|
1591
1618
|
}
|
|
1619
|
+
const enforcement = (() => {
|
|
1620
|
+
if (value.enforcement === void 0) {
|
|
1621
|
+
return {
|
|
1622
|
+
classification: "native-per-tool",
|
|
1623
|
+
perTool: "enforced",
|
|
1624
|
+
clioControls: [...NATIVE_CLIO_CONTROLS]
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
if (!isRecord3(value.enforcement) || !Array.isArray(value.enforcement.clioControls)) return null;
|
|
1628
|
+
if (Object.keys(value.enforcement).some(
|
|
1629
|
+
(key) => key !== "classification" && key !== "perTool" && key !== "clioControls"
|
|
1630
|
+
)) {
|
|
1631
|
+
return null;
|
|
1632
|
+
}
|
|
1633
|
+
if (value.enforcement.classification === "external-one-shot" && value.enforcement.perTool === "unobserved-not-enforced" && isExactStringArray(value.enforcement.clioControls, EXTERNAL_CLIO_CONTROLS)) {
|
|
1634
|
+
return {
|
|
1635
|
+
classification: "external-one-shot",
|
|
1636
|
+
perTool: "unobserved-not-enforced",
|
|
1637
|
+
clioControls: [...EXTERNAL_CLIO_CONTROLS]
|
|
1638
|
+
};
|
|
1639
|
+
}
|
|
1640
|
+
if (value.enforcement.classification === "native-per-tool" && value.enforcement.perTool === "enforced" && isExactStringArray(value.enforcement.clioControls, NATIVE_CLIO_CONTROLS)) {
|
|
1641
|
+
return {
|
|
1642
|
+
classification: "native-per-tool",
|
|
1643
|
+
perTool: "enforced",
|
|
1644
|
+
clioControls: [...NATIVE_CLIO_CONTROLS]
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
return null;
|
|
1648
|
+
})();
|
|
1649
|
+
if (enforcement === null) return void 0;
|
|
1592
1650
|
return freezeEnvelope({
|
|
1593
1651
|
version: 1,
|
|
1652
|
+
enforcement,
|
|
1594
1653
|
policy: {
|
|
1595
1654
|
recipeId,
|
|
1596
1655
|
default: { ...defaultPhase, synthesis: value.policy.default.synthesis },
|
|
@@ -1795,6 +1854,10 @@ var TASK_TYPE_RULES = [
|
|
|
1795
1854
|
["debug", /\b(debug|fix|bug|crash|failure|broken|regression)\b/i],
|
|
1796
1855
|
["refactor", /\b(refactor|clean ?up|restructure|rename|extract|simplify)\b/i],
|
|
1797
1856
|
["config", /\b(config|configuration|settings|setup|install|ci pipeline|workflow file)\b/i],
|
|
1857
|
+
[
|
|
1858
|
+
"world_knowledge",
|
|
1859
|
+
/\b(?:open[- ]world|ecosystem landscape|industry landscape|state of (?:the )?art|current alternatives|latest alternatives|advisory second opinion)\b/i
|
|
1860
|
+
],
|
|
1798
1861
|
["research", /\b(research|investigate|explore|survey|compare|find out)\b/i],
|
|
1799
1862
|
["code_read", /\b(read|explain|understand|summarize|describe|walk through|map|locate|trace)\b/i],
|
|
1800
1863
|
["code_write", /\b(write|implement|add|create|build|develop|introduce)\b/i]
|
|
@@ -1870,6 +1933,11 @@ function agentRouteCandidates(input) {
|
|
|
1870
1933
|
var TASK_SIGNALS = {
|
|
1871
1934
|
code_read: { ids: ["scout"], tags: ["reconnaissance", "symbols", "codewiki"], contracts: ["scout-report"] },
|
|
1872
1935
|
research: { ids: ["researcher"], tags: ["sources", "external-context", "papers"], contracts: ["research-report"] },
|
|
1936
|
+
world_knowledge: {
|
|
1937
|
+
ids: ["world-knowledge"],
|
|
1938
|
+
tags: ["open-world", "ecosystem", "current-context", "second-opinion"],
|
|
1939
|
+
contracts: ["world-knowledge-report"]
|
|
1940
|
+
},
|
|
1873
1941
|
code_review: { ids: ["verifier"], tags: ["review", "verification"], contracts: ["verifier-report"] },
|
|
1874
1942
|
debug: { ids: ["debugger"], tags: ["debugging", "root-cause"], contracts: ["debugger-report"] },
|
|
1875
1943
|
test: { ids: ["verifier", "tester"], tags: ["tests", "validation", "regression"], contracts: ["verifier-report"] },
|
|
@@ -2836,6 +2904,7 @@ var AUTO_BASELINE_BY_TASK_TYPE = {
|
|
|
2836
2904
|
// Read-only shapes.
|
|
2837
2905
|
code_review: "verifier",
|
|
2838
2906
|
research: "researcher",
|
|
2907
|
+
world_knowledge: "world-knowledge",
|
|
2839
2908
|
code_read: "scout",
|
|
2840
2909
|
unknown: "scout"
|
|
2841
2910
|
};
|
|
@@ -3163,10 +3232,10 @@ function taskViews(args) {
|
|
|
3163
3232
|
const sharedNode = str(args.node);
|
|
3164
3233
|
const sharedTarget = str(args.target);
|
|
3165
3234
|
return tasks.map((item) => {
|
|
3166
|
-
const
|
|
3235
|
+
const record3 = isRecord6(item) ? item : {};
|
|
3167
3236
|
const view = {
|
|
3168
|
-
agent: str(
|
|
3169
|
-
task: str(item) ?? str(
|
|
3237
|
+
agent: str(record3.agent) ?? sharedAgent,
|
|
3238
|
+
task: str(item) ?? str(record3.task) ?? "(invalid task)",
|
|
3170
3239
|
routeApproval: null,
|
|
3171
3240
|
agentSelection: null,
|
|
3172
3241
|
stepId: null,
|
|
@@ -3177,23 +3246,23 @@ function taskViews(args) {
|
|
|
3177
3246
|
agentDecision: null,
|
|
3178
3247
|
wave: null
|
|
3179
3248
|
};
|
|
3180
|
-
const briefing = "briefing" in
|
|
3249
|
+
const briefing = "briefing" in record3 ? str(record3.briefing) : str(args.briefing);
|
|
3181
3250
|
if (briefing !== void 0) view.briefing = briefing;
|
|
3182
|
-
const worktree = "worktree" in
|
|
3251
|
+
const worktree = "worktree" in record3 ? record3.worktree : args.worktree;
|
|
3183
3252
|
if (worktree === true) {
|
|
3184
3253
|
view.worktree = true;
|
|
3185
|
-
const apply = "apply" in
|
|
3254
|
+
const apply = "apply" in record3 ? record3.apply : args.apply;
|
|
3186
3255
|
view.apply = apply === "preserve" ? "preserve" : "merge";
|
|
3187
3256
|
}
|
|
3188
|
-
const model = str(
|
|
3257
|
+
const model = str(record3.model) ?? sharedModel;
|
|
3189
3258
|
if (model !== void 0) view.model = model;
|
|
3190
|
-
const node = str(
|
|
3259
|
+
const node = str(record3.node) ?? sharedNode;
|
|
3191
3260
|
if (node !== void 0) view.node = node;
|
|
3192
|
-
const target = str(
|
|
3261
|
+
const target = str(record3.target) ?? sharedTarget;
|
|
3193
3262
|
if (target !== void 0) view.target = target;
|
|
3194
|
-
const failover = failoverModeOf(
|
|
3263
|
+
const failover = failoverModeOf(record3.failover) ?? failoverModeOf(args.failover);
|
|
3195
3264
|
if (failover !== void 0) view.failover = failover;
|
|
3196
|
-
const rawCandidates = "allowedCandidates" in
|
|
3265
|
+
const rawCandidates = "allowedCandidates" in record3 ? record3.allowedCandidates : args.allowedCandidates;
|
|
3197
3266
|
const candidates = canonicalCandidates(rawCandidates);
|
|
3198
3267
|
if (failover === "approved" && candidates !== null) view.allowedCandidates = candidates;
|
|
3199
3268
|
return view;
|
|
@@ -3414,6 +3483,7 @@ var RESULT_CONTRACT_KINDS = /* @__PURE__ */ new Set([
|
|
|
3414
3483
|
"council-report",
|
|
3415
3484
|
"debugger-report",
|
|
3416
3485
|
"research-report",
|
|
3486
|
+
"world-knowledge-report",
|
|
3417
3487
|
"mutation-report",
|
|
3418
3488
|
"provenance-report",
|
|
3419
3489
|
"oracle-report",
|
|
@@ -4073,7 +4143,8 @@ ${guidance}`,
|
|
|
4073
4143
|
return { kind: "blocked", reason, decision: blocked };
|
|
4074
4144
|
}
|
|
4075
4145
|
function skillSurfaceBlockedVerdict(decision, tool, violation) {
|
|
4076
|
-
const
|
|
4146
|
+
const lifetime = violation.carriedSurface ? "The narrowing stays active for the rest of the session, across the operator's later turns, until a different skill replaces it or the operator clears it with /skill off." : "The narrowing ends when the skill policy's turn or worker run ends.";
|
|
4147
|
+
const reason = violation.disallowedBy.length > 0 ? `${tool} is disallowed by the active skill(s) ${violation.disallowedBy.join(", ")} (disallowed-tools). ${lifetime} Work within the skill workflow; if it genuinely needs this step, use ask_user when available or state the blocker in your reply.` : `${tool} is outside the tool surface declared by the active skill(s) ${violation.skills.join(", ")}. Tools are narrowed to: ${(violation.mergedAllowedTools ?? []).join(", ")} (plus context and ask_user). ${lifetime} Work within the skill workflow; if it genuinely needs this step, use ask_user when available or state the blocker in your reply.`;
|
|
4077
4148
|
const blocked = {
|
|
4078
4149
|
kind: "block",
|
|
4079
4150
|
classification: decision.classification,
|
|
@@ -4230,7 +4301,8 @@ var RUNTIME_API_FAMILIES = [
|
|
|
4230
4301
|
"rerank-http",
|
|
4231
4302
|
"embeddings-http",
|
|
4232
4303
|
"claude-agent-sdk",
|
|
4233
|
-
"claude-code-subprocess"
|
|
4304
|
+
"claude-code-subprocess",
|
|
4305
|
+
"external-agent-subprocess"
|
|
4234
4306
|
];
|
|
4235
4307
|
var RUNTIME_AUTHS = [
|
|
4236
4308
|
"api-key",
|
|
@@ -4303,15 +4375,15 @@ function readString(value, source, options) {
|
|
|
4303
4375
|
if (!options?.allowEmpty && value.length === 0) throw new Error(`${source} must be a non-empty string`);
|
|
4304
4376
|
return value;
|
|
4305
4377
|
}
|
|
4306
|
-
function readOptionalString(
|
|
4307
|
-
if (
|
|
4378
|
+
function readOptionalString(record3, key, source) {
|
|
4379
|
+
if (record3[key] !== void 0) readString(record3[key], `${source}.${key}`);
|
|
4308
4380
|
}
|
|
4309
|
-
function readOptionalBoolean(
|
|
4310
|
-
const value =
|
|
4381
|
+
function readOptionalBoolean(record3, key, source) {
|
|
4382
|
+
const value = record3[key];
|
|
4311
4383
|
if (value !== void 0 && typeof value !== "boolean") throw new Error(`${source}.${key} must be a boolean`);
|
|
4312
4384
|
}
|
|
4313
|
-
function readOptionalNumber(
|
|
4314
|
-
const value =
|
|
4385
|
+
function readOptionalNumber(record3, key, source) {
|
|
4386
|
+
const value = record3[key];
|
|
4315
4387
|
if (value !== void 0 && (typeof value !== "number" || !Number.isFinite(value))) {
|
|
4316
4388
|
throw new Error(`${source}.${key} must be a finite number`);
|
|
4317
4389
|
}
|
|
@@ -4322,15 +4394,15 @@ function readEnum(value, source, allowed) {
|
|
|
4322
4394
|
}
|
|
4323
4395
|
return value;
|
|
4324
4396
|
}
|
|
4325
|
-
function readOptionalEnum(
|
|
4326
|
-
if (
|
|
4397
|
+
function readOptionalEnum(record3, key, source, allowed) {
|
|
4398
|
+
if (record3[key] !== void 0) readEnum(record3[key], `${source}.${key}`, allowed);
|
|
4327
4399
|
}
|
|
4328
4400
|
function readStringArray(value, source) {
|
|
4329
4401
|
if (!Array.isArray(value)) throw new Error(`${source} must be an array`);
|
|
4330
4402
|
return value.map((item, index) => readString(item, `${source}[${index}]`));
|
|
4331
4403
|
}
|
|
4332
|
-
function readOptionalStringArray(
|
|
4333
|
-
if (
|
|
4404
|
+
function readOptionalStringArray(record3, key, source) {
|
|
4405
|
+
if (record3[key] !== void 0) readStringArray(record3[key], `${source}.${key}`);
|
|
4334
4406
|
}
|
|
4335
4407
|
function validateProtectedModels(value) {
|
|
4336
4408
|
if (value === void 0) return;
|
|
@@ -4397,6 +4469,9 @@ function validateCapabilityPatch(value, source) {
|
|
|
4397
4469
|
for (const key of ["contextWindow", "maxTokens"]) {
|
|
4398
4470
|
readOptionalNumber(caps, key, source);
|
|
4399
4471
|
}
|
|
4472
|
+
if (caps.thinkingControlRuntime !== void 0) {
|
|
4473
|
+
readEnum(caps.thinkingControlRuntime, `${source}.thinkingControlRuntime`, ["lmstudio", "llamacpp"]);
|
|
4474
|
+
}
|
|
4400
4475
|
for (const key of ["toolCallFormat", "thinkingFormat", "structuredOutputs"]) {
|
|
4401
4476
|
readOptionalString(caps, key, source);
|
|
4402
4477
|
}
|
|
@@ -4698,31 +4773,112 @@ import { spawn } from "node:child_process";
|
|
|
4698
4773
|
|
|
4699
4774
|
// src/engine/external-subprocess.ts
|
|
4700
4775
|
init_esm_shims();
|
|
4776
|
+
async function* readBoundedLines(readable, options) {
|
|
4777
|
+
let segments = [];
|
|
4778
|
+
let lineBytes = 0;
|
|
4779
|
+
let totalBytes = 0;
|
|
4780
|
+
let discarding = false;
|
|
4781
|
+
const finishLine = () => {
|
|
4782
|
+
if (discarding) {
|
|
4783
|
+
segments = [];
|
|
4784
|
+
lineBytes = 0;
|
|
4785
|
+
discarding = false;
|
|
4786
|
+
return { kind: "oversized" };
|
|
4787
|
+
}
|
|
4788
|
+
if (lineBytes === 0) return { kind: "line", line: "" };
|
|
4789
|
+
const joined = Buffer.concat(segments, lineBytes);
|
|
4790
|
+
segments = [];
|
|
4791
|
+
lineBytes = 0;
|
|
4792
|
+
const end = joined.at(-1) === 13 ? joined.length - 1 : joined.length;
|
|
4793
|
+
return { kind: "line", line: joined.subarray(0, end).toString("utf8") };
|
|
4794
|
+
};
|
|
4795
|
+
for await (const raw of readable) {
|
|
4796
|
+
const chunk = Buffer.isBuffer(raw) ? raw : Buffer.from(String(raw));
|
|
4797
|
+
totalBytes += chunk.byteLength;
|
|
4798
|
+
if (totalBytes > options.maxTotalBytes) throw new Error("external stdout exceeded the cumulative output limit");
|
|
4799
|
+
let offset = 0;
|
|
4800
|
+
while (offset < chunk.length) {
|
|
4801
|
+
const newline = chunk.indexOf(10, offset);
|
|
4802
|
+
const end = newline === -1 ? chunk.length : newline;
|
|
4803
|
+
const piece = chunk.subarray(offset, end);
|
|
4804
|
+
if (!discarding && piece.length > 0) {
|
|
4805
|
+
if (lineBytes + piece.length > options.maxLineBytes) {
|
|
4806
|
+
segments = [];
|
|
4807
|
+
lineBytes = 0;
|
|
4808
|
+
discarding = true;
|
|
4809
|
+
} else {
|
|
4810
|
+
segments.push(piece);
|
|
4811
|
+
lineBytes += piece.length;
|
|
4812
|
+
}
|
|
4813
|
+
}
|
|
4814
|
+
if (newline === -1) break;
|
|
4815
|
+
const line = finishLine();
|
|
4816
|
+
if (line) yield line;
|
|
4817
|
+
offset = newline + 1;
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
if (discarding || lineBytes > 0) {
|
|
4821
|
+
const line = finishLine();
|
|
4822
|
+
if (line) yield line;
|
|
4823
|
+
}
|
|
4824
|
+
}
|
|
4701
4825
|
async function readStderr(child) {
|
|
4702
|
-
let
|
|
4826
|
+
let tail = Buffer.alloc(0);
|
|
4703
4827
|
for await (const chunk of child.stderr) {
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4828
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk));
|
|
4829
|
+
tail = Buffer.concat([tail, bytes]);
|
|
4830
|
+
if (tail.byteLength > 8192) tail = tail.subarray(tail.byteLength - 8192);
|
|
4831
|
+
}
|
|
4832
|
+
return boundedExternalDiagnostic(tail.toString("utf8"));
|
|
4833
|
+
}
|
|
4834
|
+
function createProcessTreeTerminator(child, graceMs = 1500) {
|
|
4835
|
+
let sent = false;
|
|
4836
|
+
let timer = null;
|
|
4837
|
+
const signal = (name) => {
|
|
4838
|
+
if (child.exitCode !== null) return;
|
|
4839
|
+
if (child.pid && process.platform !== "win32") {
|
|
4840
|
+
try {
|
|
4841
|
+
process.kill(-child.pid, name);
|
|
4842
|
+
return;
|
|
4843
|
+
} catch {
|
|
4844
|
+
}
|
|
4845
|
+
}
|
|
4846
|
+
child.kill(name);
|
|
4847
|
+
};
|
|
4848
|
+
return {
|
|
4849
|
+
terminate() {
|
|
4850
|
+
if (sent) return;
|
|
4851
|
+
sent = true;
|
|
4852
|
+
signal("SIGTERM");
|
|
4853
|
+
timer = setTimeout(() => signal("SIGKILL"), graceMs);
|
|
4854
|
+
},
|
|
4855
|
+
cleanup() {
|
|
4856
|
+
if (timer) clearTimeout(timer);
|
|
4857
|
+
timer = null;
|
|
4858
|
+
}
|
|
4859
|
+
};
|
|
4708
4860
|
}
|
|
4709
4861
|
function waitForClose(child) {
|
|
4710
4862
|
return new Promise((resolve) => {
|
|
4711
|
-
|
|
4712
|
-
|
|
4863
|
+
let settled = false;
|
|
4864
|
+
const finish = (code) => {
|
|
4865
|
+
if (settled) return;
|
|
4866
|
+
settled = true;
|
|
4867
|
+
resolve(code);
|
|
4868
|
+
};
|
|
4869
|
+
child.once("error", () => finish(1));
|
|
4870
|
+
child.once("close", (code) => finish(code ?? 1));
|
|
4713
4871
|
});
|
|
4714
4872
|
}
|
|
4715
4873
|
|
|
4716
4874
|
// src/engine/antigravity/subprocess-runtime.ts
|
|
4717
4875
|
var ANTIGRAVITY_BINARY = "agy";
|
|
4718
|
-
var
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
4725
|
-
};
|
|
4876
|
+
var ANTIGRAVITY_MAX_STREAM_LINE_BYTES = 1024 * 1024;
|
|
4877
|
+
var ANTIGRAVITY_MAX_STREAM_BYTES = 8 * 1024 * 1024;
|
|
4878
|
+
var ANTIGRAVITY_MAX_RESPONSE_BYTES = 4 * 1024 * 1024;
|
|
4879
|
+
var ANTIGRAVITY_MAX_PROMPT_BYTES = 4 * 1024 * 1024;
|
|
4880
|
+
var MAX_PROTOCOL_DIAGNOSTICS = 32;
|
|
4881
|
+
var MAX_CONVERSATION_ID_BYTES = 4096;
|
|
4726
4882
|
function antigravitySubprocessConfigForAutonomy(level, env = process.env) {
|
|
4727
4883
|
if (level === "full-auto" && env.CLIO_CODER_ALLOW_EXTERNAL_FULL_ACCESS === "1") {
|
|
4728
4884
|
return {
|
|
@@ -4739,7 +4895,7 @@ function antigravitySubprocessConfigForAutonomy(level, env = process.env) {
|
|
|
4739
4895
|
if (level === "read-only") {
|
|
4740
4896
|
return { extraArgs: ["--mode", "plan", "--sandbox"], dangerousBypass: false, externalMode: "plan+sandbox" };
|
|
4741
4897
|
}
|
|
4742
|
-
return { extraArgs: [], dangerousBypass: false, externalMode: "
|
|
4898
|
+
return { extraArgs: ["--mode", "accept-edits"], dangerousBypass: false, externalMode: "accept-edits" };
|
|
4743
4899
|
}
|
|
4744
4900
|
function buildAntigravityPrompt(input) {
|
|
4745
4901
|
const parts = [];
|
|
@@ -4752,114 +4908,314 @@ function buildAntigravityPrompt(input) {
|
|
|
4752
4908
|
parts.push(input.task);
|
|
4753
4909
|
return parts.join("\n\n");
|
|
4754
4910
|
}
|
|
4755
|
-
function
|
|
4911
|
+
function buildAgyStdinLine(input) {
|
|
4912
|
+
const content = buildAntigravityPrompt(input);
|
|
4913
|
+
if (Buffer.byteLength(content, "utf8") > ANTIGRAVITY_MAX_PROMPT_BYTES) {
|
|
4914
|
+
throw new Error(`Antigravity work order exceeded ${ANTIGRAVITY_MAX_PROMPT_BYTES} bytes`);
|
|
4915
|
+
}
|
|
4916
|
+
return `${JSON.stringify({ event: "user", message: { content } })}
|
|
4917
|
+
`;
|
|
4918
|
+
}
|
|
4919
|
+
function buildAgyArgs(input, gateEnv = process.env) {
|
|
4756
4920
|
assertToolProfileEnforceable(input.toolProfile, "antigravity-code");
|
|
4757
|
-
const permission = antigravitySubprocessConfigForAutonomy(input.autonomy);
|
|
4758
|
-
const args = [
|
|
4921
|
+
const permission = antigravitySubprocessConfigForAutonomy(input.autonomy, gateEnv);
|
|
4922
|
+
const args = [
|
|
4923
|
+
...permission.extraArgs,
|
|
4924
|
+
"--input-format",
|
|
4925
|
+
"stream-json",
|
|
4926
|
+
"--output-format",
|
|
4927
|
+
"stream-json",
|
|
4928
|
+
"--disable-slash-commands"
|
|
4929
|
+
];
|
|
4759
4930
|
if (input.wireModelId.trim().length > 0) args.push("--model", input.wireModelId.trim());
|
|
4760
|
-
args.push(buildAntigravityPrompt(input));
|
|
4761
4931
|
return args;
|
|
4762
4932
|
}
|
|
4763
|
-
function
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4933
|
+
function record2(value) {
|
|
4934
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
4935
|
+
}
|
|
4936
|
+
function parseAntigravityStreamLine(line) {
|
|
4937
|
+
let decoded;
|
|
4938
|
+
try {
|
|
4939
|
+
decoded = JSON.parse(line);
|
|
4940
|
+
} catch {
|
|
4941
|
+
return null;
|
|
4942
|
+
}
|
|
4943
|
+
const envelope = record2(decoded);
|
|
4944
|
+
if (!envelope || typeof envelope.event !== "string") return null;
|
|
4945
|
+
if (envelope.event === "init") {
|
|
4946
|
+
return {
|
|
4947
|
+
event: "init",
|
|
4948
|
+
conversationId: typeof envelope.conversation_id === "string" ? envelope.conversation_id : null,
|
|
4949
|
+
model: typeof envelope.model === "string" ? envelope.model : null
|
|
4950
|
+
};
|
|
4951
|
+
}
|
|
4952
|
+
if (envelope.event === "step_update") {
|
|
4953
|
+
const update = record2(envelope.step_update);
|
|
4954
|
+
if (!update) return null;
|
|
4955
|
+
if (update.step_type !== "agent_response" || typeof update.text_delta !== "string") {
|
|
4956
|
+
return { event: "other" };
|
|
4957
|
+
}
|
|
4958
|
+
return {
|
|
4959
|
+
event: "text",
|
|
4960
|
+
conversationId: typeof update.conversation_id === "string" ? update.conversation_id : null,
|
|
4961
|
+
delta: update.text_delta
|
|
4962
|
+
};
|
|
4963
|
+
}
|
|
4964
|
+
if (envelope.event === "result") {
|
|
4965
|
+
const result = record2(envelope.result);
|
|
4966
|
+
return result ? { event: "result", result } : null;
|
|
4967
|
+
}
|
|
4968
|
+
return { event: "other" };
|
|
4969
|
+
}
|
|
4970
|
+
function finite(value) {
|
|
4971
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.min(value, Number.MAX_SAFE_INTEGER) : 0;
|
|
4972
|
+
}
|
|
4973
|
+
function normalizeUsage(raw) {
|
|
4974
|
+
const source = record2(raw) ?? {};
|
|
4975
|
+
const input = finite(source.input_tokens);
|
|
4976
|
+
const output = finite(source.output_tokens);
|
|
4977
|
+
const cacheRead = finite(source.cache_read_tokens);
|
|
4978
|
+
const reasoningTokens = finite(source.thinking_tokens);
|
|
4979
|
+
const usage = {
|
|
4980
|
+
input,
|
|
4981
|
+
output,
|
|
4982
|
+
cacheRead,
|
|
4983
|
+
cacheWrite: 0,
|
|
4984
|
+
totalTokens: finite(source.total_tokens) || input + output + reasoningTokens,
|
|
4985
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
4773
4986
|
};
|
|
4774
|
-
if (
|
|
4775
|
-
|
|
4776
|
-
|
|
4987
|
+
if (reasoningTokens > 0) usage.reasoningTokens = reasoningTokens;
|
|
4988
|
+
return usage;
|
|
4989
|
+
}
|
|
4990
|
+
function appendBoundedText(current, delta) {
|
|
4991
|
+
if (Buffer.byteLength(current, "utf8") + Buffer.byteLength(delta, "utf8") > ANTIGRAVITY_MAX_RESPONSE_BYTES) {
|
|
4992
|
+
throw new Error(`Antigravity response exceeded ${ANTIGRAVITY_MAX_RESPONSE_BYTES} bytes`);
|
|
4777
4993
|
}
|
|
4778
|
-
return
|
|
4994
|
+
return current + delta;
|
|
4995
|
+
}
|
|
4996
|
+
function boundedProviderField(value, field) {
|
|
4997
|
+
if (typeof value !== "string") return "";
|
|
4998
|
+
if (Buffer.byteLength(value, "utf8") > ANTIGRAVITY_MAX_RESPONSE_BYTES) {
|
|
4999
|
+
throw new Error(`Antigravity terminal ${field} exceeded ${ANTIGRAVITY_MAX_RESPONSE_BYTES} bytes`);
|
|
5000
|
+
}
|
|
5001
|
+
return value;
|
|
5002
|
+
}
|
|
5003
|
+
function boundedConversationId(value) {
|
|
5004
|
+
if (typeof value !== "string" || value.length === 0) return null;
|
|
5005
|
+
return Buffer.byteLength(value, "utf8") <= MAX_CONVERSATION_ID_BYTES ? value : null;
|
|
5006
|
+
}
|
|
5007
|
+
function protocolFailure(state, detail) {
|
|
5008
|
+
if (state.protocolDiagnostics.length < MAX_PROTOCOL_DIAGNOSTICS) state.protocolDiagnostics.push(detail);
|
|
4779
5009
|
}
|
|
4780
5010
|
function emitTextDelta(emit, state, delta) {
|
|
4781
5011
|
if (delta.length === 0) return;
|
|
4782
|
-
state.text
|
|
4783
|
-
const message = buildAssistantMessage({
|
|
4784
|
-
model: state.model,
|
|
4785
|
-
text: state.text,
|
|
4786
|
-
exitCode: 0,
|
|
4787
|
-
aborted: false,
|
|
4788
|
-
stderr: ""
|
|
4789
|
-
});
|
|
5012
|
+
state.text = appendBoundedText(state.text, delta);
|
|
4790
5013
|
if (!state.started) {
|
|
4791
5014
|
state.started = true;
|
|
4792
|
-
emit({
|
|
5015
|
+
emit({
|
|
5016
|
+
type: "message_start",
|
|
5017
|
+
message: buildAssistantMessage({
|
|
5018
|
+
model: state.model,
|
|
5019
|
+
text: "",
|
|
5020
|
+
result: null,
|
|
5021
|
+
conversationId: null,
|
|
5022
|
+
exitCode: 0,
|
|
5023
|
+
aborted: false,
|
|
5024
|
+
diagnostic: ""
|
|
5025
|
+
})
|
|
5026
|
+
});
|
|
4793
5027
|
}
|
|
4794
5028
|
emit({
|
|
4795
5029
|
type: "message_update",
|
|
4796
|
-
|
|
4797
|
-
assistantMessageEvent: {
|
|
4798
|
-
type: "text_delta",
|
|
4799
|
-
contentIndex: 0,
|
|
4800
|
-
delta,
|
|
4801
|
-
partial: message
|
|
4802
|
-
}
|
|
5030
|
+
assistantMessageEvent: { type: "text_delta", contentIndex: 0, delta }
|
|
4803
5031
|
});
|
|
4804
5032
|
}
|
|
4805
|
-
async function
|
|
4806
|
-
for await (const
|
|
4807
|
-
|
|
5033
|
+
async function readStream(child, emit, state) {
|
|
5034
|
+
for await (const bounded of readBoundedLines(child.stdout, {
|
|
5035
|
+
maxLineBytes: ANTIGRAVITY_MAX_STREAM_LINE_BYTES,
|
|
5036
|
+
maxTotalBytes: ANTIGRAVITY_MAX_STREAM_BYTES
|
|
5037
|
+
})) {
|
|
5038
|
+
if (bounded.kind === "oversized") {
|
|
5039
|
+
protocolFailure(state, "oversized structured output line");
|
|
5040
|
+
continue;
|
|
5041
|
+
}
|
|
5042
|
+
const line = bounded.line;
|
|
5043
|
+
if (!line.trim()) continue;
|
|
5044
|
+
const event = parseAntigravityStreamLine(line);
|
|
5045
|
+
if (!event) {
|
|
5046
|
+
protocolFailure(state, "unreadable structured output line");
|
|
5047
|
+
continue;
|
|
5048
|
+
}
|
|
5049
|
+
if (state.terminalSeen) {
|
|
5050
|
+
protocolFailure(state, "event after terminal result");
|
|
5051
|
+
continue;
|
|
5052
|
+
}
|
|
5053
|
+
switch (event.event) {
|
|
5054
|
+
case "init":
|
|
5055
|
+
if (state.initSeen) {
|
|
5056
|
+
protocolFailure(state, "duplicate init event");
|
|
5057
|
+
break;
|
|
5058
|
+
}
|
|
5059
|
+
state.initSeen = true;
|
|
5060
|
+
state.conversationId = boundedConversationId(event.conversationId);
|
|
5061
|
+
if (event.model?.trim()) state.model = event.model.trim();
|
|
5062
|
+
break;
|
|
5063
|
+
case "text":
|
|
5064
|
+
if (!state.initSeen) {
|
|
5065
|
+
protocolFailure(state, "text event before init");
|
|
5066
|
+
break;
|
|
5067
|
+
}
|
|
5068
|
+
state.conversationId = boundedConversationId(event.conversationId) ?? state.conversationId;
|
|
5069
|
+
emitTextDelta(emit, state, event.delta);
|
|
5070
|
+
break;
|
|
5071
|
+
case "result":
|
|
5072
|
+
if (!state.initSeen) {
|
|
5073
|
+
protocolFailure(state, "terminal result before init");
|
|
5074
|
+
break;
|
|
5075
|
+
}
|
|
5076
|
+
state.terminalSeen = true;
|
|
5077
|
+
state.result = event.result;
|
|
5078
|
+
state.conversationId = boundedConversationId(event.result.conversation_id) ?? state.conversationId;
|
|
5079
|
+
break;
|
|
5080
|
+
case "other":
|
|
5081
|
+
if (!state.initSeen) protocolFailure(state, "event before init");
|
|
5082
|
+
break;
|
|
5083
|
+
}
|
|
4808
5084
|
}
|
|
4809
5085
|
}
|
|
4810
|
-
function
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
5086
|
+
function resultDiagnostic(input) {
|
|
5087
|
+
if (input.aborted) return "Antigravity run was cancelled";
|
|
5088
|
+
if (input.spawnError) return input.spawnError;
|
|
5089
|
+
if (input.streamError) return input.streamError;
|
|
5090
|
+
if (input.protocolDiagnostics.length > 0) {
|
|
5091
|
+
return `Antigravity structured output violated the protocol: ${input.protocolDiagnostics.join("; ")}`;
|
|
5092
|
+
}
|
|
5093
|
+
if (input.result === null) {
|
|
5094
|
+
return "Antigravity CLI ended without a terminal stream result. Update `agy` and verify stream-json support.";
|
|
5095
|
+
}
|
|
5096
|
+
if (input.result.status !== "SUCCESS") {
|
|
5097
|
+
const providerError = boundedProviderField(input.result.error, "error").trim();
|
|
5098
|
+
return providerError || `Antigravity returned terminal status ${String(input.result.status ?? "missing")}`;
|
|
5099
|
+
}
|
|
5100
|
+
if (input.exitCode !== 0) return `Antigravity returned SUCCESS but exited with status ${input.exitCode}`;
|
|
5101
|
+
if (typeof input.result.response !== "string") return "Antigravity SUCCESS result omitted its required response";
|
|
5102
|
+
return "";
|
|
5103
|
+
}
|
|
5104
|
+
function buildAssistantMessage(input) {
|
|
5105
|
+
const succeeded = !input.aborted && input.exitCode === 0 && input.result?.status === "SUCCESS" && typeof input.result.response === "string" && input.diagnostic.length === 0;
|
|
5106
|
+
const message = {
|
|
5107
|
+
role: "assistant",
|
|
5108
|
+
content: [{ type: "text", text: input.text }],
|
|
5109
|
+
api: "external-agent-subprocess",
|
|
5110
|
+
provider: "antigravity",
|
|
5111
|
+
model: input.model,
|
|
5112
|
+
usage: normalizeUsage(input.result?.usage),
|
|
5113
|
+
stopReason: input.aborted ? "aborted" : succeeded ? "stop" : "error",
|
|
5114
|
+
timestamp: Date.now()
|
|
5115
|
+
};
|
|
5116
|
+
if (input.conversationId) message.responseId = input.conversationId;
|
|
5117
|
+
if (input.diagnostic) message.errorMessage = boundedExternalDiagnostic(input.diagnostic);
|
|
5118
|
+
return message;
|
|
5119
|
+
}
|
|
5120
|
+
function startAntigravityWorkerRun(input, emit, dependencies = {}) {
|
|
5121
|
+
const sourceEnv = dependencies.environment ?? process.env;
|
|
5122
|
+
const args = buildAgyArgs(input, sourceEnv);
|
|
5123
|
+
const stdinLine = buildAgyStdinLine(input);
|
|
5124
|
+
const workspaceRoot = dependencies.workspaceRoot ?? process.cwd();
|
|
5125
|
+
const cwd = resolveSafeCwd(input.cwd, workspaceRoot);
|
|
5126
|
+
const child = spawn(dependencies.binary ?? ANTIGRAVITY_BINARY, args, {
|
|
5127
|
+
cwd,
|
|
5128
|
+
env: buildSafeToolEnv({}, sourceEnv),
|
|
5129
|
+
detached: process.platform !== "win32",
|
|
5130
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
4816
5131
|
});
|
|
4817
|
-
const streamState = {
|
|
5132
|
+
const streamState = {
|
|
5133
|
+
started: false,
|
|
5134
|
+
text: "",
|
|
5135
|
+
model: input.wireModelId,
|
|
5136
|
+
result: null,
|
|
5137
|
+
conversationId: null,
|
|
5138
|
+
initSeen: false,
|
|
5139
|
+
terminalSeen: false,
|
|
5140
|
+
protocolDiagnostics: []
|
|
5141
|
+
};
|
|
4818
5142
|
let aborted = false;
|
|
4819
|
-
let
|
|
5143
|
+
let spawnError = "";
|
|
5144
|
+
let streamError = "";
|
|
5145
|
+
const terminator = createProcessTreeTerminator(child, dependencies.killGraceMs ?? 1500);
|
|
4820
5146
|
const abort = () => {
|
|
5147
|
+
if (child.exitCode !== null) return;
|
|
4821
5148
|
aborted = true;
|
|
4822
|
-
|
|
4823
|
-
child.kill("SIGTERM");
|
|
4824
|
-
killTimer = setTimeout(() => {
|
|
4825
|
-
if (!child.killed) child.kill("SIGKILL");
|
|
4826
|
-
}, 1500);
|
|
5149
|
+
terminator.terminate();
|
|
4827
5150
|
};
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
5151
|
+
const onAbort = () => abort();
|
|
5152
|
+
if (input.signal?.aborted) abort();
|
|
5153
|
+
else input.signal?.addEventListener("abort", onAbort, { once: true });
|
|
5154
|
+
child.once("error", (cause) => {
|
|
5155
|
+
spawnError = cause.code === "ENOENT" ? "Antigravity CLI (`agy`) is not installed or not on PATH." : boundedExternalDiagnostic(cause.message);
|
|
5156
|
+
});
|
|
5157
|
+
child.stdin.on("error", (cause) => {
|
|
5158
|
+
if (!aborted) spawnError ||= boundedExternalDiagnostic(`could not send work order to Antigravity: ${cause.message}`);
|
|
5159
|
+
});
|
|
5160
|
+
child.stdin.end(stdinLine);
|
|
4832
5161
|
const promise = (async () => {
|
|
4833
5162
|
emit({ type: "agent_start" });
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
5163
|
+
try {
|
|
5164
|
+
const stderrPromise = readStderr(child);
|
|
5165
|
+
const stdoutPromise = readStream(child, emit, streamState).catch((cause) => {
|
|
5166
|
+
streamError = boundedExternalDiagnostic(cause instanceof Error ? cause.message : String(cause));
|
|
5167
|
+
terminator.terminate();
|
|
5168
|
+
});
|
|
5169
|
+
const exitCode = await waitForClose(child);
|
|
5170
|
+
await stdoutPromise;
|
|
5171
|
+
const stderr = await stderrPromise.catch(
|
|
5172
|
+
(cause) => boundedExternalDiagnostic(cause instanceof Error ? cause.message : String(cause))
|
|
5173
|
+
);
|
|
5174
|
+
let terminalResponse = "";
|
|
5175
|
+
try {
|
|
5176
|
+
terminalResponse = boundedProviderField(streamState.result?.response, "response");
|
|
5177
|
+
} catch (cause) {
|
|
5178
|
+
streamError ||= boundedExternalDiagnostic(cause instanceof Error ? cause.message : String(cause));
|
|
5179
|
+
}
|
|
5180
|
+
let diagnostic = "";
|
|
5181
|
+
try {
|
|
5182
|
+
diagnostic = resultDiagnostic({
|
|
5183
|
+
result: streamState.result,
|
|
5184
|
+
exitCode,
|
|
5185
|
+
spawnError,
|
|
5186
|
+
stderr,
|
|
5187
|
+
protocolDiagnostics: streamState.protocolDiagnostics,
|
|
5188
|
+
streamError,
|
|
5189
|
+
aborted
|
|
5190
|
+
});
|
|
5191
|
+
} catch (cause) {
|
|
5192
|
+
diagnostic = boundedExternalDiagnostic(cause instanceof Error ? cause.message : String(cause));
|
|
5193
|
+
}
|
|
5194
|
+
const finalText = terminalResponse || streamState.text;
|
|
5195
|
+
const finalMessage = buildAssistantMessage({
|
|
5196
|
+
model: streamState.model,
|
|
5197
|
+
text: finalText,
|
|
5198
|
+
result: streamState.result,
|
|
5199
|
+
conversationId: streamState.conversationId,
|
|
5200
|
+
exitCode,
|
|
5201
|
+
aborted,
|
|
5202
|
+
diagnostic
|
|
5203
|
+
});
|
|
5204
|
+
if (!streamState.started) emit({ type: "message_start", message: finalMessage });
|
|
5205
|
+
emit({ type: "message_end", message: finalMessage });
|
|
5206
|
+
const messages = [finalMessage];
|
|
5207
|
+
emit({ type: "agent_end", messages });
|
|
5208
|
+
if (finalMessage.stopReason === "error" && diagnostic && !aborted) {
|
|
5209
|
+
process.stderr.write(`[worker:antigravity-code] ${boundedExternalDiagnostic(diagnostic)}
|
|
4855
5210
|
`);
|
|
5211
|
+
}
|
|
5212
|
+
return { messages, exitCode: finalMessage.stopReason === "stop" ? 0 : 1 };
|
|
5213
|
+
} finally {
|
|
5214
|
+
terminator.cleanup();
|
|
5215
|
+
input.signal?.removeEventListener("abort", onAbort);
|
|
4856
5216
|
}
|
|
4857
|
-
return { messages, exitCode: exitCode === 0 ? 0 : 1 };
|
|
4858
5217
|
})();
|
|
4859
|
-
return {
|
|
4860
|
-
promise,
|
|
4861
|
-
abort
|
|
4862
|
-
};
|
|
5218
|
+
return { promise, abort };
|
|
4863
5219
|
}
|
|
4864
5220
|
|
|
4865
5221
|
// src/engine/claude/subprocess-runtime.ts
|
|
@@ -4926,17 +5282,17 @@ function buildClaudeCodeArgs(input) {
|
|
|
4926
5282
|
args.push(buildClaudeCodePrompt(input));
|
|
4927
5283
|
return args;
|
|
4928
5284
|
}
|
|
4929
|
-
function
|
|
5285
|
+
function finite2(value) {
|
|
4930
5286
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
4931
5287
|
}
|
|
4932
|
-
function
|
|
4933
|
-
const
|
|
4934
|
-
const input =
|
|
4935
|
-
const output =
|
|
4936
|
-
const cacheRead =
|
|
4937
|
-
const cacheWrite =
|
|
5288
|
+
function normalizeUsage2(raw, totalCostUsd = 0) {
|
|
5289
|
+
const record3 = typeof raw === "object" && raw !== null ? raw : {};
|
|
5290
|
+
const input = finite2(record3.input_tokens) + finite2(record3.inputTokens) + finite2(record3.input) + finite2(record3.prompt_tokens) + finite2(record3.promptTokens);
|
|
5291
|
+
const output = finite2(record3.output_tokens) + finite2(record3.outputTokens) + finite2(record3.output) + finite2(record3.completion_tokens) + finite2(record3.completionTokens);
|
|
5292
|
+
const cacheRead = finite2(record3.cache_read_input_tokens) + finite2(record3.cacheReadInputTokens) + finite2(record3.cacheRead) + finite2(record3.cacheReadTokens);
|
|
5293
|
+
const cacheWrite = finite2(record3.cache_creation_input_tokens) + finite2(record3.cacheCreationInputTokens) + finite2(record3.cacheWrite) + finite2(record3.cacheWriteTokens);
|
|
4938
5294
|
const totalTokens = input + output + cacheRead + cacheWrite;
|
|
4939
|
-
const total =
|
|
5295
|
+
const total = finite2(totalCostUsd) + finite2(record3.costUSD) + finite2(record3.cost_usd);
|
|
4940
5296
|
return {
|
|
4941
5297
|
input,
|
|
4942
5298
|
output,
|
|
@@ -4946,8 +5302,8 @@ function normalizeUsage(raw, totalCostUsd = 0) {
|
|
|
4946
5302
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total }
|
|
4947
5303
|
};
|
|
4948
5304
|
}
|
|
4949
|
-
function nestedRecord(
|
|
4950
|
-
const value =
|
|
5305
|
+
function nestedRecord(record3, key) {
|
|
5306
|
+
const value = record3[key];
|
|
4951
5307
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
4952
5308
|
}
|
|
4953
5309
|
function extractContentText(content) {
|
|
@@ -4955,34 +5311,34 @@ function extractContentText(content) {
|
|
|
4955
5311
|
let out = "";
|
|
4956
5312
|
for (const block of content) {
|
|
4957
5313
|
if (typeof block !== "object" || block === null) continue;
|
|
4958
|
-
const
|
|
4959
|
-
if (
|
|
5314
|
+
const record3 = block;
|
|
5315
|
+
if (record3.type === "text" && typeof record3.text === "string") out += record3.text;
|
|
4960
5316
|
}
|
|
4961
5317
|
return out;
|
|
4962
5318
|
}
|
|
4963
|
-
function extractDelta(
|
|
4964
|
-
const delta = nestedRecord(
|
|
5319
|
+
function extractDelta(record3) {
|
|
5320
|
+
const delta = nestedRecord(record3, "delta");
|
|
4965
5321
|
if (delta && typeof delta.text === "string") return delta.text;
|
|
4966
5322
|
if (delta && typeof delta.thinking === "string") return "";
|
|
4967
|
-
const contentBlock = nestedRecord(
|
|
5323
|
+
const contentBlock = nestedRecord(record3, "content_block");
|
|
4968
5324
|
if (contentBlock && contentBlock.type === "text" && typeof contentBlock.text === "string") return contentBlock.text;
|
|
4969
|
-
if (typeof
|
|
5325
|
+
if (typeof record3.delta === "string") return record3.delta;
|
|
4970
5326
|
return "";
|
|
4971
5327
|
}
|
|
4972
|
-
function assistantTextFromEvent(
|
|
4973
|
-
const message = nestedRecord(
|
|
5328
|
+
function assistantTextFromEvent(record3) {
|
|
5329
|
+
const message = nestedRecord(record3, "message");
|
|
4974
5330
|
if (message) return extractContentText(message.content);
|
|
4975
|
-
return extractContentText(
|
|
5331
|
+
return extractContentText(record3.content);
|
|
4976
5332
|
}
|
|
4977
|
-
function resultText(
|
|
4978
|
-
if (!
|
|
4979
|
-
return typeof
|
|
5333
|
+
function resultText(record3) {
|
|
5334
|
+
if (!record3) return "";
|
|
5335
|
+
return typeof record3.result === "string" ? record3.result : "";
|
|
4980
5336
|
}
|
|
4981
|
-
function resultError(
|
|
4982
|
-
if (
|
|
4983
|
-
if (typeof
|
|
4984
|
-
if (Array.isArray(
|
|
4985
|
-
if (
|
|
5337
|
+
function resultError(record3, stderr) {
|
|
5338
|
+
if (record3) {
|
|
5339
|
+
if (typeof record3.error === "string") return record3.error;
|
|
5340
|
+
if (Array.isArray(record3.errors)) return record3.errors.map(String).join("; ");
|
|
5341
|
+
if (record3.subtype !== void 0 && record3.subtype !== "success") return String(record3.subtype);
|
|
4986
5342
|
}
|
|
4987
5343
|
return stderr.trim();
|
|
4988
5344
|
}
|
|
@@ -4994,7 +5350,7 @@ function buildAssistantMessage2(input) {
|
|
|
4994
5350
|
api: "claude-code-subprocess",
|
|
4995
5351
|
provider: "anthropic",
|
|
4996
5352
|
model: input.model,
|
|
4997
|
-
usage:
|
|
5353
|
+
usage: normalizeUsage2(input.result?.usage, finite2(input.result?.total_cost_usd)),
|
|
4998
5354
|
stopReason: input.aborted ? "aborted" : input.exitCode === 0 ? "stop" : "error",
|
|
4999
5355
|
timestamp: Date.now()
|
|
5000
5356
|
};
|
|
@@ -5041,18 +5397,18 @@ async function readJsonLines(child, emit, state) {
|
|
|
5041
5397
|
continue;
|
|
5042
5398
|
}
|
|
5043
5399
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) continue;
|
|
5044
|
-
const
|
|
5045
|
-
if (
|
|
5046
|
-
if (
|
|
5047
|
-
state.result =
|
|
5400
|
+
const record3 = parsed;
|
|
5401
|
+
if (record3.type === "system" && typeof record3.model === "string") state.model = record3.model;
|
|
5402
|
+
if (record3.type === "result") {
|
|
5403
|
+
state.result = record3;
|
|
5048
5404
|
continue;
|
|
5049
5405
|
}
|
|
5050
|
-
if (
|
|
5051
|
-
const text = assistantTextFromEvent(
|
|
5406
|
+
if (record3.type === "assistant") {
|
|
5407
|
+
const text = assistantTextFromEvent(record3);
|
|
5052
5408
|
if (text.length > 0 && text.length >= state.text.length) state.text = text;
|
|
5053
5409
|
continue;
|
|
5054
5410
|
}
|
|
5055
|
-
emitTextDelta2(emit, state, extractDelta(
|
|
5411
|
+
emitTextDelta2(emit, state, extractDelta(record3));
|
|
5056
5412
|
}
|
|
5057
5413
|
}
|
|
5058
5414
|
function startClaudeCodeWorkerRun(input, emit) {
|
|
@@ -5815,7 +6171,7 @@ function toolWritesOpaquely(toolName) {
|
|
|
5815
6171
|
var GIT_PATH_MUTATIONS = /* @__PURE__ */ new Set(["mv", "rm"]);
|
|
5816
6172
|
function gitPathOperands(command) {
|
|
5817
6173
|
const targets = [];
|
|
5818
|
-
for (const segment of
|
|
6174
|
+
for (const segment of commandArgumentSegments(command)) {
|
|
5819
6175
|
if (segment[0] !== "git") continue;
|
|
5820
6176
|
const subcommand = segment[1];
|
|
5821
6177
|
if (subcommand === void 0 || !GIT_PATH_MUTATIONS.has(subcommand)) continue;
|
|
@@ -5826,20 +6182,6 @@ function gitPathOperands(command) {
|
|
|
5826
6182
|
}
|
|
5827
6183
|
return targets;
|
|
5828
6184
|
}
|
|
5829
|
-
function splitCommandSegments(command) {
|
|
5830
|
-
const segments = [];
|
|
5831
|
-
let current = [];
|
|
5832
|
-
for (const token of tokenizeShellLike(command)) {
|
|
5833
|
-
if (token === ";" || token === "&&" || token === "||" || token === "|") {
|
|
5834
|
-
if (current.length > 0) segments.push(current);
|
|
5835
|
-
current = [];
|
|
5836
|
-
continue;
|
|
5837
|
-
}
|
|
5838
|
-
current.push(token);
|
|
5839
|
-
}
|
|
5840
|
-
if (current.length > 0) segments.push(current);
|
|
5841
|
-
return segments;
|
|
5842
|
-
}
|
|
5843
6185
|
function commandOf(args) {
|
|
5844
6186
|
const command = args?.command;
|
|
5845
6187
|
return typeof command === "string" && command.length > 0 ? command : null;
|
|
@@ -6042,9 +6384,9 @@ import { performance as performance2 } from "node:perf_hooks";
|
|
|
6042
6384
|
function isRecord7(value) {
|
|
6043
6385
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6044
6386
|
}
|
|
6045
|
-
function stringField(
|
|
6387
|
+
function stringField(record3, ...keys) {
|
|
6046
6388
|
for (const key of keys) {
|
|
6047
|
-
const value =
|
|
6389
|
+
const value = record3[key];
|
|
6048
6390
|
if (typeof value === "string" && value.trim().length > 0) return value.trim();
|
|
6049
6391
|
}
|
|
6050
6392
|
return void 0;
|
|
@@ -6417,4 +6759,4 @@ export {
|
|
|
6417
6759
|
isTerminalRunEnvelope,
|
|
6418
6760
|
runKindSupportsLiveSteering
|
|
6419
6761
|
};
|
|
6420
|
-
//# sourceMappingURL=chunk-
|
|
6762
|
+
//# sourceMappingURL=chunk-PAJQJ7BS.js.map
|