@skaile/workspaces 5.8.0 → 5.10.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 +102 -0
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-EYRZR4K5.js → asset-feeds-ELEBTNUS.js} +18 -18
- package/dist/{asset-feeds-EYRZR4K5.js.map → asset-feeds-ELEBTNUS.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +8 -8
- package/dist/asset-manager/index.js +14 -14
- package/dist/asset-manager/installer.js +10 -10
- package/dist/asset-manager/renderers.js +9 -9
- package/dist/asset-manager/src/index.d.ts +300 -36
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/install-agent.d.ts +3 -1
- package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
- package/dist/asset-manager/src/install-instances.d.ts +31 -1
- package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +20 -0
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/asset-manager/src/renderers.d.ts +4 -5
- package/dist/asset-manager/src/renderers.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +170 -17
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +13 -11
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +10 -10
- package/dist/bridge/drivers/echo.js +4 -4
- package/dist/bridge/drivers/gemini.js +7 -7
- package/dist/bridge/drivers/goose.js +10 -10
- package/dist/bridge/drivers/omp.js +7 -5
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +10 -10
- package/dist/bridge/drivers/qwen.js +7 -7
- package/dist/bridge/index.js +14 -14
- package/dist/bridge/src/codex/managed-driver.d.ts.map +1 -1
- package/dist/bridge/src/drivers/claude-sdk.d.ts +31 -1
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/claude-tool-allowlist.d.ts +43 -0
- package/dist/bridge/src/drivers/claude-tool-allowlist.d.ts.map +1 -0
- package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
- package/dist/bridge/src/types.d.ts +20 -1
- package/dist/bridge/src/types.d.ts.map +1 -1
- package/dist/{chunk-36AFURKZ.js → chunk-2FMEGSBN.js} +38 -11
- package/dist/chunk-2FMEGSBN.js.map +1 -0
- package/dist/{chunk-GCICGXDD.js → chunk-2H73V6XR.js} +3 -3
- package/dist/{chunk-GCICGXDD.js.map → chunk-2H73V6XR.js.map} +1 -1
- package/dist/{chunk-H7QUDDKH.js → chunk-2JMLDZLP.js} +1069 -182
- package/dist/chunk-2JMLDZLP.js.map +1 -0
- package/dist/{chunk-B6GIW55K.js → chunk-32XKCNCL.js} +6 -3
- package/dist/chunk-32XKCNCL.js.map +1 -0
- package/dist/{chunk-4MQS7CAF.js → chunk-3BEY4WK3.js} +371 -175
- package/dist/chunk-3BEY4WK3.js.map +1 -0
- package/dist/{chunk-SH5D7U7N.js → chunk-3KHYGOEY.js} +3 -3
- package/dist/{chunk-SH5D7U7N.js.map → chunk-3KHYGOEY.js.map} +1 -1
- package/dist/{chunk-CGT45WN7.js → chunk-3MKPZZRE.js} +3 -3
- package/dist/{chunk-CGT45WN7.js.map → chunk-3MKPZZRE.js.map} +1 -1
- package/dist/{chunk-QVNRCDTV.js → chunk-4OV5DSBB.js} +4 -4
- package/dist/chunk-4OV5DSBB.js.map +1 -0
- package/dist/{chunk-GXXFLBUQ.js → chunk-4P3KTUZH.js} +33 -33
- package/dist/chunk-4P3KTUZH.js.map +1 -0
- package/dist/{chunk-I6NLLJHZ.js → chunk-5QI2JYJC.js} +2 -2
- package/dist/{chunk-I6NLLJHZ.js.map → chunk-5QI2JYJC.js.map} +1 -1
- package/dist/{chunk-EF7NPDDU.js → chunk-6HHE63CO.js} +31 -17
- package/dist/chunk-6HHE63CO.js.map +1 -0
- package/dist/{chunk-FTJJO3EM.js → chunk-7CR6HT2X.js} +10 -10
- package/dist/{chunk-FTJJO3EM.js.map → chunk-7CR6HT2X.js.map} +1 -1
- package/dist/{chunk-FZNG4V4J.js → chunk-7I5VRVDP.js} +3 -3
- package/dist/{chunk-FZNG4V4J.js.map → chunk-7I5VRVDP.js.map} +1 -1
- package/dist/{chunk-HG34RNTK.js → chunk-CLTHEKHR.js} +10 -9
- package/dist/chunk-CLTHEKHR.js.map +1 -0
- package/dist/{chunk-UMVKJM4Q.js → chunk-DALV4HHP.js} +18 -3
- package/dist/chunk-DALV4HHP.js.map +1 -0
- package/dist/{chunk-F3RDEH5U.js → chunk-F4NJDSR7.js} +6 -5
- package/dist/chunk-F4NJDSR7.js.map +1 -0
- package/dist/{chunk-LSXHED6I.js → chunk-FRPBSUFH.js} +6 -6
- package/dist/{chunk-LSXHED6I.js.map → chunk-FRPBSUFH.js.map} +1 -1
- package/dist/{chunk-W5DWWE4Y.js → chunk-G54USEUP.js} +4 -4
- package/dist/{chunk-W5DWWE4Y.js.map → chunk-G54USEUP.js.map} +1 -1
- package/dist/{chunk-Y7QA2OLD.js → chunk-GEWAIQZ5.js} +24 -20
- package/dist/chunk-GEWAIQZ5.js.map +1 -0
- package/dist/{chunk-GB7WDMH2.js → chunk-GFCXNFTW.js} +4 -4
- package/dist/{chunk-GB7WDMH2.js.map → chunk-GFCXNFTW.js.map} +1 -1
- package/dist/{chunk-AWQYXZVG.js → chunk-HJ5MCB3L.js} +28 -4
- package/dist/chunk-HJ5MCB3L.js.map +1 -0
- package/dist/{chunk-2LWYNQK7.js → chunk-HOHUEKES.js} +3 -3
- package/dist/{chunk-2LWYNQK7.js.map → chunk-HOHUEKES.js.map} +1 -1
- package/dist/{chunk-ZKSJMZKD.js → chunk-IJHH4DSW.js} +8 -8
- package/dist/{chunk-ZKSJMZKD.js.map → chunk-IJHH4DSW.js.map} +1 -1
- package/dist/{chunk-BTE2V4IW.js → chunk-IXWODEED.js} +40 -7
- package/dist/chunk-IXWODEED.js.map +1 -0
- package/dist/{chunk-OFBIWVCR.js → chunk-JFXQEVLF.js} +3 -3
- package/dist/{chunk-OFBIWVCR.js.map → chunk-JFXQEVLF.js.map} +1 -1
- package/dist/{chunk-JAKOMFC6.js → chunk-JZCSNEHK.js} +77 -31
- package/dist/chunk-JZCSNEHK.js.map +1 -0
- package/dist/{chunk-CKQEIY43.js → chunk-MVQ3Q2HM.js} +4 -4
- package/dist/{chunk-CKQEIY43.js.map → chunk-MVQ3Q2HM.js.map} +1 -1
- package/dist/{chunk-LEMHVDET.js → chunk-NRDSGLCQ.js} +188 -33
- package/dist/chunk-NRDSGLCQ.js.map +1 -0
- package/dist/{chunk-V2DXZYBB.js → chunk-NWDSLXOX.js} +3 -3
- package/dist/{chunk-V2DXZYBB.js.map → chunk-NWDSLXOX.js.map} +1 -1
- package/dist/{chunk-6GRX5L6A.js → chunk-OBVJ7RPW.js} +4 -4
- package/dist/{chunk-6GRX5L6A.js.map → chunk-OBVJ7RPW.js.map} +1 -1
- package/dist/{chunk-PTSGWKHR.js → chunk-OOWHXOK6.js} +4 -4
- package/dist/{chunk-PTSGWKHR.js.map → chunk-OOWHXOK6.js.map} +1 -1
- package/dist/{chunk-YSHVQGUS.js → chunk-PE36IF2D.js} +119 -30
- package/dist/chunk-PE36IF2D.js.map +1 -0
- package/dist/{chunk-S53LOR7B.js → chunk-QG3HOJEK.js} +3 -3
- package/dist/{chunk-S53LOR7B.js.map → chunk-QG3HOJEK.js.map} +1 -1
- package/dist/{chunk-2FRUUDZY.js → chunk-SBFW3CJH.js} +5 -5
- package/dist/{chunk-2FRUUDZY.js.map → chunk-SBFW3CJH.js.map} +1 -1
- package/dist/{chunk-UAROCOXF.js → chunk-SX5U422E.js} +3 -3
- package/dist/{chunk-UAROCOXF.js.map → chunk-SX5U422E.js.map} +1 -1
- package/dist/{chunk-QOP6KDFR.js → chunk-TH4CTXHX.js} +6 -6
- package/dist/{chunk-QOP6KDFR.js.map → chunk-TH4CTXHX.js.map} +1 -1
- package/dist/{chunk-F2EKONM7.js → chunk-TRSQP3JD.js} +3 -3
- package/dist/{chunk-F2EKONM7.js.map → chunk-TRSQP3JD.js.map} +1 -1
- package/dist/{chunk-FVJK4QWM.js → chunk-V5TZH4GF.js} +4 -4
- package/dist/{chunk-FVJK4QWM.js.map → chunk-V5TZH4GF.js.map} +1 -1
- package/dist/{chunk-HYDRDNKN.js → chunk-V7PQZOBR.js} +5 -5
- package/dist/{chunk-HYDRDNKN.js.map → chunk-V7PQZOBR.js.map} +1 -1
- package/dist/{chunk-IONAUNWB.js → chunk-VLXDXRRX.js} +3 -3
- package/dist/{chunk-IONAUNWB.js.map → chunk-VLXDXRRX.js.map} +1 -1
- package/dist/{chunk-CIFS5K6T.js → chunk-VMKMFS2Q.js} +28 -7
- package/dist/chunk-VMKMFS2Q.js.map +1 -0
- package/dist/{chunk-Y4N2NUZD.js → chunk-WBYDAL6X.js} +4 -4
- package/dist/{chunk-Y4N2NUZD.js.map → chunk-WBYDAL6X.js.map} +1 -1
- package/dist/{chunk-WTQ3TATB.js → chunk-X4BAYGMT.js} +3 -3
- package/dist/{chunk-WTQ3TATB.js.map → chunk-X4BAYGMT.js.map} +1 -1
- package/dist/{chunk-NPLPCRW5.js → chunk-XCNK4UE5.js} +5 -5
- package/dist/{chunk-NPLPCRW5.js.map → chunk-XCNK4UE5.js.map} +1 -1
- package/dist/{chunk-OJ4N4T4H.js → chunk-XDVR7QIT.js} +20 -6
- package/dist/chunk-XDVR7QIT.js.map +1 -0
- package/dist/{chunk-GTILM2CI.js → chunk-Y34MSWEZ.js} +43 -12
- package/dist/chunk-Y34MSWEZ.js.map +1 -0
- package/dist/{chunk-4PTSR4UU.js → chunk-Y63UQZ7P.js} +3 -3
- package/dist/{chunk-4PTSR4UU.js.map → chunk-Y63UQZ7P.js.map} +1 -1
- package/dist/chunk-YBQONMH2.js +465 -0
- package/dist/chunk-YBQONMH2.js.map +1 -0
- package/dist/{chunk-P23M65LB.js → chunk-Z2K6BGUR.js} +71 -24
- package/dist/chunk-Z2K6BGUR.js.map +1 -0
- package/dist/{chunk-BJNUNQAW.js → chunk-ZGQTS3Y4.js} +3 -3
- package/dist/{chunk-BJNUNQAW.js.map → chunk-ZGQTS3Y4.js.map} +1 -1
- package/dist/cli/index.js +913 -720
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +8 -5
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/diff.d.ts +3 -1
- package/dist/cli/src/commands/diff.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 +34 -2
- 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 +6 -5
- package/dist/cli/src/commands/manage.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
- package/dist/cli/src/commands/outdated.d.ts +7 -5
- package/dist/cli/src/commands/outdated.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +11 -8
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +30 -1
- package/dist/cli/src/commands/source.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/commands/why.d.ts.map +1 -1
- package/dist/cli/src/skill-checks.d.ts +47 -2
- package/dist/cli/src/skill-checks.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/src/client.d.ts +10 -3
- package/dist/client/src/client.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +18 -18
- package/dist/{connectors-O6Y6VESP.js → connectors-OXP2JBGI.js} +21 -21
- package/dist/{connectors-O6Y6VESP.js.map → connectors-OXP2JBGI.js.map} +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/core/index.js +7 -7
- 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 +2 -1
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +5 -2
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/logging/sinks/sqlite-runtime.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/models.d.ts +21 -5
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/publish-manifest.d.ts +19 -3
- package/dist/core/src/publish-manifest.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/requirements.d.ts +26 -0
- package/dist/core/src/requirements.d.ts.map +1 -0
- package/dist/core/src/walker.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +18 -0
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/src/workspace-yaml-editor.d.ts +4 -1
- package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
- package/dist/core/workspace-config.js +4 -4
- package/dist/deploy/index.js +7 -7
- package/dist/discovery/index.js +5 -5
- package/dist/discovery/src/builtin-providers.d.ts.map +1 -1
- package/dist/discovery/src/discover-manifest.d.ts.map +1 -1
- package/dist/discovery/src/discover.d.ts.map +1 -1
- package/dist/discovery/src/source-config.d.ts.map +1 -1
- package/dist/discovery/src/tree-entries.d.ts.map +1 -1
- package/dist/{ensure-sources-SKLNM4UZ.js → ensure-sources-5ISVIA4T.js} +17 -17
- package/dist/{ensure-sources-SKLNM4UZ.js.map → ensure-sources-5ISVIA4T.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +18 -18
- package/dist/factory-assets/connectors/deploy.js +18 -18
- package/dist/factory-assets/connectors/devserver.js +18 -18
- package/dist/factory-assets/connectors/flow/adapter.js +18 -18
- package/dist/factory-assets/connectors/flow/engine.js +8 -8
- package/dist/factory-assets/connectors/flow/run-flow.js +20 -20
- package/dist/factory-assets/connectors/flow.js +18 -18
- package/dist/factory-assets/connectors/git.js +18 -18
- package/dist/factory-assets/connectors/gmail.js +18 -18
- package/dist/factory-assets/connectors/googledrive.js +18 -18
- package/dist/factory-assets/connectors/local.js +18 -18
- package/dist/factory-assets/connectors/mattermost.js +18 -18
- package/dist/factory-assets/connectors/memory.js +18 -18
- package/dist/factory-assets/connectors/minio.js +18 -18
- package/dist/factory-assets/connectors/postgres.js +18 -18
- package/dist/factory-assets/connectors/s3.js +18 -18
- package/dist/factory-assets/connectors/sharepoint.js +18 -18
- package/dist/factory-assets/connectors/sqlite.js +18 -18
- package/dist/factory-assets/connectors/static-server.js +18 -18
- package/dist/factory-assets/connectors/tunnel.js +18 -18
- package/dist/factory-assets/connectors/webdav.js +18 -18
- package/dist/factory-assets/connectors/xstate-store.js +18 -18
- package/dist/factory-assets/connectors/xstate.js +18 -18
- package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +9 -3
- package/dist/{flows-CBYRSAGS.js → flows-HMSE76PO.js} +12 -12
- package/dist/{flows-CBYRSAGS.js.map → flows-HMSE76PO.js.map} +1 -1
- package/dist/{helpers-MWZDRBLD.js → helpers-X6URBGSF.js} +17 -17
- package/dist/{helpers-MWZDRBLD.js.map → helpers-X6URBGSF.js.map} +1 -1
- package/dist/library/index.js +11 -11
- package/dist/library/install.js +3 -3
- package/dist/library/src/index.d.ts +2 -1
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/local/library-dir.d.ts +42 -0
- package/dist/library/src/local/library-dir.d.ts.map +1 -0
- package/dist/library/src/local/library-manager.d.ts +10 -1
- package/dist/library/src/local/library-manager.d.ts.map +1 -1
- package/dist/library/src/local/library.d.ts +2 -2
- package/dist/library/src/local/library.d.ts.map +1 -1
- package/dist/library/src/local/local-catalog-source.d.ts +9 -0
- package/dist/library/src/local/local-catalog-source.d.ts.map +1 -1
- package/dist/library/src/manifest-writer.d.ts +55 -4
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/library/src/remote/cache.d.ts +18 -1
- package/dist/library/src/remote/cache.d.ts.map +1 -1
- package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
- package/dist/library/src/remote/rest-catalog-source.d.ts.map +1 -1
- package/dist/library/src/sync/git-driver.d.ts +5 -6
- package/dist/library/src/sync/git-driver.d.ts.map +1 -1
- package/dist/{library-publish-PICMDSB2.js → library-publish-OS3JDW4S.js} +123 -41
- package/dist/library-publish-OS3JDW4S.js.map +1 -0
- package/dist/open-library-4QSUORI6.js +40 -0
- package/dist/{open-library-OG457THY.js.map → open-library-4QSUORI6.js.map} +1 -1
- package/dist/open-registry-VCKS3MP5.js +32 -0
- package/dist/{open-registry-ZUZJ7MS7.js.map → open-registry-VCKS3MP5.js.map} +1 -1
- package/dist/paths-BVO56A25.js +22 -0
- package/dist/{paths-FQ64OLJG.js.map → paths-BVO56A25.js.map} +1 -1
- package/dist/{plugin-store-MPAMD5OT.js → plugin-store-X7GPWGBG.js} +9 -9
- package/dist/{plugin-store-MPAMD5OT.js.map → plugin-store-X7GPWGBG.js.map} +1 -1
- package/dist/{project-2GFT5LEZ.js → project-PAXP46RD.js} +20 -20
- package/dist/{project-2GFT5LEZ.js.map → project-PAXP46RD.js.map} +1 -1
- package/dist/resolver/index.js +8 -8
- package/dist/runner/index.js +32 -32
- package/dist/runner/src/agent.d.ts.map +1 -1
- package/dist/runner/src/context-usage/compose.d.ts.map +1 -1
- package/dist/runner/src/platform-blocks.d.ts +55 -0
- package/dist/runner/src/platform-blocks.d.ts.map +1 -0
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +14 -14
- package/dist/sdk/bridge.js +14 -14
- package/dist/sdk/client.js +1 -1
- package/dist/sdk/core.js +7 -7
- package/dist/sdk/flow.js +8 -8
- package/dist/sdk/index.js +33 -33
- package/dist/sdk/resolver.js +8 -8
- package/dist/sdk/runner.js +32 -32
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/types.js +1 -1
- package/dist/session/index.js +2 -2
- package/dist/session/src/dispatcher.d.ts +25 -4
- package/dist/session/src/dispatcher.d.ts.map +1 -1
- package/dist/session/src/index.d.ts +1 -1
- package/dist/session/src/index.d.ts.map +1 -1
- package/dist/{setup-WHMCSIF2.js → setup-BV55VHWC.js} +24 -24
- package/dist/{setup-WHMCSIF2.js.map → setup-BV55VHWC.js.map} +1 -1
- package/dist/{skills-TVO26Y4V.js → skills-EDFUCJPX.js} +13 -13
- package/dist/{skills-TVO26Y4V.js.map → skills-EDFUCJPX.js.map} +1 -1
- package/dist/source-E4VAT5RZ.js +41 -0
- package/dist/{source-LKOFTOEK.js.map → source-E4VAT5RZ.js.map} +1 -1
- package/dist/{source-manifest-publish-L5J3QXER.js → source-manifest-publish-CLEE6TNH.js} +23 -23
- package/dist/{source-manifest-publish-L5J3QXER.js.map → source-manifest-publish-CLEE6TNH.js.map} +1 -1
- package/dist/tui/index.js +32 -32
- package/dist/types/index.js +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/events.d.ts +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/manifests/agent.d.ts +2 -0
- package/dist/types/src/manifests/agent.d.ts.map +1 -1
- package/dist/types/src/manifests/contract.d.ts +2 -0
- package/dist/types/src/manifests/contract.d.ts.map +1 -1
- package/dist/types/src/manifests/index.d.ts +3 -3
- package/dist/types/src/manifests/index.d.ts.map +1 -1
- package/dist/types/src/manifests/prompt.d.ts +2 -0
- package/dist/types/src/manifests/prompt.d.ts.map +1 -1
- package/dist/types/src/protocol.d.ts +43 -1
- package/dist/types/src/protocol.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +17 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +25 -25
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-36AFURKZ.js.map +0 -1
- package/dist/chunk-4MQS7CAF.js.map +0 -1
- package/dist/chunk-AWQYXZVG.js.map +0 -1
- package/dist/chunk-B6GIW55K.js.map +0 -1
- package/dist/chunk-BTE2V4IW.js.map +0 -1
- package/dist/chunk-CIFS5K6T.js.map +0 -1
- package/dist/chunk-EF7NPDDU.js.map +0 -1
- package/dist/chunk-F3RDEH5U.js.map +0 -1
- package/dist/chunk-GTILM2CI.js.map +0 -1
- package/dist/chunk-GXXFLBUQ.js.map +0 -1
- package/dist/chunk-H7QUDDKH.js.map +0 -1
- package/dist/chunk-HG34RNTK.js.map +0 -1
- package/dist/chunk-JAKOMFC6.js.map +0 -1
- package/dist/chunk-LEMHVDET.js.map +0 -1
- package/dist/chunk-OJ4N4T4H.js.map +0 -1
- package/dist/chunk-P23M65LB.js.map +0 -1
- package/dist/chunk-QVNRCDTV.js.map +0 -1
- package/dist/chunk-UMVKJM4Q.js.map +0 -1
- package/dist/chunk-Y7QA2OLD.js.map +0 -1
- package/dist/chunk-YSHVQGUS.js.map +0 -1
- package/dist/chunk-ZAOGFXDO.js +0 -112
- package/dist/chunk-ZAOGFXDO.js.map +0 -1
- package/dist/library-publish-PICMDSB2.js.map +0 -1
- package/dist/open-library-OG457THY.js +0 -40
- package/dist/open-registry-ZUZJ7MS7.js +0 -32
- package/dist/paths-FQ64OLJG.js +0 -22
- package/dist/source-LKOFTOEK.js +0 -41
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReconfigureLedger, classifyGenericErrorMessage, stripRunnerPrivateEnv } from './chunk-B4X2N7JQ.js';
|
|
2
2
|
import { wrapAgentCommand, resolveAgentExec } from './chunk-YROR332M.js';
|
|
3
|
-
import { AgentDriver } from './chunk-
|
|
3
|
+
import { AgentDriver } from './chunk-HJ5MCB3L.js';
|
|
4
4
|
import { spawn } from 'child_process';
|
|
5
5
|
import { createInterface } from 'readline';
|
|
6
6
|
|
|
@@ -442,5 +442,5 @@ function extractCost(json) {
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
export { SubprocessCliDriver, extractCost, extractText, extractTokens };
|
|
445
|
-
//# sourceMappingURL=chunk-
|
|
446
|
-
//# sourceMappingURL=chunk-
|
|
445
|
+
//# sourceMappingURL=chunk-3KHYGOEY.js.map
|
|
446
|
+
//# sourceMappingURL=chunk-3KHYGOEY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../bridge/src/drivers/_subprocess-cli.ts"],"names":[],"mappings":";;;;;;AA2CO,IAAe,mBAAA,GAAf,cAA2C,WAAA,CAAY;AAAA;AAAA,EAezC,IAAA,GAA6B,OAAA;AAAA,EAEtC,MAAA;AAAA,EACO,QAAA;AAAA,EAET,IAAA,GAA4B,IAAA;AAAA,EAC5B,EAAA,GAAuB,IAAA;AAAA,EACvB,eAAyB,EAAC;AAAA,EAC1B,YAAA,GAAe,EAAA;AAAA,EACf,OAAA,GAAU,KAAA;AAAA;AAAA,EAGV,QAAA,GAAW,EAAA;AAAA,EACX,eAAA,GAAkB,KAAA;AAAA,EAClB,qBAAqC,EAAC;AAAA,EACtC,SAAA,GAAY,KAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,WAAA,GAAmC,IAAA;AAAA,EACnC,UAAA,GAA4C,IAAA;AAAA,EAE1C,UAAA;AAAA,EACA,WAAA,GAAiC,IAAA;AAAA,EAE3C,YAAY,MAAA,EAAqB;AAC/B,IAAA,KAAA,EAAM;AACN,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,QAAA,GAAW,IAAI,iBAAA,CAAkB;AAAA,MACpC,MAAA,EAAQ,MAAM,IAAA,CAAK,MAAA;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AAgB,CAAA,CAAE,iBAAA,IAAqB,CAAA,CAAE,oBAAA,IAAwB,CAAA,CAAE,MAAA;AAC1F,EAAA,MAAM,SAAA,GAAY,CAAA,CAAE,mBAAA,IAAuB,CAAA,CAAE,mBAAmB,CAAA,CAAE,uBAAA;AAClE,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,MAAA,KAAW,MAAA,EAAW,OAAO,IAAA;AACxD,EAAA,MAAM,SAAqB,EAAC;AAC5B,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,MAAA,CAAO,WAAA,GAAc,KAAA;AACpD,EAAA,IAAI,OAAO,MAAA,KAAW,QAAA,EAAU,MAAA,CAAO,YAAA,GAAe,MAAA;AACtD,EAAA,IAAI,OAAO,SAAA,KAAc,QAAA,EAAU,MAAA,CAAO,eAAA,GAAkB,SAAA;AAC5D,EAAA,OAAO,MAAA;AACT;AAGO,SAAS,YAAY,IAAA,EAA+B;AACzD,EAAA,MAAM,CAAA,GACJ,IAAA,EAAM,IAAA,IAAQ,IAAA,EAAM,OAAA,IAAW,IAAA,EAAM,cAAA,IAAkB,IAAA,EAAM,KAAA,EAAO,IAAA,IAAQ,IAAA,EAAM,KAAA,EAAO,IAAA;AAC3F,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,GAAW,CAAA,GAAI,MAAA;AACrC","file":"chunk-SH5D7U7N.js","sourcesContent":["import { type ChildProcess, spawn } from \"node:child_process\";\nimport type { EventEmitter } from \"node:events\";\nimport { createInterface, type Interface } from \"node:readline\";\nimport type { Logger, TokenUsage } from \"@skaile/workspaces/types\";\nimport { resolveAgentExec, wrapAgentCommand } from \"../agent-exec.js\";\nimport { classifyGenericErrorMessage } from \"../error-classifier.js\";\nimport { ReconfigureLedger } from \"../reconfigure-ledger.js\";\nimport { stripRunnerPrivateEnv } from \"../runner-private-env.js\";\nimport {\n type AgentConfig,\n AgentDriver,\n type AgentError,\n type AgentEvent,\n type AgentMessage,\n type ReconfigureApplied,\n type ReconfigureOutcome,\n type ReconfigurePatch,\n} from \"../types.js\";\n\n/**\n * Shared base for one-shot **subprocess CLI** agent harnesses (Gemini, Qwen,\n * OpenCode, Goose, Continue).\n *\n * These harnesses are neither persistent JSON-RPC subprocesses (`omp`) nor\n * in-process SDKs (`claude-sdk`, `codex`). In headless mode each is invoked\n * **once per turn** — `prompt()` spawns the CLI fresh, a `readline` loop maps\n * newline-delimited JSON on stdout to the unified {@link AgentEvent} stream, and\n * **process exit marks the end of the turn**. Multi-turn continuity comes from\n * capturing a harness session id (emitted as `session_info`) and replaying it\n * via a resume flag on the next spawn.\n *\n * Subclasses implement {@link buildArgs}, {@link buildEnv}, and either\n * {@link handleJson} (streaming JSONL, the default) or {@link handleBuffered}\n * (`mode = \"buffered\"`, for CLIs that print a single JSON blob at the end).\n *\n * **Terminal-sequence invariant.** Subclasses MUST NOT emit `agent_end`. The\n * base emits exactly one `result` (synthesizing a success result when the\n * stream produced none) followed by a single `agent_end` on clean exit, or an\n * `error` + `agent_end` on crash. This keeps the turn-completion contract\n * (`prompt()` resolves after `agent_end`) identical across every CLI driver.\n *\n * @docLink packages/bridge/drivers#subprocess-cli\n */\nexport abstract class SubprocessCliDriver extends AgentDriver {\n /** Per-driver logger, constructed once by the subclass. */\n protected abstract readonly log: Logger;\n /** Default binary name spawned in production (e.g. `\"gemini\"`). */\n protected abstract readonly defaultBin: string;\n /** Human product name used in error messages / hints (e.g. `\"Gemini CLI\"`). */\n protected abstract readonly productName: string;\n /**\n * Test-seam env prefix. `<PREFIX>_BRIDGE_BIN` overrides the spawn binary and\n * `<PREFIX>_BRIDGE_PREARGS` (space-delimited) supplies leading argv — used by\n * the fake-CLI harness to redirect spawn without monkey-patching\n * `child_process`. Both are ignored in production.\n */\n protected abstract readonly envPrefix: string;\n /** `\"jsonl\"` streams events line-by-line; `\"buffered\"` parses all stdout once on exit. */\n protected readonly mode: \"jsonl\" | \"buffered\" = \"jsonl\";\n\n protected config: AgentConfig;\n private readonly reconfig: ReconfigureLedger;\n\n private proc: ChildProcess | null = null;\n private rl: Interface | null = null;\n private stderrBuffer: string[] = [];\n private stdoutBuffer = \"\";\n private started = false;\n\n // ── Per-turn state ──────────────────────────────────────────────────────\n private prevText = \"\";\n private activeAssistant = false;\n private pendingToolResults: AgentMessage[] = [];\n private sawResult = false;\n private aborting = false;\n private turnResolve: (() => void) | null = null;\n private turnReject: ((err: Error) => void) | null = null;\n\n protected _sessionId?: string;\n protected _lastTokens: TokenUsage | null = null;\n\n constructor(config: AgentConfig) {\n super();\n this.config = config;\n this.reconfig = new ReconfigureLedger({\n config: () => this.config,\n onDesired: (applied) => this.onReconfigured(applied),\n });\n }\n\n override get runtimeSessionId(): string | undefined {\n return this._sessionId;\n }\n\n override getModel(): string | undefined {\n return this.config.model;\n }\n\n override getTokenUsage(): TokenUsage | null {\n return this._lastTokens;\n }\n\n /**\n * A one-shot CLI has no resident process: a patch is stored and the next\n * spawn reads it. The ledger scopes the model and writes the config.\n */\n override reconfigure(patch: ReconfigurePatch): Promise<ReconfigureOutcome> {\n return this.reconfig.reconfigure(patch);\n }\n\n /**\n * A patch was stored in {@link config}. Subclasses that cache something derived\n * from the model (rendered provider files, bindings) invalidate it here.\n */\n protected onReconfigured(applied: ReconfigureApplied): void {\n void applied;\n }\n\n /**\n * No-op for one-shot CLIs — there is no long-lived process to spawn until the\n * first prompt. Kept so the runner's `start()` → `prompt()` ordering works\n * uniformly; binary-presence failures surface as a `config` error on the\n * first spawn (see {@link classifyProcessError}).\n */\n async start(): Promise<void> {\n this.started = true;\n }\n\n get isRunning(): boolean {\n return this.proc !== null && !this.proc.killed;\n }\n\n /**\n * Sends a user message to the CLI and resolves after the turn completes\n * (`agent_end`). Spawns a fresh child per call; rejects if the child exits\n * non-zero before emitting a result, so the caller never hangs.\n */\n async prompt(message: string): Promise<void> {\n if (this.proc) throw new Error(`${this.productName} turn already in progress`);\n if (!this.started) await this.start();\n\n this.prevText = \"\";\n this.activeAssistant = false;\n this.pendingToolResults = [];\n this.sawResult = false;\n this.aborting = false;\n this.stderrBuffer = [];\n this.stdoutBuffer = \"\";\n this._lastTokens = null;\n\n const composed = this.composePrompt(message);\n const overrideBin = process.env[`${this.envPrefix}_BRIDGE_BIN`];\n const preArgs = process.env[`${this.envPrefix}_BRIDGE_PREARGS`]\n ? (process.env[`${this.envPrefix}_BRIDGE_PREARGS`] as string).split(/\\s+/).filter(Boolean)\n : [];\n const bin = overrideBin || this.defaultBin;\n const args = [...preArgs, ...this.buildArgs(composed, this._sessionId)];\n const env = this.buildEnv();\n\n return new Promise<void>((resolve, reject) => {\n this.turnResolve = resolve;\n this.turnReject = reject;\n this.log.info(\"spawning CLI\", {\n bin,\n cwd: this.config.cwd,\n resume: Boolean(this._sessionId),\n });\n\n // With the uid split on, the CLI runs as the agent uid through the launch shim.\n const target = wrapAgentCommand(bin, args, resolveAgentExec());\n const proc = spawn(target.command, target.args, {\n cwd: this.config.cwd,\n env,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n }) as ChildProcess;\n this.proc = proc;\n const procEmitter = proc as unknown as EventEmitter;\n\n procEmitter.on(\"error\", (err: Error) => {\n const detail = this.classifyProcessError(err as NodeJS.ErrnoException);\n this.log.error(\"spawn error\", err, { detail });\n this.pushError(detail);\n this.emit(\"agent-event\", { type: \"agent_end\" } satisfies AgentEvent);\n this.settleReject(Object.assign(new Error(detail.message), { detail }));\n });\n\n if (proc.stdout) {\n if (this.mode === \"jsonl\") {\n const rl = createInterface({ input: proc.stdout });\n this.rl = rl;\n (rl as unknown as EventEmitter).on(\"line\", (line: string) => this.onStdoutLine(line));\n } else {\n proc.stdout.setEncoding(\"utf8\");\n proc.stdout.on(\"data\", (chunk: string) => {\n this.stdoutBuffer += chunk;\n });\n }\n }\n\n if (proc.stderr) {\n const stderrRl = createInterface({ input: proc.stderr });\n (stderrRl as unknown as EventEmitter).on(\"line\", (line: string) => {\n this.log.debug(\"stderr\", { line });\n this.stderrBuffer.push(line);\n if (this.stderrBuffer.length > 20) this.stderrBuffer.shift();\n });\n }\n\n procEmitter.on(\"exit\", (code: number | null, signal: NodeJS.Signals | null) => {\n this.log.info(\"CLI exited\", { code, signal });\n this.onExit(code, signal);\n });\n });\n }\n\n /** Out-of-band abort: terminates the current child. Driver stays usable for the next prompt. */\n async abort(): Promise<void> {\n this.aborting = true;\n this.proc?.kill(\"SIGTERM\");\n }\n\n kill(): void {\n this.aborting = true;\n this.proc?.kill(\"SIGTERM\");\n this.cleanup();\n }\n\n async resetSession(): Promise<void> {\n this.kill();\n this._sessionId = undefined;\n this._lastTokens = null;\n }\n\n // ── Subclass hooks ────────────────────────────────────────────────────────\n\n /** Build the CLI argv (binary excluded) for one turn. `resumeId` is the captured session id, if any. */\n protected abstract buildArgs(message: string, resumeId: string | undefined): string[];\n\n /** Build the child-process env (explicit allowlist — see {@link baseEnv}). */\n protected abstract buildEnv(): Record<string, string>;\n\n /** Map one parsed stdout JSON object to events via the `push*` helpers. Streaming (`jsonl`) mode only. */\n protected handleJson(_json: unknown): void {}\n\n /** Parse the full stdout blob once on clean exit. `buffered` mode only. */\n protected handleBuffered(_raw: string): void {}\n\n /** Install-failure hint surfaced when the binary is missing. */\n protected abstract installHint(): string;\n\n /**\n * Classify a non-zero exit into an {@link AgentError}, or `null` to treat the\n * exit as success (e.g. a turn-limit code where a result was already\n * emitted). Default: code `0` / clean signal → success; otherwise `process`.\n */\n protected classifyExit(code: number | null, signal: NodeJS.Signals | null): AgentError | null {\n if (code === 0 || (code === null && signal === null)) return null;\n const tail = this.stderrBuffer.slice(-10).join(\"\\n\");\n return {\n message: `${this.productName} exited with code ${code ?? \"null\"}${tail ? `: ${tail}` : \"\"}`,\n category: \"process\",\n retryable: true,\n hint: tail || `The ${this.productName} process exited unexpectedly. Try the prompt again.`,\n };\n }\n\n // ── Protected emit helpers (used by handleJson / handleBuffered) ────────────\n\n /** Prepend `systemPrompt` to the user message — uniform across CLIs lacking a reliable system flag. */\n protected composePrompt(message: string): string {\n return this.config.systemPrompt ? `${this.config.systemPrompt}\\n\\n---\\n\\n${message}` : message;\n }\n\n protected pushAssistantDelta(fullText: string): void {\n if (!this.activeAssistant) {\n this.activeAssistant = true;\n this.prevText = \"\";\n this.emit(\"agent-event\", {\n type: \"message_start\",\n message: asstMessage(\"\"),\n } satisfies AgentEvent);\n }\n const delta = fullText.startsWith(this.prevText)\n ? fullText.slice(this.prevText.length)\n : fullText;\n this.prevText = fullText;\n if (delta) {\n this.emit(\"agent-event\", {\n type: \"message_update\",\n message: asstMessage(fullText),\n _textDelta: delta,\n } satisfies AgentEvent);\n }\n }\n\n protected pushAssistantEnd(fullText?: string): void {\n if (!this.activeAssistant) return;\n const text = fullText ?? this.prevText;\n this.emit(\"agent-event\", {\n type: \"message_end\",\n message: asstMessage(text),\n } satisfies AgentEvent);\n this.activeAssistant = false;\n this.prevText = \"\";\n }\n\n protected pushToolCall(name: string, input: unknown): void {\n this.emit(\"agent-event\", {\n type: \"tool_call\",\n name,\n tool: { name },\n input,\n } satisfies AgentEvent);\n }\n\n protected pushToolResult(name: string, data: unknown, isError = false): void {\n this.pendingToolResults.push({ role: \"tool\", toolName: name, content: \"\", data, isError });\n this.emit(\"agent-event\", {\n type: \"tool_execution_end\",\n toolName: name,\n } satisfies AgentEvent);\n }\n\n private flushToolResults(): void {\n if (this.pendingToolResults.length === 0) return;\n this.emit(\"agent-event\", {\n type: \"turn_end\",\n toolResults: [...this.pendingToolResults],\n } satisfies AgentEvent);\n this.pendingToolResults = [];\n }\n\n protected pushResult(opts: {\n tokens?: TokenUsage | null;\n costUsd?: number;\n summary?: string;\n subtype?: string;\n }): void {\n this.pushAssistantEnd();\n this.flushToolResults();\n if (opts.tokens) this._lastTokens = opts.tokens;\n this.sawResult = true;\n this.emit(\"agent-event\", {\n type: \"result\",\n subtype: opts.subtype ?? \"success\",\n summary: opts.summary,\n costUsd: opts.costUsd ?? 0,\n ...(opts.tokens ? { tokens: opts.tokens } : {}),\n } satisfies AgentEvent);\n }\n\n protected pushError(detail: AgentError, fatal = false): void {\n this.emit(\"agent-event\", {\n type: \"error\",\n error: detail.message,\n detail,\n fatal,\n } satisfies AgentEvent);\n }\n\n protected captureSession(id?: string, file?: string): void {\n if (!id || id === this._sessionId) return;\n this._sessionId = id;\n this.emit(\"agent-event\", {\n type: \"session_info\",\n driverSessionId: id,\n ...(file ? { sessionFile: file } : {}),\n } satisfies AgentEvent);\n }\n\n /** Shared keyword classification + per-driver hint copy (mirrors omp/codex). */\n protected classifyMessage(message: string): AgentError {\n const generic = classifyGenericErrorMessage(message);\n if (!generic) {\n return {\n message,\n category: \"unknown\",\n retryable: true,\n hint: `An unexpected ${this.productName} error occurred. Try the prompt again.`,\n };\n }\n const hint =\n generic.category === \"auth\"\n ? `Check the API key / login configured for ${this.productName}.`\n : generic.category === \"rate_limit\"\n ? `${this.productName} hit a provider rate limit. Wait a moment and try again.`\n : generic.category === \"model\"\n ? \"The selected model is unavailable or the context is too long. Change the model or start a new session.\"\n : `A network error occurred while talking to ${this.productName}.`;\n return { message, category: generic.category, retryable: generic.retryable, hint };\n }\n\n // ── Env allowlist ──────────────────────────────────────────────────────────\n\n /**\n * Explicit env whitelist forwarded to the child. Omits anything provisioned\n * by `provision_secrets` so user credentials stay out of the subprocess\n * environment. Always passes through the driver's test-seam vars and\n * `FAKE_CLI_*`.\n *\n * `config.env` is merged **over** the whitelist, not in place of it. It used\n * to replace it wholesale, which meant any caller that set a single variable\n * silently dropped `PATH` and `HOME` and the spawn failed with ENOENT —\n * unusable as the delivery channel for registry-derived endpoint variables\n * (plan §2.3, \"Delivery rule\"). Widening keeps both: the caller's variables\n * win per key, the process still has a `PATH`.\n */\n protected baseEnv(extraKeys: string[] = []): Record<string, string> {\n const out: Record<string, string> = {};\n const explicit = [\"PATH\", \"HOME\", \"USER\", \"HOSTNAME\", \"SKAILE_SESSION_ID\", ...extraKeys];\n for (const key of explicit) {\n const v = process.env[key];\n if (v !== undefined) out[key] = v;\n }\n for (const [key, value] of Object.entries(process.env)) {\n if (typeof value !== \"string\") continue;\n if (key.startsWith(`${this.envPrefix}_BRIDGE_`) || key.startsWith(\"FAKE_CLI_\")) {\n out[key] = value;\n }\n }\n if (this.config.sshKeyPath) {\n out.GIT_SSH_COMMAND = `ssh -i \"${this.config.sshKeyPath}\" -o StrictHostKeyChecking=accept-new`;\n }\n if (this.config.env) Object.assign(out, this.config.env);\n return stripRunnerPrivateEnv(out);\n }\n\n // ── Internals ────────────────────────────────────────────────────────────\n\n private onStdoutLine(line: string): void {\n if (!line.trim()) return;\n let json: unknown;\n try {\n json = JSON.parse(line);\n } catch {\n this.log.debug(\"non-JSON stdout line\", { line });\n return;\n }\n try {\n this.handleJson(json);\n } catch (err) {\n this.log.warn(\"handleJson threw\", { error: String(err) });\n }\n }\n\n private onExit(code: number | null, signal: NodeJS.Signals | null): void {\n this.cleanup();\n\n if (this.aborting) {\n this.pushAssistantEnd();\n this.flushToolResults();\n this.emit(\"agent-event\", { type: \"agent_end\" } satisfies AgentEvent);\n this.settleResolve();\n return;\n }\n\n if (this.mode === \"buffered\" && (code === 0 || code === null)) {\n try {\n this.handleBuffered(this.stdoutBuffer);\n } catch (err) {\n this.log.warn(\"handleBuffered threw\", { error: String(err) });\n }\n }\n\n const exitErr = this.classifyExit(code, signal);\n if (exitErr && !this.sawResult) {\n this.pushAssistantEnd();\n this.flushToolResults();\n this.pushError(exitErr);\n this.emit(\"agent-event\", { type: \"agent_end\" } satisfies AgentEvent);\n this.settleReject(Object.assign(new Error(exitErr.message), { detail: exitErr }));\n return;\n }\n\n // Clean exit (or non-zero exit after a result already streamed): close any\n // open assistant message, synthesize a success result if none arrived, end.\n if (!this.sawResult) this.pushResult({ summary: \"Task completed\" });\n else {\n this.pushAssistantEnd();\n this.flushToolResults();\n }\n this.emit(\"agent-event\", { type: \"agent_end\" } satisfies AgentEvent);\n this.settleResolve();\n }\n\n private settleResolve(): void {\n const resolve = this.turnResolve;\n this.turnResolve = null;\n this.turnReject = null;\n resolve?.();\n }\n\n private settleReject(err: Error): void {\n const reject = this.turnReject;\n this.turnResolve = null;\n this.turnReject = null;\n reject?.(err);\n }\n\n private cleanup(): void {\n this.rl?.close();\n this.rl = null;\n this.proc = null;\n }\n\n private classifyProcessError(err: NodeJS.ErrnoException): AgentError {\n if (err.code === \"ENOENT\") {\n return {\n message: `${this.defaultBin} command not found`,\n category: \"config\",\n retryable: false,\n hint: this.installHint(),\n };\n }\n if (err.code === \"EACCES\") {\n return {\n message: `Permission denied running ${this.defaultBin}`,\n category: \"config\",\n retryable: false,\n hint: `Check file permissions for the ${this.defaultBin} binary.`,\n };\n }\n return {\n message: err.message,\n category: \"process\",\n retryable: true,\n hint: `An unexpected process error occurred running ${this.productName}. Try again.`,\n };\n }\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// Tolerant JSON extractors — shared because the upstream stream-json schemas\n// are not fully pinned; read the common field-name variants defensively.\n// ───────────────────────────────────────────────────────────────────────────\n\nfunction asstMessage(text: string): AgentMessage {\n return { role: \"assistant\", content: [{ type: \"text\", text }] };\n}\n\n/** Pull assistant text out of a CLI event, trying the common field names. */\nexport function extractText(json: any): string {\n if (typeof json?.text === \"string\") return json.text;\n if (typeof json?.delta === \"string\") return json.delta;\n if (typeof json?.content === \"string\") return json.content;\n if (typeof json?.response === \"string\") return json.response;\n const msg = json?.message;\n if (typeof msg?.content === \"string\") return msg.content;\n if (Array.isArray(msg?.content)) {\n return msg.content\n .filter(\n (b: any) => (b?.type === \"text\" || b?.type === undefined) && typeof b?.text === \"string\",\n )\n .map((b: any) => b.text)\n .join(\"\");\n }\n if (Array.isArray(json?.parts)) {\n return json.parts\n .filter((p: any) => typeof p?.text === \"string\")\n .map((p: any) => p.text)\n .join(\"\");\n }\n // OpenCode (`run --format json`) nests the payload under `part`.\n if (typeof json?.part?.text === \"string\") return json.part.text;\n return \"\";\n}\n\n/** Map a CLI usage/stats object onto {@link TokenUsage}, trying common field names. */\nexport function extractTokens(json: any): TokenUsage | null {\n const u = json?.usage ?? json?.stats?.usage ?? json?.stats ?? json?.tokens ?? json;\n if (!u || typeof u !== \"object\") return null;\n const input = u.input_tokens ?? u.inputTokens ?? u.prompt_tokens ?? u.promptTokenCount ?? u.input;\n const output =\n u.output_tokens ?? u.outputTokens ?? u.completion_tokens ?? u.candidatesTokenCount ?? u.output;\n const cacheRead = u.cached_input_tokens ?? u.cacheReadTokens ?? u.cachedContentTokenCount;\n if (input === undefined && output === undefined) return null;\n const tokens: TokenUsage = {};\n if (typeof input === \"number\") tokens.inputTokens = input;\n if (typeof output === \"number\") tokens.outputTokens = output;\n if (typeof cacheRead === \"number\") tokens.cacheReadTokens = cacheRead;\n return tokens;\n}\n\n/** Pull a per-turn USD cost from a CLI result object, or `undefined`. */\nexport function extractCost(json: any): number | undefined {\n const c =\n json?.cost ?? json?.costUsd ?? json?.total_cost_usd ?? json?.stats?.cost ?? json?.usage?.cost;\n return typeof c === \"number\" ? c : undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../bridge/src/drivers/_subprocess-cli.ts"],"names":[],"mappings":";;;;;;AA2CO,IAAe,mBAAA,GAAf,cAA2C,WAAA,CAAY;AAAA;AAAA,EAezC,IAAA,GAA6B,OAAA;AAAA,EAEtC,MAAA;AAAA,EACO,QAAA;AAAA,EAET,IAAA,GAA4B,IAAA;AAAA,EAC5B,EAAA,GAAuB,IAAA;AAAA,EACvB,eAAyB,EAAC;AAAA,EAC1B,YAAA,GAAe,EAAA;AAAA,EACf,OAAA,GAAU,KAAA;AAAA;AAAA,EAGV,QAAA,GAAW,EAAA;AAAA,EACX,eAAA,GAAkB,KAAA;AAAA,EAClB,qBAAqC,EAAC;AAAA,EACtC,SAAA,GAAY,KAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,WAAA,GAAmC,IAAA;AAAA,EACnC,UAAA,GAA4C,IAAA;AAAA,EAE1C,UAAA;AAAA,EACA,WAAA,GAAiC,IAAA;AAAA,EAE3C,YAAY,MAAA,EAAqB;AAC/B,IAAA,KAAA,E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AA,CAAE,eAAe,CAAA,CAAE,aAAA,IAAiB,CAAA,CAAE,gBAAA,IAAoB,CAAA,CAAE,KAAA;AAC5F,EAAA,MAAM,MAAA,GACJ,EAAE,aAAA,IAAiB,CAAA,CAAE,gBAAgB,CAAA,CAAE,iBAAA,IAAqB,CAAA,CAAE,oBAAA,IAAwB,CAAA,CAAE,MAAA;AAC1F,EAAA,MAAM,SAAA,GAAY,CAAA,CAAE,mBAAA,IAAuB,CAAA,CAAE,mBAAmB,CAAA,CAAE,uBAAA;AAClE,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,MAAA,KAAW,MAAA,EAAW,OAAO,IAAA;AACxD,EAAA,MAAM,SAAqB,EAAC;AAC5B,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,MAAA,CAAO,WAAA,GAAc,KAAA;AACpD,EAAA,IAAI,OAAO,MAAA,KAAW,QAAA,EAAU,MAAA,CAAO,YAAA,GAAe,MAAA;AACtD,EAAA,IAAI,OAAO,SAAA,KAAc,QAAA,EAAU,MAAA,CAAO,eAAA,GAAkB,SAAA;AAC5D,EAAA,OAAO,MAAA;AACT;AAGO,SAAS,YAAY,IAAA,EAA+B;AACzD,EAAA,MAAM,CAAA,GACJ,IAAA,EAAM,IAAA,IAAQ,IAAA,EAAM,OAAA,IAAW,IAAA,EAAM,cAAA,IAAkB,IAAA,EAAM,KAAA,EAAO,IAAA,IAAQ,IAAA,EAAM,KAAA,EAAO,IAAA;AAC3F,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,GAAW,CAAA,GAAI,MAAA;AACrC","file":"chunk-3KHYGOEY.js","sourcesContent":["import { type ChildProcess, spawn } from \"node:child_process\";\nimport type { EventEmitter } from \"node:events\";\nimport { createInterface, type Interface } from \"node:readline\";\nimport type { Logger, TokenUsage } from \"@skaile/workspaces/types\";\nimport { resolveAgentExec, wrapAgentCommand } from \"../agent-exec.js\";\nimport { classifyGenericErrorMessage } from \"../error-classifier.js\";\nimport { ReconfigureLedger } from \"../reconfigure-ledger.js\";\nimport { stripRunnerPrivateEnv } from \"../runner-private-env.js\";\nimport {\n type AgentConfig,\n AgentDriver,\n type AgentError,\n type AgentEvent,\n type AgentMessage,\n type ReconfigureApplied,\n type ReconfigureOutcome,\n type ReconfigurePatch,\n} from \"../types.js\";\n\n/**\n * Shared base for one-shot **subprocess CLI** agent harnesses (Gemini, Qwen,\n * OpenCode, Goose, Continue).\n *\n * These harnesses are neither persistent JSON-RPC subprocesses (`omp`) nor\n * in-process SDKs (`claude-sdk`, `codex`). In headless mode each is invoked\n * **once per turn** — `prompt()` spawns the CLI fresh, a `readline` loop maps\n * newline-delimited JSON on stdout to the unified {@link AgentEvent} stream, and\n * **process exit marks the end of the turn**. Multi-turn continuity comes from\n * capturing a harness session id (emitted as `session_info`) and replaying it\n * via a resume flag on the next spawn.\n *\n * Subclasses implement {@link buildArgs}, {@link buildEnv}, and either\n * {@link handleJson} (streaming JSONL, the default) or {@link handleBuffered}\n * (`mode = \"buffered\"`, for CLIs that print a single JSON blob at the end).\n *\n * **Terminal-sequence invariant.** Subclasses MUST NOT emit `agent_end`. The\n * base emits exactly one `result` (synthesizing a success result when the\n * stream produced none) followed by a single `agent_end` on clean exit, or an\n * `error` + `agent_end` on crash. This keeps the turn-completion contract\n * (`prompt()` resolves after `agent_end`) identical across every CLI driver.\n *\n * @docLink packages/bridge/drivers#subprocess-cli\n */\nexport abstract class SubprocessCliDriver extends AgentDriver {\n /** Per-driver logger, constructed once by the subclass. */\n protected abstract readonly log: Logger;\n /** Default binary name spawned in production (e.g. `\"gemini\"`). */\n protected abstract readonly defaultBin: string;\n /** Human product name used in error messages / hints (e.g. `\"Gemini CLI\"`). */\n protected abstract readonly productName: string;\n /**\n * Test-seam env prefix. `<PREFIX>_BRIDGE_BIN` overrides the spawn binary and\n * `<PREFIX>_BRIDGE_PREARGS` (space-delimited) supplies leading argv — used by\n * the fake-CLI harness to redirect spawn without monkey-patching\n * `child_process`. Both are ignored in production.\n */\n protected abstract readonly envPrefix: string;\n /** `\"jsonl\"` streams events line-by-line; `\"buffered\"` parses all stdout once on exit. */\n protected readonly mode: \"jsonl\" | \"buffered\" = \"jsonl\";\n\n protected config: AgentConfig;\n private readonly reconfig: ReconfigureLedger;\n\n private proc: ChildProcess | null = null;\n private rl: Interface | null = null;\n private stderrBuffer: string[] = [];\n private stdoutBuffer = \"\";\n private started = false;\n\n // ── Per-turn state ──────────────────────────────────────────────────────\n private prevText = \"\";\n private activeAssistant = false;\n private pendingToolResults: AgentMessage[] = [];\n private sawResult = false;\n private aborting = false;\n private turnResolve: (() => void) | null = null;\n private turnReject: ((err: Error) => void) | null = null;\n\n protected _sessionId?: string;\n protected _lastTokens: TokenUsage | null = null;\n\n constructor(config: AgentConfig) {\n super();\n this.config = config;\n this.reconfig = new ReconfigureLedger({\n config: () => this.config,\n onDesired: (applied) => this.onReconfigured(applied),\n });\n }\n\n override get runtimeSessionId(): string | undefined {\n return this._sessionId;\n }\n\n override getModel(): string | undefined {\n return this.config.model;\n }\n\n override getTokenUsage(): TokenUsage | null {\n return this._lastTokens;\n }\n\n /**\n * A one-shot CLI has no resident process: a patch is stored and the next\n * spawn reads it. The ledger scopes the model and writes the config.\n */\n override reconfigure(patch: ReconfigurePatch): Promise<ReconfigureOutcome> {\n return this.reconfig.reconfigure(patch);\n }\n\n /**\n * A patch was stored in {@link config}. Subclasses that cache something derived\n * from the model (rendered provider files, bindings) invalidate it here.\n */\n protected onReconfigured(applied: ReconfigureApplied): void {\n void applied;\n }\n\n /**\n * No-op for one-shot CLIs — there is no long-lived process to spawn until the\n * first prompt. Kept so the runner's `start()` → `prompt()` ordering works\n * uniformly; binary-presence failures surface as a `config` error on the\n * first spawn (see {@link classifyProcessError}).\n */\n async start(): Promise<void> {\n this.started = true;\n }\n\n get isRunning(): boolean {\n return this.proc !== null && !this.proc.killed;\n }\n\n /**\n * Sends a user message to the CLI and resolves after the turn completes\n * (`agent_end`). Spawns a fresh child per call; rejects if the child exits\n * non-zero before emitting a result, so the caller never hangs.\n */\n async prompt(message: string): Promise<void> {\n if (this.proc) throw new Error(`${this.productName} turn already in progress`);\n if (!this.started) await this.start();\n\n this.prevText = \"\";\n this.activeAssistant = false;\n this.pendingToolResults = [];\n this.sawResult = false;\n this.aborting = false;\n this.stderrBuffer = [];\n this.stdoutBuffer = \"\";\n this._lastTokens = null;\n\n const composed = this.composePrompt(message);\n const overrideBin = process.env[`${this.envPrefix}_BRIDGE_BIN`];\n const preArgs = process.env[`${this.envPrefix}_BRIDGE_PREARGS`]\n ? (process.env[`${this.envPrefix}_BRIDGE_PREARGS`] as string).split(/\\s+/).filter(Boolean)\n : [];\n const bin = overrideBin || this.defaultBin;\n const args = [...preArgs, ...this.buildArgs(composed, this._sessionId)];\n const env = this.buildEnv();\n\n return new Promise<void>((resolve, reject) => {\n this.turnResolve = resolve;\n this.turnReject = reject;\n this.log.info(\"spawning CLI\", {\n bin,\n cwd: this.config.cwd,\n resume: Boolean(this._sessionId),\n });\n\n // With the uid split on, the CLI runs as the agent uid through the launch shim.\n const target = wrapAgentCommand(bin, args, resolveAgentExec());\n const proc = spawn(target.command, target.args, {\n cwd: this.config.cwd,\n env,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n }) as ChildProcess;\n this.proc = proc;\n const procEmitter = proc as unknown as EventEmitter;\n\n procEmitter.on(\"error\", (err: Error) => {\n const detail = this.classifyProcessError(err as NodeJS.ErrnoException);\n this.log.error(\"spawn error\", err, { detail });\n this.pushError(detail);\n this.emit(\"agent-event\", { type: \"agent_end\" } satisfies AgentEvent);\n this.settleReject(Object.assign(new Error(detail.message), { detail }));\n });\n\n if (proc.stdout) {\n if (this.mode === \"jsonl\") {\n const rl = createInterface({ input: proc.stdout });\n this.rl = rl;\n (rl as unknown as EventEmitter).on(\"line\", (line: string) => this.onStdoutLine(line));\n } else {\n proc.stdout.setEncoding(\"utf8\");\n proc.stdout.on(\"data\", (chunk: string) => {\n this.stdoutBuffer += chunk;\n });\n }\n }\n\n if (proc.stderr) {\n const stderrRl = createInterface({ input: proc.stderr });\n (stderrRl as unknown as EventEmitter).on(\"line\", (line: string) => {\n this.log.debug(\"stderr\", { line });\n this.stderrBuffer.push(line);\n if (this.stderrBuffer.length > 20) this.stderrBuffer.shift();\n });\n }\n\n procEmitter.on(\"exit\", (code: number | null, signal: NodeJS.Signals | null) => {\n this.log.info(\"CLI exited\", { code, signal });\n this.onExit(code, signal);\n });\n });\n }\n\n /** Out-of-band abort: terminates the current child. Driver stays usable for the next prompt. */\n async abort(): Promise<void> {\n this.aborting = true;\n this.proc?.kill(\"SIGTERM\");\n }\n\n kill(): void {\n this.aborting = true;\n this.proc?.kill(\"SIGTERM\");\n this.cleanup();\n }\n\n async resetSession(): Promise<void> {\n this.kill();\n this._sessionId = undefined;\n this._lastTokens = null;\n }\n\n // ── Subclass hooks ────────────────────────────────────────────────────────\n\n /** Build the CLI argv (binary excluded) for one turn. `resumeId` is the captured session id, if any. */\n protected abstract buildArgs(message: string, resumeId: string | undefined): string[];\n\n /** Build the child-process env (explicit allowlist — see {@link baseEnv}). */\n protected abstract buildEnv(): Record<string, string>;\n\n /** Map one parsed stdout JSON object to events via the `push*` helpers. Streaming (`jsonl`) mode only. */\n protected handleJson(_json: unknown): void {}\n\n /** Parse the full stdout blob once on clean exit. `buffered` mode only. */\n protected handleBuffered(_raw: string): void {}\n\n /** Install-failure hint surfaced when the binary is missing. */\n protected abstract installHint(): string;\n\n /**\n * Classify a non-zero exit into an {@link AgentError}, or `null` to treat the\n * exit as success (e.g. a turn-limit code where a result was already\n * emitted). Default: code `0` / clean signal → success; otherwise `process`.\n */\n protected classifyExit(code: number | null, signal: NodeJS.Signals | null): AgentError | null {\n if (code === 0 || (code === null && signal === null)) return null;\n const tail = this.stderrBuffer.slice(-10).join(\"\\n\");\n return {\n message: `${this.productName} exited with code ${code ?? \"null\"}${tail ? `: ${tail}` : \"\"}`,\n category: \"process\",\n retryable: true,\n hint: tail || `The ${this.productName} process exited unexpectedly. Try the prompt again.`,\n };\n }\n\n // ── Protected emit helpers (used by handleJson / handleBuffered) ────────────\n\n /** Prepend `systemPrompt` to the user message — uniform across CLIs lacking a reliable system flag. */\n protected composePrompt(message: string): string {\n return this.config.systemPrompt ? `${this.config.systemPrompt}\\n\\n---\\n\\n${message}` : message;\n }\n\n protected pushAssistantDelta(fullText: string): void {\n if (!this.activeAssistant) {\n this.activeAssistant = true;\n this.prevText = \"\";\n this.emit(\"agent-event\", {\n type: \"message_start\",\n message: asstMessage(\"\"),\n } satisfies AgentEvent);\n }\n const delta = fullText.startsWith(this.prevText)\n ? fullText.slice(this.prevText.length)\n : fullText;\n this.prevText = fullText;\n if (delta) {\n this.emit(\"agent-event\", {\n type: \"message_update\",\n message: asstMessage(fullText),\n _textDelta: delta,\n } satisfies AgentEvent);\n }\n }\n\n protected pushAssistantEnd(fullText?: string): void {\n if (!this.activeAssistant) return;\n const text = fullText ?? this.prevText;\n this.emit(\"agent-event\", {\n type: \"message_end\",\n message: asstMessage(text),\n } satisfies AgentEvent);\n this.activeAssistant = false;\n this.prevText = \"\";\n }\n\n protected pushToolCall(name: string, input: unknown): void {\n this.emit(\"agent-event\", {\n type: \"tool_call\",\n name,\n tool: { name },\n input,\n } satisfies AgentEvent);\n }\n\n protected pushToolResult(name: string, data: unknown, isError = false): void {\n this.pendingToolResults.push({ role: \"tool\", toolName: name, content: \"\", data, isError });\n this.emit(\"agent-event\", {\n type: \"tool_execution_end\",\n toolName: name,\n } satisfies AgentEvent);\n }\n\n private flushToolResults(): void {\n if (this.pendingToolResults.length === 0) return;\n this.emit(\"agent-event\", {\n type: \"turn_end\",\n toolResults: [...this.pendingToolResults],\n } satisfies AgentEvent);\n this.pendingToolResults = [];\n }\n\n protected pushResult(opts: {\n tokens?: TokenUsage | null;\n costUsd?: number;\n summary?: string;\n subtype?: string;\n }): void {\n this.pushAssistantEnd();\n this.flushToolResults();\n if (opts.tokens) this._lastTokens = opts.tokens;\n this.sawResult = true;\n this.emit(\"agent-event\", {\n type: \"result\",\n subtype: opts.subtype ?? \"success\",\n summary: opts.summary,\n costUsd: opts.costUsd ?? 0,\n ...(opts.tokens ? { tokens: opts.tokens } : {}),\n } satisfies AgentEvent);\n }\n\n protected pushError(detail: AgentError, fatal = false): void {\n this.emit(\"agent-event\", {\n type: \"error\",\n error: detail.message,\n detail,\n fatal,\n } satisfies AgentEvent);\n }\n\n protected captureSession(id?: string, file?: string): void {\n if (!id || id === this._sessionId) return;\n this._sessionId = id;\n this.emit(\"agent-event\", {\n type: \"session_info\",\n driverSessionId: id,\n ...(file ? { sessionFile: file } : {}),\n } satisfies AgentEvent);\n }\n\n /** Shared keyword classification + per-driver hint copy (mirrors omp/codex). */\n protected classifyMessage(message: string): AgentError {\n const generic = classifyGenericErrorMessage(message);\n if (!generic) {\n return {\n message,\n category: \"unknown\",\n retryable: true,\n hint: `An unexpected ${this.productName} error occurred. Try the prompt again.`,\n };\n }\n const hint =\n generic.category === \"auth\"\n ? `Check the API key / login configured for ${this.productName}.`\n : generic.category === \"rate_limit\"\n ? `${this.productName} hit a provider rate limit. Wait a moment and try again.`\n : generic.category === \"model\"\n ? \"The selected model is unavailable or the context is too long. Change the model or start a new session.\"\n : `A network error occurred while talking to ${this.productName}.`;\n return { message, category: generic.category, retryable: generic.retryable, hint };\n }\n\n // ── Env allowlist ──────────────────────────────────────────────────────────\n\n /**\n * Explicit env whitelist forwarded to the child. Omits anything provisioned\n * by `provision_secrets` so user credentials stay out of the subprocess\n * environment. Always passes through the driver's test-seam vars and\n * `FAKE_CLI_*`.\n *\n * `config.env` is merged **over** the whitelist, not in place of it. It used\n * to replace it wholesale, which meant any caller that set a single variable\n * silently dropped `PATH` and `HOME` and the spawn failed with ENOENT —\n * unusable as the delivery channel for registry-derived endpoint variables\n * (plan §2.3, \"Delivery rule\"). Widening keeps both: the caller's variables\n * win per key, the process still has a `PATH`.\n */\n protected baseEnv(extraKeys: string[] = []): Record<string, string> {\n const out: Record<string, string> = {};\n const explicit = [\"PATH\", \"HOME\", \"USER\", \"HOSTNAME\", \"SKAILE_SESSION_ID\", ...extraKeys];\n for (const key of explicit) {\n const v = process.env[key];\n if (v !== undefined) out[key] = v;\n }\n for (const [key, value] of Object.entries(process.env)) {\n if (typeof value !== \"string\") continue;\n if (key.startsWith(`${this.envPrefix}_BRIDGE_`) || key.startsWith(\"FAKE_CLI_\")) {\n out[key] = value;\n }\n }\n if (this.config.sshKeyPath) {\n out.GIT_SSH_COMMAND = `ssh -i \"${this.config.sshKeyPath}\" -o StrictHostKeyChecking=accept-new`;\n }\n if (this.config.env) Object.assign(out, this.config.env);\n return stripRunnerPrivateEnv(out);\n }\n\n // ── Internals ────────────────────────────────────────────────────────────\n\n private onStdoutLine(line: string): void {\n if (!line.trim()) return;\n let json: unknown;\n try {\n json = JSON.parse(line);\n } catch {\n this.log.debug(\"non-JSON stdout line\", { line });\n return;\n }\n try {\n this.handleJson(json);\n } catch (err) {\n this.log.warn(\"handleJson threw\", { error: String(err) });\n }\n }\n\n private onExit(code: number | null, signal: NodeJS.Signals | null): void {\n this.cleanup();\n\n if (this.aborting) {\n this.pushAssistantEnd();\n this.flushToolResults();\n this.emit(\"agent-event\", { type: \"agent_end\" } satisfies AgentEvent);\n this.settleResolve();\n return;\n }\n\n if (this.mode === \"buffered\" && (code === 0 || code === null)) {\n try {\n this.handleBuffered(this.stdoutBuffer);\n } catch (err) {\n this.log.warn(\"handleBuffered threw\", { error: String(err) });\n }\n }\n\n const exitErr = this.classifyExit(code, signal);\n if (exitErr && !this.sawResult) {\n this.pushAssistantEnd();\n this.flushToolResults();\n this.pushError(exitErr);\n this.emit(\"agent-event\", { type: \"agent_end\" } satisfies AgentEvent);\n this.settleReject(Object.assign(new Error(exitErr.message), { detail: exitErr }));\n return;\n }\n\n // Clean exit (or non-zero exit after a result already streamed): close any\n // open assistant message, synthesize a success result if none arrived, end.\n if (!this.sawResult) this.pushResult({ summary: \"Task completed\" });\n else {\n this.pushAssistantEnd();\n this.flushToolResults();\n }\n this.emit(\"agent-event\", { type: \"agent_end\" } satisfies AgentEvent);\n this.settleResolve();\n }\n\n private settleResolve(): void {\n const resolve = this.turnResolve;\n this.turnResolve = null;\n this.turnReject = null;\n resolve?.();\n }\n\n private settleReject(err: Error): void {\n const reject = this.turnReject;\n this.turnResolve = null;\n this.turnReject = null;\n reject?.(err);\n }\n\n private cleanup(): void {\n this.rl?.close();\n this.rl = null;\n this.proc = null;\n }\n\n private classifyProcessError(err: NodeJS.ErrnoException): AgentError {\n if (err.code === \"ENOENT\") {\n return {\n message: `${this.defaultBin} command not found`,\n category: \"config\",\n retryable: false,\n hint: this.installHint(),\n };\n }\n if (err.code === \"EACCES\") {\n return {\n message: `Permission denied running ${this.defaultBin}`,\n category: \"config\",\n retryable: false,\n hint: `Check file permissions for the ${this.defaultBin} binary.`,\n };\n }\n return {\n message: err.message,\n category: \"process\",\n retryable: true,\n hint: `An unexpected process error occurred running ${this.productName}. Try again.`,\n };\n }\n}\n\n// ───────────────────────────────────────────────────────────────────────────\n// Tolerant JSON extractors — shared because the upstream stream-json schemas\n// are not fully pinned; read the common field-name variants defensively.\n// ───────────────────────────────────────────────────────────────────────────\n\nfunction asstMessage(text: string): AgentMessage {\n return { role: \"assistant\", content: [{ type: \"text\", text }] };\n}\n\n/** Pull assistant text out of a CLI event, trying the common field names. */\nexport function extractText(json: any): string {\n if (typeof json?.text === \"string\") return json.text;\n if (typeof json?.delta === \"string\") return json.delta;\n if (typeof json?.content === \"string\") return json.content;\n if (typeof json?.response === \"string\") return json.response;\n const msg = json?.message;\n if (typeof msg?.content === \"string\") return msg.content;\n if (Array.isArray(msg?.content)) {\n return msg.content\n .filter(\n (b: any) => (b?.type === \"text\" || b?.type === undefined) && typeof b?.text === \"string\",\n )\n .map((b: any) => b.text)\n .join(\"\");\n }\n if (Array.isArray(json?.parts)) {\n return json.parts\n .filter((p: any) => typeof p?.text === \"string\")\n .map((p: any) => p.text)\n .join(\"\");\n }\n // OpenCode (`run --format json`) nests the payload under `part`.\n if (typeof json?.part?.text === \"string\") return json.part.text;\n return \"\";\n}\n\n/** Map a CLI usage/stats object onto {@link TokenUsage}, trying common field names. */\nexport function extractTokens(json: any): TokenUsage | null {\n const u = json?.usage ?? json?.stats?.usage ?? json?.stats ?? json?.tokens ?? json;\n if (!u || typeof u !== \"object\") return null;\n const input = u.input_tokens ?? u.inputTokens ?? u.prompt_tokens ?? u.promptTokenCount ?? u.input;\n const output =\n u.output_tokens ?? u.outputTokens ?? u.completion_tokens ?? u.candidatesTokenCount ?? u.output;\n const cacheRead = u.cached_input_tokens ?? u.cacheReadTokens ?? u.cachedContentTokenCount;\n if (input === undefined && output === undefined) return null;\n const tokens: TokenUsage = {};\n if (typeof input === \"number\") tokens.inputTokens = input;\n if (typeof output === \"number\") tokens.outputTokens = output;\n if (typeof cacheRead === \"number\") tokens.cacheReadTokens = cacheRead;\n return tokens;\n}\n\n/** Pull a per-turn USD cost from a CLI result object, or `undefined`. */\nexport function extractCost(json: any): number | undefined {\n const c =\n json?.cost ?? json?.costUsd ?? json?.total_cost_usd ?? json?.stats?.cost ?? json?.usage?.cost;\n return typeof c === \"number\" ? c : undefined;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withFsDeadline, tryWithFsDeadline, walkDir } from './chunk-
|
|
1
|
+
import { withFsDeadline, tryWithFsDeadline, walkDir } from './chunk-Y34MSWEZ.js';
|
|
2
2
|
import { createLogger } from './chunk-BOFL7GIF.js';
|
|
3
3
|
import { parse } from 'yaml';
|
|
4
4
|
import { readFile, stat } from 'fs/promises';
|
|
@@ -329,5 +329,5 @@ function validateFlowVersions(nodes, skillVersions) {
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
export { buildRequiresPreamble, parseCompactionDirectives, parseSkillFrontmatter, parseSkillRequirements, validateConnectorRequirements, validateFlowVersions, validateRequirements };
|
|
332
|
-
//# sourceMappingURL=chunk-
|
|
333
|
-
//# sourceMappingURL=chunk-
|
|
332
|
+
//# sourceMappingURL=chunk-3MKPZZRE.js.map
|
|
333
|
+
//# sourceMappingURL=chunk-3MKPZZRE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../resolver/src/parser.ts","../resolver/src/preamble.ts","../resolver/src/validator.ts","../resolver/src/version.ts"],"names":["parseYaml"],"mappings":";;;;;;;AAeO,SAAS,sBAAsB,OAAA,EAAsC;AAC1E,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,CAAM,uBAAuB,CAAA;AACnD,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AACpB,EAAA,IAAI;AACF,IAAA,OAAOA,KAAA,CAAU,KAAA,CAAM,CAAC,CAAE,KAAK,EAAC;AAAA,EAClC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF;AAmBO,SAAS,uBAAuB,OAAA,EAAoC;AACzE,EAAA,MAAM,EAAA,GAAK,sBAAsB,OAAO,CAAA;AACxC,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,QAAA,IAAY,EAAC;AAC7B,EAAA,MAAM,aAAA,GAAgB,IAAA,CAAK,aAAA,IAAiB,EAAC;AAE7C,EAAA,MAAM,KAAA,GAA2B;AAAA,IAC/B,OAAO,EAAC;AAAA,IACR,iBAAiB,EAAC;AAAA,IAClB,iBAAiB,EAAC;AAAA,IAClB,OAAO,EAAC;AAAA,IACR,UAAU,EAAC;AAAA,IACX,WAAW,EAAC;AAAA,IACZ,YAAY;AAAC,GACf;AAGA,EAAA,IACE,aAAA,CAAc,KAAA,IACd,aAAA,CAAc,eAAA,IACd,aAAA,CAAc,eAAA,IACd,aAAA,CAAc,KAAA,IACd,aAAA,CAAc,QAAA,IACd,aAAA,CAAc,SAAA,IACd,cAAc,UAAA,EACd;AACA,IAAA,OAAO;AAAA,MACL,QAAQ,aAAA,CAAc,KAAA,IAAS,EAAC,EAAG,GAAA,CAAI,CAAC,CAAA,MAAY;AAAA,QAClD,MAAM,C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AACA,EAAA,OAAO,EAAE,OAAO,UAAA,EAAW;AAC7B;AChPO,SAAS,oBAAA,CACd,OACA,aAAA,EACgB;AAChB,EAAA,MAAM,SAAyB,EAAC;AAEhC,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,CAAC,KAAK,gBAAA,EAAkB;AAE5B,IAAA,MAAM,MAAA,GAAS,aAAA,CAAc,GAAA,CAAI,IAAA,CAAK,OAAO,CAAA,IAAK,EAAA;AAClD,IAAA,MAAM,YAAY,IAAA,CAAK,gBAAA;AAGvB,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,SAAS,CAAA,KAAM,IAAA;AAC7C,IAAA,MAAM,WAAA,GAAc,MAAA,KAAW,EAAA,IAAM,KAAA,CAAM,MAAM,CAAA,KAAM,IAAA;AACvD,IAAA,MAAM,WAAA,GAAc,UAAA,IAAc,WAAA,IAAe,SAAA,CAAU,QAAQ,SAAS,CAAA;AAE5E,IAAA,MAAA,CAAO,IAAA,CAAK;AAAA,MACV,QAAQ,IAAA,CAAK,MAAA;AAAA,MACb,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,SAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,EAAW;AAAA,KACZ,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-CGT45WN7.js","sourcesContent":["import { parse as parseYaml } from \"yaml\";\nimport type { ConnectorRequirement, InputField, SkillRequirements } from \"./types.js\";\n\n/**\n * Extract YAML frontmatter from a SKILL.md string.\n *\n * Frontmatter is delimited by leading `---` fences. Returns the parsed object,\n * or an empty object `{}` if no frontmatter block is found or if the YAML is malformed.\n * Errors are silently swallowed — callers should treat an empty result as \"no requirements\".\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Parsed frontmatter object, or `{}` on absence or parse failure\n *\n * @docLink packages/resolver/api-reference#parseskill-frontmatter\n */\nexport function parseSkillFrontmatter(content: string): Record<string, any> {\n const match = content.match(/^---\\n([\\s\\S]*?)\\n---/);\n if (!match) return {};\n try {\n return parseYaml(match[1]!) ?? {};\n } catch {\n return {};\n }\n}\n\n/**\n * Parse skill requirements from raw SKILL.md content into a `SkillRequirements` object.\n *\n * Supports two frontmatter formats:\n * 1. **New format** — `metadata.prerequisites` with explicit\n * `files`, `inputs_required`, `inputs_optional`, `reads`, `produces`, and `resources` arrays.\n * 2. **Legacy format** — `metadata.user_inputs.dialog[]` array, automatically promoted to\n * `inputs_required` / `inputs_optional` based on each entry's `required` flag.\n *\n * Returns empty requirements `{ files: [], inputs_required: [], inputs_optional: [], reads: [], produces: [], resources: [] }`\n * when no recognisable prerequisites section is found.\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Structured `SkillRequirements` (never throws)\n *\n * @docLink packages/resolver/api-reference#parseskill-requirements\n */\nexport function parseSkillRequirements(content: string): SkillRequirements {\n const fm = parseSkillFrontmatter(content);\n const meta = fm.metadata ?? {};\n const prerequisites = meta.prerequisites ?? {};\n\n const empty: SkillRequirements = {\n files: [],\n inputs_required: [],\n inputs_optional: [],\n reads: [],\n produces: [],\n resources: [],\n connectors: [],\n };\n\n // New format: metadata.prerequisites\n if (\n prerequisites.files ||\n prerequisites.inputs_required ||\n prerequisites.inputs_optional ||\n prerequisites.reads ||\n prerequisites.produces ||\n prerequisites.resources ||\n prerequisites.connectors\n ) {\n return {\n files: (prerequisites.files ?? []).map((f: any) => ({\n path: f.path,\n gate: f.gate ?? \"hard\",\n description: f.description ?? \"\",\n ...(f.min_entries != null ? { min_entries: f.min_entries } : {}),\n })),\n inputs_required: (prerequisites.inputs_required ?? []).map(normalizeInputField(true)),\n inputs_optional: (prerequisites.inputs_optional ?? []).map(normalizeInputField(false)),\n reads: (prerequisites.reads ?? []).map((r: any) => ({\n path: r.path,\n description: r.description ?? \"\",\n })),\n produces: (prerequisites.produces ?? []).map((p: any) => ({\n path: p.path,\n description: p.description ?? \"\",\n })),\n resources: (prerequisites.resources ?? []).map((r: any) => ({\n id: r.id,\n ...(r.operations ? { operations: r.operations } : {}),\n optional: r.optional ?? false,\n ...(r.description ? { description: r.description } : {}),\n })),\n connectors: parseConnectorRequirements(prerequisites.connectors),\n };\n }\n\n // Legacy format: metadata.user_inputs.dialog[]\n const dialog = meta.user_inputs?.dialog;\n if (Array.isArray(dialog)) {\n const required: InputField[] = [];\n const optional: InputField[] = [];\n for (const d of dialog) {\n const field = normalizeInputField(d.required ?? false)(d);\n if (d.required) required.push(field);\n else optional.push(field);\n }\n return { ...empty, inputs_required: required, inputs_optional: optional, resources: [] };\n }\n\n return empty;\n}\n\n/**\n * Extract compaction directives from a SKILL.md markdown body.\n *\n * Scans the markdown body (not frontmatter) for a `## Compaction Directives` section\n * and returns each bullet point as a trimmed string. Compaction directives are hints\n * the agent uses to summarise context when the conversation history grows long.\n * Returns an empty array when the section is absent.\n *\n * @param content - Raw SKILL.md file content (full string including frontmatter and body)\n * @returns Array of directive strings extracted from the bullet list, or `[]` if none found\n *\n * @docLink packages/resolver/api-reference#parse-compaction-directives\n */\nexport function parseCompactionDirectives(content: string): string[] {\n const headerIdx = content.search(/^## Compaction Directives/m);\n if (headerIdx === -1) return [];\n\n // Header on the last line (no trailing newline) → no body to scan.\n const newlineIdx = content.indexOf(\"\\n\", headerIdx);\n if (newlineIdx === -1) return [];\n const bodyStart = newlineIdx + 1;\n const rest = content.slice(bodyStart);\n const nextSection = rest.search(/^##\\s/m);\n const sectionBody = nextSection === -1 ? rest : rest.slice(0, nextSection);\n\n const bullets: string[] = [];\n for (const line of sectionBody.split(\"\\n\")) {\n const match = line.match(/^\\s*[-*]\\s+(.+)/);\n if (match) bullets.push(match[1].trim());\n }\n return bullets;\n}\n\nfunction normalizeInputField(defaultRequired: boolean) {\n return (d: any): InputField => ({\n // UserInputSchema permits `key` or `id`; `prompt` is the legacy label alias.\n id: d.id ?? d.key,\n label: d.label ?? d.prompt ?? d.id ?? d.key,\n type: d.type ?? \"text\",\n required: d.required ?? defaultRequired,\n ...(d.options ? { options: d.options } : {}),\n ...(d.default != null ? { default: d.default } : {}),\n ...(d.hint ? { hint: d.hint } : {}),\n ...(d.schema ? { schema: d.schema } : {}),\n });\n}\n\nfunction parseConnectorRequirements(raw: unknown): ConnectorRequirement[] {\n if (!Array.isArray(raw)) return [];\n return raw\n .filter((c): c is Record<string, unknown> => typeof c === \"object\" && c !== null)\n .map((c) => ({\n driver: String(c.driver ?? \"\"),\n ...(c.access === \"read-write\"\n ? { access: \"read-write\" as const }\n : { access: \"read-only\" as const }),\n }))\n .filter((c) => c.driver.length > 0);\n}\n","import type { SkillRequirements } from \"./types.js\";\n\n/**\n * Generate a DSL-format preamble from skill requirements.\n *\n * The preamble is prepended to the skill prompt when the skill runs standalone\n * (without an orchestrator), giving the agent an explicit checklist of what to\n * verify before starting work. Each section maps to a requirement category:\n *\n * - `REQUIRES` — file/directory gates (`hard:` or `soft:` prefix)\n * - `INPUT` — user input fields, with a pointer to `input.json` if `skillId` is provided\n * - `READS` — informational read sources (not gated)\n * - `WRITES` — files the skill will produce\n * - `RESOURCE` — runtime resource dependencies\n *\n * Sections with no entries are omitted. Returns an empty string when all\n * requirement arrays are empty.\n *\n * @param requirements - Parsed requirements (output of `parseSkillRequirements`)\n * @param skillId - Optional skill identifier; when provided, the INPUT section includes\n * the canonical `input.json` path so the agent knows where to read collected values\n * @returns Multi-section DSL string, or `\"\"` if there are no requirements to list\n *\n * @example\n * ```ts\n * const preamble = buildRequiresPreamble(requirements, \"cf_overview\");\n * const fullPrompt = preamble ? `${preamble}\\n\\n${skillBody}` : skillBody;\n * ```\n *\n * @docLink packages/resolver/api-reference#build-requires-preamble\n */\nexport function buildRequiresPreamble(requirements: SkillRequirements, skillId?: string): string {\n const sections: string[] = [];\n\n pushSection(sections, buildRequiresSection(requirements));\n pushSection(sections, buildInputSection(requirements, skillId));\n pushSection(sections, buildReadsSection(requirements));\n pushSection(sections, buildWritesSection(requirements));\n pushSection(sections, buildResourceSection(requirements));\n\n return sections.join(\"\\n\\n\");\n}\n\n/** Append a section to the list when it produced output. */\nfunction pushSection(sections: string[], section: string | null): void {\n if (section !== null) sections.push(section);\n}\n\n/** REQUIRES section (file gates). Returns `null` when there are no file gates. */\nfunction buildRequiresSection(requirements: SkillRequirements): string | null {\n if (requirements.files.length === 0) return null;\n const lines = [\"REQUIRES\"];\n for (const f of requirements.files) {\n const prefix = f.gate === \"hard\" ? \"hard\" : \"soft\";\n lines.push(` ${prefix}: ${f.path} — ${f.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** INPUT section (user inputs). Returns `null` when there are no inputs. */\nfunction buildInputSection(requirements: SkillRequirements, skillId?: string): string | null {\n const allInputs = [...requirements.inputs_required, ...requirements.inputs_optional];\n if (allInputs.length === 0) return null;\n const lines = [\"INPUT\"];\n if (skillId) {\n lines.push(` Read from: _concept/_grounding/${skillId}/input.json`);\n lines.push(\n ` If input.json is missing, ask the user for the following values and write the file:`,\n );\n }\n for (const input of allInputs) {\n const req = input.required ? \"(required)\" : \"(optional)\";\n const opts = input.options ? ` [${input.options.join(\" | \")}]` : \"\";\n const def = input.default != null ? ` default: ${input.default}` : \"\";\n lines.push(` - ${input.id}: ${input.label} ${req}${opts}${def}`);\n if (input.hint) lines.push(` hint: ${input.hint}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** READS section. Returns `null` when there are no read sources. */\nfunction buildReadsSection(requirements: SkillRequirements): string | null {\n if (requirements.reads.length === 0) return null;\n const lines = [\"READS\"];\n for (const r of requirements.reads) {\n lines.push(` ? ${r.path} — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** WRITES section (produces). Returns `null` when there is nothing produced. */\nfunction buildWritesSection(requirements: SkillRequirements): string | null {\n if (requirements.produces.length === 0) return null;\n const lines = [\"WRITES\"];\n for (const p of requirements.produces) {\n lines.push(` ${p.path} — ${p.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** RESOURCE section. Returns `null` when there are no resources. */\nfunction buildResourceSection(requirements: SkillRequirements): string | null {\n if (!requirements.resources || requirements.resources.length === 0) return null;\n const lines = [\"RESOURCE\"];\n for (const r of requirements.resources) {\n const req = r.optional ? \"(optional)\" : \"(required)\";\n const ops = r.operations ? ` ops: [${r.operations.join(\", \")}]` : \"\";\n lines.push(` ${r.id} ${req}${ops}`);\n if (r.description) lines.push(` — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n tryWithFsDeadline,\n walkDir,\n type WalkTruncation,\n withFsDeadline,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type {\n ConnectorRequirement,\n FileCheck,\n InputCheck,\n NodeOverrides,\n ReadCheck,\n RequirementsReport,\n ResourceCheck,\n SkillInputFile,\n SkillRequirements,\n} from \"./types.js\";\n\nlet validatorLogger: ReturnType<typeof createLogger> | undefined;\n\nfunction log(): ReturnType<typeof createLogger> {\n validatorLogger ??= createLogger({ kind: \"runner\", subkind: \"skill-requirements\" });\n return validatorLogger;\n}\n\n/** Best-effort existence probe. A missing path, an unreadable one, and an\n * unresponsive mount are all \"not usable here\" for a requirement check. */\nasync function pathExists(target: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${target}`,\n async () => {\n await stat(target);\n return true;\n },\n false,\n );\n}\n\n/**\n * Validate skill requirements against the filesystem and collected inputs.\n *\n * File checks resolve paths relative to `projectDir`. Hard-gate files that are absent\n * set `satisfied: false` on the returned report; soft-gate misses are recorded but do not block.\n * Input checks read `_concept/_grounding/{skillId}/input.json`; missing files are treated as\n * no inputs collected. Resource checks are always recorded as `available: true` — actual\n * availability must be confirmed by the runner's `ResourceManager`.\n *\n * **Async and bounded since #454.** `projectDir` reaches this function straight\n * from the agent — `workspace_check_skill_requirements` takes `target_dir` as a\n * tool argument — so it can be `/skaile/workspace`, the rclone FUSE mount. Every\n * probe is now awaited and deadline-bounded, and the `min_entries` count walks\n * through the bounded {@link walkDir}, so a wedged mount or a symlink cycle\n * costs one failed tool call instead of the whole `skaile serve` event loop.\n *\n * @param skillId - Canonical skill identifier, used to locate `input.json`\n * @param requirements - Parsed requirements from SKILL.md (`parseSkillRequirements` output)\n * @param projectDir - Absolute path to the project root directory\n * @param overrides - Optional flow-level overrides; paths in `skip_checks` are treated as present\n * @param producesIndex - Maps file paths to the skill ID that produces them, enabling \"produced by\" hints in the report\n * @returns `RequirementsReport` with per-check results and an overall `satisfied` flag\n *\n * @docLink packages/resolver/api-reference#validate-requirements\n */\nexport async function validateRequirements(\n skillId: string,\n requirements: SkillRequirements,\n projectDir: string,\n overrides?: NodeOverrides,\n producesIndex?: Map<string, string>,\n): Promise<RequirementsReport> {\n const skipSet = new Set(overrides?.skip_checks ?? []);\n\n // Check files. Serial on purpose: `projectDir` may be one network mount, and\n // fanning every probe out concurrently multiplies the queue depth on exactly\n // the resource that is already the bottleneck.\n const files: FileCheck[] = [];\n for (const req of requirements.files) {\n if (skipSet.has(req.path)) {\n files.push({ path: req.path, gate: req.gate, exists: true, description: req.description });\n continue;\n }\n\n const fullPath = path.join(projectDir, req.path);\n const check: FileCheck = {\n path: req.path,\n gate: req.gate,\n exists: false,\n description: req.description,\n producedBy: producesIndex?.get(req.path),\n };\n\n if (req.min_entries != null) {\n const counted = await checkDirectoryMinEntries(fullPath, req.min_entries);\n check.exists = counted.satisfied;\n if (counted.truncated) check.truncated = true;\n } else {\n check.exists = await pathExists(fullPath);\n }\n\n files.push(check);\n }\n\n // Check inputs — look for _concept/_grounding/{skillId}/input.json\n const inputFile = path.join(projectDir, \"_concept\", \"_grounding\", skillId, \"input.json\");\n let collectedValues: Record<string, any> = {};\n try {\n const raw = await withFsDeadline(`readFile ${inputFile}`, () => readFile(inputFile, \"utf-8\"));\n const parsed = JSON.parse(raw) as SkillInputFile;\n collectedValues = parsed.values ?? {};\n } catch {\n // No input file — all inputs are missing\n }\n\n const allInputs = [\n ...requirements.inputs_required.map((f) => ({ field: f, required: true })),\n ...requirements.inputs_optional.map((f) => ({ field: f, required: false })),\n ];\n\n const inputs: InputCheck[] = allInputs.map(({ field, required }) => ({\n id: field.id,\n required,\n present: field.id in collectedValues,\n field,\n }));\n\n // Check reads (informational only)\n const reads: ReadCheck[] = [];\n for (const r of requirements.reads) {\n reads.push({\n path: r.path,\n exists: await pathExists(path.join(projectDir, r.path)),\n description: r.description,\n });\n }\n\n // Check resources (validated at a higher level if a ResourceManager is available;\n // here we just record them in the report with unknown status)\n const resources: ResourceCheck[] = (requirements.resources ?? []).map((r) => ({\n id: r.id,\n available: true, // Actual availability checked by runner with ResourceManager\n missingOps: [],\n optional: r.optional ?? false,\n }));\n\n // Satisfaction: all hard file gates pass AND all required inputs present\n const hardFilesSatisfied = files.filter((f) => f.gate === \"hard\").every((f) => f.exists);\n\n const requiredInputsSatisfied = inputs.filter((i) => i.required).every((i) => i.present);\n\n const requiredResourcesSatisfied = resources.filter((r) => !r.optional).every((r) => r.available);\n\n return {\n skillId,\n satisfied: hardFilesSatisfied && requiredInputsSatisfied && requiredResourcesSatisfied,\n files,\n inputs,\n reads,\n resources,\n };\n}\n\n/**\n * A warning produced by `validateConnectorRequirements` when a skill's declared\n * connector requirement is not satisfied by the connectors in skaile.yaml.\n * Each warning covers either a missing driver or an insufficient access level.\n *\n * @docLink packages/resolver/api-reference#connector-validation-warning\n */\nexport interface ConnectorValidationWarning {\n /** Driver name that triggered the warning. */\n driver: string;\n /** Human-readable explanation of the gap, including a remediation command where applicable. */\n message: string;\n}\n\n/** Minimal structural type accepted by validateConnectorRequirements. Compatible with both\n * ConnectorDeclaration shapes in @skaile/workspaces/core and @skaile/workspaces/connectors. */\ninterface AvailableConnector {\n driver: string;\n access?: \"read-only\" | \"read-write\";\n}\n\n/**\n * Check that all connector requirements declared in a skill's SKILL.md are\n * satisfied by the connectors declared in skaile.yaml.\n *\n * Returns one warning per gap — either a missing driver or an insufficient\n * access level. This is a pre-flight advisory; no runtime enforcement is done.\n *\n * @param requirements - Connector requirements from `parseSkillRequirements().connectors`\n * @param available - Connector declarations from `skaile.yaml` (via `loadConnectorDeclarations`)\n * @returns Array of warnings — one per gap. Empty array when all requirements are satisfied.\n *\n * @docLink packages/resolver/api-reference#validate-connector-requirements\n */\nexport function validateConnectorRequirements(\n requirements: ConnectorRequirement[],\n available: AvailableConnector[],\n): ConnectorValidationWarning[] {\n const warnings: ConnectorValidationWarning[] = [];\n\n for (const req of requirements) {\n const matches = available.filter((a) => a.driver === req.driver);\n\n if (matches.length === 0) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires connector driver \"${req.driver}\" but none is declared in skaile.yaml. ` +\n `Run: skaile connector add ${req.driver}`,\n });\n continue;\n }\n\n if (req.access === \"read-write\") {\n const hasReadWrite = matches.some((m) => (m.access ?? \"read-only\") === \"read-write\");\n if (!hasReadWrite) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires \"${req.driver}\" with read-write access, but all declared instances ` +\n `are read-only. Update access in skaile.yaml.`,\n });\n }\n }\n }\n\n return warnings;\n}\n\n/**\n * Does `dirPath` hold at least `minEntries` files, counted recursively?\n *\n * `truncated` is set when a walk bound was hit *and* the count still fell\n * short: the number is then a floor, not the truth, so `satisfied: false` is\n * \"we could not prove it\" rather than \"there are not enough files\". Reaching\n * `minEntries` short-circuits the walk, so the common case never pays for the\n * whole tree and a bound hit after that point is irrelevant.\n */\nasync function checkDirectoryMinEntries(\n dirPath: string,\n minEntries: number,\n): Promise<{ satisfied: boolean; truncated: boolean }> {\n const st = await tryWithFsDeadline(`stat ${dirPath}`, () => stat(dirPath), null);\n if (!st?.isDirectory()) return { satisfied: false, truncated: false };\n\n const { count, truncation } = await countFilesRecursive(dirPath, minEntries);\n const satisfied = count >= minEntries;\n if (!satisfied && truncation) {\n log().warn(\"min_entries count truncated — result is a lower bound, not the file count\", {\n dirPath,\n minEntries,\n count,\n ...truncation,\n });\n }\n return { satisfied, truncated: !satisfied && truncation !== undefined };\n}\n\n/**\n * Count files under `dirPath`, stopping at `limit`.\n *\n * Delegates to core's {@link walkDir} rather than recursing here: `dirPath` is\n * agent-supplied and can be a network mount, so the walk needs the deadline per\n * `opendir`, the depth / entry / wall-clock bounds, and the visited-inode cycle\n * guard that walker already owns. The pre-#454 `readdirSync` recursion had none\n * of them and recursed forever on `a/link -> a`.\n *\n * Inheriting `walkDir` also inherits its skip list: `.git` and `node_modules`\n * no longer count toward `min_entries`, which is what a prerequisite like\n * \"at least 3 feature files\" meant in the first place.\n */\nasync function countFilesRecursive(\n dirPath: string,\n limit: number,\n): Promise<{ count: number; truncation?: WalkTruncation }> {\n let count = 0;\n let truncation: WalkTruncation | undefined;\n for await (const _entry of walkDir(dirPath, {\n onTruncate: (info) => {\n truncation ??= info;\n },\n })) {\n count++;\n // Enough is enough — no reason to keep walking a large tree (or a wedged\n // mount) once the requirement is already met.\n if (count >= limit) return { count };\n }\n return { count, truncation };\n}\n","import { satisfies, valid, validRange } from \"semver\";\n\n/**\n * Result of a single flow-node version pin check.\n * Returned in the array produced by `validateFlowVersions()` for every\n * node that declares a `requestedVersion`.\n *\n * @docLink packages/resolver/api-reference#version-check\n */\nexport interface VersionCheck {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier. */\n skillId: string;\n /** Semver range from the flow node (e.g. \"^1.0.0\") */\n requested: string;\n /** Version from the skill's frontmatter */\n actual: string;\n /** Whether `actual` satisfies the `requested` semver range. */\n satisfied: boolean;\n}\n\n/**\n * Minimal descriptor for a flow node that optionally pins a skill version.\n * Passed as input to `validateFlowVersions()`. Nodes without `requestedVersion`\n * are skipped during version checking.\n *\n * @docLink packages/resolver/api-reference#flow-version-node\n */\nexport interface FlowVersionNode {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier referenced by this node. */\n skillId: string;\n /** Optional semver range the node requires (e.g. `\"^1.2.0\"`). Omit to skip version checking. */\n requestedVersion?: string;\n}\n\n/**\n * Validate flow node version pins against discovered skill versions.\n *\n * Only checks nodes that declare a `requestedVersion`. Nodes without a\n * version pin are skipped entirely (no entry is produced for those nodes).\n * A check is marked `satisfied: false` when the range is invalid, the actual\n * version string is not valid semver, or the version does not satisfy the range.\n *\n * @param nodes - Flow nodes to check; only those with `requestedVersion` are evaluated\n * @param skillVersions - Map from skill ID to the semver version string in its frontmatter\n * @returns Array of `VersionCheck` results, one per node that declared a version pin\n *\n * @docLink packages/resolver/api-reference#validate-flow-versions\n */\nexport function validateFlowVersions(\n nodes: FlowVersionNode[],\n skillVersions: Map<string, string>,\n): VersionCheck[] {\n const checks: VersionCheck[] = [];\n\n for (const node of nodes) {\n if (!node.requestedVersion) continue;\n\n const actual = skillVersions.get(node.skillId) ?? \"\";\n const requested = node.requestedVersion;\n\n // Invalid range or missing/invalid actual version → not satisfied\n const rangeValid = validRange(requested) !== null;\n const actualValid = actual !== \"\" && valid(actual) !== null;\n const isSatisfied = rangeValid && actualValid && satisfies(actual, requested);\n\n checks.push({\n nodeId: node.nodeId,\n skillId: node.skillId,\n requested,\n actual,\n satisfied: isSatisfied,\n });\n }\n\n return checks;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../resolver/src/parser.ts","../resolver/src/preamble.ts","../resolver/src/validator.ts","../resolver/src/version.ts"],"names":["parseYaml"],"mappings":";;;;;;;AAeO,SAAS,sBAAsB,OAAA,EAAsC;AAC1E,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,CAAM,uBAAuB,CAAA;AACnD,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AACpB,EAAA,IAAI;AACF,IAAA,OAAOA,KAAA,CAAU,KAAA,CAAM,CAAC,CAAE,KAAK,EAAC;AAAA,EAClC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF;AAmBO,SAAS,uBAAuB,OAAA,EAAoC;AACzE,EAAA,MAAM,EAAA,GAAK,sBAAsB,OAAO,CAAA;AACxC,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,QAAA,IAAY,EAAC;AAC7B,EAAA,MAAM,aA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OAAA;AAAA,MACd,SAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,EAAW;AAAA,KACZ,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-3MKPZZRE.js","sourcesContent":["import { parse as parseYaml } from \"yaml\";\nimport type { ConnectorRequirement, InputField, SkillRequirements } from \"./types.js\";\n\n/**\n * Extract YAML frontmatter from a SKILL.md string.\n *\n * Frontmatter is delimited by leading `---` fences. Returns the parsed object,\n * or an empty object `{}` if no frontmatter block is found or if the YAML is malformed.\n * Errors are silently swallowed — callers should treat an empty result as \"no requirements\".\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Parsed frontmatter object, or `{}` on absence or parse failure\n *\n * @docLink packages/resolver/api-reference#parseskill-frontmatter\n */\nexport function parseSkillFrontmatter(content: string): Record<string, any> {\n const match = content.match(/^---\\n([\\s\\S]*?)\\n---/);\n if (!match) return {};\n try {\n return parseYaml(match[1]!) ?? {};\n } catch {\n return {};\n }\n}\n\n/**\n * Parse skill requirements from raw SKILL.md content into a `SkillRequirements` object.\n *\n * Supports two frontmatter formats:\n * 1. **New format** — `metadata.prerequisites` with explicit\n * `files`, `inputs_required`, `inputs_optional`, `reads`, `produces`, and `resources` arrays.\n * 2. **Legacy format** — `metadata.user_inputs.dialog[]` array, automatically promoted to\n * `inputs_required` / `inputs_optional` based on each entry's `required` flag.\n *\n * Returns empty requirements `{ files: [], inputs_required: [], inputs_optional: [], reads: [], produces: [], resources: [] }`\n * when no recognisable prerequisites section is found.\n *\n * @param content - Raw SKILL.md file content (full string, including `---` fences)\n * @returns Structured `SkillRequirements` (never throws)\n *\n * @docLink packages/resolver/api-reference#parseskill-requirements\n */\nexport function parseSkillRequirements(content: string): SkillRequirements {\n const fm = parseSkillFrontmatter(content);\n const meta = fm.metadata ?? {};\n const prerequisites = meta.prerequisites ?? {};\n\n const empty: SkillRequirements = {\n files: [],\n inputs_required: [],\n inputs_optional: [],\n reads: [],\n produces: [],\n resources: [],\n connectors: [],\n };\n\n // New format: metadata.prerequisites\n if (\n prerequisites.files ||\n prerequisites.inputs_required ||\n prerequisites.inputs_optional ||\n prerequisites.reads ||\n prerequisites.produces ||\n prerequisites.resources ||\n prerequisites.connectors\n ) {\n return {\n files: (prerequisites.files ?? []).map((f: any) => ({\n path: f.path,\n gate: f.gate ?? \"hard\",\n description: f.description ?? \"\",\n ...(f.min_entries != null ? { min_entries: f.min_entries } : {}),\n })),\n inputs_required: (prerequisites.inputs_required ?? []).map(normalizeInputField(true)),\n inputs_optional: (prerequisites.inputs_optional ?? []).map(normalizeInputField(false)),\n reads: (prerequisites.reads ?? []).map((r: any) => ({\n path: r.path,\n description: r.description ?? \"\",\n })),\n produces: (prerequisites.produces ?? []).map((p: any) => ({\n path: p.path,\n description: p.description ?? \"\",\n })),\n resources: (prerequisites.resources ?? []).map((r: any) => ({\n id: r.id,\n ...(r.operations ? { operations: r.operations } : {}),\n optional: r.optional ?? false,\n ...(r.description ? { description: r.description } : {}),\n })),\n connectors: parseConnectorRequirements(prerequisites.connectors),\n };\n }\n\n // Legacy format: metadata.user_inputs.dialog[]\n const dialog = meta.user_inputs?.dialog;\n if (Array.isArray(dialog)) {\n const required: InputField[] = [];\n const optional: InputField[] = [];\n for (const d of dialog) {\n const field = normalizeInputField(d.required ?? false)(d);\n if (d.required) required.push(field);\n else optional.push(field);\n }\n return { ...empty, inputs_required: required, inputs_optional: optional, resources: [] };\n }\n\n return empty;\n}\n\n/**\n * Extract compaction directives from a SKILL.md markdown body.\n *\n * Scans the markdown body (not frontmatter) for a `## Compaction Directives` section\n * and returns each bullet point as a trimmed string. Compaction directives are hints\n * the agent uses to summarise context when the conversation history grows long.\n * Returns an empty array when the section is absent.\n *\n * @param content - Raw SKILL.md file content (full string including frontmatter and body)\n * @returns Array of directive strings extracted from the bullet list, or `[]` if none found\n *\n * @docLink packages/resolver/api-reference#parse-compaction-directives\n */\nexport function parseCompactionDirectives(content: string): string[] {\n const headerIdx = content.search(/^## Compaction Directives/m);\n if (headerIdx === -1) return [];\n\n // Header on the last line (no trailing newline) → no body to scan.\n const newlineIdx = content.indexOf(\"\\n\", headerIdx);\n if (newlineIdx === -1) return [];\n const bodyStart = newlineIdx + 1;\n const rest = content.slice(bodyStart);\n const nextSection = rest.search(/^##\\s/m);\n const sectionBody = nextSection === -1 ? rest : rest.slice(0, nextSection);\n\n const bullets: string[] = [];\n for (const line of sectionBody.split(\"\\n\")) {\n const match = line.match(/^\\s*[-*]\\s+(.+)/);\n if (match) bullets.push(match[1].trim());\n }\n return bullets;\n}\n\nfunction normalizeInputField(defaultRequired: boolean) {\n return (d: any): InputField => ({\n // UserInputSchema permits `key` or `id`; `prompt` is the legacy label alias.\n id: d.id ?? d.key,\n label: d.label ?? d.prompt ?? d.id ?? d.key,\n type: d.type ?? \"text\",\n required: d.required ?? defaultRequired,\n ...(d.options ? { options: d.options } : {}),\n ...(d.default != null ? { default: d.default } : {}),\n ...(d.hint ? { hint: d.hint } : {}),\n ...(d.schema ? { schema: d.schema } : {}),\n });\n}\n\nfunction parseConnectorRequirements(raw: unknown): ConnectorRequirement[] {\n if (!Array.isArray(raw)) return [];\n return raw\n .filter((c): c is Record<string, unknown> => typeof c === \"object\" && c !== null)\n .map((c) => ({\n driver: String(c.driver ?? \"\"),\n ...(c.access === \"read-write\"\n ? { access: \"read-write\" as const }\n : { access: \"read-only\" as const }),\n }))\n .filter((c) => c.driver.length > 0);\n}\n","import type { SkillRequirements } from \"./types.js\";\n\n/**\n * Generate a DSL-format preamble from skill requirements.\n *\n * The preamble is prepended to the skill prompt when the skill runs standalone\n * (without an orchestrator), giving the agent an explicit checklist of what to\n * verify before starting work. Each section maps to a requirement category:\n *\n * - `REQUIRES` — file/directory gates (`hard:` or `soft:` prefix)\n * - `INPUT` — user input fields, with a pointer to `input.json` if `skillId` is provided\n * - `READS` — informational read sources (not gated)\n * - `WRITES` — files the skill will produce\n * - `RESOURCE` — runtime resource dependencies\n *\n * Sections with no entries are omitted. Returns an empty string when all\n * requirement arrays are empty.\n *\n * @param requirements - Parsed requirements (output of `parseSkillRequirements`)\n * @param skillId - Optional skill identifier; when provided, the INPUT section includes\n * the canonical `input.json` path so the agent knows where to read collected values\n * @returns Multi-section DSL string, or `\"\"` if there are no requirements to list\n *\n * @example\n * ```ts\n * const preamble = buildRequiresPreamble(requirements, \"cf_overview\");\n * const fullPrompt = preamble ? `${preamble}\\n\\n${skillBody}` : skillBody;\n * ```\n *\n * @docLink packages/resolver/api-reference#build-requires-preamble\n */\nexport function buildRequiresPreamble(requirements: SkillRequirements, skillId?: string): string {\n const sections: string[] = [];\n\n pushSection(sections, buildRequiresSection(requirements));\n pushSection(sections, buildInputSection(requirements, skillId));\n pushSection(sections, buildReadsSection(requirements));\n pushSection(sections, buildWritesSection(requirements));\n pushSection(sections, buildResourceSection(requirements));\n\n return sections.join(\"\\n\\n\");\n}\n\n/** Append a section to the list when it produced output. */\nfunction pushSection(sections: string[], section: string | null): void {\n if (section !== null) sections.push(section);\n}\n\n/** REQUIRES section (file gates). Returns `null` when there are no file gates. */\nfunction buildRequiresSection(requirements: SkillRequirements): string | null {\n if (requirements.files.length === 0) return null;\n const lines = [\"REQUIRES\"];\n for (const f of requirements.files) {\n const prefix = f.gate === \"hard\" ? \"hard\" : \"soft\";\n lines.push(` ${prefix}: ${f.path} — ${f.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** INPUT section (user inputs). Returns `null` when there are no inputs. */\nfunction buildInputSection(requirements: SkillRequirements, skillId?: string): string | null {\n const allInputs = [...requirements.inputs_required, ...requirements.inputs_optional];\n if (allInputs.length === 0) return null;\n const lines = [\"INPUT\"];\n if (skillId) {\n lines.push(` Read from: _concept/_grounding/${skillId}/input.json`);\n lines.push(\n ` If input.json is missing, ask the user for the following values and write the file:`,\n );\n }\n for (const input of allInputs) {\n const req = input.required ? \"(required)\" : \"(optional)\";\n const opts = input.options ? ` [${input.options.join(\" | \")}]` : \"\";\n const def = input.default != null ? ` default: ${input.default}` : \"\";\n lines.push(` - ${input.id}: ${input.label} ${req}${opts}${def}`);\n if (input.hint) lines.push(` hint: ${input.hint}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** READS section. Returns `null` when there are no read sources. */\nfunction buildReadsSection(requirements: SkillRequirements): string | null {\n if (requirements.reads.length === 0) return null;\n const lines = [\"READS\"];\n for (const r of requirements.reads) {\n lines.push(` ? ${r.path} — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** WRITES section (produces). Returns `null` when there is nothing produced. */\nfunction buildWritesSection(requirements: SkillRequirements): string | null {\n if (requirements.produces.length === 0) return null;\n const lines = [\"WRITES\"];\n for (const p of requirements.produces) {\n lines.push(` ${p.path} — ${p.description}`);\n }\n return lines.join(\"\\n\");\n}\n\n/** RESOURCE section. Returns `null` when there are no resources. */\nfunction buildResourceSection(requirements: SkillRequirements): string | null {\n if (!requirements.resources || requirements.resources.length === 0) return null;\n const lines = [\"RESOURCE\"];\n for (const r of requirements.resources) {\n const req = r.optional ? \"(optional)\" : \"(required)\";\n const ops = r.operations ? ` ops: [${r.operations.join(\", \")}]` : \"\";\n lines.push(` ${r.id} ${req}${ops}`);\n if (r.description) lines.push(` — ${r.description}`);\n }\n return lines.join(\"\\n\");\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n tryWithFsDeadline,\n walkDir,\n type WalkTruncation,\n withFsDeadline,\n} from \"@skaile/workspaces/core\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type {\n ConnectorRequirement,\n FileCheck,\n InputCheck,\n NodeOverrides,\n ReadCheck,\n RequirementsReport,\n ResourceCheck,\n SkillInputFile,\n SkillRequirements,\n} from \"./types.js\";\n\nlet validatorLogger: ReturnType<typeof createLogger> | undefined;\n\nfunction log(): ReturnType<typeof createLogger> {\n validatorLogger ??= createLogger({ kind: \"runner\", subkind: \"skill-requirements\" });\n return validatorLogger;\n}\n\n/** Best-effort existence probe. A missing path, an unreadable one, and an\n * unresponsive mount are all \"not usable here\" for a requirement check. */\nasync function pathExists(target: string): Promise<boolean> {\n return tryWithFsDeadline(\n `stat ${target}`,\n async () => {\n await stat(target);\n return true;\n },\n false,\n );\n}\n\n/**\n * Validate skill requirements against the filesystem and collected inputs.\n *\n * File checks resolve paths relative to `projectDir`. Hard-gate files that are absent\n * set `satisfied: false` on the returned report; soft-gate misses are recorded but do not block.\n * Input checks read `_concept/_grounding/{skillId}/input.json`; missing files are treated as\n * no inputs collected. Resource checks are always recorded as `available: true` — actual\n * availability must be confirmed by the runner's `ResourceManager`.\n *\n * **Async and bounded since #454.** `projectDir` reaches this function straight\n * from the agent — `workspace_check_skill_requirements` takes `target_dir` as a\n * tool argument — so it can be `/skaile/workspace`, the rclone FUSE mount. Every\n * probe is now awaited and deadline-bounded, and the `min_entries` count walks\n * through the bounded {@link walkDir}, so a wedged mount or a symlink cycle\n * costs one failed tool call instead of the whole `skaile serve` event loop.\n *\n * @param skillId - Canonical skill identifier, used to locate `input.json`\n * @param requirements - Parsed requirements from SKILL.md (`parseSkillRequirements` output)\n * @param projectDir - Absolute path to the project root directory\n * @param overrides - Optional flow-level overrides; paths in `skip_checks` are treated as present\n * @param producesIndex - Maps file paths to the skill ID that produces them, enabling \"produced by\" hints in the report\n * @returns `RequirementsReport` with per-check results and an overall `satisfied` flag\n *\n * @docLink packages/resolver/api-reference#validate-requirements\n */\nexport async function validateRequirements(\n skillId: string,\n requirements: SkillRequirements,\n projectDir: string,\n overrides?: NodeOverrides,\n producesIndex?: Map<string, string>,\n): Promise<RequirementsReport> {\n const skipSet = new Set(overrides?.skip_checks ?? []);\n\n // Check files. Serial on purpose: `projectDir` may be one network mount, and\n // fanning every probe out concurrently multiplies the queue depth on exactly\n // the resource that is already the bottleneck.\n const files: FileCheck[] = [];\n for (const req of requirements.files) {\n if (skipSet.has(req.path)) {\n files.push({ path: req.path, gate: req.gate, exists: true, description: req.description });\n continue;\n }\n\n const fullPath = path.join(projectDir, req.path);\n const check: FileCheck = {\n path: req.path,\n gate: req.gate,\n exists: false,\n description: req.description,\n producedBy: producesIndex?.get(req.path),\n };\n\n if (req.min_entries != null) {\n const counted = await checkDirectoryMinEntries(fullPath, req.min_entries);\n check.exists = counted.satisfied;\n if (counted.truncated) check.truncated = true;\n } else {\n check.exists = await pathExists(fullPath);\n }\n\n files.push(check);\n }\n\n // Check inputs — look for _concept/_grounding/{skillId}/input.json\n const inputFile = path.join(projectDir, \"_concept\", \"_grounding\", skillId, \"input.json\");\n let collectedValues: Record<string, any> = {};\n try {\n const raw = await withFsDeadline(`readFile ${inputFile}`, () => readFile(inputFile, \"utf-8\"));\n const parsed = JSON.parse(raw) as SkillInputFile;\n collectedValues = parsed.values ?? {};\n } catch {\n // No input file — all inputs are missing\n }\n\n const allInputs = [\n ...requirements.inputs_required.map((f) => ({ field: f, required: true })),\n ...requirements.inputs_optional.map((f) => ({ field: f, required: false })),\n ];\n\n const inputs: InputCheck[] = allInputs.map(({ field, required }) => ({\n id: field.id,\n required,\n present: field.id in collectedValues,\n field,\n }));\n\n // Check reads (informational only)\n const reads: ReadCheck[] = [];\n for (const r of requirements.reads) {\n reads.push({\n path: r.path,\n exists: await pathExists(path.join(projectDir, r.path)),\n description: r.description,\n });\n }\n\n // Check resources (validated at a higher level if a ResourceManager is available;\n // here we just record them in the report with unknown status)\n const resources: ResourceCheck[] = (requirements.resources ?? []).map((r) => ({\n id: r.id,\n available: true, // Actual availability checked by runner with ResourceManager\n missingOps: [],\n optional: r.optional ?? false,\n }));\n\n // Satisfaction: all hard file gates pass AND all required inputs present\n const hardFilesSatisfied = files.filter((f) => f.gate === \"hard\").every((f) => f.exists);\n\n const requiredInputsSatisfied = inputs.filter((i) => i.required).every((i) => i.present);\n\n const requiredResourcesSatisfied = resources.filter((r) => !r.optional).every((r) => r.available);\n\n return {\n skillId,\n satisfied: hardFilesSatisfied && requiredInputsSatisfied && requiredResourcesSatisfied,\n files,\n inputs,\n reads,\n resources,\n };\n}\n\n/**\n * A warning produced by `validateConnectorRequirements` when a skill's declared\n * connector requirement is not satisfied by the connectors in skaile.yaml.\n * Each warning covers either a missing driver or an insufficient access level.\n *\n * @docLink packages/resolver/api-reference#connector-validation-warning\n */\nexport interface ConnectorValidationWarning {\n /** Driver name that triggered the warning. */\n driver: string;\n /** Human-readable explanation of the gap, including a remediation command where applicable. */\n message: string;\n}\n\n/** Minimal structural type accepted by validateConnectorRequirements. Compatible with both\n * ConnectorDeclaration shapes in @skaile/workspaces/core and @skaile/workspaces/connectors. */\ninterface AvailableConnector {\n driver: string;\n access?: \"read-only\" | \"read-write\";\n}\n\n/**\n * Check that all connector requirements declared in a skill's SKILL.md are\n * satisfied by the connectors declared in skaile.yaml.\n *\n * Returns one warning per gap — either a missing driver or an insufficient\n * access level. This is a pre-flight advisory; no runtime enforcement is done.\n *\n * @param requirements - Connector requirements from `parseSkillRequirements().connectors`\n * @param available - Connector declarations from `skaile.yaml` (via `loadConnectorDeclarations`)\n * @returns Array of warnings — one per gap. Empty array when all requirements are satisfied.\n *\n * @docLink packages/resolver/api-reference#validate-connector-requirements\n */\nexport function validateConnectorRequirements(\n requirements: ConnectorRequirement[],\n available: AvailableConnector[],\n): ConnectorValidationWarning[] {\n const warnings: ConnectorValidationWarning[] = [];\n\n for (const req of requirements) {\n const matches = available.filter((a) => a.driver === req.driver);\n\n if (matches.length === 0) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires connector driver \"${req.driver}\" but none is declared in skaile.yaml. ` +\n `Run: skaile connector add ${req.driver}`,\n });\n continue;\n }\n\n if (req.access === \"read-write\") {\n const hasReadWrite = matches.some((m) => (m.access ?? \"read-only\") === \"read-write\");\n if (!hasReadWrite) {\n warnings.push({\n driver: req.driver,\n message:\n `Skill requires \"${req.driver}\" with read-write access, but all declared instances ` +\n `are read-only. Update access in skaile.yaml.`,\n });\n }\n }\n }\n\n return warnings;\n}\n\n/**\n * Does `dirPath` hold at least `minEntries` files, counted recursively?\n *\n * `truncated` is set when a walk bound was hit *and* the count still fell\n * short: the number is then a floor, not the truth, so `satisfied: false` is\n * \"we could not prove it\" rather than \"there are not enough files\". Reaching\n * `minEntries` short-circuits the walk, so the common case never pays for the\n * whole tree and a bound hit after that point is irrelevant.\n */\nasync function checkDirectoryMinEntries(\n dirPath: string,\n minEntries: number,\n): Promise<{ satisfied: boolean; truncated: boolean }> {\n const st = await tryWithFsDeadline(`stat ${dirPath}`, () => stat(dirPath), null);\n if (!st?.isDirectory()) return { satisfied: false, truncated: false };\n\n const { count, truncation } = await countFilesRecursive(dirPath, minEntries);\n const satisfied = count >= minEntries;\n if (!satisfied && truncation) {\n log().warn(\"min_entries count truncated — result is a lower bound, not the file count\", {\n dirPath,\n minEntries,\n count,\n ...truncation,\n });\n }\n return { satisfied, truncated: !satisfied && truncation !== undefined };\n}\n\n/**\n * Count files under `dirPath`, stopping at `limit`.\n *\n * Delegates to core's {@link walkDir} rather than recursing here: `dirPath` is\n * agent-supplied and can be a network mount, so the walk needs the deadline per\n * `opendir`, the depth / entry / wall-clock bounds, and the visited-inode cycle\n * guard that walker already owns. The pre-#454 `readdirSync` recursion had none\n * of them and recursed forever on `a/link -> a`.\n *\n * Inheriting `walkDir` also inherits its skip list: `.git` and `node_modules`\n * no longer count toward `min_entries`, which is what a prerequisite like\n * \"at least 3 feature files\" meant in the first place.\n */\nasync function countFilesRecursive(\n dirPath: string,\n limit: number,\n): Promise<{ count: number; truncation?: WalkTruncation }> {\n let count = 0;\n let truncation: WalkTruncation | undefined;\n for await (const _entry of walkDir(dirPath, {\n onTruncate: (info) => {\n truncation ??= info;\n },\n })) {\n count++;\n // Enough is enough — no reason to keep walking a large tree (or a wedged\n // mount) once the requirement is already met.\n if (count >= limit) return { count };\n }\n return { count, truncation };\n}\n","import { satisfies, valid, validRange } from \"semver\";\n\n/**\n * Result of a single flow-node version pin check.\n * Returned in the array produced by `validateFlowVersions()` for every\n * node that declares a `requestedVersion`.\n *\n * @docLink packages/resolver/api-reference#version-check\n */\nexport interface VersionCheck {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier. */\n skillId: string;\n /** Semver range from the flow node (e.g. \"^1.0.0\") */\n requested: string;\n /** Version from the skill's frontmatter */\n actual: string;\n /** Whether `actual` satisfies the `requested` semver range. */\n satisfied: boolean;\n}\n\n/**\n * Minimal descriptor for a flow node that optionally pins a skill version.\n * Passed as input to `validateFlowVersions()`. Nodes without `requestedVersion`\n * are skipped during version checking.\n *\n * @docLink packages/resolver/api-reference#flow-version-node\n */\nexport interface FlowVersionNode {\n /** Flow node identifier. */\n nodeId: string;\n /** Canonical skill identifier referenced by this node. */\n skillId: string;\n /** Optional semver range the node requires (e.g. `\"^1.2.0\"`). Omit to skip version checking. */\n requestedVersion?: string;\n}\n\n/**\n * Validate flow node version pins against discovered skill versions.\n *\n * Only checks nodes that declare a `requestedVersion`. Nodes without a\n * version pin are skipped entirely (no entry is produced for those nodes).\n * A check is marked `satisfied: false` when the range is invalid, the actual\n * version string is not valid semver, or the version does not satisfy the range.\n *\n * @param nodes - Flow nodes to check; only those with `requestedVersion` are evaluated\n * @param skillVersions - Map from skill ID to the semver version string in its frontmatter\n * @returns Array of `VersionCheck` results, one per node that declared a version pin\n *\n * @docLink packages/resolver/api-reference#validate-flow-versions\n */\nexport function validateFlowVersions(\n nodes: FlowVersionNode[],\n skillVersions: Map<string, string>,\n): VersionCheck[] {\n const checks: VersionCheck[] = [];\n\n for (const node of nodes) {\n if (!node.requestedVersion) continue;\n\n const actual = skillVersions.get(node.skillId) ?? \"\";\n const requested = node.requestedVersion;\n\n // Invalid range or missing/invalid actual version → not satisfied\n const rangeValid = validRange(requested) !== null;\n const actualValid = actual !== \"\" && valid(actual) !== null;\n const isSatisfied = rangeValid && actualValid && satisfies(actual, requested);\n\n checks.push({\n nodeId: node.nodeId,\n skillId: node.skillId,\n requested,\n actual,\n satisfied: isSatisfied,\n });\n }\n\n return checks;\n}\n"]}
|
|
@@ -83,8 +83,8 @@ var ASSET_NAME_HINT = 'names must be lowercase kebab-case (a-z, 0-9, single hyph
|
|
|
83
83
|
function isValidAssetName(name) {
|
|
84
84
|
return ASSET_NAME_RE.test(name);
|
|
85
85
|
}
|
|
86
|
-
var PUBLISHER_RE = /^[
|
|
87
|
-
var PUBLISHER_HINT = 'publishers must be a bare name like "acme"
|
|
86
|
+
var PUBLISHER_RE = /^[a-z0-9](?:[a-z0-9]|-(?!-)){0,37}[a-z0-9]$|^[a-z0-9]$/;
|
|
87
|
+
var PUBLISHER_HINT = 'publishers must be a bare name of 1-39 characters: lowercase letters, digits and single hyphens inside (like "acme" or "my-lib"), with no @, /, #, dots, underscores or spaces and no leading or trailing hyphen';
|
|
88
88
|
function isValidPublisher(publisher) {
|
|
89
89
|
return PUBLISHER_RE.test(publisher);
|
|
90
90
|
}
|
|
@@ -174,5 +174,5 @@ function repositoryToRaw(r) {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
export { ASSET_NAME_HINT, PUBLISHER_HINT, assetRefToDep, assetRefToStr, depToStr, entryFromRaw, entryToRaw, isValidAssetName, isValidPublisher, parseAssetRef, parseAssetRefLoose, parseDep, repositoryFromRaw, repositoryToRaw, slugifyAssetName };
|
|
177
|
-
//# sourceMappingURL=chunk-
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
177
|
+
//# sourceMappingURL=chunk-4OV5DSBB.js.map
|
|
178
|
+
//# sourceMappingURL=chunk-4OV5DSBB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../core/src/models.ts"],"names":[],"mappings":";;;AAoCA,IAAM,aAAA,GAAgB,2DAAA;AAYf,SAAS,SAAS,CAAA,EAAuB;AAC9C,EAAA,MAAM,OAAA,GAAU,EAAE,IAAA,EAAK;AACvB,EAAA,MAAM,MAAA,GAAS,aAAA,CAAc,IAAA,CAAK,OAAO,CAAA;AACzC,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,IAAI,IAAA,GAAO,OAAO,CAAC,CAAA;AACnB,IAAA,IAAI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minator for catalog entries and asset references.\n * Used in asset ref strings (e.g. `'skill:my-skill'`, `'agent:my-agent'`).\n *\n * Any string: the provider registry (`@skaile/workspaces/discovery`\n * `AssetKindRegistry`) is the only authority on which kinds exist — a kind exists\n * iff a provider is registered for it.\n * @docLink packages/core/concepts#asset-kind\n */\nexport type AssetKind = string;\n\n// ── Dependency ────────────────────────────────────────────────────────────────\n\n/**\n * Declared dependency on another catalog asset.\n * @docLink packages/core/concepts#dependency\n */\nexport interface Dependency {\n /** Asset kind (e.g. \"skill\", \"agent\", \"contract\"). */\n kind: string;\n /** Asset name within that kind. */\n name: string;\n /** Canonical publisher namespace (when known). Absent: the declaring asset's own publisher. */\n publisher?: string;\n /** Version pin (`#<version>` or legacy `@<version>` suffix), when the declaration carried one. */\n pin?: string;\n}\n\n// `[kind:]@<publisher>/<name>[#<pin>]`, with the legacy npm-style `@<version>` suffix on the\n// name. Lenient on the name (the strict grammar runs later, at resolution).\nconst SCOPED_DEP_RE = /^(?:([a-z][a-z0-9-]*):)?@([^/\\s]+)\\/([^#\\s]+?)(?:#(.+))?$/;\n\n/**\n * Parse a dependency string: `\"kind:name\"`, a bare `\"name\"` (kind defaults to `\"skill\"`), or\n * a publisher-qualified `\"kind:@publisher/name[#pin]\"` / `\"@publisher/name[#pin]\"`. The\n * qualified forms fill `publisher` (and `pin`); the other forms leave it absent so the dep\n * resolves under the declaring asset's own publisher.\n *\n * @param s - Dependency string, e.g. `\"skill:use-exa\"`, `\"use-exa\"` or `\"skill:@acme/use-exa#^1.0.0\"`\n * @returns Parsed `{ kind, name, publisher?, pin? }` dependency object\n * @docLink packages/core/concepts#parse-dep\n */\nexport function parseDep(s: string): Dependency {\n const trimmed = s.trim();\n const scoped = SCOPED_DEP_RE.exec(trimmed);\n if (scoped) {\n let name = scoped[3];\n let pin = scoped[4]?.trim() || undefined;\n const at = name.indexOf(\"@\");\n if (at > 0) {\n pin ??= name.slice(at + 1) || undefined;\n name = name.slice(0, at);\n }\n const dep: Dependency = { kind: scoped[1] ?? \"skill\", name, publisher: scoped[2] };\n if (pin) dep.pin = pin;\n return dep;\n }\n const i = trimmed.indexOf(\":\");\n if (i !== -1) {\n const kind = trimmed.slice(0, i).trim();\n const name = trimmed.slice(i + 1).trim();\n return { kind, name };\n }\n return { kind: \"skill\", name: trimmed };\n}\n\n/**\n * Serialize a Dependency back to its string form: `\"kind:name\"`, or\n * `\"kind:@publisher/name[#pin]\"` when it names a publisher.\n *\n * @param d - Dependency to serialize\n * @returns String in `\"kind:name\"` / `\"kind:@publisher/name[#pin]\"` format\n * @docLink packages/core/concepts#dep-to-str\n */\nexport function depToStr(d: Dependency): string {\n const pin = d.pin ? `#${d.pin}` : \"\";\n return d.publisher ? `${d.kind}:@${d.publisher}/${d.name}${pin}` : `${d.kind}:${d.name}${pin}`;\n}\n\n// ── CatalogEntry ──────────────────────────────────────────────────────────────\n\n/**\n * A resolved catalog entry describing an installable asset.\n * Produced by manifest parsers and stored in the catalog YAML.\n * @docLink packages/core/concepts#catalog-entry\n */\nexport interface CatalogEntry {\n /** Unique asset name within its kind. */\n name: string;\n /** Asset kind discriminator. */\n kind: AssetKind;\n /** Short description of what this asset does. */\n description: string;\n /** Absolute path to manifest file */\n source: string;\n /** Canonical publisher namespace this asset belongs to (formerly `repository`). */\n publisher?: string;\n /**\n * Canonical ref (`kind:@publisher/name#version`) the CLI prints for this entry.\n * Set by the asset manager where `publisher` is not the real publisher (a\n * clone-sourced entry carries its clone key there); absent → derived from\n * `publisher` + `version`.\n */\n canonicalRef?: string;\n /**\n * `\"<org>/<repo>\"` coordinate the asset came from. Absent → the asset groups\n * directly under its publisher (local library with no git remote, or a\n * non-GitHub source).\n */\n repo?: string;\n /**\n * Claude plugin (from `.claude-plugin/marketplace.json` / `plugin.json`\n * membership) this asset belongs to, or absent when no plugin lists it.\n * Display-only — groups assets in the manage TUI; never part of identity or\n * the install layout.\n */\n plugin?: string;\n /** Semantic version string (may be empty if not declared in the manifest). */\n version: string;\n /** Skills, agents, or other assets this entry depends on. */\n requires: Dependency[];\n /** Asset refs this entry pulls in (presets: the asset items; flows: `requires`). */\n dependencies: string[];\n /** Presets only: instance items (`library://`, placeholder, connector/mcp) a dependency expansion skips; absent when none. */\n skippedItems?: number;\n /**\n * Kind-specific metadata extracted from the manifest frontmatter.\n * Used by MCP servers to carry default config (transport, command, args, env, url, headers)\n * so that `mcp:name` dependency refs resolve to a runnable declaration without\n * requiring verbose inline config in `skaile.yaml`.\n */\n metadata?: Record<string, unknown>;\n /** Curated facet, surfaced as a badge in the manage TUI (not a tree axis). */\n category?: string;\n /** Store-listing keywords (manifest `assets[].keywords`, else frontmatter). */\n keywords?: string[];\n /** Store-listing license (manifest `assets[].license`, else repo-level default). */\n license?: string;\n /** Store-listing homepage (manifest `assets[].homepage`, else repo-level default). */\n homepage?: string;\n}\n\n/**\n * Construct a CatalogEntry from a raw deserialized record (e.g. from catalog.yaml).\n *\n * @param d - Raw object with loosely typed fields\n * @returns Normalized CatalogEntry\n * @docLink packages/core/concepts#entry-from-raw\n */\nexport function entryFromRaw(d: Record<string, unknown>): CatalogEntry {\n const rawDeps = d.dependencies;\n const deps = Array.isArray(rawDeps) ? (rawDeps as string[]).filter(Boolean) : [];\n const entry: CatalogEntry = {\n name: String(d.name ?? \"\"),\n kind: String(d.kind ?? \"skill\") as AssetKind,\n description: String(d.description ?? \"\"),\n source: String(d.source ?? \"\"),\n publisher: d.publisher != null ? String(d.publisher) : undefined,\n repo: d.repo != null ? String(d.repo) : undefined,\n plugin: d.plugin != null ? String(d.plugin) : undefined,\n version: String(d.version ?? \"\"),\n requires: Array.isArray(d.requires)\n ? (d.requires as string[]).filter(Boolean).map(parseDep)\n : [],\n dependencies: deps,\n };\n if (d.metadata != null && typeof d.metadata === \"object\" && !Array.isArray(d.metadata)) {\n entry.metadata = d.metadata as Record<string, unknown>;\n }\n if (d.category != null) entry.category = String(d.category);\n if (Array.isArray(d.keywords)) {\n entry.keywords = (d.keywords as unknown[]).filter((k): k is string => typeof k === \"string\");\n }\n if (d.license != null) entry.license = String(d.license);\n if (d.homepage != null) entry.homepage = String(d.homepage);\n return entry;\n}\n\n/**\n * Serialize a CatalogEntry to a plain record suitable for YAML/JSON persistence.\n *\n * @param e - CatalogEntry to serialize\n * @returns Plain object with string-serialized requires and dependencies\n * @docLink packages/core/concepts#entry-to-raw\n */\nexport function entryToRaw(e: CatalogEntry): Record<string, unknown> {\n const raw: Record<string, unknown> = {\n name: e.name,\n kind: e.kind,\n description: e.description,\n source: e.source,\n publisher: e.publisher,\n repo: e.repo,\n version: e.version,\n ...(e.plugin != null ? { plugin: e.plugin } : {}),\n requires: e.requires.map(depToStr),\n dependencies: e.dependencies,\n };\n if (e.metadata) raw.metadata = e.metadata;\n if (e.category != null) raw.category = e.category;\n if (e.keywords && e.keywords.length > 0) raw.keywords = e.keywords;\n if (e.license != null) raw.license = e.license;\n if (e.homepage != null) raw.homepage = e.homepage;\n return raw;\n}\n\n// ── AssetRef ─────────────────────────────────────────────────────────────────\n\n/**\n * A parsed asset reference: `kind:@<publisher>/name[#pin]`.\n *\n * `publisher` is the canonical, GitHub-shaped publisher namespace (≤39 chars,\n * alphanumeric+hyphen). `pin` is a SemVer constraint, exact SHA, or absent.\n * Floating refs (`main`, `latest`, `HEAD`) are rejected at parse time.\n *\n * Produced by `parseAssetRef`; consumed by `resolveAsset` and `resolveAll`.\n * @docLink packages/core/concepts#asset-ref\n */\nexport interface AssetRef {\n kind: string;\n name: string;\n /** Canonical publisher namespace. Optional only for ambiguity-resolution\n * during migration; new manifests require it. */\n publisher?: string;\n /** SemVer constraint (^1.4.0, ~1.4, 1.x, exact 1.4.0), 40-char SHA, or undefined. */\n pin?: string;\n}\n\nconst SHA_RE = /^[0-9a-f]{40}$/i;\n\n// Scoped grammar: `kind:@publisher/name[#version]`. The publisher sub-pattern is\n// GitHub-shaped (1-39 chars, alphanumeric + single hyphens, no leading/trailing or\n// double hyphen); `@` is the scope sigil and `#` the version sigil. `name` is\n// intentionally permissive (`[^/#\\s]+` — only the structural separators are\n// forbidden); floating-ref rejection stays in `isValidPin`, so `#main`/`#latest`\n// match here and fail there with a clear message.\nconst SCOPED_REF_RE =\n /^(?:([a-z][a-z0-9-]*):)?@([A-Za-z0-9](?:[A-Za-z0-9]|-(?!-)){0,37}[A-Za-z0-9]|[A-Za-z0-9])\\/([^/#\\s]+)(?:#(.+))?$/;\n\n// Canonical asset-name grammar: lowercase kebab-case (npm-style, scope-free) —\n// `a-z` / `0-9` segments joined by single hyphens, no leading/trailing hyphen,\n// no uppercase, spaces, dots, or underscores. Names become directory names,\n// lock keys, and CLI args, so the constraint is intentionally narrow.\nconst ASSET_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n// Diagnostic-only matcher: a ref carrying a `kind:@publisher/` scope prefix,\n// capturing whatever follows (sans `#pin`) as the candidate name. Used solely\n// to tell \"missing publisher\" apart from \"malformed name\" when the strict\n// grammar above fails (e.g. a space in the name).\nconst SCOPE_PREFIX_RE = /^(?:[a-z][a-z0-9-]*:)?@[^/\\s]+\\/([^#]+?)(?:#.*)?$/;\n\n/** Human-readable statement of the canonical asset-name rule. */\nexport const ASSET_NAME_HINT =\n 'names must be lowercase kebab-case (a-z, 0-9, single hyphens; e.g. \"cli-concept\")';\n\n/**\n * True when `name` is a canonical asset name: lowercase kebab-case, scope-free.\n *\n * This is the single source of truth for asset-name validity — `parseAssetRef`\n * enforces it, and `skaile validate` reports violations across a repo tree.\n * @docLink packages/core/concepts#is-valid-asset-name\n */\nexport function isValidAssetName(name: string): boolean {\n return ASSET_NAME_RE.test(name);\n}\n\n// The one publisher slug: 1-39 chars, lowercase letters and digits, single `-`\n// inside, no leading/trailing hyphen. The lowercase form of the publisher grammar of\n// `SCOPED_REF_RE`, so every publisher accepted here also parses in a\n// `kind:@<publisher>/name` ref.\nconst PUBLISHER_RE = /^[a-z0-9](?:[a-z0-9]|-(?!-)){0,37}[a-z0-9]$|^[a-z0-9]$/;\n\n/** Human-readable statement of the publisher rule, shared by every command that checks one. */\nexport const PUBLISHER_HINT =\n 'publishers must be a bare name of 1-39 characters: lowercase letters, digits and single hyphens inside (like \"acme\" or \"my-lib\"), with no @, /, #, dots, underscores or spaces and no leading or trailing hyphen';\n\n/**\n * True when `publisher` is a valid bare publisher slug (see {@link PUBLISHER_HINT}).\n * The one rule behind `library create --publisher`, `library set <lib> publisher=`,\n * `asset import --publisher`, `library index`, `validate` and the publish plan; the\n * caller strips a leading `@` first.\n */\nexport function isValidPublisher(publisher: string): boolean {\n return PUBLISHER_RE.test(publisher);\n}\n\n/**\n * Coerce an arbitrary string into a canonical asset name (lowercase kebab-case).\n *\n * For **third-party sources we don't control**, an upstream asset may carry a\n * human-styled identity (`\"Complex App\"`, `\"CLI_Concept\"`). The canonical grammar\n * (`isValidAssetName`) rejects those, so the ingestion boundary slugifies them to\n * a valid identity rather than crashing: Unicode is folded to ASCII, the result is\n * lowercased, every run of non-`[a-z0-9]` becomes a single hyphen, and\n * leading/trailing hyphens are trimmed. The transform is idempotent and a no-op on\n * already-canonical names.\n *\n * This is intentionally **lossy** — the pretty original is not part of identity.\n * Callers that want to preserve it for display must stash it themselves (e.g. on\n * `CatalogEntry.metadata.displayName`). Authoring-time validation (`skaile validate`)\n * still uses `isValidAssetName` on raw frontmatter, so first-party typos surface there.\n *\n * @throws When `raw` contains no `[a-z0-9]` character (nothing to slugify).\n * @docLink packages/core/concepts#slugify-asset-name\n */\nexport function slugifyAssetName(raw: string): string {\n const slug = raw\n .normalize(\"NFKD\")\n .replace(/[\\u0300-\\u036f]/g, \"\") // strip combining accents\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n if (!slug) {\n throw new Error(`cannot derive a canonical asset name from \"${raw}\" — ${ASSET_NAME_HINT}.`);\n }\n return slug;\n}\n\n/** True when `pin` is a SemVer constraint, exact SemVer, or 40-char SHA. */\nfunction isValidPin(pin: string): boolean {\n if (SHA_RE.test(pin)) return true;\n if (semver.valid(pin)) return true;\n if (semver.validRange(pin)) return true;\n return false;\n}\n\n/** Throw the canonical non-canonical-pin error for a ref `s` carrying `pin`. */\nfunction rejectFloatingPin(s: string, pin: string): never {\n throw new Error(\n `non-canonical pin \"${pin}\" in \"${s}\" — pin must be a SemVer ` +\n \"constraint (1.4.0, ^1.4, ~1.4, 1.x), a 40-char SHA, or absent. \" +\n \"Floating refs (main/latest/HEAD) are not allowed.\",\n );\n}\n\n/** Throw the canonical malformed-name error for a ref `s` carrying `name`. */\nfunction rejectInvalidName(s: string, name: string): never {\n throw new Error(\n `invalid asset name \"${name}\" in ref \"${s}\" — ${ASSET_NAME_HINT}. ` +\n \"Run the `migrate-skaile-manifest` skill on legacy manifests.\",\n );\n}\n\n/**\n * Parse a canonical asset reference string into an `AssetRef` object.\n *\n * Grammar: `kind:@<publisher>/name[#version]`\n * \"skill:@skaile-ai/audit\" → { kind: \"skill\", name: \"audit\", publisher: \"skaile-ai\" }\n * \"skill:@skaile-ai/audit#^1.4.0\" → { …, pin: \"^1.4.0\" }\n * \"skill:@skaile-ai/audit#<40-sha>\" → { …, pin: \"<40-sha>\" }\n *\n * `@` is the scope sigil and `#` the version sigil. `<publisher>` is GitHub-shaped\n * (≤39 chars, alphanumeric+hyphen, no leading/trailing or double hyphen). `pin`\n * accepts a SemVer constraint (`^`, `~`, `x`, exact), a 40-char SHA, or is absent.\n * Floating refs (`main`/`latest`/`HEAD`/anything non-canonical) are parse-time errors.\n *\n * The shorthand `mcp:` is normalized to `mcp-server:`. `kind` defaults to `\"skill\"`.\n *\n * @param s - Asset reference string\n * @returns Parsed `AssetRef`\n * @throws When the ref matches no grammar, the publisher is malformed, or the pin\n * is a floating ref.\n * @docLink packages/core/concepts#parse-asset-ref\n */\nexport function parseAssetRef(s: string): AssetRef {\n const trimmed = s.trim();\n const m = SCOPED_REF_RE.exec(trimmed);\n if (m) {\n const kindRaw = m[1] ?? \"skill\";\n const kind = kindRaw === \"mcp\" ? \"mcp-server\" : kindRaw;\n const publisher = m[2];\n const name = m[3];\n const pin = m[4]?.trim() || undefined;\n if (!isValidAssetName(name)) rejectInvalidName(s, name);\n if (pin !== undefined && !isValidPin(pin)) rejectFloatingPin(s, pin);\n return { kind, name, publisher, pin };\n }\n\n // The strict grammar failed. If the ref nonetheless carries a `@publisher/`\n // scope and the fault is the name (e.g. an embedded space), surface a\n // name-specific error rather than the misleading \"publisher required\" — the\n // publisher is plainly present. A *valid* captured name means the publisher\n // itself is malformed, so fall through to the publisher error below.\n const scoped = SCOPE_PREFIX_RE.exec(trimmed);\n if (scoped) {\n const candidate = scoped[1].trim();\n if (!isValidAssetName(candidate)) rejectInvalidName(s, candidate);\n }\n\n throw new Error(\n `publisher required in asset ref \"${s}\" — use \\`kind:@<publisher>/name\\`. ` +\n \"Run the `migrate-skaile-manifest` skill on legacy manifests.\",\n );\n}\n\n/**\n * Parse a ref for identity matching, tolerating a non-canonical pin. A lock key\n * can pin a content-sha pseudo-version (`#0.0.0-sha.<hash>`) that\n * {@link parseAssetRef} rejects; matchers only need the version-agnostic\n * `kind/publisher/name`, so drop the pin and retry before giving up.\n *\n * @returns The parsed ref (its `pin` empty when the pin was dropped), or `null`.\n */\nexport function parseAssetRefLoose(ref: string): AssetRef | null {\n try {\n return parseAssetRef(ref);\n } catch {\n const hash = ref.indexOf(\"#\");\n if (hash < 0) return null;\n try {\n return parseAssetRef(ref.slice(0, hash));\n } catch {\n return null;\n }\n }\n}\n\n/**\n * Serialize an AssetRef back to its canonical string form.\n *\n * Emits the scope form `kind:@publisher/name[#pin]` when `publisher` is present,\n * and the bare `kind:name[#pin]` form for transitive refs that inherit it.\n *\n * @param ref - AssetRef to serialize\n * @returns String in `\"kind:@publisher/name[#pin]\"` (or bare `\"kind:name[#pin]\"`) format\n * @docLink packages/core/concepts#asset-ref-to-str\n */\nexport function assetRefToStr(ref: AssetRef): string {\n const scope = ref.publisher ? `@${ref.publisher}/${ref.name}` : ref.name;\n return `${ref.kind}:${scope}${ref.pin ? `#${ref.pin}` : \"\"}`;\n}\n\n/**\n * Convert an AssetRef to a simple Dependency, dropping the repository and pin qualifiers.\n *\n * @param ref - Full asset reference (may include repository and pin)\n * @returns Dependency with only kind and name\n * @docLink packages/core/concepts#asset-ref-to-dep\n */\nexport function assetRefToDep(ref: AssetRef): Dependency {\n // Grammar-agnostic — drops publisher/pin, so the scope-sigil change doesn't touch it.\n return { kind: ref.kind, name: ref.name };\n}\n\n// ── Lock File ────────────────────────────────────────────────────────────────\n\n/** A path/sha256 pair recorded for one file inside a locked asset. */\nexport interface LockFileEntry {\n path: string;\n sha256: string;\n}\n\n/**\n * Library-origin marker on a {@link LockEntry}: the asset was resolved from a\n * registered library (a local authoring place) rather than a git source/store.\n */\nexport interface LockLibraryOrigin {\n /** Name of the library the asset was resolved from. */\n name: string;\n /** Library version of the asset at lock time. */\n version: string;\n /** Content hash recorded in the library index at lock time; absent when the library was never indexed. */\n sha256?: string;\n /**\n * Remote URL of the library at lock time, recorded for a git-backed library only. The name is\n * machine-local; when it is not registered on another machine, `install --locked` and `check`\n * match a registered library by this URL instead. Optional: locks without it resolve by name\n * as before.\n */\n url?: string;\n /**\n * Set by `skaile asset install`: the files were copied or linked straight into\n * the project, not deployed from a `skaile.yaml` dependency. `skaile install`\n * leaves such an entry and its files alone instead of reconciling them away.\n */\n installed?: \"copy\" | \"link\";\n}\n\n/**\n * Per-asset entry in the lock file (v3 schema).\n * Keyed in `LockFile.assets` by canonical ref (`<kind>:@<publisher>/<name>#<version>`).\n * Source-origin entries carry `source` + `files`; library-origin entries carry\n * `library` instead (no `source`, empty `files`). Both fields are additive, so\n * lock files written before library origin existed still load unchanged.\n * @docLink packages/core/api-reference#lock-entry\n */\nexport interface LockEntry {\n /** Composite sha256 over sorted `<path>:<sha256>\\n` rows (library-origin: the library's hash, `\"\"` when unknown). */\n sha256: string;\n /** Resolved upstream source + commit. Absent for library-origin entries. */\n source?: { url: string; commit: string };\n /** Files that constitute the asset. Empty for library-origin entries. */\n files: LockFileEntry[];\n /** True when an `overrides[]` entry pinned this resolution. */\n override_applied: boolean;\n /** Set when the asset was resolved from a registered library. */\n library?: LockLibraryOrigin;\n}\n\n/** Per-source-URL entry in `LockFile.sources`. */\nexport interface LockSourceEntry {\n url: string;\n commit: string;\n}\n\n/**\n * Full skaile.lock.yaml structure (v3 schema).\n * @docLink packages/core/api-reference#lock-file\n */\nexport interface LockFile {\n /**\n * Lock file schema version: 3, or 4 when the lock holds a library-origin\n * entry (no `source`), so CLIs that predate library origin reject it cleanly.\n */\n schema_version: 3 | 4;\n /** ISO timestamp of when the lock was generated. */\n locked_at: string;\n /** Resolved assets keyed by canonical ref `<kind>:@<publisher>/<name>#<version>`. */\n assets: Record<string, LockEntry>;\n /** Every source URL that contributed at least one resolved asset. */\n sources: LockSourceEntry[];\n /**\n * Resolved plugin packages (from `skaile.yaml` `plugins:`), keyed by package\n * name. The plugin-store reconciler reads this slice into its reconcile-hash\n * so a lock change reinstalls even when the manifest list is unchanged.\n */\n plugins?: Record<string, LockPluginEntry>;\n /**\n * Canonical refs of the `preset:` dependencies that `install` / `add` expanded into the\n * assets above (`preset:@publisher/name#version`, nested presets included). A preset is\n * never locked as an asset, so this is the only offline trace that a declared preset\n * resolved: `check` reports a declared preset that is neither listed here nor held by a\n * local library or source. Absent when no preset was expanded.\n */\n presets?: string[];\n}\n\n/** One pinned plugin package in the lock file's `plugins` slice. */\nexport interface LockPluginEntry {\n /** Resolved exact version (e.g. \"0.1.3\"). */\n version: string;\n /** Package integrity hash (e.g. \"sha512-...\"); may be empty until populated from bun's output. */\n integrity: string;\n}\n\n// ── Repository ───────────────────────────────────────────────────────────────\n\ntype RepositoryKind = \"local\" | \"github\";\n\n/**\n * A registered asset repository (local path or cloned GitHub repo).\n * Stored in the catalog; consumed by `repo-manager` for cloning and scanning.\n * @docLink packages/core/concepts#repository\n */\nexport interface Repository {\n /** Logical repository name. */\n name: string;\n /** Storage kind: \"local\" for paths, \"github\" for remote URLs. */\n kind: RepositoryKind;\n /** Absolute path (local) or remote URL (github). */\n path: string;\n /** Active branch. */\n branch: string;\n /** Upstream fork URL (for fork-based workflows). */\n upstream?: string;\n}\n\n/**\n * Construct a `Repository` from a raw deserialized record.\n *\n * @param d - Raw object from YAML/JSON\n * @returns Normalized `Repository`\n * @docLink packages/core/concepts#repository-from-raw\n */\nexport function repositoryFromRaw(d: Record<string, unknown>): Repository {\n return {\n name: String(d.name ?? \"\"),\n kind: String(d.kind ?? \"local\") as RepositoryKind,\n path: String(d.path ?? \"\"),\n branch: String(d.branch ?? \"main\"),\n upstream: d.upstream != null ? String(d.upstream) : undefined,\n };\n}\n\n/**\n * Serialize a `Repository` to a plain record for YAML/JSON persistence.\n * Omits the `branch` field when it equals `\"main\"` to keep serialized output clean.\n *\n * @param r - Repository to serialize\n * @returns Plain object suitable for YAML/JSON\n * @docLink packages/core/concepts#repository-to-raw\n */\nexport function repositoryToRaw(r: Repository): Record<string, unknown> {\n const d: Record<string, unknown> = {\n name: r.name,\n kind: r.kind,\n path: r.path,\n };\n if (r.branch !== \"main\") d.branch = r.branch;\n if (r.upstream != null) d.upstream = r.upstream;\n return d;\n}\n"]}
|