@skaile/workspaces 5.15.1 → 5.17.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 +80 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-FVDNQ2FM.js → asset-feeds-MALYFZUM.js} +18 -18
- package/dist/{asset-feeds-FVDNQ2FM.js.map → asset-feeds-MALYFZUM.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +7 -7
- package/dist/asset-manager/index.js +13 -13
- package/dist/asset-manager/installer.js +9 -9
- package/dist/asset-manager/renderers.js +8 -8
- package/dist/asset-manager/src/index.d.ts +105 -6
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +11 -2
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +425 -111
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +15 -128
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +10 -10
- package/dist/bridge/drivers/echo.js +4 -4
- package/dist/bridge/drivers/gemini.js +7 -7
- package/dist/bridge/drivers/goose.js +10 -10
- package/dist/bridge/drivers/omp.js +64 -8
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +10 -10
- package/dist/bridge/drivers/qwen.js +7 -7
- package/dist/bridge/index.js +15 -14
- package/dist/bridge/src/approval-card.d.ts +24 -0
- package/dist/bridge/src/approval-card.d.ts.map +1 -0
- package/dist/bridge/src/driver-model-check.d.ts +21 -0
- package/dist/bridge/src/driver-model-check.d.ts.map +1 -0
- package/dist/bridge/src/drivers/claude-sdk.d.ts +95 -19
- 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.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 +2 -0
- package/dist/bridge/src/index.d.ts.map +1 -1
- package/dist/bridge/src/types.d.ts +23 -0
- package/dist/bridge/src/types.d.ts.map +1 -1
- package/dist/{chunk-YUURCZWY.js → chunk-2SKPPIV7.js} +5 -5
- package/dist/{chunk-YUURCZWY.js.map → chunk-2SKPPIV7.js.map} +1 -1
- package/dist/{chunk-TCWECSEB.js → chunk-3OYOBTY4.js} +70 -6
- package/dist/chunk-3OYOBTY4.js.map +1 -0
- package/dist/{chunk-PK5XQBOC.js → chunk-46IRZJV4.js} +4 -4
- package/dist/{chunk-PK5XQBOC.js.map → chunk-46IRZJV4.js.map} +1 -1
- package/dist/{chunk-54TVXZP3.js → chunk-5DCOG5B5.js} +3 -3
- package/dist/{chunk-54TVXZP3.js.map → chunk-5DCOG5B5.js.map} +1 -1
- package/dist/{chunk-X7DIT65W.js → chunk-5RDZ5JHH.js} +4 -4
- package/dist/{chunk-X7DIT65W.js.map → chunk-5RDZ5JHH.js.map} +1 -1
- package/dist/chunk-5SWED2LW.js +125 -0
- package/dist/chunk-5SWED2LW.js.map +1 -0
- package/dist/{chunk-BV7NLPI6.js → chunk-6GSE63K2.js} +4 -4
- package/dist/{chunk-BV7NLPI6.js.map → chunk-6GSE63K2.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-LEOXPIC6.js → chunk-AP24HESN.js} +3 -3
- package/dist/{chunk-LEOXPIC6.js.map → chunk-AP24HESN.js.map} +1 -1
- package/dist/{chunk-7Y7UYNGL.js → chunk-BBRMS4IC.js} +12 -9
- package/dist/chunk-BBRMS4IC.js.map +1 -0
- package/dist/{chunk-55VKZUQY.js → chunk-BVXXBZWA.js} +70 -34
- package/dist/chunk-BVXXBZWA.js.map +1 -0
- package/dist/{chunk-JUHDED6J.js → chunk-CWAWYXD5.js} +3 -3
- package/dist/{chunk-JUHDED6J.js.map → chunk-CWAWYXD5.js.map} +1 -1
- package/dist/{chunk-OOQ5Q75W.js → chunk-D3PU3C6F.js} +41 -16
- package/dist/chunk-D3PU3C6F.js.map +1 -0
- package/dist/{chunk-WXKNM2JJ.js → chunk-D5REDKVU.js} +3 -3
- package/dist/{chunk-WXKNM2JJ.js.map → chunk-D5REDKVU.js.map} +1 -1
- package/dist/{chunk-B6I7SF2X.js → chunk-DR5ZOEYI.js} +114 -81
- package/dist/chunk-DR5ZOEYI.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-JJLH4TX4.js → chunk-EOKWTN4N.js} +421 -112
- package/dist/chunk-EOKWTN4N.js.map +1 -0
- package/dist/{chunk-NKDSU4Q7.js → chunk-ES6ARJPQ.js} +21 -7
- package/dist/chunk-ES6ARJPQ.js.map +1 -0
- package/dist/{chunk-VQQCA7BD.js → chunk-EYDRONKO.js} +4 -4
- package/dist/{chunk-VQQCA7BD.js.map → chunk-EYDRONKO.js.map} +1 -1
- package/dist/{chunk-U7YMGW7M.js → chunk-FACRITOL.js} +2 -2
- package/dist/{chunk-U7YMGW7M.js.map → chunk-FACRITOL.js.map} +1 -1
- package/dist/{chunk-WWUWMOX2.js → chunk-FSLVMZXR.js} +37 -17
- package/dist/chunk-FSLVMZXR.js.map +1 -0
- package/dist/{chunk-MKTJZLQM.js → chunk-FSSRBWYL.js} +4 -4
- package/dist/{chunk-MKTJZLQM.js.map → chunk-FSSRBWYL.js.map} +1 -1
- package/dist/{chunk-VY6NTFE7.js → chunk-FT4ZHLYR.js} +3 -2
- package/dist/chunk-FT4ZHLYR.js.map +1 -0
- package/dist/{chunk-O673TBWJ.js → chunk-GYZJKZPJ.js} +3 -3
- package/dist/{chunk-O673TBWJ.js.map → chunk-GYZJKZPJ.js.map} +1 -1
- package/dist/{chunk-ANSZULXH.js → chunk-H7R7R5BN.js} +21 -6
- package/dist/chunk-H7R7R5BN.js.map +1 -0
- package/dist/{chunk-RNFHJUK7.js → chunk-HLETG3CX.js} +3 -3
- package/dist/{chunk-RNFHJUK7.js.map → chunk-HLETG3CX.js.map} +1 -1
- package/dist/{plugin-store-BIITCNOZ.js → chunk-HUKUYWBJ.js} +32 -23
- package/dist/chunk-HUKUYWBJ.js.map +1 -0
- package/dist/chunk-KZWZRNIY.js +1016 -0
- package/dist/chunk-KZWZRNIY.js.map +1 -0
- package/dist/{chunk-X5O56UO4.js → chunk-L2AMXONH.js} +3 -3
- package/dist/chunk-L2AMXONH.js.map +1 -0
- package/dist/{chunk-NOF73BUH.js → chunk-L6UMSKDF.js} +10 -2
- package/dist/chunk-L6UMSKDF.js.map +1 -0
- package/dist/{chunk-GQ5OYFVD.js → chunk-LQT2IKYY.js} +47 -47
- package/dist/chunk-LQT2IKYY.js.map +1 -0
- package/dist/{chunk-NHH3MRSC.js → chunk-MMARPEV7.js} +7 -7
- package/dist/{chunk-NHH3MRSC.js.map → chunk-MMARPEV7.js.map} +1 -1
- package/dist/{chunk-GR7TV4XC.js → chunk-OQN7PCI4.js} +4 -4
- package/dist/{chunk-GR7TV4XC.js.map → chunk-OQN7PCI4.js.map} +1 -1
- package/dist/{chunk-NVBN3YOH.js → chunk-OXUCYHL5.js} +46 -67
- package/dist/chunk-OXUCYHL5.js.map +1 -0
- package/dist/{chunk-SZPE55SB.js → chunk-PGZDSDOB.js} +3 -3
- package/dist/{chunk-SZPE55SB.js.map → chunk-PGZDSDOB.js.map} +1 -1
- package/dist/{chunk-4QINFQ27.js → chunk-PIC23DDE.js} +59 -17
- package/dist/chunk-PIC23DDE.js.map +1 -0
- package/dist/{chunk-SAKVAG23.js → chunk-QBY74UBH.js} +7 -7
- package/dist/{chunk-SAKVAG23.js.map → chunk-QBY74UBH.js.map} +1 -1
- package/dist/{chunk-GV3MFKDV.js → chunk-QEX75L77.js} +62 -6
- package/dist/chunk-QEX75L77.js.map +1 -0
- package/dist/{chunk-4AKR4XPQ.js → chunk-QSLXB44M.js} +3 -3
- package/dist/chunk-QSLXB44M.js.map +1 -0
- package/dist/{chunk-PQF5QHVS.js → chunk-QW534EZB.js} +20 -6
- package/dist/chunk-QW534EZB.js.map +1 -0
- package/dist/{chunk-DPCEQOIZ.js → chunk-QXA2W6UB.js} +3 -3
- package/dist/{chunk-DPCEQOIZ.js.map → chunk-QXA2W6UB.js.map} +1 -1
- package/dist/{chunk-N36S36OZ.js → chunk-SPV2CXJ3.js} +3 -3
- package/dist/{chunk-N36S36OZ.js.map → chunk-SPV2CXJ3.js.map} +1 -1
- package/dist/{chunk-KRRHADE7.js → chunk-SXWGLW23.js} +4 -4
- package/dist/{chunk-KRRHADE7.js.map → chunk-SXWGLW23.js.map} +1 -1
- package/dist/{chunk-MUOSKYI2.js → chunk-V5CDPKDA.js} +12 -12
- package/dist/{chunk-MUOSKYI2.js.map → chunk-V5CDPKDA.js.map} +1 -1
- package/dist/{chunk-R37L4BNR.js → chunk-W44KA24A.js} +648 -76
- package/dist/chunk-W44KA24A.js.map +1 -0
- package/dist/{chunk-PV47EEHD.js → chunk-WKEBNB5S.js} +4 -4
- package/dist/{chunk-PV47EEHD.js.map → chunk-WKEBNB5S.js.map} +1 -1
- package/dist/{chunk-ESXZJP4M.js → chunk-WXWQNJCT.js} +3 -3
- package/dist/{chunk-ESXZJP4M.js.map → chunk-WXWQNJCT.js.map} +1 -1
- package/dist/{chunk-354JIEIE.js → chunk-WY22FMZF.js} +5 -5
- package/dist/{chunk-354JIEIE.js.map → chunk-WY22FMZF.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-MGM5EJQQ.js → chunk-YK3XLEQJ.js} +40 -26
- package/dist/chunk-YK3XLEQJ.js.map +1 -0
- package/dist/{chunk-SP5NGNBV.js → chunk-YW2BNDSE.js} +11 -4
- package/dist/chunk-YW2BNDSE.js.map +1 -0
- package/dist/{chunk-GLMKS6V6.js → chunk-ZPCABSSW.js} +4 -4
- package/dist/{chunk-GLMKS6V6.js.map → chunk-ZPCABSSW.js.map} +1 -1
- package/dist/{chunk-J76LDUDS.js → chunk-ZVZTCDUN.js} +26 -10
- package/dist/chunk-ZVZTCDUN.js.map +1 -0
- package/dist/{chunk-RTYDYSUV.js → chunk-ZWUJ22RF.js} +82 -22
- package/dist/chunk-ZWUJ22RF.js.map +1 -0
- package/dist/cli/index.js +902 -1620
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/agent-checks.d.ts +22 -10
- package/dist/cli/src/agent-checks.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-index.d.ts +6 -0
- package/dist/cli/src/commands/library-index.d.ts.map +1 -1
- package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
- package/dist/cli/src/commands/outdated.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin/codex.d.ts +10 -0
- package/dist/cli/src/commands/plugin/codex.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin/types.d.ts +5 -2
- package/dist/cli/src/commands/plugin/types.d.ts.map +1 -1
- package/dist/cli/src/commands/preset-export.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +6 -0
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/rebuild.d.ts.map +1 -1
- package/dist/cli/src/commands/run.d.ts.map +1 -1
- package/dist/cli/src/commands/serve-preflight.d.ts +13 -0
- package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
- package/dist/cli/src/commands/serve.d.ts.map +1 -1
- package/dist/cli/src/commands/show.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +2 -1
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/store.d.ts.map +1 -1
- package/dist/cli/src/commands/update.d.ts.map +1 -1
- package/dist/cli/src/commands/validate.d.ts +6 -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/helpers.d.ts +23 -0
- package/dist/cli/src/helpers.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/index.d.ts +8 -0
- package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/load.d.ts +1 -0
- package/dist/cli/src/plugin-store/load.d.ts.map +1 -1
- package/dist/cli/src/skill-checks.d.ts +9 -21
- package/dist/cli/src/skill-checks.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +19 -18
- package/dist/{connectors-TVFFE5H4.js → connectors-CIEIMJY2.js} +22 -21
- package/dist/{connectors-TVFFE5H4.js.map → connectors-CIEIMJY2.js.map} +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/core/index.js +6 -6
- 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/conformance.d.ts.map +1 -1
- package/dist/core/src/driver-sdk.d.ts +12 -2
- package/dist/core/src/driver-sdk.d.ts.map +1 -1
- package/dist/core/src/index.d.ts +4 -4
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +7 -0
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts +9 -0
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/publish-manifest.d.ts +5 -2
- package/dist/core/src/publish-manifest.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +14 -0
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/workspace-config.js +4 -4
- package/dist/deploy/index.js +6 -6
- package/dist/discovery/index.js +5 -5
- package/dist/discovery/src/index.d.ts +2 -2
- package/dist/discovery/src/index.d.ts.map +1 -1
- package/dist/discovery/src/parse-manifest.d.ts +7 -0
- package/dist/discovery/src/parse-manifest.d.ts.map +1 -1
- package/dist/discovery/src/source-config.d.ts +6 -0
- package/dist/discovery/src/source-config.d.ts.map +1 -1
- package/dist/{ensure-sources-N4E5EDGC.js → ensure-sources-I62QMZZP.js} +16 -16
- package/dist/{ensure-sources-N4E5EDGC.js.map → ensure-sources-I62QMZZP.js.map} +1 -1
- package/dist/factory-assets/README.md +1 -1
- package/dist/factory-assets/connectors/box.js +19 -18
- package/dist/factory-assets/connectors/deploy.js +19 -18
- package/dist/factory-assets/connectors/devserver.js +19 -18
- package/dist/factory-assets/connectors/flow/adapter.js +19 -18
- package/dist/factory-assets/connectors/flow/engine.js +7 -7
- package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.js +21 -20
- package/dist/factory-assets/connectors/flow.js +19 -18
- package/dist/factory-assets/connectors/git.js +19 -18
- package/dist/factory-assets/connectors/gmail.js +19 -18
- package/dist/factory-assets/connectors/googledrive.js +19 -18
- package/dist/factory-assets/connectors/local.js +19 -18
- package/dist/factory-assets/connectors/mattermost.js +19 -18
- package/dist/factory-assets/connectors/memory.js +19 -18
- package/dist/factory-assets/connectors/minio.js +19 -18
- package/dist/factory-assets/connectors/postgres.js +19 -18
- package/dist/factory-assets/connectors/s3.js +19 -18
- package/dist/factory-assets/connectors/sharepoint.js +19 -18
- package/dist/factory-assets/connectors/sqlite.js +19 -18
- package/dist/factory-assets/connectors/static-server.js +19 -18
- package/dist/factory-assets/connectors/tunnel.js +19 -18
- package/dist/factory-assets/connectors/webdav.js +19 -18
- package/dist/factory-assets/connectors/xstate-store.js +19 -18
- package/dist/factory-assets/connectors/xstate.js +19 -18
- package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +12 -11
- package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +11 -7
- package/dist/factory-assets/skills/skailify/SKILL.md +3 -3
- package/dist/{flows-CYJI3URW.js → flows-YKC53LDP.js} +11 -11
- package/dist/{flows-CYJI3URW.js.map → flows-YKC53LDP.js.map} +1 -1
- package/dist/{helpers-PPVGVYIZ.js → helpers-3FOM37BO.js} +16 -16
- package/dist/{helpers-PPVGVYIZ.js.map → helpers-3FOM37BO.js.map} +1 -1
- package/dist/library/index.js +10 -10
- 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/local/store-paths.d.ts +8 -0
- package/dist/library/src/local/store-paths.d.ts.map +1 -1
- package/dist/library/src/manifest-writer.d.ts +5 -1
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/library/src/remote/remote-catalog-source.d.ts +3 -2
- package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
- package/dist/{library-publish-EQFYHJ6G.js → library-publish-EFKITCGE.js} +59 -51
- package/dist/library-publish-EFKITCGE.js.map +1 -0
- package/dist/model-endpoint/index.js +19 -3
- package/dist/model-endpoint/src/index.d.ts +1 -1
- package/dist/model-endpoint/src/index.d.ts.map +1 -1
- package/dist/model-endpoint/src/resolve.d.ts +5 -0
- package/dist/model-endpoint/src/resolve.d.ts.map +1 -1
- package/dist/model-endpoint/src/server.d.ts +7 -0
- package/dist/model-endpoint/src/server.d.ts.map +1 -1
- package/dist/model-endpoint/src/types.d.ts +41 -7
- package/dist/model-endpoint/src/types.d.ts.map +1 -1
- package/dist/{open-library-JJGDEYYT.js → open-library-NZUI4XGF.js} +19 -19
- package/dist/{open-library-JJGDEYYT.js.map → open-library-NZUI4XGF.js.map} +1 -1
- package/dist/{open-registry-X6YQVP7V.js → open-registry-YPRQDUMK.js} +14 -14
- package/dist/{open-registry-X6YQVP7V.js.map → open-registry-YPRQDUMK.js.map} +1 -1
- package/dist/{paths-NXWIBZCX.js → paths-P55DTBEK.js} +9 -9
- package/dist/{paths-NXWIBZCX.js.map → paths-P55DTBEK.js.map} +1 -1
- package/dist/plugin-store-IPIBZRBX.js +23 -0
- package/dist/plugin-store-IPIBZRBX.js.map +1 -0
- package/dist/project-2BNFZ2CR.js +83 -0
- package/dist/{project-5HW3XSOE.js.map → project-2BNFZ2CR.js.map} +1 -1
- package/dist/resolver/index.js +7 -7
- package/dist/resolver/src/types.d.ts +1 -0
- package/dist/resolver/src/types.d.ts.map +1 -1
- package/dist/resolver/src/validator.d.ts +1 -1
- package/dist/runner/index.js +35 -34
- package/dist/runner/src/agent.d.ts +9 -1
- package/dist/runner/src/agent.d.ts.map +1 -1
- package/dist/runner/src/agents/in-process-host.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/composition/content-source.d.ts.map +1 -1
- package/dist/runner/src/composition/index.d.ts +1 -1
- package/dist/runner/src/composition/index.d.ts.map +1 -1
- package/dist/runner/src/composition/resolve-instance.d.ts +20 -0
- package/dist/runner/src/composition/resolve-instance.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/model-endpoint-discovery.d.ts.map +1 -1
- package/dist/runner/src/resource-handler.d.ts.map +1 -1
- package/dist/runner/src/runner-capabilities.d.ts +16 -3
- package/dist/runner/src/runner-capabilities.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts +10 -0
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts +20 -1
- package/dist/runner/src/session-builder.d.ts.map +1 -1
- package/dist/runner/src/session-capability-wiring.d.ts +7 -0
- package/dist/runner/src/session-capability-wiring.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +13 -13
- package/dist/sdk/bridge.js +15 -14
- package/dist/sdk/core.js +6 -6
- package/dist/sdk/flow.js +7 -7
- package/dist/sdk/index.js +35 -34
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +7 -7
- package/dist/sdk/runner.js +35 -34
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/transport/ws/server.js +1 -1
- package/dist/sdk/transport/ws.js +1 -1
- package/dist/sdk/transport.js +1 -1
- package/dist/sdk/types.js +1 -1
- package/dist/{serve-preflight-GD7IQFA3.js → serve-preflight-V5GM33T3.js} +15 -9
- package/dist/serve-preflight-V5GM33T3.js.map +1 -0
- package/dist/session/index.js +2 -2
- package/dist/{setup-52NDDR7C.js → setup-ZMAPTKJW.js} +25 -24
- package/dist/setup-ZMAPTKJW.js.map +1 -0
- package/dist/{skills-XVHOXOOH.js → skills-7G6QCDEM.js} +12 -12
- package/dist/{skills-XVHOXOOH.js.map → skills-7G6QCDEM.js.map} +1 -1
- package/dist/{source-WKV4QFGS.js → source-6BZA34F5.js} +45 -44
- package/dist/{source-WKV4QFGS.js.map → source-6BZA34F5.js.map} +1 -1
- package/dist/{source-manifest-publish-3HAX6DPN.js → source-manifest-publish-MJXCSUKT.js} +47 -46
- package/dist/source-manifest-publish-MJXCSUKT.js.map +1 -0
- package/dist/transport/index.js +1 -1
- package/dist/transport/src/ws/server.d.ts +9 -0
- package/dist/transport/src/ws/server.d.ts.map +1 -1
- package/dist/transport/ws/server.js +1 -1
- package/dist/transport/ws.js +1 -1
- package/dist/tui/index.js +110 -44
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/src/repl-session.d.ts +7 -0
- package/dist/tui/src/repl-session.d.ts.map +1 -1
- package/dist/tui/src/repl.d.ts +16 -0
- 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 -0
- 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 -0
- package/dist/workspace-plugin/adapters/mcp.js +26 -25
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4AKR4XPQ.js.map +0 -1
- package/dist/chunk-4QINFQ27.js.map +0 -1
- package/dist/chunk-55VKZUQY.js.map +0 -1
- package/dist/chunk-7Y7UYNGL.js.map +0 -1
- package/dist/chunk-ANSZULXH.js.map +0 -1
- package/dist/chunk-B6I7SF2X.js.map +0 -1
- package/dist/chunk-D5WTOVLG.js.map +0 -1
- package/dist/chunk-GQ5OYFVD.js.map +0 -1
- package/dist/chunk-GV3MFKDV.js.map +0 -1
- package/dist/chunk-J76LDUDS.js.map +0 -1
- package/dist/chunk-JJLH4TX4.js.map +0 -1
- package/dist/chunk-MGM5EJQQ.js.map +0 -1
- package/dist/chunk-NKDSU4Q7.js.map +0 -1
- package/dist/chunk-NOF73BUH.js.map +0 -1
- package/dist/chunk-NVBN3YOH.js.map +0 -1
- package/dist/chunk-OOQ5Q75W.js.map +0 -1
- package/dist/chunk-PQF5QHVS.js.map +0 -1
- package/dist/chunk-R37L4BNR.js.map +0 -1
- package/dist/chunk-RTYDYSUV.js.map +0 -1
- package/dist/chunk-SP5NGNBV.js.map +0 -1
- package/dist/chunk-TCWECSEB.js.map +0 -1
- package/dist/chunk-VY6NTFE7.js.map +0 -1
- package/dist/chunk-WWUWMOX2.js.map +0 -1
- package/dist/chunk-X5O56UO4.js.map +0 -1
- package/dist/library-publish-EQFYHJ6G.js.map +0 -1
- package/dist/plugin-store-BIITCNOZ.js.map +0 -1
- package/dist/project-5HW3XSOE.js +0 -82
- package/dist/serve-preflight-GD7IQFA3.js.map +0 -1
- package/dist/setup-52NDDR7C.js.map +0 -1
- package/dist/source-manifest-publish-3HAX6DPN.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 } from '../../chunk-
|
|
5
|
-
import { dispatchCapability } from '../../chunk-
|
|
6
|
-
import { fetchProviderModels } from '../../chunk-
|
|
4
|
+
import { scrubPoisonedTranscript, transcriptStoreForRuntime, resolveClaudeConfigDir, claudeEndpointMode, buildClaudeEndpointEnv, APPROVE_ONCE, DENY } from '../../chunk-3OYOBTY4.js';
|
|
5
|
+
import { dispatchCapability } from '../../chunk-AJ7EGIFR.js';
|
|
6
|
+
import { fetchProviderModels } from '../../chunk-ZPCABSSW.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-QSLXB44M.js';
|
|
10
|
+
import { BUILTIN_DRIVER_CATALOG, entryCredentialValue } from '../../chunk-LQT2IKYY.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-YK3XLEQJ.js';
|
|
14
|
+
import { loadDriverSdk } from '../../chunk-PIC23DDE.js';
|
|
15
15
|
import '../../chunk-4GY63JU6.js';
|
|
16
|
-
import '../../chunk-
|
|
16
|
+
import '../../chunk-5RDZ5JHH.js';
|
|
17
17
|
import '../../chunk-D54T2F54.js';
|
|
18
18
|
import '../../chunk-5BEFNLOR.js';
|
|
19
19
|
import '../../chunk-A2ULN3KX.js';
|
|
20
|
-
import '../../chunk-
|
|
20
|
+
import '../../chunk-ZVZTCDUN.js';
|
|
21
21
|
import '../../chunk-L5VSIPQD.js';
|
|
22
22
|
import '../../chunk-IG5LZ3WU.js';
|
|
23
|
-
import '../../chunk-
|
|
23
|
+
import '../../chunk-H7R7R5BN.js';
|
|
24
24
|
import '../../chunk-RVRB27AN.js';
|
|
25
|
-
import '../../chunk-
|
|
26
|
-
import '../../chunk-
|
|
25
|
+
import '../../chunk-YW2BNDSE.js';
|
|
26
|
+
import '../../chunk-FT4ZHLYR.js';
|
|
27
27
|
import '../../chunk-ICSCSM5D.js';
|
|
28
28
|
import '../../chunk-DKXNKFKP.js';
|
|
29
29
|
import { mergeRegistries, parseModelRef, isEntryEnabled, resolveEntryBaseUrl } from '../../chunk-MJHSLODD.js';
|
|
@@ -31,6 +31,7 @@ import '../../chunk-C3CAXQMA.js';
|
|
|
31
31
|
import { createLogger } from '../../chunk-BOFL7GIF.js';
|
|
32
32
|
import '../../chunk-NSBPE2FW.js';
|
|
33
33
|
import { spawnSync, spawn } from 'child_process';
|
|
34
|
+
import { randomUUID } from 'crypto';
|
|
34
35
|
import { readFileSync, existsSync } from 'fs';
|
|
35
36
|
import { createRequire } from 'module';
|
|
36
37
|
import * as zNS from 'zod';
|
|
@@ -173,12 +174,18 @@ var SelfTurnTracker = class {
|
|
|
173
174
|
}
|
|
174
175
|
emit;
|
|
175
176
|
active = false;
|
|
176
|
-
/**
|
|
177
|
+
/** The self-started turn took a prompt pushed while it ran: its result answers that prompt too. */
|
|
177
178
|
joined = false;
|
|
178
|
-
/**
|
|
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. */
|
|
179
184
|
settled = /* @__PURE__ */ new Set();
|
|
180
185
|
/** Tasks registered in the foreground: reported only if they move to the background. */
|
|
181
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();
|
|
182
189
|
/** Whether the turn running now is one the driver did not prompt. */
|
|
183
190
|
get selfTurnActive() {
|
|
184
191
|
return this.active;
|
|
@@ -196,6 +203,7 @@ var SelfTurnTracker = class {
|
|
|
196
203
|
}
|
|
197
204
|
if (msg.type !== "assistant" && msg.type !== "stream_event" && msg.type !== "user") return;
|
|
198
205
|
if (msg.parent_tool_use_id) return;
|
|
206
|
+
this.observeConsumedPrompts(msg);
|
|
199
207
|
if (inTurn) return;
|
|
200
208
|
this.active = true;
|
|
201
209
|
const taskIds = [...this.settled];
|
|
@@ -210,17 +218,30 @@ var SelfTurnTracker = class {
|
|
|
210
218
|
return this.active && !this.joined;
|
|
211
219
|
}
|
|
212
220
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
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.
|
|
215
224
|
*/
|
|
216
|
-
|
|
217
|
-
|
|
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;
|
|
218
238
|
}
|
|
219
239
|
/** The running turn's `result` was handled. */
|
|
220
240
|
onResult() {
|
|
221
241
|
if (!this.active) return;
|
|
222
242
|
this.active = false;
|
|
223
243
|
this.joined = false;
|
|
244
|
+
this.queuedPrompt = null;
|
|
224
245
|
this.settled.clear();
|
|
225
246
|
}
|
|
226
247
|
/**
|
|
@@ -234,8 +255,20 @@ var SelfTurnTracker = class {
|
|
|
234
255
|
reset() {
|
|
235
256
|
this.active = false;
|
|
236
257
|
this.joined = false;
|
|
258
|
+
this.queuedPrompt = null;
|
|
259
|
+
this.stampsPrompts = false;
|
|
237
260
|
this.settled.clear();
|
|
238
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
|
+
}
|
|
239
272
|
}
|
|
240
273
|
observeTask(msg, inTurn) {
|
|
241
274
|
const taskId = msg.task_id;
|
|
@@ -262,11 +295,12 @@ var SelfTurnTracker = class {
|
|
|
262
295
|
}
|
|
263
296
|
if (msg.subtype === "task_notification") {
|
|
264
297
|
this.foreground.delete(taskId);
|
|
265
|
-
if (!ambient) remember(this.settled, taskId);
|
|
298
|
+
if (!ambient && this.reported.has(taskId)) remember(this.settled, taskId);
|
|
266
299
|
}
|
|
267
300
|
}
|
|
268
301
|
reportStarted(taskId, inTurn) {
|
|
269
302
|
if (!inTurn) return;
|
|
303
|
+
remember(this.reported, taskId);
|
|
270
304
|
this.emit({ type: "background_task_started", taskId });
|
|
271
305
|
}
|
|
272
306
|
};
|
|
@@ -382,6 +416,7 @@ function sanitizeAssistantText(text) {
|
|
|
382
416
|
return changed ? out.replace(/\s+$/, "") : out;
|
|
383
417
|
}
|
|
384
418
|
var TAG_PREFIXES = [
|
|
419
|
+
"function_calls",
|
|
385
420
|
"function_call",
|
|
386
421
|
"function_cal",
|
|
387
422
|
"function_ca",
|
|
@@ -421,18 +456,31 @@ var TAG_PREFIXES = [
|
|
|
421
456
|
"sy",
|
|
422
457
|
"s"
|
|
423
458
|
].join("|");
|
|
424
|
-
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;
|
|
425
464
|
var UNCLOSED_OPENER = new RegExp(`\\[\\s*${NS}function_calls\\s*\\]|\\[\\s*${NS}invoke\\b`, "i");
|
|
426
|
-
function
|
|
427
|
-
let cleaned = sanitizeAssistantText(text);
|
|
465
|
+
function cutAtUnclosedOpener(cleaned) {
|
|
428
466
|
const opener = UNCLOSED_OPENER.exec(cleaned);
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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));
|
|
432
476
|
const tail = PARTIAL_MARKER_TAIL.exec(cleaned);
|
|
433
477
|
if (tail && tail.index >= 0) {
|
|
434
478
|
cleaned = cleaned.slice(0, tail.index);
|
|
435
479
|
}
|
|
480
|
+
const label = ROLE_LABEL_TAIL.exec(cleaned);
|
|
481
|
+
if (label?.[1]) {
|
|
482
|
+
cleaned = cleaned.slice(0, cleaned.length - label[1].length);
|
|
483
|
+
}
|
|
436
484
|
return cleaned.replace(/\s+$/, "");
|
|
437
485
|
}
|
|
438
486
|
|
|
@@ -443,41 +491,60 @@ function capabilityToolsKey(tools) {
|
|
|
443
491
|
[...tools].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0).map((t) => [t.name, t.description, t.parameters])
|
|
444
492
|
);
|
|
445
493
|
}
|
|
446
|
-
|
|
494
|
+
var LOOSE_SCHEMA_MAX_DEPTH = 6;
|
|
495
|
+
function looseShape(schema, z2, depth, nested) {
|
|
447
496
|
const props = schema?.properties ?? null;
|
|
448
|
-
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;
|
|
449
501
|
const required = new Set(Array.isArray(schema?.required) ? schema.required : []);
|
|
450
502
|
const out = {};
|
|
451
|
-
for (const
|
|
452
|
-
let zod;
|
|
453
|
-
switch (def?.type) {
|
|
454
|
-
case "string":
|
|
455
|
-
zod = z2.string();
|
|
456
|
-
break;
|
|
457
|
-
case "number":
|
|
458
|
-
case "integer":
|
|
459
|
-
zod = z2.number();
|
|
460
|
-
break;
|
|
461
|
-
case "boolean":
|
|
462
|
-
zod = z2.boolean();
|
|
463
|
-
break;
|
|
464
|
-
case "array":
|
|
465
|
-
zod = z2.array(z2.any());
|
|
466
|
-
break;
|
|
467
|
-
case "object":
|
|
468
|
-
zod = z2.record(z2.string(), z2.any());
|
|
469
|
-
break;
|
|
470
|
-
default:
|
|
471
|
-
zod = z2.any();
|
|
472
|
-
}
|
|
473
|
-
if (def?.description && typeof def.description === "string") {
|
|
474
|
-
zod = zod.describe(def.description);
|
|
475
|
-
}
|
|
503
|
+
for (const key of keys) {
|
|
504
|
+
let zod = looseType(props[key], z2, depth + 1);
|
|
476
505
|
if (!required.has(key)) zod = zod.optional();
|
|
477
506
|
out[key] = zod;
|
|
478
507
|
}
|
|
479
508
|
return out;
|
|
480
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
|
+
}
|
|
481
548
|
if (typeof globalThis.require === "undefined") {
|
|
482
549
|
try {
|
|
483
550
|
const metaUrl = (0, eval)("import.meta.url");
|
|
@@ -655,6 +722,36 @@ function diffModelUsage(current, previous) {
|
|
|
655
722
|
var QUESTION_SUPERSEDED_BY_PROMPT = "The user replied in chat instead of answering this dialog, so the question was cancelled. Their reply arrives as the next user turn \u2014 read it before you re-ask or assume an answer.";
|
|
656
723
|
var claudeBinaryCache;
|
|
657
724
|
var claudeBinaryResolved = false;
|
|
725
|
+
function isApproval(answer) {
|
|
726
|
+
return /^(approve once|approve|allow|yes|y)$/i.test(answer.trim());
|
|
727
|
+
}
|
|
728
|
+
var MAX_APPROVAL_DETAIL = 2e3;
|
|
729
|
+
function describeToolApproval(toolName, input) {
|
|
730
|
+
const text = (value) => {
|
|
731
|
+
const raw = typeof value === "string" ? value : JSON.stringify(value) ?? "";
|
|
732
|
+
return raw.length > MAX_APPROVAL_DETAIL ? `${raw.slice(0, MAX_APPROVAL_DETAIL)}\u2026` : raw;
|
|
733
|
+
};
|
|
734
|
+
if (toolName === "Bash") return { kind: "command", details: [text(input.command ?? input)] };
|
|
735
|
+
if (["Edit", "MultiEdit", "Write", "NotebookEdit"].includes(toolName)) {
|
|
736
|
+
return { kind: "file", details: [text(input.file_path ?? input.notebook_path ?? input)] };
|
|
737
|
+
}
|
|
738
|
+
const detail = text(input) || toolName;
|
|
739
|
+
return { kind: toolName.startsWith("mcp__") ? "mcp" : "permissions", details: [detail] };
|
|
740
|
+
}
|
|
741
|
+
function withoutExpectedSdkWarnings(fn) {
|
|
742
|
+
const original = process.emitWarning;
|
|
743
|
+
process.emitWarning = function(warning, ...args) {
|
|
744
|
+
const first = args[0];
|
|
745
|
+
const code = typeof first === "object" && first !== null ? first.code : typeof args[1] === "string" ? args[1] : void 0;
|
|
746
|
+
if (code === "CLAUDE_SDK_CAN_USE_TOOL_SHADOWED") return;
|
|
747
|
+
return original.call(process, warning, ...args);
|
|
748
|
+
};
|
|
749
|
+
try {
|
|
750
|
+
return fn();
|
|
751
|
+
} finally {
|
|
752
|
+
process.emitWarning = original;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
658
755
|
var ClaudeSdkDriver = class extends AgentDriver {
|
|
659
756
|
driverInfo = {
|
|
660
757
|
id: "claude-sdk",
|
|
@@ -673,11 +770,14 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
673
770
|
toolIdToName = /* @__PURE__ */ new Map();
|
|
674
771
|
prevText = "";
|
|
675
772
|
/**
|
|
676
|
-
*
|
|
677
|
-
* Lets {@link handleStreamEvent} emit only the
|
|
678
|
-
*
|
|
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.
|
|
679
777
|
*/
|
|
680
|
-
|
|
778
|
+
emittedSanitizedText = "";
|
|
779
|
+
/** Set once this message's sanitized text stopped extending what was streamed (logged once). */
|
|
780
|
+
streamDiverged = false;
|
|
681
781
|
/** Set once the streaming text of the current message classifies as a self-healable auth render. */
|
|
682
782
|
suppressingAuthStream = false;
|
|
683
783
|
/**
|
|
@@ -774,6 +874,11 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
774
874
|
subagentToolAllowlists = /* @__PURE__ */ new Map();
|
|
775
875
|
/** Guards against duplicate agent_end emissions per turn. */
|
|
776
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;
|
|
777
882
|
/** Announces the turns the CLI starts by itself and the background tasks they continue. */
|
|
778
883
|
selfTurns = new SelfTurnTracker((event) => {
|
|
779
884
|
try {
|
|
@@ -883,6 +988,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
883
988
|
* transcript). Null when no question is pending.
|
|
884
989
|
*/
|
|
885
990
|
pendingQuestion = null;
|
|
991
|
+
/** Tool approvals waiting behind the one on screen; each is shown once the one before is answered. */
|
|
992
|
+
approvalQueue = [];
|
|
886
993
|
/** Cached slash commands discovered from the SDK. */
|
|
887
994
|
cachedCommands = [];
|
|
888
995
|
/** Token usage from the most recent completed turn. */
|
|
@@ -903,15 +1010,17 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
903
1010
|
/** Per-model usage of the most recent completed turn, derived in `captureResultUsage`. */
|
|
904
1011
|
_lastModelUsage = null;
|
|
905
1012
|
/**
|
|
906
|
-
* 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
|
|
907
1015
|
* `total_cost_usd` it is cumulative over the whole SDK run, so a turn's share
|
|
908
1016
|
* is the per-model difference against this snapshot.
|
|
909
1017
|
*/
|
|
910
1018
|
_lastCumulativeModelUsage = null;
|
|
911
1019
|
/**
|
|
912
|
-
* The SDK's `total_cost_usd` from the most recently seen result message
|
|
913
|
-
* cumulative over the whole SDK
|
|
914
|
-
* 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.
|
|
915
1024
|
*/
|
|
916
1025
|
_lastCumulativeCostUsd = 0;
|
|
917
1026
|
/** Per-turn cost delta derived from `total_cost_usd`, emitted as the `result` event's `costUsd`. */
|
|
@@ -919,13 +1028,19 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
919
1028
|
/** Whether the last result carried `total_cost_usd`; 0 alone cannot tell a free turn from an unreported one. */
|
|
920
1029
|
_lastCostReported = false;
|
|
921
1030
|
/**
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
*
|
|
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.
|
|
925
1042
|
*/
|
|
926
|
-
|
|
927
|
-
/** Spawn generation `_lastCumulativeCostUsd` was captured under. */
|
|
928
|
-
_costTrackingGeneration = -1;
|
|
1043
|
+
_staleRestoreFallback = null;
|
|
929
1044
|
/**
|
|
930
1045
|
* `true` when the active credential is a Claude Code OAuth subscription
|
|
931
1046
|
* (no API key in config) rather than a raw `ANTHROPIC_API_KEY`. Set on
|
|
@@ -1141,7 +1256,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1141
1256
|
}
|
|
1142
1257
|
this.running = true;
|
|
1143
1258
|
this.prevText = "";
|
|
1144
|
-
this.
|
|
1259
|
+
this.emittedSanitizedText = "";
|
|
1260
|
+
this.streamDiverged = false;
|
|
1145
1261
|
this.suppressingAuthStream = false;
|
|
1146
1262
|
this.suppressedAuthRenderText = null;
|
|
1147
1263
|
this.lastApiErrorRender = null;
|
|
@@ -1157,8 +1273,9 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1157
1273
|
});
|
|
1158
1274
|
try {
|
|
1159
1275
|
if (this.query && this.inputStream) {
|
|
1160
|
-
this.
|
|
1161
|
-
this.
|
|
1276
|
+
const userMessage = this.buildUserMessage(message);
|
|
1277
|
+
this.inputStream.push(userMessage);
|
|
1278
|
+
this.selfTurns.onPromptPushed(userMessage.uuid);
|
|
1162
1279
|
} else {
|
|
1163
1280
|
await this.startQuery(message);
|
|
1164
1281
|
}
|
|
@@ -1551,10 +1668,11 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1551
1668
|
* were cut from, so it matches what the consumer received exactly.
|
|
1552
1669
|
*/
|
|
1553
1670
|
retractUnfinishedText() {
|
|
1554
|
-
if (this.
|
|
1555
|
-
const text =
|
|
1671
|
+
if (this.emittedSanitizedText === "") return;
|
|
1672
|
+
const text = this.emittedSanitizedText;
|
|
1556
1673
|
this.prevText = "";
|
|
1557
|
-
this.
|
|
1674
|
+
this.emittedSanitizedText = "";
|
|
1675
|
+
this.streamDiverged = false;
|
|
1558
1676
|
this.log.info("retracting the unfinished text of an attempt about to be replayed", {
|
|
1559
1677
|
chars: text.length
|
|
1560
1678
|
});
|
|
@@ -1743,7 +1861,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1743
1861
|
elapsedMs: 0,
|
|
1744
1862
|
outcome: "no_session"
|
|
1745
1863
|
});
|
|
1746
|
-
return;
|
|
1864
|
+
return null;
|
|
1747
1865
|
}
|
|
1748
1866
|
try {
|
|
1749
1867
|
const scrub = await scrubPoisonedTranscript({
|
|
@@ -1766,6 +1884,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1766
1884
|
cacheStripped: scrub.cacheStripped
|
|
1767
1885
|
});
|
|
1768
1886
|
}
|
|
1887
|
+
return scrub.costState;
|
|
1769
1888
|
} catch (err) {
|
|
1770
1889
|
this.log.warn("preventive transcript scrub failed; continuing", {
|
|
1771
1890
|
phase: "transcript_scrub",
|
|
@@ -1774,8 +1893,45 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1774
1893
|
sessionId,
|
|
1775
1894
|
error: err instanceof Error ? err.message : String(err)
|
|
1776
1895
|
});
|
|
1896
|
+
return null;
|
|
1777
1897
|
}
|
|
1778
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;
|
|
1930
|
+
}
|
|
1931
|
+
this._lastCumulativeCostUsd = 0;
|
|
1932
|
+
this._lastCumulativeModelUsage = null;
|
|
1933
|
+
this._costBaselineSessionId = null;
|
|
1934
|
+
}
|
|
1779
1935
|
/**
|
|
1780
1936
|
* Resolve the AI provider registry entry this session addresses, plus
|
|
1781
1937
|
* everything derived from it: the child env, the credential, the
|
|
@@ -1825,12 +1981,13 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1825
1981
|
};
|
|
1826
1982
|
}
|
|
1827
1983
|
async startQuery(message) {
|
|
1828
|
-
this._querySpawnGeneration++;
|
|
1829
1984
|
this.queryStartedAt = Date.now();
|
|
1830
1985
|
this.awaitingFirstMessageOfSpawn = true;
|
|
1831
1986
|
this.spawnResumed = !!(this.config.resumeSessionId || this.sessionId || this.hasSession);
|
|
1987
|
+
const resumedSessionId = this.config.resumeSessionId || this.sessionId || null;
|
|
1832
1988
|
this.abortController = new AbortController();
|
|
1833
|
-
await this.preventivelyScrubTranscript();
|
|
1989
|
+
const restoredCost = await this.preventivelyScrubTranscript();
|
|
1990
|
+
this.seedCostBaseline(resumedSessionId, restoredCost);
|
|
1834
1991
|
const endpoint = this.resolveEndpoint();
|
|
1835
1992
|
const spawnConfig = {
|
|
1836
1993
|
model: this.config.model,
|
|
@@ -1855,8 +2012,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1855
2012
|
strictMcpConfig: true,
|
|
1856
2013
|
// Use full Claude Code tool preset so skills, agents, etc. work
|
|
1857
2014
|
tools: { type: "preset", preset: "claude_code" },
|
|
1858
|
-
|
|
1859
|
-
allowDangerouslySkipPermissions: true,
|
|
2015
|
+
// `interactive` hands every call the SDK does not auto-allow to `canUseTool`, which asks.
|
|
2016
|
+
...this.config.permissionMode === "interactive" ? { permissionMode: "default" } : { permissionMode: "bypassPermissions", allowDangerouslySkipPermissions: true },
|
|
1860
2017
|
// AskUserQuestion routes through canUseTool even under bypassPermissions
|
|
1861
2018
|
// (ask-rule evaluation precedes permission-mode evaluation in the SDK),
|
|
1862
2019
|
// so this is the only place the turn can pause to collect a real answer.
|
|
@@ -1980,7 +2137,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
1980
2137
|
options
|
|
1981
2138
|
};
|
|
1982
2139
|
if (apiKey) queryArgs.apiKey = apiKey;
|
|
1983
|
-
this.query = query(queryArgs);
|
|
2140
|
+
this.query = withoutExpectedSdkWarnings(() => query(queryArgs));
|
|
1984
2141
|
this.reconfig.setSnapshot({
|
|
1985
2142
|
...spawnConfig,
|
|
1986
2143
|
providerId: endpoint.providerId,
|
|
@@ -2008,6 +2165,9 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2008
2165
|
const denial = this.toolAllowlistDenialFor(toolName, opts.agentID);
|
|
2009
2166
|
if (denial) return Promise.resolve({ behavior: "deny", message: denial });
|
|
2010
2167
|
if (toolName !== "AskUserQuestion") {
|
|
2168
|
+
if (this.config.permissionMode === "interactive") {
|
|
2169
|
+
return this.askToolApproval(toolName, input, opts.signal);
|
|
2170
|
+
}
|
|
2011
2171
|
return Promise.resolve({ behavior: "allow", updatedInput: input });
|
|
2012
2172
|
}
|
|
2013
2173
|
const rawQuestions = Array.isArray(input.questions) ? input.questions : [];
|
|
@@ -2034,6 +2194,91 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2034
2194
|
this.log.debug("paused on AskUserQuestion", { questions: questionTexts.length });
|
|
2035
2195
|
});
|
|
2036
2196
|
};
|
|
2197
|
+
/**
|
|
2198
|
+
* `permissionMode: "interactive"`: pause the turn on an approval card for a tool call the SDK
|
|
2199
|
+
* did not auto-allow. The reply goes through {@link answerQuestion} like an `AskUserQuestion`
|
|
2200
|
+
* answer; anything but an approval denies. A session nobody can answer refuses the call.
|
|
2201
|
+
*/
|
|
2202
|
+
askToolApproval(toolName, input, signal) {
|
|
2203
|
+
if (this.config.unattended) {
|
|
2204
|
+
return Promise.resolve({
|
|
2205
|
+
behavior: "deny",
|
|
2206
|
+
message: `${toolName} needs approval (permission_mode: interactive) and this session has no one to ask`
|
|
2207
|
+
});
|
|
2208
|
+
}
|
|
2209
|
+
return new Promise((resolve) => {
|
|
2210
|
+
const entry = { toolName, input, resolve };
|
|
2211
|
+
signal.addEventListener(
|
|
2212
|
+
"abort",
|
|
2213
|
+
() => {
|
|
2214
|
+
const queued = this.approvalQueue.indexOf(entry);
|
|
2215
|
+
if (queued >= 0) {
|
|
2216
|
+
this.approvalQueue.splice(queued, 1);
|
|
2217
|
+
resolve({
|
|
2218
|
+
behavior: "deny",
|
|
2219
|
+
message: "session aborted before the approval was answered"
|
|
2220
|
+
});
|
|
2221
|
+
} else if (this.pendingQuestion?.resolve === resolve) {
|
|
2222
|
+
this.denyPendingQuestion("session aborted before the approval was answered");
|
|
2223
|
+
this.presentNextApproval();
|
|
2224
|
+
}
|
|
2225
|
+
},
|
|
2226
|
+
{ once: true }
|
|
2227
|
+
);
|
|
2228
|
+
if (this.pendingQuestion) this.approvalQueue.push(entry);
|
|
2229
|
+
else this.presentApproval(entry);
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
/** Show the approval card of one tool call and make it the pending question. */
|
|
2233
|
+
presentApproval(entry) {
|
|
2234
|
+
const { toolName, input, resolve } = entry;
|
|
2235
|
+
const { kind, details } = describeToolApproval(toolName, input);
|
|
2236
|
+
const question = `Allow ${toolName}?`;
|
|
2237
|
+
this.pendingQuestion = {
|
|
2238
|
+
resolve,
|
|
2239
|
+
originalInput: input,
|
|
2240
|
+
questionTexts: [question],
|
|
2241
|
+
slots: new AskSlots([question]),
|
|
2242
|
+
answers: {},
|
|
2243
|
+
approval: true
|
|
2244
|
+
};
|
|
2245
|
+
const callId = `approval-${randomUUID()}`;
|
|
2246
|
+
const cardInput = {
|
|
2247
|
+
requestId: callId,
|
|
2248
|
+
questions: [{ question, options: [{ label: APPROVE_ONCE }, { label: DENY }] }],
|
|
2249
|
+
approval: { kind, details }
|
|
2250
|
+
};
|
|
2251
|
+
this.emit("agent-event", {
|
|
2252
|
+
type: "message_start",
|
|
2253
|
+
message: {
|
|
2254
|
+
role: "assistant",
|
|
2255
|
+
content: [{ type: "tool_use", name: "AskUserQuestion", id: callId, input: cardInput }]
|
|
2256
|
+
}
|
|
2257
|
+
});
|
|
2258
|
+
this.emit("agent-event", {
|
|
2259
|
+
type: "tool_call",
|
|
2260
|
+
name: "AskUserQuestion",
|
|
2261
|
+
tool: { name: "AskUserQuestion" },
|
|
2262
|
+
toolCallId: callId,
|
|
2263
|
+
input: cardInput
|
|
2264
|
+
});
|
|
2265
|
+
this.log.debug("paused on a tool approval", {
|
|
2266
|
+
tool: toolName,
|
|
2267
|
+
queued: this.approvalQueue.length
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
/** Once nothing is on screen, show the next queued approval. */
|
|
2271
|
+
presentNextApproval() {
|
|
2272
|
+
if (this.pendingQuestion) return;
|
|
2273
|
+
const next = this.approvalQueue.shift();
|
|
2274
|
+
if (next) this.presentApproval(next);
|
|
2275
|
+
}
|
|
2276
|
+
/** Deny the pending question and every queued approval (abort, kill, reset, a new prompt). */
|
|
2277
|
+
denyAllPending(reason) {
|
|
2278
|
+
this.denyPendingQuestion(reason);
|
|
2279
|
+
const queued = this.approvalQueue.splice(0);
|
|
2280
|
+
for (const entry of queued) entry.resolve({ behavior: "deny", message: reason });
|
|
2281
|
+
}
|
|
2037
2282
|
/**
|
|
2038
2283
|
* Denial reason when the per-turn allowlist forbids `toolName`, else `null`.
|
|
2039
2284
|
* A subagent seen under a restricted turn is bound to that turn's allowlist
|
|
@@ -2071,7 +2316,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2071
2316
|
return {};
|
|
2072
2317
|
};
|
|
2073
2318
|
supersedePendingQuestion() {
|
|
2074
|
-
this.
|
|
2319
|
+
this.denyAllPending(QUESTION_SUPERSEDED_BY_PROMPT);
|
|
2075
2320
|
}
|
|
2076
2321
|
hasPendingQuestion() {
|
|
2077
2322
|
return this.pendingQuestion !== null;
|
|
@@ -2086,11 +2331,21 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2086
2331
|
if (complete) {
|
|
2087
2332
|
this.pendingQuestion = null;
|
|
2088
2333
|
this.lastSdkMessageAt = Date.now();
|
|
2334
|
+
if (pending.approval) {
|
|
2335
|
+
const approved = isApproval(pending.answers[pending.questionTexts[0]] ?? answer);
|
|
2336
|
+
pending.resolve(
|
|
2337
|
+
approved ? { behavior: "allow", updatedInput: pending.originalInput } : { behavior: "deny", message: "the user denied this tool call" }
|
|
2338
|
+
);
|
|
2339
|
+
this.log.debug("answered a tool approval", { approved });
|
|
2340
|
+
this.presentNextApproval();
|
|
2341
|
+
return true;
|
|
2342
|
+
}
|
|
2089
2343
|
pending.resolve({
|
|
2090
2344
|
behavior: "allow",
|
|
2091
2345
|
updatedInput: { ...pending.originalInput, answers: pending.answers }
|
|
2092
2346
|
});
|
|
2093
2347
|
this.log.debug("answered AskUserQuestion", { questions: pending.questionTexts.length });
|
|
2348
|
+
this.presentNextApproval();
|
|
2094
2349
|
}
|
|
2095
2350
|
return true;
|
|
2096
2351
|
}
|
|
@@ -2158,10 +2413,11 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2158
2413
|
*
|
|
2159
2414
|
* A tool whose declared schema has a property key the API rejects
|
|
2160
2415
|
* ({@link checkToolPropertyKeys}) is left out and reported in `dropped`.
|
|
2161
|
-
* Only the key rule applies here: `jsonSchemaToZodLoose` copies
|
|
2162
|
-
* verbatim
|
|
2163
|
-
* array/record/any,
|
|
2164
|
-
*
|
|
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.
|
|
2165
2421
|
*/
|
|
2166
2422
|
async buildCapabilityMcpServer() {
|
|
2167
2423
|
const dropped = [];
|
|
@@ -2280,7 +2536,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2280
2536
|
this.firstSdkMessageSeen = true;
|
|
2281
2537
|
this.captureSessionId(msg);
|
|
2282
2538
|
this.handleSdkMessage(msg);
|
|
2283
|
-
if (msg.type === "result" && !msg.is_error) {
|
|
2539
|
+
if (msg.type === "result" && !msg.is_error && !this.resultEndedWakeOnly) {
|
|
2284
2540
|
this.completeTurn();
|
|
2285
2541
|
}
|
|
2286
2542
|
}
|
|
@@ -2705,10 +2961,12 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2705
2961
|
this.log.info("suppressing SDK auth-error assistant text; self-heal will retry");
|
|
2706
2962
|
this.stashSuppressedAuthRender(this.assistantTextOf(agentMsg));
|
|
2707
2963
|
this.prevText = "";
|
|
2708
|
-
this.
|
|
2964
|
+
this.emittedSanitizedText = "";
|
|
2965
|
+
this.streamDiverged = false;
|
|
2709
2966
|
this.suppressingAuthStream = false;
|
|
2710
2967
|
return;
|
|
2711
2968
|
}
|
|
2969
|
+
this.flushHeldBackText();
|
|
2712
2970
|
this.emit("agent-event", { type: "message_start", message: agentMsg });
|
|
2713
2971
|
if (agentMsg.toolCalls) {
|
|
2714
2972
|
for (const tc of agentMsg.toolCalls) {
|
|
@@ -2722,7 +2980,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2722
2980
|
}
|
|
2723
2981
|
}
|
|
2724
2982
|
this.prevText = "";
|
|
2725
|
-
this.
|
|
2983
|
+
this.emittedSanitizedText = "";
|
|
2984
|
+
this.streamDiverged = false;
|
|
2726
2985
|
this.suppressingAuthStream = false;
|
|
2727
2986
|
this.suppressedAuthRenderText = null;
|
|
2728
2987
|
this.emit("agent-event", { type: "message_end", message: agentMsg });
|
|
@@ -2808,20 +3067,55 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2808
3067
|
this.stashSuppressedAuthRender(this.prevText);
|
|
2809
3068
|
return;
|
|
2810
3069
|
}
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
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
|
|
2823
3115
|
});
|
|
3116
|
+
return;
|
|
2824
3117
|
}
|
|
3118
|
+
this.emitSanitizedDelta(final);
|
|
2825
3119
|
}
|
|
2826
3120
|
handleUserMessage(msg) {
|
|
2827
3121
|
const toolResults = this.mapToolResults(msg);
|
|
@@ -2837,6 +3131,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2837
3131
|
}
|
|
2838
3132
|
}
|
|
2839
3133
|
handleResultMessage(msg) {
|
|
3134
|
+
this.resultEndedWakeOnly = this.selfTurns.resultEndsWakeOnly;
|
|
2840
3135
|
this.captureResultUsage(msg);
|
|
2841
3136
|
if (msg.subtype === "success" && !msg.is_error) {
|
|
2842
3137
|
this.handleSuccessResult(msg);
|
|
@@ -2889,10 +3184,22 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2889
3184
|
const reportedCostUsd = msg.total_cost_usd;
|
|
2890
3185
|
this._lastCostReported = typeof reportedCostUsd === "number";
|
|
2891
3186
|
const totalCostUsd = reportedCostUsd ?? 0;
|
|
2892
|
-
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;
|
|
2893
3200
|
this._lastTurnCostUsd = freshCostSession ? totalCostUsd : totalCostUsd - this._lastCumulativeCostUsd;
|
|
2894
3201
|
this._lastCumulativeCostUsd = totalCostUsd;
|
|
2895
|
-
this.
|
|
3202
|
+
this._costBaselineSessionId = this._lastCostReported ? this.sessionId || null : null;
|
|
2896
3203
|
if (modelUsage) {
|
|
2897
3204
|
this._lastModelUsage = diffModelUsage(
|
|
2898
3205
|
modelUsage,
|
|
@@ -2957,7 +3264,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
2957
3264
|
this.emit("agent-event", this.withFailoverUsage(resultEvent));
|
|
2958
3265
|
}
|
|
2959
3266
|
const awaitingFollowUpThrow = looseMsg.is_error === true && errors.length === 0;
|
|
2960
|
-
if (!this.turnCompleted && !awaitingFollowUpThrow) {
|
|
3267
|
+
if (!this.turnCompleted && !awaitingFollowUpThrow && !this.resultEndedWakeOnly) {
|
|
2961
3268
|
this.completeTurn();
|
|
2962
3269
|
}
|
|
2963
3270
|
}
|
|
@@ -3026,9 +3333,11 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3026
3333
|
this.emit("agent-event", {
|
|
3027
3334
|
type: "error",
|
|
3028
3335
|
error: errorText,
|
|
3029
|
-
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 } : {}
|
|
3030
3339
|
});
|
|
3031
|
-
} else {
|
|
3340
|
+
} else if (!this.resultEndedWakeOnly) {
|
|
3032
3341
|
this.armErrorResultGrace(detail, {
|
|
3033
3342
|
subtype: msg.subtype,
|
|
3034
3343
|
terminalReason: msg.terminal_reason
|
|
@@ -3039,10 +3348,14 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3039
3348
|
// ---------------------------------------------------------------------------
|
|
3040
3349
|
// Helpers
|
|
3041
3350
|
// ---------------------------------------------------------------------------
|
|
3042
|
-
/**
|
|
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
|
+
*/
|
|
3043
3355
|
buildUserMessage(text) {
|
|
3044
3356
|
return {
|
|
3045
3357
|
type: "user",
|
|
3358
|
+
uuid: randomUUID(),
|
|
3046
3359
|
message: {
|
|
3047
3360
|
role: "user",
|
|
3048
3361
|
content: text
|
|
@@ -3112,7 +3425,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3112
3425
|
* down outright — see {@link hardResetQuery}.
|
|
3113
3426
|
*/
|
|
3114
3427
|
async abort() {
|
|
3115
|
-
this.
|
|
3428
|
+
this.denyAllPending("turn aborted before the question was answered");
|
|
3116
3429
|
if (!this.running && this.query) return;
|
|
3117
3430
|
const abortedQuery = this.query;
|
|
3118
3431
|
const abortedController = this.abortController;
|
|
@@ -3152,7 +3465,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3152
3465
|
* needs to be snapshotted before `query.close()` runs, not after.
|
|
3153
3466
|
*/
|
|
3154
3467
|
kill() {
|
|
3155
|
-
this.
|
|
3468
|
+
this.denyAllPending("session terminated before the question was answered");
|
|
3156
3469
|
this.killed = true;
|
|
3157
3470
|
if (this.turnReject) this.rejectTurnSilently(new Error(KILLED_TURN_MESSAGE));
|
|
3158
3471
|
const descendants = this.snapshotDescendantPids();
|
|
@@ -3213,7 +3526,7 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3213
3526
|
});
|
|
3214
3527
|
}
|
|
3215
3528
|
async resetSession() {
|
|
3216
|
-
this.
|
|
3529
|
+
this.denyAllPending("session reset before the question was answered");
|
|
3217
3530
|
const descendants = this.snapshotDescendantPids();
|
|
3218
3531
|
this.endInputStream();
|
|
3219
3532
|
if (this.query) {
|
|
@@ -3237,7 +3550,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
|
|
|
3237
3550
|
this._lastCumulativeCostUsd = 0;
|
|
3238
3551
|
this._lastTurnCostUsd = 0;
|
|
3239
3552
|
this._lastCostReported = false;
|
|
3240
|
-
this.
|
|
3553
|
+
this._costBaselineSessionId = null;
|
|
3554
|
+
this._staleRestoreFallback = null;
|
|
3241
3555
|
}
|
|
3242
3556
|
/**
|
|
3243
3557
|
* Build allowedTools / disallowedTools options from AgentConfig.tools.
|
|
@@ -3319,6 +3633,6 @@ var claudeSdkDriverTarget = {
|
|
|
3319
3633
|
}).listModels()
|
|
3320
3634
|
};
|
|
3321
3635
|
|
|
3322
|
-
export { ClaudeSdkDriver, claudeSdkDriverTarget, diffModelUsage };
|
|
3636
|
+
export { ClaudeSdkDriver, claudeSdkDriverTarget, diffModelUsage, withoutExpectedSdkWarnings };
|
|
3323
3637
|
//# sourceMappingURL=claude-sdk.js.map
|
|
3324
3638
|
//# sourceMappingURL=claude-sdk.js.map
|