@skaile/workspaces 5.7.0 → 5.8.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 +114 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-K36CR52Q.js → asset-feeds-EYRZR4K5.js} +54 -30
- package/dist/asset-feeds-EYRZR4K5.js.map +1 -0
- package/dist/asset-manager/catalog-deployer.js +9 -9
- package/dist/asset-manager/index.js +15 -15
- package/dist/asset-manager/installer.js +11 -11
- package/dist/asset-manager/renderers.js +10 -10
- package/dist/asset-manager/src/index.d.ts +268 -24
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/install-agent.d.ts +11 -0
- package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +2 -2
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +147 -211
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +90 -66
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +14 -15
- package/dist/bridge/drivers/continue.js.map +1 -1
- package/dist/bridge/drivers/echo.js +4 -4
- package/dist/bridge/drivers/gemini.js +8 -8
- package/dist/bridge/drivers/goose.js +14 -15
- package/dist/bridge/drivers/goose.js.map +1 -1
- package/dist/bridge/drivers/omp.js +68 -104
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +14 -15
- package/dist/bridge/drivers/opencode.js.map +1 -1
- package/dist/bridge/drivers/qwen.js +8 -8
- package/dist/bridge/index.js +16 -17
- package/dist/bridge/src/codex/managed-driver.d.ts +13 -10
- package/dist/bridge/src/codex/managed-driver.d.ts.map +1 -1
- package/dist/bridge/src/drivers/_subprocess-cli.d.ts +12 -2
- package/dist/bridge/src/drivers/_subprocess-cli.d.ts.map +1 -1
- package/dist/bridge/src/drivers/claude-sdk.d.ts +37 -62
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/codex.d.ts +26 -10
- package/dist/bridge/src/drivers/codex.d.ts.map +1 -1
- package/dist/bridge/src/drivers/continue.d.ts +2 -2
- package/dist/bridge/src/drivers/continue.d.ts.map +1 -1
- package/dist/bridge/src/drivers/gemini.d.ts +2 -2
- package/dist/bridge/src/drivers/gemini.d.ts.map +1 -1
- package/dist/bridge/src/drivers/goose.d.ts +2 -2
- package/dist/bridge/src/drivers/goose.d.ts.map +1 -1
- package/dist/bridge/src/drivers/omp.d.ts +24 -35
- package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
- package/dist/bridge/src/drivers/opencode.d.ts +2 -2
- package/dist/bridge/src/drivers/opencode.d.ts.map +1 -1
- package/dist/bridge/src/drivers/recovery-policy.d.ts +79 -0
- package/dist/bridge/src/drivers/recovery-policy.d.ts.map +1 -0
- package/dist/bridge/src/index.d.ts +1 -0
- package/dist/bridge/src/index.d.ts.map +1 -1
- package/dist/bridge/src/reconfigure-ledger.d.ts +117 -0
- package/dist/bridge/src/reconfigure-ledger.d.ts.map +1 -0
- package/dist/bridge/src/types.d.ts +57 -6
- package/dist/bridge/src/types.d.ts.map +1 -1
- package/dist/{chunk-WIEC3ZE4.js → chunk-2FRUUDZY.js} +5 -5
- package/dist/{chunk-WIEC3ZE4.js.map → chunk-2FRUUDZY.js.map} +1 -1
- package/dist/{chunk-O4Z7MAW7.js → chunk-2LWYNQK7.js} +3 -3
- package/dist/{chunk-O4Z7MAW7.js.map → chunk-2LWYNQK7.js.map} +1 -1
- package/dist/{chunk-OOLT6HGP.js → chunk-36AFURKZ.js} +7 -7
- package/dist/{chunk-OOLT6HGP.js.map → chunk-36AFURKZ.js.map} +1 -1
- package/dist/{chunk-DFFD4BFG.js → chunk-4MQS7CAF.js} +174 -86
- package/dist/chunk-4MQS7CAF.js.map +1 -0
- package/dist/{chunk-RNPHRRLG.js → chunk-4PTSR4UU.js} +3 -3
- package/dist/{chunk-RNPHRRLG.js.map → chunk-4PTSR4UU.js.map} +1 -1
- package/dist/{chunk-34C42MJX.js → chunk-6GRX5L6A.js} +5 -5
- package/dist/{chunk-34C42MJX.js.map → chunk-6GRX5L6A.js.map} +1 -1
- package/dist/{chunk-NFGRW3L7.js → chunk-7RGTAEG6.js} +3 -3
- package/dist/{chunk-NFGRW3L7.js.map → chunk-7RGTAEG6.js.map} +1 -1
- package/dist/{chunk-BTK7ECLH.js → chunk-AWQYXZVG.js} +15 -6
- package/dist/chunk-AWQYXZVG.js.map +1 -0
- package/dist/{chunk-XBSQ4KMC.js → chunk-B4X2N7JQ.js} +205 -3
- package/dist/chunk-B4X2N7JQ.js.map +1 -0
- package/dist/{chunk-FRHE7FFB.js → chunk-B6GIW55K.js} +5 -3
- package/dist/chunk-B6GIW55K.js.map +1 -0
- package/dist/{chunk-JLSCA5T5.js → chunk-BJNUNQAW.js} +3 -3
- package/dist/{chunk-JLSCA5T5.js.map → chunk-BJNUNQAW.js.map} +1 -1
- package/dist/{chunk-RVIZQ5XD.js → chunk-BTE2V4IW.js} +3 -3
- package/dist/{chunk-RVIZQ5XD.js.map → chunk-BTE2V4IW.js.map} +1 -1
- package/dist/{chunk-EB4XN3KE.js → chunk-CGT45WN7.js} +3 -3
- package/dist/{chunk-EB4XN3KE.js.map → chunk-CGT45WN7.js.map} +1 -1
- package/dist/{chunk-47ZD34KB.js → chunk-CIFS5K6T.js} +3 -3
- package/dist/{chunk-47ZD34KB.js.map → chunk-CIFS5K6T.js.map} +1 -1
- package/dist/{chunk-FAP63KV7.js → chunk-CKQEIY43.js} +4 -4
- package/dist/{chunk-FAP63KV7.js.map → chunk-CKQEIY43.js.map} +1 -1
- package/dist/{chunk-AVCUPPG6.js → chunk-EF7NPDDU.js} +4 -4
- package/dist/{chunk-AVCUPPG6.js.map → chunk-EF7NPDDU.js.map} +1 -1
- package/dist/chunk-EPBKISS5.js +84 -0
- package/dist/chunk-EPBKISS5.js.map +1 -0
- package/dist/{chunk-THEJJBOU.js → chunk-F2EKONM7.js} +3 -3
- package/dist/{chunk-THEJJBOU.js.map → chunk-F2EKONM7.js.map} +1 -1
- package/dist/{chunk-DMLDYFDS.js → chunk-F3RDEH5U.js} +7 -4
- package/dist/chunk-F3RDEH5U.js.map +1 -0
- package/dist/{chunk-SZWRPEF7.js → chunk-FTJJO3EM.js} +39 -29
- package/dist/chunk-FTJJO3EM.js.map +1 -0
- package/dist/{chunk-PSA6ONFB.js → chunk-FVJK4QWM.js} +4 -4
- package/dist/{chunk-PSA6ONFB.js.map → chunk-FVJK4QWM.js.map} +1 -1
- package/dist/{chunk-LBQ4BBX4.js → chunk-FZNG4V4J.js} +16 -30
- package/dist/chunk-FZNG4V4J.js.map +1 -0
- package/dist/{chunk-SWO25LTO.js → chunk-GB7WDMH2.js} +4 -4
- package/dist/{chunk-SWO25LTO.js.map → chunk-GB7WDMH2.js.map} +1 -1
- package/dist/{chunk-NARITJS2.js → chunk-GCICGXDD.js} +3 -3
- package/dist/{chunk-NARITJS2.js.map → chunk-GCICGXDD.js.map} +1 -1
- package/dist/{chunk-TTPSDC2G.js → chunk-GTILM2CI.js} +34 -13
- package/dist/chunk-GTILM2CI.js.map +1 -0
- package/dist/{chunk-EU3Q5AQ4.js → chunk-GXXFLBUQ.js} +23 -32
- package/dist/chunk-GXXFLBUQ.js.map +1 -0
- package/dist/{chunk-D5HOETOB.js → chunk-H7QUDDKH.js} +981 -126
- package/dist/chunk-H7QUDDKH.js.map +1 -0
- package/dist/{chunk-GIC3G5YG.js → chunk-HG34RNTK.js} +7 -13
- package/dist/chunk-HG34RNTK.js.map +1 -0
- package/dist/{chunk-LXY4BUA3.js → chunk-HYDRDNKN.js} +9 -5
- package/dist/chunk-HYDRDNKN.js.map +1 -0
- package/dist/{chunk-N6FBTXQ5.js → chunk-I6NLLJHZ.js} +2 -2
- package/dist/{chunk-N6FBTXQ5.js.map → chunk-I6NLLJHZ.js.map} +1 -1
- package/dist/{chunk-NWQB7UTY.js → chunk-IONAUNWB.js} +3 -3
- package/dist/{chunk-NWQB7UTY.js.map → chunk-IONAUNWB.js.map} +1 -1
- package/dist/{chunk-CT6NQSA4.js → chunk-ISHJITXJ.js} +3 -3
- package/dist/{chunk-CT6NQSA4.js.map → chunk-ISHJITXJ.js.map} +1 -1
- package/dist/chunk-IZCR27MU.js +60 -0
- package/dist/chunk-IZCR27MU.js.map +1 -0
- package/dist/{chunk-LCU5U5IW.js → chunk-JAKOMFC6.js} +67 -19
- package/dist/chunk-JAKOMFC6.js.map +1 -0
- package/dist/{chunk-VOOI7B2L.js → chunk-LEMHVDET.js} +86 -66
- package/dist/chunk-LEMHVDET.js.map +1 -0
- package/dist/{chunk-37FTLYFP.js → chunk-LNFKL23K.js} +3 -3
- package/dist/{chunk-37FTLYFP.js.map → chunk-LNFKL23K.js.map} +1 -1
- package/dist/{chunk-6UFFKMVC.js → chunk-LSXHED6I.js} +6 -6
- package/dist/{chunk-6UFFKMVC.js.map → chunk-LSXHED6I.js.map} +1 -1
- package/dist/{chunk-XUUYAS3Z.js → chunk-M3WPBTGJ.js} +3 -3
- package/dist/{chunk-XUUYAS3Z.js.map → chunk-M3WPBTGJ.js.map} +1 -1
- package/dist/{chunk-QZLWJETK.js → chunk-MGGFBZWA.js} +3 -3
- package/dist/{chunk-QZLWJETK.js.map → chunk-MGGFBZWA.js.map} +1 -1
- package/dist/{chunk-53MSCGR2.js → chunk-NPLPCRW5.js} +5 -5
- package/dist/{chunk-53MSCGR2.js.map → chunk-NPLPCRW5.js.map} +1 -1
- package/dist/{chunk-QCI6D7E4.js → chunk-NUELZWCF.js} +266 -170
- package/dist/chunk-NUELZWCF.js.map +1 -0
- package/dist/{chunk-BWZF2ZIF.js → chunk-OFBIWVCR.js} +3 -3
- package/dist/{chunk-BWZF2ZIF.js.map → chunk-OFBIWVCR.js.map} +1 -1
- package/dist/{chunk-IZLQ4GDO.js → chunk-P23M65LB.js} +43 -21
- package/dist/chunk-P23M65LB.js.map +1 -0
- package/dist/{chunk-G67BOI2J.js → chunk-PMECEZK3.js} +15 -9
- package/dist/chunk-PMECEZK3.js.map +1 -0
- package/dist/{chunk-GWXFSLBK.js → chunk-PTSGWKHR.js} +4 -4
- package/dist/{chunk-GWXFSLBK.js.map → chunk-PTSGWKHR.js.map} +1 -1
- package/dist/{chunk-OKGUDNDT.js → chunk-Q6E6FM7P.js} +35 -33
- package/dist/chunk-Q6E6FM7P.js.map +1 -0
- package/dist/{chunk-CWM3MYGX.js → chunk-QOP6KDFR.js} +8 -9
- package/dist/chunk-QOP6KDFR.js.map +1 -0
- package/dist/{chunk-O7VPNKYN.js → chunk-QVNRCDTV.js} +23 -7
- package/dist/chunk-QVNRCDTV.js.map +1 -0
- package/dist/{chunk-UX3K4RKE.js → chunk-S53LOR7B.js} +3 -3
- package/dist/{chunk-UX3K4RKE.js.map → chunk-S53LOR7B.js.map} +1 -1
- package/dist/{chunk-KNWCFEWU.js → chunk-SH5D7U7N.js} +20 -7
- package/dist/{chunk-KNWCFEWU.js.map → chunk-SH5D7U7N.js.map} +1 -1
- package/dist/{chunk-KM7XWC4Y.js → chunk-UAROCOXF.js} +3 -3
- package/dist/{chunk-KM7XWC4Y.js.map → chunk-UAROCOXF.js.map} +1 -1
- package/dist/{chunk-JMKB7IB4.js → chunk-UMVKJM4Q.js} +4 -4
- package/dist/chunk-UMVKJM4Q.js.map +1 -0
- package/dist/{chunk-HCYS7GFP.js → chunk-V2DXZYBB.js} +3 -3
- package/dist/{chunk-HCYS7GFP.js.map → chunk-V2DXZYBB.js.map} +1 -1
- package/dist/{chunk-IUUYRXT6.js → chunk-W5DWWE4Y.js} +4 -4
- package/dist/{chunk-IUUYRXT6.js.map → chunk-W5DWWE4Y.js.map} +1 -1
- package/dist/{chunk-FK6HPLQA.js → chunk-WTQ3TATB.js} +3 -3
- package/dist/{chunk-FK6HPLQA.js.map → chunk-WTQ3TATB.js.map} +1 -1
- package/dist/{chunk-7FJQT3GT.js → chunk-Y4N2NUZD.js} +4 -4
- package/dist/{chunk-7FJQT3GT.js.map → chunk-Y4N2NUZD.js.map} +1 -1
- package/dist/{chunk-6VRJH4MR.js → chunk-Y7QA2OLD.js} +6 -6
- package/dist/{chunk-6VRJH4MR.js.map → chunk-Y7QA2OLD.js.map} +1 -1
- package/dist/{chunk-74EEFB52.js → chunk-YSHVQGUS.js} +115 -27
- package/dist/chunk-YSHVQGUS.js.map +1 -0
- package/dist/{chunk-6C654TFI.js → chunk-ZAOGFXDO.js} +36 -8
- package/dist/chunk-ZAOGFXDO.js.map +1 -0
- package/dist/{chunk-MKLBK7HI.js → chunk-ZKSJMZKD.js} +17 -13
- package/dist/chunk-ZKSJMZKD.js.map +1 -0
- package/dist/cli/index.js +373 -188
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/asset-feeds.d.ts +5 -2
- package/dist/cli/src/asset-feeds.d.ts.map +1 -1
- package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +15 -2
- package/dist/cli/src/commands/catalog.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 +8 -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/manage.d.ts.map +1 -1
- package/dist/cli/src/commands/outdated.d.ts +7 -2
- package/dist/cli/src/commands/outdated.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +2 -0
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/publish-core.d.ts +10 -1
- package/dist/cli/src/commands/publish-core.d.ts.map +1 -1
- package/dist/cli/src/commands/session.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +14 -0
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/tree.d.ts.map +1 -1
- package/dist/cli/src/commands/update.d.ts.map +1 -1
- package/dist/cli/src/commands/validate.d.ts.map +1 -1
- package/dist/cli/src/flow-discovery.d.ts +8 -5
- package/dist/cli/src/flow-discovery.d.ts.map +1 -1
- package/dist/cli/src/open-library.d.ts +0 -11
- package/dist/cli/src/open-library.d.ts.map +1 -1
- package/dist/cli/src/skill-checks.d.ts +11 -2
- package/dist/cli/src/skill-checks.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +25 -26
- package/dist/connectors/src/access-policy.d.ts +33 -0
- package/dist/connectors/src/access-policy.d.ts.map +1 -0
- package/dist/connectors/src/connector-manager.d.ts.map +1 -1
- package/dist/connectors/src/index.d.ts +2 -0
- package/dist/connectors/src/index.d.ts.map +1 -1
- package/dist/connectors-O6Y6VESP.js +44 -0
- package/dist/{connectors-SSOTIDHT.js.map → connectors-O6Y6VESP.js.map} +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/core/index.js +8 -8
- package/dist/core/logging.js +1 -1
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.js +1 -1
- package/dist/core/publish-manifest.js +2 -2
- package/dist/core/ref.js +1 -1
- package/dist/core/runtime-assets.js +5 -5
- package/dist/core/src/index.d.ts +3 -3
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/logging/config.d.ts +9 -1
- package/dist/core/src/logging/config.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts +11 -1
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/models.d.ts +14 -6
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +41 -6
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/store.d.ts +16 -2
- package/dist/core/src/store.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +10 -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 +8 -8
- package/dist/discovery/index.js +5 -5
- package/dist/{ensure-sources-277VI7R3.js → ensure-sources-SKLNM4UZ.js} +18 -18
- package/dist/{ensure-sources-277VI7R3.js.map → ensure-sources-SKLNM4UZ.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +25 -26
- package/dist/factory-assets/connectors/deploy.js +25 -26
- package/dist/factory-assets/connectors/devserver.js +25 -26
- package/dist/factory-assets/connectors/flow/adapter.d.ts +6 -0
- package/dist/factory-assets/connectors/flow/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/adapter.js +25 -26
- package/dist/factory-assets/connectors/flow/contract/expression.d.ts +3 -0
- package/dist/factory-assets/connectors/flow/contract/expression.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/contract/output-fields.d.ts +1 -1
- package/dist/factory-assets/connectors/flow/contract/output-fields.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/contract/schema.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/contract.js +4 -4
- package/dist/factory-assets/connectors/flow/engine/flow-output.d.ts +4 -3
- package/dist/factory-assets/connectors/flow/engine/flow-output.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/engine/output-schema.d.ts +6 -1
- package/dist/factory-assets/connectors/flow/engine/output-schema.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/engine.js +12 -12
- package/dist/factory-assets/connectors/flow/inline-sub-flow-host.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/prompt-fragments.js +3 -3
- package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.js +27 -28
- package/dist/factory-assets/connectors/flow.js +25 -26
- package/dist/factory-assets/connectors/git/config.d.ts.map +1 -1
- package/dist/factory-assets/connectors/git.js +25 -26
- package/dist/factory-assets/connectors/gmail.js +25 -26
- package/dist/factory-assets/connectors/googledrive.js +25 -26
- package/dist/factory-assets/connectors/local.js +25 -26
- package/dist/factory-assets/connectors/mattermost.js +25 -26
- package/dist/factory-assets/connectors/memory.js +25 -26
- package/dist/factory-assets/connectors/minio.js +25 -26
- package/dist/factory-assets/connectors/postgres.js +25 -26
- package/dist/factory-assets/connectors/s3.js +25 -26
- package/dist/factory-assets/connectors/sharepoint.js +25 -26
- package/dist/factory-assets/connectors/sqlite.js +25 -26
- package/dist/factory-assets/connectors/static-server.js +25 -26
- package/dist/factory-assets/connectors/tunnel.js +25 -26
- package/dist/factory-assets/connectors/webdav.js +25 -26
- package/dist/factory-assets/connectors/xstate-store.js +25 -26
- package/dist/factory-assets/connectors/xstate.js +25 -26
- package/dist/factory-assets/skills/skaile-author-asset/SKILL.md +10 -7
- package/dist/{flows-J2UEU2QM.js → flows-CBYRSAGS.js} +13 -13
- package/dist/{flows-J2UEU2QM.js.map → flows-CBYRSAGS.js.map} +1 -1
- package/dist/{helpers-KC5O7CML.js → helpers-MWZDRBLD.js} +18 -18
- package/dist/{helpers-KC5O7CML.js.map → helpers-MWZDRBLD.js.map} +1 -1
- package/dist/library/index.js +12 -12
- package/dist/library/install.js +3 -3
- package/dist/library/src/index.d.ts +3 -1
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/local/scan-authoring-libraries.d.ts +43 -0
- package/dist/library/src/local/scan-authoring-libraries.d.ts.map +1 -0
- package/dist/library/src/manifest-writer.d.ts +26 -3
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/library/src/sync/git-driver.d.ts.map +1 -1
- package/dist/{library-publish-FGXF5TJO.js → library-publish-PICMDSB2.js} +73 -37
- package/dist/library-publish-PICMDSB2.js.map +1 -0
- package/dist/open-library-OG457THY.js +40 -0
- package/dist/{open-library-P3D337NH.js.map → open-library-OG457THY.js.map} +1 -1
- package/dist/open-registry-ZUZJ7MS7.js +32 -0
- package/dist/{open-registry-Z3P2X2AB.js.map → open-registry-ZUZJ7MS7.js.map} +1 -1
- package/dist/paths-FQ64OLJG.js +22 -0
- package/dist/{paths-JKEKXM52.js.map → paths-FQ64OLJG.js.map} +1 -1
- package/dist/{plugin-store-WI4MZJLP.js → plugin-store-MPAMD5OT.js} +10 -10
- package/dist/{plugin-store-WI4MZJLP.js.map → plugin-store-MPAMD5OT.js.map} +1 -1
- package/dist/project-2GFT5LEZ.js +41 -0
- package/dist/{project-WFUDVYNN.js.map → project-2GFT5LEZ.js.map} +1 -1
- package/dist/resolver/index.js +9 -9
- package/dist/runner/index.js +40 -41
- package/dist/runner/src/logging-bootstrap.d.ts +6 -0
- package/dist/runner/src/logging-bootstrap.d.ts.map +1 -1
- package/dist/runner/src/reconfigure-handler.d.ts +38 -17
- package/dist/runner/src/reconfigure-handler.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-capability-wiring.d.ts +0 -2
- package/dist/runner/src/session-capability-wiring.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +15 -15
- package/dist/sdk/bridge.js +16 -17
- package/dist/sdk/core.js +8 -8
- package/dist/sdk/flow.js +12 -12
- package/dist/sdk/index.js +68 -45
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +9 -9
- package/dist/sdk/runner.js +40 -41
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/src/agent-session.d.ts +8 -0
- package/dist/sdk/src/agent-session.d.ts.map +1 -1
- package/dist/sdk/store.js +2 -1
- package/dist/sdk/types.js +1 -1
- package/dist/session/index.js +2 -2
- package/dist/{setup-RAMLTORM.js → setup-WHMCSIF2.js} +26 -27
- package/dist/setup-WHMCSIF2.js.map +1 -0
- package/dist/skills-TVO26Y4V.js +26 -0
- package/dist/{skills-EOHZ2DZ4.js.map → skills-TVO26Y4V.js.map} +1 -1
- package/dist/source-LKOFTOEK.js +41 -0
- package/dist/{source-FYVSFYEI.js.map → source-LKOFTOEK.js.map} +1 -1
- package/dist/{source-manifest-publish-4FPIPPLV.js → source-manifest-publish-L5J3QXER.js} +27 -27
- package/dist/{source-manifest-publish-4FPIPPLV.js.map → source-manifest-publish-L5J3QXER.js.map} +1 -1
- package/dist/store/index.js +2 -1
- package/dist/store/src/store.d.ts +8 -5
- package/dist/store/src/store.d.ts.map +1 -1
- package/dist/tui/index.js +40 -41
- package/dist/tui/index.js.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/ask-slots.d.ts +68 -0
- package/dist/types/src/ask-slots.d.ts.map +1 -0
- package/dist/types/src/delivery.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +29 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.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/preset.d.ts +4 -0
- package/dist/types/src/manifests/preset.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +12 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +32 -33
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +2 -2
- package/package.json +1 -1
- package/dist/asset-feeds-K36CR52Q.js.map +0 -1
- package/dist/chunk-6C654TFI.js.map +0 -1
- package/dist/chunk-74EEFB52.js.map +0 -1
- package/dist/chunk-BTK7ECLH.js.map +0 -1
- package/dist/chunk-CWM3MYGX.js.map +0 -1
- package/dist/chunk-D5HOETOB.js.map +0 -1
- package/dist/chunk-DFFD4BFG.js.map +0 -1
- package/dist/chunk-DMLDYFDS.js.map +0 -1
- package/dist/chunk-EINLFFP6.js +0 -59
- package/dist/chunk-EINLFFP6.js.map +0 -1
- package/dist/chunk-EU3Q5AQ4.js.map +0 -1
- package/dist/chunk-FRHE7FFB.js.map +0 -1
- package/dist/chunk-G67BOI2J.js.map +0 -1
- package/dist/chunk-GIC3G5YG.js.map +0 -1
- package/dist/chunk-IZLQ4GDO.js.map +0 -1
- package/dist/chunk-JMKB7IB4.js.map +0 -1
- package/dist/chunk-LBQ4BBX4.js.map +0 -1
- package/dist/chunk-LCU5U5IW.js.map +0 -1
- package/dist/chunk-LXY4BUA3.js.map +0 -1
- package/dist/chunk-MKLBK7HI.js.map +0 -1
- package/dist/chunk-O7VPNKYN.js.map +0 -1
- package/dist/chunk-OKGUDNDT.js.map +0 -1
- package/dist/chunk-QCI6D7E4.js.map +0 -1
- package/dist/chunk-SZWRPEF7.js.map +0 -1
- package/dist/chunk-TTPSDC2G.js.map +0 -1
- package/dist/chunk-VOOI7B2L.js.map +0 -1
- package/dist/chunk-XBSQ4KMC.js.map +0 -1
- package/dist/connectors-SSOTIDHT.js +0 -45
- package/dist/library-publish-FGXF5TJO.js.map +0 -1
- package/dist/open-library-P3D337NH.js +0 -40
- package/dist/open-registry-Z3P2X2AB.js +0 -32
- package/dist/paths-JKEKXM52.js +0 -22
- package/dist/project-WFUDVYNN.js +0 -41
- package/dist/setup-RAMLTORM.js.map +0 -1
- package/dist/skills-EOHZ2DZ4.js +0 -26
- package/dist/source-FYVSFYEI.js +0 -41
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputSchema, consumedOutputFieldPaths, declaredFieldSchema, MISSING_FIELD } from './chunk-
|
|
1
|
+
import { InputSchema, consumedOutputFieldPaths, declaredFieldSchema, MISSING_FIELD } from './chunk-NUELZWCF.js';
|
|
2
2
|
|
|
3
3
|
// factory-assets/connectors/flow/contract/input-schema.ts
|
|
4
4
|
var INPUT_SCHEMA_SHAPES_HINT = "{ kind: 'text', multiline? }, { kind: 'choice', options: [{ id, label, description? }], multiple? }, { kind: 'form', fields: [{ id, label, type: text|textarea|number|choice|file|date|boolean, required?, options?, accept? }] }, or { kind: 'file', accept?, maxSize?, multiple? }";
|
|
@@ -220,5 +220,5 @@ function mismatchedSubFlowOutputTypes(parent, subFlowNodeId, child) {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
export { INPUT_SCHEMA_SHAPES_HINT, coerceInputSchema, mismatchedSubFlowOutputTypes, undeclaredSubFlowOutputReads };
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
224
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-LNFKL23K.js.map
|
|
224
|
+
//# sourceMappingURL=chunk-LNFKL23K.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../factory-assets/connectors/flow/contract/input-schema.ts","../factory-assets/connectors/flow/contract/sub-flow-output.ts"],"names":[],"mappings":";;;AAwBO,IAAM,wBAAA,GACX;AAYF,IAAM,WAAA,GAAc,CAAC,MAAA,EAAQ,QAAA,EAAU,QAAQ,MAAM,CAAA;AAkB9C,SAAS,kBAAkB,KAAA,EAAqC;AACrE,EAAA,IAAI,SAAA,GAAqB,KAAA;AACzB,EAAA,IAAI,OAAO,cAAc,QAAA,EAAU;AACjC,IAAA,IAAI;AACF,MAAA,SAAA,GAAY,IAAA,CAAK,MAAM,SAAS,CAAA;AAAA,IAClC,CAAA,CAAA,MAAQ;AAGN,MAAA,OAAO,EAAE,EAAA,EAAI,IAAA,EAAM,QAAQ,EAAE,IAAA,EAAM,QAAO,EAAE;AAAA,IAC9C;AAAA,EACF;AACA,EAAA,IAAI,SAAA,KAAc,IAAA,IAAQ,OAAO,SAAA,KAAc,QAAA,EAAU;AACvD,IAAA,OAAO,EAAE,EAAA,EAAI,IAAA,EAAM,QAAQ,EAAE,IAAA,EAAM,QAAO,EAAE;AAAA,EAC9C;AACA,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAA,EAAG;AAC5B,IAAA,OAAO,MAAA,CAAO;AAAA,MACZ;AAAA,KACD,CAAA;AAAA,EACH;AAEA,EAAA,MAAM,GAAA,GAAM,SAAA;AACZ,EAAA,MAAM,OAAO,GAAA,CAAI,IAAA;AAGjB,EAAA,IAAI,OAAO,IAAA,KAAS,QAAA,IAAY,CAAC,WAAA,CAAY,KAAK,CAAC,KAAA,KAAU,KAAA,KAAU,IAAI,CAAA,EAAG;AAC5E,IAAA,OAAO,MAAA,CAAO;AAAA,MACZ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,EAAC;AAC3C,EAAA,MAAM,aAA0C,EAAC;AACjD,EAAA,KAAA,MAAW,IAAA,IAAQ,wBAAA,CAAyB,MAAA,EAAQ,aAAa,CAAA,EAAG;AAClE,IAAA,MAAM,UAAA,GAAa,aAAA,CAAc,mBAAA,CAAoB,YAAA,EAAc,IAAI,CAAC,CAAA;AACxE,IAAA,MAAM,SAAA,GAAY,aAAA,CAAc,mBAAA,CAAoB,WAAA,EAAa,IAAI,CAAC,CAAA;AACtE,IAAA,IAAI,CAAC,UAAA,IAAc,CAAC,SAAA,EAAW;AAC/B,IAAA,MAAM,OAAO,SAAA,CAAU,KAAA;AAAA,MACrB,CAAC,IAAA,KAAS,UAAA,CAAW,QAAA,CAAS,IAAI,KAAM,IAAA,KAAS,SAAA,IAAa,UAAA,CAAW,QAAA,CAAS,QAAQ;AAAA,KAC5F;AACA,IAAA,IAAI,CAAC,IAAA,EAAM,UAAA,CAAW,IAAA,CAAK,EAAE,IAAA,EAAM,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA,EAAG,UAAA,EAAY,SAAA,EAAW,CAAA;AAAA,EAC5E;AACA,EAAA,OAAO,UAAA;AACT","file":"chunk-37FTLYFP.js","sourcesContent":["/**\n * Coercion of an agent-supplied `request_input` schema onto the flow contract.\n *\n * `request_input` used to cast whatever the agent passed straight into\n * `InputSchema`, so a choice gate could be persisted with option ids no host\n * could render — a run parked forever on a question no human could answer.\n * This module tolerates the shapes agents actually reach for (a bare string per\n * option, an option with a label and no id) and refuses the rest, because a\n * refusal the agent can read and retry beats a stored gate nobody can answer.\n *\n * Exported because hosts normalize the same payloads when they read a stored\n * gate; one shared rule is what keeps the write and read sides in agreement.\n */\n\nimport type { InputSchema } from \"@skaile/workspaces/types\";\nimport type * as z from \"zod\";\nimport { InputSchema as InputSchemaContract } from \"./schema.js\";\n\n/**\n * The shapes `request_input` accepts, phrased for an agent retrying a refused\n * call. Every optional key the contract admits is listed, because validation is\n * strict: an agent refused for one unknown key would otherwise read a key it\n * omitted here as illegal too.\n */\nexport const INPUT_SCHEMA_SHAPES_HINT =\n \"{ kind: 'text', multiline? }, { kind: 'choice', options: [{ id, label, description? }], multiple? }, { kind: 'form', fields: [{ id, label, type: text|textarea|number|choice|file|date|boolean, required?, options?, accept? }] }, or { kind: 'file', accept?, maxSize?, multiple? }\";\n\n/**\n * Outcome of {@link coerceInputSchema}: either a schema in the contract shape,\n * or the reasons it was refused — one entry per problem, each naming its path,\n * closed by a final entry naming the accepted shapes. The hint travels with the\n * issues so every caller's refusal is actionable without re-appending it.\n */\nexport type InputSchemaCoercion =\n | { ok: true; schema: InputSchema }\n | { ok: false; issues: string[] };\n\nconst KNOWN_KINDS = [\"text\", \"choice\", \"form\", \"file\"] as const;\n\n/** A coerced option or form field, and whether its id was derived from its label. */\ntype Prepared = { entry: Record<string, unknown>; derivedId: boolean };\n\n/**\n * Brings an untrusted `request_input` schema into the `InputSchema` contract.\n *\n * Tolerated: a JSON string wrapper, a choice option given as a bare string, and\n * an option or form field whose id is missing but whose label can supply one.\n * Refused: an unknown `kind`, an option or field that carries no usable label, a\n * duplicate explicit id, an id or label of the wrong type, and a choice or form\n * with nothing to answer — anything a host could not turn into an answerable\n * control. Options are never dropped: every unusable one produces an issue.\n *\n * @param value Raw `schema` argument as the agent supplied it.\n * @returns The contract-shaped schema, or the issues that make it unanswerable.\n */\nexport function coerceInputSchema(value: unknown): InputSchemaCoercion {\n let candidate: unknown = value;\n if (typeof candidate === \"string\") {\n try {\n candidate = JSON.parse(candidate);\n } catch {\n // A free-text box is still answerable, so an unparseable string keeps the\n // fallback it has always had rather than failing the agent's turn.\n return { ok: true, schema: { kind: \"text\" } };\n }\n }\n if (candidate === null || typeof candidate !== \"object\") {\n return { ok: true, schema: { kind: \"text\" } };\n }\n if (Array.isArray(candidate)) {\n return refuse([\n \"schema: expected an object with a `kind`, got an array — a bare option list needs { kind: 'choice', options: [...] }\",\n ]);\n }\n\n const raw = candidate as Record<string, unknown>;\n const kind = raw.kind;\n // An unknown kind is refused rather than degraded to text: text would discard\n // the agent's intent and hand the user a box the flow cannot consume.\n if (typeof kind !== \"string\" || !KNOWN_KINDS.some((known) => known === kind)) {\n return refuse([\n `schema.kind: expected one of ${KNOWN_KINDS.join(\", \")}, got ${describe(kind)}`,\n ]);\n }\n\n const issues: string[] = [];\n const prepared =\n kind === \"choice\"\n ? prepareChoice(raw, issues)\n : kind === \"form\"\n ? prepareForm(raw, issues)\n : raw;\n if (issues.length > 0) return refuse(issues);\n\n const parsed = InputSchemaContract.safeParse(prepared);\n if (!parsed.success) return refuse(formatIssues(parsed.error.issues));\n return { ok: true, schema: parsed.data };\n}\n\n/** Closes a refusal with the accepted shapes, so no caller has to know to add them. */\nfunction refuse(issues: string[]): InputSchemaCoercion {\n return { ok: false, issues: [...issues, `valid shapes: ${INPUT_SCHEMA_SHAPES_HINT}`] };\n}\n\nfunction prepareChoice(raw: Record<string, unknown>, issues: string[]): Record<string, unknown> {\n const options = raw.options;\n if (!Array.isArray(options)) {\n issues.push(`options: expected an array of choices, got ${describe(options)}`);\n return raw;\n }\n if (options.length === 0) {\n issues.push(\n \"options: expected at least one choice — a choice gate with none cannot be answered\",\n );\n return raw;\n }\n return { ...raw, options: coerceChoices(options, \"options\", issues) };\n}\n\nfunction prepareForm(raw: Record<string, unknown>, issues: string[]): Record<string, unknown> {\n const fields = raw.fields;\n if (!Array.isArray(fields)) {\n issues.push(`fields: expected an array of form fields, got ${describe(fields)}`);\n return raw;\n }\n // A form with no fields is as unanswerable as a choice with no options.\n if (fields.length === 0) {\n issues.push(\"fields: expected at least one field — a form gate with none cannot be answered\");\n return raw;\n }\n const prepared = fields.map((field, index) => coerceField(field, `fields[${index}]`, issues));\n return { ...raw, fields: settleIds(prepared, \"fields\", issues) };\n}\n\nfunction coerceChoices(\n options: unknown[],\n path: string,\n issues: string[],\n): Record<string, unknown>[] {\n const prepared = options.map((option, index) =>\n coerceChoice(option, `${path}[${index}]`, issues),\n );\n return settleIds(prepared, path, issues);\n}\n\nfunction coerceChoice(option: unknown, at: string, issues: string[]): Prepared | undefined {\n if (typeof option === \"string\") {\n const label = option.trim();\n if (label === \"\") {\n issues.push(`${at}: expected a non-empty string`);\n return undefined;\n }\n return { entry: { id: label, label }, derivedId: true };\n }\n if (!isPlainObject(option)) {\n issues.push(\n `${at}: expected a string or an object with { id, label }, got ${describe(option)}`,\n );\n return undefined;\n }\n const identity = coerceIdentity(option, at, issues);\n if (!identity) return undefined;\n const entry: Record<string, unknown> = { ...option, id: identity.id, label: identity.label };\n const { description } = entry;\n // An absent, null, or blank description carries nothing; the contract admits\n // only a non-empty string, and anything else stays for it to reject.\n if (\n description === null ||\n description === undefined ||\n (typeof description === \"string\" && description.trim() === \"\")\n ) {\n delete entry.description;\n }\n return { entry, derivedId: identity.derivedId };\n}\n\nfunction coerceField(field: unknown, at: string, issues: string[]): Prepared | undefined {\n if (!isPlainObject(field)) {\n issues.push(`${at}: expected an object with { id, label, type }, got ${describe(field)}`);\n return undefined;\n }\n const identity = coerceIdentity(field, at, issues);\n if (!identity) return undefined;\n const entry: Record<string, unknown> = { ...field, id: identity.id, label: identity.label };\n const options = field.options;\n // A select with nothing to select is the same unrenderable control a choice\n // gate with no options is, one level down.\n if (field.type === \"choice\" && (!Array.isArray(options) || options.length === 0)) {\n issues.push(\n `${at}.options: expected at least one choice — a choice field with none cannot be answered`,\n );\n return undefined;\n }\n if (Array.isArray(options)) {\n entry.options = coerceChoices(options, `${at}.options`, issues);\n }\n return { entry, derivedId: identity.derivedId };\n}\n\n/**\n * Resolves the `id`/`label` pair of an option or field, letting either supply\n * the other. An id or label of the wrong type is refused rather than replaced:\n * silently swapping in a different id is the failure this module exists to stop\n * — an agent that branches on the id it wrote would never see the substitution.\n */\nfunction coerceIdentity(\n raw: Record<string, unknown>,\n at: string,\n issues: string[],\n): { id: string; label: string; derivedId: boolean } | undefined {\n const id = explicitText(raw.id, at, \"id\", issues);\n const label = explicitText(raw.label, at, \"label\", issues);\n if (!id.ok || !label.ok) return undefined;\n const text = label.value ?? id.value;\n if (text === undefined) {\n issues.push(`${at}: expected a non-empty \\`label\\`, got ${describe(raw.label)}`);\n return undefined;\n }\n return { id: id.value ?? text, label: text, derivedId: id.value === undefined };\n}\n\n/**\n * An explicit `id`/`label`, or `undefined` when the agent supplied nothing to\n * carry (absent, null, or blank). Any other type is intent in the wrong shape,\n * so it is reported instead of dropped.\n */\nfunction explicitText(\n value: unknown,\n at: string,\n key: \"id\" | \"label\",\n issues: string[],\n): { ok: true; value: string | undefined } | { ok: false } {\n if (value === undefined || value === null) return { ok: true, value: undefined };\n if (typeof value !== \"string\") {\n issues.push(`${at}.${key}: expected a non-empty string, got ${describe(value)}`);\n return { ok: false };\n }\n const trimmed = value.trim();\n return { ok: true, value: trimmed === \"\" ? undefined : trimmed };\n}\n\n/**\n * Settles ids across a list of options or fields. Every explicit id is reserved\n * before any derived one is filled in, so a collision's verdict cannot depend on\n * which side of it came first — and a refusal never names an id the agent did\n * not write.\n */\nfunction settleIds(\n prepared: (Prepared | undefined)[],\n path: string,\n issues: string[],\n): Record<string, unknown>[] {\n const used = new Set<string>();\n const reserved = prepared.map((item, index) => {\n if (!item || item.derivedId) return item;\n const id = String(item.entry.id);\n if (used.has(id)) {\n issues.push(\n `${path}[${index}]: duplicate id \"${id}\" — ids must be unique or a host cannot tell the answers apart`,\n );\n return undefined;\n }\n used.add(id);\n return item;\n });\n\n const settled: Record<string, unknown>[] = [];\n reserved.forEach((item, index) => {\n if (!item) return;\n if (item.derivedId) item.entry.id = uniqueId(String(item.entry.id), index, used);\n used.add(String(item.entry.id));\n settled.push(item.entry);\n });\n return settled;\n}\n\nfunction uniqueId(base: string, index: number, used: Set<string>): string {\n if (!used.has(base)) return base;\n // Two options can legitimately share a label; the index disambiguates the id\n // derived from it so the answer stays unambiguous.\n let attempt = index;\n let candidate = `${base}-${attempt}`;\n while (used.has(candidate)) {\n attempt += 1;\n candidate = `${base}-${attempt}`;\n }\n return candidate;\n}\n\nfunction formatIssues(issues: readonly z.core.$ZodIssue[]): string[] {\n return issues.map((issue) => {\n const path = issue.path.reduce<string>((acc, segment) => {\n if (typeof segment === \"number\") return `${acc}[${segment}]`;\n return acc === \"\" ? String(segment) : `${acc}.${String(segment)}`;\n }, \"\");\n return `${path === \"\" ? \"schema\" : path}: ${issue.message}`;\n });\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction describe(value: unknown): string {\n if (value === undefined) return \"nothing\";\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"an array\";\n if (typeof value === \"string\") return `the string ${JSON.stringify(value)}`;\n if (typeof value === \"object\") return \"an object\";\n return `${typeof value} ${String(value)}`;\n}\n","import { consumedOutputFieldPaths, declaredFieldSchema, MISSING_FIELD } from \"./output-fields.js\";\n\ntype SubFlowParent = Parameters<typeof consumedOutputFieldPaths>[0];\ninterface SubFlowChild {\n output?: { schema: Record<string, unknown>; bindings?: Record<string, unknown> };\n}\n\n/**\n * Field paths the parent reads from a sub-flow node that the child flow does not return.\n *\n * A child returns a field only when its `output.schema` declares the path and\n * `output.bindings` binds the top-level property. Paths are dot-joined relative\n * to `output.fields`. The engine calls this when the sub-flow node starts; a host\n * validator can call it at save time with the resolved child definition.\n * Throws when a parent consumer expression does not parse.\n */\nexport function undeclaredSubFlowOutputReads(\n parent: SubFlowParent,\n subFlowNodeId: string,\n child: SubFlowChild,\n): string[] {\n const output = child.output;\n return consumedOutputFieldPaths(parent, subFlowNodeId)\n .filter(\n (path) =>\n output?.bindings === undefined ||\n !Object.hasOwn(output.bindings, path[0]) ||\n declaredFieldSchema(output.schema, path) === MISSING_FIELD,\n )\n .map((path) => path.join(\".\"));\n}\n\n/** One parent read whose declared type the child's returned type does not fit. */\nexport interface SubFlowOutputTypeMismatch {\n /** Dot-joined path relative to `output.fields`. */\n path: string;\n /** JSON Schema `type` the parent's sub-flow node declares for the path. */\n parentType: string[];\n /** JSON Schema `type` the child's `output.schema` declares for the path. */\n childType: string[];\n}\n\nfunction declaredTypes(schema: unknown): string[] | undefined {\n if (typeof schema !== \"object\" || schema === null) return undefined;\n const type = (schema as Record<string, unknown>).type;\n if (typeof type === \"string\") return [type];\n if (Array.isArray(type) && type.every((entry) => typeof entry === \"string\")) return type;\n return undefined;\n}\n\n/**\n * Parent reads whose type, as the parent's sub-flow node declares it in\n * `contract.output.fields`, the child's `output.schema` does not fit.\n *\n * Compares only the JSON Schema `type` keyword, and only where both sides\n * declare one: every child type must be one the parent accepts, with\n * `integer` accepted where the parent says `number`. Reads the child does not\n * return are left to {@link undeclaredSubFlowOutputReads}.\n * Throws when a parent consumer expression does not parse.\n */\nexport function mismatchedSubFlowOutputTypes(\n parent: SubFlowParent,\n subFlowNodeId: string,\n child: SubFlowChild,\n): SubFlowOutputTypeMismatch[] {\n const parentFields = parent.nodes.find(({ id }) => id === subFlowNodeId)?.contract?.output\n ?.fields;\n const childSchema = child.output?.schema;\n if (!parentFields || !childSchema) return [];\n const mismatches: SubFlowOutputTypeMismatch[] = [];\n for (const path of consumedOutputFieldPaths(parent, subFlowNodeId)) {\n const parentType = declaredTypes(declaredFieldSchema(parentFields, path));\n const childType = declaredTypes(declaredFieldSchema(childSchema, path));\n if (!parentType || !childType) continue;\n const fits = childType.every(\n (type) => parentType.includes(type) || (type === \"integer\" && parentType.includes(\"number\")),\n );\n if (!fits) mismatches.push({ path: path.join(\".\"), parentType, childType });\n }\n return mismatches;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../factory-assets/connectors/flow/contract/input-schema.ts","../factory-assets/connectors/flow/contract/sub-flow-output.ts"],"names":[],"mappings":";;;AAwBO,IAAM,wBAAA,GACX;AAYF,IAAM,WAAA,GAAc,CAAC,MAAA,EAAQ,QAAA,EAAU,QAAQ,MAAM,CAAA;AAkB9C,SAAS,kBAAkB,KAAA,EAAqC;AACrE,EAAA,IAAI,SAAA,GAAqB,KAAA;AACzB,EAAA,IAAI,OAAO,cAAc,Q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KAAS,SAAA,IAAa,UAAA,CAAW,QAAA,CAAS,QAAQ;AAAA,KAC5F;AACA,IAAA,IAAI,CAAC,IAAA,EAAM,UAAA,CAAW,IAAA,CAAK,EAAE,IAAA,EAAM,IAAA,CAAK,IAAA,CAAK,GAAG,CAAA,EAAG,UAAA,EAAY,SAAA,EAAW,CAAA;AAAA,EAC5E;AACA,EAAA,OAAO,UAAA;AACT","file":"chunk-LNFKL23K.js","sourcesContent":["/**\n * Coercion of an agent-supplied `request_input` schema onto the flow contract.\n *\n * `request_input` used to cast whatever the agent passed straight into\n * `InputSchema`, so a choice gate could be persisted with option ids no host\n * could render — a run parked forever on a question no human could answer.\n * This module tolerates the shapes agents actually reach for (a bare string per\n * option, an option with a label and no id) and refuses the rest, because a\n * refusal the agent can read and retry beats a stored gate nobody can answer.\n *\n * Exported because hosts normalize the same payloads when they read a stored\n * gate; one shared rule is what keeps the write and read sides in agreement.\n */\n\nimport type { InputSchema } from \"@skaile/workspaces/types\";\nimport type * as z from \"zod\";\nimport { InputSchema as InputSchemaContract } from \"./schema.js\";\n\n/**\n * The shapes `request_input` accepts, phrased for an agent retrying a refused\n * call. Every optional key the contract admits is listed, because validation is\n * strict: an agent refused for one unknown key would otherwise read a key it\n * omitted here as illegal too.\n */\nexport const INPUT_SCHEMA_SHAPES_HINT =\n \"{ kind: 'text', multiline? }, { kind: 'choice', options: [{ id, label, description? }], multiple? }, { kind: 'form', fields: [{ id, label, type: text|textarea|number|choice|file|date|boolean, required?, options?, accept? }] }, or { kind: 'file', accept?, maxSize?, multiple? }\";\n\n/**\n * Outcome of {@link coerceInputSchema}: either a schema in the contract shape,\n * or the reasons it was refused — one entry per problem, each naming its path,\n * closed by a final entry naming the accepted shapes. The hint travels with the\n * issues so every caller's refusal is actionable without re-appending it.\n */\nexport type InputSchemaCoercion =\n | { ok: true; schema: InputSchema }\n | { ok: false; issues: string[] };\n\nconst KNOWN_KINDS = [\"text\", \"choice\", \"form\", \"file\"] as const;\n\n/** A coerced option or form field, and whether its id was derived from its label. */\ntype Prepared = { entry: Record<string, unknown>; derivedId: boolean };\n\n/**\n * Brings an untrusted `request_input` schema into the `InputSchema` contract.\n *\n * Tolerated: a JSON string wrapper, a choice option given as a bare string, and\n * an option or form field whose id is missing but whose label can supply one.\n * Refused: an unknown `kind`, an option or field that carries no usable label, a\n * duplicate explicit id, an id or label of the wrong type, and a choice or form\n * with nothing to answer — anything a host could not turn into an answerable\n * control. Options are never dropped: every unusable one produces an issue.\n *\n * @param value Raw `schema` argument as the agent supplied it.\n * @returns The contract-shaped schema, or the issues that make it unanswerable.\n */\nexport function coerceInputSchema(value: unknown): InputSchemaCoercion {\n let candidate: unknown = value;\n if (typeof candidate === \"string\") {\n try {\n candidate = JSON.parse(candidate);\n } catch {\n // A free-text box is still answerable, so an unparseable string keeps the\n // fallback it has always had rather than failing the agent's turn.\n return { ok: true, schema: { kind: \"text\" } };\n }\n }\n if (candidate === null || typeof candidate !== \"object\") {\n return { ok: true, schema: { kind: \"text\" } };\n }\n if (Array.isArray(candidate)) {\n return refuse([\n \"schema: expected an object with a `kind`, got an array — a bare option list needs { kind: 'choice', options: [...] }\",\n ]);\n }\n\n const raw = candidate as Record<string, unknown>;\n const kind = raw.kind;\n // An unknown kind is refused rather than degraded to text: text would discard\n // the agent's intent and hand the user a box the flow cannot consume.\n if (typeof kind !== \"string\" || !KNOWN_KINDS.some((known) => known === kind)) {\n return refuse([\n `schema.kind: expected one of ${KNOWN_KINDS.join(\", \")}, got ${describe(kind)}`,\n ]);\n }\n\n const issues: string[] = [];\n const prepared =\n kind === \"choice\"\n ? prepareChoice(raw, issues)\n : kind === \"form\"\n ? prepareForm(raw, issues)\n : raw;\n if (issues.length > 0) return refuse(issues);\n\n const parsed = InputSchemaContract.safeParse(prepared);\n if (!parsed.success) return refuse(formatIssues(parsed.error.issues));\n return { ok: true, schema: parsed.data };\n}\n\n/** Closes a refusal with the accepted shapes, so no caller has to know to add them. */\nfunction refuse(issues: string[]): InputSchemaCoercion {\n return { ok: false, issues: [...issues, `valid shapes: ${INPUT_SCHEMA_SHAPES_HINT}`] };\n}\n\nfunction prepareChoice(raw: Record<string, unknown>, issues: string[]): Record<string, unknown> {\n const options = raw.options;\n if (!Array.isArray(options)) {\n issues.push(`options: expected an array of choices, got ${describe(options)}`);\n return raw;\n }\n if (options.length === 0) {\n issues.push(\n \"options: expected at least one choice — a choice gate with none cannot be answered\",\n );\n return raw;\n }\n return { ...raw, options: coerceChoices(options, \"options\", issues) };\n}\n\nfunction prepareForm(raw: Record<string, unknown>, issues: string[]): Record<string, unknown> {\n const fields = raw.fields;\n if (!Array.isArray(fields)) {\n issues.push(`fields: expected an array of form fields, got ${describe(fields)}`);\n return raw;\n }\n // A form with no fields is as unanswerable as a choice with no options.\n if (fields.length === 0) {\n issues.push(\"fields: expected at least one field — a form gate with none cannot be answered\");\n return raw;\n }\n const prepared = fields.map((field, index) => coerceField(field, `fields[${index}]`, issues));\n return { ...raw, fields: settleIds(prepared, \"fields\", issues) };\n}\n\nfunction coerceChoices(\n options: unknown[],\n path: string,\n issues: string[],\n): Record<string, unknown>[] {\n const prepared = options.map((option, index) =>\n coerceChoice(option, `${path}[${index}]`, issues),\n );\n return settleIds(prepared, path, issues);\n}\n\nfunction coerceChoice(option: unknown, at: string, issues: string[]): Prepared | undefined {\n if (typeof option === \"string\") {\n const label = option.trim();\n if (label === \"\") {\n issues.push(`${at}: expected a non-empty string`);\n return undefined;\n }\n return { entry: { id: label, label }, derivedId: true };\n }\n if (!isPlainObject(option)) {\n issues.push(\n `${at}: expected a string or an object with { id, label }, got ${describe(option)}`,\n );\n return undefined;\n }\n const identity = coerceIdentity(option, at, issues);\n if (!identity) return undefined;\n const entry: Record<string, unknown> = { ...option, id: identity.id, label: identity.label };\n const { description } = entry;\n // An absent, null, or blank description carries nothing; the contract admits\n // only a non-empty string, and anything else stays for it to reject.\n if (\n description === null ||\n description === undefined ||\n (typeof description === \"string\" && description.trim() === \"\")\n ) {\n delete entry.description;\n }\n return { entry, derivedId: identity.derivedId };\n}\n\nfunction coerceField(field: unknown, at: string, issues: string[]): Prepared | undefined {\n if (!isPlainObject(field)) {\n issues.push(`${at}: expected an object with { id, label, type }, got ${describe(field)}`);\n return undefined;\n }\n const identity = coerceIdentity(field, at, issues);\n if (!identity) return undefined;\n const entry: Record<string, unknown> = { ...field, id: identity.id, label: identity.label };\n const options = field.options;\n // A select with nothing to select is the same unrenderable control a choice\n // gate with no options is, one level down.\n if (field.type === \"choice\" && (!Array.isArray(options) || options.length === 0)) {\n issues.push(\n `${at}.options: expected at least one choice — a choice field with none cannot be answered`,\n );\n return undefined;\n }\n if (Array.isArray(options)) {\n entry.options = coerceChoices(options, `${at}.options`, issues);\n }\n return { entry, derivedId: identity.derivedId };\n}\n\n/**\n * Resolves the `id`/`label` pair of an option or field, letting either supply\n * the other. An id or label of the wrong type is refused rather than replaced:\n * silently swapping in a different id is the failure this module exists to stop\n * — an agent that branches on the id it wrote would never see the substitution.\n */\nfunction coerceIdentity(\n raw: Record<string, unknown>,\n at: string,\n issues: string[],\n): { id: string; label: string; derivedId: boolean } | undefined {\n const id = explicitText(raw.id, at, \"id\", issues);\n const label = explicitText(raw.label, at, \"label\", issues);\n if (!id.ok || !label.ok) return undefined;\n const text = label.value ?? id.value;\n if (text === undefined) {\n issues.push(`${at}: expected a non-empty \\`label\\`, got ${describe(raw.label)}`);\n return undefined;\n }\n return { id: id.value ?? text, label: text, derivedId: id.value === undefined };\n}\n\n/**\n * An explicit `id`/`label`, or `undefined` when the agent supplied nothing to\n * carry (absent, null, or blank). Any other type is intent in the wrong shape,\n * so it is reported instead of dropped.\n */\nfunction explicitText(\n value: unknown,\n at: string,\n key: \"id\" | \"label\",\n issues: string[],\n): { ok: true; value: string | undefined } | { ok: false } {\n if (value === undefined || value === null) return { ok: true, value: undefined };\n if (typeof value !== \"string\") {\n issues.push(`${at}.${key}: expected a non-empty string, got ${describe(value)}`);\n return { ok: false };\n }\n const trimmed = value.trim();\n return { ok: true, value: trimmed === \"\" ? undefined : trimmed };\n}\n\n/**\n * Settles ids across a list of options or fields. Every explicit id is reserved\n * before any derived one is filled in, so a collision's verdict cannot depend on\n * which side of it came first — and a refusal never names an id the agent did\n * not write.\n */\nfunction settleIds(\n prepared: (Prepared | undefined)[],\n path: string,\n issues: string[],\n): Record<string, unknown>[] {\n const used = new Set<string>();\n const reserved = prepared.map((item, index) => {\n if (!item || item.derivedId) return item;\n const id = String(item.entry.id);\n if (used.has(id)) {\n issues.push(\n `${path}[${index}]: duplicate id \"${id}\" — ids must be unique or a host cannot tell the answers apart`,\n );\n return undefined;\n }\n used.add(id);\n return item;\n });\n\n const settled: Record<string, unknown>[] = [];\n reserved.forEach((item, index) => {\n if (!item) return;\n if (item.derivedId) item.entry.id = uniqueId(String(item.entry.id), index, used);\n used.add(String(item.entry.id));\n settled.push(item.entry);\n });\n return settled;\n}\n\nfunction uniqueId(base: string, index: number, used: Set<string>): string {\n if (!used.has(base)) return base;\n // Two options can legitimately share a label; the index disambiguates the id\n // derived from it so the answer stays unambiguous.\n let attempt = index;\n let candidate = `${base}-${attempt}`;\n while (used.has(candidate)) {\n attempt += 1;\n candidate = `${base}-${attempt}`;\n }\n return candidate;\n}\n\nfunction formatIssues(issues: readonly z.core.$ZodIssue[]): string[] {\n return issues.map((issue) => {\n const path = issue.path.reduce<string>((acc, segment) => {\n if (typeof segment === \"number\") return `${acc}[${segment}]`;\n return acc === \"\" ? String(segment) : `${acc}.${String(segment)}`;\n }, \"\");\n return `${path === \"\" ? \"schema\" : path}: ${issue.message}`;\n });\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction describe(value: unknown): string {\n if (value === undefined) return \"nothing\";\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"an array\";\n if (typeof value === \"string\") return `the string ${JSON.stringify(value)}`;\n if (typeof value === \"object\") return \"an object\";\n return `${typeof value} ${String(value)}`;\n}\n","import { consumedOutputFieldPaths, declaredFieldSchema, MISSING_FIELD } from \"./output-fields.js\";\n\ntype SubFlowParent = Parameters<typeof consumedOutputFieldPaths>[0];\ninterface SubFlowChild {\n output?: { schema: Record<string, unknown>; bindings?: Record<string, unknown> };\n}\n\n/**\n * Field paths the parent reads from a sub-flow node that the child flow does not return.\n *\n * A child returns a field only when its `output.schema` declares the path and\n * `output.bindings` binds the top-level property. Paths are dot-joined relative\n * to `output.fields`. The engine calls this when the sub-flow node starts; a host\n * validator can call it at save time with the resolved child definition.\n * Throws when a parent consumer expression does not parse.\n */\nexport function undeclaredSubFlowOutputReads(\n parent: SubFlowParent,\n subFlowNodeId: string,\n child: SubFlowChild,\n): string[] {\n const output = child.output;\n return consumedOutputFieldPaths(parent, subFlowNodeId)\n .filter(\n (path) =>\n output?.bindings === undefined ||\n !Object.hasOwn(output.bindings, path[0]) ||\n declaredFieldSchema(output.schema, path) === MISSING_FIELD,\n )\n .map((path) => path.join(\".\"));\n}\n\n/** One parent read whose declared type the child's returned type does not fit. */\nexport interface SubFlowOutputTypeMismatch {\n /** Dot-joined path relative to `output.fields`. */\n path: string;\n /** JSON Schema `type` the parent's sub-flow node declares for the path. */\n parentType: string[];\n /** JSON Schema `type` the child's `output.schema` declares for the path. */\n childType: string[];\n}\n\nfunction declaredTypes(schema: unknown): string[] | undefined {\n if (typeof schema !== \"object\" || schema === null) return undefined;\n const type = (schema as Record<string, unknown>).type;\n if (typeof type === \"string\") return [type];\n if (Array.isArray(type) && type.every((entry) => typeof entry === \"string\")) return type;\n return undefined;\n}\n\n/**\n * Parent reads whose type, as the parent's sub-flow node declares it in\n * `contract.output.fields`, the child's `output.schema` does not fit.\n *\n * Compares only the JSON Schema `type` keyword, and only where both sides\n * declare one: every child type must be one the parent accepts, with\n * `integer` accepted where the parent says `number`. Reads the child does not\n * return are left to {@link undeclaredSubFlowOutputReads}.\n * Throws when a parent consumer expression does not parse.\n */\nexport function mismatchedSubFlowOutputTypes(\n parent: SubFlowParent,\n subFlowNodeId: string,\n child: SubFlowChild,\n): SubFlowOutputTypeMismatch[] {\n const parentFields = parent.nodes.find(({ id }) => id === subFlowNodeId)?.contract?.output\n ?.fields;\n const childSchema = child.output?.schema;\n if (!parentFields || !childSchema) return [];\n const mismatches: SubFlowOutputTypeMismatch[] = [];\n for (const path of consumedOutputFieldPaths(parent, subFlowNodeId)) {\n const parentType = declaredTypes(declaredFieldSchema(parentFields, path));\n const childType = declaredTypes(declaredFieldSchema(childSchema, path));\n if (!parentType || !childType) continue;\n const fits = childType.every(\n (type) => parentType.includes(type) || (type === \"integer\" && parentType.includes(\"number\")),\n );\n if (!fits) mismatches.push({ path: path.join(\".\"), parentType, childType });\n }\n return mismatches;\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { flowList, flowShow, flowListSessions, flowGetSession, flowFindFlowForSession } from './chunk-
|
|
1
|
+
import { flowList, flowShow, flowListSessions, flowGetSession, flowFindFlowForSession } from './chunk-UAROCOXF.js';
|
|
2
2
|
import { sessionList, sessionGet } from './chunk-R6O6YWU7.js';
|
|
3
|
-
import { skillList, skillShow, skillSearch, skillCheckRequirements, skillGetPreamble } from './chunk-
|
|
3
|
+
import { skillList, skillShow, skillSearch, skillCheckRequirements, skillGetPreamble } from './chunk-W5DWWE4Y.js';
|
|
4
4
|
import { workspaceValidate, workspaceInfo, workspaceTestSecret, workspaceReload } from './chunk-4ZTPYIBE.js';
|
|
5
|
-
import { mountList, mountSync, mountStatus, mountRead, connectorList, connectorRead, connectorWrite, connectorSearch, connectorExec, connectorLoadSkill, connectorDescribe } from './chunk-
|
|
6
|
-
import { withActivityLabelDefs } from './chunk-
|
|
5
|
+
import { mountList, mountSync, mountStatus, mountRead, connectorList, connectorRead, connectorWrite, connectorSearch, connectorExec, connectorLoadSkill, connectorDescribe } from './chunk-IONAUNWB.js';
|
|
6
|
+
import { withActivityLabelDefs } from './chunk-F3RDEH5U.js';
|
|
7
7
|
import { DEFAULT_DRIVER_ID } from './chunk-5BEFNLOR.js';
|
|
8
8
|
import * as zNS from 'zod';
|
|
9
9
|
|
|
@@ -246,5 +246,5 @@ async function runMcpServerStdio(plugin) {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
export { buildWorkspaceMcpServer, buildWorkspaceMcpStdioServer, buildWorkspaceToolDefs, runMcpServerStdio };
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
249
|
+
//# sourceMappingURL=chunk-LSXHED6I.js.map
|
|
250
|
+
//# sourceMappingURL=chunk-LSXHED6I.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../workspace-plugin/src/adapters/mcp.ts"],"names":["z"],"mappings":";;;;;;;;;AA4CA,IAAM,OAAA,GAA4B,SAAkB,GAAA,CAAA,OAAA,IAAW,GAAA;AAiCxD,SAAS,uBAAuB,MAAA,EAA6C;AAClF,EAAA,MAAMA,EAAAA,GAAS,OAAA;AAEf,EAAA,MAAM,MAAA,GAAS,OAAO,MAAA,IAAU,iBAAA;AAChC,EAAA,MAAM,IAAI,MAAA,CAAO,UAAA;AAEjB,EAAA,OAAO;AAAA;AAAA,IAEL;AAAA,MACE,IAAA,EAAM,YAAA;AAAA,MACN,WAAA,EAAa,kEAAA;AAAA,MACb,aAAa,EAAC;AAAA,MACd,OAAA,EAAS,YAAY,SAAA,CAAU,MAAA,CAAO,gBAAgB;AAAA,KACxD;AAAA,IACA;AAAA,MACE,IAAA,EAAM,YAAA;AAAA,MACN,WAAA,EAAa,gEAAA;AAAA,MACb,WAAA,EAAa,EAAE,QAAA,EAAUA,EAAAA,CAAE,QAAO,CAAE,QAAA,CAAS,0BAA0B,CAAA,EAAE;AAAA,MACzE,OAAA,EAAS,OAAO,EAAE,QAAA,OAChB,SAAA,CAAU,MAAA,CAAO,kBAAkB,QAAQ;AAAA,KAC/C;AAAA,IACA;AAAA,MACE,IAAA,EAAM,cAAA;AAAA,MACN,WAAA,EAAa,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A,MACd,OAAA,EAAS,YAAY,eAAA,CAAgB,MAAM;AAAA;AAC7C,GACF;AACF;AAmBA,eAAsB,wBAAwB,MAAA,EAAkD;AAC9F,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,MAAM,OAAO,gCAAgC,CAAA;AAAA,EACrD,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,IAAI,kBAAA,CAAmB;AAAA,IAC5B,IAAA,EAAM,kBAAA;AAAA,IACN,KAAA,EAAO,qBAAA,CAAsB,sBAAA,CAAuB,MAAM,GAAG,OAAO;AAAA,GACrE,CAAA;AACH;AAgBA,eAAsB,6BAA6B,MAAA,EAAuC;AACxF,EAAA,MAAM,EAAE,SAAA,EAAU,GAAI,MAAM,OAAO,yCAAmD,CAAA;AACtF,EAAA,MAAM,MAAA,GAAS,IAAI,SAAA,CAAU,EAAE,MAAM,kBAAA,EAAoB,OAAA,EAAS,SAAS,CAAA;AAC3E,EAAA,KAAA,MAAW,GAAA,IAAO,sBAAA,CAAuB,MAAM,CAAA,EAAG;AAChD,IAAA,MAAA,CAAO,YAAA;AAAA,MACL,GAAA,CAAI,IAAA;AAAA,MACJ,EAAE,WAAA,EAAa,GAAA,CAAI,WAAA,EAAa,WAAA,EAAa,IAAI,WAAA,EAAY;AAAA,MAC7D,GAAA,CAAI;AAAA,KACN;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT;AAaA,eAAsB,kBAAkB,MAAA,EAAwC;AAC9E,EAAA,MAAM,MAAA,GAAS,MAAM,4BAAA,CAA6B,MAAM,CAAA;AACxD,EAAA,MAAM,EAAE,oBAAA,EAAqB,GAAI,MAAM,OACrC,2CACF,CAAA;AACA,EAAA,MAAM,MAAA,CAAO,OAAA,CAAQ,IAAI,oBAAA,EAAsB,CAAA;AACjD","file":"chunk-6UFFKMVC.js","sourcesContent":["// Static namespace import so bun --compile bundles zod into the binary.\n// Dynamic import(\"zod\") via a string variable evades bun's static analysis\n// and fails at runtime inside /$bunfs/. The unwrap (zNS.z ?? zNS.default\n// ?? zNS) handles both bun's native ESM and vitest's CJS-interop resolver,\n// which return the zod namespace at different keys.\nimport * as zNS from \"zod\";\nimport { DEFAULT_DRIVER_ID } from \"@skaile/workspaces/core/framework\";\nimport { withActivityLabelDefs } from \"@skaile/workspaces/types\";\nimport type { WorkspacePlugin } from \"../plugin.js\";\nimport {\n connectorDescribe,\n connectorExec,\n connectorList,\n connectorLoadSkill,\n connectorRead,\n connectorSearch,\n connectorWrite,\n mountList,\n mountRead,\n mountStatus,\n mountSync,\n} from \"../tools/connectors.js\";\nimport {\n flowFindFlowForSession,\n flowGetSession,\n flowList,\n flowListSessions,\n flowShow,\n} from \"../tools/flows.js\";\nimport { sessionGet, sessionList } from \"../tools/sessions.js\";\nimport {\n skillCheckRequirements,\n skillGetPreamble,\n skillList,\n skillSearch,\n skillShow,\n} from \"../tools/skills.js\";\nimport {\n workspaceInfo,\n workspaceReload,\n workspaceTestSecret,\n workspaceValidate,\n} from \"../tools/validator.js\";\n\nconst zStatic: any = (zNS as any).z ?? (zNS as any).default ?? zNS;\n\n/**\n * One workspace plugin tool — name, description, a zod raw-shape input schema,\n * and an async handler returning a `ToolResult`.\n *\n * Carries **zero MCP/SDK dependency**: the same definitions feed both the\n * in-process Claude Agent SDK server ({@link buildWorkspaceMcpServer}) and the\n * raw stdio MCP server ({@link buildWorkspaceMcpStdioServer}).\n */\nexport interface WorkspaceToolDef {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n handler: (args: any) => Promise<unknown>;\n}\n\n/**\n * Build the 27 workspace plugin tool definitions.\n *\n * Tool groups:\n * - 4 mount tools (`mount_list`, `mount_sync`, `mount_status`, `mount_read`)\n * - 5 flow tools (`flow_list`, `flow_show`, `flow_list_sessions`, `flow_get_session`, `flow_find_flow_for_session`)\n * - 5 skill tools (`skill_list`, `skill_show`, `skill_search`, `skill_check_requirements`, `skill_get_preamble`)\n * - 2 session tools (`session_list`, `session_get`)\n * - 7 connector tools (`connector_list`, `connector_read`, `connector_write`, `connector_search`, `connector_exec`, `connector_load_skill`, `connector_describe`)\n * - 4 workspace tools (`workspace_validate`, `workspace_info`, `workspace_test_secret`, `workspace_reload`)\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @returns The 27 tool definitions, free of any MCP/SDK coupling.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildWorkspaceToolDefs(plugin: WorkspacePlugin): WorkspaceToolDef[] {\n const z: any = zStatic;\n\n const driver = plugin.driver ?? DEFAULT_DRIVER_ID;\n const p = plugin.projectDir;\n\n return [\n // Mount tools\n {\n name: \"mount_list\",\n description: \"List all mounts declared in skaile.yaml with their mount status.\",\n inputSchema: {},\n handler: async () => mountList(plugin.connectorManager),\n },\n {\n name: \"mount_sync\",\n description: \"Sync a mount — pull latest from remote (git, S3, WebDAV).\",\n inputSchema: { mount_id: z.string().describe(\"Mount ID from mount_list\") },\n handler: async ({ mount_id }: { mount_id: string }) =>\n mountSync(plugin.connectorManager, mount_id),\n },\n {\n name: \"mount_status\",\n description: \"Get the mount status and last sync time for a mount.\",\n inputSchema: { mount_id: z.string() },\n handler: async ({ mount_id }: { mount_id: string }) =>\n mountStatus(plugin.connectorManager, mount_id),\n },\n {\n name: \"mount_read\",\n description: \"Read a file from a mounted mount by path.\",\n inputSchema: {\n mount_id: z.string(),\n path: z.string().describe(\"Relative path within the mount\"),\n },\n handler: async ({ mount_id, path }: { mount_id: string; path: string }) =>\n mountRead(plugin.connectorManager, mount_id, path),\n },\n // Flow tools\n {\n name: \"flow_list\",\n description: \"List all available flow definitions from ai-assets.\",\n inputSchema: {},\n handler: async () => flowList(p),\n },\n {\n name: \"flow_show\",\n description: \"Show full flow definition (nodes + edges) for a flow ID.\",\n inputSchema: { flow_id: z.string().describe(\"Flow ID from flow_list\") },\n handler: async ({ flow_id }: { flow_id: string }) => flowShow(p, flow_id),\n },\n {\n name: \"flow_list_sessions\",\n description: \"List past and active flow run sessions for this workspace.\",\n inputSchema: {},\n handler: async () => flowListSessions(p),\n },\n {\n name: \"flow_get_session\",\n description: \"Get driver metadata for a specific flow run session.\",\n inputSchema: { run_id: z.string().describe(\"Run ID from flow_list_sessions\") },\n handler: async ({ run_id }: { run_id: string }) => flowGetSession(p, run_id),\n },\n {\n name: \"flow_find_flow_for_session\",\n description: \"Resolve and return the flow definition used in a past session.\",\n inputSchema: { run_id: z.string() },\n handler: async ({ run_id }: { run_id: string }) => flowFindFlowForSession(p, run_id),\n },\n // Skill tools\n {\n name: \"skill_list\",\n description: \"List all skills in the ai-assets catalog.\",\n inputSchema: {},\n handler: async () => skillList(p),\n },\n {\n name: \"skill_show\",\n description: \"Show the full SKILL.md content for a skill ID.\",\n inputSchema: { skill_id: z.string().describe(\"Skill ID from skill_list\") },\n handler: async ({ skill_id }: { skill_id: string }) => skillShow(p, skill_id),\n },\n {\n name: \"skill_search\",\n description: \"Search skills by name, description, or keywords.\",\n inputSchema: { query: z.string() },\n handler: async ({ query }: { query: string }) => skillSearch(p, query),\n },\n {\n name: \"skill_check_requirements\",\n description: \"Validate that all skill prerequisites are met in the target directory.\",\n inputSchema: {\n skill_id: z.string(),\n target_dir: z\n .string()\n .optional()\n .describe(\"Directory to check against (default: projectDir)\"),\n },\n handler: async ({ skill_id, target_dir }: { skill_id: string; target_dir?: string }) =>\n skillCheckRequirements(p, skill_id, target_dir ?? p),\n },\n {\n name: \"skill_get_preamble\",\n description: \"Get the REQUIRES/INPUT/READS/WRITES DSL preamble for a skill.\",\n inputSchema: { skill_id: z.string() },\n handler: async ({ skill_id }: { skill_id: string }) => skillGetPreamble(p, skill_id),\n },\n // Session tools\n {\n name: \"session_list\",\n description: \"List all past agent run sessions for this workspace, sorted newest first.\",\n inputSchema: {},\n handler: async () => sessionList(p),\n },\n {\n name: \"session_get\",\n description: \"Get full metadata for a specific session by run ID.\",\n inputSchema: { run_id: z.string() },\n handler: async ({ run_id }: { run_id: string }) => sessionGet(p, run_id),\n },\n // Connector tools\n {\n name: \"connector_list\",\n description:\n \"List connectors declared in skaile.yaml as {connected, failed, notice?}. A host-managed mount in `connected` carries `health` {status: ok|stale|failed, errorClass, checkedAt}; if it is not ok, tell the user and do not write to it. `failed` holds connectors that did not connect this session, with the failure reason — their mount paths are dead directories, not synced workspaces.\",\n inputSchema: {},\n handler: async () => connectorList(plugin.connectorManager),\n },\n {\n name: \"connector_read\",\n description: \"Read content from a connector by path.\",\n inputSchema: {\n connector_id: z.string().describe(\"Connector ID from connector_list\"),\n path: z.string().describe(\"Path within the connector\"),\n },\n handler: async ({ connector_id, path }: { connector_id: string; path: string }) =>\n connectorRead(plugin.connectorManager, connector_id, path),\n },\n {\n name: \"connector_write\",\n description: \"Write content to a connector by path.\",\n inputSchema: {\n connector_id: z.string(),\n path: z.string(),\n content: z.string().describe(\"Content to write\"),\n },\n handler: async ({\n connector_id,\n path,\n content,\n }: {\n connector_id: string;\n path: string;\n content: string;\n }) => connectorWrite(plugin.connectorManager, connector_id, path, content),\n },\n {\n name: \"connector_search\",\n description: \"Search within a connector by query string.\",\n inputSchema: {\n connector_id: z.string(),\n query: z.string().describe(\"Search query\"),\n },\n handler: async ({ connector_id, query }: { connector_id: string; query: string }) =>\n connectorSearch(plugin.connectorManager, connector_id, query),\n },\n {\n name: \"connector_exec\",\n description: \"Execute a custom operation on a connector.\",\n inputSchema: {\n connector_id: z.string(),\n operation: z.string().describe(\"Operation name from connector_describe\"),\n args: z.record(z.string(), z.unknown()).describe(\"Operation arguments\"),\n },\n handler: async ({\n connector_id,\n operation,\n args,\n }: {\n connector_id: string;\n operation: string;\n args: Record<string, unknown>;\n }) => connectorExec(plugin.connectorManager, connector_id, operation, args),\n },\n {\n name: \"connector_load_skill\",\n description: \"Load the rendered skill body for a connector (operations + usage).\",\n inputSchema: {\n connector_id: z.string(),\n },\n handler: async ({ connector_id }: { connector_id: string }) =>\n connectorLoadSkill(plugin.connectorManager, connector_id),\n },\n {\n name: \"connector_describe\",\n description: \"Describe a connector's capabilities via its RuntimeSkillDescriptor.\",\n inputSchema: {\n connector_id: z.string(),\n },\n handler: async ({ connector_id }: { connector_id: string }) =>\n connectorDescribe(plugin.connectorManager, connector_id),\n },\n // Validator tools\n {\n name: \"workspace_validate\",\n description: \"Run a full health check: connectors, mounts, secrets, driver binary.\",\n inputSchema: {},\n handler: async () => workspaceValidate(plugin, driver),\n },\n {\n name: \"workspace_info\",\n description: \"Show workspace configuration: driver, model, provider, resource counts.\",\n inputSchema: {},\n handler: async () => workspaceInfo(plugin, driver, plugin.model),\n },\n {\n name: \"workspace_test_secret\",\n description: \"Test resolution of one secret reference (env:VAR, forge:key).\",\n inputSchema: { ref: z.string().describe(\"Secret ref e.g. env:ANTHROPIC_API_KEY\") },\n handler: async ({ ref }: { ref: string }) => workspaceTestSecret(ref),\n },\n {\n name: \"workspace_reload\",\n description: \"Re-read skaile.yaml and re-sync the plugin state.\",\n inputSchema: {},\n handler: async () => workspaceReload(plugin),\n },\n ];\n}\n\n/**\n * Build the **in-process** workspace MCP server via the Claude Agent SDK's\n * `createSdkMcpServer`. This shape is what the runner embeds into a Claude\n * Agent SDK `query()` call — the runner *is* the Claude Agent SDK host.\n *\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is not installed\n * (graceful degradation for non-Claude-Code environments).\n *\n * For the standalone `skaile mcp-server` stdio subprocess use\n * {@link buildWorkspaceMcpStdioServer} / {@link runMcpServerStdio} instead —\n * those carry no Claude Agent SDK dependency.\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @returns The SDK MCP server object or `null` if the SDK is unavailable.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport async function buildWorkspaceMcpServer(plugin: WorkspacePlugin): Promise<unknown | null> {\n let sdk: any;\n try {\n sdk = await import(\"@anthropic-ai/claude-agent-sdk\");\n } catch {\n return null;\n }\n return sdk.createSdkMcpServer({\n name: \"skaile-workspace\",\n tools: withActivityLabelDefs(buildWorkspaceToolDefs(plugin), zStatic),\n });\n}\n\n/**\n * Build a **raw stdio** workspace MCP server on `@modelcontextprotocol/sdk` —\n * no Claude Agent SDK. This is the correct shape for the `skaile mcp-server`\n * stdio subprocess that MCP-client agents (Claude Code, Codex, …) spawn.\n * Runs on plain Node.\n *\n * The returned server is not yet connected — call `.connect(transport)` (or\n * use {@link runMcpServerStdio}).\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @returns A `McpServer` with all 27 workspace tools registered.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport async function buildWorkspaceMcpStdioServer(plugin: WorkspacePlugin): Promise<any> {\n const { McpServer } = await import(\"@modelcontextprotocol/sdk/server/mcp.js\" as string);\n const server = new McpServer({ name: \"skaile-workspace\", version: \"1.0.0\" });\n for (const def of buildWorkspaceToolDefs(plugin)) {\n server.registerTool(\n def.name,\n { description: def.description, inputSchema: def.inputSchema },\n def.handler,\n );\n }\n return server;\n}\n\n/**\n * Start the workspace MCP server over stdio transport.\n *\n * Builds the raw `@modelcontextprotocol/sdk` server via\n * {@link buildWorkspaceMcpStdioServer} and connects a `StdioServerTransport`.\n * No `@anthropic-ai/claude-agent-sdk` dependency anywhere on this path.\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport async function runMcpServerStdio(plugin: WorkspacePlugin): Promise<void> {\n const server = await buildWorkspaceMcpStdioServer(plugin);\n const { StdioServerTransport } = await import(\n \"@modelcontextprotocol/sdk/server/stdio.js\" as string\n );\n await server.connect(new StdioServerTransport());\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../workspace-plugin/src/adapters/mcp.ts"],"names":["z"],"mappings":";;;;;;;;;AA4CA,IAAM,OAAA,GAA4B,SAAkB,GAAA,CAAA,OAAA,IAAW,GAAA;AAiCxD,SAAS,uBAAuB,MAAA,EAA6C;AAClF,EAAA,MAAMA,EAAAA,GAAS,OAAA;AAEf,EAAA,MAAM,MAAA,GAAS,OAAO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A,MAAW,GAAA,IAAO,sBAAA,CAAuB,MAAM,CAAA,EAAG;AAChD,IAAA,MAAA,CAAO,YAAA;AAAA,MACL,GAAA,CAAI,IAAA;AAAA,MACJ,EAAE,WAAA,EAAa,GAAA,CAAI,WAAA,EAAa,WAAA,EAAa,IAAI,WAAA,EAAY;AAAA,MAC7D,GAAA,CAAI;AAAA,KACN;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT;AAaA,eAAsB,kBAAkB,MAAA,EAAwC;AAC9E,EAAA,MAAM,MAAA,GAAS,MAAM,4BAAA,CAA6B,MAAM,CAAA;AACxD,EAAA,MAAM,EAAE,oBAAA,EAAqB,GAAI,MAAM,OACrC,2CACF,CAAA;AACA,EAAA,MAAM,MAAA,CAAO,OAAA,CAAQ,IAAI,oBAAA,EAAsB,CAAA;AACjD","file":"chunk-LSXHED6I.js","sourcesContent":["// Static namespace import so bun --compile bundles zod into the binary.\n// Dynamic import(\"zod\") via a string variable evades bun's static analysis\n// and fails at runtime inside /$bunfs/. The unwrap (zNS.z ?? zNS.default\n// ?? zNS) handles both bun's native ESM and vitest's CJS-interop resolver,\n// which return the zod namespace at different keys.\nimport * as zNS from \"zod\";\nimport { DEFAULT_DRIVER_ID } from \"@skaile/workspaces/core/framework\";\nimport { withActivityLabelDefs } from \"@skaile/workspaces/types\";\nimport type { WorkspacePlugin } from \"../plugin.js\";\nimport {\n connectorDescribe,\n connectorExec,\n connectorList,\n connectorLoadSkill,\n connectorRead,\n connectorSearch,\n connectorWrite,\n mountList,\n mountRead,\n mountStatus,\n mountSync,\n} from \"../tools/connectors.js\";\nimport {\n flowFindFlowForSession,\n flowGetSession,\n flowList,\n flowListSessions,\n flowShow,\n} from \"../tools/flows.js\";\nimport { sessionGet, sessionList } from \"../tools/sessions.js\";\nimport {\n skillCheckRequirements,\n skillGetPreamble,\n skillList,\n skillSearch,\n skillShow,\n} from \"../tools/skills.js\";\nimport {\n workspaceInfo,\n workspaceReload,\n workspaceTestSecret,\n workspaceValidate,\n} from \"../tools/validator.js\";\n\nconst zStatic: any = (zNS as any).z ?? (zNS as any).default ?? zNS;\n\n/**\n * One workspace plugin tool — name, description, a zod raw-shape input schema,\n * and an async handler returning a `ToolResult`.\n *\n * Carries **zero MCP/SDK dependency**: the same definitions feed both the\n * in-process Claude Agent SDK server ({@link buildWorkspaceMcpServer}) and the\n * raw stdio MCP server ({@link buildWorkspaceMcpStdioServer}).\n */\nexport interface WorkspaceToolDef {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n handler: (args: any) => Promise<unknown>;\n}\n\n/**\n * Build the 27 workspace plugin tool definitions.\n *\n * Tool groups:\n * - 4 mount tools (`mount_list`, `mount_sync`, `mount_status`, `mount_read`)\n * - 5 flow tools (`flow_list`, `flow_show`, `flow_list_sessions`, `flow_get_session`, `flow_find_flow_for_session`)\n * - 5 skill tools (`skill_list`, `skill_show`, `skill_search`, `skill_check_requirements`, `skill_get_preamble`)\n * - 2 session tools (`session_list`, `session_get`)\n * - 7 connector tools (`connector_list`, `connector_read`, `connector_write`, `connector_search`, `connector_exec`, `connector_load_skill`, `connector_describe`)\n * - 4 workspace tools (`workspace_validate`, `workspace_info`, `workspace_test_secret`, `workspace_reload`)\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @returns The 27 tool definitions, free of any MCP/SDK coupling.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildWorkspaceToolDefs(plugin: WorkspacePlugin): WorkspaceToolDef[] {\n const z: any = zStatic;\n\n const driver = plugin.driver ?? DEFAULT_DRIVER_ID;\n const p = plugin.projectDir;\n\n return [\n // Mount tools\n {\n name: \"mount_list\",\n description: \"List all mounts declared in skaile.yaml with their mount status.\",\n inputSchema: {},\n handler: async () => mountList(plugin.connectorManager),\n },\n {\n name: \"mount_sync\",\n description: \"Sync a mount — pull latest from remote (git, S3, WebDAV).\",\n inputSchema: { mount_id: z.string().describe(\"Mount ID from mount_list\") },\n handler: async ({ mount_id }: { mount_id: string }) =>\n mountSync(plugin.connectorManager, mount_id),\n },\n {\n name: \"mount_status\",\n description: \"Get the mount status and last sync time for a mount.\",\n inputSchema: { mount_id: z.string() },\n handler: async ({ mount_id }: { mount_id: string }) =>\n mountStatus(plugin.connectorManager, mount_id),\n },\n {\n name: \"mount_read\",\n description: \"Read a file from a mounted mount by path.\",\n inputSchema: {\n mount_id: z.string(),\n path: z.string().describe(\"Relative path within the mount\"),\n },\n handler: async ({ mount_id, path }: { mount_id: string; path: string }) =>\n mountRead(plugin.connectorManager, mount_id, path),\n },\n // Flow tools\n {\n name: \"flow_list\",\n description: \"List all available flow definitions from ai-assets.\",\n inputSchema: {},\n handler: async () => flowList(p),\n },\n {\n name: \"flow_show\",\n description: \"Show full flow definition (nodes + edges) for a flow ID.\",\n inputSchema: { flow_id: z.string().describe(\"Flow ID from flow_list\") },\n handler: async ({ flow_id }: { flow_id: string }) => flowShow(p, flow_id),\n },\n {\n name: \"flow_list_sessions\",\n description: \"List past and active flow run sessions for this workspace.\",\n inputSchema: {},\n handler: async () => flowListSessions(p),\n },\n {\n name: \"flow_get_session\",\n description: \"Get driver metadata for a specific flow run session.\",\n inputSchema: { run_id: z.string().describe(\"Run ID from flow_list_sessions\") },\n handler: async ({ run_id }: { run_id: string }) => flowGetSession(p, run_id),\n },\n {\n name: \"flow_find_flow_for_session\",\n description: \"Resolve and return the flow definition used in a past session.\",\n inputSchema: { run_id: z.string() },\n handler: async ({ run_id }: { run_id: string }) => flowFindFlowForSession(p, run_id),\n },\n // Skill tools\n {\n name: \"skill_list\",\n description: \"List all skills in the ai-assets catalog.\",\n inputSchema: {},\n handler: async () => skillList(p),\n },\n {\n name: \"skill_show\",\n description: \"Show the full SKILL.md content for a skill ID.\",\n inputSchema: { skill_id: z.string().describe(\"Skill ID from skill_list\") },\n handler: async ({ skill_id }: { skill_id: string }) => skillShow(p, skill_id),\n },\n {\n name: \"skill_search\",\n description: \"Search skills by name, description, or keywords.\",\n inputSchema: { query: z.string() },\n handler: async ({ query }: { query: string }) => skillSearch(p, query),\n },\n {\n name: \"skill_check_requirements\",\n description: \"Validate that all skill prerequisites are met in the target directory.\",\n inputSchema: {\n skill_id: z.string(),\n target_dir: z\n .string()\n .optional()\n .describe(\"Directory to check against (default: projectDir)\"),\n },\n handler: async ({ skill_id, target_dir }: { skill_id: string; target_dir?: string }) =>\n skillCheckRequirements(p, skill_id, target_dir ?? p),\n },\n {\n name: \"skill_get_preamble\",\n description: \"Get the REQUIRES/INPUT/READS/WRITES DSL preamble for a skill.\",\n inputSchema: { skill_id: z.string() },\n handler: async ({ skill_id }: { skill_id: string }) => skillGetPreamble(p, skill_id),\n },\n // Session tools\n {\n name: \"session_list\",\n description: \"List all past agent run sessions for this workspace, sorted newest first.\",\n inputSchema: {},\n handler: async () => sessionList(p),\n },\n {\n name: \"session_get\",\n description: \"Get full metadata for a specific session by run ID.\",\n inputSchema: { run_id: z.string() },\n handler: async ({ run_id }: { run_id: string }) => sessionGet(p, run_id),\n },\n // Connector tools\n {\n name: \"connector_list\",\n description:\n \"List connectors declared in skaile.yaml as {connected, failed, notice?}. A host-managed mount in `connected` carries `health` {status: ok|stale|failed, errorClass, checkedAt}; if it is not ok, tell the user and do not write to it. `failed` holds connectors that did not connect this session, with the failure reason — their mount paths are dead directories, not synced workspaces.\",\n inputSchema: {},\n handler: async () => connectorList(plugin.connectorManager),\n },\n {\n name: \"connector_read\",\n description: \"Read content from a connector by path.\",\n inputSchema: {\n connector_id: z.string().describe(\"Connector ID from connector_list\"),\n path: z.string().describe(\"Path within the connector\"),\n },\n handler: async ({ connector_id, path }: { connector_id: string; path: string }) =>\n connectorRead(plugin.connectorManager, connector_id, path),\n },\n {\n name: \"connector_write\",\n description: \"Write content to a connector by path.\",\n inputSchema: {\n connector_id: z.string(),\n path: z.string(),\n content: z.string().describe(\"Content to write\"),\n },\n handler: async ({\n connector_id,\n path,\n content,\n }: {\n connector_id: string;\n path: string;\n content: string;\n }) => connectorWrite(plugin.connectorManager, connector_id, path, content),\n },\n {\n name: \"connector_search\",\n description: \"Search within a connector by query string.\",\n inputSchema: {\n connector_id: z.string(),\n query: z.string().describe(\"Search query\"),\n },\n handler: async ({ connector_id, query }: { connector_id: string; query: string }) =>\n connectorSearch(plugin.connectorManager, connector_id, query),\n },\n {\n name: \"connector_exec\",\n description: \"Execute a custom operation on a connector.\",\n inputSchema: {\n connector_id: z.string(),\n operation: z.string().describe(\"Operation name from connector_describe\"),\n args: z.record(z.string(), z.unknown()).describe(\"Operation arguments\"),\n },\n handler: async ({\n connector_id,\n operation,\n args,\n }: {\n connector_id: string;\n operation: string;\n args: Record<string, unknown>;\n }) => connectorExec(plugin.connectorManager, connector_id, operation, args),\n },\n {\n name: \"connector_load_skill\",\n description: \"Load the rendered skill body for a connector (operations + usage).\",\n inputSchema: {\n connector_id: z.string(),\n },\n handler: async ({ connector_id }: { connector_id: string }) =>\n connectorLoadSkill(plugin.connectorManager, connector_id),\n },\n {\n name: \"connector_describe\",\n description: \"Describe a connector's capabilities via its RuntimeSkillDescriptor.\",\n inputSchema: {\n connector_id: z.string(),\n },\n handler: async ({ connector_id }: { connector_id: string }) =>\n connectorDescribe(plugin.connectorManager, connector_id),\n },\n // Validator tools\n {\n name: \"workspace_validate\",\n description: \"Run a full health check: connectors, mounts, secrets, driver binary.\",\n inputSchema: {},\n handler: async () => workspaceValidate(plugin, driver),\n },\n {\n name: \"workspace_info\",\n description: \"Show workspace configuration: driver, model, provider, resource counts.\",\n inputSchema: {},\n handler: async () => workspaceInfo(plugin, driver, plugin.model),\n },\n {\n name: \"workspace_test_secret\",\n description: \"Test resolution of one secret reference (env:VAR, forge:key).\",\n inputSchema: { ref: z.string().describe(\"Secret ref e.g. env:ANTHROPIC_API_KEY\") },\n handler: async ({ ref }: { ref: string }) => workspaceTestSecret(ref),\n },\n {\n name: \"workspace_reload\",\n description: \"Re-read skaile.yaml and re-sync the plugin state.\",\n inputSchema: {},\n handler: async () => workspaceReload(plugin),\n },\n ];\n}\n\n/**\n * Build the **in-process** workspace MCP server via the Claude Agent SDK's\n * `createSdkMcpServer`. This shape is what the runner embeds into a Claude\n * Agent SDK `query()` call — the runner *is* the Claude Agent SDK host.\n *\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is not installed\n * (graceful degradation for non-Claude-Code environments).\n *\n * For the standalone `skaile mcp-server` stdio subprocess use\n * {@link buildWorkspaceMcpStdioServer} / {@link runMcpServerStdio} instead —\n * those carry no Claude Agent SDK dependency.\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @returns The SDK MCP server object or `null` if the SDK is unavailable.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport async function buildWorkspaceMcpServer(plugin: WorkspacePlugin): Promise<unknown | null> {\n let sdk: any;\n try {\n sdk = await import(\"@anthropic-ai/claude-agent-sdk\");\n } catch {\n return null;\n }\n return sdk.createSdkMcpServer({\n name: \"skaile-workspace\",\n tools: withActivityLabelDefs(buildWorkspaceToolDefs(plugin), zStatic),\n });\n}\n\n/**\n * Build a **raw stdio** workspace MCP server on `@modelcontextprotocol/sdk` —\n * no Claude Agent SDK. This is the correct shape for the `skaile mcp-server`\n * stdio subprocess that MCP-client agents (Claude Code, Codex, …) spawn.\n * Runs on plain Node.\n *\n * The returned server is not yet connected — call `.connect(transport)` (or\n * use {@link runMcpServerStdio}).\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n * @returns A `McpServer` with all 27 workspace tools registered.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport async function buildWorkspaceMcpStdioServer(plugin: WorkspacePlugin): Promise<any> {\n const { McpServer } = await import(\"@modelcontextprotocol/sdk/server/mcp.js\" as string);\n const server = new McpServer({ name: \"skaile-workspace\", version: \"1.0.0\" });\n for (const def of buildWorkspaceToolDefs(plugin)) {\n server.registerTool(\n def.name,\n { description: def.description, inputSchema: def.inputSchema },\n def.handler,\n );\n }\n return server;\n}\n\n/**\n * Start the workspace MCP server over stdio transport.\n *\n * Builds the raw `@modelcontextprotocol/sdk` server via\n * {@link buildWorkspaceMcpStdioServer} and connects a `StdioServerTransport`.\n * No `@anthropic-ai/claude-agent-sdk` dependency anywhere on this path.\n *\n * @param plugin - A booted `WorkspacePlugin` instance.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport async function runMcpServerStdio(plugin: WorkspacePlugin): Promise<void> {\n const server = await buildWorkspaceMcpStdioServer(plugin);\n const { StdioServerTransport } = await import(\n \"@modelcontextprotocol/sdk/server/stdio.js\" as string\n );\n await server.connect(new StdioServerTransport());\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAgentNode, isGateNode, isCheckNode, nodeIsOptional, nodeRequiresApproval, nodeLabel, flowDefaults } from './chunk-
|
|
1
|
+
import { isAgentNode, isGateNode, isCheckNode, nodeIsOptional, nodeRequiresApproval, nodeLabel, flowDefaults } from './chunk-7RGTAEG6.js';
|
|
2
2
|
|
|
3
3
|
// factory-assets/connectors/flow/prompt-fragments.ts
|
|
4
4
|
function renderStimulusPrompt(stimulus) {
|
|
@@ -219,5 +219,5 @@ function describeStimulus(stimulus) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
export { buildOrchestratorPrompt, describeStimulus, renderStimulusPrompt, renderSubpromptPrompt };
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-M3WPBTGJ.js.map
|
|
223
|
+
//# sourceMappingURL=chunk-M3WPBTGJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../factory-assets/connectors/flow/prompt-fragments.ts"],"names":[],"mappings":";;;AA2DO,SAAS,qBAAqB,QAAA,EAAgC;AACnE,EAAA,QAAQ,SAAS,IAAA;AAAM,IACrB,KAAK,cAAA;AACH,MAAA,OAAO,iKAAA;AAAA,IACT,KAAK,mBAAA,EAAqB;AACxB,MAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAU,SAAA,EA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M,IACrB,KAAK,cAAA;AACH,MAAA,OAAO,cAAA;AAAA,IACT,KAAK,mBAAA;AACH,MAAA,OAAO,CAAA,kBAAA,EAAqB,QAAA,CAAS,MAAM,CAAA,CAAA,EAAI,SAAS,QAAQ,CAAA,CAAA;AAAA,IAClE,KAAK,gBAAA;AACH,MAAA,OAAO,CAAA,eAAA,EAAkB,SAAS,MAAM,CAAA,CAAA;AAAA,IAC1C,KAAK,iBAAA;AACH,MAAA,OAAO,CAAA,gBAAA,EAAmB,SAAS,MAAM,CAAA,CAAA;AAAA,IAC3C,KAAK,cAAA;AACH,MAAA,OAAO,CAAA,aAAA,EAAgB,SAAS,QAAQ,CAAA,CAAA;AAAA,IAC1C,KAAK,2BAAA;AACH,MAAA,OAAO,2BAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,WAAA;AAAA,IACT,KAAK,eAAA;AACH,MAAA,OAAO,eAAA;AAAA;AAEb","file":"chunk-XUUYAS3Z.js","sourcesContent":["/**\n * Prompt fragments for the flow connector.\n *\n * Pure functions that translate a {@link TurnStimulus} into the strings the\n * runner's flow orchestrator splices into the per-turn agent prompt.\n * Extracted from `runner/src/flow-orchestrator.ts` in Phase 3 of the\n * flow-connector extraction (2026-05-08) so the connector owns its\n * prompt-rendering surface without a runtime dep on the orchestrator.\n *\n * The contract is byte-identical to the previous inline implementation —\n * any divergence is a regression.\n *\n * @docLink packages/factory-assets/flow#prompt-fragments\n */\n\nimport type { FlowExecution } from \"@skaile/workspaces/types\";\nimport type { FlowDefinition } from \"./engine/types.js\";\nimport {\n flowDefaults,\n isAgentNode,\n isCheckNode,\n isGateNode,\n nodeIsOptional,\n nodeLabel,\n nodeRequiresApproval,\n} from \"./engine/node-shape.js\";\n\n/**\n * Reasons why a new turn is starting. The flow orchestrator's prompt template\n * renders a stimulus-specific paragraph (via {@link renderStimulusPrompt}) so\n * the agent knows exactly why it has been invoked.\n *\n * @docLink packages/factory-assets/flow#turn-stimulus\n */\nexport type TurnStimulus =\n | { kind: \"flow_started\" }\n | {\n kind: \"approval_received\";\n nodeId: string;\n decision: \"approved\" | \"rejected\";\n feedback?: string;\n decidedBy: string;\n }\n | { kind: \"input_received\"; nodeId: string; response: unknown; providedBy: string }\n | { kind: \"retry_requested\"; nodeId: string; requestedBy: string }\n | { kind: \"user_message\"; text: string; senderId: string }\n | { kind: \"resumed_after_hibernation\" }\n | { kind: \"cancelled\" }\n | { kind: \"state_changed\" };\n\n/**\n * Render the stimulus paragraph the agent sees at turn start.\n *\n * The output is a single paragraph (one or more sentences, no surrounding\n * whitespace) describing why the runner has woken the agent. Spliced into\n * the orchestrator prompt under the `## Why this turn is happening` heading.\n *\n * @docLink packages/factory-assets/flow#render-stimulus-prompt\n */\nexport function renderStimulusPrompt(stimulus: TurnStimulus): string {\n switch (stimulus.kind) {\n case \"flow_started\":\n return \"The user just started this flow. Begin with the first available node — call `get_available`, then `build_handoff` for your chosen node, then `start_node`.\";\n case \"approval_received\": {\n const { nodeId, decision, decidedBy, feedback } = stimulus;\n if (decision === \"approved\") {\n return `Node \\`${nodeId}\\` was **approved** by ${decidedBy}. Call \\`complete_node\\` for this node with the approved output, then advance to the next available node.`;\n }\n const fb = feedback ? ` Feedback: \"${feedback}\".` : \"\";\n return `Node \\`${nodeId}\\` was **rejected** by ${decidedBy}.${fb} Decide how to proceed: retry the node (the engine returned it to \\`available\\`), ask clarifying questions via \\`request_input\\`, or call \\`fail_node(..., recoverable: false)\\` if the issue cannot be addressed.`;\n }\n case \"input_received\":\n return `The user just provided input for node \\`${stimulus.nodeId}\\` (provided by ${stimulus.providedBy}). The node has returned to its prior status. Continue executing the node with this input.`;\n case \"retry_requested\":\n return `A user requested a retry of node \\`${stimulus.nodeId}\\` (requested by ${stimulus.requestedBy}). The node has been returned to \\`available\\` with its prior error preserved in history. Start a fresh attempt — review the error context if relevant and try a different approach.`;\n case \"user_message\":\n return `A user sent a message: \"${stimulus.text}\" (from ${stimulus.senderId}). You can respond directly without touching the flow, continue flow work, or both. If the message is a question about the flow, answer it; if it signals a new direction, consider whether to pause.`;\n case \"resumed_after_hibernation\":\n return \"This session was hibernated and has just resumed. Review the current state above and continue where you left off. No state was lost.\";\n case \"cancelled\":\n return \"The user has cancelled this flow. Wrap up cleanly: do not start any new nodes. You may record a short summary if relevant, then stop.\";\n case \"state_changed\":\n return \"The flow state changed. Review the current state above and continue work accordingly.\";\n }\n}\n\n/**\n * Build the full agent-orchestrator prompt for a flow turn.\n *\n * Reassembles the five-section prompt from the current FlowExecution snapshot\n * and the supplied stimulus:\n *\n * 1. Flow definition (markdown table of nodes)\n * 2. Current state (progress, available/blocked, interaction pointers)\n * 3. Why this turn is happening (stimulus-specific paragraph)\n * 4. Flow tools available (static documentation)\n * 5. Rules\n *\n * Originally a byte-identical lift of the (since-deleted)\n * `FlowOrchestrator.buildOrchestratorPrompt`; the contract now is simply\n * this function's own output. When strict v2 defaults or legacy globals are\n * non-empty, a `## Flow globals` section exposes those run-scoped values. The\n * flow-wide active-node table stays bounded to selection metadata; `build_handoff`\n * supplies a selected agent node's execution payload. First-class gates appear\n * as runtime-owned state but never as agent-executable work.\n * Pure — depends only on its inputs.\n *\n * @docLink packages/factory-assets/flow#build-orchestrator-prompt\n * @since 2.2.0\n */\nexport function buildOrchestratorPrompt(\n flowDef: FlowDefinition,\n state: FlowExecution,\n stimulus: TurnStimulus,\n): string {\n const agentNodes = flowDef.nodes.filter(isAgentNode);\n const gateNodes = flowDef.nodes.filter(isGateNode);\n const checkNodes = flowDef.nodes.filter(isCheckNode);\n const promptNodes = flowDef.nodes.filter((node) => isAgentNode(node) || isGateNode(node));\n const agentNodeIds = new Set(agentNodes.map((node) => node.id));\n const promptNodeIds = new Set(promptNodes.map((node) => node.id));\n\n // ── Section 1: definition table ──\n const nodeRows = promptNodes\n .map((n) => {\n const deps =\n flowDef.edges\n .filter((e) => e.target === n.id && e.type === \"flow\")\n .map((e) => e.source)\n .join(\", \") || \"—\";\n const required = nodeIsOptional(n) ? \"optional\" : \"required\";\n const gate = isGateNode(n) ? \"first-class\" : nodeRequiresApproval(n) ? \"mandatory\" : \"—\";\n const nodeState = state.nodes[n.id];\n const status = nodeState?.status ?? \"not_started\";\n const description = (n.description ?? n.data?.description ?? \"—\")\n .replace(/\\s+/g, \" \")\n .replaceAll(\"|\", \"\\\\|\");\n return `| ${n.id} | ${nodeLabel(n)} | ${description} | ${required} | ${gate} | ${status} | ${deps} |`;\n })\n .join(\"\\n\");\n\n // ── Section 2: current state summary ──\n const nodesByStatus = (s: string) =>\n Object.values(state.nodes)\n .filter((n) => promptNodeIds.has(n.id) && n.status === s)\n .map((n) => n.id);\n // An approved agent node stays `awaiting_approval` until the agent calls\n // `complete_node`. Listed with the undecided ones, a resumed agent reads the\n // human decision as still pending and ends its turn, hanging the run.\n const approvedAwaitingCompletion = Object.values(state.nodes).filter(\n (n) =>\n agentNodeIds.has(n.id) &&\n n.status === \"awaiting_approval\" &&\n n.approval?.decision === \"approved\" &&\n n.approval.decidedAt != null,\n );\n const approvedIds = new Set(approvedAwaitingCompletion.map((n) => n.id));\n const available = nodesByStatus(\"available\");\n const awaitingApproval = nodesByStatus(\"awaiting_approval\").filter((id) => !approvedIds.has(id));\n const awaitingInput = nodesByStatus(\"awaiting_input\");\n const running = nodesByStatus(\"running\");\n const failed = nodesByStatus(\"failed\");\n const completed = nodesByStatus(\"complete\");\n const totalRequired = promptNodes.filter((n) => !nodeIsOptional(n)).length;\n\n const stateSummary = [\n `- Run ID: ${state.runId}`,\n `- Status: ${state.status}`,\n `- Autonomous mode: ${state.autonomousMode}`,\n `- Progress: ${completed.length} / ${totalRequired} required nodes complete`,\n `- Available now: ${available.join(\", \") || \"(none)\"}`,\n `- Currently running: ${running.join(\", \") || \"(none)\"}`,\n `- Awaiting approval: ${awaitingApproval.join(\", \") || \"(none)\"}`,\n ...(approvedIds.size > 0\n ? [`- Approved, awaiting \\`complete_node\\`: ${[...approvedIds].join(\", \")}`]\n : []),\n `- Awaiting input: ${awaitingInput.join(\", \") || \"(none)\"}`,\n `- Failed: ${failed.join(\", \") || \"(none)\"}`,\n ].join(\"\\n\");\n\n const approvedSection =\n approvedAwaitingCompletion.length > 0\n ? `## Approved nodes awaiting completion\n\n${approvedAwaitingCompletion\n .map(\n (node) =>\n `- \\`${node.id}\\` — approved by ${node.approval?.decidedBy ?? \"unknown reviewer\"} at ${node.approval?.decidedAt}`,\n )\n .join(\"\\n\")}\n\nA human has already approved these nodes. Do not wait for another decision and do not call \\`request_approval\\` again. Carry out whatever the approval authorised that is still outstanding, then call \\`complete_node\\` for each.\n\n`\n : \"\";\n\n const outputCorrections = Object.values(state.nodes)\n .filter(\n (node) =>\n agentNodeIds.has(node.id) &&\n node.outputCorrection &&\n node.status !== \"complete\" &&\n node.status !== \"failed\",\n )\n .map(\n (node) =>\n `- Node \\`${node.id}\\`: ${node.outputCorrection?.issues.join(\"; \") ?? \"unknown issue\"}`,\n );\n const correctionSection =\n outputCorrections.length > 0\n ? `## Output correction required\n\nThe following node has already used its single corrective reprompt. Submit one corrected \\`complete_node\\` call that fixes every issue; a second mismatch fails the node.\n\n${outputCorrections.join(\"\\n\")}\n\n`\n : \"\";\n\n const rejectedGates = gateNodes.flatMap((node) => {\n const approval = state.nodes[node.id]?.approval;\n if (approval?.decision !== \"rejected\") return [];\n return [\n `- \\`${node.id}\\` — rejected by ${approval.decidedBy ?? \"unknown reviewer\"}: ${\n approval.feedback ?? \"(no feedback provided)\"\n }`,\n ];\n });\n const rejectedGateSection =\n rejectedGates.length > 0\n ? `## Rejected first-class gates requiring revision\n\n${rejectedGates.join(\"\\n\")}\n\nRevise the surrounding work in conversation, then re-request each gate with \\`request_approval(nodeId, summary, artifacts)\\`. Every gate remains parked until its new human decision; do not start, complete, skip, or fail a first-class gate.\n\n`\n : \"\";\n\n // An override survives only in the approval record: the state table shows the\n // node as `complete` like any other, so without this section the failure is\n // invisible from the turn after the decision onward.\n const overriddenChecks = checkNodes.flatMap((node) => {\n const record = state.nodes[node.id];\n if (record?.status !== \"complete\" || record.approval?.decision !== \"approved\") return [];\n return [\n `- \\`${node.id}\\` — failed, overridden by ${record.approval.decidedBy ?? \"unknown reviewer\"}: ${\n record.approval.feedback ?? \"(no reason recorded)\"\n }`,\n ];\n });\n const overriddenCheckSection =\n overriddenChecks.length > 0\n ? `## Checks completed by human override\n\n${overriddenChecks.join(\"\\n\")}\n\nThese checks did **not** pass. A human decided the run may continue anyway, so they are \\`complete\\` and their dependents are unblocked. Their evidence still records the failure — do not report them as passing, and say so if downstream work depends on what they were meant to verify.\n\n`\n : \"\";\n\n // ── Section 2b: flow globals (additive — omitted entirely when empty so\n // flows without globals keep the byte-identical Phase 3 prompt) ──\n const globals = flowDefaults(flowDef);\n const globalsSection =\n Object.keys(globals).length > 0\n ? `## Flow globals\n\nRun-scoped parameters set by the flow author or by the host that started this run. When \\`run_input\\` is present it carries the payload this run was started with (e.g. a scheduled or webhook-triggered run) — treat it as the run's initial input instead of asking the user for it.\n\n\\`\\`\\`json\n${JSON.stringify(globals, null, 2)}\n\\`\\`\\`\n\n`\n : \"\";\n\n // ── Section 3: stimulus paragraph ──\n const stimulusNode =\n stimulus.kind === \"approval_received\"\n ? flowDef.nodes.find((node) => node.id === stimulus.nodeId)\n : undefined;\n let stimulusParagraph = renderStimulusPrompt(stimulus);\n if (stimulus.kind === \"approval_received\" && stimulusNode && isGateNode(stimulusNode)) {\n if (stimulus.decision === \"approved\") {\n const availableSuccessors = agentNodes\n .filter((node) => state.nodes[node.id]?.status === \"available\")\n .map((node) => `\\`${node.id}\\``);\n stimulusParagraph = `Gate node \\`${stimulus.nodeId}\\` is already \\`complete\\` after approval by ${stimulus.decidedBy}. Do not call \\`complete_node\\` for the gate. Advance to successor work${\n availableSuccessors.length > 0\n ? `; available agent nodes: ${availableSuccessors.join(\", \")}`\n : \"\"\n } — call \\`get_available\\`, then \\`build_handoff\\` and \\`start_node\\` for the chosen agent node.`;\n } else {\n stimulusParagraph = `Gate node \\`${stimulus.nodeId}\\` was **rejected** by ${stimulus.decidedBy}.${\n stimulus.feedback ? ` Feedback: \"${stimulus.feedback}\".` : \"\"\n } Revise the work in conversation and follow the rejected-gate instructions above.`;\n }\n }\n // A check is host-decided the same way a gate is: the adapter already wrote the\n // terminal status, and `complete_node` rejects any non-agent node — so the\n // generic approved/rejected wording would send the agent into a guaranteed throw.\n if (stimulus.kind === \"approval_received\" && stimulusNode && isCheckNode(stimulusNode)) {\n const availableSuccessors = agentNodes\n .filter((node) => state.nodes[node.id]?.status === \"available\")\n .map((node) => `\\`${node.id}\\``);\n stimulusParagraph =\n stimulus.decision === \"approved\"\n ? `Check node \\`${stimulus.nodeId}\\` failed, and ${stimulus.decidedBy} **overrode** the failure${\n stimulus.feedback ? `: \"${stimulus.feedback}\"` : \"\"\n }. The node is already \\`complete\\` and its evidence still records the failure. Do not call \\`complete_node\\` for it. Advance to successor work${\n availableSuccessors.length > 0\n ? `; available agent nodes: ${availableSuccessors.join(\", \")}`\n : \"\"\n } — call \\`get_available\\`, then \\`build_handoff\\` and \\`start_node\\` for the chosen agent node.`\n : `Check node \\`${stimulus.nodeId}\\` failed and ${stimulus.decidedBy} **rejected** it${\n stimulus.feedback ? `: \"${stimulus.feedback}\"` : \"\"\n }. The node is already terminally \\`failed\\` — it did not return to \\`available\\`. Do not call \\`complete_node\\` or \\`fail_node\\` for it. Report the outcome and stop unless other nodes remain available.`;\n }\n\n // ── Section 4+5: static tool surface and rules ──\n return `# Flow Execution Context\n\nYou are orchestrating the flow **${flowDef.name}** (${flowDef.id} v${flowDef.version}). This is a governed flow execution: your job is to run nodes through the flow tools, summarize their outputs for human review, and yield control at approval gates.\n\n## Flow definition\n\n| ID | Label | Description | Required | Gate | Status | Depends on |\n|----|-------|-------------|----------|------|--------|------------|\n${nodeRows}\n\nNodes with **Gate = mandatory** are hard approval gates: they always require \\`request_approval\\` and a human decision, even when autonomous mode is on. They cannot be skipped — \\`request_approval\\` → approval is their only completion path.\nNodes with **Gate = first-class** are runtime-owned human decisions. The runtime parks them automatically and completes them directly on approval; the agent never executes them.\n\n## Current state\n\n${stateSummary}\n\n${globalsSection}${correctionSection}${rejectedGateSection}${overriddenCheckSection}${approvedSection}## Why this turn is happening\n\n${stimulusParagraph}\n\n## Flow tools available\n\nAll tools are exposed by the \\`flow\\` connector:\n\n- \\`get_available()\\` — list node IDs that are ready to start\n- \\`get_state()\\` — full current state including approvals, inputs, outputs\n- \\`get_globals()\\` — the flow's run-scoped globals (e.g. the \\`run_input\\` payload for scheduled/params-bound runs)\n- \\`build_handoff(nodeId)\\` — selected node instruction, supplied bindings, required assets, and upstream context\n- \\`start_node(nodeId)\\` — transition an agent node from \\`available\\` → \\`running\\`; call before executing it. Never start a first-class gate.\n- \\`request_approval(nodeId, summary, artifacts)\\` — transition a running agent node to \\`awaiting_approval\\`, or replace a rejected first-class gate's decision with a fresh pending request. **This ends your turn.**\n- \\`request_input(nodeId, prompt, schema)\\` — transition to \\`awaiting_input\\`. **This ends your turn.** Legal from \\`available\\`, \\`running\\`, or \\`awaiting_approval\\`.\n- \\`complete_node(nodeId, summary, fields?, artifacts?, concerns?)\\` — complete an agent node. When downstream nodes consume declared output fields, include a conforming JSON object. The first mismatch gets one corrective call; the second fails the node. Valid only if the agent node was approved, OR autonomousMode is true and it does not require mandatory approval. First-class gates are completed by the runtime on approval; never call this tool for them.\n- \\`fail_node(nodeId, message, recoverable)\\` — transition to \\`failed\\`, or to \\`skipped\\` if the node is optional. \\`recoverable=true\\` returns the node to \\`available\\` instead.\n- \\`skip_node(nodeId)\\` — transition to \\`skipped\\`. Only valid for optional nodes.\n\n## Rules\n\n1. Before executing an agent node, call \\`build_handoff(nodeId)\\` and follow its instruction with the supplied bindings, assets, and upstream context; then call \\`start_node(nodeId)\\`.\n2. After executing the node, call \\`request_approval\\` unless \\`autonomousMode\\` is true — in which case call \\`complete_node\\` directly. Exception: nodes marked **Gate = mandatory** always require \\`request_approval\\` and a human decision, even in autonomous mode.\n3. First-class nodes marked **Gate = first-class** are runtime-owned. Never start, complete, skip, fail, or request input for them. After rejection, revise in conversation and only call \\`request_approval\\` to create the next attempt.\n4. If you need information from the user before or during agent execution, call \\`request_input\\`. This ends your turn until the user responds.\n5. On unrecoverable agent failure, call \\`fail_node(..., recoverable: false)\\`; an optional node ends \\`skipped\\` rather than \\`failed\\`, so the run continues past it. On recoverable failure, call \\`fail_node(..., recoverable: true)\\` and the engine returns the node to \\`available\\`.\n6. When all required nodes are \\`complete\\` or \\`skipped\\`, stop. The runner marks the flow done automatically.\n7. Free-chat user messages do not require flow action. Respond directly, continue flow work, or both — your call.\n`;\n}\n\n/**\n * Render the full prompt sent to a subprompt node's isolated driver instance.\n *\n * `instruction` is already interpolated with the node's resolved bindings\n * (the same `interpolateNodeInstruction` step an agent handoff uses) — this\n * function only adds the typed-response directive when the node declares an\n * output contract. There is no corrective reprompt for a subprompt (it has no\n * conversation to reprompt in), so the directive is the runtime's only lever\n * for getting parseable JSON back; a malformed or non-conforming reply is an\n * ordinary node failure handled by the caller, never retried in-band here.\n *\n * The object-only constraint is therefore stated twice, before and after the\n * schema: the serialized schema is a large blob, so a directive placed only\n * ahead of it is not the last thing the model reads.\n *\n * @docLink packages/factory-assets/flow#render-subprompt-prompt\n */\nexport function renderSubpromptPrompt(\n instruction: string,\n outputSchema: Record<string, unknown> | undefined,\n): string {\n if (!outputSchema) return instruction;\n return `${instruction}\\n\\nRespond with a single JSON object matching this JSON Schema, and nothing else — no markdown code fences, no commentary before or after it:\\n\\n${JSON.stringify(outputSchema, null, 2)}\\n\\nReply with the object only. The first character of your reply must be \\`{\\` and the last must be \\`}\\` — no explanation, no restatement, no code fence.`;\n}\n\n/**\n * Single-line tag suitable for telemetry / logging. Derives a short, stable\n * summary of a stimulus that's safe to attach to spans, log entries, and\n * trace events. The kind is always included; node-specific stimuli also\n * include their `nodeId` so log queries can pivot on it.\n *\n * @docLink packages/factory-assets/flow#describe-stimulus\n */\nexport function describeStimulus(stimulus: TurnStimulus): string {\n switch (stimulus.kind) {\n case \"flow_started\":\n return \"flow_started\";\n case \"approval_received\":\n return `approval_received:${stimulus.nodeId}:${stimulus.decision}`;\n case \"input_received\":\n return `input_received:${stimulus.nodeId}`;\n case \"retry_requested\":\n return `retry_requested:${stimulus.nodeId}`;\n case \"user_message\":\n return `user_message:${stimulus.senderId}`;\n case \"resumed_after_hibernation\":\n return \"resumed_after_hibernation\";\n case \"cancelled\":\n return \"cancelled\";\n case \"state_changed\":\n return \"state_changed\";\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../factory-assets/connectors/flow/prompt-fragments.ts"],"names":[],"mappings":";;;AA2DO,SAAS,qBAAqB,QAAA,EAAgC;AACnE,EAAA,QAAQ,SAAS,IAAA;AAAM,IACrB,KAAK,cAAA;AACH,MAAA,OAAO,iKAAA;AAAA,IACT,KAAK,mBAAA,EAAqB;AACxB,MAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAU,SAAA,EAAW,UAAS,GAAI,QAAA;AAClD,MAAA,IAAI,aAAa,UAAA,EAAY;AAC3B,QAAA,OAAO,CAAA,OAAA,EAAU,MAAM,CAAA,uBAAA,EAA0B,SAAS,CAAA,yGAAA,CAAA;AAAA,MAC5D;AACA,MAAA,MAAM,EAAA,GAAK,QAAA,GAAW,CAAA,YAAA,EAAe,QAAQ,CAAA,EAAA,CAAA,GAAO,EAAA;AACpD,MAAA,OAAO,CAAA,OAAA,EAAU,MAAM,CAAA,uBAAA,EAA0B,SAAS,IAAI,EAAE,CAAA,kNAAA,CAAA;AAAA,IAClE;AAAA,IACA,KAAK,gBAAA;AACH,MAAA,OAAO,CAAA,wCAAA,EAA2C,QAAA,CAAS,MAAM,CAAA,gBAAA,EAAmB,SAAS,UAAU,CAAA,0FAAA,CAAA;AAAA,IACzG,KAAK,iBAAA;AACH,MAAA,OAAO,CAAA,mCAAA,EAAsC,QAAA,CAAS,MAAM,CAAA,iBAAA,EAAoB,SAAS,WAAW,CAAA,yLAAA,CAAA;AAAA,IACtG,KAAK,cAAA;AAC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urnStimulus} into the strings the\n * runner's flow orchestrator splices into the per-turn agent prompt.\n * Extracted from `runner/src/flow-orchestrator.ts` in Phase 3 of the\n * flow-connector extraction (2026-05-08) so the connector owns its\n * prompt-rendering surface without a runtime dep on the orchestrator.\n *\n * The contract is byte-identical to the previous inline implementation —\n * any divergence is a regression.\n *\n * @docLink packages/factory-assets/flow#prompt-fragments\n */\n\nimport type { FlowExecution } from \"@skaile/workspaces/types\";\nimport type { FlowDefinition } from \"./engine/types.js\";\nimport {\n flowDefaults,\n isAgentNode,\n isCheckNode,\n isGateNode,\n nodeIsOptional,\n nodeLabel,\n nodeRequiresApproval,\n} from \"./engine/node-shape.js\";\n\n/**\n * Reasons why a new turn is starting. The flow orchestrator's prompt template\n * renders a stimulus-specific paragraph (via {@link renderStimulusPrompt}) so\n * the agent knows exactly why it has been invoked.\n *\n * @docLink packages/factory-assets/flow#turn-stimulus\n */\nexport type TurnStimulus =\n | { kind: \"flow_started\" }\n | {\n kind: \"approval_received\";\n nodeId: string;\n decision: \"approved\" | \"rejected\";\n feedback?: string;\n decidedBy: string;\n }\n | { kind: \"input_received\"; nodeId: string; response: unknown; providedBy: string }\n | { kind: \"retry_requested\"; nodeId: string; requestedBy: string }\n | { kind: \"user_message\"; text: string; senderId: string }\n | { kind: \"resumed_after_hibernation\" }\n | { kind: \"cancelled\" }\n | { kind: \"state_changed\" };\n\n/**\n * Render the stimulus paragraph the agent sees at turn start.\n *\n * The output is a single paragraph (one or more sentences, no surrounding\n * whitespace) describing why the runner has woken the agent. Spliced into\n * the orchestrator prompt under the `## Why this turn is happening` heading.\n *\n * @docLink packages/factory-assets/flow#render-stimulus-prompt\n */\nexport function renderStimulusPrompt(stimulus: TurnStimulus): string {\n switch (stimulus.kind) {\n case \"flow_started\":\n return \"The user just started this flow. Begin with the first available node — call `get_available`, then `build_handoff` for your chosen node, then `start_node`.\";\n case \"approval_received\": {\n const { nodeId, decision, decidedBy, feedback } = stimulus;\n if (decision === \"approved\") {\n return `Node \\`${nodeId}\\` was **approved** by ${decidedBy}. Call \\`complete_node\\` for this node with the approved output, then advance to the next available node.`;\n }\n const fb = feedback ? ` Feedback: \"${feedback}\".` : \"\";\n return `Node \\`${nodeId}\\` was **rejected** by ${decidedBy}.${fb} Decide how to proceed: retry the node (the engine returned it to \\`available\\`), ask clarifying questions via \\`request_input\\`, or call \\`fail_node(..., recoverable: false)\\` if the issue cannot be addressed.`;\n }\n case \"input_received\":\n return `The user just provided input for node \\`${stimulus.nodeId}\\` (provided by ${stimulus.providedBy}). The node has returned to its prior status. Continue executing the node with this input.`;\n case \"retry_requested\":\n return `A user requested a retry of node \\`${stimulus.nodeId}\\` (requested by ${stimulus.requestedBy}). The node has been returned to \\`available\\` with its prior error preserved in history. Start a fresh attempt — review the error context if relevant and try a different approach.`;\n case \"user_message\":\n return `A user sent a message: \"${stimulus.text}\" (from ${stimulus.senderId}). You can respond directly without touching the flow, continue flow work, or both. If the message is a question about the flow, answer it; if it signals a new direction, consider whether to pause.`;\n case \"resumed_after_hibernation\":\n return \"This session was hibernated and has just resumed. Review the current state above and continue where you left off. No state was lost.\";\n case \"cancelled\":\n return \"The user has cancelled this flow. Wrap up cleanly: do not start any new nodes. You may record a short summary if relevant, then stop.\";\n case \"state_changed\":\n return \"The flow state changed. Review the current state above and continue work accordingly.\";\n }\n}\n\n/**\n * Build the full agent-orchestrator prompt for a flow turn.\n *\n * Reassembles the five-section prompt from the current FlowExecution snapshot\n * and the supplied stimulus:\n *\n * 1. Flow definition (markdown table of nodes)\n * 2. Current state (progress, available/blocked, interaction pointers)\n * 3. Why this turn is happening (stimulus-specific paragraph)\n * 4. Flow tools available (static documentation)\n * 5. Rules\n *\n * Originally a byte-identical lift of the (since-deleted)\n * `FlowOrchestrator.buildOrchestratorPrompt`; the contract now is simply\n * this function's own output. When strict v2 defaults or legacy globals are\n * non-empty, a `## Flow globals` section exposes those run-scoped values. The\n * flow-wide active-node table stays bounded to selection metadata; `build_handoff`\n * supplies a selected agent node's execution payload. First-class gates appear\n * as runtime-owned state but never as agent-executable work.\n * Pure — depends only on its inputs.\n *\n * @docLink packages/factory-assets/flow#build-orchestrator-prompt\n * @since 2.2.0\n */\nexport function buildOrchestratorPrompt(\n flowDef: FlowDefinition,\n state: FlowExecution,\n stimulus: TurnStimulus,\n): string {\n const agentNodes = flowDef.nodes.filter(isAgentNode);\n const gateNodes = flowDef.nodes.filter(isGateNode);\n const checkNodes = flowDef.nodes.filter(isCheckNode);\n const promptNodes = flowDef.nodes.filter((node) => isAgentNode(node) || isGateNode(node));\n const agentNodeIds = new Set(agentNodes.map((node) => node.id));\n const promptNodeIds = new Set(promptNodes.map((node) => node.id));\n\n // ── Section 1: definition table ──\n const nodeRows = promptNodes\n .map((n) => {\n const deps =\n flowDef.edges\n .filter((e) => e.target === n.id && e.type === \"flow\")\n .map((e) => e.source)\n .join(\", \") || \"—\";\n const required = nodeIsOptional(n) ? \"optional\" : \"required\";\n const gate = isGateNode(n) ? \"first-class\" : nodeRequiresApproval(n) ? \"mandatory\" : \"—\";\n const nodeState = state.nodes[n.id];\n const status = nodeState?.status ?? \"not_started\";\n const description = (n.description ?? n.data?.description ?? \"—\")\n .replace(/\\s+/g, \" \")\n .replaceAll(\"|\", \"\\\\|\");\n return `| ${n.id} | ${nodeLabel(n)} | ${description} | ${required} | ${gate} | ${status} | ${deps} |`;\n })\n .join(\"\\n\");\n\n // ── Section 2: current state summary ──\n const nodesByStatus = (s: string) =>\n Object.values(state.nodes)\n .filter((n) => promptNodeIds.has(n.id) && n.status === s)\n .map((n) => n.id);\n // An approved agent node stays `awaiting_approval` until the agent calls\n // `complete_node`. Listed with the undecided ones, a resumed agent reads the\n // human decision as still pending and ends its turn, hanging the run.\n const approvedAwaitingCompletion = Object.values(state.nodes).filter(\n (n) =>\n agentNodeIds.has(n.id) &&\n n.status === \"awaiting_approval\" &&\n n.approval?.decision === \"approved\" &&\n n.approval.decidedAt != null,\n );\n const approvedIds = new Set(approvedAwaitingCompletion.map((n) => n.id));\n const available = nodesByStatus(\"available\");\n const awaitingApproval = nodesByStatus(\"awaiting_approval\").filter((id) => !approvedIds.has(id));\n const awaitingInput = nodesByStatus(\"awaiting_input\");\n const running = nodesByStatus(\"running\");\n const failed = nodesByStatus(\"failed\");\n const completed = nodesByStatus(\"complete\");\n const totalRequired = promptNodes.filter((n) => !nodeIsOptional(n)).length;\n\n const stateSummary = [\n `- Run ID: ${state.runId}`,\n `- Status: ${state.status}`,\n `- Autonomous mode: ${state.autonomousMode}`,\n `- Progress: ${completed.length} / ${totalRequired} required nodes complete`,\n `- Available now: ${available.join(\", \") || \"(none)\"}`,\n `- Currently running: ${running.join(\", \") || \"(none)\"}`,\n `- Awaiting approval: ${awaitingApproval.join(\", \") || \"(none)\"}`,\n ...(approvedIds.size > 0\n ? [`- Approved, awaiting \\`complete_node\\`: ${[...approvedIds].join(\", \")}`]\n : []),\n `- Awaiting input: ${awaitingInput.join(\", \") || \"(none)\"}`,\n `- Failed: ${failed.join(\", \") || \"(none)\"}`,\n ].join(\"\\n\");\n\n const approvedSection =\n approvedAwaitingCompletion.length > 0\n ? `## Approved nodes awaiting completion\n\n${approvedAwaitingCompletion\n .map(\n (node) =>\n `- \\`${node.id}\\` — approved by ${node.approval?.decidedBy ?? \"unknown reviewer\"} at ${node.approval?.decidedAt}`,\n )\n .join(\"\\n\")}\n\nA human has already approved these nodes. Do not wait for another decision and do not call \\`request_approval\\` again. Carry out whatever the approval authorised that is still outstanding, then call \\`complete_node\\` for each.\n\n`\n : \"\";\n\n const outputCorrections = Object.values(state.nodes)\n .filter(\n (node) =>\n agentNodeIds.has(node.id) &&\n node.outputCorrection &&\n node.status !== \"complete\" &&\n node.status !== \"failed\",\n )\n .map(\n (node) =>\n `- Node \\`${node.id}\\`: ${node.outputCorrection?.issues.join(\"; \") ?? \"unknown issue\"}`,\n );\n const correctionSection =\n outputCorrections.length > 0\n ? `## Output correction required\n\nThe following node has already used its single corrective reprompt. Submit one corrected \\`complete_node\\` call that fixes every issue; a second mismatch fails the node.\n\n${outputCorrections.join(\"\\n\")}\n\n`\n : \"\";\n\n const rejectedGates = gateNodes.flatMap((node) => {\n const approval = state.nodes[node.id]?.approval;\n if (approval?.decision !== \"rejected\") return [];\n return [\n `- \\`${node.id}\\` — rejected by ${approval.decidedBy ?? \"unknown reviewer\"}: ${\n approval.feedback ?? \"(no feedback provided)\"\n }`,\n ];\n });\n const rejectedGateSection =\n rejectedGates.length > 0\n ? `## Rejected first-class gates requiring revision\n\n${rejectedGates.join(\"\\n\")}\n\nRevise the surrounding work in conversation, then re-request each gate with \\`request_approval(nodeId, summary, artifacts)\\`. Every gate remains parked until its new human decision; do not start, complete, skip, or fail a first-class gate.\n\n`\n : \"\";\n\n // An override survives only in the approval record: the state table shows the\n // node as `complete` like any other, so without this section the failure is\n // invisible from the turn after the decision onward.\n const overriddenChecks = checkNodes.flatMap((node) => {\n const record = state.nodes[node.id];\n if (record?.status !== \"complete\" || record.approval?.decision !== \"approved\") return [];\n return [\n `- \\`${node.id}\\` — failed, overridden by ${record.approval.decidedBy ?? \"unknown reviewer\"}: ${\n record.approval.feedback ?? \"(no reason recorded)\"\n }`,\n ];\n });\n const overriddenCheckSection =\n overriddenChecks.length > 0\n ? `## Checks completed by human override\n\n${overriddenChecks.join(\"\\n\")}\n\nThese checks did **not** pass. A human decided the run may continue anyway, so they are \\`complete\\` and their dependents are unblocked. Their evidence still records the failure — do not report them as passing, and say so if downstream work depends on what they were meant to verify.\n\n`\n : \"\";\n\n // ── Section 2b: flow globals (additive — omitted entirely when empty so\n // flows without globals keep the byte-identical Phase 3 prompt) ──\n const globals = flowDefaults(flowDef);\n const globalsSection =\n Object.keys(globals).length > 0\n ? `## Flow globals\n\nRun-scoped parameters set by the flow author or by the host that started this run. When \\`run_input\\` is present it carries the payload this run was started with (e.g. a scheduled or webhook-triggered run) — treat it as the run's initial input instead of asking the user for it.\n\n\\`\\`\\`json\n${JSON.stringify(globals, null, 2)}\n\\`\\`\\`\n\n`\n : \"\";\n\n // ── Section 3: stimulus paragraph ──\n const stimulusNode =\n stimulus.kind === \"approval_received\"\n ? flowDef.nodes.find((node) => node.id === stimulus.nodeId)\n : undefined;\n let stimulusParagraph = renderStimulusPrompt(stimulus);\n if (stimulus.kind === \"approval_received\" && stimulusNode && isGateNode(stimulusNode)) {\n if (stimulus.decision === \"approved\") {\n const availableSuccessors = agentNodes\n .filter((node) => state.nodes[node.id]?.status === \"available\")\n .map((node) => `\\`${node.id}\\``);\n stimulusParagraph = `Gate node \\`${stimulus.nodeId}\\` is already \\`complete\\` after approval by ${stimulus.decidedBy}. Do not call \\`complete_node\\` for the gate. Advance to successor work${\n availableSuccessors.length > 0\n ? `; available agent nodes: ${availableSuccessors.join(\", \")}`\n : \"\"\n } — call \\`get_available\\`, then \\`build_handoff\\` and \\`start_node\\` for the chosen agent node.`;\n } else {\n stimulusParagraph = `Gate node \\`${stimulus.nodeId}\\` was **rejected** by ${stimulus.decidedBy}.${\n stimulus.feedback ? ` Feedback: \"${stimulus.feedback}\".` : \"\"\n } Revise the work in conversation and follow the rejected-gate instructions above.`;\n }\n }\n // A check is host-decided the same way a gate is: the adapter already wrote the\n // terminal status, and `complete_node` rejects any non-agent node — so the\n // generic approved/rejected wording would send the agent into a guaranteed throw.\n if (stimulus.kind === \"approval_received\" && stimulusNode && isCheckNode(stimulusNode)) {\n const availableSuccessors = agentNodes\n .filter((node) => state.nodes[node.id]?.status === \"available\")\n .map((node) => `\\`${node.id}\\``);\n stimulusParagraph =\n stimulus.decision === \"approved\"\n ? `Check node \\`${stimulus.nodeId}\\` failed, and ${stimulus.decidedBy} **overrode** the failure${\n stimulus.feedback ? `: \"${stimulus.feedback}\"` : \"\"\n }. The node is already \\`complete\\` and its evidence still records the failure. Do not call \\`complete_node\\` for it. Advance to successor work${\n availableSuccessors.length > 0\n ? `; available agent nodes: ${availableSuccessors.join(\", \")}`\n : \"\"\n } — call \\`get_available\\`, then \\`build_handoff\\` and \\`start_node\\` for the chosen agent node.`\n : `Check node \\`${stimulus.nodeId}\\` failed and ${stimulus.decidedBy} **rejected** it${\n stimulus.feedback ? `: \"${stimulus.feedback}\"` : \"\"\n }. The node is already terminally \\`failed\\` — it did not return to \\`available\\`. Do not call \\`complete_node\\` or \\`fail_node\\` for it. Report the outcome and stop unless other nodes remain available.`;\n }\n\n // ── Section 4+5: static tool surface and rules ──\n return `# Flow Execution Context\n\nYou are orchestrating the flow **${flowDef.name}** (${flowDef.id} v${flowDef.version}). This is a governed flow execution: your job is to run nodes through the flow tools, summarize their outputs for human review, and yield control at approval gates.\n\n## Flow definition\n\n| ID | Label | Description | Required | Gate | Status | Depends on |\n|----|-------|-------------|----------|------|--------|------------|\n${nodeRows}\n\nNodes with **Gate = mandatory** are hard approval gates: they always require \\`request_approval\\` and a human decision, even when autonomous mode is on. They cannot be skipped — \\`request_approval\\` → approval is their only completion path.\nNodes with **Gate = first-class** are runtime-owned human decisions. The runtime parks them automatically and completes them directly on approval; the agent never executes them.\n\n## Current state\n\n${stateSummary}\n\n${globalsSection}${correctionSection}${rejectedGateSection}${overriddenCheckSection}${approvedSection}## Why this turn is happening\n\n${stimulusParagraph}\n\n## Flow tools available\n\nAll tools are exposed by the \\`flow\\` connector:\n\n- \\`get_available()\\` — list node IDs that are ready to start\n- \\`get_state()\\` — full current state including approvals, inputs, outputs\n- \\`get_globals()\\` — the flow's run-scoped globals (e.g. the \\`run_input\\` payload for scheduled/params-bound runs)\n- \\`build_handoff(nodeId)\\` — selected node instruction, supplied bindings, required assets, and upstream context\n- \\`start_node(nodeId)\\` — transition an agent node from \\`available\\` → \\`running\\`; call before executing it. Never start a first-class gate.\n- \\`request_approval(nodeId, summary, artifacts)\\` — transition a running agent node to \\`awaiting_approval\\`, or replace a rejected first-class gate's decision with a fresh pending request. **This ends your turn.**\n- \\`request_input(nodeId, prompt, schema)\\` — transition to \\`awaiting_input\\`. **This ends your turn.** Legal from \\`available\\`, \\`running\\`, or \\`awaiting_approval\\`.\n- \\`complete_node(nodeId, summary, fields?, artifacts?, concerns?)\\` — complete an agent node. When downstream nodes consume declared output fields, include a conforming JSON object. The first mismatch gets one corrective call; the second fails the node. Valid only if the agent node was approved, OR autonomousMode is true and it does not require mandatory approval. First-class gates are completed by the runtime on approval; never call this tool for them.\n- \\`fail_node(nodeId, message, recoverable)\\` — transition to \\`failed\\`, or to \\`skipped\\` if the node is optional. \\`recoverable=true\\` returns the node to \\`available\\` instead.\n- \\`skip_node(nodeId)\\` — transition to \\`skipped\\`. Only valid for optional nodes.\n\n## Rules\n\n1. Before executing an agent node, call \\`build_handoff(nodeId)\\` and follow its instruction with the supplied bindings, assets, and upstream context; then call \\`start_node(nodeId)\\`.\n2. After executing the node, call \\`request_approval\\` unless \\`autonomousMode\\` is true — in which case call \\`complete_node\\` directly. Exception: nodes marked **Gate = mandatory** always require \\`request_approval\\` and a human decision, even in autonomous mode.\n3. First-class nodes marked **Gate = first-class** are runtime-owned. Never start, complete, skip, fail, or request input for them. After rejection, revise in conversation and only call \\`request_approval\\` to create the next attempt.\n4. If you need information from the user before or during agent execution, call \\`request_input\\`. This ends your turn until the user responds.\n5. On unrecoverable agent failure, call \\`fail_node(..., recoverable: false)\\`; an optional node ends \\`skipped\\` rather than \\`failed\\`, so the run continues past it. On recoverable failure, call \\`fail_node(..., recoverable: true)\\` and the engine returns the node to \\`available\\`.\n6. When all required nodes are \\`complete\\` or \\`skipped\\`, stop. The runner marks the flow done automatically.\n7. Free-chat user messages do not require flow action. Respond directly, continue flow work, or both — your call.\n`;\n}\n\n/**\n * Render the full prompt sent to a subprompt node's isolated driver instance.\n *\n * `instruction` is already interpolated with the node's resolved bindings\n * (the same `interpolateNodeInstruction` step an agent handoff uses) — this\n * function only adds the typed-response directive when the node declares an\n * output contract. There is no corrective reprompt for a subprompt (it has no\n * conversation to reprompt in), so the directive is the runtime's only lever\n * for getting parseable JSON back; a malformed or non-conforming reply is an\n * ordinary node failure handled by the caller, never retried in-band here.\n *\n * The object-only constraint is therefore stated twice, before and after the\n * schema: the serialized schema is a large blob, so a directive placed only\n * ahead of it is not the last thing the model reads.\n *\n * @docLink packages/factory-assets/flow#render-subprompt-prompt\n */\nexport function renderSubpromptPrompt(\n instruction: string,\n outputSchema: Record<string, unknown> | undefined,\n): string {\n if (!outputSchema) return instruction;\n return `${instruction}\\n\\nRespond with a single JSON object matching this JSON Schema, and nothing else — no markdown code fences, no commentary before or after it:\\n\\n${JSON.stringify(outputSchema, null, 2)}\\n\\nReply with the object only. The first character of your reply must be \\`{\\` and the last must be \\`}\\` — no explanation, no restatement, no code fence.`;\n}\n\n/**\n * Single-line tag suitable for telemetry / logging. Derives a short, stable\n * summary of a stimulus that's safe to attach to spans, log entries, and\n * trace events. The kind is always included; node-specific stimuli also\n * include their `nodeId` so log queries can pivot on it.\n *\n * @docLink packages/factory-assets/flow#describe-stimulus\n */\nexport function describeStimulus(stimulus: TurnStimulus): string {\n switch (stimulus.kind) {\n case \"flow_started\":\n return \"flow_started\";\n case \"approval_received\":\n return `approval_received:${stimulus.nodeId}:${stimulus.decision}`;\n case \"input_received\":\n return `input_received:${stimulus.nodeId}`;\n case \"retry_requested\":\n return `retry_requested:${stimulus.nodeId}`;\n case \"user_message\":\n return `user_message:${stimulus.senderId}`;\n case \"resumed_after_hibernation\":\n return \"resumed_after_hibernation\";\n case \"cancelled\":\n return \"cancelled\";\n case \"state_changed\":\n return \"state_changed\";\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseFlowDefinitionStructure, FlowDefinitionSchema } from './chunk-
|
|
1
|
+
import { parseFlowDefinitionStructure, FlowDefinitionSchema } from './chunk-NUELZWCF.js';
|
|
2
2
|
import * as z from 'zod';
|
|
3
3
|
|
|
4
4
|
var successfullyParsedDefinitions = /* @__PURE__ */ new WeakMap();
|
|
@@ -361,5 +361,5 @@ function parseFlowDefinition(data) {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
export { normalizeV1, parseFlowDefinition };
|
|
364
|
-
//# sourceMappingURL=chunk-
|
|
365
|
-
//# sourceMappingURL=chunk-
|
|
364
|
+
//# sourceMappingURL=chunk-MGGFBZWA.js.map
|
|
365
|
+
//# sourceMappingURL=chunk-MGGFBZWA.js.map
|