@skaile/workspaces 5.16.0 → 5.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-BELBSJEE.js → asset-feeds-WAKBHGEV.js} +21 -21
- package/dist/{asset-feeds-BELBSJEE.js.map → asset-feeds-WAKBHGEV.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +8 -8
- package/dist/asset-manager/index.js +18 -14
- package/dist/asset-manager/installer.js +10 -10
- package/dist/asset-manager/renderers.js +9 -9
- package/dist/asset-manager/src/index.d.ts +122 -5
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +13 -10
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/asset-manager/src/mcp-config.d.ts +61 -1
- package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
- package/dist/asset-manager/src/renderers.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +287 -104
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +12 -12
- package/dist/bridge/drivers/continue.js +11 -11
- package/dist/bridge/drivers/echo.js +4 -4
- package/dist/bridge/drivers/gemini.js +7 -7
- package/dist/bridge/drivers/goose.js +11 -11
- package/dist/bridge/drivers/omp.js +34 -8
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +11 -11
- package/dist/bridge/drivers/qwen.js +7 -7
- package/dist/bridge/index.js +16 -16
- package/dist/bridge/src/driver-model-check.d.ts +8 -8
- package/dist/bridge/src/driver-model-check.d.ts.map +1 -1
- package/dist/bridge/src/drivers/claude-sdk.d.ts +74 -20
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/claude-self-turns.d.ts +25 -6
- package/dist/bridge/src/drivers/claude-self-turns.d.ts.map +1 -1
- package/dist/bridge/src/drivers/omp-models-yml.d.ts +5 -0
- package/dist/bridge/src/drivers/omp-models-yml.d.ts.map +1 -1
- package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
- package/dist/bridge/src/drivers/sanitize-assistant-text.d.ts +10 -0
- package/dist/bridge/src/drivers/sanitize-assistant-text.d.ts.map +1 -1
- package/dist/bridge/src/drivers/scrub-transcript.d.ts +20 -0
- package/dist/bridge/src/drivers/scrub-transcript.d.ts.map +1 -1
- package/dist/bridge/src/index.d.ts +1 -1
- package/dist/bridge/src/index.d.ts.map +1 -1
- package/dist/{chunk-FWAJUWXQ.js → chunk-24AXETE3.js} +55 -17
- package/dist/chunk-24AXETE3.js.map +1 -0
- package/dist/{chunk-ZVZTCDUN.js → chunk-2NOLF7B2.js} +37 -9
- package/dist/chunk-2NOLF7B2.js.map +1 -0
- package/dist/{chunk-NSNM2ZXF.js → chunk-3KMREAR2.js} +45 -5
- package/dist/chunk-3KMREAR2.js.map +1 -0
- package/dist/{chunk-D54T2F54.js → chunk-5TBFN46Z.js} +4 -4
- package/dist/chunk-5TBFN46Z.js.map +1 -0
- package/dist/{chunk-6RTEUWXX.js → chunk-6HK6RUFM.js} +3 -3
- package/dist/{chunk-6RTEUWXX.js.map → chunk-6HK6RUFM.js.map} +1 -1
- package/dist/{chunk-PGZDSDOB.js → chunk-6Z5KTFJT.js} +3 -3
- package/dist/{chunk-PGZDSDOB.js.map → chunk-6Z5KTFJT.js.map} +1 -1
- package/dist/{chunk-PW3TYWOI.js → chunk-AJ7EGIFR.js} +3 -3
- package/dist/{chunk-PW3TYWOI.js.map → chunk-AJ7EGIFR.js.map} +1 -1
- package/dist/{chunk-46IRZJV4.js → chunk-CD7SVH6W.js} +4 -4
- package/dist/{chunk-46IRZJV4.js.map → chunk-CD7SVH6W.js.map} +1 -1
- package/dist/{chunk-WKEBNB5S.js → chunk-CKBCX3HQ.js} +4 -4
- package/dist/{chunk-WKEBNB5S.js.map → chunk-CKBCX3HQ.js.map} +1 -1
- package/dist/{chunk-H7R7R5BN.js → chunk-CKICWXMU.js} +18 -15
- package/dist/chunk-CKICWXMU.js.map +1 -0
- package/dist/{chunk-YK3XLEQJ.js → chunk-CKNIYIV2.js} +83 -77
- package/dist/chunk-CKNIYIV2.js.map +1 -0
- package/dist/{chunk-SPV2CXJ3.js → chunk-D6UBEYQH.js} +4 -4
- package/dist/{chunk-SPV2CXJ3.js.map → chunk-D6UBEYQH.js.map} +1 -1
- package/dist/{chunk-5CE6J4DB.js → chunk-DA2MCPFN.js} +53 -16
- package/dist/chunk-DA2MCPFN.js.map +1 -0
- package/dist/{chunk-A26MUUN7.js → chunk-DJD36HC5.js} +7 -7
- package/dist/{chunk-A26MUUN7.js.map → chunk-DJD36HC5.js.map} +1 -1
- package/dist/{chunk-Y25V2MW2.js → chunk-E5YNGE3I.js} +4 -4
- package/dist/{chunk-Y25V2MW2.js.map → chunk-E5YNGE3I.js.map} +1 -1
- package/dist/{chunk-OJHPG6HK.js → chunk-EELKR2WP.js} +45 -28
- package/dist/chunk-EELKR2WP.js.map +1 -0
- package/dist/{chunk-YIDZJHY6.js → chunk-EFLKSMCO.js} +3 -3
- package/dist/{chunk-YIDZJHY6.js.map → chunk-EFLKSMCO.js.map} +1 -1
- package/dist/{chunk-SMUIYYCH.js → chunk-EZVZDCHZ.js} +24 -15
- package/dist/chunk-EZVZDCHZ.js.map +1 -0
- package/dist/{chunk-SAGBVBY2.js → chunk-FHIMIXT3.js} +5 -5
- package/dist/{chunk-SAGBVBY2.js.map → chunk-FHIMIXT3.js.map} +1 -1
- package/dist/{chunk-D5REDKVU.js → chunk-FKU57Q5Q.js} +3 -3
- package/dist/{chunk-D5REDKVU.js.map → chunk-FKU57Q5Q.js.map} +1 -1
- package/dist/{chunk-J4RRH2NP.js → chunk-FV2MSBVA.js} +4 -4
- package/dist/{chunk-J4RRH2NP.js.map → chunk-FV2MSBVA.js.map} +1 -1
- package/dist/{chunk-YW2BNDSE.js → chunk-GOCWM7FN.js} +22 -4
- package/dist/chunk-GOCWM7FN.js.map +1 -0
- package/dist/{chunk-TXGVG7VH.js → chunk-GRKU3S5V.js} +3 -3
- package/dist/{chunk-TXGVG7VH.js.map → chunk-GRKU3S5V.js.map} +1 -1
- package/dist/{chunk-AP24HESN.js → chunk-H6UVIKQ2.js} +3 -3
- package/dist/{chunk-AP24HESN.js.map → chunk-H6UVIKQ2.js.map} +1 -1
- package/dist/{chunk-ES6ARJPQ.js → chunk-HPVMTX6M.js} +15 -10
- package/dist/chunk-HPVMTX6M.js.map +1 -0
- package/dist/{chunk-A7AZ3RL5.js → chunk-JJ7LDI3S.js} +7 -7
- package/dist/{chunk-A7AZ3RL5.js.map → chunk-JJ7LDI3S.js.map} +1 -1
- package/dist/{chunk-OHNNCXMB.js → chunk-JY7GVNYU.js} +32 -18
- package/dist/chunk-JY7GVNYU.js.map +1 -0
- package/dist/{chunk-HUKUYWBJ.js → chunk-JYWW32JI.js} +17 -6
- package/dist/chunk-JYWW32JI.js.map +1 -0
- package/dist/{chunk-VJ2DZLDM.js → chunk-K5LVU2MN.js} +13 -7
- package/dist/chunk-K5LVU2MN.js.map +1 -0
- package/dist/{chunk-5RDZ5JHH.js → chunk-KC6HGWXN.js} +4 -4
- package/dist/{chunk-5RDZ5JHH.js.map → chunk-KC6HGWXN.js.map} +1 -1
- package/dist/{chunk-X5O56UO4.js → chunk-L2AMXONH.js} +3 -3
- package/dist/chunk-L2AMXONH.js.map +1 -0
- package/dist/{chunk-RTNWU2UD.js → chunk-L5XUEC2W.js} +4 -4
- package/dist/{chunk-RTNWU2UD.js.map → chunk-L5XUEC2W.js.map} +1 -1
- package/dist/{chunk-TKI7YDWE.js → chunk-L6IFN6ER.js} +54 -9
- package/dist/chunk-L6IFN6ER.js.map +1 -0
- package/dist/{chunk-L6UMSKDF.js → chunk-LW7ZI6EQ.js} +8 -36
- package/dist/chunk-LW7ZI6EQ.js.map +1 -0
- package/dist/{chunk-XGR7IDTY.js → chunk-MQIRRN76.js} +3 -3
- package/dist/{chunk-XGR7IDTY.js.map → chunk-MQIRRN76.js.map} +1 -1
- package/dist/{chunk-ISSYT5AZ.js → chunk-N5P2WBUL.js} +3 -3
- package/dist/{chunk-ISSYT5AZ.js.map → chunk-N5P2WBUL.js.map} +1 -1
- package/dist/{chunk-E634MBP6.js → chunk-ODDATIII.js} +8 -8
- package/dist/{chunk-E634MBP6.js.map → chunk-ODDATIII.js.map} +1 -1
- package/dist/{chunk-WXWQNJCT.js → chunk-PUK7TQT4.js} +3 -3
- package/dist/{chunk-WXWQNJCT.js.map → chunk-PUK7TQT4.js.map} +1 -1
- package/dist/{chunk-72KZJE3G.js → chunk-PZ6NF5DE.js} +16 -23
- package/dist/chunk-PZ6NF5DE.js.map +1 -0
- package/dist/{chunk-5DCOG5B5.js → chunk-RD6N2D7I.js} +3 -3
- package/dist/{chunk-5DCOG5B5.js.map → chunk-RD6N2D7I.js.map} +1 -1
- package/dist/{chunk-TADJCATD.js → chunk-RO2BPKXK.js} +3 -3
- package/dist/{chunk-TADJCATD.js.map → chunk-RO2BPKXK.js.map} +1 -1
- package/dist/{chunk-6GSE63K2.js → chunk-SRNCN4X2.js} +13 -5
- package/dist/chunk-SRNCN4X2.js.map +1 -0
- package/dist/{chunk-PIC23DDE.js → chunk-T2TQAH2X.js} +42 -11
- package/dist/chunk-T2TQAH2X.js.map +1 -0
- package/dist/{chunk-DADAZLFW.js → chunk-TDQ2ERCM.js} +695 -96
- package/dist/chunk-TDQ2ERCM.js.map +1 -0
- package/dist/{chunk-SXWGLW23.js → chunk-U2FI547Z.js} +4 -4
- package/dist/{chunk-SXWGLW23.js.map → chunk-U2FI547Z.js.map} +1 -1
- package/dist/{chunk-CQFVKN6S.js → chunk-V4RV2NJF.js} +240 -84
- package/dist/chunk-V4RV2NJF.js.map +1 -0
- package/dist/{chunk-D3PU3C6F.js → chunk-VKPBUPH7.js} +41 -15
- package/dist/chunk-VKPBUPH7.js.map +1 -0
- package/dist/{chunk-FT4ZHLYR.js → chunk-WDXZA7QW.js} +33 -3
- package/dist/chunk-WDXZA7QW.js.map +1 -0
- package/dist/{chunk-FSSRBWYL.js → chunk-WJCQFNF6.js} +4 -4
- package/dist/chunk-WJCQFNF6.js.map +1 -0
- package/dist/{chunk-2SKPPIV7.js → chunk-WJLYL6RY.js} +5 -5
- package/dist/{chunk-2SKPPIV7.js.map → chunk-WJLYL6RY.js.map} +1 -1
- package/dist/{chunk-6Q7NKTDG.js → chunk-X54YR4AW.js} +2 -2
- package/dist/{chunk-6Q7NKTDG.js.map → chunk-X54YR4AW.js.map} +1 -1
- package/dist/{chunk-D5WTOVLG.js → chunk-Y56YIT6J.js} +2 -2
- package/dist/chunk-Y56YIT6J.js.map +1 -0
- package/dist/{chunk-ZIW34FGO.js → chunk-YIF2IJUA.js} +3 -3
- package/dist/{chunk-ZIW34FGO.js.map → chunk-YIF2IJUA.js.map} +1 -1
- package/dist/{chunk-HG52NGAV.js → chunk-YU6AURJY.js} +3 -3
- package/dist/{chunk-HG52NGAV.js.map → chunk-YU6AURJY.js.map} +1 -1
- package/dist/{chunk-FSLVMZXR.js → chunk-YZ3N7IUU.js} +72 -31
- package/dist/chunk-YZ3N7IUU.js.map +1 -0
- package/dist/{chunk-DQOAPR4M.js → chunk-ZNN7ONJX.js} +8 -4
- package/dist/chunk-ZNN7ONJX.js.map +1 -0
- package/dist/cli/index.js +349 -150
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/config.d.ts.map +1 -1
- package/dist/cli/src/commands/integration.d.ts.map +1 -1
- package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin/claude-code.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin/codex.d.ts +6 -0
- package/dist/cli/src/commands/plugin/codex.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/run.d.ts.map +1 -1
- package/dist/cli/src/commands/serve.d.ts +5 -0
- package/dist/cli/src/commands/serve.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/validate.d.ts.map +1 -1
- package/dist/cli/src/commands/verify.d.ts.map +1 -1
- package/dist/cli/src/driver-error.d.ts +3 -1
- package/dist/cli/src/driver-error.d.ts.map +1 -1
- package/dist/cli/src/helpers.d.ts +6 -4
- package/dist/cli/src/helpers.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/index.d.ts +6 -0
- package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
- package/dist/cli/src/skill-checks.d.ts +4 -3
- package/dist/cli/src/skill-checks.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +22 -22
- package/dist/connectors/src/connector-manager.d.ts.map +1 -1
- package/dist/connectors/src/connector-types.d.ts +5 -0
- package/dist/connectors/src/connector-types.d.ts.map +1 -1
- package/dist/connectors/src/watcher.d.ts.map +1 -1
- package/dist/{connectors-44RE2QEM.js → connectors-QL4GBMH3.js} +25 -25
- package/dist/{connectors-44RE2QEM.js.map → connectors-QL4GBMH3.js.map} +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/core/index.js +7 -7
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.js +1 -1
- package/dist/core/publish-manifest.js +3 -3
- package/dist/core/ref.js +1 -1
- package/dist/core/runtime-assets.js +5 -5
- package/dist/core/src/bind.d.ts +30 -0
- package/dist/core/src/bind.d.ts.map +1 -0
- package/dist/core/src/index.d.ts +4 -3
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +11 -2
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/models.d.ts +19 -0
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/publish-manifest.d.ts +15 -13
- package/dist/core/src/publish-manifest.d.ts.map +1 -1
- package/dist/core/src/store.d.ts +2 -1
- package/dist/core/src/store.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +26 -1
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/store.js +1 -1
- package/dist/core/workspace-config.js +4 -4
- package/dist/deploy/index.js +7 -7
- package/dist/discovery/index.js +5 -5
- package/dist/discovery/src/parse-manifest.d.ts +1 -1
- package/dist/discovery/src/source-config.d.ts +2 -1
- package/dist/discovery/src/source-config.d.ts.map +1 -1
- package/dist/{ensure-sources-R6AHZ7RV.js → ensure-sources-CEFODJCE.js} +21 -17
- package/dist/ensure-sources-CEFODJCE.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +22 -22
- package/dist/factory-assets/connectors/deploy.js +22 -22
- package/dist/factory-assets/connectors/devserver.js +22 -22
- package/dist/factory-assets/connectors/flow/adapter.js +22 -22
- package/dist/factory-assets/connectors/flow/engine.js +9 -9
- package/dist/factory-assets/connectors/flow/run-flow.js +24 -24
- package/dist/factory-assets/connectors/flow.js +22 -22
- package/dist/factory-assets/connectors/git.js +22 -22
- package/dist/factory-assets/connectors/gmail.js +22 -22
- package/dist/factory-assets/connectors/googledrive.js +22 -22
- package/dist/factory-assets/connectors/local.js +22 -22
- package/dist/factory-assets/connectors/mattermost.js +22 -22
- package/dist/factory-assets/connectors/memory.js +22 -22
- package/dist/factory-assets/connectors/minio.js +22 -22
- package/dist/factory-assets/connectors/postgres.js +22 -22
- package/dist/factory-assets/connectors/s3.js +22 -22
- package/dist/factory-assets/connectors/sharepoint.js +22 -22
- package/dist/factory-assets/connectors/sqlite.js +22 -22
- package/dist/factory-assets/connectors/static-server.js +22 -22
- package/dist/factory-assets/connectors/tunnel.js +22 -22
- package/dist/factory-assets/connectors/webdav.js +22 -22
- package/dist/factory-assets/connectors/xstate-store/adapter.d.ts +1 -1
- package/dist/factory-assets/connectors/xstate-store/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/xstate-store.js +22 -22
- package/dist/factory-assets/connectors/xstate.js +22 -22
- package/dist/{flows-YKC53LDP.js → flows-BHY73K3O.js} +12 -12
- package/dist/{flows-YKC53LDP.js.map → flows-BHY73K3O.js.map} +1 -1
- package/dist/{helpers-FNQL5PI7.js → helpers-R22QNPFN.js} +21 -17
- package/dist/{helpers-FNQL5PI7.js.map → helpers-R22QNPFN.js.map} +1 -1
- package/dist/library/index.js +11 -11
- package/dist/library/install.js +4 -4
- package/dist/library/src/index.d.ts +1 -1
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/manifest-writer.d.ts +17 -1
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/{library-publish-GHPVY42Y.js → library-publish-VBE3X2TH.js} +63 -66
- package/dist/library-publish-VBE3X2TH.js.map +1 -0
- package/dist/model-endpoint/index.js +10 -10
- package/dist/model-endpoint/src/server.d.ts.map +1 -1
- package/dist/open-library-JP5TC5UX.js +42 -0
- package/dist/{open-library-YSUGNP36.js.map → open-library-JP5TC5UX.js.map} +1 -1
- package/dist/open-registry-RBELV5YH.js +32 -0
- package/dist/{open-registry-YPRQDUMK.js.map → open-registry-RBELV5YH.js.map} +1 -1
- package/dist/paths-BFM6K2QO.js +22 -0
- package/dist/{paths-P55DTBEK.js.map → paths-BFM6K2QO.js.map} +1 -1
- package/dist/plugin-store-QOQDM24E.js +23 -0
- package/dist/{plugin-store-IPIBZRBX.js.map → plugin-store-QOQDM24E.js.map} +1 -1
- package/dist/{project-NDSLXERO.js → project-6ETXGQWD.js} +48 -48
- package/dist/{project-NDSLXERO.js.map → project-6ETXGQWD.js.map} +1 -1
- package/dist/resolver/index.js +8 -8
- package/dist/runner/index.js +40 -40
- package/dist/runner/src/agent.d.ts.map +1 -1
- package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
- package/dist/runner/src/coalesced-restart.d.ts +41 -0
- package/dist/runner/src/coalesced-restart.d.ts.map +1 -0
- package/dist/runner/src/compaction/prompt.d.ts.map +1 -1
- package/dist/runner/src/mcp-runtime-handlers.d.ts +27 -0
- package/dist/runner/src/mcp-runtime-handlers.d.ts.map +1 -1
- package/dist/runner/src/runner-capabilities.d.ts +7 -0
- package/dist/runner/src/runner-capabilities.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-capability-wiring.d.ts +2 -0
- package/dist/runner/src/session-capability-wiring.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +18 -14
- package/dist/sdk/bridge.js +16 -16
- package/dist/sdk/core.js +7 -7
- package/dist/sdk/flow.js +9 -9
- package/dist/sdk/index.js +40 -40
- package/dist/sdk/resolver.js +8 -8
- package/dist/sdk/runner.js +40 -40
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/transport/ws/server.js +19 -1
- package/dist/sdk/transport/ws.js +19 -1
- package/dist/sdk/transport.js +19 -1
- package/dist/sdk/types.js +1 -1
- package/dist/{serve-preflight-ON2LS3SD.js → serve-preflight-BTGTZUDN.js} +9 -9
- package/dist/{serve-preflight-ON2LS3SD.js.map → serve-preflight-BTGTZUDN.js.map} +1 -1
- package/dist/session/index.js +2 -2
- package/dist/{setup-MFPEQS2I.js → setup-JQDTYPSD.js} +30 -26
- package/dist/setup-JQDTYPSD.js.map +1 -0
- package/dist/{skills-7G6QCDEM.js → skills-RSZVUIYZ.js} +13 -13
- package/dist/{skills-7G6QCDEM.js.map → skills-RSZVUIYZ.js.map} +1 -1
- package/dist/{source-4QVRD5NV.js → source-FPLHY3DP.js} +50 -50
- package/dist/{source-4QVRD5NV.js.map → source-FPLHY3DP.js.map} +1 -1
- package/dist/{source-manifest-publish-ZIO24GUM.js → source-manifest-publish-LY4H63VA.js} +52 -52
- package/dist/{source-manifest-publish-ZIO24GUM.js.map → source-manifest-publish-LY4H63VA.js.map} +1 -1
- package/dist/transport/index.js +19 -1
- package/dist/transport/src/ws/server.d.ts +2 -16
- package/dist/transport/src/ws/server.d.ts.map +1 -1
- package/dist/transport/ws/server.js +19 -1
- package/dist/transport/ws.js +19 -1
- package/dist/tui/index.js +57 -45
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/src/repl.d.ts +4 -1
- package/dist/tui/src/repl.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/events.d.ts +7 -4
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/manifests/index.d.ts +1 -1
- package/dist/types/src/manifests/index.d.ts.map +1 -1
- package/dist/types/src/manifests/scaffold-body.d.ts +8 -0
- package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -1
- package/dist/types/src/manifests/skill.d.ts +0 -2
- package/dist/types/src/manifests/skill.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +29 -29
- package/dist/workspace-plugin/adapters/omp.js +32 -18
- package/dist/workspace-plugin/adapters/omp.js.map +1 -1
- package/dist/workspace-plugin/index.js +1 -1
- package/dist/workspace-plugin/src/adapters/claude-code.d.ts +1 -1
- package/dist/workspace-plugin/src/adapters/omp.d.ts +8 -5
- package/dist/workspace-plugin/src/adapters/omp.d.ts.map +1 -1
- package/dist/workspace-plugin/src/plugin.d.ts +7 -1
- package/dist/workspace-plugin/src/plugin.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5CE6J4DB.js.map +0 -1
- package/dist/chunk-6GSE63K2.js.map +0 -1
- package/dist/chunk-72KZJE3G.js.map +0 -1
- package/dist/chunk-CQFVKN6S.js.map +0 -1
- package/dist/chunk-D3PU3C6F.js.map +0 -1
- package/dist/chunk-D54T2F54.js.map +0 -1
- package/dist/chunk-D5WTOVLG.js.map +0 -1
- package/dist/chunk-DADAZLFW.js.map +0 -1
- package/dist/chunk-DQOAPR4M.js.map +0 -1
- package/dist/chunk-ES6ARJPQ.js.map +0 -1
- package/dist/chunk-FSLVMZXR.js.map +0 -1
- package/dist/chunk-FSSRBWYL.js.map +0 -1
- package/dist/chunk-FT4ZHLYR.js.map +0 -1
- package/dist/chunk-FWAJUWXQ.js.map +0 -1
- package/dist/chunk-H7R7R5BN.js.map +0 -1
- package/dist/chunk-HUKUYWBJ.js.map +0 -1
- package/dist/chunk-L6UMSKDF.js.map +0 -1
- package/dist/chunk-NSNM2ZXF.js.map +0 -1
- package/dist/chunk-OHNNCXMB.js.map +0 -1
- package/dist/chunk-OJHPG6HK.js.map +0 -1
- package/dist/chunk-PIC23DDE.js.map +0 -1
- package/dist/chunk-SMUIYYCH.js.map +0 -1
- package/dist/chunk-TKI7YDWE.js.map +0 -1
- package/dist/chunk-VJ2DZLDM.js.map +0 -1
- package/dist/chunk-X5O56UO4.js.map +0 -1
- package/dist/chunk-YK3XLEQJ.js.map +0 -1
- package/dist/chunk-YW2BNDSE.js.map +0 -1
- package/dist/chunk-ZVZTCDUN.js.map +0 -1
- package/dist/ensure-sources-R6AHZ7RV.js.map +0 -1
- package/dist/library-publish-GHPVY42Y.js.map +0 -1
- package/dist/open-library-YSUGNP36.js +0 -40
- package/dist/open-registry-YPRQDUMK.js +0 -32
- package/dist/paths-P55DTBEK.js +0 -22
- package/dist/plugin-store-IPIBZRBX.js +0 -23
- package/dist/setup-MFPEQS2I.js.map +0 -1
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { formatDroppedToolsNotice, filterInProcessMcpServerTools, checkToolPropertyKeys } from '../../chunk-
|
|
1
|
+
import { formatDroppedToolsNotice, filterInProcessMcpServerTools, checkToolPropertyKeys, TOOL_PROPERTY_KEY_PATTERN } from '../../chunk-L2AMXONH.js';
|
|
2
2
|
import { freshBudget, isFirstAttempt, spend, isSpent, decide, isAvailable } from '../../chunk-IZCR27MU.js';
|
|
3
3
|
import { AskSlots } from '../../chunk-EPBKISS5.js';
|
|
4
|
-
import { scrubPoisonedTranscript, transcriptStoreForRuntime, resolveClaudeConfigDir, claudeEndpointMode, buildClaudeEndpointEnv, APPROVE_ONCE, DENY } from '../../chunk-
|
|
5
|
-
import { dispatchCapability } from '../../chunk-
|
|
6
|
-
import { fetchProviderModels } from '../../chunk-
|
|
4
|
+
import { scrubPoisonedTranscript, transcriptStoreForRuntime, resolveClaudeConfigDir, claudeEndpointMode, buildClaudeEndpointEnv, APPROVE_ONCE, DENY } from '../../chunk-3KMREAR2.js';
|
|
5
|
+
import { dispatchCapability } from '../../chunk-AJ7EGIFR.js';
|
|
6
|
+
import { fetchProviderModels } from '../../chunk-L5XUEC2W.js';
|
|
7
7
|
import { ReconfigureLedger, AuthError, stripRunnerPrivateEnv, classifyClaudeSdkError, reclassifyAuthAsAccountUnavailable, AccountUnavailableError, isLongContextEntitlementRejection, LONG_CONTEXT_CREDITS_API_ERROR } from '../../chunk-B4X2N7JQ.js';
|
|
8
8
|
import { agentExecRequested, wrapAgentCommand, resolveAgentExec } from '../../chunk-YROR332M.js';
|
|
9
|
-
import { AgentDriver, getBridgeLogger, registryDriverConfig } from '../../chunk-
|
|
10
|
-
import { BUILTIN_DRIVER_CATALOG, entryCredentialValue } from '../../chunk-
|
|
9
|
+
import { AgentDriver, getBridgeLogger, registryDriverConfig } from '../../chunk-YU6AURJY.js';
|
|
10
|
+
import { BUILTIN_DRIVER_CATALOG, entryCredentialValue } from '../../chunk-X54YR4AW.js';
|
|
11
11
|
import '../../chunk-6E6PKKAD.js';
|
|
12
|
-
import { withActivityLabelShape } from '../../chunk-
|
|
13
|
-
import '../../chunk-
|
|
14
|
-
import { loadDriverSdk } from '../../chunk-
|
|
12
|
+
import { withActivityLabelShape } from '../../chunk-Y56YIT6J.js';
|
|
13
|
+
import '../../chunk-CKNIYIV2.js';
|
|
14
|
+
import { loadDriverSdk } from '../../chunk-T2TQAH2X.js';
|
|
15
15
|
import '../../chunk-4GY63JU6.js';
|
|
16
|
-
import '../../chunk-
|
|
17
|
-
import '../../chunk-
|
|
16
|
+
import '../../chunk-KC6HGWXN.js';
|
|
17
|
+
import '../../chunk-5TBFN46Z.js';
|
|
18
18
|
import '../../chunk-5BEFNLOR.js';
|
|
19
19
|
import '../../chunk-A2ULN3KX.js';
|
|
20
|
-
import '../../chunk-
|
|
20
|
+
import '../../chunk-2NOLF7B2.js';
|
|
21
21
|
import '../../chunk-L5VSIPQD.js';
|
|
22
22
|
import '../../chunk-IG5LZ3WU.js';
|
|
23
|
-
import '../../chunk-
|
|
23
|
+
import '../../chunk-CKICWXMU.js';
|
|
24
24
|
import '../../chunk-RVRB27AN.js';
|
|
25
|
-
import '../../chunk-
|
|
26
|
-
import '../../chunk-
|
|
25
|
+
import '../../chunk-GOCWM7FN.js';
|
|
26
|
+
import '../../chunk-WDXZA7QW.js';
|
|
27
27
|
import '../../chunk-ICSCSM5D.js';
|
|
28
28
|
import '../../chunk-DKXNKFKP.js';
|
|
29
29
|
import { mergeRegistries, parseModelRef, isEntryEnabled, resolveEntryBaseUrl } from '../../chunk-MJHSLODD.js';
|
|
@@ -174,12 +174,18 @@ var SelfTurnTracker = class {
|
|
|
174
174
|
}
|
|
175
175
|
emit;
|
|
176
176
|
active = false;
|
|
177
|
-
/**
|
|
177
|
+
/** The self-started turn took a prompt pushed while it ran: its result answers that prompt too. */
|
|
178
178
|
joined = false;
|
|
179
|
-
/**
|
|
179
|
+
/** A prompt pushed during the self-started turn that the CLI has not taken yet. */
|
|
180
|
+
queuedPrompt = null;
|
|
181
|
+
/** This CLI stamps consumed prompts' uuids on assistant messages, so taking one is observable. */
|
|
182
|
+
stampsPrompts = false;
|
|
183
|
+
/** Tasks reported settled since the last turn ended, oldest first; only ones reported started. */
|
|
180
184
|
settled = /* @__PURE__ */ new Set();
|
|
181
185
|
/** Tasks registered in the foreground: reported only if they move to the background. */
|
|
182
186
|
foreground = /* @__PURE__ */ new Set();
|
|
187
|
+
/** Tasks announced with `background_task_started`, the only ids a host can tie to a turn. */
|
|
188
|
+
reported = /* @__PURE__ */ new Set();
|
|
183
189
|
/** Whether the turn running now is one the driver did not prompt. */
|
|
184
190
|
get selfTurnActive() {
|
|
185
191
|
return this.active;
|
|
@@ -197,6 +203,7 @@ var SelfTurnTracker = class {
|
|
|
197
203
|
}
|
|
198
204
|
if (msg.type !== "assistant" && msg.type !== "stream_event" && msg.type !== "user") return;
|
|
199
205
|
if (msg.parent_tool_use_id) return;
|
|
206
|
+
this.observeConsumedPrompts(msg);
|
|
200
207
|
if (inTurn) return;
|
|
201
208
|
this.active = true;
|
|
202
209
|
const taskIds = [...this.settled];
|
|
@@ -211,17 +218,30 @@ var SelfTurnTracker = class {
|
|
|
211
218
|
return this.active && !this.joined;
|
|
212
219
|
}
|
|
213
220
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
221
|
+
* Whether the next `result` ends the self-started turn alone: a prompt pushed
|
|
222
|
+
* during it is still queued, so the CLI answers it in a turn of its own, and
|
|
223
|
+
* the prompted turn must wait for that turn's result.
|
|
216
224
|
*/
|
|
217
|
-
|
|
218
|
-
|
|
225
|
+
get resultEndsWakeOnly() {
|
|
226
|
+
return this.active && !this.joined && this.queuedPrompt !== null;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The driver pushed a prompt (`uuid`) into the live CLI. During a self-started
|
|
230
|
+
* turn the CLI may fold it into that turn or answer it in a turn of its own;
|
|
231
|
+
* the prompt joins the wake only once the CLI stamps its uuid on the wake's
|
|
232
|
+
* output. A CLI not seen to stamp uuids is assumed to fold it in.
|
|
233
|
+
*/
|
|
234
|
+
onPromptPushed(uuid) {
|
|
235
|
+
if (!this.active) return;
|
|
236
|
+
if (uuid && this.stampsPrompts) this.queuedPrompt = uuid;
|
|
237
|
+
else this.joined = true;
|
|
219
238
|
}
|
|
220
239
|
/** The running turn's `result` was handled. */
|
|
221
240
|
onResult() {
|
|
222
241
|
if (!this.active) return;
|
|
223
242
|
this.active = false;
|
|
224
243
|
this.joined = false;
|
|
244
|
+
this.queuedPrompt = null;
|
|
225
245
|
this.settled.clear();
|
|
226
246
|
}
|
|
227
247
|
/**
|
|
@@ -235,8 +255,20 @@ var SelfTurnTracker = class {
|
|
|
235
255
|
reset() {
|
|
236
256
|
this.active = false;
|
|
237
257
|
this.joined = false;
|
|
258
|
+
this.queuedPrompt = null;
|
|
259
|
+
this.stampsPrompts = false;
|
|
238
260
|
this.settled.clear();
|
|
239
261
|
this.foreground.clear();
|
|
262
|
+
this.reported.clear();
|
|
263
|
+
}
|
|
264
|
+
observeConsumedPrompts(msg) {
|
|
265
|
+
const uuids = msg.user_message_uuids ?? (msg.user_message_uuid ? [msg.user_message_uuid] : []);
|
|
266
|
+
if (uuids.length === 0) return;
|
|
267
|
+
this.stampsPrompts = true;
|
|
268
|
+
if (this.queuedPrompt !== null && uuids.includes(this.queuedPrompt)) {
|
|
269
|
+
this.queuedPrompt = null;
|
|
270
|
+
if (this.active) this.joined = true;
|
|
271
|
+
}
|
|
240
272
|
}
|
|
241
273
|
observeTask(msg, inTurn) {
|
|
242
274
|
const taskId = msg.task_id;
|
|
@@ -263,11 +295,12 @@ var SelfTurnTracker = class {
|
|
|
263
295
|
}
|
|
264
296
|
if (msg.subtype === "task_notification") {
|
|
265
297
|
this.foreground.delete(taskId);
|
|
266
|
-
if (!ambient) remember(this.settled, taskId);
|
|
298
|
+
if (!ambient && this.reported.has(taskId)) remember(this.settled, taskId);
|
|
267
299
|
}
|
|
268
300
|
}
|
|
269
301
|
reportStarted(taskId, inTurn) {
|
|
270
302
|
if (!inTurn) return;
|
|
303
|
+
remember(this.reported, taskId);
|
|
271
304
|
this.emit({ type: "background_task_started", taskId });
|
|
272
305
|
}
|
|
273
306
|
};
|
|
@@ -383,6 +416,7 @@ function sanitizeAssistantText(text) {
|
|
|
383
416
|
return changed ? out.replace(/\s+$/, "") : out;
|
|
384
417
|
}
|
|
385
418
|
var TAG_PREFIXES = [
|
|
419
|
+
"function_calls",
|
|
386
420
|
"function_call",
|
|
387
421
|
"function_cal",
|
|
388
422
|
"function_ca",
|
|
@@ -422,18 +456,31 @@ var TAG_PREFIXES = [
|
|
|
422
456
|
"sy",
|
|
423
457
|
"s"
|
|
424
458
|
].join("|");
|
|
425
|
-
var PARTIAL_MARKER_TAIL = new RegExp(
|
|
459
|
+
var PARTIAL_MARKER_TAIL = new RegExp(
|
|
460
|
+
`\\[\\s*(?:/\\s*)?(?:${NS}(?:${TAG_PREFIXES})|[a-z][a-z0-9]*:?)?\\s*$`,
|
|
461
|
+
"i"
|
|
462
|
+
);
|
|
463
|
+
var ROLE_LABEL_TAIL = /(?:^|\n)[^\S\n]*(\[(?:User|Assistant|System)\]\s*)$/i;
|
|
426
464
|
var UNCLOSED_OPENER = new RegExp(`\\[\\s*${NS}function_calls\\s*\\]|\\[\\s*${NS}invoke\\b`, "i");
|
|
427
|
-
function
|
|
428
|
-
let cleaned = sanitizeAssistantText(text);
|
|
465
|
+
function cutAtUnclosedOpener(cleaned) {
|
|
429
466
|
const opener = UNCLOSED_OPENER.exec(cleaned);
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
467
|
+
return opener ? cleaned.slice(0, opener.index) : cleaned;
|
|
468
|
+
}
|
|
469
|
+
function finalizeStreamedText(text) {
|
|
470
|
+
const sanitized = sanitizeAssistantText(text);
|
|
471
|
+
const cut = cutAtUnclosedOpener(sanitized);
|
|
472
|
+
return cut === sanitized ? cut : cut.replace(/\s+$/, "");
|
|
473
|
+
}
|
|
474
|
+
function streamingSafeSanitize(text) {
|
|
475
|
+
let cleaned = cutAtUnclosedOpener(sanitizeAssistantText(text));
|
|
433
476
|
const tail = PARTIAL_MARKER_TAIL.exec(cleaned);
|
|
434
477
|
if (tail && tail.index >= 0) {
|
|
435
478
|
cleaned = cleaned.slice(0, tail.index);
|
|
436
479
|
}
|
|
480
|
+
const label = ROLE_LABEL_TAIL.exec(cleaned);
|
|
481
|
+
if (label?.[1]) {
|
|
482
|
+
cleaned = cleaned.slice(0, cleaned.length - label[1].length);
|
|
483
|
+
}
|
|
437
484
|
return cleaned.replace(/\s+$/, "");
|
|
438
485
|
}
|
|
439
486
|
|
|
@@ -444,41 +491,60 @@ function capabilityToolsKey(tools) {
|
|
|
444
491
|
[...tools].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0).map((t) => [t.name, t.description, t.parameters])
|
|
445
492
|
);
|
|
446
493
|
}
|
|
447
|
-
|
|
494
|
+
var LOOSE_SCHEMA_MAX_DEPTH = 6;
|
|
495
|
+
function looseShape(schema, z2, depth, nested) {
|
|
448
496
|
const props = schema?.properties ?? null;
|
|
449
|
-
if (!props || typeof props !== "object") return null;
|
|
497
|
+
if (!props || typeof props !== "object" || Array.isArray(props)) return null;
|
|
498
|
+
const keys = Object.keys(props);
|
|
499
|
+
if (nested && (keys.length === 0 || !keys.every((k) => TOOL_PROPERTY_KEY_PATTERN.test(k))))
|
|
500
|
+
return null;
|
|
450
501
|
const required = new Set(Array.isArray(schema?.required) ? schema.required : []);
|
|
451
502
|
const out = {};
|
|
452
|
-
for (const
|
|
453
|
-
let zod;
|
|
454
|
-
switch (def?.type) {
|
|
455
|
-
case "string":
|
|
456
|
-
zod = z2.string();
|
|
457
|
-
break;
|
|
458
|
-
case "number":
|
|
459
|
-
case "integer":
|
|
460
|
-
zod = z2.number();
|
|
461
|
-
break;
|
|
462
|
-
case "boolean":
|
|
463
|
-
zod = z2.boolean();
|
|
464
|
-
break;
|
|
465
|
-
case "array":
|
|
466
|
-
zod = z2.array(z2.any());
|
|
467
|
-
break;
|
|
468
|
-
case "object":
|
|
469
|
-
zod = z2.record(z2.string(), z2.any());
|
|
470
|
-
break;
|
|
471
|
-
default:
|
|
472
|
-
zod = z2.any();
|
|
473
|
-
}
|
|
474
|
-
if (def?.description && typeof def.description === "string") {
|
|
475
|
-
zod = zod.describe(def.description);
|
|
476
|
-
}
|
|
503
|
+
for (const key of keys) {
|
|
504
|
+
let zod = looseType(props[key], z2, depth + 1);
|
|
477
505
|
if (!required.has(key)) zod = zod.optional();
|
|
478
506
|
out[key] = zod;
|
|
479
507
|
}
|
|
480
508
|
return out;
|
|
481
509
|
}
|
|
510
|
+
function looseType(def, z2, depth) {
|
|
511
|
+
let zod;
|
|
512
|
+
const meta = {};
|
|
513
|
+
const deep = depth >= LOOSE_SCHEMA_MAX_DEPTH;
|
|
514
|
+
switch (def?.type) {
|
|
515
|
+
case "string":
|
|
516
|
+
zod = z2.string();
|
|
517
|
+
break;
|
|
518
|
+
case "number":
|
|
519
|
+
case "integer":
|
|
520
|
+
zod = z2.number();
|
|
521
|
+
break;
|
|
522
|
+
case "boolean":
|
|
523
|
+
zod = z2.boolean();
|
|
524
|
+
break;
|
|
525
|
+
case "array": {
|
|
526
|
+
const items = def.items;
|
|
527
|
+
const itemSchema = !deep && items && typeof items === "object" && !Array.isArray(items) ? items : null;
|
|
528
|
+
zod = z2.array(itemSchema ? looseType(itemSchema, z2, depth + 1) : z2.any());
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
case "object": {
|
|
532
|
+
const shape = deep ? null : looseShape(def, z2, depth, true);
|
|
533
|
+
zod = shape ? z2.looseObject(shape) : z2.record(z2.string(), z2.any());
|
|
534
|
+
if (shape && def.additionalProperties === false) meta.additionalProperties = false;
|
|
535
|
+
break;
|
|
536
|
+
}
|
|
537
|
+
default:
|
|
538
|
+
zod = z2.any();
|
|
539
|
+
}
|
|
540
|
+
if (def?.description && typeof def.description === "string") {
|
|
541
|
+
meta.description = def.description;
|
|
542
|
+
}
|
|
543
|
+
return Object.keys(meta).length > 0 ? zod.meta(meta) : zod;
|
|
544
|
+
}
|
|
545
|
+
function jsonSchemaToZodLoose(schema, z2) {
|
|
546
|
+
return looseShape(schema, z2, 0, false);
|
|
547
|
+
}
|
|
482
548
|
if (typeof globalThis.require === "undefined") {
|
|
483
549
|
try {
|
|
484
550
|
const metaUrl = (0, eval)("import.meta.url");
|
|
@@ -704,11 +770,14 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
704
770
|
toolIdToName = /* @__PURE__ */ new Map();
|
|
705
771
|
prevText = "";
|
|
706
772
|
/**
|
|
707
|
-
*
|
|
708
|
-
* Lets {@link handleStreamEvent} emit only the
|
|
709
|
-
*
|
|
773
|
+
* The sanitized text already streamed for the current message, exactly as the
|
|
774
|
+
* `_textDelta`s carried it. Lets {@link handleStreamEvent} emit only the
|
|
775
|
+
* newly-stable sanitized suffix, so a leaked marker that spans deltas is never
|
|
776
|
+
* half-sent, and lets {@link flushHeldBackText} send what was held back.
|
|
710
777
|
*/
|
|
711
|
-
|
|
778
|
+
emittedSanitizedText = "";
|
|
779
|
+
/** Set once this message's sanitized text stopped extending what was streamed (logged once). */
|
|
780
|
+
streamDiverged = false;
|
|
712
781
|
/** Set once the streaming text of the current message classifies as a self-healable auth render. */
|
|
713
782
|
suppressingAuthStream = false;
|
|
714
783
|
/**
|
|
@@ -805,6 +874,11 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
805
874
|
subagentToolAllowlists = /* @__PURE__ */ new Map();
|
|
806
875
|
/** Guards against duplicate agent_end emissions per turn. */
|
|
807
876
|
turnCompleted = false;
|
|
877
|
+
/**
|
|
878
|
+
* The last `result` ended a self-started turn while a prompt pushed during it
|
|
879
|
+
* was still queued: the prompted turn ends on the result of the turn that answers it.
|
|
880
|
+
*/
|
|
881
|
+
resultEndedWakeOnly = false;
|
|
808
882
|
/** Announces the turns the CLI starts by itself and the background tasks they continue. */
|
|
809
883
|
selfTurns = new SelfTurnTracker((event) => {
|
|
810
884
|
try {
|
|
@@ -936,15 +1010,17 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
936
1010
|
/** Per-model usage of the most recent completed turn, derived in `captureResultUsage`. */
|
|
937
1011
|
_lastModelUsage = null;
|
|
938
1012
|
/**
|
|
939
|
-
* The raw `modelUsage` map from the most recently seen result message
|
|
1013
|
+
* The raw `modelUsage` map from the most recently seen result message, or the
|
|
1014
|
+
* map a resumed spawn restored (see {@link seedCostBaseline}). Like
|
|
940
1015
|
* `total_cost_usd` it is cumulative over the whole SDK run, so a turn's share
|
|
941
1016
|
* is the per-model difference against this snapshot.
|
|
942
1017
|
*/
|
|
943
1018
|
_lastCumulativeModelUsage = null;
|
|
944
1019
|
/**
|
|
945
|
-
* The SDK's `total_cost_usd` from the most recently seen result message
|
|
946
|
-
* cumulative over the whole SDK
|
|
947
|
-
* the next result's total to
|
|
1020
|
+
* The SDK's `total_cost_usd` from the most recently seen result message, or
|
|
1021
|
+
* the total a resumed spawn restored — cumulative over the whole SDK
|
|
1022
|
+
* run/session, not per-turn. Diffed against the next result's total to
|
|
1023
|
+
* derive the per-turn delta.
|
|
948
1024
|
*/
|
|
949
1025
|
_lastCumulativeCostUsd = 0;
|
|
950
1026
|
/** Per-turn cost delta derived from `total_cost_usd`, emitted as the `result` event's `costUsd`. */
|
|
@@ -952,13 +1028,19 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
952
1028
|
/** Whether the last result carried `total_cost_usd`; 0 alone cannot tell a free turn from an unreported one. */
|
|
953
1029
|
_lastCostReported = false;
|
|
954
1030
|
/**
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
*
|
|
1031
|
+
* SDK session the cumulative baseline (`_lastCumulativeCostUsd`,
|
|
1032
|
+
* `_lastCumulativeModelUsage`) belongs to. A spawn that resumes this session
|
|
1033
|
+
* keeps the baseline, because the CLI restores the same totals; any other
|
|
1034
|
+
* spawn re-seeds it in {@link seedCostBaseline}.
|
|
1035
|
+
*/
|
|
1036
|
+
_costBaselineSessionId = null;
|
|
1037
|
+
/**
|
|
1038
|
+
* The transcript's `cost-state` when a spawn kept the in-memory baseline.
|
|
1039
|
+
* Consulted by the spawn's first result only: the CLI stamps `cost-state` at
|
|
1040
|
+
* exit, so a hard-killed or still-exiting old process can leave it restoring
|
|
1041
|
+
* less than was booked.
|
|
958
1042
|
*/
|
|
959
|
-
|
|
960
|
-
/** Spawn generation `_lastCumulativeCostUsd` was captured under. */
|
|
961
|
-
_costTrackingGeneration = -1;
|
|
1043
|
+
_staleRestoreFallback = null;
|
|
962
1044
|
/**
|
|
963
1045
|
* `true` when the active credential is a Claude Code OAuth subscription
|
|
964
1046
|
* (no API key in config) rather than a raw `ANTHROPIC_API_KEY`. Set on
|
|
@@ -1174,7 +1256,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1174
1256
|
}
|
|
1175
1257
|
this.running = true;
|
|
1176
1258
|
this.prevText = "";
|
|
1177
|
-
this.
|
|
1259
|
+
this.emittedSanitizedText = "";
|
|
1260
|
+
this.streamDiverged = false;
|
|
1178
1261
|
this.suppressingAuthStream = false;
|
|
1179
1262
|
this.suppressedAuthRenderText = null;
|
|
1180
1263
|
this.lastApiErrorRender = null;
|
|
@@ -1190,8 +1273,9 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1190
1273
|
});
|
|
1191
1274
|
try {
|
|
1192
1275
|
if (this.query && this.inputStream) {
|
|
1193
|
-
this.
|
|
1194
|
-
this.
|
|
1276
|
+
const userMessage = this.buildUserMessage(message);
|
|
1277
|
+
this.inputStream.push(userMessage);
|
|
1278
|
+
this.selfTurns.onPromptPushed(userMessage.uuid);
|
|
1195
1279
|
} else {
|
|
1196
1280
|
await this.startQuery(message);
|
|
1197
1281
|
}
|
|
@@ -1584,10 +1668,11 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1584
1668
|
* were cut from, so it matches what the consumer received exactly.
|
|
1585
1669
|
*/
|
|
1586
1670
|
retractUnfinishedText() {
|
|
1587
|
-
if (this.
|
|
1588
|
-
const text =
|
|
1671
|
+
if (this.emittedSanitizedText === "") return;
|
|
1672
|
+
const text = this.emittedSanitizedText;
|
|
1589
1673
|
this.prevText = "";
|
|
1590
|
-
this.
|
|
1674
|
+
this.emittedSanitizedText = "";
|
|
1675
|
+
this.streamDiverged = false;
|
|
1591
1676
|
this.log.info("retracting the unfinished text of an attempt about to be replayed", {
|
|
1592
1677
|
chars: text.length
|
|
1593
1678
|
});
|
|
@@ -1776,7 +1861,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1776
1861
|
elapsedMs: 0,
|
|
1777
1862
|
outcome: "no_session"
|
|
1778
1863
|
});
|
|
1779
|
-
return;
|
|
1864
|
+
return null;
|
|
1780
1865
|
}
|
|
1781
1866
|
try {
|
|
1782
1867
|
const scrub = await scrubPoisonedTranscript({
|
|
@@ -1799,6 +1884,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1799
1884
|
cacheStripped: scrub.cacheStripped
|
|
1800
1885
|
});
|
|
1801
1886
|
}
|
|
1887
|
+
return scrub.costState;
|
|
1802
1888
|
} catch (err) {
|
|
1803
1889
|
this.log.warn("preventive transcript scrub failed; continuing", {
|
|
1804
1890
|
phase: "transcript_scrub",
|
|
@@ -1807,7 +1893,44 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1807
1893
|
sessionId,
|
|
1808
1894
|
error: err instanceof Error ? err.message : String(err)
|
|
1809
1895
|
});
|
|
1896
|
+
return null;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Set the cumulative baseline a new spawn's results are diffed against.
|
|
1901
|
+
*
|
|
1902
|
+
* `total_cost_usd` and `modelUsage` are run-cumulative, and on `--resume` the
|
|
1903
|
+
* CLI restores both from the transcript's last `cost-state` entry, so the
|
|
1904
|
+
* first result of a resumed spawn restates everything booked before it. The
|
|
1905
|
+
* restored totals are therefore the baseline, not new spend:
|
|
1906
|
+
* - resuming the session the in-memory baseline belongs to (a recycle or a
|
|
1907
|
+
* replay in this driver lifetime) keeps that baseline. It is what was
|
|
1908
|
+
* booked, so spend the old process made without a result still counts;
|
|
1909
|
+
* - resuming any other session (a wake: a new driver) takes the transcript's
|
|
1910
|
+
* `cost-state`, read in the same pass as the scrub;
|
|
1911
|
+
* - a fresh session, or a transcript without a `cost-state`, starts at zero.
|
|
1912
|
+
* A first total below the kept baseline means the CLI restored an older
|
|
1913
|
+
* stamp; {@link captureResultUsage} then diffs against the transcript's
|
|
1914
|
+
* `cost-state` when it fits, else books the total (it never goes negative).
|
|
1915
|
+
* A stale stamp whose first total still reaches the kept baseline cannot be
|
|
1916
|
+
* told apart from a correct restore, so that case under-books by the gap
|
|
1917
|
+
* rather than double-counting; it is logged at info.
|
|
1918
|
+
*/
|
|
1919
|
+
seedCostBaseline(resumedSessionId, restored) {
|
|
1920
|
+
this._staleRestoreFallback = null;
|
|
1921
|
+
if (resumedSessionId && resumedSessionId === this._costBaselineSessionId) {
|
|
1922
|
+
this._staleRestoreFallback = restored;
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
if (resumedSessionId && restored) {
|
|
1926
|
+
this._lastCumulativeCostUsd = restored.totalCostUSD;
|
|
1927
|
+
this._lastCumulativeModelUsage = restored.modelUsage;
|
|
1928
|
+
this._costBaselineSessionId = resumedSessionId;
|
|
1929
|
+
return;
|
|
1810
1930
|
}
|
|
1931
|
+
this._lastCumulativeCostUsd = 0;
|
|
1932
|
+
this._lastCumulativeModelUsage = null;
|
|
1933
|
+
this._costBaselineSessionId = null;
|
|
1811
1934
|
}
|
|
1812
1935
|
/**
|
|
1813
1936
|
* Resolve the AI provider registry entry this session addresses, plus
|
|
@@ -1858,12 +1981,13 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1858
1981
|
};
|
|
1859
1982
|
}
|
|
1860
1983
|
async startQuery(message) {
|
|
1861
|
-
this._querySpawnGeneration++;
|
|
1862
1984
|
this.queryStartedAt = Date.now();
|
|
1863
1985
|
this.awaitingFirstMessageOfSpawn = true;
|
|
1864
1986
|
this.spawnResumed = !!(this.config.resumeSessionId || this.sessionId || this.hasSession);
|
|
1987
|
+
const resumedSessionId = this.config.resumeSessionId || this.sessionId || null;
|
|
1865
1988
|
this.abortController = new AbortController();
|
|
1866
|
-
await this.preventivelyScrubTranscript();
|
|
1989
|
+
const restoredCost = await this.preventivelyScrubTranscript();
|
|
1990
|
+
this.seedCostBaseline(resumedSessionId, restoredCost);
|
|
1867
1991
|
const endpoint = this.resolveEndpoint();
|
|
1868
1992
|
const spawnConfig = {
|
|
1869
1993
|
model: this.config.model,
|
|
@@ -2289,10 +2413,11 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2289
2413
|
*
|
|
2290
2414
|
* A tool whose declared schema has a property key the API rejects
|
|
2291
2415
|
* ({@link checkToolPropertyKeys}) is left out and reported in `dropped`.
|
|
2292
|
-
* Only the key rule applies here: `jsonSchemaToZodLoose` copies
|
|
2293
|
-
* verbatim
|
|
2294
|
-
* array/record/any,
|
|
2295
|
-
*
|
|
2416
|
+
* Only the key rule applies here: `jsonSchemaToZodLoose` copies top-level
|
|
2417
|
+
* keys verbatim (nested ones only when they pass the key rule) and flattens
|
|
2418
|
+
* every other construct to string/number/boolean/array/object/record/any,
|
|
2419
|
+
* so the wire schema is always valid draft 2020-12 and a declared-schema
|
|
2420
|
+
* meta check would drop tools that work.
|
|
2296
2421
|
*/
|
|
2297
2422
|
async buildCapabilityMcpServer() {
|
|
2298
2423
|
const dropped = [];
|
|
@@ -2411,7 +2536,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2411
2536
|
this.firstSdkMessageSeen = true;
|
|
2412
2537
|
this.captureSessionId(msg);
|
|
2413
2538
|
this.handleSdkMessage(msg);
|
|
2414
|
-
if (msg.type === "result" && !msg.is_error) {
|
|
2539
|
+
if (msg.type === "result" && !msg.is_error && !this.resultEndedWakeOnly) {
|
|
2415
2540
|
this.completeTurn();
|
|
2416
2541
|
}
|
|
2417
2542
|
}
|
|
@@ -2836,10 +2961,12 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2836
2961
|
this.log.info("suppressing SDK auth-error assistant text; self-heal will retry");
|
|
2837
2962
|
this.stashSuppressedAuthRender(this.assistantTextOf(agentMsg));
|
|
2838
2963
|
this.prevText = "";
|
|
2839
|
-
this.
|
|
2964
|
+
this.emittedSanitizedText = "";
|
|
2965
|
+
this.streamDiverged = false;
|
|
2840
2966
|
this.suppressingAuthStream = false;
|
|
2841
2967
|
return;
|
|
2842
2968
|
}
|
|
2969
|
+
this.flushHeldBackText();
|
|
2843
2970
|
this.emit("agent-event", { type: "message_start", message: agentMsg });
|
|
2844
2971
|
if (agentMsg.toolCalls) {
|
|
2845
2972
|
for (const tc of agentMsg.toolCalls) {
|
|
@@ -2853,7 +2980,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2853
2980
|
}
|
|
2854
2981
|
}
|
|
2855
2982
|
this.prevText = "";
|
|
2856
|
-
this.
|
|
2983
|
+
this.emittedSanitizedText = "";
|
|
2984
|
+
this.streamDiverged = false;
|
|
2857
2985
|
this.suppressingAuthStream = false;
|
|
2858
2986
|
this.suppressedAuthRenderText = null;
|
|
2859
2987
|
this.emit("agent-event", { type: "message_end", message: agentMsg });
|
|
@@ -2939,20 +3067,55 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2939
3067
|
this.stashSuppressedAuthRender(this.prevText);
|
|
2940
3068
|
return;
|
|
2941
3069
|
}
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
3070
|
+
this.emitSanitizedDelta(streamingSafeSanitize(this.prevText));
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
/**
|
|
3074
|
+
* Stream the part of `safe` (the sanitized text so far) not yet sent. Only a
|
|
3075
|
+
* strict extension of what was sent is streamed: deltas cannot be taken back.
|
|
3076
|
+
*/
|
|
3077
|
+
emitSanitizedDelta(safe) {
|
|
3078
|
+
if (!safe.startsWith(this.emittedSanitizedText)) {
|
|
3079
|
+
if (!this.streamDiverged) {
|
|
3080
|
+
this.streamDiverged = true;
|
|
3081
|
+
this.log.warn("sanitized text no longer extends the streamed text; streaming paused", {
|
|
3082
|
+
streamed: this.emittedSanitizedText.length,
|
|
3083
|
+
now: safe.length
|
|
3084
|
+
});
|
|
3085
|
+
}
|
|
3086
|
+
return;
|
|
3087
|
+
}
|
|
3088
|
+
const sanitizedDelta = safe.slice(this.emittedSanitizedText.length);
|
|
3089
|
+
if (sanitizedDelta.length === 0) return;
|
|
3090
|
+
this.emittedSanitizedText = safe;
|
|
3091
|
+
const agentMsg = {
|
|
3092
|
+
role: "assistant",
|
|
3093
|
+
content: [{ type: "text", text: safe }]
|
|
3094
|
+
};
|
|
3095
|
+
this.emit("agent-event", {
|
|
3096
|
+
type: "message_update",
|
|
3097
|
+
message: agentMsg,
|
|
3098
|
+
_textDelta: sanitizedDelta
|
|
3099
|
+
});
|
|
3100
|
+
}
|
|
3101
|
+
/**
|
|
3102
|
+
* Send the tail {@link streamingSafeSanitize} held back while the message
|
|
3103
|
+
* streamed. Once the message is complete nothing more can arrive, so only an
|
|
3104
|
+
* unclosed leaked block stays cut ({@link finalizeStreamedText}). Without this
|
|
3105
|
+
* a held-back tail (e.g. after an unclosed `[`) is lost: the consumer keeps
|
|
3106
|
+
* only the deltas.
|
|
3107
|
+
*/
|
|
3108
|
+
flushHeldBackText() {
|
|
3109
|
+
if (this.emittedSanitizedText === "") return;
|
|
3110
|
+
const final = finalizeStreamedText(this.prevText);
|
|
3111
|
+
if (!final.startsWith(this.emittedSanitizedText)) {
|
|
3112
|
+
this.log.warn("final sanitized text does not extend the streamed text; tail not sent", {
|
|
3113
|
+
streamed: this.emittedSanitizedText.length,
|
|
3114
|
+
final: final.length
|
|
2954
3115
|
});
|
|
3116
|
+
return;
|
|
2955
3117
|
}
|
|
3118
|
+
this.emitSanitizedDelta(final);
|
|
2956
3119
|
}
|
|
2957
3120
|
handleUserMessage(msg) {
|
|
2958
3121
|
const toolResults = this.mapToolResults(msg);
|
|
@@ -2968,6 +3131,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2968
3131
|
}
|
|
2969
3132
|
}
|
|
2970
3133
|
handleResultMessage(msg) {
|
|
3134
|
+
this.resultEndedWakeOnly = this.selfTurns.resultEndsWakeOnly;
|
|
2971
3135
|
this.captureResultUsage(msg);
|
|
2972
3136
|
if (msg.subtype === "success" && !msg.is_error) {
|
|
2973
3137
|
this.handleSuccessResult(msg);
|
|
@@ -3020,10 +3184,22 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3020
3184
|
const reportedCostUsd = msg.total_cost_usd;
|
|
3021
3185
|
this._lastCostReported = typeof reportedCostUsd === "number";
|
|
3022
3186
|
const totalCostUsd = reportedCostUsd ?? 0;
|
|
3023
|
-
const
|
|
3187
|
+
const staleRestore = this._staleRestoreFallback;
|
|
3188
|
+
this._staleRestoreFallback = null;
|
|
3189
|
+
if (staleRestore && totalCostUsd < this._lastCumulativeCostUsd && staleRestore.totalCostUSD <= totalCostUsd) {
|
|
3190
|
+
this._lastCumulativeCostUsd = staleRestore.totalCostUSD;
|
|
3191
|
+
this._lastCumulativeModelUsage = staleRestore.modelUsage;
|
|
3192
|
+
} else if (staleRestore && staleRestore.totalCostUSD < this._lastCumulativeCostUsd) {
|
|
3193
|
+
this.log.info("resumed spawn's transcript cost-state is below the booked total", {
|
|
3194
|
+
bookedCostUsd: this._lastCumulativeCostUsd,
|
|
3195
|
+
restoredCostUsd: staleRestore.totalCostUSD,
|
|
3196
|
+
firstTotalCostUsd: totalCostUsd
|
|
3197
|
+
});
|
|
3198
|
+
}
|
|
3199
|
+
const freshCostSession = totalCostUsd < this._lastCumulativeCostUsd;
|
|
3024
3200
|
this._lastTurnCostUsd = freshCostSession ? totalCostUsd : totalCostUsd - this._lastCumulativeCostUsd;
|
|
3025
3201
|
this._lastCumulativeCostUsd = totalCostUsd;
|
|
3026
|
-
this.
|
|
3202
|
+
this._costBaselineSessionId = this._lastCostReported ? this.sessionId || null : null;
|
|
3027
3203
|
if (modelUsage) {
|
|
3028
3204
|
this._lastModelUsage = diffModelUsage(
|
|
3029
3205
|
modelUsage,
|
|
@@ -3088,7 +3264,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3088
3264
|
this.emit("agent-event", this.withFailoverUsage(resultEvent));
|
|
3089
3265
|
}
|
|
3090
3266
|
const awaitingFollowUpThrow = looseMsg.is_error === true && errors.length === 0;
|
|
3091
|
-
if (!this.turnCompleted && !awaitingFollowUpThrow) {
|
|
3267
|
+
if (!this.turnCompleted && !awaitingFollowUpThrow && !this.resultEndedWakeOnly) {
|
|
3092
3268
|
this.completeTurn();
|
|
3093
3269
|
}
|
|
3094
3270
|
}
|
|
@@ -3157,9 +3333,11 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3157
3333
|
this.emit("agent-event", {
|
|
3158
3334
|
type: "error",
|
|
3159
3335
|
error: errorText,
|
|
3160
|
-
detail
|
|
3336
|
+
detail,
|
|
3337
|
+
// A wake's error must not read as the end of a prompted turn still waiting for its answer.
|
|
3338
|
+
...this.selfTurns.stampsTerminal ? { selfStarted: true } : {}
|
|
3161
3339
|
});
|
|
3162
|
-
} else {
|
|
3340
|
+
} else if (!this.resultEndedWakeOnly) {
|
|
3163
3341
|
this.armErrorResultGrace(detail, {
|
|
3164
3342
|
subtype: msg.subtype,
|
|
3165
3343
|
terminalReason: msg.terminal_reason
|
|
@@ -3170,10 +3348,14 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3170
3348
|
// ---------------------------------------------------------------------------
|
|
3171
3349
|
// Helpers
|
|
3172
3350
|
// ---------------------------------------------------------------------------
|
|
3173
|
-
/**
|
|
3351
|
+
/**
|
|
3352
|
+
* Build an SDKUserMessage for the persistent prompt stream. The uuid comes back
|
|
3353
|
+
* stamped on the assistant messages of the turn that takes the prompt.
|
|
3354
|
+
*/
|
|
3174
3355
|
buildUserMessage(text) {
|
|
3175
3356
|
return {
|
|
3176
3357
|
type: "user",
|
|
3358
|
+
uuid: randomUUID(),
|
|
3177
3359
|
message: {
|
|
3178
3360
|
role: "user",
|
|
3179
3361
|
content: text
|
|
@@ -3368,7 +3550,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3368
3550
|
this._lastCumulativeCostUsd = 0;
|
|
3369
3551
|
this._lastTurnCostUsd = 0;
|
|
3370
3552
|
this._lastCostReported = false;
|
|
3371
|
-
this.
|
|
3553
|
+
this._costBaselineSessionId = null;
|
|
3554
|
+
this._staleRestoreFallback = null;
|
|
3372
3555
|
}
|
|
3373
3556
|
/**
|
|
3374
3557
|
* Build allowedTools / disallowedTools options from AgentConfig.tools.
|