@skaile/workspaces 5.9.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 +96 -0
- package/dist/{asset-feeds-XMKKUUK6.js → asset-feeds-ELEBTNUS.js} +18 -18
- package/dist/{asset-feeds-XMKKUUK6.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 +11 -11
- package/dist/bridge/drivers/codex.js +11 -11
- package/dist/bridge/drivers/continue.js +10 -10
- package/dist/bridge/drivers/echo.js +2 -2
- package/dist/bridge/drivers/gemini.js +7 -7
- package/dist/bridge/drivers/goose.js +10 -10
- package/dist/bridge/drivers/omp.js +3 -3
- package/dist/bridge/drivers/opencode.js +10 -10
- package/dist/bridge/drivers/qwen.js +7 -7
- package/dist/bridge/index.js +12 -12
- package/dist/{chunk-36AFURKZ.js → chunk-2FMEGSBN.js} +38 -11
- package/dist/chunk-2FMEGSBN.js.map +1 -0
- package/dist/{chunk-IMKSM5NL.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-FYXZRVID.js → chunk-3KHYGOEY.js} +3 -3
- package/dist/{chunk-FYXZRVID.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-GKMZ6THE.js → chunk-4P3KTUZH.js} +33 -33
- package/dist/chunk-4P3KTUZH.js.map +1 -0
- package/dist/{chunk-ZTBAYUDY.js → chunk-5QI2JYJC.js} +2 -2
- package/dist/{chunk-ZTBAYUDY.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-TTRYE6AC.js → chunk-7CR6HT2X.js} +8 -8
- package/dist/{chunk-TTRYE6AC.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-P67WJVP4.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-IR33D6EP.js → chunk-FRPBSUFH.js} +5 -5
- package/dist/{chunk-IR33D6EP.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-5NNNV76P.js → chunk-HJ5MCB3L.js} +2 -2
- package/dist/{chunk-5NNNV76P.js.map → chunk-HJ5MCB3L.js.map} +1 -1
- 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-UM7RIAHO.js → chunk-IJHH4DSW.js} +8 -8
- package/dist/{chunk-UM7RIAHO.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-K3CVFRVS.js → chunk-JFXQEVLF.js} +3 -3
- package/dist/{chunk-K3CVFRVS.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-LAMCXQGA.js → chunk-NRDSGLCQ.js} +31 -24
- 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-MR5HBOUF.js → chunk-OBVJ7RPW.js} +3 -3
- package/dist/{chunk-MR5HBOUF.js.map → chunk-OBVJ7RPW.js.map} +1 -1
- package/dist/{chunk-J7U3PIOE.js → chunk-OOWHXOK6.js} +4 -4
- package/dist/{chunk-J7U3PIOE.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-QVEKLSEH.js → chunk-TH4CTXHX.js} +6 -6
- package/dist/{chunk-QVEKLSEH.js.map → chunk-TH4CTXHX.js.map} +1 -1
- package/dist/{chunk-JZ5EHBPI.js → chunk-TRSQP3JD.js} +3 -3
- package/dist/{chunk-JZ5EHBPI.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-GXLQLPE5.js → chunk-V7PQZOBR.js} +5 -5
- package/dist/{chunk-GXLQLPE5.js.map → chunk-V7PQZOBR.js.map} +1 -1
- package/dist/{chunk-DNZYOKOJ.js → chunk-VLXDXRRX.js} +3 -3
- package/dist/{chunk-DNZYOKOJ.js.map → chunk-VLXDXRRX.js.map} +1 -1
- 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-SCOT677Q.js → chunk-XCNK4UE5.js} +5 -5
- package/dist/{chunk-SCOT677Q.js.map → chunk-XCNK4UE5.js.map} +1 -1
- 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-7AI3Q5AQ.js → chunk-Z2K6BGUR.js} +71 -24
- package/dist/chunk-Z2K6BGUR.js.map +1 -0
- package/dist/{chunk-UO7WPLDY.js → chunk-ZGQTS3Y4.js} +3 -3
- package/dist/{chunk-UO7WPLDY.js.map → chunk-ZGQTS3Y4.js.map} +1 -1
- package/dist/cli/index.js +910 -717
- 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/connectors/config.js +5 -5
- package/dist/connectors/index.js +15 -15
- package/dist/{connectors-C7UQ73BK.js → connectors-OXP2JBGI.js} +18 -18
- package/dist/{connectors-C7UQ73BK.js.map → connectors-OXP2JBGI.js.map} +1 -1
- 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-SRC2DVR5.js → ensure-sources-5ISVIA4T.js} +17 -17
- package/dist/{ensure-sources-SRC2DVR5.js.map → ensure-sources-5ISVIA4T.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +15 -15
- package/dist/factory-assets/connectors/deploy.js +15 -15
- package/dist/factory-assets/connectors/devserver.js +15 -15
- package/dist/factory-assets/connectors/flow/adapter.js +15 -15
- package/dist/factory-assets/connectors/flow/engine.js +8 -8
- package/dist/factory-assets/connectors/flow/run-flow.js +17 -17
- package/dist/factory-assets/connectors/flow.js +15 -15
- package/dist/factory-assets/connectors/git.js +15 -15
- package/dist/factory-assets/connectors/gmail.js +15 -15
- package/dist/factory-assets/connectors/googledrive.js +15 -15
- package/dist/factory-assets/connectors/local.js +15 -15
- package/dist/factory-assets/connectors/mattermost.js +15 -15
- package/dist/factory-assets/connectors/memory.js +15 -15
- package/dist/factory-assets/connectors/minio.js +15 -15
- package/dist/factory-assets/connectors/postgres.js +15 -15
- package/dist/factory-assets/connectors/s3.js +15 -15
- package/dist/factory-assets/connectors/sharepoint.js +15 -15
- package/dist/factory-assets/connectors/sqlite.js +15 -15
- package/dist/factory-assets/connectors/static-server.js +15 -15
- package/dist/factory-assets/connectors/tunnel.js +15 -15
- package/dist/factory-assets/connectors/webdav.js +15 -15
- package/dist/factory-assets/connectors/xstate-store.js +15 -15
- package/dist/factory-assets/connectors/xstate.js +15 -15
- 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-XAEKCZKT.js → helpers-X6URBGSF.js} +17 -17
- package/dist/{helpers-XAEKCZKT.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-VJSWMOLH.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-DB2PNL2X.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-I6NX3NFB.js → project-PAXP46RD.js} +20 -20
- package/dist/{project-I6NX3NFB.js.map → project-PAXP46RD.js.map} +1 -1
- package/dist/resolver/index.js +8 -8
- package/dist/runner/index.js +29 -29
- package/dist/runner/src/agent.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +14 -14
- package/dist/sdk/bridge.js +12 -12
- package/dist/sdk/core.js +7 -7
- package/dist/sdk/flow.js +8 -8
- package/dist/sdk/index.js +29 -29
- package/dist/sdk/resolver.js +8 -8
- package/dist/sdk/runner.js +29 -29
- package/dist/{setup-B7JUHYJW.js → setup-BV55VHWC.js} +22 -22
- package/dist/{setup-B7JUHYJW.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-PJBMDCKX.js.map → source-E4VAT5RZ.js.map} +1 -1
- package/dist/{source-manifest-publish-LLJWXGID.js → source-manifest-publish-CLEE6TNH.js} +23 -23
- package/dist/{source-manifest-publish-LLJWXGID.js.map → source-manifest-publish-CLEE6TNH.js.map} +1 -1
- package/dist/tui/index.js +29 -29
- package/dist/types/manifests.js +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/workspace-plugin/adapters/mcp.js +22 -22
- 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-7AI3Q5AQ.js.map +0 -1
- package/dist/chunk-B6GIW55K.js.map +0 -1
- package/dist/chunk-BTE2V4IW.js.map +0 -1
- package/dist/chunk-EF7NPDDU.js.map +0 -1
- package/dist/chunk-GKMZ6THE.js.map +0 -1
- package/dist/chunk-GTILM2CI.js.map +0 -1
- package/dist/chunk-IMKSM5NL.js.map +0 -1
- package/dist/chunk-JAKOMFC6.js.map +0 -1
- package/dist/chunk-LAMCXQGA.js.map +0 -1
- package/dist/chunk-P67WJVP4.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-VJSWMOLH.js.map +0 -1
- package/dist/open-library-DB2PNL2X.js +0 -40
- package/dist/open-registry-ZUZJ7MS7.js +0 -32
- package/dist/paths-FQ64OLJG.js +0 -22
- package/dist/source-PJBMDCKX.js +0 -41
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { createSpinner } from './chunk-NESV47MF.js';
|
|
2
|
-
import { logInfo, logWarn, TARGET_DEFAULT_HINT, logErr, logOk, colorRef, S,
|
|
3
|
-
import { getKindRegistry } from './chunk-
|
|
4
|
-
import { AssetManager } from './chunk-
|
|
5
|
-
import { readLock } from './chunk-
|
|
2
|
+
import { logInfo, logWarn, TARGET_DEFAULT_HINT, logErr, logOk, colorRef, S, warnLegacyClaudeCopies, formatSoftDepHint } from './chunk-TRSQP3JD.js';
|
|
3
|
+
import { getKindRegistry } from './chunk-SBFW3CJH.js';
|
|
4
|
+
import { AssetManager } from './chunk-2JMLDZLP.js';
|
|
5
|
+
import { readLock } from './chunk-2FMEGSBN.js';
|
|
6
|
+
import { SourceEntryError } from './chunk-JZCSNEHK.js';
|
|
6
7
|
import { userConfigPath } from './chunk-L5VSIPQD.js';
|
|
7
8
|
import { SUPPORTED_DRIVER_TARGETS } from './chunk-CPSIPIX7.js';
|
|
8
|
-
import { parseAssetRef } from './chunk-
|
|
9
|
+
import { parseAssetRef } from './chunk-4OV5DSBB.js';
|
|
9
10
|
import path from 'path';
|
|
10
11
|
import * as p from '@clack/prompts';
|
|
11
12
|
import { Command } from 'commander';
|
|
@@ -61,6 +62,9 @@ function reportAgentInstances(instances, removedFiles, onLine = logInfo, onRemov
|
|
|
61
62
|
function reportRelocked(relocked, onLine = logInfo) {
|
|
62
63
|
for (const ref of relocked ?? []) onLine(`Re-locked ${ref}`);
|
|
63
64
|
}
|
|
65
|
+
function reportReplaced(replaced, onLine = logInfo) {
|
|
66
|
+
for (const r of replaced ?? []) onLine(`${r.ref} replaced ${r.from} \u2192 ${r.to}`);
|
|
67
|
+
}
|
|
64
68
|
function makeInstallCommand() {
|
|
65
69
|
return new Command("install").description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`).argument("[ref]", `Asset ref to install from the Catalog (${REF_HINT})`).option("--locked", "Install from lock file (CI mode \u2014 fails on drift)").option("--project-dir <path>", "Project directory", process.cwd()).option("--target <agent>", `Agent framework (${TARGET_DEFAULT_HINT})`).option(
|
|
66
70
|
"--global",
|
|
@@ -101,7 +105,7 @@ async function runRefInstall(ref, opts) {
|
|
|
101
105
|
const spinner = createSpinner();
|
|
102
106
|
spinner.start(`Installing ${ref}`);
|
|
103
107
|
try {
|
|
104
|
-
const { openCatalogSource, openLibrary } = await import('./open-library-
|
|
108
|
+
const { openCatalogSource, openLibrary } = await import('./open-library-4QSUORI6.js');
|
|
105
109
|
const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });
|
|
106
110
|
if (!supportsInstallManifest(catalog)) {
|
|
107
111
|
throw new Error(
|
|
@@ -143,7 +147,7 @@ async function runYamlInstall(opts) {
|
|
|
143
147
|
return;
|
|
144
148
|
}
|
|
145
149
|
try {
|
|
146
|
-
const { ensureSourcesCloned } = await import('./ensure-sources-
|
|
150
|
+
const { ensureSourcesCloned } = await import('./ensure-sources-5ISVIA4T.js');
|
|
147
151
|
const hydrate = ensureSourcesCloned(projectDir, { quiet: true });
|
|
148
152
|
if (hydrate.cloned.length > 0) {
|
|
149
153
|
logOk(`Cloned source(s): ${hydrate.cloned.join(", ")}`);
|
|
@@ -154,19 +158,18 @@ async function runYamlInstall(opts) {
|
|
|
154
158
|
} catch (err) {
|
|
155
159
|
logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
156
160
|
}
|
|
157
|
-
const warnings = deferredWarnings();
|
|
158
161
|
const am = new AssetManager({
|
|
159
162
|
registry: getKindRegistry(),
|
|
160
163
|
projectDir,
|
|
161
|
-
driverTarget: opts.target
|
|
162
|
-
onLibraryCollision: warnings.push
|
|
164
|
+
driverTarget: opts.target
|
|
163
165
|
});
|
|
164
166
|
const spinner = createSpinner();
|
|
165
167
|
spinner.start(opts.locked ? "Installing from lock file" : "Installing dependencies");
|
|
166
168
|
try {
|
|
167
169
|
const result = await am.install({ locked: opts.locked, link: opts.link });
|
|
168
|
-
spinner.stop(
|
|
169
|
-
|
|
170
|
+
spinner.stop(
|
|
171
|
+
result.agentInstanceErrors?.length || result.missing.length > 0 ? "Failed" : "Done"
|
|
172
|
+
);
|
|
170
173
|
if (result.deployed.length > 0) {
|
|
171
174
|
for (const d of result.deployed) logOk(d);
|
|
172
175
|
}
|
|
@@ -175,10 +178,17 @@ async function runYamlInstall(opts) {
|
|
|
175
178
|
if (result.removed.length > 0) {
|
|
176
179
|
for (const r of result.removed) logWarn(`Removed: ${r}`);
|
|
177
180
|
}
|
|
181
|
+
reportReplaced(result.replaced);
|
|
178
182
|
reportRelocked(result.relocked);
|
|
179
|
-
if (result.deployed.length === 0 && result.removed.length === 0 && result.missing.length === 0 && !result.relocked?.length) {
|
|
183
|
+
if (result.deployed.length === 0 && result.removed.length === 0 && !result.replaced?.length && result.missing.length === 0 && !result.relocked?.length && !result.agentInstanceErrors?.length) {
|
|
180
184
|
logInfo("Nothing to install (already up to date).");
|
|
181
185
|
}
|
|
186
|
+
if (result.agentInstanceErrors?.length) {
|
|
187
|
+
logErr(
|
|
188
|
+
`${result.agentInstanceErrors.length} agent instance(s) could not be rendered (see above)`
|
|
189
|
+
);
|
|
190
|
+
process.exitCode = 1;
|
|
191
|
+
}
|
|
182
192
|
if (result.missing.length > 0) {
|
|
183
193
|
for (const m of result.missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? ""}`);
|
|
184
194
|
process.exitCode = 1;
|
|
@@ -190,8 +200,7 @@ async function runYamlInstall(opts) {
|
|
|
190
200
|
if (!opts.locked) await reportInstalledSoftDeps(am);
|
|
191
201
|
} catch (err) {
|
|
192
202
|
spinner.stop("Failed");
|
|
193
|
-
|
|
194
|
-
logErr(String(err));
|
|
203
|
+
logErr(err instanceof SourceEntryError ? err.message : String(err));
|
|
195
204
|
process.exit(1);
|
|
196
205
|
}
|
|
197
206
|
}
|
|
@@ -205,25 +214,23 @@ async function reportInstalledSoftDeps(am, onHint = (l) => logInfo(S.dim(l))) {
|
|
|
205
214
|
}
|
|
206
215
|
}
|
|
207
216
|
async function runGlobalInstall(opts, harnesses) {
|
|
208
|
-
const warnings = deferredWarnings();
|
|
209
217
|
const am = new AssetManager({
|
|
210
218
|
registry: getKindRegistry(),
|
|
211
219
|
projectDir: path.resolve(opts.projectDir),
|
|
212
220
|
global: true,
|
|
213
|
-
harnesses
|
|
214
|
-
onLibraryCollision: warnings.push
|
|
221
|
+
harnesses
|
|
215
222
|
});
|
|
216
223
|
const spinner = createSpinner();
|
|
217
224
|
spinner.start("Installing global dependencies");
|
|
218
225
|
try {
|
|
219
226
|
const result = await am.install({ locked: opts.locked, link: opts.link });
|
|
220
|
-
spinner.stop("Done");
|
|
221
|
-
warnings.flush();
|
|
227
|
+
spinner.stop(result.missing.length > 0 ? "Failed" : "Done");
|
|
222
228
|
if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);
|
|
223
229
|
reportPresetExpansions(result.presets);
|
|
224
230
|
if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);
|
|
231
|
+
reportReplaced(result.replaced);
|
|
225
232
|
reportRelocked(result.relocked);
|
|
226
|
-
if (result.deployed.length === 0 && result.removed.length === 0 && result.missing.length === 0 && !result.relocked?.length)
|
|
233
|
+
if (result.deployed.length === 0 && result.removed.length === 0 && !result.replaced?.length && result.missing.length === 0 && !result.relocked?.length)
|
|
227
234
|
logInfo("Nothing to install (already up to date).");
|
|
228
235
|
if (result.missing.length > 0) {
|
|
229
236
|
for (const m of result.missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? ""}`);
|
|
@@ -237,7 +244,6 @@ async function runGlobalInstall(opts, harnesses) {
|
|
|
237
244
|
for (const [harness, n] of byHarness) logInfo(`${harness}: ${n} installed`);
|
|
238
245
|
} catch (err) {
|
|
239
246
|
spinner.stop("Failed");
|
|
240
|
-
warnings.flush();
|
|
241
247
|
logErr(String(err));
|
|
242
248
|
process.exit(1);
|
|
243
249
|
}
|
|
@@ -248,17 +254,11 @@ function makeCheckCommand() {
|
|
|
248
254
|
registry: getKindRegistry(),
|
|
249
255
|
projectDir: path.resolve(opts.projectDir)
|
|
250
256
|
});
|
|
251
|
-
const gaps = await am.
|
|
252
|
-
|
|
253
|
-
if (gaps.length === 0 && incomplete.length === 0) {
|
|
257
|
+
const { gaps } = await am.projectState();
|
|
258
|
+
if (gaps.length === 0) {
|
|
254
259
|
logOk("All dependencies satisfied.");
|
|
255
260
|
} else {
|
|
256
261
|
for (const g of gaps) logErr(g.message);
|
|
257
|
-
for (const d of incomplete) {
|
|
258
|
-
logErr(
|
|
259
|
-
`${d.ref} is deployed without ${d.missing.join(", ")} \u2014 run \`skaile install\` to restore it`
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
262
|
process.exit(1);
|
|
263
263
|
}
|
|
264
264
|
});
|
|
@@ -322,6 +322,6 @@ function makeCleanCommand() {
|
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
export { REF_HINT, makeCheckCommand, makeCleanCommand, makeInstallCommand, reportAgentInstances, reportInstalledSoftDeps, reportPresetExpansions, reportRelocked, runPointerOnlyInstall, supportsInstallManifest };
|
|
326
|
-
//# sourceMappingURL=chunk-
|
|
327
|
-
//# sourceMappingURL=chunk-
|
|
325
|
+
export { REF_HINT, makeCheckCommand, makeCleanCommand, makeInstallCommand, reportAgentInstances, reportInstalledSoftDeps, reportPresetExpansions, reportRelocked, reportReplaced, runPointerOnlyInstall, supportsInstallManifest };
|
|
326
|
+
//# sourceMappingURL=chunk-4P3KTUZH.js.map
|
|
327
|
+
//# sourceMappingURL=chunk-4P3KTUZH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../cli/src/commands/project.ts"],"names":["confirm"],"mappings":";;;;;;;;;;;;;AAsCO,IAAM,QAAA,GAAW;AAGxB,SAAS,gBAAgB,GAAA,EAAsB;AAC7C,EAAA,IAAI;AACF,IAAA,aAAA,CAAc,GAAG,CAAA;AACjB,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAqBO,SAAS,wBAAwB,MAAA,EAAkD;AACxF,EAAA,OACE,OAAQ,QAAgE,kBAAA,KACxE,UAAA;AAEJ;AAwCA,eAAsB,qBAAA,CACpB,KACA,IAAA,EACmC;AACnC,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI;AACF,IAAA,SAAA,GAAY,cAAc,GAAG,CAAA;AAAA,EAC/B,SAAS,CAAA,EAAG;AACV,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,qBAAA,EAAwB,GAAG,CAAA,kBAAA,EAAgB,QAAQ,CAAA,EAAA,EAAK,CAAA,YAAa,KAAA,GAAQ,CAAA,CAAE,OAAA,GAAU,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,KACpG;AAAA,EACF;AACA,EAAA,MAAM,QAAA,GAAW,MAAM,IAAA,CAAK,OAAA,CAAQ,mBAAmB,GAAG,CAAA;AAI1D,EAAA,MAAM,GAAA,GAAM,aAAA,CAAc,QAAA,CAAS,GAA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AAA,OAAA,CAAQ,WAAW,CAAA,CAAE,GAAG,CAAA,EAAA,EAAK,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,IACzC;AACA,IAAA,IAAI,MAAA,CAAO,SAAA,CAAU,MAAA,GAAS,CAAA,EAAG;AAC/B,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,OAAA,CAAQ,CAAA,KAAA,EAAQ,MAAA,CAAO,SAAA,CAAU,MAAM,CAAA,oBAAA,CAAsB,CAAA;AAC7D,MAAA,KAAA,MAAW,CAAA,IAAK,OAAO,SAAA,EAAW;AAChC,QAAA,OAAA,CAAQ,IAAI,CAAA,IAAA,EAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,CAAA,CAAE,CAAA;AAAA,MAC/B;AAAA,IACF;AACA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,OAAA,CAAQ,GAAA,EAAI;AACZ,MAAA,KAAA,CAAM,sBAAsB,CAAA;AAAA,IAC9B;AAAA,EACF,CAAC,CAAA;AACL","file":"chunk-4P3KTUZH.js","sourcesContent":["import path from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport {\n AssetManager,\n type InstalledAgentInstance,\n type ReplacedAsset,\n} from \"@skaile/workspaces/asset-manager\";\nimport {\n type DriverTarget,\n type PresetExpansion,\n parseAssetRef,\n readLock,\n SUPPORTED_DRIVER_TARGETS,\n SourceEntryError,\n userConfigPath,\n} from \"@skaile/workspaces/core\";\nimport type { InstallManifest } from \"@skaile/workspaces/types\";\nimport { Command } from \"commander\";\nimport {\n colorRef,\n formatSoftDepHint,\n logErr,\n logInfo,\n logOk,\n logWarn,\n S,\n TARGET_DEFAULT_HINT,\n warnLegacyClaudeCopies,\n} from \"../helpers.ts\";\nimport { createSpinner } from \"../spinner.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\n\n/**\n * Canonical asset-ref shape accepted by `skaile install <ref>`:\n * `kind:@<publisher>/<name>#<version>` (the `#` version sigil). Validated via\n * `parseAssetRef` so the CLI shares the single canonical grammar; the legacy\n * trailing-`@version` shape is rejected.\n */\nexport const REF_HINT = \"kind:@<publisher>/<name>#<version> (e.g. skill:@skaile/use-exa#1.0.0)\";\n\n/** True when `ref` parses as a canonical asset ref. */\nfunction isValidAssetRef(ref: string): boolean {\n try {\n parseAssetRef(ref);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Minimal catalog-source surface the pointer-only install path needs.\n * `RemoteCatalogSource` satisfies this — narrowing keeps {@link runPointerOnlyInstall}\n * testable with a hand-rolled stub.\n */\nexport interface InstallManifestSource {\n getInstallManifest(ref: string): Promise<InstallManifest>;\n}\n\n/**\n * Capability check: is this catalog source able to serve install manifests?\n *\n * `openCatalogSource` returns a `RemoteCatalogSource | RestCatalogSource`.\n * Only the tRPC-framed `RemoteCatalogSource` implements `getInstallManifest`;\n * the REST-framed `RestCatalogSource` (the default for any catalog URL other\n * than `https://skaile.store`) does not. Calling it unconditionally would be a\n * runtime `TypeError`, so the pointer-only install path must capability-detect\n * first and fail with a clear, actionable message.\n */\nexport function supportsInstallManifest(source: unknown): source is InstallManifestSource {\n return (\n typeof (source as { getInstallManifest?: unknown } | null | undefined)?.getInstallManifest ===\n \"function\"\n );\n}\n\n/**\n * Minimal library surface the pointer-only install path needs.\n * `LocalIndex` satisfies this.\n */\nexport interface InstallLibrary {\n install(manifest: InstallManifest): Promise<{ installPath: string }>;\n}\n\n/**\n * Result of a pointer-only catalog install.\n */\nexport interface PointerOnlyInstallResult {\n /** Absolute path the verified asset bytes were written to. */\n installPath: string;\n /** The pinned upstream commit SHA the asset was fetched at. */\n commitSha: string;\n /** Number of files in the install manifest. */\n fileCount: number;\n}\n\n/**\n * Pointer-only catalog install — the `skaile install <ref>` code path.\n *\n * 1. Resolves the pointer-only {@link InstallManifest} from the Catalog.\n * 2. Hands it to the library, which fetches each file's bytes directly from\n * the upstream repo at the pinned commit, verifies every per-file SHA256\n * plus the composite SHA256, and only then writes the verified files.\n *\n * Both dependencies are injected so the function is unit-testable without a\n * network round-trip. In production the CLI passes a `RemoteCatalogSource`\n * and a `LocalIndex`.\n *\n * @param ref - Canonical asset ref (`kind:@<publisher>/<name>#<version>`).\n * @param deps - Injected catalog source + library.\n * @returns The install path, pinned commit SHA, and file count.\n * @throws When the ref is malformed, the manifest cannot be resolved, or any\n * hash verification fails. The underlying error message is surfaced as-is.\n */\nexport async function runPointerOnlyInstall(\n ref: string,\n deps: { catalog: InstallManifestSource; library: InstallLibrary },\n): Promise<PointerOnlyInstallResult> {\n let requested: ReturnType<typeof parseAssetRef>;\n try {\n requested = parseAssetRef(ref);\n } catch (e) {\n throw new Error(\n `malformed asset ref '${ref}' — expected ${REF_HINT}: ${e instanceof Error ? e.message : String(e)}`,\n );\n }\n const manifest = await deps.catalog.getInstallManifest(ref);\n // [M1] Identity check: the catalog must not install a different asset than\n // requested. Compare the PARSED refs (kind/publisher/name/pin) so equivalent\n // spellings (optional `kind:`, default `skill`) are treated as the same ref.\n const got = parseAssetRef(manifest.ref);\n if (\n got.kind !== requested.kind ||\n got.publisher !== requested.publisher ||\n got.name !== requested.name ||\n got.pin !== requested.pin\n ) {\n throw new Error(\n `catalog identity mismatch: requested '${ref}' but the catalog returned a manifest for '${manifest.ref}'`,\n );\n }\n const { installPath } = await deps.library.install(manifest);\n return {\n installPath,\n commitSha: manifest.source.commitSha,\n fileCount: manifest.files.length,\n };\n}\n\n/**\n * Print one summary line per `preset:` dependency `skaile install` expanded: how many\n * asset items joined the install set and how many instance items (`library://`,\n * placeholders) were skipped, which only `skaile preset apply` materialises.\n */\nexport function reportPresetExpansions(\n presets: readonly PresetExpansion[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const preset of presets ?? []) {\n onLine(\n `preset ${preset.ref}: ${preset.assets} assets, ${preset.skipped} instance items skipped (apply with skaile preset apply)`,\n );\n }\n}\n\n/**\n * Print one line per agent instance `skaile install` rendered (with the files\n * written) and one per native agent file removed because its instance left `skaile.yaml`.\n */\nexport function reportAgentInstances(\n instances: readonly InstalledAgentInstance[] | undefined,\n removedFiles: readonly string[] | undefined,\n onLine: (line: string) => void = logInfo,\n onRemoved: (line: string) => void = logWarn,\n): void {\n for (const instance of instances ?? []) {\n onLine(`agent ${instance.id}: ${instance.files.join(\", \")}`);\n }\n for (const file of removedFiles ?? []) onRemoved(`Removed: ${file}`);\n}\n\n/** One `Re-locked` line per lock entry `install`/`update` rewrote for an already-locked asset. */\nexport function reportRelocked(\n relocked: string[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const ref of relocked ?? []) onLine(`Re-locked ${ref}`);\n}\n\n/** One `replaced <old> → <new>` line per asset `install`/`update` moved to another locked version. */\nexport function reportReplaced(\n replaced: readonly ReplacedAsset[] | undefined,\n onLine: (line: string) => void = logInfo,\n): void {\n for (const r of replaced ?? []) onLine(`${r.ref} replaced ${r.from} → ${r.to}`);\n}\n\n/**\n * Creates the `skaile install` command.\n *\n * Two modes, selected by argument shape:\n *\n * - `skaile install` (no positional arg) — reads `skaile.yaml` and deploys all\n * declared assets (and their transitive dependencies) to the configured\n * driver target directory. Supports `--locked` for CI-mode install from a\n * lock file.\n * - `skaile install kind:@<publisher>/<name>#<version>` — pointer-only catalog\n * install: resolves the pointer-only install manifest from the configured\n * Catalog, fetches each file's bytes directly from the upstream repo at the\n * pinned commit, verifies every per-file + the composite SHA256, then writes\n * the verified files into the local Library.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-install-command\n */\nexport function makeInstallCommand(): Command {\n return new Command(\"install\")\n .description(`Install dependencies from skaile.yaml, or a single asset by ref (${REF_HINT})`)\n .argument(\"[ref]\", `Asset ref to install from the Catalog (${REF_HINT})`)\n .option(\"--locked\", \"Install from lock file (CI mode — fails on drift)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .option(\n \"--global\",\n \"Install the global SSOT (~/.skaile/skaile.yaml), fanning out to every global harness\",\n )\n .option(\n \"--harness <ids>\",\n \"Comma-separated global harnesses to install into (default: all resolved); implies --global\",\n )\n .option(\n \"--link\",\n \"symlink local-path assets instead of copying (dev loop; machine-local, not for committing)\",\n )\n .action(runInstallCommand);\n}\n\n/** Options shape accepted by the `skaile install` command action. */\ninterface InstallCommandOptions {\n locked?: boolean;\n projectDir: string;\n target?: string;\n global?: boolean;\n harness?: string;\n link?: boolean;\n}\n\n/**\n * Parse a `--harness a,b` value into validated {@link DriverTarget}s, exiting on\n * an unknown id. Returns `undefined` when the flag is absent (resolve the full\n * global set instead).\n */\nfunction parseHarnessFilter(raw: string | undefined): DriverTarget[] | undefined {\n if (!raw) return undefined;\n const ids = raw\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n const out: DriverTarget[] = [];\n for (const id of ids) {\n if (!(SUPPORTED_DRIVER_TARGETS as string[]).includes(id)) {\n logErr(`unknown harness '${id}' — expected one of: ${SUPPORTED_DRIVER_TARGETS.join(\", \")}`);\n process.exit(1);\n }\n out.push(id as DriverTarget);\n }\n return out.length > 0 ? out : undefined;\n}\n\n/**\n * `skaile install` action body. Dispatches by argument shape:\n * a positional `ref` selects pointer-only catalog install, otherwise the\n * legacy `skaile.yaml` install path runs.\n */\nasync function runInstallCommand(\n ref: string | undefined,\n opts: InstallCommandOptions,\n): Promise<void> {\n // ── Pointer-only catalog install: `skaile install <ref>` ──────────────\n if (ref !== undefined) {\n await runRefInstall(ref, opts);\n return;\n }\n\n // ── Legacy install: `skaile install` reads skaile.yaml ────────────────\n await runYamlInstall(opts);\n}\n\n/** Pointer-only catalog install path for `skaile install <ref>`. */\nasync function runRefInstall(ref: string, opts: InstallCommandOptions): Promise<void> {\n if (!isValidAssetRef(ref)) {\n logErr(`malformed asset ref '${ref}' — expected ${REF_HINT}`);\n process.exit(1);\n }\n const spinner = createSpinner();\n spinner.start(`Installing ${ref}`);\n try {\n const { openCatalogSource, openLibrary } = await import(\"../open-library.ts\");\n const catalog = await openCatalogSource({ projectDir: path.resolve(opts.projectDir) });\n // [H2] REST-framed catalogs (the default for any catalog URL other\n // than https://skaile.store) cannot serve install manifests. Detect\n // and fail clearly rather than throwing a runtime TypeError.\n if (!supportsInstallManifest(catalog)) {\n throw new Error(\n \"pointer-only install (skaile install <ref>) requires a tRPC-framed Catalog. \" +\n \"The configured catalog uses REST framing, which does not serve install \" +\n \"manifests. Set catalog.url to https://skaile.store, or catalog.framing: trpc, \" +\n `in ${userConfigPath()}.`,\n );\n }\n const library = await openLibrary();\n try {\n const result = await runPointerOnlyInstall(ref, { catalog, library });\n spinner.stop(\"Done\");\n logOk(`Installed ${colorRef(ref)}`);\n logInfo(`Path: ${S.dim(result.installPath)}`);\n logInfo(`Commit: ${S.dim(result.commitSha)}`);\n logInfo(`Files: ${S.dim(String(result.fileCount))}`);\n logInfo(\n S.dim(\n `Installed globally (see Path above) — use \\`skaile add ${ref}\\` to deploy into this project.`,\n ),\n );\n } finally {\n library.close();\n }\n } catch (err) {\n spinner.stop(\"Failed\");\n const msg = err instanceof Error ? err.message : String(err);\n if (/unreachable/i.test(msg)) {\n logErr(`asset uninstallable — source commit no longer available (${msg})`);\n } else {\n logErr(msg);\n }\n process.exit(1);\n }\n}\n\n/** Legacy install path for bare `skaile install` (reads skaile.yaml). */\nasync function runYamlInstall(opts: InstallCommandOptions): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n\n const harnesses = parseHarnessFilter(opts.harness);\n // `--harness` implies `--global`.\n if (opts.global || harnesses) {\n await runGlobalInstall(opts, harnesses);\n return;\n }\n\n // Hydrate sources declared in skaile.yaml before resolving assets, so\n // freshly checked-out projects pull their source clones automatically.\n try {\n const { ensureSourcesCloned } = await import(\"../ensure-sources.ts\");\n const hydrate = ensureSourcesCloned(projectDir, { quiet: true });\n if (hydrate.cloned.length > 0) {\n logOk(`Cloned source(s): ${hydrate.cloned.join(\", \")}`);\n }\n if (hydrate.failed.length > 0) {\n logErr(`Failed to clone source(s): ${hydrate.failed.join(\", \")}`);\n }\n } catch (err) {\n logWarn(`source hydration skipped: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir,\n driverTarget: opts.target as DriverTarget,\n });\n const spinner = createSpinner();\n spinner.start(opts.locked ? \"Installing from lock file\" : \"Installing dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(\n result.agentInstanceErrors?.length || result.missing.length > 0 ? \"Failed\" : \"Done\",\n );\n if (result.deployed.length > 0) {\n for (const d of result.deployed) logOk(d);\n }\n reportPresetExpansions(result.presets);\n reportAgentInstances(result.agentInstances, result.agentFilesRemoved);\n if (result.removed.length > 0) {\n for (const r of result.removed) logWarn(`Removed: ${r}`);\n }\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n result.missing.length === 0 &&\n !result.relocked?.length &&\n !result.agentInstanceErrors?.length\n ) {\n logInfo(\"Nothing to install (already up to date).\");\n }\n if (result.agentInstanceErrors?.length) {\n logErr(\n `${result.agentInstanceErrors.length} agent instance(s) could not be rendered (see above)`,\n );\n process.exitCode = 1;\n }\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n // Partial-miss must fail the process — CI can't otherwise distinguish a\n // clean install from \"half the assets never resolved\".\n process.exitCode = 1;\n }\n if (result.lockWritten) {\n logInfo(`Lock file written: ${S.dim(\"skaile.lock.yaml\")}`);\n }\n warnLegacyClaudeCopies(am);\n // Report-only: surface soft deps the declared assets reference but aren't\n // present. Never a prompt — install is a batch/CI path. Skipped under\n // --locked: that mode is \"restore exactly\", so an `add` nudge would jar.\n if (!opts.locked) await reportInstalledSoftDeps(am);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(err instanceof SourceEntryError ? err.message : String(err));\n process.exit(1);\n }\n}\n\n/**\n * Report (never prompt) the body-link soft deps that the declared assets\n * reference but that aren't in the project — the `install` counterpart to the\n * `add`-time soft-dep surface. `install` is a batch/CI path (often non-TTY), so\n * it only ever prints a hint: pulling stays an explicit `skaile add`. Best-effort\n * — `reportSoftDeps` swallows any index failure and returns `[]`.\n */\nexport async function reportInstalledSoftDeps(\n am: Pick<AssetManager, \"listDeclared\" | \"reportSoftDeps\">,\n onHint: (line: string) => void = (l) => logInfo(S.dim(l)),\n): Promise<void> {\n try {\n const declared = (await am.listDeclared()).map((d) => d.ref);\n if (declared.length === 0) return;\n const edges = await am.reportSoftDeps(declared);\n for (const edge of edges) onHint(formatSoftDepHint(edge));\n } catch {\n // Best-effort: a soft-dep report must never fail an install that succeeded.\n }\n}\n\n/**\n * Global cross-harness install: deploy every dep declared in the global SSOT\n * (`~/.skaile/skaile.yaml`) into each resolved global harness's dir under `~`,\n * write the global lock (`~/.skaile/skaile.lock.yaml`), then print per-harness\n * state. `harnesses` is the `--harness` filter (omit for the full resolved set).\n */\nasync function runGlobalInstall(\n opts: InstallCommandOptions,\n harnesses: DriverTarget[] | undefined,\n): Promise<void> {\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n global: true,\n harnesses,\n });\n const spinner = createSpinner();\n spinner.start(\"Installing global dependencies\");\n try {\n const result = await am.install({ locked: opts.locked, link: opts.link });\n spinner.stop(result.missing.length > 0 ? \"Failed\" : \"Done\");\n if (result.deployed.length > 0) for (const d of result.deployed) logOk(d);\n reportPresetExpansions(result.presets);\n if (result.removed.length > 0) for (const r of result.removed) logWarn(`Removed: ${r}`);\n reportReplaced(result.replaced);\n reportRelocked(result.relocked);\n if (\n result.deployed.length === 0 &&\n result.removed.length === 0 &&\n !result.replaced?.length &&\n result.missing.length === 0 &&\n !result.relocked?.length\n )\n logInfo(\"Nothing to install (already up to date).\");\n if (result.missing.length > 0) {\n for (const m of result.missing) logErr(`Missing: ${m}${result.missingHints?.[m] ?? \"\"}`);\n process.exitCode = 1;\n }\n if (result.lockWritten) logInfo(`Global lock written: ${S.dim(\"~/.skaile/skaile.lock.yaml\")}`);\n\n // Per-harness reconciliation summary so a partial fan-out is visible.\n const state = am.globalState({});\n const byHarness = new Map<string, number>();\n for (const s of state)\n if (s.state === \"installed\") byHarness.set(s.harness, (byHarness.get(s.harness) ?? 0) + 1);\n for (const [harness, n] of byHarness) logInfo(`${harness}: ${n} installed`);\n } catch (err) {\n spinner.stop(\"Failed\");\n logErr(String(err));\n process.exit(1);\n }\n}\n\n/**\n * Creates the `skaile check` command.\n *\n * Fails (exit 1) on every problem {@link AssetManager.projectState} reports: unmet\n * requirements of deployed assets, a declared dep that never resolved into the lock (its\n * library or source is gone, like `skaile list` showing it as `declared`) or never\n * materialized (e.g. a store-sourced `mcp-server`, #462), a locked asset whose library is\n * gone or whose deployed copy or files are missing, a locked library asset whose files\n * changed since the lock (or whose lock hash predates the shared asset hash), and an\n * `agents.<id>.ref` that binds to no agent. `doctor`, `outdated`, `diff` and\n * `install --locked` take their verdict from the same state.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-check-command\n */\nexport function makeCheckCommand(): Command {\n return new Command(\"check\")\n .description(\"Check for unmet requirements\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (opts) => {\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n });\n const { gaps } = await am.projectState();\n if (gaps.length === 0) {\n logOk(\"All dependencies satisfied.\");\n } else {\n for (const g of gaps) logErr(g.message);\n process.exit(1);\n }\n });\n}\n\n/**\n * Creates the `skaile clean` command.\n *\n * Removes all skaile-managed assets tracked in `skaile.lock.yaml` from the\n * workspace. With `--all` also removes history, patches, repos, and the lock\n * file itself. Preserves unmanaged (manually placed) assets.\n *\n * @returns Configured {@link Command} ready for `program.addCommand()`.\n * @docLink cli/commands/project#make-clean-command\n */\nexport function makeCleanCommand(): Command {\n return new Command(\"clean\")\n .description(\"Remove all skaile-managed assets from the workspace\")\n .option(\"--all\", \"Full reset: also remove history, patches, repos, and lock file\")\n .option(\"--dry-run\", \"Show what would be removed without doing it\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .option(\"--target <agent>\", `Agent framework (${TARGET_DEFAULT_HINT})`)\n .action(async (opts) => {\n const am = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.resolve(opts.projectDir),\n driverTarget: opts.target as DriverTarget,\n });\n\n // Preview: load lock file to show what will be cleaned\n const lock = readLock(path.resolve(opts.projectDir, \"skaile.lock.yaml\"));\n\n if (!lock || Object.keys(lock.assets).length === 0) {\n logInfo(\"Nothing to clean (no skaile-managed assets found).\");\n return;\n }\n\n const assetRefs = Object.keys(lock.assets);\n console.log();\n console.log(` ${S.heading(\"Assets to remove:\")} ${S.dim(`(${assetRefs.length})`)}`);\n for (const ref of assetRefs) {\n console.log(` ${colorRef(ref)}`);\n }\n\n if (opts.all) {\n console.log();\n console.log(` ${S.heading(\"Also removing:\")}`);\n console.log(` ${S.dim(\".skaile/history.yaml\")}`);\n console.log(` ${S.dim(\".skaile/patches/\")}`);\n console.log(` ${S.dim(\"skaile.lock.yaml\")}`);\n }\n\n if (opts.dryRun) {\n console.log();\n logInfo(\"Dry run — no changes made.\");\n return;\n }\n\n if (!opts.yes) {\n const confirm = await p.confirm({ message: \"Proceed?\" });\n if (p.isCancel(confirm) || !confirm) {\n logInfo(\"Cancelled.\");\n return;\n }\n }\n\n const result = am.clean({ all: opts.all });\n\n console.log();\n for (const r of result.removed) {\n logOk(`Removed ${r}`);\n }\n for (const s of result.skipped) {\n logWarn(`Skipped ${s.ref}: ${s.reason}`);\n }\n if (result.unmanaged.length > 0) {\n console.log();\n logInfo(`Kept ${result.unmanaged.length} unmanaged asset(s):`);\n for (const u of result.unmanaged) {\n console.log(` ${S.dim(u)}`);\n }\n }\n if (opts.all) {\n console.log();\n logOk(\"Full reset complete.\");\n }\n });\n}\n"]}
|
|
@@ -299,5 +299,5 @@ function resolveProjectDir(additionalEnvVars) {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
export { PluginStore, WorkspacePlugin, buildClaudePluginFiles, resolveProjectDir };
|
|
302
|
-
//# sourceMappingURL=chunk-
|
|
303
|
-
//# sourceMappingURL=chunk-
|
|
302
|
+
//# sourceMappingURL=chunk-5QI2JYJC.js.map
|
|
303
|
+
//# sourceMappingURL=chunk-5QI2JYJC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../workspace-plugin/src/adapters/claude-code.ts","../workspace-plugin/src/store.ts","../workspace-plugin/src/plugin.ts","../workspace-plugin/src/utils/project-dir.ts"],"names":["err"],"mappings":";;;;;;;AAeA,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,yEAAA;AAAA,EACb,MAAA,EAAQ,EAAE,IAAA,EAAM,WAAA,EAAa,KAAK,8BAAA,EAA+B;AAAA,EACjE,UAAA,EAAY,yCAAA;AAAA,EACZ,QAAA,EAAU,CAAC,QAAA,EAAU,YAAA,EAAc,aAAa,WAAW,CAAA;AAAA,EAC3D,KAAA,EAAO,oBAAA;AAAA,EACP,UAAA,EAAY,aAAA;AAAA,EACZ,UAAA,EAAY;AAAA,IACV,gBAAA,EAAkB;AAAA,MAChB,IAAA,EAAM,QAAA;AAAA,MACN,KAAA,EAAO,kBAAA;AAAA,MACP,WAAA,EAAa;AAAA;AACf;AAEJ,CAAA;AAOA,IAAM,UAAA,GAAa;AAAA,EACjB,KAAA,EAAO;AAAA,IACL,YAAA,EAAc,CAAC,EAAE,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,OAAA,EAAS,kCAAA,EAAoC,CAAA,EAAG,CAAA;AAAA,IAC5F,UAAA,EAAY,CAAC,EAAE,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW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AA,CAAwB,KAAK,UAAU,CAAA;AAAA,EAChD;AAAA,EAEA,MAAM,kBAAA,CAAmB,KAAA,EAAe,IAAA,EAAiC;AACvE,IAAA,MAAM,EAAE,kBAAA,EAAmB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AAC/D,IAAA,OAAO,kBAAA,CAAmB,IAAA,EAAM,KAAA,EAAO,IAAI,CAAA;AAAA,EAC7C;AACF;;;ACpOO,SAAS,kBAAkB,iBAAA,EAAsC;AACtE,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,kBAAA,EAAoB,OAAO,QAAQ,GAAA,CAAI,kBAAA;AACvD,EAAA,KAAA,MAAW,GAAA,IAAO,iBAAA,IAAqB,EAAC,EAAG;AACzC,IAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,GAAG,CAAA;AAC3B,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB","file":"chunk-ZTBAYUDY.js","sourcesContent":["// ── Claude Code plugin-directory generator (STATELESS) ──────────────────────\n// Generates the contents of a Claude Code plugin directory\n// (`.claude/plugins/skaile/`) as an in-memory file map. No plugin instance or\n// boot() is required — safe to call from install commands.\n//\n// The previous standalone `@skaile/workspace-plugin-claude` package shipped\n// these as static files plus loose `.mjs` hook scripts; they are now\n// CLI-owned templates. Hooks invoke the `skaile` binary directly\n// (`skaile plugin hook <event>`) and MCP runs via `skaile mcp-server` — no\n// generated script files, no shebang, no runtime assumption.\n\n/**\n * The Claude Code plugin manifest. `name` is `skaile`; `hooks` and\n * `mcpServers` point at sibling files in the generated directory.\n */\nconst PLUGIN_JSON = {\n name: \"skaile\",\n version: \"0.1.0\",\n description: \"Skaile workspace — connectors, mounts, skills, flows, shared state\",\n author: { name: \"skaile-ai\", url: \"https://github.com/skaile-ai\" },\n repository: \"https://github.com/skaile-ai/workspaces\",\n keywords: [\"skaile\", \"connectors\", \"workspace\", \"ai-assets\"],\n hooks: \"./hooks/hooks.json\",\n mcpServers: \"./.mcp.json\",\n userConfig: {\n skaile_yaml_path: {\n type: \"string\",\n title: \"skaile.yaml path\",\n description: \"Override path to skaile.yaml (default: auto-detect from project root)\",\n },\n },\n};\n\n/**\n * Hook wiring. Each lifecycle event invokes the `skaile` binary directly —\n * no loose `.mjs` scripts. `skaile plugin hook <event>` resolves the project\n * directory itself (`CLAUDE_PROJECT_DIR` / cwd) and always exits 0.\n */\nconst HOOKS_JSON = {\n hooks: {\n SessionStart: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-start\" }] }],\n SessionEnd: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-end\" }] }],\n UserPromptSubmit: [\n { hooks: [{ type: \"command\", command: \"skaile plugin hook user-prompt-submit\" }] },\n ],\n },\n};\n\n/**\n * MCP server wiring. Spawns `skaile mcp-server` — a stdio MCP subprocess that\n * runs on plain Node (no Claude Agent SDK).\n */\nconst MCP_JSON = {\n mcpServers: {\n \"skaile-workspace\": {\n command: \"skaile\",\n args: [\"mcp-server\"],\n env: {},\n },\n },\n};\n\n/**\n * Build the Claude Code plugin directory as an in-memory file map.\n *\n * Returns `{ relativePath: contents }` for every file the installer must\n * write under `<projectDir>/.claude/plugins/skaile/`. The installer is also\n * responsible for populating `skills/` from the project's `.skaile/skills/`.\n *\n * Stateless — no plugin instance, no `boot()`. The generated artifacts carry\n * no project-specific paths: hooks and the MCP server resolve the project\n * directory themselves at runtime.\n *\n * @returns A map of plugin-relative file paths to their string contents.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildClaudePluginFiles(): Record<string, string> {\n return {\n \".claude-plugin/plugin.json\": `${JSON.stringify(PLUGIN_JSON, null, 2)}\\n`,\n \"hooks/hooks.json\": `${JSON.stringify(HOOKS_JSON, null, 2)}\\n`,\n \".mcp.json\": `${JSON.stringify(MCP_JSON, null, 2)}\\n`,\n \"skills/.gitkeep\": \"\",\n };\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\ninterface Subscriber {\n regex: RegExp;\n handler: (key: string, value: unknown) => void;\n}\n\n/**\n * Disk-backed reactive key-value store for plugin state.\n *\n * Keeps an in-memory map that can be flushed to / loaded from a JSON file.\n * Supports glob-style subscriptions (`connector:*`, `*`).\n *\n * State is persisted to `<projectDir>/.skaile/plugin-state.json`.\n * The instance is available on {@link WorkspacePlugin} as the public `store`\n * field after `boot()` resolves.\n *\n * @docLink packages/workspace-plugin/concepts#plugin-store\n */\nexport class PluginStore {\n private readonly statePath: string;\n private data: Map<string, unknown> = new Map();\n private subscribers: Subscriber[] = [];\n\n constructor(statePath: string) {\n this.statePath = statePath;\n }\n\n /** Synchronous read from in-memory map. */\n get<T>(key: string): T | undefined {\n return this.data.get(key) as T | undefined;\n }\n\n /** Write to in-memory map and notify matching subscribers. */\n set<T>(key: string, value: T): void {\n this.data.set(key, value);\n this.notify(key, value);\n }\n\n /** Remove key and notify matching subscribers. */\n delete(key: string): void {\n this.data.delete(key);\n this.notify(key, undefined);\n }\n\n /**\n * Subscribe to changes matching a glob-style pattern.\n * `*` matches any sequence of characters.\n * Returns an unsubscribe function.\n */\n subscribe(pattern: string, handler: (key: string, value: unknown) => void): () => void {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexStr = `^${escaped.replace(/\\*/g, \".*\")}$`;\n const sub: Subscriber = { regex: new RegExp(regexStr), handler };\n this.subscribers.push(sub);\n\n return () => {\n const idx = this.subscribers.indexOf(sub);\n if (idx !== -1) this.subscribers.splice(idx, 1);\n };\n }\n\n /** Rehydrate from disk JSON. Missing file = empty store (no throw). */\n async load(): Promise<void> {\n try {\n const raw = await readFile(this.statePath, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n this.data = new Map(Object.entries(parsed));\n }\n } catch (e: unknown) {\n // Missing file or invalid JSON — start with empty store\n }\n }\n\n /** Write entire store to disk as JSON. Creates parent dirs if needed. */\n async flush(): Promise<void> {\n const obj = Object.fromEntries(this.data);\n const json = JSON.stringify(obj, null, 2);\n await mkdir(dirname(this.statePath), { recursive: true });\n await writeFile(this.statePath, json, \"utf-8\");\n }\n\n private notify(key: string, value: unknown): void {\n for (const sub of this.subscribers) {\n if (sub.regex.test(key)) {\n sub.handler(key, value);\n }\n }\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport { DEFAULT_DRIVER_ID } from \"@skaile/workspaces/core/framework\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { PluginStore } from \"./store.js\";\n\n/**\n * Construction options for {@link WorkspacePlugin}.\n *\n * At minimum `projectDir` must be supplied. All other fields are optional\n * and are pre-resolved by the caller when available (e.g. the runner already\n * knows `driver`/`model` from its own settings resolution).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport interface WorkspacePluginOpts {\n projectDir: string;\n /**\n * Active connector manager. The unified `ConnectorManager` owns both\n * filesystem-face (mountable) and tool-face connectors.\n */\n connectorManager?: ConnectorManager;\n bootOwned?: boolean;\n onLog?: (msg: string) => void;\n /** Pre-resolved driver type (avoids needing boot() to read settings). */\n driver?: string;\n /** Pre-resolved model. */\n model?: string;\n}\n\n/**\n * Shared runtime core for the skaile workspace plugin.\n *\n * Manages the full lifecycle (`boot` → tools available → `shutdown`) and\n * surfaces workspace capabilities — mounts, connectors, flows, skills,\n * sessions, and config validation — through two adapters:\n *\n * - **MCP, in-process** (runner): call {@link buildWorkspaceMcpServer} for the\n * Claude Agent SDK server the runner embeds into its `query()` call.\n * - **MCP, stdio** (`skaile mcp-server`): call {@link runMcpServerStdio} for a\n * raw `@modelcontextprotocol/sdk` server — no Claude Agent SDK.\n * - **OMP**: call {@link buildOmpToolSet} for the 13-tool native subset and\n * {@link buildOmpExtensionSource} for the generated extension file.\n *\n * Two boot modes are supported via {@link WorkspacePluginOpts.bootOwned}:\n * - `bootOwned: false` (default) — managers injected externally by the runner.\n * - `bootOwned: true` — plugin owns the full manager lifecycle (standalone MCP\n * subprocess or OMP extension).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport class WorkspacePlugin {\n readonly projectDir: string;\n connectorManager: ConnectorManager | null;\n readonly store: PluginStore;\n\n private readonly bootOwned: boolean;\n private readonly onLog: (msg: string) => void;\n private readonly log: Logger = createLogger({\n kind: \"mcp\",\n subkind: \"skaile-workspace\",\n });\n driver?: string;\n model?: string;\n\n constructor(opts: WorkspacePluginOpts) {\n this.projectDir = opts.projectDir;\n this.connectorManager = opts.connectorManager ?? null;\n this.store = new PluginStore(join(opts.projectDir, \".skaile\", \"plugin-state.json\"));\n this.bootOwned = opts.bootOwned ?? false;\n if (opts.driver) this.driver = opts.driver;\n if (opts.model) this.model = opts.model;\n this.onLog = opts.onLog ?? (() => {});\n this.log.debug(\"plugin constructed\", {\n driver: opts.driver,\n hasConnectors: !!opts.connectorManager,\n model: opts.model,\n bootOwned: this.bootOwned,\n });\n }\n\n async boot(): Promise<void> {\n if (!this.bootOwned) {\n // Managers were injected externally — resolve settings only (non-fatal)\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? DEFAULT_DRIVER_ID;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n await this.store.load();\n return;\n }\n\n // bootOwned: we own the managers lifecycle\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? DEFAULT_DRIVER_ID;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n\n try {\n const {\n ConnectorManager,\n loadConnectorDeclarations,\n registerBuiltinConnectors,\n createCliSecretProviderChain,\n } = await import(\"@skaile/workspaces/connectors\");\n\n registerBuiltinConnectors();\n\n const secrets = createCliSecretProviderChain();\n\n const connectorDecls = await loadConnectorDeclarations(this.projectDir);\n const cm = new ConnectorManager(this.projectDir, { secrets });\n await cm.connectAll(connectorDecls);\n this.connectorManager = cm;\n\n this.log.info(\"workspace plugin booted\", {\n connectors: connectorDecls.length,\n });\n this.onLog(`WorkspacePlugin booted: ${connectorDecls.length} connectors`);\n } catch (err) {\n this.log.warn(\"workspace plugin boot warning\", {\n error: err instanceof Error ? err.message : String(err),\n });\n this.onLog(`WorkspacePlugin boot warning: ${err}`);\n }\n\n await this.store.load();\n }\n\n async reload(): Promise<void> {\n if (!this.bootOwned) return;\n await this.shutdown();\n await this.boot();\n }\n\n async shutdown(): Promise<void> {\n this.log.info(\"workspace plugin shutdown\");\n await this.store.flush();\n if (!this.bootOwned) return;\n try {\n await (this.connectorManager as any)?.disconnectAll?.();\n } catch {\n /* best-effort */\n }\n this.connectorManager = null;\n }\n\n buildSystemPromptSection(driver?: string): string {\n const d = driver ?? this.driver ?? \"unknown\";\n // The unified ConnectorManager owns both mountable (filesystem-face) and\n // tool-face connectors. Filesystem-face connectors expose a `mountPath`.\n const all = (this.connectorManager as any)?.listConnectors?.() ?? [];\n const mounts = (all as any[]).filter((c) => typeof c.mountPath === \"string\");\n const connectors = (all as any[]).filter((c) => typeof c.mountPath !== \"string\");\n const lines = [\"## Workspace (skaile)\", \"\", `Driver: ${d}`, `Project: ${this.projectDir}`];\n if (mounts.length > 0) {\n lines.push(\"\", \"Mounts:\");\n for (const v of mounts) {\n lines.push(` · ${v.id} (${v.driver}) → ${v.mountPath ?? \"(unmounted)\"}`);\n }\n }\n if (connectors.length > 0) {\n lines.push(\"\", \"Connectors:\");\n for (const c of connectors) {\n lines.push(` · ${c.id} (${c.driver})`);\n }\n }\n lines.push(\"\", \"Use workspace_info for full details. Use workspace_validate to check health.\");\n\n for (const name of [\"SOUL.md\", \"RULES.md\"]) {\n const skaileOverride = join(this.projectDir, \".skaile\", name);\n const rootFile = join(this.projectDir, name);\n for (const candidate of [skaileOverride, rootFile]) {\n try {\n const content = readFileSync(candidate, \"utf-8\").trim();\n if (content) {\n lines.push(\"\", `## ${name.replace(\".md\", \"\")}`, \"\", content);\n break;\n }\n } catch {\n // file not found, try next\n }\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Build the in-process Claude Agent SDK MCP server (runner embedding).\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is unavailable.\n */\n async buildWorkspaceMcpServer(): Promise<unknown | null> {\n this.log.info(\"building workspace MCP server\");\n try {\n const { buildWorkspaceMcpServer } = await import(\"./adapters/mcp.js\");\n const server = await buildWorkspaceMcpServer(this);\n if (server) this.log.info(\"workspace MCP server ready\");\n else this.log.debug(\"workspace MCP server skipped (no tools)\");\n return server;\n } catch (err) {\n this.log.error(\"workspace MCP server build failed\", err);\n throw err;\n }\n }\n\n /**\n * Build the raw `@modelcontextprotocol/sdk` stdio MCP server — no Claude\n * Agent SDK. Used by the `skaile mcp-server` subprocess. The returned\n * server is not yet connected to a transport.\n */\n async buildWorkspaceMcpStdioServer(): Promise<unknown> {\n this.log.info(\"building workspace stdio MCP server\");\n const { buildWorkspaceMcpStdioServer } = await import(\"./adapters/mcp.js\");\n return buildWorkspaceMcpStdioServer(this);\n }\n\n /**\n * Build and run the stdio MCP server: builds the raw\n * `@modelcontextprotocol/sdk` server and connects a `StdioServerTransport`.\n * Used by the `skaile mcp-server` subprocess.\n */\n async runMcpServerStdio(): Promise<void> {\n this.log.info(\"starting workspace stdio MCP server\");\n const { runMcpServerStdio } = await import(\"./adapters/mcp.js\");\n await runMcpServerStdio(this);\n }\n\n async buildOmpToolSet(): Promise<unknown[]> {\n const { buildOmpToolSet } = await import(\"./adapters/omp.js\");\n return buildOmpToolSet(this);\n }\n\n async buildOmpExtensionSource(): Promise<string> {\n const { buildOmpExtensionSource } = await import(\"./adapters/omp.js\");\n return buildOmpExtensionSource(this.projectDir);\n }\n\n async handleSlashCommand(group: string, args: string[]): Promise<string> {\n const { handleSlashCommand } = await import(\"./adapters/omp.js\");\n return handleSlashCommand(this, group, args);\n }\n}\n","// utils/project-dir.ts\n// Centralised project-directory resolution used by all plugin entry points.\n\n/**\n * Resolve the skaile project directory from environment variables.\n *\n * Resolution order:\n * 1. `SKAILE_PROJECT_DIR` (always checked first)\n * 2. Any additional env var keys supplied by the caller (in order)\n * 3. `process.cwd()` as final fallback\n *\n * @param additionalEnvVars - Optional list of extra environment variable names\n * to check before falling back to `process.cwd()`.\n * @returns Absolute path to the resolved project directory.\n *\n * @example\n * // Claude Code — also checks CLAUDE_PROJECT_DIR\n * const projectDir = resolveProjectDir([\"CLAUDE_PROJECT_DIR\"]);\n *\n * // OMP / standalone — SKAILE_PROJECT_DIR or cwd only\n * const projectDir = resolveProjectDir();\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function resolveProjectDir(additionalEnvVars?: string[]): string {\n if (process.env.SKAILE_PROJECT_DIR) return process.env.SKAILE_PROJECT_DIR;\n for (const key of additionalEnvVars ?? []) {\n const val = process.env[key];\n if (val) return val;\n }\n return process.cwd();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../workspace-plugin/src/adapters/claude-code.ts","../workspace-plugin/src/store.ts","../workspace-plugin/src/plugin.ts","../workspace-plugin/src/utils/project-dir.ts"],"names":["err"],"mappings":";;;;;;;AAeA,IAAM,WAAA,GAAc;AAAA,EAClB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,yEAAA;AAAA,EACb,MAAA,EAAQ,EAAE,IAAA,EAAM,WAAA,EAAa,KAAK,8BAAA,EAA+B;AAAA,EACjE,UAAA,EAAY,yCAAA;AAAA,EACZ,QAAA,EAAU,CAAC,QAAA,EAAU,YAAA,EAAc,aAAa,WAAW,CAAA;AAAA,EAC3D,KAAA,EAAO,oBAAA;AAAA,EACP,UAAA,EAAY,aAAA;AAAA,EACZ,UAAA,EAAY;AAAA,IACV,gBAAA,EAAkB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,GAAI,MAAM,OAAO,oCAAmB,CAAA;AAC9D,IAAA,MAAM,kBAAkB,IAAI,CAAA;AAAA,EAC9B;AAAA,EAEA,MAAM,eAAA,GAAsC;AAC1C,IAAA,MAAM,EAAE,eAAA,EAAgB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AAC5D,IAAA,OAAO,gBAAgB,IAAI,CAAA;AAAA,EAC7B;AAAA,EAEA,MAAM,uBAAA,GAA2C;AAC/C,IAAA,MAAM,EAAE,uBAAA,EAAwB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AACpE,IAAA,OAAO,uBAAA,CAAwB,KAAK,UAAU,CAAA;AAAA,EAChD;AAAA,EAEA,MAAM,kBAAA,CAAmB,KAAA,EAAe,IAAA,EAAiC;AACvE,IAAA,MAAM,EAAE,kBAAA,EAAmB,GAAI,MAAM,OAAO,oCAAmB,CAAA;AAC/D,IAAA,OAAO,kBAAA,CAAmB,IAAA,EAAM,KAAA,EAAO,IAAI,CAAA;AAAA,EAC7C;AACF;;;ACpOO,SAAS,kBAAkB,iBAAA,EAAsC;AACtE,EAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,kBAAA,EAAoB,OAAO,QAAQ,GAAA,CAAI,kBAAA;AACvD,EAAA,KAAA,MAAW,GAAA,IAAO,iBAAA,IAAqB,EAAC,EAAG;AACzC,IAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,GAAG,CAAA;AAC3B,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EAClB;AACA,EAAA,OAAO,QAAQ,GAAA,EAAI;AACrB","file":"chunk-5QI2JYJC.js","sourcesContent":["// ── Claude Code plugin-directory generator (STATELESS) ──────────────────────\n// Generates the contents of a Claude Code plugin directory\n// (`.claude/plugins/skaile/`) as an in-memory file map. No plugin instance or\n// boot() is required — safe to call from install commands.\n//\n// The previous standalone `@skaile/workspace-plugin-claude` package shipped\n// these as static files plus loose `.mjs` hook scripts; they are now\n// CLI-owned templates. Hooks invoke the `skaile` binary directly\n// (`skaile plugin hook <event>`) and MCP runs via `skaile mcp-server` — no\n// generated script files, no shebang, no runtime assumption.\n\n/**\n * The Claude Code plugin manifest. `name` is `skaile`; `hooks` and\n * `mcpServers` point at sibling files in the generated directory.\n */\nconst PLUGIN_JSON = {\n name: \"skaile\",\n version: \"0.1.0\",\n description: \"Skaile workspace — connectors, mounts, skills, flows, shared state\",\n author: { name: \"skaile-ai\", url: \"https://github.com/skaile-ai\" },\n repository: \"https://github.com/skaile-ai/workspaces\",\n keywords: [\"skaile\", \"connectors\", \"workspace\", \"ai-assets\"],\n hooks: \"./hooks/hooks.json\",\n mcpServers: \"./.mcp.json\",\n userConfig: {\n skaile_yaml_path: {\n type: \"string\",\n title: \"skaile.yaml path\",\n description: \"Override path to skaile.yaml (default: auto-detect from project root)\",\n },\n },\n};\n\n/**\n * Hook wiring. Each lifecycle event invokes the `skaile` binary directly —\n * no loose `.mjs` scripts. `skaile plugin hook <event>` resolves the project\n * directory itself (`CLAUDE_PROJECT_DIR` / cwd) and always exits 0.\n */\nconst HOOKS_JSON = {\n hooks: {\n SessionStart: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-start\" }] }],\n SessionEnd: [{ hooks: [{ type: \"command\", command: \"skaile plugin hook session-end\" }] }],\n UserPromptSubmit: [\n { hooks: [{ type: \"command\", command: \"skaile plugin hook user-prompt-submit\" }] },\n ],\n },\n};\n\n/**\n * MCP server wiring. Spawns `skaile mcp-server` — a stdio MCP subprocess that\n * runs on plain Node (no Claude Agent SDK).\n */\nconst MCP_JSON = {\n mcpServers: {\n \"skaile-workspace\": {\n command: \"skaile\",\n args: [\"mcp-server\"],\n env: {},\n },\n },\n};\n\n/**\n * Build the Claude Code plugin directory as an in-memory file map.\n *\n * Returns `{ relativePath: contents }` for every file the installer must\n * write under `<projectDir>/.claude/plugins/skaile/`. The installer is also\n * responsible for populating `skills/` from the project's `.skaile/skills/`.\n *\n * Stateless — no plugin instance, no `boot()`. The generated artifacts carry\n * no project-specific paths: hooks and the MCP server resolve the project\n * directory themselves at runtime.\n *\n * @returns A map of plugin-relative file paths to their string contents.\n *\n * @docLink packages/workspace-plugin/concepts#adapters\n */\nexport function buildClaudePluginFiles(): Record<string, string> {\n return {\n \".claude-plugin/plugin.json\": `${JSON.stringify(PLUGIN_JSON, null, 2)}\\n`,\n \"hooks/hooks.json\": `${JSON.stringify(HOOKS_JSON, null, 2)}\\n`,\n \".mcp.json\": `${JSON.stringify(MCP_JSON, null, 2)}\\n`,\n \"skills/.gitkeep\": \"\",\n };\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\ninterface Subscriber {\n regex: RegExp;\n handler: (key: string, value: unknown) => void;\n}\n\n/**\n * Disk-backed reactive key-value store for plugin state.\n *\n * Keeps an in-memory map that can be flushed to / loaded from a JSON file.\n * Supports glob-style subscriptions (`connector:*`, `*`).\n *\n * State is persisted to `<projectDir>/.skaile/plugin-state.json`.\n * The instance is available on {@link WorkspacePlugin} as the public `store`\n * field after `boot()` resolves.\n *\n * @docLink packages/workspace-plugin/concepts#plugin-store\n */\nexport class PluginStore {\n private readonly statePath: string;\n private data: Map<string, unknown> = new Map();\n private subscribers: Subscriber[] = [];\n\n constructor(statePath: string) {\n this.statePath = statePath;\n }\n\n /** Synchronous read from in-memory map. */\n get<T>(key: string): T | undefined {\n return this.data.get(key) as T | undefined;\n }\n\n /** Write to in-memory map and notify matching subscribers. */\n set<T>(key: string, value: T): void {\n this.data.set(key, value);\n this.notify(key, value);\n }\n\n /** Remove key and notify matching subscribers. */\n delete(key: string): void {\n this.data.delete(key);\n this.notify(key, undefined);\n }\n\n /**\n * Subscribe to changes matching a glob-style pattern.\n * `*` matches any sequence of characters.\n * Returns an unsubscribe function.\n */\n subscribe(pattern: string, handler: (key: string, value: unknown) => void): () => void {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const regexStr = `^${escaped.replace(/\\*/g, \".*\")}$`;\n const sub: Subscriber = { regex: new RegExp(regexStr), handler };\n this.subscribers.push(sub);\n\n return () => {\n const idx = this.subscribers.indexOf(sub);\n if (idx !== -1) this.subscribers.splice(idx, 1);\n };\n }\n\n /** Rehydrate from disk JSON. Missing file = empty store (no throw). */\n async load(): Promise<void> {\n try {\n const raw = await readFile(this.statePath, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n this.data = new Map(Object.entries(parsed));\n }\n } catch (e: unknown) {\n // Missing file or invalid JSON — start with empty store\n }\n }\n\n /** Write entire store to disk as JSON. Creates parent dirs if needed. */\n async flush(): Promise<void> {\n const obj = Object.fromEntries(this.data);\n const json = JSON.stringify(obj, null, 2);\n await mkdir(dirname(this.statePath), { recursive: true });\n await writeFile(this.statePath, json, \"utf-8\");\n }\n\n private notify(key: string, value: unknown): void {\n for (const sub of this.subscribers) {\n if (sub.regex.test(key)) {\n sub.handler(key, value);\n }\n }\n }\n}\n","import { readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ConnectorManager } from \"@skaile/workspaces/connectors\";\nimport { DEFAULT_DRIVER_ID } from \"@skaile/workspaces/core/framework\";\nimport { createLogger } from \"@skaile/workspaces/core/logging\";\nimport type { Logger } from \"@skaile/workspaces/types\";\nimport { PluginStore } from \"./store.js\";\n\n/**\n * Construction options for {@link WorkspacePlugin}.\n *\n * At minimum `projectDir` must be supplied. All other fields are optional\n * and are pre-resolved by the caller when available (e.g. the runner already\n * knows `driver`/`model` from its own settings resolution).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport interface WorkspacePluginOpts {\n projectDir: string;\n /**\n * Active connector manager. The unified `ConnectorManager` owns both\n * filesystem-face (mountable) and tool-face connectors.\n */\n connectorManager?: ConnectorManager;\n bootOwned?: boolean;\n onLog?: (msg: string) => void;\n /** Pre-resolved driver type (avoids needing boot() to read settings). */\n driver?: string;\n /** Pre-resolved model. */\n model?: string;\n}\n\n/**\n * Shared runtime core for the skaile workspace plugin.\n *\n * Manages the full lifecycle (`boot` → tools available → `shutdown`) and\n * surfaces workspace capabilities — mounts, connectors, flows, skills,\n * sessions, and config validation — through two adapters:\n *\n * - **MCP, in-process** (runner): call {@link buildWorkspaceMcpServer} for the\n * Claude Agent SDK server the runner embeds into its `query()` call.\n * - **MCP, stdio** (`skaile mcp-server`): call {@link runMcpServerStdio} for a\n * raw `@modelcontextprotocol/sdk` server — no Claude Agent SDK.\n * - **OMP**: call {@link buildOmpToolSet} for the 13-tool native subset and\n * {@link buildOmpExtensionSource} for the generated extension file.\n *\n * Two boot modes are supported via {@link WorkspacePluginOpts.bootOwned}:\n * - `bootOwned: false` (default) — managers injected externally by the runner.\n * - `bootOwned: true` — plugin owns the full manager lifecycle (standalone MCP\n * subprocess or OMP extension).\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport class WorkspacePlugin {\n readonly projectDir: string;\n connectorManager: ConnectorManager | null;\n readonly store: PluginStore;\n\n private readonly bootOwned: boolean;\n private readonly onLog: (msg: string) => void;\n private readonly log: Logger = createLogger({\n kind: \"mcp\",\n subkind: \"skaile-workspace\",\n });\n driver?: string;\n model?: string;\n\n constructor(opts: WorkspacePluginOpts) {\n this.projectDir = opts.projectDir;\n this.connectorManager = opts.connectorManager ?? null;\n this.store = new PluginStore(join(opts.projectDir, \".skaile\", \"plugin-state.json\"));\n this.bootOwned = opts.bootOwned ?? false;\n if (opts.driver) this.driver = opts.driver;\n if (opts.model) this.model = opts.model;\n this.onLog = opts.onLog ?? (() => {});\n this.log.debug(\"plugin constructed\", {\n driver: opts.driver,\n hasConnectors: !!opts.connectorManager,\n model: opts.model,\n bootOwned: this.bootOwned,\n });\n }\n\n async boot(): Promise<void> {\n if (!this.bootOwned) {\n // Managers were injected externally — resolve settings only (non-fatal)\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? DEFAULT_DRIVER_ID;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n await this.store.load();\n return;\n }\n\n // bootOwned: we own the managers lifecycle\n try {\n const { resolveSettings } = await import(\"@skaile/workspaces/core\");\n const settings = await resolveSettings(this.projectDir);\n this.driver = settings.driver ?? DEFAULT_DRIVER_ID;\n this.model = settings.model;\n } catch {\n /* non-fatal */\n }\n\n try {\n const {\n ConnectorManager,\n loadConnectorDeclarations,\n registerBuiltinConnectors,\n createCliSecretProviderChain,\n } = await import(\"@skaile/workspaces/connectors\");\n\n registerBuiltinConnectors();\n\n const secrets = createCliSecretProviderChain();\n\n const connectorDecls = await loadConnectorDeclarations(this.projectDir);\n const cm = new ConnectorManager(this.projectDir, { secrets });\n await cm.connectAll(connectorDecls);\n this.connectorManager = cm;\n\n this.log.info(\"workspace plugin booted\", {\n connectors: connectorDecls.length,\n });\n this.onLog(`WorkspacePlugin booted: ${connectorDecls.length} connectors`);\n } catch (err) {\n this.log.warn(\"workspace plugin boot warning\", {\n error: err instanceof Error ? err.message : String(err),\n });\n this.onLog(`WorkspacePlugin boot warning: ${err}`);\n }\n\n await this.store.load();\n }\n\n async reload(): Promise<void> {\n if (!this.bootOwned) return;\n await this.shutdown();\n await this.boot();\n }\n\n async shutdown(): Promise<void> {\n this.log.info(\"workspace plugin shutdown\");\n await this.store.flush();\n if (!this.bootOwned) return;\n try {\n await (this.connectorManager as any)?.disconnectAll?.();\n } catch {\n /* best-effort */\n }\n this.connectorManager = null;\n }\n\n buildSystemPromptSection(driver?: string): string {\n const d = driver ?? this.driver ?? \"unknown\";\n // The unified ConnectorManager owns both mountable (filesystem-face) and\n // tool-face connectors. Filesystem-face connectors expose a `mountPath`.\n const all = (this.connectorManager as any)?.listConnectors?.() ?? [];\n const mounts = (all as any[]).filter((c) => typeof c.mountPath === \"string\");\n const connectors = (all as any[]).filter((c) => typeof c.mountPath !== \"string\");\n const lines = [\"## Workspace (skaile)\", \"\", `Driver: ${d}`, `Project: ${this.projectDir}`];\n if (mounts.length > 0) {\n lines.push(\"\", \"Mounts:\");\n for (const v of mounts) {\n lines.push(` · ${v.id} (${v.driver}) → ${v.mountPath ?? \"(unmounted)\"}`);\n }\n }\n if (connectors.length > 0) {\n lines.push(\"\", \"Connectors:\");\n for (const c of connectors) {\n lines.push(` · ${c.id} (${c.driver})`);\n }\n }\n lines.push(\"\", \"Use workspace_info for full details. Use workspace_validate to check health.\");\n\n for (const name of [\"SOUL.md\", \"RULES.md\"]) {\n const skaileOverride = join(this.projectDir, \".skaile\", name);\n const rootFile = join(this.projectDir, name);\n for (const candidate of [skaileOverride, rootFile]) {\n try {\n const content = readFileSync(candidate, \"utf-8\").trim();\n if (content) {\n lines.push(\"\", `## ${name.replace(\".md\", \"\")}`, \"\", content);\n break;\n }\n } catch {\n // file not found, try next\n }\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Build the in-process Claude Agent SDK MCP server (runner embedding).\n * Returns `null` when `@anthropic-ai/claude-agent-sdk` is unavailable.\n */\n async buildWorkspaceMcpServer(): Promise<unknown | null> {\n this.log.info(\"building workspace MCP server\");\n try {\n const { buildWorkspaceMcpServer } = await import(\"./adapters/mcp.js\");\n const server = await buildWorkspaceMcpServer(this);\n if (server) this.log.info(\"workspace MCP server ready\");\n else this.log.debug(\"workspace MCP server skipped (no tools)\");\n return server;\n } catch (err) {\n this.log.error(\"workspace MCP server build failed\", err);\n throw err;\n }\n }\n\n /**\n * Build the raw `@modelcontextprotocol/sdk` stdio MCP server — no Claude\n * Agent SDK. Used by the `skaile mcp-server` subprocess. The returned\n * server is not yet connected to a transport.\n */\n async buildWorkspaceMcpStdioServer(): Promise<unknown> {\n this.log.info(\"building workspace stdio MCP server\");\n const { buildWorkspaceMcpStdioServer } = await import(\"./adapters/mcp.js\");\n return buildWorkspaceMcpStdioServer(this);\n }\n\n /**\n * Build and run the stdio MCP server: builds the raw\n * `@modelcontextprotocol/sdk` server and connects a `StdioServerTransport`.\n * Used by the `skaile mcp-server` subprocess.\n */\n async runMcpServerStdio(): Promise<void> {\n this.log.info(\"starting workspace stdio MCP server\");\n const { runMcpServerStdio } = await import(\"./adapters/mcp.js\");\n await runMcpServerStdio(this);\n }\n\n async buildOmpToolSet(): Promise<unknown[]> {\n const { buildOmpToolSet } = await import(\"./adapters/omp.js\");\n return buildOmpToolSet(this);\n }\n\n async buildOmpExtensionSource(): Promise<string> {\n const { buildOmpExtensionSource } = await import(\"./adapters/omp.js\");\n return buildOmpExtensionSource(this.projectDir);\n }\n\n async handleSlashCommand(group: string, args: string[]): Promise<string> {\n const { handleSlashCommand } = await import(\"./adapters/omp.js\");\n return handleSlashCommand(this, group, args);\n }\n}\n","// utils/project-dir.ts\n// Centralised project-directory resolution used by all plugin entry points.\n\n/**\n * Resolve the skaile project directory from environment variables.\n *\n * Resolution order:\n * 1. `SKAILE_PROJECT_DIR` (always checked first)\n * 2. Any additional env var keys supplied by the caller (in order)\n * 3. `process.cwd()` as final fallback\n *\n * @param additionalEnvVars - Optional list of extra environment variable names\n * to check before falling back to `process.cwd()`.\n * @returns Absolute path to the resolved project directory.\n *\n * @example\n * // Claude Code — also checks CLAUDE_PROJECT_DIR\n * const projectDir = resolveProjectDir([\"CLAUDE_PROJECT_DIR\"]);\n *\n * // OMP / standalone — SKAILE_PROJECT_DIR or cwd only\n * const projectDir = resolveProjectDir();\n *\n * @docLink packages/workspace-plugin/concepts#workspaceplugin-lifecycle\n */\nexport function resolveProjectDir(additionalEnvVars?: string[]): string {\n if (process.env.SKAILE_PROJECT_DIR) return process.env.SKAILE_PROJECT_DIR;\n for (const key of additionalEnvVars ?? []) {\n const val = process.env[key];\n if (val) return val;\n }\n return process.cwd();\n}\n"]}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import { normalizeAnthropicModel } from './chunk-
|
|
2
|
-
import { buildAgentPromptSections } from './chunk-
|
|
3
|
-
import { mkdirSync, writeFileSync } from 'fs';
|
|
1
|
+
import { normalizeAnthropicModel } from './chunk-32XKCNCL.js';
|
|
2
|
+
import { buildAgentPromptSections } from './chunk-2FMEGSBN.js';
|
|
3
|
+
import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
|
|
4
4
|
import { join, dirname, relative } from 'path';
|
|
5
5
|
import { stringify } from 'yaml';
|
|
6
6
|
|
|
7
|
-
function writeAgent(filePath, content, workspaceRoot, created) {
|
|
7
|
+
function writeAgent(filePath, content, workspaceRoot, created, changed) {
|
|
8
|
+
const rel = relative(workspaceRoot, filePath);
|
|
9
|
+
created.push(rel);
|
|
10
|
+
if (existsSync(filePath)) {
|
|
11
|
+
try {
|
|
12
|
+
if (readFileSync(filePath, "utf-8") === content) return;
|
|
13
|
+
} catch {
|
|
14
|
+
}
|
|
15
|
+
}
|
|
8
16
|
mkdirSync(dirname(filePath), { recursive: true });
|
|
9
17
|
writeFileSync(filePath, content, "utf-8");
|
|
10
|
-
|
|
18
|
+
changed.push(rel);
|
|
11
19
|
}
|
|
12
20
|
function buildMarkdownBody(soul, rules, duties, abilityRefs, contractRefs, frameworkFragments, promptExtensions) {
|
|
13
21
|
const sections = buildAgentPromptSections({
|
|
@@ -42,6 +50,7 @@ var claudeCodeRenderer = ({
|
|
|
42
50
|
mcpServers
|
|
43
51
|
}) => {
|
|
44
52
|
const created = [];
|
|
53
|
+
const changed = [];
|
|
45
54
|
const warnings = [];
|
|
46
55
|
const frontmatter = {
|
|
47
56
|
name: agentName,
|
|
@@ -89,8 +98,8 @@ ${stringify(frontmatter).trim()}
|
|
|
89
98
|
|
|
90
99
|
${body}`;
|
|
91
100
|
const filePath = join(agentDeployDir, `${agentName}.md`);
|
|
92
|
-
writeAgent(filePath, content, workspaceRoot, created);
|
|
93
|
-
return { created, warnings };
|
|
101
|
+
writeAgent(filePath, content, workspaceRoot, created, changed);
|
|
102
|
+
return { created, changed, warnings };
|
|
94
103
|
};
|
|
95
104
|
var MUTATING_TOOLS = ["Write", "Edit", "MultiEdit", "NotebookEdit", "Bash"];
|
|
96
105
|
function codexSandboxMode(tools) {
|
|
@@ -116,6 +125,7 @@ var codexRenderer = ({
|
|
|
116
125
|
promptExtensions
|
|
117
126
|
}) => {
|
|
118
127
|
const created = [];
|
|
128
|
+
const changed = [];
|
|
119
129
|
const warnings = [];
|
|
120
130
|
const instructions = buildMarkdownBody(
|
|
121
131
|
soul,
|
|
@@ -140,10 +150,10 @@ var codexRenderer = ({
|
|
|
140
150
|
const content = `${lines.join("\n")}
|
|
141
151
|
`;
|
|
142
152
|
const filePath = join(agentDeployDir, `${agentName}.toml`);
|
|
143
|
-
writeAgent(filePath, content, workspaceRoot, created);
|
|
153
|
+
writeAgent(filePath, content, workspaceRoot, created, changed);
|
|
144
154
|
const agentMdPath = join(dirname(agentDeployDir), CODEX_IDENTITY_DIR, `${agentName}.md`);
|
|
145
|
-
writeAgent(agentMdPath, instructions, workspaceRoot, created);
|
|
146
|
-
return { created, warnings };
|
|
155
|
+
writeAgent(agentMdPath, instructions, workspaceRoot, created, changed);
|
|
156
|
+
return { created, changed, warnings };
|
|
147
157
|
};
|
|
148
158
|
var ompRenderer = ({
|
|
149
159
|
manifest,
|
|
@@ -160,9 +170,9 @@ var ompRenderer = ({
|
|
|
160
170
|
lifecycle
|
|
161
171
|
}) => {
|
|
162
172
|
const created = [];
|
|
173
|
+
const changed = [];
|
|
163
174
|
const warnings = [];
|
|
164
175
|
const destDir = join(agentDeployDir, agentName);
|
|
165
|
-
mkdirSync(destDir, { recursive: true });
|
|
166
176
|
const agentYaml = {
|
|
167
177
|
spec_version: manifest.spec_version ?? "0.2",
|
|
168
178
|
name: agentName,
|
|
@@ -181,7 +191,7 @@ var ompRenderer = ({
|
|
|
181
191
|
if (manifest.composes?.length) agentYaml.composes = manifest.composes;
|
|
182
192
|
if (manifest.tags?.length) agentYaml.tags = manifest.tags;
|
|
183
193
|
if (manifest.metadata) agentYaml.metadata = manifest.metadata;
|
|
184
|
-
|
|
194
|
+
writeAgent(join(destDir, "agent.yaml"), stringify(agentYaml), workspaceRoot, [], changed);
|
|
185
195
|
const enrichedSoul = buildMarkdownBody(
|
|
186
196
|
soul,
|
|
187
197
|
rules,
|
|
@@ -191,16 +201,20 @@ var ompRenderer = ({
|
|
|
191
201
|
frameworkFragments,
|
|
192
202
|
promptExtensions
|
|
193
203
|
);
|
|
194
|
-
|
|
204
|
+
writeAgent(join(destDir, "SOUL.md"), enrichedSoul, workspaceRoot, [], changed);
|
|
195
205
|
created.push(relative(workspaceRoot, destDir));
|
|
196
|
-
return { created, warnings };
|
|
206
|
+
return { created, changed, warnings };
|
|
197
207
|
};
|
|
198
208
|
var noop = () => {
|
|
199
209
|
};
|
|
200
210
|
function renderAgentToFramework(input, driverTarget, log = noop) {
|
|
201
211
|
const renderer = AGENT_RENDERERS[driverTarget];
|
|
202
212
|
if (!renderer) {
|
|
203
|
-
return {
|
|
213
|
+
return {
|
|
214
|
+
created: [],
|
|
215
|
+
changed: [],
|
|
216
|
+
warnings: [`No renderer for framework "${driverTarget}"`]
|
|
217
|
+
};
|
|
204
218
|
}
|
|
205
219
|
const result = renderer(input);
|
|
206
220
|
for (const c of result.created) log(` rendered agent: ${c}`);
|
|
@@ -217,5 +231,5 @@ function driverTargetSupportsAgents(driverTarget) {
|
|
|
217
231
|
}
|
|
218
232
|
|
|
219
233
|
export { AGENT_RENDERERS, CODEX_IDENTITY_DIR, claudeCodeRenderer, codexRenderer, driverTargetSupportsAgents, ompRenderer, renderAgentToFramework };
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
234
|
+
//# sourceMappingURL=chunk-6HHE63CO.js.map
|
|
235
|
+
//# sourceMappingURL=chunk-6HHE63CO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../asset-manager/src/renderers.ts"],"names":["stringifyYaml"],"mappings":";;;;;;AA+FA,SAAS,UAAA,CACP,QAAA,EACA,OAAA,EACA,aAAA,EACA,SACA,OAAA,EACM;AACN,EAAA,MAAM,GAAA,GA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D,EAAA,KAAA,MAAW,KAAK,MAAA,CAAO,QAAA,EAAU,GAAA,CAAI,CAAA,QAAA,EAAW,CAAC,CAAA,CAAE,CAAA;AACnD,EAAA,OAAO,MAAA;AACT;AAUO,IAAM,eAAA,GAAiD;AAAA,EAC5D,aAAA,EAAe,kBAAA;AAAA,EACf,GAAA,EAAK,WAAA;AAAA,EACL,KAAA,EAAO;AACT;AASO,SAAS,2BAA2B,YAAA,EAA+B;AACxE,EAAA,OAAO,YAAA,IAAgB,eAAA;AACzB","file":"chunk-6HHE63CO.js","sourcesContent":["/**\n * Framework-specific renderers for GitAgent packages.\n *\n * Each renderer transforms a parsed GitAgent package (agent.yaml + SOUL.md + RULES.md)\n * into the native file format that the target agent framework natively reads.\n *\n * Only harnesses with a full bridge driver (runtime execution) are included:\n * claude-code → .claude/agents/<name>.md (YAML frontmatter + markdown body)\n * omp → .omp/agents/<name>/ (directory with agent.yaml + SOUL.md)\n * codex → .codex/agents/<name>.toml (TOML)\n *\n * Removed (no bridge driver): cursor, roo, github-copilot, gemini, amp.\n * Add them back when a bridge driver is implemented.\n */\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, relative } from \"node:path\";\nimport { buildAgentPromptSections } from \"@skaile/workspaces/core\";\nimport {\n type AgentLifecycle,\n type AgentManifest,\n normalizeAnthropicModel,\n} from \"@skaile/workspaces/types/manifests\";\nimport { stringify as stringifyYaml } from \"yaml\";\nimport type { AbilityRef, ContractRef } from \"./fragments.js\";\n\n// ── Types ─────────────────────────────────��───────────────────────────────────\n\nexport type { AgentManifest };\n\n/**\n * All data an {@link AgentRenderer} needs to produce a native agent definition file.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport interface AgentRenderInput {\n /** Parsed `agent.yaml` manifest for the GitAgent being rendered. */\n manifest: AgentManifest;\n /** Raw content of `SOUL.md`, or `null` if absent. */\n soul: string | null;\n /** Raw content of `RULES.md`, or `null` if absent. */\n rules: string | null;\n /** Raw content of `DUTIES.md`, or `null` if absent. */\n duties: string | null;\n /** Agent name used as the output filename and frontmatter `name` field. */\n agentName: string;\n /** Resolved absolute path to the framework's agent deploy directory (e.g. `.claude/agents/`). */\n agentDeployDir: string;\n /** Absolute path to the workspace root. */\n workspaceRoot: string;\n /** Resolved ability refs — installed skills referenced in the `## Installed Abilities` section. */\n abilityRefs: AbilityRef[];\n /** Resolved contract refs — installed in the skills dir, listed in the `## Contracts` section. */\n contractRefs: ContractRef[];\n /** Resolved framework fragment markdown blocks (agent-mode, handoff, skill-discovery, etc.). */\n frameworkFragments: string[];\n /** Per-project prompt extension markdown blocks loaded from `skaile.yaml` `agent.prompt-extensions`. */\n promptExtensions: string[];\n /** `standing` (long-running identity) or `role` (short-lived, callable). */\n lifecycle: AgentLifecycle;\n /** Names of the skills the agent composes (`composes[{kind: skill}]`), as installed. */\n skills: string[];\n /** Names of the MCP servers the agent's `mcp-server` slots are bound to. */\n mcpServers: string[];\n}\n\n/**\n * Result returned by every {@link AgentRenderer}.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport interface AgentRenderResult {\n /** Paths to files/dirs rendered, relative to `workspaceRoot`. */\n created: string[];\n /** The subset of `created` whose bytes differ from what was on disk before (new or edited); an identical rewrite is skipped. */\n changed: string[];\n /** Non-fatal warnings (e.g. experimental feature notices). */\n warnings: string[];\n}\n\n/**\n * A function that transforms an {@link AgentRenderInput} into framework-native agent definition files.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport type AgentRenderer = (input: AgentRenderInput) => AgentRenderResult;\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\n/**\n * Write an agent definition file. Agents are compiled artifacts — they must\n * reflect the current canonical source — but a file that already holds exactly\n * these bytes is left untouched (mtime included), so a repeat install is a no-op.\n * `created` lists every rendered path; `changed` only those that were (re)written.\n */\nfunction writeAgent(\n filePath: string,\n content: string,\n workspaceRoot: string,\n created: string[],\n changed: string[],\n): void {\n const rel = relative(workspaceRoot, filePath);\n created.push(rel);\n if (existsSync(filePath)) {\n try {\n if (readFileSync(filePath, \"utf-8\") === content) return;\n } catch {\n // unreadable (e.g. a directory in the way): fall through to the write\n }\n }\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, content, \"utf-8\");\n changed.push(rel);\n}\n\n/**\n * Build the full agent system prompt body baked into the framework-native agent file.\n *\n * This is the sole source of the agent's system prompt body. Agent identity is rendered at install time; the harness reads it natively at runtime.\n * The rendered output ends up in .claude/agents/<name>.md, .omp/agents/<name>/SOUL.md,\n * .codex/agents/<name>.toml and is read natively by the framework on every agent invocation.\n *\n * Section order is owned by the shared builder (`buildAgentPromptSections` in\n * core, the same one the runner assembles its system prompt with):\n * soul → `<MEMORY>` → framework fragments → `## Constraints` (RULES) →\n * `## Duties` → `## Installed Abilities` → `## Contracts` → composed inline\n * blocks → prompt extensions.\n */\nfunction buildMarkdownBody(\n soul: string | null,\n rules: string | null,\n duties: string | null,\n abilityRefs: AbilityRef[],\n contractRefs: ContractRef[],\n frameworkFragments: string[],\n promptExtensions: string[],\n): string {\n const sections = buildAgentPromptSections({\n soul,\n constraints: rules,\n duties,\n abilities: abilityRefs,\n contracts: contractRefs,\n frameworkFragments,\n promptExtensions,\n });\n return `${sections.map((s) => s.text).join(\"\\n\\n\")}\\n`;\n}\n\n/** Escape a string for use as a TOML multi-line basic string (triple-quote). */\nfunction toTomlMultilineString(s: string): string {\n // Replace \"\"\" with \\\\\"\"\" to avoid breaking the TOML literal\n return s.replace(/\"\"\"/g, '\\\\\"\\\\\"\\\\\"');\n}\n\n// ── Claude Code ────────────��──────────────────────────────────────────────────\n// Format: .claude/agents/<name>.md\n// Sub-agent support: automatic (description-based) + @-mention\n// Required frontmatter: name, description\n//\n// Installation → runtime handoff:\n// skaile install (claudeCodeRenderer) creates the .md file from GitAgent source\n// ClaudeSdkDriver.startQuery() passes options.agent = agentName to the SDK query\n// The SDK reads .claude/agents/<agentName>.md to get model, tools, and system prompt\n// This is equivalent to running: claude --agent <agentName>\n\n/**\n * Render a GitAgent to Claude Code's `.claude/agents/<name>.md` format.\n *\n * Writes YAML frontmatter (name, description, model, tools, skills, mcpServers,\n * maxTurns, background) followed by the enriched system prompt body. `skills`\n * lists the composed skills, `mcpServers` the MCP servers the agent's\n * `mcp-server` slots are bound to, and `background: true` marks a `role`\n * instance whose `runtime.background` is set. Always overwrites to reflect\n * current source.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const claudeCodeRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n lifecycle,\n skills,\n mcpServers,\n}) => {\n const created: string[] = [];\n const changed: string[] = [];\n const warnings: string[] = [];\n\n const frontmatter: Record<string, unknown> = {\n name: agentName,\n description: manifest.description ?? `${agentName} agent`,\n };\n\n // Model: map to Claude Code's model field. Accepts aliases (sonnet/opus/haiku/inherit)\n // or a full Anthropic ID. Unrecognized values (e.g. legacy `claude-opus-4`) are\n // coerced to the matching family alias so the agent still loads.\n if (manifest.model?.preferred) {\n const raw = manifest.model.preferred;\n const normalized = normalizeAnthropicModel(raw);\n if (normalized !== raw) {\n warnings.push(\n `agent ${agentName}: model \"${raw}\" is not a valid Claude model ID; normalized to alias \"${normalized}\". Update agent.yaml.`,\n );\n }\n frontmatter.model = normalized;\n }\n\n // Tool restrictions\n if (manifest.tools?.allowed?.length) {\n frontmatter.tools = manifest.tools.allowed.join(\", \");\n }\n if (manifest.tools?.denied?.length) {\n frontmatter.disallowedTools = manifest.tools.denied.join(\", \");\n }\n\n if (skills.length > 0) frontmatter.skills = skills;\n if (mcpServers.length > 0) frontmatter.mcpServers = mcpServers;\n\n // Runtime\n if (manifest.runtime?.max_turns) {\n frontmatter.maxTurns = manifest.runtime.max_turns;\n }\n if (lifecycle === \"role\" && manifest.runtime?.background === true) {\n frontmatter.background = true;\n }\n\n // Metadata pass-through for Claude Code-specific fields\n if (manifest.metadata?.color) frontmatter.color = manifest.metadata.color;\n if (manifest.metadata?.effort) frontmatter.effort = manifest.metadata.effort;\n if (manifest.metadata?.isolation) frontmatter.isolation = manifest.metadata.isolation;\n\n const body = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n const content = `---\\n${stringifyYaml(frontmatter).trim()}\\n---\\n\\n${body}`;\n const filePath = join(agentDeployDir, `${agentName}.md`);\n writeAgent(filePath, content, workspaceRoot, created, changed);\n\n return { created, changed, warnings };\n};\n\n// ── OpenAI Codex ──────────────────────────────────────────────────────────────\n// Format: .codex/agents/<name>.toml\n// Sub-agent support: explicit user request only (not automatic)\n// Required fields: name, description, developer_instructions\n\n/**\n * Tools that change the workspace or run commands. Codex has no per-agent tool\n * allowlist; the closest per-agent control is `sandbox_mode`, so an agent whose\n * declared tool surface contains none of these is rendered `read-only`.\n */\nconst MUTATING_TOOLS = [\"Write\", \"Edit\", \"MultiEdit\", \"NotebookEdit\", \"Bash\"] as const;\n\n/** `read-only` when the manifest's tool surface cannot mutate anything, else `undefined` (inherit). */\nfunction codexSandboxMode(tools: AgentManifest[\"tools\"]): \"read-only\" | undefined {\n const allowed = tools?.allowed ?? [];\n const denied = new Set(tools?.denied ?? []);\n if (allowed.length > 0) {\n return allowed.some((t) => !denied.has(t) && (MUTATING_TOOLS as readonly string[]).includes(t))\n ? undefined\n : \"read-only\";\n }\n // No allowlist: everything not denied is available.\n return MUTATING_TOOLS.every((t) => denied.has(t)) ? \"read-only\" : undefined;\n}\n\n/** Directory (next to `agents/`) holding each Codex agent's markdown identity, one file per agent. */\nexport const CODEX_IDENTITY_DIR = \"skaile-agents\";\n\n/**\n * Render a GitAgent to OpenAI Codex's `.codex/agents/<name>.toml` format.\n *\n * Produces a TOML file with `name`, `description`, `model`, `sandbox_mode` and\n * `developer_instructions`. `sandbox_mode = \"read-only\"` is the per-agent tool\n * restriction: it is emitted when the manifest's `tools` leave the agent no way\n * to write or run commands (Codex has no per-tool allowlist). Triple-quoted\n * TOML multi-line strings are escaped to avoid syntax errors.\n *\n * Also writes the agent's identity as `.codex/skaile-agents/<name>.md`, which\n * the Codex driver combines with the session's runtime prompt (one file per\n * agent, so several instances never overwrite each other).\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const codexRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n}) => {\n const created: string[] = [];\n const changed: string[] = [];\n const warnings: string[] = [];\n\n const instructions = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n const escaped = toTomlMultilineString(instructions);\n\n const lines: string[] = [\n `name = ${JSON.stringify(agentName)}`,\n `description = ${JSON.stringify(manifest.description ?? `${agentName} agent`)}`,\n ];\n if (manifest.model?.preferred) {\n lines.push(`model = ${JSON.stringify(manifest.model.preferred)}`);\n }\n const sandboxMode = codexSandboxMode(manifest.tools);\n if (sandboxMode) lines.push(`sandbox_mode = ${JSON.stringify(sandboxMode)}`);\n lines.push(`developer_instructions = \"\"\"`, escaped.trim(), `\"\"\"`);\n\n const content = `${lines.join(\"\\n\")}\\n`;\n const filePath = join(agentDeployDir, `${agentName}.toml`);\n writeAgent(filePath, content, workspaceRoot, created, changed);\n\n // Write the full agent identity as markdown for the Codex driver to read at runtime.\n // The driver combines this with the session's dynamic content (resources, context)\n // and passes the result via model_instructions_file.\n const agentMdPath = join(dirname(agentDeployDir), CODEX_IDENTITY_DIR, `${agentName}.md`);\n writeAgent(agentMdPath, instructions, workspaceRoot, created, changed);\n\n return { created, changed, warnings };\n};\n\n// ── oh-my-pi ─��────────────��────────────────────────────────��─────────────────\n// Format: .omp/agents/<name>/ (directory with agent.yaml + SOUL.md + RULES.md)\n// oh-my-pi reads GitAgent directories natively via PI_CODING_AGENT_DIR.\n// The renderer copies/enriches the source directory rather than flattening to .md.\n//\n// Installation → runtime handoff:\n// skaile install (ompRenderer) creates .omp/agents/<name>/ from GitAgent source\n// OmpDriver._start() sets env.PI_CODING_AGENT_DIR = agentDir in the child process\n// omp reads SOUL.md/RULES.md/knowledge/ from that directory natively on startup\n//\n// Note: REPL mode can bypass the install step — agentDir can point directly to the\n// GitAgent source directory, and omp will read it natively via PI_CODING_AGENT_DIR.\n// The rendered .omp/agents/ copy is only needed when the source is not accessible\n// from the project cwd (e.g. different repo, remote workspace).\n\n/**\n * Render a GitAgent to oh-my-pi's `.omp/agents/<name>/` directory format.\n *\n * Writes `agent.yaml` (resolved model/tools/delegation plus the 0.2\n * declaration — `composes` verbatim, `lifecycle`, `io`, `memory`, `triggers`,\n * `capabilities`) and an enriched `SOUL.md` that includes fragments and\n * extensions. omp reads this directory natively via the `PI_CODING_AGENT_DIR`\n * environment variable.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const ompRenderer: AgentRenderer = ({\n manifest,\n soul,\n rules,\n duties,\n agentName,\n agentDeployDir,\n workspaceRoot,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n lifecycle,\n}) => {\n const created: string[] = [];\n const changed: string[] = [];\n const warnings: string[] = [];\n\n const destDir = join(agentDeployDir, agentName);\n\n // Write agent.yaml with tools resolved\n const agentYaml: Record<string, unknown> = {\n spec_version: manifest.spec_version ?? \"0.2\",\n name: agentName,\n version: manifest.version ?? \"1.0.0\",\n description: manifest.description ?? `${agentName} agent`,\n lifecycle,\n };\n // Pass model through verbatim. omp takes provider-prefixed full IDs and also\n // resolves the family aliases: verified live 2026-09-20 against omp v18.1.10\n // through teamclaude.postxl.com — `--model anthropic/opus` produced\n // `model_change {\"model\":\"anthropic/claude-opus-5\",\"resolvedModelIsFallback\":false}`.\n // (This comment previously asserted the opposite; it was never tested.)\n // A model id is *not* checked here, and no longer by `validateAgent` either:\n // the manifest field is a selector (`@role`, `provider/model`, a bare id) and\n // only the endpoint that serves it knows its namespace — see\n // `resolveManifestModel` in `@skaile/workspaces/bridge`. Do NOT call\n // `normalizeAnthropicModel` here: it coerces an unrecognized id into an\n // Anthropic alias, which for an omp deployment on any other provider\n // substitutes a different model outright.\n if (manifest.model) agentYaml.model = manifest.model;\n if (manifest.tools) agentYaml.tools = manifest.tools;\n if (manifest.delegation) agentYaml.delegation = manifest.delegation;\n if (manifest.runtime) agentYaml.runtime = manifest.runtime;\n if (manifest.io) agentYaml.io = manifest.io;\n if (manifest.memory) agentYaml.memory = manifest.memory;\n if (manifest.triggers?.length) agentYaml.triggers = manifest.triggers;\n if (manifest.capabilities?.length) agentYaml.capabilities = manifest.capabilities;\n if (manifest.composes?.length) agentYaml.composes = manifest.composes;\n if (manifest.tags?.length) agentYaml.tags = manifest.tags;\n if (manifest.metadata) agentYaml.metadata = manifest.metadata;\n\n writeAgent(join(destDir, \"agent.yaml\"), stringifyYaml(agentYaml), workspaceRoot, [], changed);\n\n // Write SOUL.md (enriched with fragments and extensions, like other renderers)\n const enrichedSoul = buildMarkdownBody(\n soul,\n rules,\n duties,\n abilityRefs,\n contractRefs,\n frameworkFragments,\n promptExtensions,\n );\n writeAgent(join(destDir, \"SOUL.md\"), enrichedSoul, workspaceRoot, [], changed);\n\n created.push(relative(workspaceRoot, destDir));\n return { created, changed, warnings };\n};\n\n// ── Renderer registry ──────────────────────────────���──────────────────────────\n\nexport type Log = (msg: string) => void;\nconst noop: Log = () => {};\n\n/**\n * Render an agent to framework-native format via the renderer registry.\n *\n * Shared by both the simple deploy path (`deployAsset`) and the enriched scaffold path (agents layer).\n *\n * @param input - Full render input including manifest, SOUL/RULES text, and resolved refs.\n * @param driverTarget - Agent framework ID to look up in {@link AGENT_RENDERERS}.\n * @param log - Optional logger callback for progress messages.\n * @returns Object with `created` file paths and `warnings` list.\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport function renderAgentToFramework(\n input: AgentRenderInput,\n driverTarget: string,\n log: Log = noop,\n): AgentRenderResult {\n const renderer = AGENT_RENDERERS[driverTarget];\n if (!renderer) {\n return {\n created: [],\n changed: [],\n warnings: [`No renderer for framework \"${driverTarget}\"`],\n };\n }\n const result = renderer(input);\n for (const c of result.created) log(` rendered agent: ${c}`);\n for (const w of result.warnings) log(` warn: ${w}`);\n return result;\n}\n\n/**\n * Registry mapping framework IDs to their {@link AgentRenderer} functions.\n *\n * Only harnesses with a full bridge driver are registered. Add new entries\n * when a bridge driver is implemented in `workspaces/bridge/src/drivers/`.\n *\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport const AGENT_RENDERERS: Record<string, AgentRenderer> = {\n \"claude-code\": claudeCodeRenderer,\n omp: ompRenderer,\n codex: codexRenderer,\n};\n\n/**\n * Returns `true` if the given driver target supports file-based sub-agent installation.\n *\n * @param driverTarget - Agent framework ID to check.\n * @returns `true` when `driverTarget` has a registered entry in {@link AGENT_RENDERERS}.\n * @docLink packages/asset-manager/api-reference#renderers\n */\nexport function driverTargetSupportsAgents(driverTarget: string): boolean {\n return driverTarget in AGENT_RENDERERS;\n}\n"]}
|