@skaile/workspaces 6.15.0 → 6.16.1
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 +79 -0
- package/dist/agent-file-refresh-VRD2SNJW.js +89 -0
- package/dist/agent-file-refresh-VRD2SNJW.js.map +1 -0
- package/dist/ai-sdk.js +8 -7
- package/dist/ai-sdk.js.map +1 -1
- package/dist/{asset-feeds-PM7FKHJP.js → asset-feeds-ON7FYHHF.js} +25 -23
- package/dist/asset-feeds-ON7FYHHF.js.map +1 -0
- package/dist/asset-manager/catalog-deployer.js +8 -7
- package/dist/asset-manager/history.js +7 -6
- package/dist/asset-manager/index.js +17 -15
- package/dist/asset-manager/installer.js +16 -9
- package/dist/asset-manager/renderers.js +8 -8
- package/dist/asset-manager/src/add-remove/add.d.ts +134 -0
- package/dist/asset-manager/src/add-remove/add.d.ts.map +1 -0
- package/dist/asset-manager/src/add-remove/remove.d.ts +329 -0
- package/dist/asset-manager/src/add-remove/remove.d.ts.map +1 -0
- package/dist/asset-manager/src/agent-render.d.ts +116 -0
- package/dist/asset-manager/src/agent-render.d.ts.map +1 -0
- package/dist/asset-manager/src/composed-blocks.d.ts +40 -0
- package/dist/asset-manager/src/composed-blocks.d.ts.map +1 -0
- package/dist/asset-manager/src/config/core.d.ts +297 -0
- package/dist/asset-manager/src/config/core.d.ts.map +1 -0
- package/dist/asset-manager/src/config/edit.d.ts +161 -0
- package/dist/asset-manager/src/config/edit.d.ts.map +1 -0
- package/dist/asset-manager/src/index.d.ts +31 -2961
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/install/clone-commit-fetcher.d.ts +11 -0
- package/dist/asset-manager/src/install/clone-commit-fetcher.d.ts.map +1 -0
- package/dist/asset-manager/src/install/install.d.ts +151 -0
- package/dist/asset-manager/src/install/install.d.ts.map +1 -0
- package/dist/asset-manager/src/install/restore.d.ts +76 -0
- package/dist/asset-manager/src/install/restore.d.ts.map +1 -0
- package/dist/asset-manager/src/install-agent.d.ts +52 -4
- package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
- package/dist/asset-manager/src/install-instances.d.ts +70 -2
- package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +54 -4
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/asset-manager/src/lock/copies.d.ts +156 -0
- package/dist/asset-manager/src/lock/copies.d.ts.map +1 -0
- package/dist/asset-manager/src/lock/library.d.ts +261 -0
- package/dist/asset-manager/src/lock/library.d.ts.map +1 -0
- package/dist/asset-manager/src/mcp-render.d.ts +86 -0
- package/dist/asset-manager/src/mcp-render.d.ts.map +1 -0
- package/dist/asset-manager/src/omp-sweep.d.ts +25 -0
- package/dist/asset-manager/src/omp-sweep.d.ts.map +1 -0
- package/dist/asset-manager/src/read/diff.d.ts +109 -0
- package/dist/asset-manager/src/read/diff.d.ts.map +1 -0
- package/dist/asset-manager/src/read/doctor.d.ts +116 -0
- package/dist/asset-manager/src/read/doctor.d.ts.map +1 -0
- package/dist/asset-manager/src/read/gaps.d.ts +120 -0
- package/dist/asset-manager/src/read/gaps.d.ts.map +1 -0
- package/dist/asset-manager/src/read/graph.d.ts +69 -0
- package/dist/asset-manager/src/read/graph.d.ts.map +1 -0
- package/dist/asset-manager/src/read/outdated.d.ts +152 -0
- package/dist/asset-manager/src/read/outdated.d.ts.map +1 -0
- package/dist/asset-manager/src/read/state.d.ts +265 -0
- package/dist/asset-manager/src/read/state.d.ts.map +1 -0
- package/dist/asset-manager/src/renderers.d.ts +11 -1
- package/dist/asset-manager/src/renderers.d.ts.map +1 -1
- package/dist/asset-manager/src/resolve/guards.d.ts +167 -0
- package/dist/asset-manager/src/resolve/guards.d.ts.map +1 -0
- package/dist/asset-manager/src/resolve/scan.d.ts +222 -0
- package/dist/asset-manager/src/resolve/scan.d.ts.map +1 -0
- package/dist/asset-manager/src/resolve/stores.d.ts +176 -0
- package/dist/asset-manager/src/resolve/stores.d.ts.map +1 -0
- package/dist/asset-manager/src/shared/files.d.ts +42 -0
- package/dist/asset-manager/src/shared/files.d.ts.map +1 -0
- package/dist/asset-manager/src/shared/library-hooks.d.ts +16 -0
- package/dist/asset-manager/src/shared/library-hooks.d.ts.map +1 -0
- package/dist/asset-manager/src/shared/library.d.ts +96 -0
- package/dist/asset-manager/src/shared/library.d.ts.map +1 -0
- package/dist/asset-manager/src/shared/refs.d.ts +101 -0
- package/dist/asset-manager/src/shared/refs.d.ts.map +1 -0
- package/dist/asset-manager/src/shared/types.d.ts +399 -0
- package/dist/asset-manager/src/shared/types.d.ts.map +1 -0
- package/dist/bridge/harnesses/claude-sdk.js +11 -17
- package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
- package/dist/bridge/harnesses/codex.js +10 -10
- package/dist/bridge/harnesses/continue.js +12 -16
- package/dist/bridge/harnesses/continue.js.map +1 -1
- package/dist/bridge/harnesses/echo.js +3 -8
- package/dist/bridge/harnesses/echo.js.map +1 -1
- package/dist/bridge/harnesses/gemini.js +5 -5
- package/dist/bridge/harnesses/goose.js +13 -17
- package/dist/bridge/harnesses/goose.js.map +1 -1
- package/dist/bridge/harnesses/omp.js +5 -11
- package/dist/bridge/harnesses/omp.js.map +1 -1
- package/dist/bridge/harnesses/opencode.js +13 -17
- package/dist/bridge/harnesses/opencode.js.map +1 -1
- package/dist/bridge/harnesses/qwen.js +6 -11
- package/dist/bridge/harnesses/qwen.js.map +1 -1
- package/dist/bridge/index.js +16 -16
- package/dist/bridge/src/codex/managed-harness.d.ts.map +1 -1
- package/dist/bridge/src/driver-contract.d.ts +72 -0
- package/dist/bridge/src/driver-contract.d.ts.map +1 -0
- package/dist/bridge/src/harness-model-check.d.ts +1 -1
- package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/_subprocess-cli.d.ts +8 -0
- package/dist/bridge/src/harnesses/_subprocess-cli.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/codex.d.ts +2 -0
- package/dist/bridge/src/harnesses/codex.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/continue.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/echo.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/gemini.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/goose.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/omp.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/opencode.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/qwen.d.ts.map +1 -1
- package/dist/bridge/src/index.d.ts +2 -0
- package/dist/bridge/src/index.d.ts.map +1 -1
- package/dist/bridge/src/preflight.d.ts +114 -0
- package/dist/bridge/src/preflight.d.ts.map +1 -0
- package/dist/bridge/src/registry.d.ts +12 -0
- package/dist/bridge/src/registry.d.ts.map +1 -1
- package/dist/{chunk-MUQBP2BK.js → chunk-2JUCWMIS.js} +8808 -8337
- package/dist/chunk-2JUCWMIS.js.map +1 -0
- package/dist/{chunk-VS6XC5JE.js → chunk-2MTRRK37.js} +3 -3
- package/dist/{chunk-VS6XC5JE.js.map → chunk-2MTRRK37.js.map} +1 -1
- package/dist/chunk-2PJYJPDE.js +3 -0
- package/dist/chunk-2PJYJPDE.js.map +1 -0
- package/dist/{chunk-J7FEWDRQ.js → chunk-2SSG5B24.js} +4 -4
- package/dist/{chunk-J7FEWDRQ.js.map → chunk-2SSG5B24.js.map} +1 -1
- package/dist/{chunk-WDG5IVEA.js → chunk-2ZDZJ7XQ.js} +3 -3
- package/dist/{chunk-WDG5IVEA.js.map → chunk-2ZDZJ7XQ.js.map} +1 -1
- package/dist/{chunk-V2VDTQ7A.js → chunk-3A7JUOY2.js} +3 -3
- package/dist/{chunk-V2VDTQ7A.js.map → chunk-3A7JUOY2.js.map} +1 -1
- package/dist/{chunk-R7422XD4.js → chunk-3CRZJR7E.js} +20 -14
- package/dist/chunk-3CRZJR7E.js.map +1 -0
- package/dist/chunk-3LAJJURV.js +26 -0
- package/dist/chunk-3LAJJURV.js.map +1 -0
- package/dist/{chunk-FJJEC6O2.js → chunk-3UYKT62L.js} +5 -5
- package/dist/{chunk-FJJEC6O2.js.map → chunk-3UYKT62L.js.map} +1 -1
- package/dist/{chunk-HCIXCCUH.js → chunk-4X5WXQV7.js} +4 -4
- package/dist/{chunk-HCIXCCUH.js.map → chunk-4X5WXQV7.js.map} +1 -1
- package/dist/chunk-4ZNKEDYH.js +887 -0
- package/dist/chunk-4ZNKEDYH.js.map +1 -0
- package/dist/{chunk-OIWFXUZB.js → chunk-6M44OQKH.js} +40 -44
- package/dist/chunk-6M44OQKH.js.map +1 -0
- package/dist/{chunk-SXRN27TU.js → chunk-72DYHOO2.js} +24 -25
- package/dist/chunk-72DYHOO2.js.map +1 -0
- package/dist/{chunk-BNLXZXZN.js → chunk-BRAOB37W.js} +97 -47
- package/dist/chunk-BRAOB37W.js.map +1 -0
- package/dist/{chunk-ZLDAPZIX.js → chunk-BTMSHGN3.js} +4 -4
- package/dist/{chunk-ZLDAPZIX.js.map → chunk-BTMSHGN3.js.map} +1 -1
- package/dist/{chunk-7K73MCI6.js → chunk-CU5WY6HN.js} +3 -3
- package/dist/{chunk-7K73MCI6.js.map → chunk-CU5WY6HN.js.map} +1 -1
- package/dist/{chunk-CG63XGVV.js → chunk-EGKCKWWE.js} +3 -3
- package/dist/{chunk-CG63XGVV.js.map → chunk-EGKCKWWE.js.map} +1 -1
- package/dist/{chunk-CJO3XKO7.js → chunk-ETGC2MEM.js} +4 -4
- package/dist/{chunk-CJO3XKO7.js.map → chunk-ETGC2MEM.js.map} +1 -1
- package/dist/{chunk-PFBPESW7.js → chunk-FPG36VC4.js} +8 -13
- package/dist/chunk-FPG36VC4.js.map +1 -0
- package/dist/{chunk-SBAUZ7XH.js → chunk-H3PY5DFL.js} +4 -4
- package/dist/{chunk-SBAUZ7XH.js.map → chunk-H3PY5DFL.js.map} +1 -1
- package/dist/{chunk-7HRZACI4.js → chunk-HW4BDJPC.js} +17 -6
- package/dist/chunk-HW4BDJPC.js.map +1 -0
- package/dist/{chunk-7VBD5XUM.js → chunk-IG4YQ7ER.js} +32 -90
- package/dist/chunk-IG4YQ7ER.js.map +1 -0
- package/dist/{chunk-YDMZWVZN.js → chunk-K4763755.js} +8 -8
- package/dist/{chunk-YDMZWVZN.js.map → chunk-K4763755.js.map} +1 -1
- package/dist/{chunk-6WIZC6GM.js → chunk-KDRA6FYE.js} +120 -211
- package/dist/chunk-KDRA6FYE.js.map +1 -0
- package/dist/{chunk-KOI7QFDH.js → chunk-M7XIYHWB.js} +3 -3
- package/dist/{chunk-KOI7QFDH.js.map → chunk-M7XIYHWB.js.map} +1 -1
- package/dist/{chunk-7LJUK5JK.js → chunk-MG6QD7GE.js} +201 -43
- package/dist/chunk-MG6QD7GE.js.map +1 -0
- package/dist/{chunk-CWUHUL6W.js → chunk-NAQXDTF3.js} +3 -3
- package/dist/{chunk-CWUHUL6W.js.map → chunk-NAQXDTF3.js.map} +1 -1
- package/dist/{chunk-JIZ35OOU.js → chunk-NJ6UCY2B.js} +3 -3
- package/dist/{chunk-JIZ35OOU.js.map → chunk-NJ6UCY2B.js.map} +1 -1
- package/dist/{chunk-A3G3FHGB.js → chunk-NNJQQYHY.js} +2 -2
- package/dist/{chunk-A3G3FHGB.js.map → chunk-NNJQQYHY.js.map} +1 -1
- package/dist/{chunk-TYRAEMWE.js → chunk-OD4N5O7V.js} +4 -4
- package/dist/{chunk-TYRAEMWE.js.map → chunk-OD4N5O7V.js.map} +1 -1
- package/dist/{chunk-LBJCOEXH.js → chunk-P6FJDT35.js} +27 -7
- package/dist/chunk-P6FJDT35.js.map +1 -0
- package/dist/{chunk-IOXFT5D7.js → chunk-PD42JZWI.js} +3 -3
- package/dist/{chunk-IOXFT5D7.js.map → chunk-PD42JZWI.js.map} +1 -1
- package/dist/{chunk-MS2IXLTC.js → chunk-PMXTBWFD.js} +27 -7
- package/dist/chunk-PMXTBWFD.js.map +1 -0
- package/dist/{chunk-O74SRQ3W.js → chunk-PPSSDUN6.js} +3 -3
- package/dist/{chunk-O74SRQ3W.js.map → chunk-PPSSDUN6.js.map} +1 -1
- package/dist/{chunk-IYXOSBQ4.js → chunk-PRB67LCK.js} +126 -17
- package/dist/chunk-PRB67LCK.js.map +1 -0
- package/dist/{chunk-6VQW2X2F.js → chunk-QUIK7L3Z.js} +9 -9
- package/dist/{chunk-6VQW2X2F.js.map → chunk-QUIK7L3Z.js.map} +1 -1
- package/dist/{chunk-DRUAQ7IY.js → chunk-QUPZKTF3.js} +9 -8
- package/dist/chunk-QUPZKTF3.js.map +1 -0
- package/dist/{chunk-7FXOOUOC.js → chunk-RPRMD7XV.js} +27 -11
- package/dist/chunk-RPRMD7XV.js.map +1 -0
- package/dist/{chunk-U7EJB6LY.js → chunk-S3UOZBGE.js} +20 -3
- package/dist/chunk-S3UOZBGE.js.map +1 -0
- package/dist/{chunk-LQWOU7S2.js → chunk-SFBLZOV5.js} +3 -3
- package/dist/{chunk-LQWOU7S2.js.map → chunk-SFBLZOV5.js.map} +1 -1
- package/dist/{chunk-XPSZIBPU.js → chunk-SMCG4PMP.js} +43 -48
- package/dist/chunk-SMCG4PMP.js.map +1 -0
- package/dist/{chunk-EB2LKPI6.js → chunk-SMFZ5YGN.js} +4 -4
- package/dist/{chunk-EB2LKPI6.js.map → chunk-SMFZ5YGN.js.map} +1 -1
- package/dist/{chunk-IRIWNKQS.js → chunk-SX54OQQT.js} +4 -4
- package/dist/{chunk-IRIWNKQS.js.map → chunk-SX54OQQT.js.map} +1 -1
- package/dist/{chunk-2PVYDAFN.js → chunk-T65N4CIZ.js} +3 -3
- package/dist/{chunk-2PVYDAFN.js.map → chunk-T65N4CIZ.js.map} +1 -1
- package/dist/{chunk-C5ZCREBI.js → chunk-TVRL3IPZ.js} +3 -3
- package/dist/{chunk-C5ZCREBI.js.map → chunk-TVRL3IPZ.js.map} +1 -1
- package/dist/{chunk-RKTEHX2S.js → chunk-TW5AP6IF.js} +5 -5
- package/dist/{chunk-RKTEHX2S.js.map → chunk-TW5AP6IF.js.map} +1 -1
- package/dist/{chunk-EMIOFJQJ.js → chunk-TYK752MU.js} +3 -3
- package/dist/{chunk-EMIOFJQJ.js.map → chunk-TYK752MU.js.map} +1 -1
- package/dist/{chunk-HPQ2WDYC.js → chunk-U2WPJHRA.js} +5 -5
- package/dist/{chunk-HPQ2WDYC.js.map → chunk-U2WPJHRA.js.map} +1 -1
- package/dist/{chunk-YLKOCMU7.js → chunk-U6UFPOEK.js} +326 -1058
- package/dist/chunk-U6UFPOEK.js.map +1 -0
- package/dist/{chunk-MEU2HHGV.js → chunk-U7P22GEB.js} +386 -46
- package/dist/chunk-U7P22GEB.js.map +1 -0
- package/dist/{chunk-AEFDFCS2.js → chunk-VFEZUSB6.js} +4 -4
- package/dist/{chunk-AEFDFCS2.js.map → chunk-VFEZUSB6.js.map} +1 -1
- package/dist/{chunk-A4VKIVGB.js → chunk-WW22FS74.js} +75 -67
- package/dist/chunk-WW22FS74.js.map +1 -0
- package/dist/{chunk-72PPC4SC.js → chunk-Z23I2JA6.js} +6 -6
- package/dist/{chunk-72PPC4SC.js.map → chunk-Z23I2JA6.js.map} +1 -1
- package/dist/{chunk-KIFAU62K.js → chunk-Z7HLX4V2.js} +4 -4
- package/dist/{chunk-KIFAU62K.js.map → chunk-Z7HLX4V2.js.map} +1 -1
- package/dist/{chunk-CVUMZTNO.js → chunk-ZQPBYLCS.js} +4 -4
- package/dist/{chunk-CVUMZTNO.js.map → chunk-ZQPBYLCS.js.map} +1 -1
- package/dist/{claude-code-5QYXWC5H.js → claude-code-VL6UM7BZ.js} +4 -4
- package/dist/{claude-code-5QYXWC5H.js.map → claude-code-VL6UM7BZ.js.map} +1 -1
- package/dist/cli/index.js +491 -298
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/agent-file-refresh.d.ts +25 -0
- package/dist/cli/src/agent-file-refresh.d.ts.map +1 -0
- package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +9 -2
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/config.d.ts.map +1 -1
- package/dist/cli/src/commands/harness.d.ts +1 -1
- package/dist/cli/src/commands/harness.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 +5 -7
- 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/preset-export.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/run.d.ts.map +1 -1
- package/dist/cli/src/commands/serve-preflight.d.ts +27 -48
- package/dist/cli/src/commands/serve-preflight.d.ts.map +1 -1
- package/dist/cli/src/commands/serve.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +6 -9
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/validate.d.ts +6 -0
- package/dist/cli/src/commands/validate.d.ts.map +1 -1
- package/dist/cli/src/config-checks.d.ts.map +1 -1
- package/dist/cli/src/harness-error.d.ts +11 -9
- package/dist/cli/src/harness-error.d.ts.map +1 -1
- package/dist/cli/src/skill-checks.d.ts +48 -74
- package/dist/cli/src/skill-checks.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +19 -19
- package/dist/{connectors-DLXW27NQ.js → connectors-7EPJRVLJ.js} +22 -22
- package/dist/{connectors-DLXW27NQ.js.map → connectors-7EPJRVLJ.js.map} +1 -1
- package/dist/core/index.js +7 -6
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.js +1 -1
- package/dist/core/publish-manifest.js +3 -3
- package/dist/core/ref.js +1 -1
- package/dist/core/runtime-assets.js +5 -5
- package/dist/core/src/agent-prompt-sections.d.ts +96 -4
- package/dist/core/src/agent-prompt-sections.d.ts.map +1 -1
- package/dist/core/src/check-asset.d.ts +115 -0
- package/dist/core/src/check-asset.d.ts.map +1 -0
- package/dist/core/src/harness-model.d.ts +20 -0
- package/dist/core/src/harness-model.d.ts.map +1 -0
- package/dist/core/src/index.d.ts +10 -6
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +12 -10
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/models.d.ts +42 -11
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/publish-manifest.d.ts +17 -0
- package/dist/core/src/publish-manifest.d.ts.map +1 -1
- package/dist/core/src/repo-identity.d.ts +41 -0
- package/dist/core/src/repo-identity.d.ts.map +1 -0
- package/dist/core/src/repo-manager.d.ts +3 -9
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/walker.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/workspace-config.js +4 -4
- package/dist/deploy/index.js +7 -6
- package/dist/deploy/index.js.map +1 -1
- package/dist/discovery/index.js +5 -5
- package/dist/discovery/src/source-config.d.ts.map +1 -1
- package/dist/{ensure-sources-I7GCXPXK.js → ensure-sources-CI3JQJST.js} +30 -28
- package/dist/ensure-sources-CI3JQJST.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +19 -19
- package/dist/factory-assets/connectors/deploy.js +19 -19
- package/dist/factory-assets/connectors/devserver.js +19 -19
- package/dist/factory-assets/connectors/flow/adapter.js +19 -19
- package/dist/factory-assets/connectors/flow/engine.js +8 -7
- package/dist/factory-assets/connectors/flow/run-flow.js +21 -21
- package/dist/factory-assets/connectors/flow.js +19 -19
- package/dist/factory-assets/connectors/git.js +19 -19
- package/dist/factory-assets/connectors/gmail.js +19 -19
- package/dist/factory-assets/connectors/googledrive.js +19 -19
- package/dist/factory-assets/connectors/local.js +19 -19
- package/dist/factory-assets/connectors/mattermost.js +19 -19
- package/dist/factory-assets/connectors/memory.js +19 -19
- package/dist/factory-assets/connectors/minio.js +19 -19
- package/dist/factory-assets/connectors/postgres.js +19 -19
- package/dist/factory-assets/connectors/s3.js +19 -19
- package/dist/factory-assets/connectors/sharepoint.js +19 -19
- package/dist/factory-assets/connectors/sqlite.js +19 -19
- package/dist/factory-assets/connectors/static-server.js +19 -19
- package/dist/factory-assets/connectors/tunnel.js +19 -19
- package/dist/factory-assets/connectors/webdav.js +19 -19
- package/dist/factory-assets/connectors/xstate-store.js +19 -19
- package/dist/factory-assets/connectors/xstate.js +19 -19
- package/dist/{flows-J64L5MGJ.js → flows-6XQAYQS4.js} +12 -11
- package/dist/{flows-J64L5MGJ.js.map → flows-6XQAYQS4.js.map} +1 -1
- package/dist/{helpers-U75UGGH5.js → helpers-26MR5QPO.js} +30 -28
- package/dist/{helpers-U75UGGH5.js.map → helpers-26MR5QPO.js.map} +1 -1
- package/dist/library/index.js +10 -10
- package/dist/library/install.js +4 -4
- package/dist/library/src/index.d.ts +1 -1
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/local/db.d.ts.map +1 -1
- package/dist/library/src/local/library-manager.d.ts.map +1 -1
- package/dist/library/src/local/library.d.ts.map +1 -1
- package/dist/library/src/local/schema.d.ts +19 -0
- package/dist/library/src/local/schema.d.ts.map +1 -1
- package/dist/library/src/user-library.d.ts +18 -0
- package/dist/library/src/user-library.d.ts.map +1 -1
- package/dist/{library-publish-57422ULT.js → library-publish-YHYGA6G5.js} +71 -65
- package/dist/library-publish-YHYGA6G5.js.map +1 -0
- package/dist/model-endpoint/index.js +10 -9
- package/dist/{open-library-EVUKLOV7.js → open-library-FVV6GG4I.js} +33 -31
- package/dist/{open-library-EVUKLOV7.js.map → open-library-FVV6GG4I.js.map} +1 -1
- package/dist/{open-registry-4HNCWOCN.js → open-registry-VX2BVMS5.js} +16 -16
- package/dist/{open-registry-4HNCWOCN.js.map → open-registry-VX2BVMS5.js.map} +1 -1
- package/dist/{paths-PXBWY532.js → paths-PIWSSUUG.js} +10 -9
- package/dist/{paths-PXBWY532.js.map → paths-PIWSSUUG.js.map} +1 -1
- package/dist/{plugin-store-ZC3EGZ3D.js → plugin-store-MVTW6G7J.js} +10 -9
- package/dist/{plugin-store-ZC3EGZ3D.js.map → plugin-store-MVTW6G7J.js.map} +1 -1
- package/dist/{project-HB7OYPEF.js → project-BOAHGBMI.js} +47 -45
- package/dist/{project-HB7OYPEF.js.map → project-BOAHGBMI.js.map} +1 -1
- package/dist/resolver/index.js +8 -7
- package/dist/runner/composition-content.d.ts +2 -0
- package/dist/runner/composition-content.js +29 -0
- package/dist/runner/composition-content.js.map +1 -0
- package/dist/runner/index.js +37 -36
- package/dist/runner/src/composition/content-entry.d.ts +15 -0
- package/dist/runner/src/composition/content-entry.d.ts.map +1 -0
- package/dist/runner/src/composition/content-source.d.ts +7 -0
- package/dist/runner/src/composition/content-source.d.ts.map +1 -1
- package/dist/runner/src/composition/dry-run.d.ts +5 -1
- package/dist/runner/src/composition/dry-run.d.ts.map +1 -1
- package/dist/runner/src/composition/index.d.ts +1 -1
- package/dist/runner/src/composition/index.d.ts.map +1 -1
- package/dist/runner/src/composition/prompt-sections.d.ts +47 -20
- package/dist/runner/src/composition/prompt-sections.d.ts.map +1 -1
- package/dist/runner/src/external-mcp.d.ts +32 -7
- package/dist/runner/src/external-mcp.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts +3 -8
- package/dist/runner/src/session-builder.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +17 -15
- package/dist/sdk/bridge.js +16 -16
- package/dist/sdk/core.js +7 -6
- package/dist/sdk/flow.js +8 -7
- package/dist/sdk/index.js +37 -36
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +8 -7
- package/dist/sdk/runner.js +37 -36
- package/dist/sdk/transport/ws/server.js +8 -7
- package/dist/sdk/transport/ws.js +8 -7
- package/dist/sdk/transport.js +8 -7
- package/dist/serve-preflight-XJS5OZML.js +138 -0
- package/dist/serve-preflight-XJS5OZML.js.map +1 -0
- package/dist/{setup-2XV6T53V.js → setup-BFEBJLYF.js} +31 -29
- package/dist/setup-BFEBJLYF.js.map +1 -0
- package/dist/{skills-5D4KDVPJ.js → skills-OCG7B5CL.js} +13 -12
- package/dist/{skills-5D4KDVPJ.js.map → skills-OCG7B5CL.js.map} +1 -1
- package/dist/source-J2MJIHDS.js +93 -0
- package/dist/{source-VXE3RSSA.js.map → source-J2MJIHDS.js.map} +1 -1
- package/dist/{source-manifest-publish-IIVQLM67.js → source-manifest-publish-6MYDXCKZ.js} +51 -49
- package/dist/source-manifest-publish-6MYDXCKZ.js.map +1 -0
- package/dist/transport/index.js +8 -7
- package/dist/transport/ws/server.js +8 -7
- package/dist/transport/ws.js +8 -7
- package/dist/tui/index.js +37 -36
- package/dist/tui/index.js.map +1 -1
- package/dist/types/src/runtime.d.ts +6 -0
- package/dist/types/src/runtime.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +26 -26
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +7 -1
- package/dist/asset-feeds-PM7FKHJP.js.map +0 -1
- package/dist/chunk-2RVEYDQK.js +0 -110
- package/dist/chunk-2RVEYDQK.js.map +0 -1
- package/dist/chunk-6WIZC6GM.js.map +0 -1
- package/dist/chunk-7FXOOUOC.js.map +0 -1
- package/dist/chunk-7HRZACI4.js.map +0 -1
- package/dist/chunk-7LJUK5JK.js.map +0 -1
- package/dist/chunk-7VBD5XUM.js.map +0 -1
- package/dist/chunk-A4VKIVGB.js.map +0 -1
- package/dist/chunk-BNLXZXZN.js.map +0 -1
- package/dist/chunk-DRUAQ7IY.js.map +0 -1
- package/dist/chunk-IYXOSBQ4.js.map +0 -1
- package/dist/chunk-LBJCOEXH.js.map +0 -1
- package/dist/chunk-MEU2HHGV.js.map +0 -1
- package/dist/chunk-MS2IXLTC.js.map +0 -1
- package/dist/chunk-MUQBP2BK.js.map +0 -1
- package/dist/chunk-OIWFXUZB.js.map +0 -1
- package/dist/chunk-PFBPESW7.js.map +0 -1
- package/dist/chunk-R7422XD4.js.map +0 -1
- package/dist/chunk-SXRN27TU.js.map +0 -1
- package/dist/chunk-U7EJB6LY.js.map +0 -1
- package/dist/chunk-XPSZIBPU.js.map +0 -1
- package/dist/chunk-YLKOCMU7.js.map +0 -1
- package/dist/cli/src/commands/harness-preflight.d.ts +0 -40
- package/dist/cli/src/commands/harness-preflight.d.ts.map +0 -1
- package/dist/ensure-sources-I7GCXPXK.js.map +0 -1
- package/dist/library-publish-57422ULT.js.map +0 -1
- package/dist/serve-preflight-YY3YC6GH.js +0 -61
- package/dist/serve-preflight-YY3YC6GH.js.map +0 -1
- package/dist/setup-2XV6T53V.js.map +0 -1
- package/dist/source-VXE3RSSA.js +0 -91
- package/dist/source-manifest-publish-IIVQLM67.js.map +0 -1
|
@@ -0,0 +1,887 @@
|
|
|
1
|
+
import { knowledgeKindProvider, scanLibraryRoot, LocalIndex } from './chunk-RPRMD7XV.js';
|
|
2
|
+
import { createDefaultKindRegistry } from './chunk-QUPZKTF3.js';
|
|
3
|
+
import { readLock, assembleAgent } from './chunk-U7P22GEB.js';
|
|
4
|
+
import { matchPin, getGlobalCacheDir, sourceCacheKey, sameRepo, resolveSkWorkspaceConfig } from './chunk-BRAOB37W.js';
|
|
5
|
+
import { harnessNameForHarnessId, HARNESS_TARGETS } from './chunk-VTETQCR6.js';
|
|
6
|
+
import { BindingSchema } from './chunk-LCXQ4LVP.js';
|
|
7
|
+
import fs3 from 'fs/promises';
|
|
8
|
+
import path2, { join, dirname } from 'path';
|
|
9
|
+
import { parse } from 'yaml';
|
|
10
|
+
import { spawnSync } from 'child_process';
|
|
11
|
+
import { createHash } from 'crypto';
|
|
12
|
+
import { readdirSync, statSync, existsSync, mkdirSync, writeFileSync, readFileSync, realpathSync } from 'fs';
|
|
13
|
+
import * as z from 'zod';
|
|
14
|
+
|
|
15
|
+
// runner/src/composition/errors.ts
|
|
16
|
+
var CompositionError = class extends Error {
|
|
17
|
+
constructor(code, reason, message, ref, moved) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.code = code;
|
|
20
|
+
this.reason = reason;
|
|
21
|
+
this.ref = ref;
|
|
22
|
+
this.moved = moved;
|
|
23
|
+
this.name = "CompositionError";
|
|
24
|
+
}
|
|
25
|
+
code;
|
|
26
|
+
reason;
|
|
27
|
+
ref;
|
|
28
|
+
moved;
|
|
29
|
+
};
|
|
30
|
+
function isCompositionError(err, code) {
|
|
31
|
+
return err instanceof CompositionError && (code === void 0 || err.code === code);
|
|
32
|
+
}
|
|
33
|
+
async function resolveMixin(ref, defaultKind, agentDir, repos) {
|
|
34
|
+
if (ref.startsWith(".") || ref.startsWith("/")) {
|
|
35
|
+
const absPath = ref.startsWith("/") ? ref : path2.join(agentDir, ref);
|
|
36
|
+
if (defaultKind === "knowledge") {
|
|
37
|
+
return loadKnowledgeDir(absPath);
|
|
38
|
+
}
|
|
39
|
+
const content = await readFileSafe(absPath);
|
|
40
|
+
if (!content) return null;
|
|
41
|
+
return { content: stripFrontmatter(content).trim(), source: absPath };
|
|
42
|
+
}
|
|
43
|
+
const { kind, name, repoQualifier } = parseRef(ref, defaultKind);
|
|
44
|
+
const entry = findInRepos(repos, kind, name, repoQualifier);
|
|
45
|
+
if (!entry) return null;
|
|
46
|
+
if (entry.kind === "knowledge") {
|
|
47
|
+
return loadKnowledgeDir(path2.dirname(entry.source));
|
|
48
|
+
}
|
|
49
|
+
const raw = await readFileSafe(entry.source);
|
|
50
|
+
if (!raw) return null;
|
|
51
|
+
return { content: stripFrontmatter(raw).trim(), source: entry.source };
|
|
52
|
+
}
|
|
53
|
+
async function readFileSafe(filePath) {
|
|
54
|
+
try {
|
|
55
|
+
return await fs3.readFile(filePath, "utf-8");
|
|
56
|
+
} catch {
|
|
57
|
+
return "";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function stripFrontmatter(text) {
|
|
61
|
+
return text.replace(/^---\s*\n[\s\S]*?\n---\s*\n?/, "");
|
|
62
|
+
}
|
|
63
|
+
function parseRef(ref, defaultKind) {
|
|
64
|
+
let rest = ref.trim();
|
|
65
|
+
let kind = defaultKind;
|
|
66
|
+
const colonIdx = rest.indexOf(":");
|
|
67
|
+
if (colonIdx !== -1) {
|
|
68
|
+
kind = rest.slice(0, colonIdx).trim();
|
|
69
|
+
rest = rest.slice(colonIdx + 1).trim();
|
|
70
|
+
}
|
|
71
|
+
const hashIdx = rest.indexOf("#");
|
|
72
|
+
if (hashIdx !== -1) rest = rest.slice(0, hashIdx).trim();
|
|
73
|
+
let repoQualifier;
|
|
74
|
+
const atIdx = rest.indexOf("@");
|
|
75
|
+
if (atIdx !== -1) {
|
|
76
|
+
repoQualifier = rest.slice(atIdx + 1).trim() || void 0;
|
|
77
|
+
rest = rest.slice(0, atIdx).trim();
|
|
78
|
+
}
|
|
79
|
+
return { kind, name: rest, repoQualifier };
|
|
80
|
+
}
|
|
81
|
+
function findInRepos(repos, kind, name, repoQualifier) {
|
|
82
|
+
const searchRepos = repoQualifier ? repos[repoQualifier] ? [repos[repoQualifier]] : [] : Object.values(repos);
|
|
83
|
+
for (const entries of searchRepos) {
|
|
84
|
+
const found = entries.find((e) => e.kind === kind && e.name === name);
|
|
85
|
+
if (found) return found;
|
|
86
|
+
}
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
function isEmptyKnowledgeIndex(text) {
|
|
90
|
+
if (!text) return false;
|
|
91
|
+
let parsed;
|
|
92
|
+
try {
|
|
93
|
+
parsed = parse(text);
|
|
94
|
+
} catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return false;
|
|
98
|
+
const documents = parsed.documents;
|
|
99
|
+
return Array.isArray(documents) && documents.length === 0;
|
|
100
|
+
}
|
|
101
|
+
async function loadKnowledgeDir(dir) {
|
|
102
|
+
let entries;
|
|
103
|
+
try {
|
|
104
|
+
entries = (await fs3.readdir(dir)).filter((e) => e.endsWith(".md"));
|
|
105
|
+
} catch {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
const priorityMap = {};
|
|
109
|
+
const indexContent = await readFileSafe(path2.join(dir, "index.yaml"));
|
|
110
|
+
if (indexContent) {
|
|
111
|
+
const pathMatches = [...indexContent.matchAll(/path:\s*(\S+)/g)];
|
|
112
|
+
const priorityMatches = [...indexContent.matchAll(/priority:\s*(\d+)/g)];
|
|
113
|
+
pathMatches.forEach((m, i) => {
|
|
114
|
+
const filename = m[1];
|
|
115
|
+
if (!filename) return;
|
|
116
|
+
const priority = priorityMatches[i] ? parseInt(priorityMatches[i][1] ?? "99", 10) : 99;
|
|
117
|
+
priorityMap[filename] = priority;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const docs = await Promise.all(
|
|
121
|
+
entries.map(async (filename) => ({
|
|
122
|
+
filename,
|
|
123
|
+
priority: priorityMap[filename] ?? 99,
|
|
124
|
+
content: (await readFileSafe(path2.join(dir, filename))).trim()
|
|
125
|
+
}))
|
|
126
|
+
);
|
|
127
|
+
const sorted = docs.filter((d) => d.content).sort((a, b) => a.priority - b.priority || a.filename.localeCompare(b.filename));
|
|
128
|
+
if (sorted.length === 0) {
|
|
129
|
+
return isEmptyKnowledgeIndex(indexContent) ? { content: indexContent, source: dir } : null;
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
content: sorted.map((d) => d.content).join("\n\n---\n\n"),
|
|
133
|
+
source: dir
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function parseCatalogRef(ref) {
|
|
137
|
+
let rest = ref.trim();
|
|
138
|
+
const kindPrefix = /^([a-z][a-z0-9-]*):(?!\/\/)/.exec(rest);
|
|
139
|
+
if (kindPrefix) rest = rest.slice(kindPrefix[0].length);
|
|
140
|
+
let pin;
|
|
141
|
+
const hash = rest.indexOf("#");
|
|
142
|
+
if (hash !== -1) {
|
|
143
|
+
pin = rest.slice(hash + 1).trim() || void 0;
|
|
144
|
+
rest = rest.slice(0, hash);
|
|
145
|
+
}
|
|
146
|
+
const scoped = /^@([^/@]+)\/([^@]+)(?:@(.+))?$/.exec(rest);
|
|
147
|
+
if (scoped) {
|
|
148
|
+
return { publisher: scoped[1], name: scoped[2], pin: pin ?? scoped[3]?.trim() };
|
|
149
|
+
}
|
|
150
|
+
const at = rest.indexOf("@");
|
|
151
|
+
if (at !== -1) {
|
|
152
|
+
return { publisher: rest.slice(at + 1) || void 0, name: rest.slice(0, at), pin };
|
|
153
|
+
}
|
|
154
|
+
return { name: rest, pin };
|
|
155
|
+
}
|
|
156
|
+
var LOCK_KEY_RE = /^([a-z][a-z0-9-]*):@([^/]+)\/([^#]+)#(.+)$/;
|
|
157
|
+
var barePublisher = (p) => p.startsWith("@") ? p.slice(1) : p;
|
|
158
|
+
var sha256Of = (text) => createHash("sha256").update(text).digest("hex");
|
|
159
|
+
var CatalogScanner = class {
|
|
160
|
+
constructor(projectDir, registry, explicitRoots) {
|
|
161
|
+
this.projectDir = projectDir;
|
|
162
|
+
this.registry = registry;
|
|
163
|
+
this.roots = explicitRoots;
|
|
164
|
+
}
|
|
165
|
+
projectDir;
|
|
166
|
+
registry;
|
|
167
|
+
scans = /* @__PURE__ */ new Map();
|
|
168
|
+
roots;
|
|
169
|
+
/** Every discovered asset of `kind` named `name` under one root (any root, declared or not). */
|
|
170
|
+
findIn(root, kind, name) {
|
|
171
|
+
return this.scan(root).filter((hit) => hit.asset.kind === kind && hit.asset.name === name);
|
|
172
|
+
}
|
|
173
|
+
/** Every discovered asset of `kind` named `name`, across all roots. */
|
|
174
|
+
find(kind, name) {
|
|
175
|
+
const out = [];
|
|
176
|
+
for (const root of this.resolveRoots()) {
|
|
177
|
+
for (const hit of this.scan(root)) {
|
|
178
|
+
if (hit.asset.kind === kind && hit.asset.name === name) out.push(hit);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return out;
|
|
182
|
+
}
|
|
183
|
+
scan(root) {
|
|
184
|
+
let cached = this.scans.get(root);
|
|
185
|
+
if (!cached) {
|
|
186
|
+
try {
|
|
187
|
+
cached = scanLibraryRoot(root, this.registry).assets.map((asset) => ({ asset, root }));
|
|
188
|
+
} catch {
|
|
189
|
+
cached = [];
|
|
190
|
+
}
|
|
191
|
+
this.scans.set(root, cached);
|
|
192
|
+
}
|
|
193
|
+
return cached;
|
|
194
|
+
}
|
|
195
|
+
resolveRoots() {
|
|
196
|
+
if (!this.roots) this.roots = defaultCatalogRoots(this.projectDir);
|
|
197
|
+
return this.roots;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
function defaultCatalogRoots(projectDir) {
|
|
201
|
+
const roots = /* @__PURE__ */ new Set();
|
|
202
|
+
const add = (dir2) => {
|
|
203
|
+
if (!dir2 || !existsSync(dir2)) return;
|
|
204
|
+
try {
|
|
205
|
+
if (statSync(dir2).isDirectory()) roots.add(realpathSync(dir2));
|
|
206
|
+
} catch {
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
let dir = path2.resolve(projectDir);
|
|
210
|
+
for (let i = 0; i < 8; i++) {
|
|
211
|
+
const candidate = path2.join(dir, "ai-assets");
|
|
212
|
+
if (existsSync(candidate)) {
|
|
213
|
+
add(candidate);
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
const parent = path2.resolve(dir, "..");
|
|
217
|
+
if (parent === dir) break;
|
|
218
|
+
dir = parent;
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
for (const source of resolveSkWorkspaceConfig(projectDir).sources ?? []) {
|
|
222
|
+
add(path2.join(getGlobalCacheDir(), sourceCacheKey(source.url)));
|
|
223
|
+
}
|
|
224
|
+
} catch {
|
|
225
|
+
}
|
|
226
|
+
const projectSources = path2.join(projectDir, ".skaile", "cache", "sources");
|
|
227
|
+
try {
|
|
228
|
+
for (const entry of readdirSync(projectSources)) add(path2.join(projectSources, entry));
|
|
229
|
+
} catch {
|
|
230
|
+
}
|
|
231
|
+
return [...roots];
|
|
232
|
+
}
|
|
233
|
+
async function registeredLibraryRoots(origin) {
|
|
234
|
+
let index;
|
|
235
|
+
try {
|
|
236
|
+
index = new LocalIndex();
|
|
237
|
+
const libraries = await index.listSources();
|
|
238
|
+
const byName = libraries.filter((l) => l.name === origin.name);
|
|
239
|
+
const byUrl = byName.length === 0 && origin.url ? libraries.filter((l) => {
|
|
240
|
+
const url = l.backendConfig.url;
|
|
241
|
+
return typeof url === "string" && sameRepo(url, origin.url ?? "");
|
|
242
|
+
}) : [];
|
|
243
|
+
return [...byName, ...byUrl].map((l) => l.path).filter((dir) => existsSync(dir));
|
|
244
|
+
} catch {
|
|
245
|
+
return [];
|
|
246
|
+
} finally {
|
|
247
|
+
index?.close();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function createCompositionContentSource(opts) {
|
|
251
|
+
const registry = opts.registry ?? createDefaultKindRegistry([knowledgeKindProvider]);
|
|
252
|
+
const scanner = new CatalogScanner(opts.projectDir, registry, opts.catalogRoots);
|
|
253
|
+
return new DefaultCompositionContentSource(
|
|
254
|
+
path2.resolve(opts.agentDir),
|
|
255
|
+
path2.resolve(opts.projectDir),
|
|
256
|
+
registry,
|
|
257
|
+
scanner,
|
|
258
|
+
opts.lockAssets
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
var DefaultCompositionContentSource = class _DefaultCompositionContentSource {
|
|
262
|
+
constructor(agentDir, projectDir, registry, scanner, givenLock) {
|
|
263
|
+
this.agentDir = agentDir;
|
|
264
|
+
this.projectDir = projectDir;
|
|
265
|
+
this.registry = registry;
|
|
266
|
+
this.scanner = scanner;
|
|
267
|
+
this.givenLock = givenLock;
|
|
268
|
+
this.lockLoaded = givenLock !== void 0;
|
|
269
|
+
this.lockAssets = givenLock ?? {};
|
|
270
|
+
}
|
|
271
|
+
agentDir;
|
|
272
|
+
projectDir;
|
|
273
|
+
registry;
|
|
274
|
+
scanner;
|
|
275
|
+
givenLock;
|
|
276
|
+
lockLoaded;
|
|
277
|
+
lockAssets;
|
|
278
|
+
scoped(agentDir) {
|
|
279
|
+
return new _DefaultCompositionContentSource(
|
|
280
|
+
path2.resolve(agentDir),
|
|
281
|
+
this.projectDir,
|
|
282
|
+
this.registry,
|
|
283
|
+
this.scanner,
|
|
284
|
+
this.givenLock
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
async load(ref, kind) {
|
|
288
|
+
if (ref.startsWith(".") || ref.startsWith("/")) return this.loadLocal(ref, kind);
|
|
289
|
+
const parsed = parseCatalogRef(ref);
|
|
290
|
+
if (!parsed.name) {
|
|
291
|
+
throw new CompositionError(
|
|
292
|
+
"composition_asset_missing",
|
|
293
|
+
"missing",
|
|
294
|
+
`"${ref}" (${kind}): not a resolvable ref`,
|
|
295
|
+
ref
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
const locked = this.lockCandidate(ref, kind, parsed);
|
|
299
|
+
if (locked) return this.loadLocked(ref, kind, locked);
|
|
300
|
+
return this.loadFromCatalog(ref, kind, parsed);
|
|
301
|
+
}
|
|
302
|
+
// ── local ────────────────────────────────────────────────────────────────
|
|
303
|
+
async loadLocal(ref, kind) {
|
|
304
|
+
const absPath = ref.startsWith("/") ? ref : path2.join(this.agentDir, ref);
|
|
305
|
+
let target = absPath;
|
|
306
|
+
let resolved = await resolveMixin(ref, kind, this.agentDir, {});
|
|
307
|
+
if (!resolved && kind !== "knowledge" && isDirectory(absPath)) {
|
|
308
|
+
const manifest = this.manifestInDir(kind, absPath);
|
|
309
|
+
if (manifest) {
|
|
310
|
+
target = manifest;
|
|
311
|
+
resolved = await resolveMixin(manifest, kind, this.agentDir, {});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (!resolved) {
|
|
315
|
+
throw new CompositionError(
|
|
316
|
+
"composition_asset_missing",
|
|
317
|
+
"missing",
|
|
318
|
+
`"${ref}" (${kind}): no content at ${absPath}`,
|
|
319
|
+
ref
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
return {
|
|
323
|
+
canonicalRef: `local:${this.relativeToProject(target)}`,
|
|
324
|
+
kind,
|
|
325
|
+
version: null,
|
|
326
|
+
sha256: sha256Of(resolved.content),
|
|
327
|
+
content: resolved.content,
|
|
328
|
+
location: resolved.source
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
manifestInDir(kind, dir) {
|
|
332
|
+
const provider = this.registry.getProvider(kind);
|
|
333
|
+
for (const name of readdirSync(dir).sort()) {
|
|
334
|
+
const matches = provider ? provider.matchesPath(name) : name === `${kind.toUpperCase()}.md`;
|
|
335
|
+
if (matches && statSync(path2.join(dir, name)).isFile()) return path2.join(dir, name);
|
|
336
|
+
}
|
|
337
|
+
return void 0;
|
|
338
|
+
}
|
|
339
|
+
relativeToProject(abs) {
|
|
340
|
+
const rel = path2.relative(this.projectDir, abs).split(path2.sep).join("/");
|
|
341
|
+
return rel.startsWith("..") ? abs : rel;
|
|
342
|
+
}
|
|
343
|
+
// ── lock pin ─────────────────────────────────────────────────────────────
|
|
344
|
+
lockCandidate(ref, kind, parsed) {
|
|
345
|
+
if (!this.lockLoaded) {
|
|
346
|
+
this.lockLoaded = true;
|
|
347
|
+
try {
|
|
348
|
+
this.lockAssets = readLock(path2.join(this.projectDir, "skaile.lock.yaml"))?.assets ?? {};
|
|
349
|
+
} catch (err) {
|
|
350
|
+
throw new CompositionError(
|
|
351
|
+
"composition_conflict",
|
|
352
|
+
"stale_manifest",
|
|
353
|
+
`skaile.lock.yaml is unreadable: ${err instanceof Error ? err.message : String(err)}`,
|
|
354
|
+
ref
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const matches = [];
|
|
359
|
+
for (const [key, entry] of Object.entries(this.lockAssets)) {
|
|
360
|
+
const m = LOCK_KEY_RE.exec(key);
|
|
361
|
+
if (!m || m[1] !== kind || m[3] !== parsed.name) continue;
|
|
362
|
+
if (parsed.publisher && barePublisher(parsed.publisher) !== m[2]) continue;
|
|
363
|
+
if (parsed.pin && !matchPin(parsed.pin, m[4])) continue;
|
|
364
|
+
matches.push({ key, publisher: m[2], name: m[3], version: m[4], entry });
|
|
365
|
+
}
|
|
366
|
+
if (matches.length > 1) {
|
|
367
|
+
throw new CompositionError(
|
|
368
|
+
"composition_conflict",
|
|
369
|
+
"ambiguous",
|
|
370
|
+
`"${ref}" (${kind}): skaile.lock.yaml pins ${matches.length} matching assets (${matches.map((x) => x.key).join(", ")}) \u2014 qualify the ref with a publisher and version`,
|
|
371
|
+
ref
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
return matches[0] ?? null;
|
|
375
|
+
}
|
|
376
|
+
async loadLocked(ref, kind, pin) {
|
|
377
|
+
const { entry } = pin;
|
|
378
|
+
const storeDir = path2.join(
|
|
379
|
+
this.projectDir,
|
|
380
|
+
".skaile",
|
|
381
|
+
"cache",
|
|
382
|
+
"store",
|
|
383
|
+
pin.publisher,
|
|
384
|
+
kind,
|
|
385
|
+
pin.name,
|
|
386
|
+
pin.version
|
|
387
|
+
);
|
|
388
|
+
const prefix = commonDirPrefix(entry.files.map((f) => f.path));
|
|
389
|
+
const strip = (p) => prefix && p.startsWith(`${prefix}/`) ? p.slice(prefix.length + 1) : p;
|
|
390
|
+
if (isDirectory(storeDir) && entry.files.length > 0) {
|
|
391
|
+
await this.verifyFiles(ref, pin.key, entry, (p) => path2.join(storeDir, strip(p)));
|
|
392
|
+
const primary = this.primaryOf(
|
|
393
|
+
kind,
|
|
394
|
+
entry.files.map((f) => f.path)
|
|
395
|
+
);
|
|
396
|
+
return this.readAsset(
|
|
397
|
+
kind,
|
|
398
|
+
pin.key,
|
|
399
|
+
pin.version,
|
|
400
|
+
path2.join(storeDir, strip(primary)),
|
|
401
|
+
storeDir
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
const holdsPin = (h) => h.asset.version === pin.version && barePublisher(h.asset.publisher) === pin.publisher;
|
|
405
|
+
let hit = this.scanner.find(kind, pin.name).find(holdsPin);
|
|
406
|
+
if (!hit && entry.library) {
|
|
407
|
+
for (const root of await registeredLibraryRoots(entry.library)) {
|
|
408
|
+
hit = this.scanner.findIn(root, kind, pin.name).find(holdsPin);
|
|
409
|
+
if (hit) break;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (!hit) {
|
|
413
|
+
const atCommit = await this.loadAtLockedCommit(ref, kind, pin, strip);
|
|
414
|
+
if (atCommit) return atCommit;
|
|
415
|
+
let moved;
|
|
416
|
+
if (entry.library) {
|
|
417
|
+
for (const root of await registeredLibraryRoots(entry.library)) {
|
|
418
|
+
const other = this.scanner.findIn(root, kind, pin.name).find((h) => barePublisher(h.asset.publisher) === pin.publisher);
|
|
419
|
+
if (other?.asset.version) {
|
|
420
|
+
moved = {
|
|
421
|
+
key: pin.key,
|
|
422
|
+
library: entry.library.name,
|
|
423
|
+
libraryVersion: other.asset.version,
|
|
424
|
+
lockedVersion: pin.version
|
|
425
|
+
};
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
throw new CompositionError(
|
|
431
|
+
"composition_asset_missing",
|
|
432
|
+
"missing",
|
|
433
|
+
moved ? `"${ref}" (${kind}): skaile.lock.yaml pins ${pin.key} but library "${moved.library}" is at ${moved.libraryVersion} \u2014 run \`skaile update\` to move the lock to it` : `"${ref}" (${kind}): skaile.lock.yaml pins ${pin.key} but no bytes for it are on disk \u2014 run \`skaile install\``,
|
|
434
|
+
ref,
|
|
435
|
+
moved
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
const assetRoot = hit.asset.fileFilter.assetRoot;
|
|
439
|
+
if (entry.files.length > 0) {
|
|
440
|
+
try {
|
|
441
|
+
await this.verifyFiles(ref, pin.key, entry, (p) => path2.join(assetRoot, strip(p)));
|
|
442
|
+
} catch (err) {
|
|
443
|
+
const atCommit = await this.loadAtLockedCommit(ref, kind, pin, strip);
|
|
444
|
+
if (atCommit) return atCommit;
|
|
445
|
+
throw err;
|
|
446
|
+
}
|
|
447
|
+
} else if (entry.library?.sha256 && entry.library.sha256 !== hit.asset.sha256) {
|
|
448
|
+
throw new CompositionError(
|
|
449
|
+
"composition_conflict",
|
|
450
|
+
"hash_mismatch",
|
|
451
|
+
`"${ref}" (${kind}): ${pin.key} was locked from a library at ${entry.library.sha256.slice(0, 12)}\u2026 but the catalog now holds ${hit.asset.sha256.slice(0, 12)}\u2026`,
|
|
452
|
+
ref
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
return this.readAsset(kind, pin.key, pin.version, hit.asset.manifestPath, assetRoot);
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* A source-origin entry's bytes at ITS locked commit, read from the git objects of a source
|
|
459
|
+
* clone that holds the commit (the clone's checkout never moves) and staged under the
|
|
460
|
+
* project cache. `null` when the entry is not a source entry or no clone holds the commit; the
|
|
461
|
+
* staged bytes are verified against the lock like any other.
|
|
462
|
+
*/
|
|
463
|
+
async loadAtLockedCommit(ref, kind, pin, strip) {
|
|
464
|
+
const { entry } = pin;
|
|
465
|
+
const source = entry.source;
|
|
466
|
+
if (!source || entry.library || entry.origin === "store" || entry.files.length === 0) {
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
if (!/^[0-9a-f]{40}$/.test(source.commit) || /^0+$/.test(source.commit)) return null;
|
|
470
|
+
const clones = [path2.join(getGlobalCacheDir(), sourceCacheKey(source.url))];
|
|
471
|
+
const projectSources = path2.join(this.projectDir, ".skaile", "cache", "sources");
|
|
472
|
+
try {
|
|
473
|
+
for (const e of readdirSync(projectSources)) clones.push(path2.join(projectSources, e));
|
|
474
|
+
} catch {
|
|
475
|
+
}
|
|
476
|
+
const git = (dir, args) => spawnSync("git", ["-C", dir, ...args], {
|
|
477
|
+
stdio: "pipe",
|
|
478
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
479
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
480
|
+
});
|
|
481
|
+
const clone = clones.find(
|
|
482
|
+
(dir) => existsSync(dir) && git(dir, ["cat-file", "-e", `${source.commit}^{commit}`]).status === 0
|
|
483
|
+
);
|
|
484
|
+
if (!clone) return null;
|
|
485
|
+
const stageDir = path2.join(
|
|
486
|
+
this.projectDir,
|
|
487
|
+
".skaile",
|
|
488
|
+
"cache",
|
|
489
|
+
"source-commits",
|
|
490
|
+
source.commit,
|
|
491
|
+
pin.publisher,
|
|
492
|
+
kind,
|
|
493
|
+
pin.name,
|
|
494
|
+
pin.version
|
|
495
|
+
);
|
|
496
|
+
for (const file of entry.files) {
|
|
497
|
+
const shown = git(clone, ["show", `${source.commit}:${file.path}`]);
|
|
498
|
+
if (shown.status !== 0) return null;
|
|
499
|
+
const dest = path2.join(stageDir, strip(file.path));
|
|
500
|
+
mkdirSync(path2.dirname(dest), { recursive: true });
|
|
501
|
+
writeFileSync(dest, shown.stdout);
|
|
502
|
+
}
|
|
503
|
+
await this.verifyFiles(ref, pin.key, entry, (p) => path2.join(stageDir, strip(p)));
|
|
504
|
+
const primary = this.primaryOf(
|
|
505
|
+
kind,
|
|
506
|
+
entry.files.map((f) => f.path)
|
|
507
|
+
);
|
|
508
|
+
return this.readAsset(
|
|
509
|
+
kind,
|
|
510
|
+
pin.key,
|
|
511
|
+
pin.version,
|
|
512
|
+
path2.join(stageDir, strip(primary)),
|
|
513
|
+
stageDir
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
async verifyFiles(ref, key, entry, locate) {
|
|
517
|
+
for (const file of entry.files) {
|
|
518
|
+
const abs = locate(file.path);
|
|
519
|
+
let bytes;
|
|
520
|
+
try {
|
|
521
|
+
bytes = await fs3.readFile(abs);
|
|
522
|
+
} catch {
|
|
523
|
+
throw new CompositionError(
|
|
524
|
+
"composition_asset_missing",
|
|
525
|
+
"missing",
|
|
526
|
+
`"${ref}": ${key} lists ${file.path} but ${abs} is missing \u2014 run \`skaile install\``,
|
|
527
|
+
ref
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
const actual = sha256Of(bytes);
|
|
531
|
+
if (actual !== file.sha256) {
|
|
532
|
+
throw new CompositionError(
|
|
533
|
+
"composition_conflict",
|
|
534
|
+
"hash_mismatch",
|
|
535
|
+
`"${ref}": ${file.path} of ${key} is ${actual.slice(0, 12)}\u2026 on disk but skaile.lock.yaml pins ${file.sha256.slice(0, 12)}\u2026 \u2014 run \`skaile install\` to restore it`,
|
|
536
|
+
ref
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
primaryOf(kind, paths) {
|
|
542
|
+
const provider = this.registry.getProvider(kind);
|
|
543
|
+
const hit = provider ? paths.find((p) => provider.matchesPath(p)) : void 0;
|
|
544
|
+
return hit ?? paths[0] ?? "";
|
|
545
|
+
}
|
|
546
|
+
// ── catalog ──────────────────────────────────────────────────────────────
|
|
547
|
+
async loadFromCatalog(ref, kind, parsed) {
|
|
548
|
+
const wantPublisher = parsed.publisher ? barePublisher(parsed.publisher) : void 0;
|
|
549
|
+
const candidates = this.scanner.find(kind, parsed.name).filter((h) => !wantPublisher || barePublisher(h.asset.publisher) === wantPublisher).filter((h) => matchPin(parsed.pin, h.asset.version));
|
|
550
|
+
const distinct = /* @__PURE__ */ new Map();
|
|
551
|
+
for (const c of candidates) {
|
|
552
|
+
distinct.set(`${c.asset.publisher}/${c.asset.name}#${c.asset.version}:${c.asset.sha256}`, c);
|
|
553
|
+
}
|
|
554
|
+
if (distinct.size === 0) {
|
|
555
|
+
throw new CompositionError(
|
|
556
|
+
"composition_asset_missing",
|
|
557
|
+
"missing",
|
|
558
|
+
`"${ref}" (${kind}): not in skaile.lock.yaml and not found in the local catalog`,
|
|
559
|
+
ref
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
if (distinct.size > 1) {
|
|
563
|
+
throw new CompositionError(
|
|
564
|
+
"composition_conflict",
|
|
565
|
+
"ambiguous",
|
|
566
|
+
`"${ref}" (${kind}): ${distinct.size} catalog assets match (${[...distinct.values()].map((c) => `@${barePublisher(c.asset.publisher)}/${c.asset.name}#${c.asset.version}`).join(", ")}) \u2014 qualify the ref with a publisher and version`,
|
|
567
|
+
ref
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
const { asset } = [...distinct.values()][0];
|
|
571
|
+
const canonical = `${kind}:@${barePublisher(asset.publisher)}/${asset.name}#${asset.version}`;
|
|
572
|
+
return this.readAsset(
|
|
573
|
+
kind,
|
|
574
|
+
canonical,
|
|
575
|
+
asset.version,
|
|
576
|
+
asset.manifestPath,
|
|
577
|
+
asset.fileFilter.assetRoot
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
// ── shared read ──────────────────────────────────────────────────────────
|
|
581
|
+
async readAsset(kind, canonicalRef, version, primaryPath, assetRoot) {
|
|
582
|
+
let content;
|
|
583
|
+
let location = primaryPath;
|
|
584
|
+
if (kind === "knowledge") {
|
|
585
|
+
const dir = path2.basename(primaryPath) === "knowledge.yaml" ? path2.dirname(primaryPath) : assetRoot;
|
|
586
|
+
const loaded = await loadKnowledgeDir(dir);
|
|
587
|
+
if (!loaded) {
|
|
588
|
+
throw new CompositionError(
|
|
589
|
+
"composition_asset_missing",
|
|
590
|
+
"missing",
|
|
591
|
+
`"${canonicalRef}": knowledge directory ${dir} holds no documents`,
|
|
592
|
+
canonicalRef
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
content = loaded.content;
|
|
596
|
+
location = dir;
|
|
597
|
+
} else {
|
|
598
|
+
let raw;
|
|
599
|
+
try {
|
|
600
|
+
raw = await fs3.readFile(primaryPath, "utf-8");
|
|
601
|
+
} catch {
|
|
602
|
+
throw new CompositionError(
|
|
603
|
+
"composition_asset_missing",
|
|
604
|
+
"missing",
|
|
605
|
+
`"${canonicalRef}": ${primaryPath} is not readable`,
|
|
606
|
+
canonicalRef
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
content = stripFrontmatter(raw).trim();
|
|
610
|
+
}
|
|
611
|
+
return { canonicalRef, kind, version, sha256: sha256Of(content), content, location };
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
function isDirectory(p) {
|
|
615
|
+
try {
|
|
616
|
+
return statSync(p).isDirectory();
|
|
617
|
+
} catch {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
function commonDirPrefix(paths) {
|
|
622
|
+
if (paths.length === 0) return "";
|
|
623
|
+
const split = paths.map((p) => p.split("/").slice(0, -1));
|
|
624
|
+
const first = split[0];
|
|
625
|
+
let n = first.length;
|
|
626
|
+
for (const parts of split) {
|
|
627
|
+
let i = 0;
|
|
628
|
+
while (i < n && i < parts.length && parts[i] === first[i]) i++;
|
|
629
|
+
n = i;
|
|
630
|
+
}
|
|
631
|
+
return first.slice(0, n).join("/");
|
|
632
|
+
}
|
|
633
|
+
function hashContent(content) {
|
|
634
|
+
return sha256Of(content);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
// runner/src/composition/types.ts
|
|
638
|
+
var KIND_BINDING_DEFAULTS = {
|
|
639
|
+
soul: "inline-snapshot",
|
|
640
|
+
persona: "inline-snapshot",
|
|
641
|
+
ruleset: "inline-live",
|
|
642
|
+
skill: "discoverable",
|
|
643
|
+
knowledge: "discoverable",
|
|
644
|
+
connector: "discoverable",
|
|
645
|
+
prompt: "inline-live",
|
|
646
|
+
flow: "discoverable",
|
|
647
|
+
"mcp-server": "discoverable",
|
|
648
|
+
contract: "inline-live",
|
|
649
|
+
agent: "delegate"
|
|
650
|
+
};
|
|
651
|
+
var UnknownCompositionKindError = class extends Error {
|
|
652
|
+
constructor(kind, ref) {
|
|
653
|
+
super(`composes item "${ref}" has unknown asset kind "${kind}" and no explicit binding`);
|
|
654
|
+
this.kind = kind;
|
|
655
|
+
this.ref = ref;
|
|
656
|
+
this.name = "UnknownCompositionKindError";
|
|
657
|
+
}
|
|
658
|
+
kind;
|
|
659
|
+
ref;
|
|
660
|
+
code = "unknown_asset_kind";
|
|
661
|
+
};
|
|
662
|
+
function resolveBinding(item) {
|
|
663
|
+
if (item.binding) return item.binding;
|
|
664
|
+
if (!Object.hasOwn(KIND_BINDING_DEFAULTS, item.kind)) {
|
|
665
|
+
throw new UnknownCompositionKindError(item.kind, item.ref);
|
|
666
|
+
}
|
|
667
|
+
return KIND_BINDING_DEFAULTS[item.kind];
|
|
668
|
+
}
|
|
669
|
+
var COMPILE_MANIFEST_FILENAME = "compile_manifest.json";
|
|
670
|
+
var CompileManifestEntrySchema = z.object({
|
|
671
|
+
asset_ref: z.string().min(1),
|
|
672
|
+
kind: z.string().min(1),
|
|
673
|
+
resolved_ref: z.string().min(1),
|
|
674
|
+
version: z.string().nullable(),
|
|
675
|
+
hash: z.string().regex(/^[0-9a-f]{64}$/),
|
|
676
|
+
binding: BindingSchema,
|
|
677
|
+
resolved_at: z.string(),
|
|
678
|
+
content: z.string()
|
|
679
|
+
});
|
|
680
|
+
var CompileManifestSchema = z.object({
|
|
681
|
+
schema_version: z.literal(2),
|
|
682
|
+
prompt_version: z.number().int().nonnegative(),
|
|
683
|
+
compiled_at: z.string(),
|
|
684
|
+
entries: z.array(CompileManifestEntrySchema)
|
|
685
|
+
});
|
|
686
|
+
var StaleSchemaMarker = z.object({ schema_version: z.literal(1) });
|
|
687
|
+
var NestedAgentComposes = z.object({ composes: z.array(z.unknown()) });
|
|
688
|
+
var NestedAgentItem = z.object({ kind: z.literal("agent"), ref: z.string() });
|
|
689
|
+
async function compileComposition(opts) {
|
|
690
|
+
const { agentDir, items, source } = opts;
|
|
691
|
+
const manifestPath = path2.join(agentDir, COMPILE_MANIFEST_FILENAME);
|
|
692
|
+
const nextVersion = await readPromptVersion(manifestPath) + 1;
|
|
693
|
+
const loaded = /* @__PURE__ */ new Map();
|
|
694
|
+
const entries = [];
|
|
695
|
+
const resolvedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
696
|
+
for (const item of items) {
|
|
697
|
+
const binding = resolveBinding(item);
|
|
698
|
+
const cacheKey = `${item.kind}\0${item.ref}`;
|
|
699
|
+
let asset = loaded.get(cacheKey);
|
|
700
|
+
if (!asset) {
|
|
701
|
+
asset = await source.load(item.ref, item.kind);
|
|
702
|
+
loaded.set(cacheKey, asset);
|
|
703
|
+
}
|
|
704
|
+
entries.push({
|
|
705
|
+
asset_ref: item.ref,
|
|
706
|
+
kind: item.kind,
|
|
707
|
+
resolved_ref: asset.canonicalRef,
|
|
708
|
+
version: asset.version,
|
|
709
|
+
hash: asset.sha256,
|
|
710
|
+
binding,
|
|
711
|
+
resolved_at: resolvedAt,
|
|
712
|
+
content: asset.content
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
await assertAcyclicSubagents(agentDir, items, source);
|
|
716
|
+
const manifest = {
|
|
717
|
+
schema_version: 2,
|
|
718
|
+
prompt_version: nextVersion,
|
|
719
|
+
entries,
|
|
720
|
+
compiled_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
721
|
+
};
|
|
722
|
+
const tmpPath = `${manifestPath}.tmp`;
|
|
723
|
+
await fs3.writeFile(tmpPath, `${JSON.stringify(manifest, null, 2)}
|
|
724
|
+
`, "utf-8");
|
|
725
|
+
await fs3.rename(tmpPath, manifestPath);
|
|
726
|
+
return { manifest, manifestPath, resolvedCount: entries.length };
|
|
727
|
+
}
|
|
728
|
+
async function isCompilePinCurrent(opts) {
|
|
729
|
+
let pinned;
|
|
730
|
+
try {
|
|
731
|
+
pinned = await loadCompileManifestFromDir(opts.agentDir);
|
|
732
|
+
} catch {
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
if (!pinned || pinned.entries.length !== opts.items.length) return false;
|
|
736
|
+
for (const [i, item] of opts.items.entries()) {
|
|
737
|
+
const entry = pinned.entries[i];
|
|
738
|
+
if (entry.asset_ref !== item.ref || entry.kind !== item.kind) return false;
|
|
739
|
+
if (entry.binding !== resolveBinding(item)) return false;
|
|
740
|
+
const asset = await opts.source.load(item.ref, item.kind);
|
|
741
|
+
if (asset.sha256 !== entry.hash) return false;
|
|
742
|
+
}
|
|
743
|
+
return true;
|
|
744
|
+
}
|
|
745
|
+
async function loadCompileManifest(manifestPath) {
|
|
746
|
+
let raw;
|
|
747
|
+
try {
|
|
748
|
+
raw = await fs3.readFile(manifestPath, "utf-8");
|
|
749
|
+
} catch {
|
|
750
|
+
return void 0;
|
|
751
|
+
}
|
|
752
|
+
let json;
|
|
753
|
+
try {
|
|
754
|
+
json = JSON.parse(raw);
|
|
755
|
+
} catch {
|
|
756
|
+
throw new CompositionError(
|
|
757
|
+
"composition_rebuild_required",
|
|
758
|
+
"stale_manifest",
|
|
759
|
+
`${manifestPath} is not valid JSON \u2014 run \`skaile rebuild\``
|
|
760
|
+
);
|
|
761
|
+
}
|
|
762
|
+
if (StaleSchemaMarker.safeParse(json).success) {
|
|
763
|
+
throw new CompositionError(
|
|
764
|
+
"composition_rebuild_required",
|
|
765
|
+
"stale_manifest",
|
|
766
|
+
`${manifestPath} is a schema-1 compile manifest (hashes only, no captured content) \u2014 run \`skaile rebuild\``
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
const parsed = CompileManifestSchema.safeParse(json);
|
|
770
|
+
if (!parsed.success) {
|
|
771
|
+
throw new CompositionError(
|
|
772
|
+
"composition_rebuild_required",
|
|
773
|
+
"stale_manifest",
|
|
774
|
+
`${manifestPath} is malformed (${parsed.error.issues[0]?.path.join(".") || "root"}: ${parsed.error.issues[0]?.message}) \u2014 run \`skaile rebuild\``
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
for (const entry of parsed.data.entries) {
|
|
778
|
+
const actual = hashContent(entry.content);
|
|
779
|
+
if (actual !== entry.hash) {
|
|
780
|
+
throw new CompositionError(
|
|
781
|
+
"composition_conflict",
|
|
782
|
+
"hash_mismatch",
|
|
783
|
+
`${manifestPath}: captured content of "${entry.asset_ref}" (${entry.kind}) hashes to ${actual.slice(0, 12)}\u2026 but the manifest records ${entry.hash.slice(0, 12)}\u2026 \u2014 the file was edited; run \`skaile rebuild\``,
|
|
784
|
+
entry.asset_ref
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return parsed.data;
|
|
789
|
+
}
|
|
790
|
+
async function loadCompileManifestFromDir(agentDir) {
|
|
791
|
+
return loadCompileManifest(path2.join(agentDir, COMPILE_MANIFEST_FILENAME));
|
|
792
|
+
}
|
|
793
|
+
async function readPromptVersion(manifestPath) {
|
|
794
|
+
try {
|
|
795
|
+
const parsed = JSON.parse(await fs3.readFile(manifestPath, "utf-8"));
|
|
796
|
+
return typeof parsed?.prompt_version === "number" ? parsed.prompt_version : 0;
|
|
797
|
+
} catch {
|
|
798
|
+
return 0;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
var identityOf = (file) => {
|
|
802
|
+
try {
|
|
803
|
+
return realpathSync(file);
|
|
804
|
+
} catch {
|
|
805
|
+
return file;
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
async function assertAcyclicSubagents(agentDir, items, source) {
|
|
809
|
+
const manifestFile = path2.join(agentDir, "agent.yaml");
|
|
810
|
+
const root = existsSync(manifestFile) ? identityOf(manifestFile) : identityOf(agentDir);
|
|
811
|
+
const visit = async (children, src, chain) => {
|
|
812
|
+
for (const item of children) {
|
|
813
|
+
if (item.kind !== "agent") continue;
|
|
814
|
+
const asset = await src.load(item.ref, "agent");
|
|
815
|
+
const identity = asset.location ? identityOf(asset.location) : asset.canonicalRef;
|
|
816
|
+
if (chain.includes(identity)) {
|
|
817
|
+
throw new CompositionError(
|
|
818
|
+
"composition_conflict",
|
|
819
|
+
"cycle",
|
|
820
|
+
`"${item.ref}" (agent): sub-agent composition loops (${[...chain, identity].map((p) => path2.basename(path2.dirname(p)) || p).join(" \u2192 ")})`,
|
|
821
|
+
item.ref
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
const nested = NestedAgentComposes.safeParse(parseYamlSafe(asset.content));
|
|
825
|
+
if (!nested.success || !asset.location) continue;
|
|
826
|
+
const subagents = nested.data.composes.flatMap((c) => {
|
|
827
|
+
const parsedItem = NestedAgentItem.safeParse(c);
|
|
828
|
+
return parsedItem.success ? [parsedItem.data] : [];
|
|
829
|
+
});
|
|
830
|
+
if (subagents.length === 0) continue;
|
|
831
|
+
await visit(subagents, src.scoped(path2.dirname(asset.location)), [...chain, identity]);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
await visit(items, source, [root]);
|
|
835
|
+
}
|
|
836
|
+
function parseYamlSafe(text) {
|
|
837
|
+
try {
|
|
838
|
+
return parse(text);
|
|
839
|
+
} catch {
|
|
840
|
+
return null;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
function agentPromptInput(resolved, promptExtensions) {
|
|
844
|
+
const blocks = resolved?.inlineBlocks ?? [];
|
|
845
|
+
const joined = (kind) => blocks.filter((block) => block.implicit && block.kind === kind).map((block) => block.content.trim()).filter(Boolean).join("\n\n");
|
|
846
|
+
return {
|
|
847
|
+
soul: joined("soul"),
|
|
848
|
+
memory: resolved?.memoryBlocks ?? [],
|
|
849
|
+
duties: joined("prompt"),
|
|
850
|
+
composed: blocks.filter((block) => !block.implicit).map((block) => ({ text: block.content, source: block.ref })),
|
|
851
|
+
promptExtensions: promptExtensions.map((e) => ({ text: e.value, source: e.source }))
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
function assembleRunnerAgent(resolved, promptExtensions, options = {}) {
|
|
855
|
+
return assembleAgent(agentPromptInput(resolved, promptExtensions), options);
|
|
856
|
+
}
|
|
857
|
+
function buildRunnerAgentSections(resolved, promptExtensions, options = {}) {
|
|
858
|
+
return assembleRunnerAgent(resolved, promptExtensions, options).runnerSections;
|
|
859
|
+
}
|
|
860
|
+
function nativeAgentFilePath(cwd, harness, agentName) {
|
|
861
|
+
const target = harnessNameForHarnessId(harness);
|
|
862
|
+
if (target === "claude-code") {
|
|
863
|
+
return join(cwd, HARNESS_TARGETS["claude-code"].local.agent, `${agentName}.md`);
|
|
864
|
+
}
|
|
865
|
+
if (target === "codex") {
|
|
866
|
+
return join(
|
|
867
|
+
cwd,
|
|
868
|
+
dirname(HARNESS_TARGETS.codex.local.agent),
|
|
869
|
+
"skaile-agents",
|
|
870
|
+
`${agentName}.md`
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
return void 0;
|
|
874
|
+
}
|
|
875
|
+
function readNativeAgentFile(cwd, harness, agentName) {
|
|
876
|
+
const file = nativeAgentFilePath(cwd, harness, agentName);
|
|
877
|
+
if (!file) return void 0;
|
|
878
|
+
try {
|
|
879
|
+
return readFileSync(file, "utf-8");
|
|
880
|
+
} catch {
|
|
881
|
+
return void 0;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
export { COMPILE_MANIFEST_FILENAME, CompileManifestEntrySchema, CompositionError, UnknownCompositionKindError, agentPromptInput, assembleRunnerAgent, buildRunnerAgentSections, compileComposition, createCompositionContentSource, hashContent, isCompilePinCurrent, isCompositionError, isEmptyKnowledgeIndex, loadCompileManifest, loadCompileManifestFromDir, loadKnowledgeDir, nativeAgentFilePath, readNativeAgentFile, resolveBinding, resolveMixin, stripFrontmatter };
|
|
886
|
+
//# sourceMappingURL=chunk-4ZNKEDYH.js.map
|
|
887
|
+
//# sourceMappingURL=chunk-4ZNKEDYH.js.map
|