@skaile/workspaces 6.6.0 → 6.7.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 +28 -0
- package/dist/ai-sdk.js +10 -17
- package/dist/ai-sdk.js.map +1 -1
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-WQ6YQPHV.js → asset-feeds-4A7PJ4OB.js} +18 -18
- package/dist/{asset-feeds-WQ6YQPHV.js.map → asset-feeds-4A7PJ4OB.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +4 -4
- package/dist/asset-manager/index.js +10 -10
- package/dist/asset-manager/installer.js +6 -6
- package/dist/asset-manager/renderers.js +5 -5
- package/dist/asset-manager/src/index.d.ts +89 -15
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/install-agent.d.ts +22 -1
- package/dist/asset-manager/src/install-agent.d.ts.map +1 -1
- package/dist/asset-manager/src/install-instances.d.ts +30 -1
- package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +12 -0
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/asset-manager/src/renderers.d.ts.map +1 -1
- package/dist/bridge/harnesses/claude-sdk.js +21 -15
- package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
- package/dist/bridge/harnesses/codex.js +9 -8
- package/dist/bridge/harnesses/codex.js.map +1 -1
- package/dist/bridge/harnesses/continue.js +11 -9
- package/dist/bridge/harnesses/continue.js.map +1 -1
- package/dist/bridge/harnesses/echo.js +5 -4
- package/dist/bridge/harnesses/echo.js.map +1 -1
- package/dist/bridge/harnesses/gemini.js +8 -6
- package/dist/bridge/harnesses/goose.js +11 -9
- package/dist/bridge/harnesses/goose.js.map +1 -1
- package/dist/bridge/harnesses/omp.js +9 -7
- package/dist/bridge/harnesses/omp.js.map +1 -1
- package/dist/bridge/harnesses/opencode.js +11 -9
- package/dist/bridge/harnesses/opencode.js.map +1 -1
- package/dist/bridge/harnesses/qwen.js +9 -7
- package/dist/bridge/harnesses/qwen.js.map +1 -1
- package/dist/bridge/index.js +17 -15
- package/dist/bridge/src/ai-sdk.d.ts.map +1 -1
- package/dist/bridge/src/claude-sdk-surface.d.ts +2 -1
- package/dist/bridge/src/claude-sdk-surface.d.ts.map +1 -1
- package/dist/bridge/src/harness-binaries.d.ts +21 -0
- package/dist/bridge/src/harness-binaries.d.ts.map +1 -0
- package/dist/bridge/src/harness-model-check.d.ts +22 -6
- package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/harnesses/continue.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-models-yml.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 -1
- package/dist/bridge/src/index.d.ts.map +1 -1
- package/dist/{chunk-LBJ4M5J2.js → chunk-237BMOZW.js} +4 -4
- package/dist/{chunk-LBJ4M5J2.js.map → chunk-237BMOZW.js.map} +1 -1
- package/dist/{chunk-2TLPC6TQ.js → chunk-37AYPPOO.js} +41 -19
- package/dist/chunk-37AYPPOO.js.map +1 -0
- package/dist/{chunk-GTGWRKMJ.js → chunk-37X4A6VZ.js} +6 -6
- package/dist/{chunk-GTGWRKMJ.js.map → chunk-37X4A6VZ.js.map} +1 -1
- package/dist/{chunk-MXI3XWV6.js → chunk-3HSLJAMJ.js} +4 -4
- package/dist/{chunk-MXI3XWV6.js.map → chunk-3HSLJAMJ.js.map} +1 -1
- package/dist/{chunk-RHCEX2EV.js → chunk-3W6XZQ2Y.js} +3 -3
- package/dist/{chunk-RHCEX2EV.js.map → chunk-3W6XZQ2Y.js.map} +1 -1
- package/dist/{chunk-F4CZQD3T.js → chunk-4C2E5QUP.js} +4 -3
- package/dist/chunk-4C2E5QUP.js.map +1 -0
- package/dist/{chunk-DS6UUCFG.js → chunk-4CD2R4MJ.js} +5 -4
- package/dist/chunk-4CD2R4MJ.js.map +1 -0
- package/dist/{chunk-AQNW2FET.js → chunk-6RPS7JEH.js} +92 -39
- package/dist/chunk-6RPS7JEH.js.map +1 -0
- package/dist/{chunk-BSMW3PX2.js → chunk-6UP2EDFN.js} +4 -313
- package/dist/chunk-6UP2EDFN.js.map +1 -0
- package/dist/{chunk-4J7JQX4G.js → chunk-72TLO2AG.js} +4 -4
- package/dist/{chunk-4J7JQX4G.js.map → chunk-72TLO2AG.js.map} +1 -1
- package/dist/{chunk-I5IF3JCG.js → chunk-AO57IFME.js} +3 -3
- package/dist/{chunk-I5IF3JCG.js.map → chunk-AO57IFME.js.map} +1 -1
- package/dist/{chunk-G5SYFFMD.js → chunk-ASBZOTEO.js} +2 -2
- package/dist/{chunk-G5SYFFMD.js.map → chunk-ASBZOTEO.js.map} +1 -1
- package/dist/{chunk-O7QZI6MQ.js → chunk-BB5EJLKZ.js} +2 -2
- package/dist/{chunk-O7QZI6MQ.js.map → chunk-BB5EJLKZ.js.map} +1 -1
- package/dist/{chunk-N2PBAXAA.js → chunk-BKLDBUQA.js} +3 -3
- package/dist/{chunk-N2PBAXAA.js.map → chunk-BKLDBUQA.js.map} +1 -1
- package/dist/{chunk-XD3RYAMR.js → chunk-CTRTFMCX.js} +6 -6
- package/dist/{chunk-XD3RYAMR.js.map → chunk-CTRTFMCX.js.map} +1 -1
- package/dist/{chunk-EPXZQIC6.js → chunk-DFP476EU.js} +8 -4
- package/dist/chunk-DFP476EU.js.map +1 -0
- package/dist/{chunk-MMOWIRHP.js → chunk-G44FFUMA.js} +12 -10
- package/dist/chunk-G44FFUMA.js.map +1 -0
- package/dist/{chunk-JIQUF3X2.js → chunk-G7NMF5WQ.js} +3 -3
- package/dist/{chunk-JIQUF3X2.js.map → chunk-G7NMF5WQ.js.map} +1 -1
- package/dist/{chunk-SHTXMERQ.js → chunk-GAIMSCZ7.js} +10 -8
- package/dist/chunk-GAIMSCZ7.js.map +1 -0
- package/dist/{chunk-6A6HE5LW.js → chunk-HLAEYFUN.js} +3 -3
- package/dist/{chunk-6A6HE5LW.js.map → chunk-HLAEYFUN.js.map} +1 -1
- package/dist/{chunk-YN6N3RBM.js → chunk-HMVAGPYR.js} +47 -11
- package/dist/chunk-HMVAGPYR.js.map +1 -0
- package/dist/{chunk-U3UDOX6I.js → chunk-HPXONAI2.js} +6 -4
- package/dist/chunk-HPXONAI2.js.map +1 -0
- package/dist/{chunk-5ETYBC2X.js → chunk-IRK3LNG3.js} +6 -6
- package/dist/{chunk-5ETYBC2X.js.map → chunk-IRK3LNG3.js.map} +1 -1
- package/dist/{chunk-J262X4JU.js → chunk-J7VEQORJ.js} +69 -16
- package/dist/chunk-J7VEQORJ.js.map +1 -0
- package/dist/{chunk-DI6J2PJB.js → chunk-KO3VSZQP.js} +47 -18
- package/dist/chunk-KO3VSZQP.js.map +1 -0
- package/dist/{chunk-KSH5CFQS.js → chunk-KORDNXKA.js} +3 -3
- package/dist/{chunk-KSH5CFQS.js.map → chunk-KORDNXKA.js.map} +1 -1
- package/dist/{chunk-SCRYXAHH.js → chunk-L3JQJ6D5.js} +6 -6
- package/dist/{chunk-SCRYXAHH.js.map → chunk-L3JQJ6D5.js.map} +1 -1
- package/dist/{chunk-7I5PNB2G.js → chunk-L7QOZG5V.js} +3 -3
- package/dist/{chunk-7I5PNB2G.js.map → chunk-L7QOZG5V.js.map} +1 -1
- package/dist/{chunk-VXYZ5M7Z.js → chunk-LX4TTTRR.js} +64 -27
- package/dist/chunk-LX4TTTRR.js.map +1 -0
- package/dist/{chunk-KSUT5KAE.js → chunk-LZPJOF7Y.js} +3 -3
- package/dist/{chunk-KSUT5KAE.js.map → chunk-LZPJOF7Y.js.map} +1 -1
- package/dist/{chunk-65UAC3ZR.js → chunk-N6ZGB5ES.js} +4 -3
- package/dist/chunk-N6ZGB5ES.js.map +1 -0
- package/dist/{chunk-2M3VLKT2.js → chunk-NURTGAWM.js} +3 -3
- package/dist/{chunk-2M3VLKT2.js.map → chunk-NURTGAWM.js.map} +1 -1
- package/dist/{chunk-J4WKNJHO.js → chunk-O5Y7VMVQ.js} +15 -14
- package/dist/chunk-O5Y7VMVQ.js.map +1 -0
- package/dist/{chunk-6SXSVKQY.js → chunk-O7ADRMCR.js} +63 -14
- package/dist/chunk-O7ADRMCR.js.map +1 -0
- package/dist/{chunk-7PVGND4J.js → chunk-OGTQUEAO.js} +21 -14
- package/dist/chunk-OGTQUEAO.js.map +1 -0
- package/dist/{chunk-VJRL6ZK6.js → chunk-OSABUEWA.js} +3 -3
- package/dist/{chunk-VJRL6ZK6.js.map → chunk-OSABUEWA.js.map} +1 -1
- package/dist/{chunk-WW5NAU6N.js → chunk-PLLZSKOO.js} +3 -3
- package/dist/{chunk-WW5NAU6N.js.map → chunk-PLLZSKOO.js.map} +1 -1
- package/dist/{chunk-7SJHSGUV.js → chunk-Q2NYTMT6.js} +16 -15
- package/dist/chunk-Q2NYTMT6.js.map +1 -0
- package/dist/{chunk-E2EC6SAX.js → chunk-QC5BYUED.js} +51 -15
- package/dist/chunk-QC5BYUED.js.map +1 -0
- package/dist/{chunk-RAU5QPI6.js → chunk-QCR5AE5E.js} +5 -5
- package/dist/{chunk-RAU5QPI6.js.map → chunk-QCR5AE5E.js.map} +1 -1
- package/dist/{chunk-TUFNY6OD.js → chunk-QW5B3TEO.js} +10 -4
- package/dist/chunk-QW5B3TEO.js.map +1 -0
- package/dist/{chunk-Z4FERR4U.js → chunk-RAHAZ7LP.js} +2 -2
- package/dist/{chunk-Z4FERR4U.js.map → chunk-RAHAZ7LP.js.map} +1 -1
- package/dist/{chunk-OY22B7E2.js → chunk-SBNUXJ6E.js} +3 -3
- package/dist/{chunk-OY22B7E2.js.map → chunk-SBNUXJ6E.js.map} +1 -1
- package/dist/{chunk-6ARPZHOV.js → chunk-TMJBEGS4.js} +35 -6
- package/dist/chunk-TMJBEGS4.js.map +1 -0
- package/dist/{chunk-6RHWTZPT.js → chunk-TXX3OUYI.js} +3 -3
- package/dist/{chunk-6RHWTZPT.js.map → chunk-TXX3OUYI.js.map} +1 -1
- package/dist/{chunk-SZKCE7EC.js → chunk-U52FYGK5.js} +5 -5
- package/dist/{chunk-SZKCE7EC.js.map → chunk-U52FYGK5.js.map} +1 -1
- package/dist/{chunk-TCH5UDKT.js → chunk-UCB7FK25.js} +10 -8
- package/dist/chunk-UCB7FK25.js.map +1 -0
- package/dist/{chunk-5XHQBCB5.js → chunk-WFK4MUBL.js} +21 -7
- package/dist/chunk-WFK4MUBL.js.map +1 -0
- package/dist/{chunk-HGZN6JLP.js → chunk-WIYVR24B.js} +4 -4
- package/dist/{chunk-HGZN6JLP.js.map → chunk-WIYVR24B.js.map} +1 -1
- package/dist/{chunk-B6N653ZG.js → chunk-WKENHNDM.js} +6 -6
- package/dist/{chunk-B6N653ZG.js.map → chunk-WKENHNDM.js.map} +1 -1
- package/dist/chunk-WWSRIT3J.js +59 -0
- package/dist/chunk-WWSRIT3J.js.map +1 -0
- package/dist/chunk-XON6ODIC.js +315 -0
- package/dist/chunk-XON6ODIC.js.map +1 -0
- package/dist/{chunk-4BFEPZ6J.js → chunk-ZBA4P5TD.js} +3 -3
- package/dist/{chunk-4BFEPZ6J.js.map → chunk-ZBA4P5TD.js.map} +1 -1
- package/dist/{chunk-JRVQV7WC.js → chunk-ZDTDS62B.js} +595 -126
- package/dist/chunk-ZDTDS62B.js.map +1 -0
- package/dist/{chunk-XYCYGN3Q.js → chunk-ZM4SDVUV.js} +79 -20
- package/dist/chunk-ZM4SDVUV.js.map +1 -0
- package/dist/{claude-code-LZH7Y4Y5.js → claude-code-BLFRZU2X.js} +4 -4
- package/dist/{claude-code-LZH7Y4Y5.js.map → claude-code-BLFRZU2X.js.map} +1 -1
- package/dist/cli/index.js +474 -198
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/agent-pins.d.ts +9 -3
- package/dist/cli/src/agent-pins.d.ts.map +1 -1
- package/dist/cli/src/commands/asset-cmd.d.ts +1 -1
- package/dist/cli/src/commands/asset-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/cache.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +2 -0
- 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-preflight.d.ts +38 -0
- package/dist/cli/src/commands/harness-preflight.d.ts.map +1 -0
- package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/library-index.d.ts +16 -0
- package/dist/cli/src/commands/library-index.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-assets.d.ts +5 -0
- package/dist/cli/src/commands/migrate-assets.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate-harness.d.ts +15 -7
- package/dist/cli/src/commands/migrate-harness.d.ts.map +1 -1
- package/dist/cli/src/commands/migrate.d.ts.map +1 -1
- package/dist/cli/src/commands/outdated.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +14 -0
- 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 +6 -5
- 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/session.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +11 -0
- 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-instances.d.ts +6 -0
- package/dist/cli/src/commands/validate-instances.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/plugin-store/reconcile.d.ts.map +1 -1
- package/dist/cli/src/session-hint.d.ts +7 -0
- package/dist/cli/src/session-hint.d.ts.map +1 -0
- package/dist/connectors/config.js +3 -3
- package/dist/connectors/index.js +21 -19
- package/dist/connectors/src/managed-gitconfig.d.ts +6 -4
- package/dist/connectors/src/managed-gitconfig.d.ts.map +1 -1
- package/dist/{connectors-HU5MHSUJ.js → connectors-OJJU4LSN.js} +24 -22
- package/dist/{connectors-HU5MHSUJ.js.map → connectors-OJJU4LSN.js.map} +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/core/index.js +4 -4
- package/dist/core/publish-manifest.js +1 -1
- package/dist/core/runtime-assets.js +3 -3
- package/dist/core/src/agent-instances.d.ts +11 -0
- package/dist/core/src/agent-instances.d.ts.map +1 -1
- package/dist/core/src/index.d.ts +3 -2
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/publish-manifest.d.ts +20 -6
- package/dist/core/src/publish-manifest.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +9 -0
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/run-state-ignore.d.ts +17 -0
- package/dist/core/src/run-state-ignore.d.ts.map +1 -0
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/workspace-config.js +2 -2
- package/dist/deploy/index.js +4 -4
- package/dist/discovery/index.js +2 -2
- 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/tree-entries.d.ts.map +1 -1
- package/dist/{ensure-sources-CAMWJTMR.js → ensure-sources-F6VQDCWY.js} +26 -24
- package/dist/ensure-sources-F6VQDCWY.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +21 -19
- package/dist/factory-assets/connectors/deploy.js +21 -19
- package/dist/factory-assets/connectors/devserver.js +21 -19
- package/dist/factory-assets/connectors/flow/adapter.js +21 -19
- package/dist/factory-assets/connectors/flow/engine/router-settlement.d.ts +2 -0
- package/dist/factory-assets/connectors/flow/engine/router-settlement.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/engine.js +5 -5
- package/dist/factory-assets/connectors/flow/run-flow.js +22 -20
- package/dist/factory-assets/connectors/flow.js +21 -19
- package/dist/factory-assets/connectors/git/CONNECTOR.md +4 -1
- package/dist/factory-assets/connectors/git/exec.d.ts.map +1 -1
- package/dist/factory-assets/connectors/git.js +21 -19
- package/dist/factory-assets/connectors/gmail.js +21 -19
- package/dist/factory-assets/connectors/googledrive.js +21 -19
- package/dist/factory-assets/connectors/local.js +21 -19
- package/dist/factory-assets/connectors/mattermost.js +21 -19
- package/dist/factory-assets/connectors/memory.js +21 -19
- package/dist/factory-assets/connectors/minio.js +21 -19
- package/dist/factory-assets/connectors/postgres.js +21 -19
- package/dist/factory-assets/connectors/s3.js +21 -19
- package/dist/factory-assets/connectors/sharepoint.js +21 -19
- package/dist/factory-assets/connectors/sqlite.js +21 -19
- package/dist/factory-assets/connectors/static-server.js +21 -19
- package/dist/factory-assets/connectors/tunnel.js +21 -19
- package/dist/factory-assets/connectors/webdav.js +21 -19
- package/dist/factory-assets/connectors/xstate-store.js +21 -19
- package/dist/factory-assets/connectors/xstate.js +21 -19
- package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +14 -1
- package/dist/{flows-GVOVQGQW.js → flows-I6ODIPZZ.js} +7 -7
- package/dist/{flows-GVOVQGQW.js.map → flows-I6ODIPZZ.js.map} +1 -1
- package/dist/{helpers-WMCCODAV.js → helpers-PJNUTZXZ.js} +26 -24
- package/dist/{helpers-WMCCODAV.js.map → helpers-PJNUTZXZ.js.map} +1 -1
- package/dist/library/index.js +7 -7
- package/dist/library/install.js +2 -2
- package/dist/library/src/manifest-writer.d.ts +5 -0
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/{library-publish-UQQMHTND.js → library-publish-FNNDWVBO.js} +47 -45
- package/dist/library-publish-FNNDWVBO.js.map +1 -0
- package/dist/model-endpoint/index.js +8 -7
- package/dist/{open-library-OJ4HT2X4.js → open-library-R5EZROFN.js} +29 -27
- package/dist/{open-library-OJ4HT2X4.js.map → open-library-R5EZROFN.js.map} +1 -1
- package/dist/{open-registry-LWGIOJDK.js → open-registry-RZW2AFD6.js} +11 -11
- package/dist/{open-registry-LWGIOJDK.js.map → open-registry-RZW2AFD6.js.map} +1 -1
- package/dist/{paths-FR2752HV.js → paths-RPK5PNZQ.js} +7 -7
- package/dist/{paths-FR2752HV.js.map → paths-RPK5PNZQ.js.map} +1 -1
- package/dist/{plugin-store-IALJUBN2.js → plugin-store-OJTERUEZ.js} +7 -7
- package/dist/{plugin-store-IALJUBN2.js.map → plugin-store-OJTERUEZ.js.map} +1 -1
- package/dist/{project-UQFCYHYS.js → project-S2FT3LLR.js} +43 -41
- package/dist/{project-UQFCYHYS.js.map → project-S2FT3LLR.js.map} +1 -1
- package/dist/resolver/index.js +4 -4
- package/dist/runner/index.js +32 -30
- package/dist/runner/src/capability-roundtrip.d.ts +6 -6
- package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
- package/dist/runner/src/composition/run-snapshot.d.ts +7 -1
- package/dist/runner/src/composition/run-snapshot.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +10 -10
- package/dist/sdk/bridge.js +17 -15
- package/dist/sdk/core.js +4 -4
- package/dist/sdk/flow.js +5 -5
- package/dist/sdk/index.js +32 -30
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +4 -4
- package/dist/sdk/runner.js +32 -30
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/transport/ws/server.js +5 -5
- package/dist/sdk/transport/ws.js +5 -5
- package/dist/sdk/transport.js +5 -5
- package/dist/sdk/types.js +1 -1
- package/dist/serve-preflight-AADSOUO2.js +58 -0
- package/dist/{serve-preflight-TYEKHC32.js.map → serve-preflight-AADSOUO2.js.map} +1 -1
- package/dist/session/index.js +2 -2
- package/dist/{setup-4JV2IMCB.js → setup-HOAJHUFQ.js} +27 -25
- package/dist/setup-HOAJHUFQ.js.map +1 -0
- package/dist/{skills-6QTKFMLW.js → skills-KHHW3RZ3.js} +6 -6
- package/dist/{skills-6QTKFMLW.js.map → skills-KHHW3RZ3.js.map} +1 -1
- package/dist/source-FOELFCY6.js +88 -0
- package/dist/{source-XYMMJVKR.js.map → source-FOELFCY6.js.map} +1 -1
- package/dist/{source-manifest-publish-SZFGGKB4.js → source-manifest-publish-Q7P5AEVU.js} +44 -42
- package/dist/source-manifest-publish-Q7P5AEVU.js.map +1 -0
- package/dist/transport/index.js +5 -5
- package/dist/transport/ws/server.js +5 -5
- package/dist/transport/ws.js +5 -5
- package/dist/tui/index.js +56 -37
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/src/repl.d.ts +10 -0
- package/dist/tui/src/repl.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/src/version.d.ts +4 -4
- package/dist/workspace-plugin/adapters/mcp.js +24 -22
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2TLPC6TQ.js.map +0 -1
- package/dist/chunk-5XHQBCB5.js.map +0 -1
- package/dist/chunk-65UAC3ZR.js.map +0 -1
- package/dist/chunk-6ARPZHOV.js.map +0 -1
- package/dist/chunk-6SXSVKQY.js.map +0 -1
- package/dist/chunk-7PVGND4J.js.map +0 -1
- package/dist/chunk-7SJHSGUV.js.map +0 -1
- package/dist/chunk-AQNW2FET.js.map +0 -1
- package/dist/chunk-BSMW3PX2.js.map +0 -1
- package/dist/chunk-DI6J2PJB.js.map +0 -1
- package/dist/chunk-DS6UUCFG.js.map +0 -1
- package/dist/chunk-E2EC6SAX.js.map +0 -1
- package/dist/chunk-EPXZQIC6.js.map +0 -1
- package/dist/chunk-F4CZQD3T.js.map +0 -1
- package/dist/chunk-J262X4JU.js.map +0 -1
- package/dist/chunk-J4WKNJHO.js.map +0 -1
- package/dist/chunk-JRVQV7WC.js.map +0 -1
- package/dist/chunk-MMOWIRHP.js.map +0 -1
- package/dist/chunk-SHTXMERQ.js.map +0 -1
- package/dist/chunk-TCH5UDKT.js.map +0 -1
- package/dist/chunk-TUFNY6OD.js.map +0 -1
- package/dist/chunk-U3UDOX6I.js.map +0 -1
- package/dist/chunk-VXYZ5M7Z.js.map +0 -1
- package/dist/chunk-XYCYGN3Q.js.map +0 -1
- package/dist/chunk-YN6N3RBM.js.map +0 -1
- package/dist/ensure-sources-CAMWJTMR.js.map +0 -1
- package/dist/library-publish-UQQMHTND.js.map +0 -1
- package/dist/serve-preflight-TYEKHC32.js +0 -56
- package/dist/setup-4JV2IMCB.js.map +0 -1
- package/dist/source-XYMMJVKR.js +0 -86
- package/dist/source-manifest-publish-SZFGGKB4.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/commands/source-manifest.ts","../cli/src/commands/source.ts"],"names":["path","existsSync","readdirSync","spawnSync","dest"],"mappings":";;;;;;;;;;;;;;;;;;;AAkDA,IAAM,aAAA,GACJ,2IAAA;AAGF,SAAS,SAAS,IAAA,EAAqB;AACrC,EAAA,MAAA,CAAO,CAAA,EAAG,aAAa,CAAA,wBAAA,EAA2B,IAAI,CAAA,CAAA,CAAG,CAAA;AACzD,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAChB;AAsBO,SAAS,gBAAA,CACd,GAAA,EACA,UAAA,EACA,IAAA,GAA6B,EAAC,EAQ9B;AAEA,EAAA,MAAM,UAAA,GAA4B,kBAAA;AAAA,IAC3BA,KAAA,CAAA,IAAA,CAAUA,KAAA,CAAA,OAAA,CAAQ,UAAU,CAAA,EAAG,yBAAyB;AAAA,GAC/D;AACA,EAAA,MAAM,KAAA,GAAQ,WAAW,IAAA,CAAK,CAAC,MAAM,gBAAA,CAAiB,CAAA,EAAG,GAAG,CAAC,CAAA;A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AY,IAAA,CAAK,OAAA,KAAY,MAAM,IAAI,CAAA;AAC5D,QAAA,MAAM,UAAA,GAAa,uBAAuB,IAAI,CAAA;AAC9C,QAAA,IAAI,YAAY,OAAA,CAAQ,CAAA,EAAG,IAAI,CAAA,EAAA,EAAK,UAAU,CAAA,CAAE,CAAA;AAAA,MAClD;AAAA,IACF;AAAA,GACF;AAGF,EAAA,GAAA,CACG,OAAA,CAAQ,aAAa,CAAA,CACrB,WAAA,CAAY,iDAAiD,CAAA,CAC7D,MAAA,CAAO,CAAC,IAAA,KAAiB;AACxB,IAAA,MAAA;AAAA,MACE;AAAA,KAEF;AACA,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB,CAAC,CAAA;AAEH,EAAA,GAAA,CACG,OAAA,CAAQ,eAAe,CAAA,CACvB,WAAA,CAAY,sDAAsD,CAAA,CAClE,MAAA,CAAO,CAAC,IAAA,KAAiB;AACxB,IAAA,MAAA;AAAA,MACE;AAAA,KAEF;AACA,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB,CAAC,CAAA;AAGH,EAAA,yBAAA,CAA0B,GAAG,CAAA;AAE7B,EAAA,OAAO,GAAA;AACT","file":"chunk-XYCYGN3Q.js","sourcesContent":["/**\n * `skaile source manifest …` — curated `skaile.manifest.yaml` lifecycle for a\n * source you do NOT own. `init` generates a curated manifest from a discovery\n * run and stores it OUTSIDE the source, under the local store catalog\n * (`~/.skaile/store/manifests/<slug>.yaml`); `edit` opens it in `$EDITOR` and\n * re-validates on save. `source add`/`sync` then apply it as a read overlay\n * (see `source.ts` `refreshManifestCache`).\n *\n * `rebuild` refreshes a curated manifest after an upstream change (merge by\n * default — curation is sacred; `--overwrite` re-scans). `verify` is a\n * read-only integrity check (paths, declared hashes, schema, dep refs).\n * `publish`/`propose`/`yank` remain stubs — they need the store publish\n * endpoint (`POST /sources/<id>/manifest`), which lands in a follow-up.\n *\n * @docLink cli/commands/source#manifest\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n type AssetEntry,\n decodeSkaileManifest,\n encodeSkaileManifest,\n parseAssetRef,\n resolveSourcePublisher,\n type SkPublishManifest,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n workspaceConfigFilename,\n} from \"@skaile/workspaces/core\";\nimport { computeDeterministicHash, discoverAssetsInTree } from \"@skaile/workspaces/discovery\";\nimport {\n commitStoreManifest,\n getStoreManifestsDir,\n storeManifestFile,\n writeCuratedManifest,\n} from \"@skaile/workspaces/library\";\nimport type { Command } from \"commander\";\nimport { logErr, logInfo, logOk, logWarn, S } from \"../helpers.ts\";\nimport { getKindRegistry } from \"../open-registry.ts\";\nimport {\n ensureClone,\n normalizeSourceUrl,\n readProjectSources,\n sourceClonePath,\n sourceMatchesKey,\n} from \"./source.ts\";\n\nconst NOT_WIRED_MSG =\n \"`skaile source manifest *` is scaffolded but not yet wired. \" +\n \"Server-side endpoint (`POST /sources/<id>/manifest`) lands in a follow-up PR.\";\n\nfunction notWired(verb: string): never {\n logErr(`${NOT_WIRED_MSG} (verb: source manifest ${verb})`);\n process.exit(2);\n}\n\n/**\n * Resolve a `source manifest` argument into a `{ url, slug, dest }` triple.\n *\n * Resolution order:\n * 1. A key matching an already-registered project source (stored URL, cache\n * key, or short slug).\n * 2. A **store slug** whose manifest already exists in\n * `~/.skaile/store/manifests/`: the exact file name (`<host>__<owner>__<repo>` or the\n * `<repo>-<hash>` key of a non-GitHub URL), or — for the verbs that find a manifest, not\n * for `init` — the bare repo name of a non-GitHub URL (`srcA` for `srcA-e2d8fe81.yaml`,\n * p1691). This MUST be tried before bare-name expansion: a bare name like `cli` would\n * otherwise expand (via `normalizeSourceUrl`) to the skaile-ai org and a DIFFERENT slug\n * than the one `init` wrote (e.g. `larksuite`). The slug is the exact identifier `init`'s\n * next-step hint prints back.\n * 3. Otherwise a git URL / `owner/repo` / bare name via `normalizeSourceUrl`.\n *\n * The clone dir is the same URL-keyed cache `source add` uses.\n *\n * `ambiguous` lists the manifest slugs a bare name matched when it matched several.\n */\nexport function resolveSourceArg(\n arg: string,\n projectDir: string,\n opts: { byName?: boolean } = {},\n): {\n url: string;\n slug: string;\n dest: string;\n manifestFile: string;\n guessed: boolean;\n ambiguous?: string[];\n} {\n // Like `source list` / `check` / `add`: the project is `projectDir` itself, no parent search (p1860).\n const registered: SourceEntry[] = readProjectSources(\n path.join(path.resolve(projectDir), workspaceConfigFilename()),\n );\n const match = registered.find((e) => sourceMatchesKey(e, arg));\n const found = !match ? resolveByStoreSlug(arg, opts.byName ?? true) : undefined;\n const bySlug = found && \"url\" in found ? found : undefined;\n const url = match ? match.url : (bySlug?.url ?? normalizeSourceUrl(arg));\n const slug = sourceShortName(url); // human-facing label\n const dest = sourceClonePath(sourceCacheKey(url));\n return {\n url,\n slug,\n dest,\n manifestFile: bySlug?.manifestFile ?? storeManifestPath(url),\n guessed: !match && !bySlug,\n ...(found && \"ambiguous\" in found ? { ambiguous: found.ambiguous } : {}),\n };\n}\n\n/** The slugs (file names without `.yaml`) of the curated manifests in the store. */\nfunction storeManifestSlugs(): string[] {\n try {\n return readdirSync(getStoreManifestsDir())\n .filter((f) => f.endsWith(\".yaml\"))\n .map((f) => f.slice(0, -\".yaml\".length));\n } catch {\n return [];\n }\n}\n\n/** The origin URL of the clone a `<repo>-<hash>` key names, or `undefined` when none is there. */\nfunction cloneOriginUrl(key: string): string | undefined {\n const dest = sourceClonePath(key);\n if (!existsSync(dest)) return undefined;\n const r = spawnSync(\"git\", [\"-C\", dest, \"remote\", \"get-url\", \"origin\"], { encoding: \"utf8\" });\n const out = r.status === 0 ? r.stdout.trim() : \"\";\n return out || undefined;\n}\n\n/**\n * When `arg` names a curated manifest that exists on disk, recover the source URL and point at\n * that manifest file directly. `arg` is a store slug (`<host>__<owner>__<repo>`, or the\n * `<repo>-<hash>` key `init` gives a non-GitHub URL) or, with `byName`, the bare repo name of\n * such a manifest (`srcA` for `srcA-e2d8fe81.yaml`). A GitHub manifest is never found by its bare\n * repo name: `cli` means the skaile-ai repo, not `larksuite/cli`.\n * Returns `{ ambiguous }` when a bare name matches several, and `undefined` when the arg is no\n * slug or has no manifest (fall back to URL normalization).\n */\nfunction resolveByStoreSlug(\n arg: string,\n byName: boolean,\n): { url: string; manifestFile: string } | { ambiguous: string[] } | undefined {\n // A slug is our own encoding — no path/URL sigils. Anything URL/owner-repo shaped is not one.\n if (!/^[\\w.-]+$/.test(arg)) return undefined;\n const slugs = storeManifestSlugs();\n let slug: string | undefined = slugs.includes(arg) ? arg : undefined;\n if (!slug && byName) {\n // Only the `<repo>-<hash>` file of a non-GitHub URL: a bare name never picks one org's\n // `github.com__<org>__<repo>` manifest over the skaile-ai repo it expands to.\n const named = slugs.filter(\n (s) => s.startsWith(`${arg}-`) && /^[0-9a-f]{8}$/.test(s.slice(arg.length + 1)),\n );\n if (named.length === 1) slug = named[0];\n else if (named.length > 1) return { ambiguous: [...named].sort() };\n }\n if (!slug) return undefined;\n const manifestFile = path.join(getStoreManifestsDir(), `${slug}.yaml`);\n if (slug.includes(\"__\")) {\n // `<host>__<owner>__<repo>` → `https://<host>/<owner>/<repo>` — good enough to key the clone\n // dir + re-derive the same slug; the manifest file is what edit actually opens.\n const [host, owner, repo] = slug.split(\"__\");\n return { url: host && owner && repo ? `https://${host}/${owner}/${repo}` : slug, manifestFile };\n }\n // `<repo>-<hash>`: the hash hides the URL; the clone `init` made remembers it.\n const origin = cloneOriginUrl(slug);\n return origin ? { url: origin, manifestFile } : undefined;\n}\n\n/**\n * The `No curated manifest …` line of a verb that needs one. A bare name that matched several\n * manifests (`ambiguous`) is told to pick a slug or the URL instead.\n */\nexport function missingManifestMessage(\n slug: string,\n manifestFile: string,\n ambiguous?: readonly string[],\n): string {\n if (ambiguous?.length) {\n return (\n `\"${slug}\" matches several curated manifests: ${ambiguous.join(\", \")} — ` +\n \"pass one of these slugs or the full source URL.\"\n );\n }\n return (\n `No curated manifest for \"${slug}\" at ${S.dim(manifestFile)} — ` +\n \"run `skaile source manifest init` first.\"\n );\n}\n\n/**\n * Absolute path to a source's curated store manifest. Keyed by the\n * collision-free {@link storeManifestSlug} (`<host>__<owner>__<repo>`) so\n * `orgA/cli` and `orgB/cli` don't share `cli.yaml`.\n */\nfunction storeManifestPath(url: string): string {\n return storeManifestFile(url);\n}\n\n/**\n * Directory-name segments that mark a test-fixture tree. `init`/`rebuild` drop\n * any asset whose repo-relative root contains one of these as an exact path\n * SEGMENT. Repos routinely ship fixture \"skills\" under such dirs (e.g.\n * `scripts/skill-format-check/tests`, `internal/qualitygate/skillscan/testdata/skills/lark-demo`)\n * that are not real, publishable assets.\n */\nconst TEST_FIXTURE_SEGMENTS = new Set([\n \"tests\",\n \"test\",\n \"__tests__\",\n \"testdata\",\n \"fixtures\",\n \"__fixtures__\",\n]);\n\n/**\n * True when an asset's repo-relative `root` sits under a test-fixture directory\n * (see {@link TEST_FIXTURE_SEGMENTS}). Conservative, not repo-specific — finer\n * curation (keeping a genuine fixture asset) stays the user's job via `edit`.\n * `init`/`rebuild`-path only; the general discovery walk (`source add`) is\n * untouched.\n */\nfunction isTestFixtureAsset(relativePath: string): boolean {\n const segments = relativePath.replace(/\\\\/g, \"/\").split(\"/\");\n return segments.some((s) => TEST_FIXTURE_SEGMENTS.has(s));\n}\n\n/**\n * `source manifest init <src>` — clone (if needed), run discovery, and write a\n * curated `skaile.manifest.yaml` to `~/.skaile/store/manifests/<slug>.yaml`.\n */\nasync function runInit(\n arg: string,\n opts: { projectDir: string; publisher?: string; dev?: boolean; force?: boolean },\n): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n const {\n url,\n dest,\n manifestFile: target,\n guessed,\n } = resolveSourceArg(arg, projectDir, {\n byName: false,\n });\n // The same rule `source add` applies (p394): a bare name that is no registered source and no\n // store slug used to expand to a made-up `skaile-ai/<name>` repo and clone it over SSH.\n if (guessed && /^[\\w.-]+$/.test(arg.trim().replace(/\\.git$/, \"\"))) {\n logErr(\n `\"${arg}\" is not a git URL or an owner/repo shorthand. ` +\n \"Use `skaile source manifest init <owner>/<repo>` or the full URL.\",\n );\n process.exitCode = 1;\n return;\n }\n\n if (existsSync(target) && !opts.force) {\n logWarn(\n `A curated manifest already exists at ${S.dim(target)}. ` +\n \"Edit it with `skaile source manifest edit`, refresh it after an upstream \" +\n \"change with `skaile source manifest rebuild`, or pass --force to regenerate.\",\n );\n return;\n }\n\n const entry: SourceEntry = { url };\n ensureClone(entry);\n\n const { assets, errors } = discoverCuratableAssets(dest, opts.dev ?? false);\n\n const publisher = opts.publisher ?? resolveSourcePublisher(dest) ?? sourceShortName(url);\n\n const written = writeCuratedManifest({\n manifestFile: target,\n publisher,\n assets,\n force: opts.force,\n // Init: every asset inherits the top-level repo `publisher`. Do NOT stamp a\n // per-asset publisher — glob discovery here runs without the resolved\n // publisher, so each DiscoveredAsset.publisher is only the clone directory\n // name, which would clobber the intended org/`--publisher` default with\n // junk per-asset overrides.\n inheritPublisher: true,\n });\n\n if (!written.wrote) {\n logWarn(\n `Curated manifest already exists at ${S.dim(target)} — not overwritten. ` +\n \"Pass --force to regenerate.\",\n );\n return;\n }\n\n commitStoreManifest(\n target,\n `manifest init: ${sourceShortName(url)} (${written.assetCount} assets)`,\n );\n logOk(`Wrote curated manifest with ${written.assetCount} assets to ${S.dim(target)}.`);\n // `edit` takes the <src> the user passed (`resolveSourceArg` maps it back to this\n // manifest), but `source add` needs the URL: a bare name there is no source.\n logInfo(\n `Edit it with \\`skaile source manifest edit ${arg}\\`, then ` +\n `\\`skaile source add ${url}\\` to consume it.`,\n );\n if (errors.length > 0) {\n logWarn(`${errors.length} discovery error(s) — inspect the manifest before consuming.`);\n }\n}\n\n/**\n * Run discovery over a clone and drop the test-fixture assets (see\n * {@link isTestFixtureAsset}). Shared by `init` and `rebuild` so both paths\n * produce an identical inventory from the same tree.\n */\nfunction discoverCuratableAssets(\n dest: string,\n includeDev: boolean,\n): { assets: ReturnType<typeof discoverAssetsInTree>[\"assets\"]; errors: string[] } {\n const result = discoverAssetsInTree(dest, {\n registry: getKindRegistry(),\n includeDev,\n });\n const assets = result.assets.filter((a) => !isTestFixtureAsset(a.relativePath));\n return { assets, errors: result.errors.map((e) => `${e.path}: ${e.error}`) };\n}\n\n/**\n * Best-effort `git pull --ff-only` on an existing clone. Never throws: a pull\n * failure (offline, diverged, detached) is warned and the caller continues with\n * the clone as-is.\n */\nfunction pullCloneFfOnly(dest: string): void {\n const res = spawnSync(\"git\", [\"-C\", dest, \"pull\", \"--ff-only\"], { stdio: \"pipe\" });\n if (res.status !== 0) {\n logWarn(\n \"git pull --ff-only failed — continuing with the existing clone \" +\n \"(it may be behind upstream).\",\n );\n }\n}\n\n/**\n * Repo-relative `root` path for a manifest asset entry — the merge match key\n * between an existing curated entry and a freshly-discovered asset. `root:`\n * entries use their declared path; a `files:`-only entry (rare for a curated\n * sidecar) falls back to the entry's dirname of the first file, else the name.\n */\nfunction entryRootKey(entry: AssetEntry): string {\n if (entry.root) return entry.root.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n const files = entry.files;\n if (files && files.length > 0) {\n const first = typeof files[0] === \"string\" ? files[0] : files[0].path;\n const dir = path.posix.dirname(first.replace(/\\\\/g, \"/\"));\n return dir === \".\" ? entry.name : dir;\n }\n return entry.name;\n}\n\n/** Repo-relative `root` path a discovered asset maps to (matches init's writer). */\nfunction discoveredRootKey(relativePath: string): string {\n const dir = path.posix.dirname(relativePath.replace(/\\\\/g, \"/\"));\n return dir === \".\" ? path.posix.basename(relativePath.replace(/\\\\/g, \"/\")) : dir;\n}\n\n/** Human ref for reporting: `kind:name`. */\nfunction entryRef(entry: AssetEntry): string {\n return `${entry.kind}:${entry.name}`;\n}\n\n/**\n * `source manifest rebuild <src>` — refresh a curated manifest after the\n * upstream repo changed. MERGE is the default (curation is sacred); `--overwrite`\n * re-scans from scratch with `init --force` semantics.\n *\n * Merge algorithm (match by repo-relative `root` path):\n * - Existing entries whose root is STILL discovered → KEPT verbatim (all\n * hand-edits preserved).\n * - Existing entries whose root is GONE upstream → DROPPED (reported).\n * - Freshly-discovered assets not already in the manifest → NOT auto-added,\n * only REPORTED (a curated foreign sidecar must not silently absorb new\n * upstream skills). An asset the curator deliberately dropped stays dropped\n * because it is neither in the existing manifest nor re-added here.\n */\nasync function runRebuild(\n arg: string,\n opts: { projectDir: string; publisher?: string; dev?: boolean; overwrite?: boolean },\n): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n const { url, dest, slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(missingManifestMessage(slug, target, ambiguous));\n process.exit(1);\n }\n\n // Update the clone: clone if absent, else pull --ff-only (best-effort).\n const entry: SourceEntry = { url };\n const cloned = ensureClone(entry);\n if (!cloned) pullCloneFfOnly(dest);\n\n const { assets: freshAssets, errors } = discoverCuratableAssets(dest, opts.dev ?? false);\n\n if (opts.overwrite) {\n logWarn(\n \"--overwrite: replacing the curated manifest with a full fresh inventory. \" +\n \"All hand-curation (dropped assets, per-asset edits) is discarded.\",\n );\n const publisher = opts.publisher ?? resolveSourcePublisher(dest) ?? sourceShortName(url);\n const written = writeCuratedManifest({\n manifestFile: target,\n publisher,\n assets: freshAssets,\n force: true,\n inheritPublisher: true,\n });\n commitStoreManifest(\n target,\n `manifest rebuild --overwrite: ${slug} (${written.assetCount} assets)`,\n );\n logOk(\n `Rebuilt curated manifest with ${written.assetCount} assets to ${S.dim(target)} (overwrite).`,\n );\n if (errors.length > 0) {\n logWarn(`${errors.length} discovery error(s) — inspect the manifest before consuming.`);\n }\n return;\n }\n\n // MERGE (default). `--publisher` only applies to the full re-derive path.\n if (opts.publisher) {\n logWarn(\n \"--publisher is ignored in merge mode (the curated publisher is preserved). \" +\n \"Use --overwrite to re-derive the publisher from a full re-scan.\",\n );\n }\n\n // Read the existing curated manifest and keep it as the base.\n const { manifest: existing } = decodeSkaileManifest(readFileSync(target, \"utf-8\"));\n const existingEntries = existing.assets ?? [];\n\n // Index fresh discovery by repo-relative root path.\n const freshByRoot = new Map<string, (typeof freshAssets)[number]>();\n for (const a of freshAssets) freshByRoot.set(discoveredRootKey(a.relativePath), a);\n\n const kept: AssetEntry[] = [];\n const dropped: string[] = [];\n for (const e of existingEntries) {\n if (freshByRoot.has(entryRootKey(e))) kept.push(e);\n else dropped.push(entryRef(e));\n }\n\n // Fresh assets not already curated → report as available, do NOT add.\n const existingRoots = new Set(existingEntries.map(entryRootKey));\n const newlyAvailable: string[] = [];\n for (const a of freshAssets) {\n if (!existingRoots.has(discoveredRootKey(a.relativePath))) {\n newlyAvailable.push(`${a.kind}:${a.name}`);\n }\n }\n\n const changed = dropped.length > 0;\n if (dropped.length > 0) {\n logWarn(`removed (gone upstream): ${dropped.sort().join(\", \")}`);\n }\n if (newlyAvailable.length > 0) {\n logInfo(\n `${newlyAvailable.length} new upstream asset(s) available (not added): ` +\n `${newlyAvailable.sort().join(\", \")} — add with \\`skaile source manifest edit ${arg}\\` if wanted`,\n );\n }\n\n if (!changed) {\n logOk(\"already up to date\");\n if (errors.length > 0) {\n logWarn(`${errors.length} discovery error(s) — inspect the source before re-consuming.`);\n }\n return;\n }\n\n const merged: SkPublishManifest = { ...existing, assets: kept };\n writeFileSync(target, encodeSkaileManifest(merged), \"utf-8\");\n commitStoreManifest(\n target,\n `manifest rebuild: ${slug} (kept ${kept.length}, dropped ${dropped.length})`,\n );\n logOk(\n `Rebuilt curated manifest: kept ${kept.length}, dropped ${dropped.length} → ${S.dim(target)}.`,\n );\n if (errors.length > 0) {\n logWarn(`${errors.length} discovery error(s) — inspect the source before re-consuming.`);\n }\n}\n\n/**\n * `source manifest verify <src>` — READ-ONLY integrity check of a curated\n * manifest against its clone. Writes nothing. Exit 0 when no errors; with\n * `--strict`, any warning also forces a nonzero exit.\n *\n * Per-asset checks:\n * - `root`/`files` paths still exist upstream (missing → error).\n * - A declared `sha256` recomputes to the same deterministic hash (mismatch → error).\n * - Schema decode diagnostics map to errors/warnings.\n * - Dependency refs parse via `parseAssetRef` (malformed → warning).\n */\nasync function runVerify(\n arg: string,\n opts: { projectDir: string; strict?: boolean },\n): Promise<void> {\n const projectDir = path.resolve(opts.projectDir);\n const { url, dest, slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(missingManifestMessage(slug, target, ambiguous));\n process.exit(1);\n }\n\n // Ensure a clone exists to verify paths/hashes against (best-effort; no pull).\n ensureClone({ url });\n\n const text = readFileSync(target, \"utf-8\");\n const { manifest, diagnostics } = decodeSkaileManifest(text);\n\n const errors: string[] = [];\n const warnings: string[] = [];\n\n // Schema diagnostics from the decoder.\n for (const d of diagnostics) {\n const line = `${d.code}: ${d.message}`;\n if (d.severity === \"error\") errors.push(line);\n else warnings.push(line);\n }\n\n const assets = manifest.assets ?? [];\n for (const entry of assets) {\n const ref = entryRef(entry);\n\n // Path existence: `root` dir and/or each `files[]` path.\n const relPaths: string[] = [];\n if (entry.root) relPaths.push(entry.root);\n if (entry.files) {\n for (const f of entry.files) relPaths.push(typeof f === \"string\" ? f : f.path);\n }\n if (relPaths.length === 0) relPaths.push(entry.name);\n for (const rel of relPaths) {\n if (!existsSync(path.join(dest, rel))) {\n errors.push(`${ref}: path not found upstream: ${rel}`);\n }\n }\n\n // Declared sha256 → recompute + compare, but ONLY for granular `files:`\n // entries. Discovery (`discover-manifest.ts`) anchors a `files:`-only entry\n // at the REPO ROOT and hashes the files VERBATIM as repo-relative strings\n // (the path is folded into the digest), so verify must hash the same way:\n // `assetRoot = dest`, files kept repo-relative — NOT rebased onto the root.\n // A `root:` entry cannot be verified this way (discovery hashes only the\n // per-kind filtered set, not the whole-dir walk), and the writer never emits\n // sha256 for `root:` entries, so skip the hash check for them.\n if (entry.sha256) {\n if (entry.files && entry.files.length > 0) {\n const hashFiles = entry.files.map((f) =>\n (typeof f === \"string\" ? f : f.path).replace(/\\\\/g, \"/\"),\n );\n const actual = computeDeterministicHash(dest, hashFiles);\n if (actual !== entry.sha256) {\n errors.push(\n `${ref}: sha256 mismatch (declared ${entry.sha256.slice(0, 12)}…, got ${actual.slice(0, 12)}…)`,\n );\n }\n } else {\n warnings.push(\n `${ref}: declared sha256 on a root:-mode entry is not verifiable (discovery hashes only the per-kind filtered set) — skipped`,\n );\n }\n }\n\n // Dependency refs parse.\n for (const dep of entry.dependencies ?? []) {\n try {\n parseAssetRef(dep);\n } catch (err) {\n warnings.push(\n `${ref}: malformed dependency \"${dep}\": ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n }\n\n for (const w of warnings) logWarn(w);\n for (const e of errors) logErr(e);\n\n if (errors.length === 0) {\n logOk(`verified ${assets.length} asset(s).`);\n } else {\n logErr(`${errors.length} issue(s).`);\n }\n\n const failStrict = opts.strict && warnings.length > 0;\n if (errors.length > 0 || failStrict) process.exit(1);\n}\n\n/**\n * Split a `$VISUAL`/`$EDITOR` value into `{ command, args }` and append the file\n * as the final arg. The env value is a full command line, not a bare binary —\n * `EDITOR=\"code --wait\"` must spawn `code` with `[\"--wait\", <file>]`, and\n * `EDITOR=code` (which returns before save) is the user's problem, not ours.\n * A whitespace split covers the common editors (`code --wait`, `code -w`,\n * `subl -w`, `vi`); paths with embedded spaces are not supported (rare for an\n * editor binary and out of scope). Falls back to `vi` when unset/empty.\n *\n * @docLink cli/commands/source#manifest-edit\n */\nexport function resolveEditorCommand(\n editorEnv: string | undefined,\n target: string,\n): { command: string; args: string[] } {\n const parts = (editorEnv ?? \"\").trim().split(/\\s+/).filter(Boolean);\n const [command, ...rest] = parts.length > 0 ? parts : [\"vi\"];\n return { command: command as string, args: [...rest, target] };\n}\n\n/** Minimal spawn contract runEdit needs — lets tests inject a fake. */\ntype SpawnLike = (\n command: string,\n args: string[],\n opts: { stdio: \"inherit\" },\n) => { status: number | null };\n\n/**\n * `source manifest edit <src>` — open the curated store manifest in `$EDITOR`\n * and re-validate on save. Warnings are surfaced but never hard-fail.\n *\n * `spawn` is injectable so tests can assert the argv without launching a real\n * editor; production passes the default `spawnSync`.\n */\nexport function runEdit(\n arg: string,\n opts: { projectDir: string },\n spawn: SpawnLike = spawnSync as unknown as SpawnLike,\n): void {\n const projectDir = path.resolve(opts.projectDir);\n const { slug, manifestFile: target, ambiguous } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(missingManifestMessage(slug, target, ambiguous));\n process.exit(1);\n }\n\n const { command, args } = resolveEditorCommand(process.env.VISUAL || process.env.EDITOR, target);\n const res = spawn(command, args, { stdio: \"inherit\" });\n if (res.status !== 0 && res.status !== null) {\n logErr(`Editor exited with status ${res.status}.`);\n process.exit(1);\n }\n\n commitStoreManifest(target, `manifest edit: ${slug}`);\n\n // Re-validate the saved file; surface diagnostics as warnings, don't hard-fail.\n const { diagnostics } = decodeSkaileManifest(readFileSync(target, \"utf-8\"));\n const errors = diagnostics.filter((d) => d.severity === \"error\");\n const warnings = diagnostics.filter((d) => d.severity !== \"error\");\n if (errors.length > 0) {\n for (const d of errors) logErr(`${d.code}: ${d.message}`);\n logWarn(\"Manifest has errors — fix them before `skaile source add` will consume it.\");\n } else if (warnings.length > 0) {\n for (const d of warnings) logWarn(`${d.code}: ${d.message}`);\n logOk(\"Saved (with warnings).\");\n } else {\n logOk(\"Saved.\");\n }\n}\n\n/**\n * Append the `manifest` sub-tree to a `source` command.\n *\n * Called from `makeSourceCommand()` in `source.ts`.\n */\nexport function addSourceManifestCommands(src: Command): void {\n // enablePositionalOptions so options on the leaf verb (`source manifest init\n // --publisher …`) route to that verb instead of being rejected by `manifest`.\n const manifest = src\n .command(\"manifest\")\n .description(\"Curated manifest lifecycle for a source\")\n .enablePositionalOptions();\n\n manifest\n .command(\"init <src>\")\n .description(\"Generate a curated manifest for a source (stored in the local store catalog)\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--publisher <name>\", \"Override the publisher (default: source's GitHub org)\")\n .option(\"--dev\", \"Include assets under the source's dev_paths\", false)\n .option(\"--force\", \"Overwrite an existing curated manifest\", false)\n .action((arg, opts) => runInit(arg, opts));\n\n manifest\n .command(\"edit <src>\")\n .description(\"Open the curated manifest in $EDITOR and re-validate on save\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .action((arg, opts) => runEdit(arg, opts));\n\n manifest\n .command(\"rebuild <src>\")\n .description(\n \"Refresh a curated manifest after an upstream change (merge by default: \" +\n \"keeps curation, drops assets gone upstream, reports new ones without adding)\",\n )\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--publisher <name>\", \"Override the publisher (--overwrite only)\")\n .option(\"--dev\", \"Include assets under the source's dev_paths\", false)\n .option(\"--overwrite\", \"Discard curation and re-scan the full inventory\", false)\n .action((arg, opts) => runRebuild(arg, opts));\n\n manifest\n .command(\"verify <src>\")\n .description(\"Verify hashes, deps, and schema (read-only)\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--strict\", \"Fail on advisory checks (warnings force a nonzero exit)\", false)\n .action((arg, opts) => runVerify(arg, opts));\n\n manifest\n .command(\"publish <src>\")\n .description(\"Push the curated sidecar manifest and publish it to the store\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--as <namespace>\", \"Publisher namespace (default: your store username)\")\n .option(\"--sidecar-repo <url>\", \"Public GitHub repo you own to hold the curated manifest\")\n .option(\"--ref <gitref>\", \"Foreign source ref to ingest (branch/sha; default: main)\")\n .option(\"--dry-run\", \"Print the publish plan without pushing or calling the store\", false)\n .action(async (arg, opts) => {\n const { runPublish } = await import(\"./source-manifest-publish.ts\");\n await runPublish(arg, opts);\n });\n\n manifest\n .command(\"propose <src>\")\n .description(\"Open a PR to upstream with the sidecar manifest\")\n .action(() => notWired(\"propose\"));\n\n manifest\n .command(\"yank <src>\")\n .description(\"Retract the source's published assets from the store\")\n .option(\"-C, --project-dir <dir>\", \"Project directory\", process.cwd())\n .option(\"--asset <ref>\", \"Yank only the asset matching this ref/name\")\n .action(async (arg, opts) => {\n const { runYank } = await import(\"./source-manifest-publish.ts\");\n await runYank(arg, opts);\n });\n}\n","/**\n * `skaile source …` — manage github sources for the current project.\n *\n * A *source* is a third-party github repo of AI assets. The project's\n * `skaile.yaml` `sources:` array is the source of truth for which sources\n * this project uses. The clone itself lives at\n * `<cache root>/sources/<host>/<owner>/<repo>/` (`~/.skaile/cache` unless `SKAILE_HOME` or\n * `SKAILE_CACHE_DIR` moves it; machine-global cache, shared across projects, URL-keyed so\n * cross-org repos never collide), and the manifest is mirrored into `<skaile home>/index.db`\n * (machine-global manifest cache).\n *\n * @docLink cli/commands/source\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n realpathSync,\n renameSync,\n rmdirSync,\n rmSync,\n statSync,\n} from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport {\n attachToBranch,\n buildProvenanceIndex,\n discardUnclonedSourceDir,\n getGlobalCacheDir,\n getRepoCommit,\n globalCacheRoot,\n globalSkaileDir,\n isSourceCloned,\n priorSourceCacheKeys,\n resolveSkWorkspaceConfig,\n resolveSourcePublisher,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n WorkspaceYamlEditor,\n workspaceConfigFilename,\n} from \"@skaile/workspaces/core\";\nimport { AssetManager } from \"@skaile/workspaces/asset-manager\";\nimport { curatedManifestOverlay, LocalCatalogSource } from \"@skaile/workspaces/library\";\nimport * as p from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { logErr, logInfo, logNoProject, logOk, logWarn, S } from \"../helpers.ts\";\nimport { openLibraryManager } from \"../open-library.ts\";\nimport { getKindRegistry, getKnownKinds } from \"../open-registry.ts\";\nimport { requireValidPublisherOrExit } from \"./library-index.ts\";\nimport { addSourceManifestCommands } from \"./source-manifest.ts\";\n\n/**\n * Clone dir for one source cache key (`<host>/<owner>/<repo>`). Exported for the\n * cache-path regression test. Callers pass `sourceCacheKey(url)`.\n */\nexport function sourceClonePath(key: string): string {\n return path.join(getGlobalCacheDir(), key);\n}\n\nconst SKAILE_MANIFEST_FILENAME = \"skaile.manifest.yaml\";\nconst LEGACY_SOURCE_CONFIG_FILENAME = \".skaile-source.yaml\";\n\n/**\n * Whether a manifest-cache refresh actually failed to index something. Keyed on\n * `errors`, NOT on `assetsUpdated < assetsFound`: the discovery walk counts\n * presets (and other intentionally-not-cataloged kinds) toward `assetsFound` but\n * never upserts them, so a source shipping a `.preset.yaml` would otherwise read\n * as a partial failure — false `! N asset(s) failed to index` + exit 1 — with\n * zero real errors.\n */\nexport function indexingHadFailures(result: { errors: string[] }): boolean {\n return result.errors.length > 0;\n}\n\n/**\n * A clone that ships only the legacy `.skaile-source.yaml` (no\n * `skaile.manifest.yaml`) has its declared `publisher_default` silently ignored\n * — discovery only reads `skaile.manifest.yaml`, so publisher resolution falls\n * back to the first path segment. Surface a hint so the author can fix it.\n */\nexport function legacySourceConfigHint(dest: string): string | undefined {\n const hasLegacy = existsSync(path.join(dest, LEGACY_SOURCE_CONFIG_FILENAME));\n const hasManifest = existsSync(path.join(dest, SKAILE_MANIFEST_FILENAME));\n if (hasLegacy && !hasManifest) {\n return (\n `This source ships a legacy ${LEGACY_SOURCE_CONFIG_FILENAME} but no ` +\n `${SKAILE_MANIFEST_FILENAME}; its declared publisher is ignored and assets ` +\n `are published under their first path segment. Add a ${SKAILE_MANIFEST_FILENAME} ` +\n `(\\`skaile source manifest init\\`) to set the publisher and asset inventory.`\n );\n }\n return undefined;\n}\n\n/**\n * The one spelling of a full git URL or scp-style spec: trailing slashes dropped, scheme and\n * host in lower case (userinfo, path and a `.git` suffix stay as typed). `…/skillz.git/` and\n * `HTTPS://GitHub.com/o/skillz.git` are the source `…/skillz.git` already is (p891, p722).\n */\nfunction canonicalGitUrl(spec: string): string {\n const noSlash = spec.replace(/\\/+$/, \"\");\n const url = /^([a-z][a-z0-9+.-]*):\\/\\/([^/]*)(.*)$/i.exec(noSlash);\n if (url) {\n const scheme = (url[1] ?? \"\").toLowerCase();\n // A `file://` path with `.`, `..` or `//` segments is the one repository its folded path\n // names: `file:///a/r1/../remotes/x.git` is `file:///a/remotes/x.git` (p1856).\n if (scheme === \"file\" && url[2] === \"\" && /(?:^|\\/)\\.\\.?(?:\\/|$)|\\/\\//.test(url[3] ?? \"\")) {\n return `file://${path.posix.normalize(url[3] ?? \"\")}`;\n }\n const authority = url[2] ?? \"\";\n const at = authority.lastIndexOf(\"@\");\n const host = authority.slice(at + 1).toLowerCase();\n return `${scheme}://${authority.slice(0, at + 1)}${host}${url[3] ?? \"\"}`;\n }\n const scp = /^(git@)([^:]+):(.*)$/.exec(noSlash);\n return scp ? `${scp[1]}${(scp[2] ?? \"\").toLowerCase()}:${scp[3] ?? \"\"}` : noSlash;\n}\n\n/**\n * Normalize a `source add` argument into a clonable git URL. Full URLs and\n * scp-style (`git@host:…`) specs keep their form but get the canonical spelling of\n * {@link canonicalGitUrl}; a local path (`/abs`, `./rel`,\n * `../rel`, `~/x`) becomes an absolute, normalised path so the same repo added from two\n * directories is one source and a clone never depends on the cwd; an `owner/repo`\n * shorthand and a bare repo name expand to GitHub over SSH — a bare name\n * defaults to the `skaile-ai` org (`git@github.com:skaile-ai/<name>.git`).\n */\nexport function normalizeSourceUrl(input: string): string {\n const s = input.trim();\n if (/^(?:https?|git|ssh|file):\\/\\//.test(s) || /^git@/.test(s)) return canonicalGitUrl(s);\n if (/^(?:\\/|\\.{1,2}(?:\\/|$)|~\\/)/.test(s)) {\n const abs = path.resolve(s.startsWith(\"~/\") ? path.join(os.homedir(), s.slice(2)) : s);\n // The same folder reached through a symlink (macOS `/var` → `/private/var`) is one source.\n try {\n return realpathSync(abs);\n } catch {\n return abs;\n }\n }\n const repo = s.replace(/\\.git$/, \"\");\n if (/^[\\w.-]+\\/[\\w.-]+$/.test(repo)) return `git@github.com:${repo}.git`;\n if (/^[\\w.-]+$/.test(repo)) return `git@github.com:skaile-ai/${repo}.git`;\n return s;\n}\n\n/**\n * Match a stored source against a user-supplied key. Mirrors the shortcut\n * expansion `source add` applies (`normalizeSourceUrl`) so any form that `add`\n * accepted — bare name, `owner/repo`, `.git`-suffixed, full URL — also resolves\n * at `sync`/`show`/`remove` time, not just the raw stored URL or derived slug.\n */\nexport function sourceMatchesKey(entry: SourceEntry, key: string): boolean {\n if (entry.url === key) return true;\n if (sourceCacheKey(entry.url) === key || sourceShortName(entry.url) === key) return true;\n return entry.url === normalizeSourceUrl(key);\n}\n\n/**\n * Name a source in output: its repo short name, or its clone-cache key when\n * another source in the project shares that short name (two `skillz` repos of\n * different owners). The key is unique per URL and `source show`/`remove` accept it.\n */\nexport function sourceLabel(entry: SourceEntry, all: readonly SourceEntry[]): string {\n const short = sourceShortName(entry.url);\n const shared = all.some((s) => s.url !== entry.url && sourceShortName(s.url) === short);\n return shared ? sourceCacheKey(entry.url) : short;\n}\n\n/** Outcome of {@link resolveSource}. */\nexport type SourceResolution =\n | { kind: \"one\"; entry: SourceEntry }\n | { kind: \"ambiguous\"; entries: SourceEntry[] }\n | { kind: \"none\" };\n\n/**\n * `true` for a source on this machine: an absolute path or a `file://` URL. The two spellings of\n * one repository share a clone-cache key and are one source (p618).\n */\nfunction isLocalSourceUrl(url: string): boolean {\n return url.startsWith(\"/\") || url.startsWith(\"file://\");\n}\n\n/**\n * Pick the one source `key` names. Exact forms win over names: the stored URL,\n * then the cache key, then the repo short name or a `source add` shortcut, then the other\n * spelling of a local repository (`file:///x/r.git` for a source added as `/x/r.git`). A\n * name that several sources share (`skillz` from two owners) is `ambiguous`\n * instead of silently picking the first.\n */\nexport function resolveSource(sources: readonly SourceEntry[], key: string): SourceResolution {\n const tiers: ((s: SourceEntry) => boolean)[] = [\n (s) => s.url === key,\n (s) => sourceCacheKey(s.url) === key,\n (s) => sourceShortName(s.url) === key || s.url === normalizeSourceUrl(key),\n (s) =>\n isLocalSourceUrl(key) &&\n isLocalSourceUrl(s.url) &&\n realLocalCacheKey(s.url) === realLocalCacheKey(normalizeSourceUrl(key)),\n ];\n for (const tier of tiers) {\n const hits = sources.filter(tier);\n if (hits.length === 1) return { kind: \"one\", entry: hits[0] };\n if (hits.length > 1) return { kind: \"ambiguous\", entries: hits };\n }\n return { kind: \"none\" };\n}\n\nfunction exitAmbiguousSource(key: string, entries: readonly SourceEntry[]): never {\n logErr(`\"${key}\" matches ${entries.length} sources; pass the URL of the one you mean:`);\n for (const e of entries) console.error(` ${e.url}`);\n process.exit(1);\n}\n\n/**\n * git's stderr as one line: every line but the `hint:` advice and the\n * `From <url>` / ` * branch …` fetch progress, joined by spaces. Keeps the\n * cause (`fatal: '<path>' does not appear to be a git repository`).\n */\nfunction pullFailureReason(stderr: string): string {\n return stderr\n .split(\"\\n\")\n .map((l) => l.trim())\n .filter((l) => l !== \"\" && !/^(hint:|From |[*+=!-] )/.test(l))\n .join(\" \");\n}\n\n/** The advisory a reference lint raises for a file the asset filter leaves out. */\nconst FILTER_ADVISORY = \"not captured by the file filter\";\n\n/**\n * Print the advisories of one indexing run. The reference notes about files outside the asset\n * filter are one line with a count unless `verbose`; every other advisory stays on its own line\n * (p1031: a source such as ai-assets printed 77 of them on every sync).\n */\nfunction logAdvisories(advisories: readonly string[], verbose: boolean, slug?: string): void {\n const prefix = slug ? `${slug}: ` : \"\";\n const filtered = advisories.filter((a) => a.includes(FILTER_ADVISORY));\n for (const advisory of advisories) {\n if (verbose || !advisory.includes(FILTER_ADVISORY)) logInfo(`${prefix}${advisory}`);\n }\n if (!verbose && filtered.length > 0) {\n logInfo(\n `${prefix}${filtered.length} referenced file${filtered.length === 1 ? \"\" : \"s\"} outside the asset filter (pass --verbose to list them)`,\n );\n }\n}\n\n/**\n * Find an already-registered source that maps to the same cache key as `url`\n * but is stored under a *different* URL string (e.g. the `.git`-suffixed or\n * scp form of the same remote). Two such entries would fight over one clone\n * dir, so `source add` rejects the ambiguity. Returns the colliding entry, or\n * `undefined` when the URL is unique or only matches an exact-string duplicate\n * (which `setSource` updates in place).\n */\nexport function findCacheKeyCollision(\n sources: SourceEntry[],\n url: string,\n): SourceEntry | undefined {\n const key = realLocalCacheKey(url);\n return sources.find((s) => s.url !== url && realLocalCacheKey(s.url) === key);\n}\n\n/**\n * The clone-cache key of `url`; a repository on this machine is keyed by its real path, so a\n * symlinked spelling (`/var/x` for `/private/var/x`) is the same source (p618).\n */\nfunction realLocalCacheKey(url: string): string {\n const local = url.startsWith(\"file://\") ? url.slice(\"file://\".length) : url;\n if (local.startsWith(\"/\") && existsSync(local)) {\n try {\n return sourceCacheKey(realpathSync(local));\n } catch {\n // fall through to the spelling\n }\n }\n return sourceCacheKey(url);\n}\n\n/**\n * `projectDir` when it holds its own `skaile.yaml`, else `undefined`. Like `list`, `check` and\n * `add`, the `source` commands never search parent directories (p1860).\n */\nfunction projectRootOf(projectDir: string): string | undefined {\n const dir = path.resolve(projectDir);\n return existsSync(path.join(dir, workspaceConfigFilename())) ? dir : undefined;\n}\n\n/** The `skaile.yaml` path of `projectDir`; stops with the `No skaile.yaml found` lines when it has none. */\nfunction requireProjectYamlPath(projectDir: string): string {\n const root = projectRootOf(projectDir);\n if (!root) {\n logNoProject(projectDir);\n process.exit(1);\n }\n return path.join(root, workspaceConfigFilename());\n}\n\n/**\n * Load `skaile.yaml` for a `source` command. A file that does not parse stops the command with\n * the one `<file> — parse error: <reason>` line `check` and `install` print: it is not \"no\n * sources\", and nothing is written to it (p1421).\n */\nexport function loadProjectEditor(yamlPath: string): WorkspaceYamlEditor {\n try {\n return WorkspaceYamlEditor.load(yamlPath);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n logErr(/ — parse error: /.test(message) ? message : `Could not read ${yamlPath}: ${message}`);\n process.exit(1);\n }\n}\n\nexport function readProjectSources(yamlPath: string): SourceEntry[] {\n if (!existsSync(yamlPath)) return [];\n try {\n return loadProjectEditor(yamlPath).getSources();\n } catch (err) {\n logErr(`Could not read ${yamlPath}: ${err instanceof Error ? err.message : String(err)}`);\n process.exit(1);\n }\n}\n\n/** Remove the empty `<owner>` / `<host>` directories a failed clone left under `sources/`. */\nfunction pruneEmptyCloneParents(dest: string): void {\n let dir = path.dirname(dest);\n while (path.basename(dir) !== \"sources\" && dir !== path.dirname(dir)) {\n try {\n if (readdirSync(dir).length > 0) return;\n rmdirSync(dir);\n } catch {\n return;\n }\n dir = path.dirname(dir);\n }\n}\n\n/**\n * Clone the source if its clone directory does not yet exist. When `force` is\n * set, the existing clone is replaced by a fresh checkout. Returns true when a\n * clone happened. The cache slug is derived from the URL.\n *\n * A `--force` re-clone moves the old clone aside first and only deletes it once\n * the fresh clone succeeds — so a failed re-clone restores the previous clone\n * rather than leaving the source registered with no cache behind it.\n */\nexport function ensureClone(entry: SourceEntry, opts: { force?: boolean } = {}): boolean {\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n let backup: string | undefined;\n if (!isSourceCloned(dest)) discardUnclonedSourceDir(dest);\n if (isSourceCloned(dest)) {\n if (!opts.force) return false;\n backup = `${dest}.bak`;\n rmSync(backup, { recursive: true, force: true });\n renameSync(dest, backup);\n }\n mkdirSync(path.dirname(dest), { recursive: true });\n const args = [\"clone\", entry.url, dest];\n // `pin` may be a branch/tag; pass it as the clone branch when present.\n if (entry.pin) args.splice(1, 0, \"--branch\", entry.pin);\n const clone = spawnSync(\"git\", args, { stdio: \"inherit\" });\n if (clone.status !== 0) {\n if (backup) {\n rmSync(dest, { recursive: true, force: true });\n renameSync(backup, dest);\n } else {\n // Nothing was there before: leave no empty `<host>/<owner>/` directories behind.\n rmSync(dest, { recursive: true, force: true });\n pruneEmptyCloneParents(dest);\n }\n logErr(`git clone failed for ${entry.url}`);\n process.exit(1);\n }\n if (backup) rmSync(backup, { recursive: true, force: true });\n return true;\n}\n\n/**\n * Advance an existing clone with `git pull --ff-only`. `add` and\n * `install --locked` leave the shared clone on a detached HEAD at the locked\n * commit, where `git pull` refuses to run, so a detached clone is put back on\n * its branch first (the pin when it is a branch, else the remote's default).\n * An entry pinned to a tag or SHA has nothing to pull and counts as synced.\n * On failure `error` is one line: git's whole stderr minus `hint:` advice and fetch progress.\n */\nexport function pullSourceClone(\n dest: string,\n entry: SourceEntry,\n): { ok: true } | { ok: false; error: string } {\n if (!attachToBranch(dest, entry.pin) && entry.pin) return { ok: true };\n const pull = spawnSync(\"git\", [\"pull\", \"--ff-only\"], {\n cwd: dest,\n stdio: \"pipe\",\n encoding: \"utf8\",\n });\n if (pull.status === 0) return { ok: true };\n const reason = pullFailureReason(pull.stderr) || `git exited with status ${pull.status}`;\n return { ok: false, error: `git pull failed: ${reason}` };\n}\n\n/**\n * Library name for a new source row: the repo short name, or `<owner>-<repo>`\n * (then `<host>-<owner>-<repo>`) when another library already holds that name.\n * Rows are found by clone path, never by this name: `orgA/repo` and\n * `orgB/repo` share the short name `repo`.\n */\nfunction sourceLibraryName(url: string, libs: readonly { name: string }[]): string {\n const taken = new Set(libs.map((l) => l.name));\n // A repo may be named `my.repo`; `addLibrary` only accepts `[A-Za-z0-9_-]`\n // starting with a letter or digit, so every candidate is slugged first.\n const flat = (s: string) => s.replace(/[^A-Za-z0-9_-]+/g, \"-\").replace(/^[-_]+/, \"\") || \"source\";\n const short = flat(sourceShortName(url));\n if (!taken.has(short)) return short;\n const parts = sourceCacheKey(url).split(\"/\");\n const candidates =\n parts.length === 3\n ? [flat(`${parts[1]}-${parts[2]}`), flat(`${parts[0]}-${parts[1]}-${parts[2]}`)]\n : [];\n for (const c of candidates) if (!taken.has(c)) return c;\n let n = 2;\n while (taken.has(`${short}-${n}`)) n++;\n return `${short}-${n}`;\n}\n\n/**\n * Why a freshly cloned source has no publisher to give its assets, or `undefined`. A GitHub URL\n * derives it from the org and `--publisher` records it, so only another URL is walked: the walk\n * is the one `add`, `install` and `check` run, so what it refuses here they would skip later.\n */\nasync function publisherProblem(entry: SourceEntry, dest: string): Promise<string | undefined> {\n if (entry.publisher || /github\\.com[/:]/.test(entry.url)) return undefined;\n let problem: string | undefined;\n await buildProvenanceIndex(\n [\n {\n localPath: dest,\n sourceUrl: entry.url,\n commit: getRepoCommit(dest) ?? \"0\".repeat(40),\n tag: entry.pin,\n overlayManifestPath: curatedManifestOverlay(entry.url),\n },\n ],\n {\n knownKinds: getKnownKinds(),\n onSourceError: (_clone, err) => {\n const why = err instanceof Error ? err.message : String(err);\n if (/publisher must be declared/.test(why)) problem = why;\n },\n },\n );\n return problem;\n}\n\n/**\n * Refresh the machine-global manifest cache for `entry` by running discovery\n * and upserting AssetDefinitions into `<skaile home>/index.db`. Creates the\n * libraries-table cache row if missing (ownership: reader = cache state).\n */\nasync function refreshManifestCache(\n entry: SourceEntry,\n includeDev = false,\n): Promise<{\n assetsFound: number;\n assetsUpdated: number;\n errors: string[];\n advisories: string[];\n}> {\n const { manager, library, close } = await openLibraryManager();\n try {\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n const libs = await manager.listLibraries();\n const existing = libs.find((l) => path.resolve(l.path) === path.resolve(dest));\n // A clone made under an older cache key (the bare last segment before the url hash; `.git`\n // kept for a `….git/` url) leaves its library row at the old path. The row is this source's:\n // point it at the new clone instead of adding a second row for the same source (`add` would\n // warn \"exists in 2 libraries\"). Found by the old clone path or by the url it records.\n const key = sourceCacheKey(entry.url);\n const priorDirs = priorSourceCacheKeys(entry.url).map((k) => path.resolve(sourceClonePath(k)));\n const legacyRow = existing\n ? undefined\n : libs.find(\n (l) =>\n l.ownership === \"reader\" &&\n (priorDirs.includes(path.resolve(l.path)) ||\n (\"url\" in l.backendConfig && sourceCacheKey(l.backendConfig.url) === key)),\n );\n if (legacyRow) {\n const legacyDir = path.resolve(legacyRow.path);\n await manager.updateLibrary(legacyRow.id, { path: dest });\n logInfo(\n `Moved the \"${legacyRow.name}\" library to the new clone ${dest}. ` +\n `The old clone ${legacyDir} is no longer used and can be deleted.`,\n );\n }\n const added =\n existing ??\n legacyRow ??\n (await manager.addLibrary({\n name: sourceLibraryName(entry.url, libs),\n path: dest,\n backend: \"git\",\n backendConfig: {\n url: entry.url,\n branch: entry.pin ?? \"main\",\n authHint: \"ssh\",\n ...(entry.publisher ? { publisher: entry.publisher } : {}),\n },\n ownership: \"reader\",\n }));\n // The library row and its indexed assets are shared by every project that declares the\n // source, so they keep the publisher the first indexer recorded. A project that declares\n // another `--publisher` sees its own one: `AssetManager.scopeLibraryIndex` re-labels the\n // assets for it and leaves what other projects see alone (p1822).\n const cfg = added.backendConfig;\n const recorded = \"url\" in cfg ? cfg.publisher : undefined;\n const publisher = existing || legacyRow ? recorded : entry.publisher;\n const lib = added;\n // A `skaile source manifest init` curated manifest overrides the upstream repo's\n // raw glob discovery; `asset install` rescans with the same overlay.\n const catalog = new LocalCatalogSource(library, lib.id, dest, getKindRegistry(), {\n sidecarManifestFile: curatedManifestOverlay(entry.url),\n publisher,\n });\n const result = await catalog.sync({ includeDev });\n await library.syncSource(lib.id);\n return result;\n } finally {\n close();\n }\n}\n\n/**\n * Re-register the reader library of every source this project declares whose clone is cached\n * but whose library row is gone. The row is machine-wide: `source remove` in another project\n * drops it while this project's `sources:` still names the source, and `search` then finds\n * nothing until `update` runs (p757). Never touches the network; returns the sources restored.\n */\nexport async function restoreSourceReaders(projectDir: string): Promise<string[]> {\n const root = projectRootOf(projectDir);\n if (!root) return [];\n const sources = readProjectSources(path.join(root, workspaceConfigFilename()));\n const cached = sources.filter((s) => isSourceCloned(sourceClonePath(sourceCacheKey(s.url))));\n if (cached.length === 0) return [];\n const { manager, close } = await openLibraryManager();\n let missing: SourceEntry[];\n try {\n const libs = await manager.listLibraries();\n missing = cached.filter(\n (s) =>\n !libs.some(\n (l) => path.resolve(l.path) === path.resolve(sourceClonePath(sourceCacheKey(s.url))),\n ),\n );\n } finally {\n close();\n }\n const restored: string[] = [];\n for (const entry of missing) {\n try {\n await refreshManifestCache(entry);\n restored.push(sourceLabel(entry, sources));\n } catch (err) {\n logWarn(\n `Could not re-register source \"${sourceLabel(entry, sources)}\": ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n return restored;\n}\n\n/**\n * Auto-sync hook for `skaile search` on an unsynced workspace. Clones/pulls and\n * re-indexes every source declared in the project's `skaile.yaml`, then returns\n * whether the manifest cache may have changed (caller re-queries on `true`).\n *\n * Unlike `source sync`, this degrades gracefully — a clone/pull/index failure is\n * logged and skipped (never `process.exit`) so a failed auto-sync falls back to\n * the \"run sync first\" hint rather than killing the search. Returns `false`\n * (silently, no announce) when no sources are declared. Callers must guard\n * air-gapped mode themselves — this always touches the network.\n */\nexport async function autoSyncForSearch(projectDir: string): Promise<boolean> {\n const root = projectRootOf(projectDir);\n if (!root) return false;\n if (readProjectSources(path.join(root, workspaceConfigFilename())).length === 0) return false;\n\n logInfo(\"sources not synced — syncing now…\");\n const { synced } = await syncProjectSources(projectDir);\n return synced > 0;\n}\n\n/**\n * Clone-or-pull every source declared in the project's `skaile.yaml`, then\n * refresh its manifest cache. Shared by `autoSyncForSearch` and `skaile update`\n * (the latter offers it behind a confirm) so a re-deploy can see upstream\n * commits — `update` re-deploys against the local source cache, which is\n * otherwise frozen at the commit captured when the source was first cloned.\n *\n * Graceful by design: a clone/pull/index failure for one source is logged and\n * skipped (never `process.exit`), so a single bad remote can't abort the run.\n * Existing clones are advanced with `git pull --ff-only` (no `--depth=1`, unlike\n * the installer's `pullRepo`, so it fast-forwards instead of tripping the\n * shallow-divergence path). Returns a count summary for the caller to report.\n */\nexport async function syncProjectSources(\n projectDir: string,\n opts: { dev?: boolean } = {},\n): Promise<{ total: number; synced: number; failed: number }> {\n const root = path.resolve(projectDir);\n const sources = readProjectSources(path.join(root, workspaceConfigFilename()));\n let synced = 0;\n let failed = 0;\n for (const entry of sources) {\n const slug = sourceShortName(entry.url);\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n try {\n // Quiet git — the sync is a preparatory step; keep progress bars out of\n // the foreground output (spinner / install result).\n if (!isSourceCloned(dest)) {\n discardUnclonedSourceDir(dest);\n mkdirSync(path.dirname(dest), { recursive: true });\n const args = [\"clone\", entry.url, dest];\n if (entry.pin) args.splice(1, 0, \"--branch\", entry.pin);\n const clone = spawnSync(\"git\", args, { stdio: \"ignore\" });\n if (clone.status !== 0) {\n discardUnclonedSourceDir(dest);\n logWarn(`${slug}: git clone failed, skipping.`);\n failed++;\n continue;\n }\n } else {\n const pull = pullSourceClone(dest, entry);\n if (!pull.ok) {\n logErr(`${slug}: ${pull.error}`);\n failed++;\n continue;\n }\n }\n const result = await refreshManifestCache(entry, opts.dev);\n for (const err of result.errors) logWarn(`${slug}: ${err}`);\n logAdvisories(result.advisories, false, slug);\n synced++;\n } catch (err) {\n logWarn(`${slug}: sync failed — ${err instanceof Error ? err.message : String(err)}`);\n failed++;\n }\n }\n return { total: sources.length, synced, failed };\n}\n\n/**\n * Short names of the project's source clones that hold commits their upstream lacks.\n * `update --no-sync` still re-deploys from such a clone, so it reports them the way\n * `source sync` does. A clone without an upstream (detached at a pin) never counts.\n */\nexport function divergedSourceClones(projectDir: string): string[] {\n const root = path.resolve(projectDir);\n const diverged: string[] = [];\n for (const entry of readProjectSources(path.join(root, workspaceConfigFilename()))) {\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n if (!existsSync(dest)) continue;\n const ahead = spawnSync(\"git\", [\"-C\", dest, \"rev-list\", \"--count\", \"@{upstream}..HEAD\"], {\n stdio: \"pipe\",\n encoding: \"utf8\",\n });\n if (ahead.status === 0 && Number(ahead.stdout.trim()) > 0) {\n diverged.push(sourceShortName(entry.url));\n }\n }\n return diverged;\n}\n\n/** Remove the libraries-table cache row and (optionally) the clone bytes. */\nasync function dropManifestCache(url: string, purgeClone: boolean): Promise<void> {\n const dest = sourceClonePath(sourceCacheKey(url));\n const { manager, close } = await openLibraryManager();\n try {\n // By clone path, not short name: another org's repo of the same name keeps its row.\n const dirs = [dest, ...priorSourceCacheKeys(url).map((k) => sourceClonePath(k))].map((d) =>\n path.resolve(d),\n );\n const existing = (await manager.listLibraries()).find((l) =>\n dirs.includes(path.resolve(l.path)),\n );\n if (existing) {\n await manager.removeLibrary(existing.name, { purge: false });\n }\n } finally {\n close();\n }\n if (purgeClone) {\n const dest = sourceClonePath(sourceCacheKey(url));\n if (existsSync(dest)) rmSync(dest, { recursive: true, force: true });\n }\n}\n\n/**\n * The refusal for a `source add` argument that names a directory on this machine which cannot be\n * cloned: a registered library (it is already searchable and needs no source) or a folder that\n * is not a git repository. `undefined` for a URL, a shorthand or a directory that is a git repo.\n */\nexport async function localPathNotASource(source: string): Promise<string | undefined> {\n const raw = source.trim().replace(/^file:\\/\\//, \"\");\n // The path rule of `normalizeSourceUrl`: a bare name is a shorthand, never a folder in the cwd.\n if (!/^(?:\\/|\\.{1,2}(?:\\/|$)|~\\/)/.test(raw)) return undefined;\n const dir = path.resolve(raw.startsWith(\"~/\") ? path.join(os.homedir(), raw.slice(2)) : raw);\n if (!existsSync(dir) || !statSync(dir).isDirectory()) return undefined;\n const real = realpathSync(dir);\n const { manager, close } = await openLibraryManager();\n try {\n const lib = (await manager.listLibraries()).find((l) => {\n try {\n return realpathSync(l.path) === real;\n } catch {\n return path.resolve(l.path) === dir;\n }\n });\n if (lib) {\n return `${dir} is the library \"${lib.name}\"; it needs no source — \\`skaile library list\\` shows it and its assets are already searchable.`;\n }\n } finally {\n close();\n }\n const git = spawnSync(\"git\", [\"-C\", dir, \"rev-parse\", \"--git-dir\"], { encoding: \"utf8\" });\n if (git.status !== 0) {\n return `${dir} is not a git repository. A source is a git repo: run \\`git init\\` and commit there, or register the folder as a library with \\`skaile library init <name> --path ${dir}\\`.`;\n }\n return undefined;\n}\n\n/**\n * The refusal for a `source add` URL that is the remote of a library registered by hand\n * (`library init --git`, `library init --reader`): its assets are already searchable, and a\n * source of the same repository would register a second, read-only library of the same\n * content (p499). `undefined` for any other URL. The reader row of a source clone never counts:\n * it lives in the clone cache and is the source itself.\n */\nexport async function remoteOfRegisteredLibrary(url: string): Promise<string | undefined> {\n const key = sourceCacheKey(url);\n const cloneRoots = [getGlobalCacheDir(), path.join(globalSkaileDir(), \"sources\")].map((d) =>\n path.resolve(d),\n );\n const { manager, close } = await openLibraryManager();\n try {\n const lib = (await manager.listLibraries()).find((l) => {\n const remote = \"url\" in l.backendConfig ? l.backendConfig.url : undefined;\n if (typeof remote !== \"string\" || sourceCacheKey(remote) !== key) return false;\n const at = path.resolve(l.path);\n return !cloneRoots.some((root) => at.startsWith(root + path.sep));\n });\n return lib\n ? `${url} is the remote of the library \"${lib.name}\"; it needs no source — \\`skaile library list\\` shows it and its assets are already searchable.`\n : undefined;\n } finally {\n close();\n }\n}\n\nexport function makeSourceCommand(): Command {\n const cmd = new Command(\"source\").description(\n \"Manage github sources for the current project (recorded in skaile.yaml)\",\n );\n\n // ── source add ──────────────────────────────────────────────────────────\n cmd\n .command(\"add <source>\")\n .description(\n \"Clone a github repo and register it in this project's skaile.yaml. \" +\n \"<source> is a full git URL or an owner/repo shorthand (→ git@github.com:<owner>/<repo>.git).\",\n )\n .option(\"--name <slug>\", \"[deprecated] no-op — the source entry stores only the URL\")\n .option(\"--pin <ref>\", \"Pin a branch, tag, or 40-char SHA\")\n .option(\"--branch <branch>\", \"[deprecated] alias for --pin\")\n .option(\n \"--force\",\n \"Remove an existing clone and re-clone; also change the publisher of a registered URL\",\n false,\n )\n .option(\n \"--publisher <name>\",\n \"Publisher of the source's assets when its skaile.manifest.yaml declares none (required for a non-GitHub URL)\",\n )\n .option(\"--dev\", \"Also index dev-only assets under the source's dev_paths\", false)\n .option(\"--verbose\", \"List every referenced file outside the asset filter\", false)\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(\n async (\n source: string,\n opts: {\n name?: string;\n pin?: string;\n branch?: string;\n force?: boolean;\n publisher?: string;\n dev?: boolean;\n verbose?: boolean;\n projectDir: string;\n },\n ) => {\n // A bare name used to expand to the `skaile-ai` org over SSH: a typo (or the slug\n // `source manifest init` printed) cloned a made-up repo. Say what to give instead.\n if (/^[\\w.-]+$/.test(source.trim().replace(/\\.git$/, \"\"))) {\n logErr(\n `\"${source}\" is not a git URL or an owner/repo shorthand. ` +\n \"Use `skaile source add <owner>/<repo>` or the full URL \" +\n \"(for a curated manifest: `skaile source add <the repo URL>`).\",\n );\n process.exitCode = 1;\n return;\n }\n const notASource = await localPathNotASource(source);\n if (notASource) {\n logErr(notASource);\n process.exitCode = 1;\n return;\n }\n let url = normalizeSourceUrl(source);\n const ownLibrary = await remoteOfRegisteredLibrary(url);\n if (ownLibrary) {\n logErr(ownLibrary);\n process.exitCode = 1;\n return;\n }\n const yamlPath = requireProjectYamlPath(opts.projectDir);\n\n // A different URL string that maps to the same cache key (e.g. the\n // `.git`-suffixed or scp form of an already-registered remote) would\n // fight over one clone dir. setSource only dedupes exact strings, so\n // reject the ambiguous collision here instead of silently shadowing.\n // The one exception is a repository on this machine: `/x/r.git` and `file:///x/r.git`\n // are one source, and the registered spelling stays (p618).\n const collision = findCacheKeyCollision(readProjectSources(yamlPath), url);\n if (collision && isLocalSourceUrl(collision.url) && isLocalSourceUrl(url)) {\n url = collision.url;\n } else if (collision) {\n logErr(\n `\"${url}\" maps to the same cache key (${sourceCacheKey(url)}) as ` +\n `already-registered \"${collision.url}\". Remove that source first ` +\n `(skaile source remove) or re-use its exact URL to update it.`,\n );\n process.exitCode = 1;\n return;\n }\n\n if (opts.name) {\n logWarn(\n \"the --name flag is deprecated; the source entry now stores only the URL \" +\n \"(the cache slug is derived from it).\",\n );\n }\n const pin = opts.pin ?? opts.branch;\n const slug = sourceShortName(url);\n const entry: SourceEntry = { url };\n if (pin) entry.pin = pin;\n if (opts.publisher) entry.publisher = requireValidPublisherOrExit(opts.publisher);\n\n // The publisher of a registered URL names every ref its assets carry: a different one\n // would re-key the source and break the refs declared under the old one (p722).\n const registered = readProjectSources(yamlPath).find((s) => s.url === url);\n // A source registered without `--publisher` has one too: the manifest's, else the GitHub\n // org of its URL. Compare what each choice resolves to in the clone, not the flag (p722).\n // The clone's `origin` may have been repointed (a mirror, `git remote set-url`), so the\n // org is read from the registered URL when the clone gives none: the guard compares\n // against the registered entry, never against whatever the clone says today.\n const clonedAt = sourceClonePath(sourceCacheKey(url));\n const urlOrg = registered\n ? /github\\.com[/:]([^/]+)\\/[^/]+/.exec(registered.url)?.[1]?.toLowerCase()\n : undefined;\n const publisherNow =\n registered && existsSync(clonedAt)\n ? resolveSourcePublisher(clonedAt, registered.publisher ?? urlOrg)\n : (registered?.publisher ?? urlOrg);\n const publisherThen =\n registered && entry.publisher !== undefined && existsSync(clonedAt)\n ? resolveSourcePublisher(clonedAt, entry.publisher)\n : entry.publisher;\n if (\n registered &&\n publisherNow !== undefined &&\n entry.publisher !== undefined &&\n publisherNow !== publisherThen &&\n !opts.force\n ) {\n let declared: string[] = [];\n try {\n declared = (resolveSkWorkspaceConfig(path.dirname(yamlPath)).dependencies ?? []).filter(\n (d) => d.includes(`@${publisherNow}/`),\n );\n } catch {\n // an unreadable skaile.yaml stops later; the refusal below still holds\n }\n logErr(\n `${url} is registered with publisher \"${publisherNow}\"${\n registered.publisher === undefined ? \" (from its manifest or GitHub org)\" : \"\"\n }; --publisher ` +\n `\"${entry.publisher}\" would change it${\n declared.length > 0 ? ` and break the declared ${declared.join(\", \")}` : \"\"\n }. Pass --force to change it, or skaile source remove it first.`,\n );\n process.exitCode = 1;\n return;\n }\n\n const dest = sourceClonePath(sourceCacheKey(url));\n const preexisting = isSourceCloned(dest);\n // Clone/validate the repo BEFORE touching skaile.yaml — a failed clone\n // (repo not found, bad URL, network error) hard-exits in ensureClone, so\n // the entry is only ever recorded once the source is known-good.\n const cloned = ensureClone(entry, { force: opts.force });\n // A source with no publisher to give is skipped by every later command, so refuse it\n // here, before anything is recorded or indexed (a clone made by this call goes too).\n const noPublisher = await publisherProblem(entry, dest);\n if (noPublisher) {\n if (cloned && !preexisting) {\n rmSync(dest, { recursive: true, force: true });\n pruneEmptyCloneParents(dest);\n }\n logErr(noPublisher);\n process.exitCode = 1;\n return;\n }\n if (!cloned) {\n logOk(`Reusing cached clone at ${dest}`);\n } else if (preexisting) {\n logOk(`Re-cloned ${url} → ${dest}`);\n } else {\n logOk(`Cloned ${url} → ${dest}`);\n }\n\n const editor = loadProjectEditor(yamlPath);\n editor.setSource(entry);\n editor.save();\n\n const result = await refreshManifestCache(entry, opts.dev);\n const failed = indexingHadFailures(result);\n const indexedMsg = `Indexed ${result.assetsUpdated} of ${result.assetsFound} asset(s) from \"${slug}\".`;\n if (failed) {\n logWarn(indexedMsg);\n } else {\n logOk(indexedMsg);\n }\n for (const err of result.errors) logWarn(err);\n logAdvisories(result.advisories, opts.verbose === true);\n\n const legacyHint = legacySourceConfigHint(dest);\n if (legacyHint) logWarn(legacyHint);\n\n const where = path.relative(process.cwd(), yamlPath);\n if (failed) {\n // The entry IS recorded in skaile.yaml, but indexing did not fully\n // succeed — don't present it as a clean success.\n logWarn(\n `Source \"${slug}\" registered in ${where}, but ${result.errors.length} ` +\n `asset(s) failed to index (see above). Fix the cause, then re-run ` +\n `\\`skaile source sync ${slug}\\`.`,\n );\n process.exitCode = 1;\n } else {\n logOk(`Source \"${slug}\" registered in ${where}.`);\n }\n },\n );\n\n // ── source list ─────────────────────────────────────────────────────────\n cmd\n .command(\"list\")\n .description(\"List sources registered in this project's skaile.yaml\")\n .option(\"--json\", \"Output as JSON\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (opts: { json?: boolean; projectDir: string }) => {\n const yamlPath = requireProjectYamlPath(opts.projectDir);\n const sources = readProjectSources(yamlPath);\n if (opts.json) return console.log(JSON.stringify(sources, null, 2));\n if (sources.length === 0) {\n logInfo(\"No sources in skaile.yaml. Run `skaile source add <git-url>` to register one.\");\n return;\n }\n console.log();\n console.log(S.heading(\" Sources\"));\n for (const s of sources) {\n const slug = sourceLabel(s, sources);\n const cached = isSourceCloned(sourceClonePath(sourceCacheKey(s.url)))\n ? \"\"\n : S.warn(\" (not cached)\");\n console.log(` ${S.cmd(slug.padEnd(24))} ${S.dim(s.url)}${cached}`);\n }\n console.log(`\\n ${S.dim(`${sources.length} source(s)`)}\\n`);\n });\n\n // ── source show ─────────────────────────────────────────────────────────\n cmd\n .command(\"show <name-or-url>\")\n .description(\"Show details for a source (matched by URL or derived slug)\")\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (key: string, opts: { projectDir: string }) => {\n const yamlPath = requireProjectYamlPath(opts.projectDir);\n const all = readProjectSources(yamlPath);\n const resolved = resolveSource(all, key);\n if (resolved.kind === \"none\") {\n logErr(`No source matching \"${key}\" in ${yamlPath}.`);\n process.exit(1);\n }\n if (resolved.kind === \"ambiguous\") exitAmbiguousSource(key, resolved.entries);\n const entry = resolved.entry;\n const slug = sourceLabel(entry, all);\n const clonePath = sourceClonePath(sourceCacheKey(entry.url));\n console.log(\n JSON.stringify(\n {\n ...entry,\n slug,\n clonePath,\n cached: isSourceCloned(clonePath),\n },\n null,\n 2,\n ),\n );\n });\n\n // ── source remove ───────────────────────────────────────────────────────\n cmd\n .command(\"remove <name-or-url>\")\n .description(\"Remove a source from this project's skaile.yaml (matched by URL or slug)\")\n .option(\n \"--purge\",\n `Also delete the cached clone from ${path.join(globalCacheRoot(), \"sources\")}${path.sep}`,\n false,\n )\n .option(\"--force\", \"Remove the source although a locked asset still comes from it\", false)\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(async (key: string, opts: { purge: boolean; force?: boolean; projectDir: string }) => {\n const yamlPath = requireProjectYamlPath(opts.projectDir);\n const editor = loadProjectEditor(yamlPath);\n // Resolve to the stored URL (entries are keyed by url in the editor).\n const all = editor.getSources();\n const resolved = resolveSource(all, key);\n if (resolved.kind === \"none\") {\n logErr(`No source matching \"${key}\" in ${yamlPath}.`);\n process.exit(1);\n }\n if (resolved.kind === \"ambiguous\") exitAmbiguousSource(key, resolved.entries);\n const match = resolved.entry;\n const slug = sourceLabel(match, all);\n // A locked asset that comes from this source could not be restored or updated once the\n // source is gone: check, doctor and outdated would report it, install --locked would fail.\n const locked = new AssetManager({\n registry: getKindRegistry(),\n projectDir: path.dirname(yamlPath),\n }).lockedFromSource(match.url);\n if (locked.length > 0 && !opts.force) {\n logErr(\n `Source \"${slug}\" still supplies ${locked.length} locked asset(s): ${locked.join(\", \")}. ` +\n `Run \\`skaile remove\\` on them first, or pass --force to remove the source anyway.`,\n );\n process.exit(1);\n }\n editor.removeSource(match.url);\n editor.save();\n await dropManifestCache(match.url, opts.purge);\n logOk(\n opts.purge\n ? `Removed source \"${slug}\" and purged its clone.`\n : `Removed source \"${slug}\" from skaile.yaml (clone left in ${path.join(globalCacheRoot(), \"sources\")} — pass --purge to remove it, or run \\`skaile cache clean --global\\`).`,\n );\n });\n\n // ── source sync ─────────────────────────────────────────────────────────\n cmd\n .command(\"sync [name]\")\n .description(\"Pull upstream changes and refresh the manifest cache\")\n .option(\"--dev\", \"Also index dev-only assets under each source's dev_paths\", false)\n .option(\"--verbose\", \"List every referenced file outside the asset filter\", false)\n .option(\"--all\", \"Sync every source without prompting\", false)\n .option(\"--project-dir <path>\", \"Project directory\", process.cwd())\n .action(\n async (\n key: string | undefined,\n opts: { dev?: boolean; all?: boolean; verbose?: boolean; projectDir: string },\n ) => {\n const yamlPath = requireProjectYamlPath(opts.projectDir);\n const sources = readProjectSources(yamlPath);\n if (sources.length === 0) {\n logInfo(\"No sources in skaile.yaml.\");\n return;\n }\n\n let targets: SourceEntry[];\n if (key) {\n const resolved = resolveSource(sources, key);\n if (resolved.kind === \"ambiguous\") exitAmbiguousSource(key, resolved.entries);\n if (resolved.kind === \"none\") {\n logInfo(`No source matching \"${key}\".`);\n return;\n }\n targets = [resolved.entry];\n } else if (opts.all || sources.length === 1 || !process.stdin.isTTY) {\n // --all, a single source, or a non-interactive shell: sync everything.\n targets = sources;\n } else {\n const selected = await p.multiselect({\n message: \"Select sources to sync\",\n options: sources.map((s) => ({\n value: s.url,\n label: sourceShortName(s.url),\n hint: s.url,\n })),\n required: true,\n });\n if (p.isCancel(selected)) {\n p.cancel(\"Cancelled.\");\n return;\n }\n const picked = new Set(selected as string[]);\n targets = sources.filter((s) => picked.has(s.url));\n }\n for (const entry of targets) {\n const slug = sourceLabel(entry, sources);\n const dest = sourceClonePath(sourceCacheKey(entry.url));\n if (!isSourceCloned(dest)) {\n ensureClone(entry);\n logOk(`${slug}: cloned to ${dest}.`);\n } else {\n const pull = pullSourceClone(dest, entry);\n if (!pull.ok) {\n logErr(`${slug}: ${pull.error}`);\n process.exitCode = 1;\n continue;\n }\n }\n const result = await refreshManifestCache(entry, opts.dev);\n const failed = indexingHadFailures(result);\n const indexedMsg = `${slug}: indexed ${result.assetsUpdated} of ${result.assetsFound} asset(s).`;\n if (failed) {\n logWarn(indexedMsg);\n process.exitCode = 1;\n } else {\n logOk(indexedMsg);\n }\n for (const err of result.errors) logWarn(`${slug}: ${err}`);\n logAdvisories(result.advisories, opts.verbose === true, slug);\n const legacyHint = legacySourceConfigHint(dest);\n if (legacyHint) logWarn(`${slug}: ${legacyHint}`);\n }\n },\n );\n\n // ── source patch / propose (stubs) ──────────────────────────────────────\n cmd\n .command(\"patch <ref>\")\n .description(\"Extract an asset for editing against the source\")\n .action((_ref: string) => {\n logErr(\n \"`skaile source patch` is scaffolded but not yet wired. \" +\n \"The patch flow lands in a follow-up PR.\",\n );\n process.exit(2);\n });\n\n cmd\n .command(\"propose <ref>\")\n .description(\"Open a PR with the patch against the source upstream\")\n .action((_ref: string) => {\n logErr(\n \"`skaile source propose` is scaffolded but not yet wired. \" +\n \"The propose flow lands in a follow-up PR.\",\n );\n process.exit(2);\n });\n\n // ── source manifest * ───────────────────────────────────────────────────\n addSourceManifestCommands(cmd);\n\n return cmd;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../bridge/src/harness-model-check.ts","../bridge/src/normalizer.ts","../bridge/src/runtime.ts","../bridge/src/validation.ts"],"names":["path"],"mappings":";;;;;;;;;;;;;;AAsCA,SAAS,gBAAgB,SAAA,EAAoD;AAC3E,EAAA,IAAI,cAAc,OAAA,EAAS,2BAAW,GAAA,CAAI,CAAC,QAAQ,CAAC,CAAA;AACpD,EAAA,IAAI,cAAc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gB;AACvC,IAAA,MAAM,UAAU,UAAA,CAAW,MAAM,UAAA,CAAW,KAAA,IAAS,GAAI,CAAA;AAEzD,IAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,GAAA,EAAK;AAAA,MAChC,MAAA,EAAQ,KAAA;AAAA,MACR,OAAA;AAAA,MACA,QAAQ,UAAA,CAAW;AAAA,KACpB,CAAA;AAED,IAAA,YAAA,CAAa,OAAO,CAAA;AAEpB,IAAA,IAAI,QAAA,CAAS,EAAA,EAAI,OAAO,EAAE,IAAI,IAAA,EAAK;AAEnC,IAAA,MAAM,SAAS,QAAA,CAAS,MAAA;AACxB,IAAA,IAAI,MAAA,KAAW,GAAA,IAAO,MAAA,KAAW,GAAA,EAAK;AACpC,MAAA,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,KAAA,EAAO,yCAAA,EAA0C;AAAA,IACvE;AACA,IAAA,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,KAAA,EAAO,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAA,EAAG;AAAA,EAC3D,SAAS,GAAA,EAAU;AACjB,IAAA,IAAI,GAAA,CAAI,SAAS,YAAA,EAAc,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,OAAO,wBAAA,EAAyB;AACnF,IAAA,OAAO,EAAE,EAAA,EAAI,KAAA,EAAO,KAAA,EAAO,GAAA,CAAI,WAAW,eAAA,EAAgB;AAAA,EAC5D;AACF","file":"chunk-YN6N3RBM.js","sourcesContent":["/**\n * Pre-flight model check: would the harness refuse the selected model before it starts a turn?\n *\n * `skaile run --dry-run` uses it so a setup check learns about a refusal that a real run would\n * print. The codex harness refuses a selection up front when it cannot address the AI provider\n * surface; codex, omp and the Claude SDK refuse a provider nothing serves\n * ({@link checkModelProvider}); every other harness answers `undefined`.\n */\nimport { execFile } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport {\n type AIProviderRegistry,\n isEntryEnabled,\n type MergedAIProviderRegistry,\n parseModelRef,\n registryEntries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport { openSqlite } from \"@skaile/workspaces/core/logging\";\nimport { parse } from \"yaml\";\nimport { buildCodexConfigDocument } from \"./codex/config-toml.js\";\nimport { ompRegistryModelRefusal, registryModelEntries } from \"./harnesses/omp-models-yml.js\";\nimport { AI_PROVIDER_PRESETS } from \"./provider-catalog.js\";\n\n/** What {@link checkHarnessModel} reads. */\nexport interface HarnessModelCheckInput {\n registry?: AIProviderRegistry | MergedAIProviderRegistry;\n /** The model selector: `<providerId>/<modelId>`, a bare id or `@role`. */\n model?: string;\n roles?: Record<string, string>;\n}\n\n/**\n * Providers a harness reaches with its own login, without a registry entry: codex talks to\n * OpenAI, the Claude SDK to Anthropic, omp to every vendor it ships a login for. A harness not\n * listed here (a plugin's, `echo`) is not checked.\n */\nfunction nativeProviders(harnessId: string): ReadonlySet<string> | undefined {\n if (harnessId === \"codex\") return new Set([\"openai\"]);\n if (harnessId === \"claude-sdk\") return new Set([\"anthropic\"]);\n if (harnessId === \"omp\") return new Set(Object.keys(AI_PROVIDER_PRESETS));\n return undefined;\n}\n\n/**\n * What omp can serve on the user's own agent directory (`PI_CODING_AGENT_DIR`, else\n * `~/.omp/agent`): the provider ids their `models.yml` defines, and whether they have a login\n * (a usable credential in `agent.db`), which may carry built-in providers this list cannot name\n * (p1111). The file alone is no login: omp creates an empty `agent.db` on its first start (p1470).\n */\nfunction ompOwnHome(): { providers: ReadonlySet<string>; hasLogin: boolean } {\n const dir = process.env.PI_CODING_AGENT_DIR || path.join(os.homedir(), \".omp\", \"agent\");\n const providers = new Set<string>();\n try {\n const doc = parse(readFileSync(path.join(dir, \"models.yml\"), \"utf-8\")) as {\n providers?: unknown;\n } | null;\n const block = doc?.providers;\n if (block && typeof block === \"object\" && !Array.isArray(block)) {\n for (const id of Object.keys(block)) providers.add(id);\n }\n } catch {\n // no models.yml, or one omp itself will reject\n }\n return { providers, hasLogin: ompHasCredential(path.join(dir, \"agent.db\")) };\n}\n\n/**\n * True when omp's auth store holds a credential that is not disabled. A missing, unreadable or\n * schema-less file holds none. Reads the `auth_credentials` table and its `disabled_cause`\n * column as omp 18.12.6 writes them (checked against that version); a different layout reads\n * as \"no login\", which is the safe side. Read-only: the check never creates or changes the file.\n */\nfunction ompHasCredential(authDb: string): boolean {\n if (!existsSync(authDb)) return false;\n try {\n const db = openSqlite(authDb, { readonly: true });\n try {\n return (\n db\n .prepare(\"SELECT 1 AS found FROM auth_credentials WHERE disabled_cause IS NULL LIMIT 1\")\n .get<{ found: number }>() != null\n );\n } finally {\n db.close();\n }\n } catch {\n return false;\n }\n}\n\n/**\n * `<provider>/<model>` whose provider nothing can serve: not a registry entry and not a\n * provider the harness has its own login for. Without this the id goes to the harness's default\n * provider verbatim and fails there with a message that blames the login.\n *\n * The rule differs per harness (p1111). omp and the Claude SDK route through a registry entry,\n * so while any enabled registry entry is left they take an unknown head as a vendor-scoped\n * model id (`meta-llama/Llama-3.3-70B`). codex talks to OpenAI only and cannot, so it refuses\n * a head that is neither a registered provider nor `openai`, whatever else is registered.\n */\nexport function checkModelProvider(\n harnessId: string,\n input: HarnessModelCheckInput,\n): string | undefined {\n const native = nativeProviders(harnessId);\n let selector = input.model?.trim() ?? \"\";\n if (selector.startsWith(\"@\")) selector = input.roles?.[selector.slice(1)]?.trim() ?? \"\";\n const slash = selector.indexOf(\"/\");\n if (!native || slash <= 0 || selector.startsWith(\"@\")) return undefined;\n const head = selector.slice(0, slash);\n if (native.has(head)) return undefined;\n const entries = input.registry ? registryEntries(input.registry) : [];\n if (entries.some(([id]) => id === head)) return undefined;\n const servesVendorIds =\n harnessId !== \"codex\" &&\n entries.some(\n ([, entry]) => (entry.kind === \"llm\" || entry.kind === \"embed\") && isEntryEnabled(entry),\n );\n if (servesVendorIds) return undefined;\n if (harnessId === \"omp\") {\n // With no registry entry omp runs on the user's own agent directory: their `models.yml`\n // providers and the logins omp ships are served there.\n const own = ompOwnHome();\n if (own.providers.has(head) || own.hasLogin) return undefined;\n }\n return `provider '${head}' is not configured: run skaile providers list`;\n}\n\n/**\n * The refusal message the harness prints for this model, or `undefined` when it takes it.\n * The text matches the one the harness throws at start.\n */\nexport function checkHarnessModel(\n harnessId: string,\n input: HarnessModelCheckInput,\n): string | undefined {\n const unknownProvider = checkModelProvider(harnessId, input);\n if (unknownProvider) return unknownProvider;\n if (harnessId === \"omp\") {\n let selector = input.model?.trim() ?? \"\";\n if (selector.startsWith(\"@\")) selector = input.roles?.[selector.slice(1)]?.trim() ?? \"\";\n return ompRegistryModelRefusal(input.registry, selector, nativeProviders(\"omp\") ?? new Set());\n }\n if (harnessId !== \"codex\") return undefined;\n const build = buildCodexConfigDocument({\n registry: input.registry,\n ...(input.model ? { modelRef: input.model, model: input.model } : {}),\n ...(input.roles ? { roles: input.roles } : {}),\n });\n if (!build.unaddressable) return undefined;\n const { id, reason } = build.unaddressable;\n return `AI provider '${id}' cannot be used with the codex harness: ${reason}. Pick a model of another provider.`;\n}\n\n/**\n * The refusal `skaile serve --harness omp --model <x>` prints before it is ready, or `undefined`\n * when omp can take the model (p1334). Stricter than {@link checkHarnessModel}, which `run --dry-run`\n * shares: a server answers its first prompt long after start, so a model omp reports as \"not\n * found\" must fail at start.\n *\n * It judges exactly what the harness sends. `materializeOmpProviders` resolves the selector with\n * `parseModelRef` and passes `--model <entry>/<model>` to omp: an `<entry>/<model>` selector goes\n * to that entry; a bare id, or a vendor-scoped id whose head is no registry entry\n * (`anthropic/claude-sonnet-4-5`, `openrouter/openai/gpt-5.2`), goes to the entry that maps it,\n * else to the first entry (so `meta-llama/Llama-3.3-70B` reaches a gateway that serves it). omp\n * then refuses a model that entry does not declare. The check refuses the same set and names the\n * selector the user typed, never the rewritten one alone.\n */\nexport function checkOmpServeModel(input: HarnessModelCheckInput): string | undefined {\n const registry = input.registry;\n let selector = input.model?.trim() ?? \"\";\n if (selector.startsWith(\"@\")) selector = input.roles?.[selector.slice(1)]?.trim() ?? \"\";\n if (!registry || !selector) return undefined;\n const ref = parseModelRef(selector, registry, input.roles);\n if (!ref?.providerModelId) return undefined;\n const sent = `${ref.providerId}/${ref.providerModelId}`;\n const refusal = ompRegistryModelRefusal(registry, sent, nativeProviders(\"omp\") ?? new Set());\n if (!refusal) return undefined;\n if (sent === selector) return refusal;\n const detail = refusal.slice(refusal.indexOf(\"': \") + 3);\n const why = selector.includes(\"/\")\n ? ` (no registry entry is named '${selector.slice(0, selector.indexOf(\"/\"))}')`\n : \"\";\n return `omp cannot serve model '${selector}': it is sent to omp as '${sent}'${why}; ${detail}`;\n}\n\n/** Thinking levels omp takes as a `:<level>` suffix of a model selector. */\nconst OMP_THINKING_SUFFIX = /:(off|minimal|low|medium|high|xhigh)$/i;\n\n/** Run `omp <args> --json` and return the `models` of its answer, or `undefined` for no answer. */\nfunction ompModels(args: string[], timeoutMs: number): Promise<unknown[] | undefined> {\n const bin = process.env.OMP_BRIDGE_BIN || \"omp\";\n const pre = process.env.OMP_BRIDGE_PREARGS\n ? process.env.OMP_BRIDGE_PREARGS.split(/\\s+/).filter(Boolean)\n : [];\n return new Promise((resolve) => {\n execFile(\n bin,\n [...pre, ...args, \"--json\"],\n { timeout: timeoutMs, maxBuffer: 64 * 1024 * 1024, env: process.env },\n (error, out) => {\n if (error) return resolve(undefined);\n try {\n const parsed: unknown = JSON.parse(out);\n const models = Array.isArray(parsed)\n ? parsed\n : parsed && typeof parsed === \"object\" && \"models\" in parsed\n ? parsed.models\n : undefined;\n resolve(Array.isArray(models) ? models : undefined);\n } catch {\n resolve(undefined);\n }\n },\n );\n });\n}\n\n/**\n * The refusal `skaile serve --harness omp --model <x>` prints before it is ready when no registry\n * entry is involved and omp runs on the user's own agent directory, or `undefined` when omp may\n * take the model (p1334). The registry check ({@link checkOmpServeModel}) cannot judge that\n * case: omp's catalog (built-in vendors, `models.yml`, logins) lives in omp.\n *\n * Asks omp itself. `omp models find` is a substring search, but `omp --model` also takes forms it\n * does not match (`anthropic/sonnet-4-5`, `openrouter/~anthropic/claude-sonnet-latest:high`), so\n * a selector is refused only when omp cannot know it: a `:<thinking level>` suffix is dropped, a\n * non-empty `find` answer passes, and an empty one passes too when the selector's `<provider>/`\n * head is a provider omp lists models for. A bare id that matches nothing, or a provider omp does\n * not list, is refused. Anything else (omp missing, a timeout, output that is not the expected\n * JSON) is no verdict, and the harness reports its own failure at start. Honours the\n * `OMP_BRIDGE_BIN` / `OMP_BRIDGE_PREARGS` test seam the harness uses.\n *\n * @param selector - The model as typed (`<provider>/<model>` or a bare id); `@role` is not judged.\n * @param timeoutMs - Total time to wait for omp across both calls (default 20 s).\n */\nexport async function checkOmpListedModel(\n selector: string,\n timeoutMs = 20_000,\n): Promise<string | undefined> {\n const wanted = selector.trim();\n if (!wanted || wanted.startsWith(\"@\")) return undefined;\n const deadline = Date.now() + timeoutMs;\n const query = wanted.replace(OMP_THINKING_SUFFIX, \"\");\n const found = await ompModels([\"models\", \"find\", query], timeoutMs);\n if (!found || found.length > 0) return undefined;\n const refusal = `omp cannot serve model '${wanted}': omp lists no model that matches it. Run \\`omp models\\` to see what it can serve.`;\n const slash = query.indexOf(\"/\");\n if (slash <= 0) return refusal;\n // The budget covers both calls: with no time left there is no verdict.\n const left = deadline - Date.now();\n if (left <= 0) return undefined;\n const all = await ompModels([\"models\"], left);\n if (!all) return undefined;\n const provider = query.slice(0, slash).toLowerCase();\n const known = all.some(\n (m) =>\n typeof m === \"object\" &&\n m !== null &&\n \"provider\" in m &&\n typeof m.provider === \"string\" &&\n m.provider.toLowerCase() === provider,\n );\n return known ? undefined : refusal;\n}\n","/**\n * EventNormalizer — converts bridge-level AgentEvent (raw harness events) to\n * skaile-agent-types AgentEvent (normalized, human-readable events).\n *\n * Stateful: tracks active subagents and dev-server detection across a session.\n * Call reset() between sessions.\n */\n\nimport {\n type AgentEvent as NormalizedEvent,\n type NativeApprovalDescription,\n stripActivityLabel,\n TOOL_ACTIVITY_LABEL_MAX_CHARS,\n TOOL_ACTIVITY_LABEL_PARAM,\n} from \"@skaile/workspaces/types\";\nimport { classifyClaudeSdkError } from \"./error-classifier.js\";\nimport type { AgentMessage, AgentEvent as BridgeEvent, ContentBlock } from \"./types.js\";\n\n/**\n * The optional usage keys a `result` event carries, in the shape both\n * `finished` and a result-sourced `error` emit them. Absent keys stay absent.\n */\nfunction resultUsageFields(\n event: Pick<\n Extract<BridgeEvent, { type: \"result\" | \"error\" }>,\n \"tokens\" | \"modelUsage\" | \"contextTokens\" | \"contextWindow\"\n >,\n) {\n return {\n ...(event.tokens ? { tokens: event.tokens } : {}),\n ...(event.modelUsage ? { modelUsage: event.modelUsage } : {}),\n ...(typeof event.contextTokens === \"number\" ? { contextTokens: event.contextTokens } : {}),\n ...(typeof event.contextWindow === \"number\" ? { contextWindow: event.contextWindow } : {}),\n };\n}\n\n/**\n * The tool a harness uses to park a turn on a human answer. Both branches that\n * recognise it must use this constant: `message_start` turns it into a\n * `question`, and `tool_call` must then stay silent about it.\n */\nconst QUESTION_TOOL = \"AskUserQuestion\";\n\nconst MAX_ANNOUNCED_TOOL_USES = 64;\n\n/**\n * Bridge `tool_call` inputs are loosely typed: Codex MCP arguments may arrive\n * as a JSON string, and the echo harness passes a bare path.\n */\nfunction toolInputRecord(input: unknown): Record<string, unknown> {\n let value = input;\n if (typeof value === \"string\") {\n try {\n value = JSON.parse(value);\n } catch {\n return { input };\n }\n }\n if (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\n return value as Record<string, unknown>;\n }\n return value === undefined ? {} : { input };\n}\n\n/**\n * Converts raw bridge-level {@link BridgeEvent} payloads into normalized\n * `@skaile/workspaces/types` `AgentEvent` payloads consumed by the runner and transport.\n *\n * Stateful: tracks active subagents and dev-server detection across a session.\n * Call {@link EventNormalizer.reset} between sessions to clear accumulated state.\n *\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport class EventNormalizer {\n private activeSubagents = new Map<string, string>();\n private devServerStartingEmitted = false;\n /** Dev-server URLs already announced as ready: each server once, a second one too. */\n private announcedDevServers = new Set<string>();\n /** True when message_update deltas have been emitted for the current message. */\n private hasStreamedText = false;\n /**\n * True once a `_thinkingDelta` run has been reported as `status: thinking`;\n * cleared by the next text delta or assistant message, so a run reports once.\n */\n private thinkingAnnounced = false;\n /**\n * tool_use blocks `message_start` already reported, awaiting the harness's\n * matching bridge `tool_call` — which must then not report the call again.\n */\n private announcedToolUses: Array<{ id?: string; name: string }> = [];\n\n /**\n * Convert a single bridge event into zero or more normalized events.\n * One bridge event can produce multiple normalized events (e.g., a message_start\n * with text + tool_use blocks produces both text and tool_call events).\n */\n normalize(event: BridgeEvent): NormalizedEvent[] {\n switch (event.type) {\n case \"message_start\":\n return this.handleMessageStart(event.message);\n\n case \"message_update\":\n return this.handleMessageUpdate(event);\n\n case \"message_end\":\n return [];\n\n case \"message_retract\":\n // The replay streams its reply afresh, so its deltas (or, failing\n // those, its message_start text) must count as a new message.\n this.hasStreamedText = false;\n return event.text ? [{ type: \"text_retract\", content: event.text }] : [];\n\n case \"turn_end\":\n return this.handleTurnEnd(event.toolResults);\n\n case \"result\":\n return this.handleResult(event);\n\n case \"error\":\n this.announcedToolUses = [];\n return [\n {\n type: \"error\",\n message: event.error,\n fatal: event.fatal ?? true,\n category: event.detail?.category,\n ...(event.detail?.hint ? { hint: event.detail.hint } : {}),\n ...resultUsageFields(event),\n ...(event.retrying === true\n ? { retrying: true, ...(event.retryReason ? { retryReason: event.retryReason } : {}) }\n : {}),\n ...(event.selfStarted === true ? { selfStarted: true as const } : {}),\n },\n ];\n\n case \"background_task_started\":\n return [{ type: \"background_task_started\", taskId: event.taskId }];\n\n case \"self_turn_started\":\n return [{ type: \"self_turn_started\", taskIds: [...event.taskIds] }];\n\n case \"tool_call\": {\n // The question tool parks the turn on the user's answer, so reporting\n // work here would undo the idle its `question` event just set, and\n // nothing follows to correct it while the user reads the prompt.\n const toolName = event.name ?? event.tool?.name;\n if (toolName === QUESTION_TOOL) return [];\n // A harness that also sent the call as a `message_start` tool_use block\n // (Claude) was already reported there; the rest only ever send this.\n if (!toolName || this.consumeAnnouncedToolUse(toolName, event.toolCallId)) {\n return [{ type: \"status\", phase: \"working\" }];\n }\n return this.handleToolUse(\n {\n type: \"tool_use\",\n id: typeof event.toolCallId === \"string\" ? event.toolCallId : undefined,\n name: toolName,\n input: toolInputRecord(event.input),\n },\n typeof event.parentToolUseId === \"string\" ? event.parentToolUseId : undefined,\n );\n }\n\n case \"tool_execution_end\":\n return [];\n\n case \"agent_end\":\n this.announcedToolUses = [];\n return [{ type: \"status\", phase: \"idle\" }];\n\n case \"commands_available\":\n // Pass through to transport — the gateway caches this event\n return [event as unknown as NormalizedEvent];\n\n case \"session_info\":\n // Pass through to transport — the forge layer stores the OMP session ID\n return [event as unknown as NormalizedEvent];\n\n case \"ui_render\":\n case \"ui_render_update\":\n case \"ui_clear\":\n // Pass through verbatim — harnesses that implement the Agent UI Protocol emit these directly\n return [event as unknown as NormalizedEvent];\n\n default:\n return [];\n }\n }\n\n /** Clear all stateful tracking between sessions. */\n reset(): void {\n this.activeSubagents.clear();\n this.devServerStartingEmitted = false;\n this.announcedDevServers.clear();\n this.hasStreamedText = false;\n this.thinkingAnnounced = false;\n this.announcedToolUses = [];\n }\n\n private consumeAnnouncedToolUse(name: string, id: unknown): boolean {\n const callId = typeof id === \"string\" ? id : undefined;\n const index = this.announcedToolUses.findIndex(\n (entry) => entry.name === name && (!callId || !entry.id || entry.id === callId),\n );\n if (index === -1) return false;\n this.announcedToolUses.splice(index, 1);\n return true;\n }\n\n // ---------------------------------------------------------------------------\n // message_start → text, tool_call, question, subagent\n // ---------------------------------------------------------------------------\n\n private handleMessageStart(message: AgentMessage): NormalizedEvent[] {\n // Only process assistant messages. Harnesses (e.g. omp) may echo the user's\n // message as a message_start with role:\"user\" before streaming the response.\n // Emitting a text event for that echo would prepend the user's input to the\n // assistant bubble on the frontend.\n if (message.role !== \"assistant\") return [];\n\n // A subagent's message is not the main reply: its text belongs to the\n // subagent's own result, and it must not reset the main stream's state.\n const parentToolUseId = message.parentToolUseId;\n const events: NormalizedEvent[] = [];\n const blocks = this.getContentBlocks(message);\n\n for (const block of blocks) {\n if (block.type === \"text\" && block.text) {\n if (parentToolUseId) continue;\n // Skip full text if we already streamed it via message_update deltas\n if (!this.hasStreamedText) {\n events.push({ type: \"text\", content: block.text });\n }\n } else if (block.type === \"tool_use\" && block.name) {\n if (block.name !== QUESTION_TOOL) {\n this.announcedToolUses.push({ id: block.id, name: block.name });\n // Bounded in case a harness never echoes a block as a tool_call.\n if (this.announcedToolUses.length > MAX_ANNOUNCED_TOOL_USES) {\n this.announcedToolUses.shift();\n }\n }\n events.push(...this.handleToolUse(block, parentToolUseId));\n }\n }\n\n if (!parentToolUseId) this.hasStreamedText = false;\n if (!parentToolUseId) this.thinkingAnnounced = false;\n return events;\n }\n\n private handleToolUse(block: ContentBlock, parentToolUseId?: string): NormalizedEvent[] {\n const name = block.name!;\n const input = (block.input ?? {}) as Record<string, unknown>;\n\n if (name === QUESTION_TOOL) {\n return this.handleAskUserQuestion(input);\n }\n if (name === \"Agent\") {\n return this.handleAgentToolUse(block, input);\n }\n return this.handleGenericToolUse(name, input, parentToolUseId);\n }\n\n private handleAskUserQuestion(input: Record<string, unknown>): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n const candidate = input.approval as Partial<NativeApprovalDescription> | undefined;\n const approval =\n candidate &&\n [\"command\", \"file\", \"permissions\", \"mcp\"].includes(candidate.kind ?? \"\") &&\n Array.isArray(candidate.details) &&\n candidate.details.length > 0 &&\n candidate.details.length <= 64 &&\n candidate.details.every((detail) => typeof detail === \"string\" && detail.length <= 8192) &&\n candidate.details.reduce((total, detail) => total + detail.length, 0) <= 65536\n ? (candidate as NativeApprovalDescription)\n : undefined;\n if (Object.hasOwn(input, \"approval\") && !approval) return [];\n // Claude SDK sends { questions: [{ question, header, options: [{ label, description }] }] }\n // Legacy/simple format sends { question: string, options?: string[] }\n const questions = input.questions;\n if (Array.isArray(questions)) {\n for (const q of questions) {\n const qObj = q as Record<string, unknown>;\n const question = String(qObj.question ?? \"\");\n const rawOpts = qObj.options;\n const options = Array.isArray(rawOpts)\n ? rawOpts.map((o: any) => (typeof o === \"string\" ? o : String(o.label ?? o)))\n : undefined;\n events.push({\n type: \"question\",\n question,\n options,\n ...(typeof input.requestId === \"string\" ? { requestId: input.requestId } : {}),\n ...(approval ? { approval } : {}),\n });\n }\n } else {\n const question = String(input.question ?? input.text ?? \"\");\n const rawOptions = input.options;\n const options = Array.isArray(rawOptions) ? rawOptions.map(String) : undefined;\n events.push({\n type: \"question\",\n question,\n options,\n ...(typeof input.requestId === \"string\" ? { requestId: input.requestId } : {}),\n ...(approval ? { approval } : {}),\n });\n }\n return events;\n }\n\n private handleAgentToolUse(\n block: ContentBlock,\n input: Record<string, unknown>,\n ): NormalizedEvent[] {\n const agentName = String(input.subagent_type ?? input.description ?? \"unknown\");\n const description = String(input.description ?? input.prompt ?? \"\").slice(0, 200);\n if (block.id) {\n this.activeSubagents.set(block.id, agentName);\n }\n return [\n { type: \"subagent\", name: agentName, status: \"started\", description },\n { type: \"status\", phase: \"working\" },\n ];\n }\n\n private handleGenericToolUse(\n name: string,\n input: Record<string, unknown>,\n parentToolUseId?: string,\n ): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n const label = labelToolCall(name, input);\n events.push({\n type: \"tool_call\",\n tool: name,\n input,\n // Summarize without the label: it would eat the default branch's\n // 100-char argument budget and push the real args out.\n summary: summarizeToolCall(name, stripActivityLabel(input)),\n ...(label ? { label } : {}),\n ...(parentToolUseId ? { parentToolUseId } : {}),\n });\n events.push({ type: \"status\", phase: \"working\" });\n\n if (name === \"Bash\" && typeof input.command === \"string\") {\n const devEvent = this.detectDevServerStarting(input.command);\n if (devEvent) events.push(devEvent);\n }\n\n return events;\n }\n\n // ---------------------------------------------------------------------------\n // message_update → streaming text\n // ---------------------------------------------------------------------------\n\n private handleMessageUpdate(event: BridgeEvent): NormalizedEvent[] {\n // Bridge deltas carry no subagent tag: a harness must drop a subagent's\n // partials itself (claude-sdk does in handleStreamEvent), or they read as main text.\n const delta = (event as any)._textDelta as string | undefined;\n if (delta) {\n this.hasStreamedText = true;\n this.thinkingAnnounced = false;\n return [{ type: \"text\", content: delta }];\n }\n // The protocol has no thinking-content event, so reasoning surfaces as the\n // existing `thinking` phase, once per run. The text is never forwarded as\n // `text`; a harness keeps it out of `_textDelta`.\n const thinking: unknown = \"_thinkingDelta\" in event ? event._thinkingDelta : undefined;\n if (typeof thinking === \"string\" && thinking && !this.thinkingAnnounced) {\n this.thinkingAnnounced = true;\n return [{ type: \"status\", phase: \"thinking\" }];\n }\n return [];\n }\n\n // ---------------------------------------------------------------------------\n // turn_end → tool_result, subagent finished, file_changed, dev_server\n // ---------------------------------------------------------------------------\n\n private handleTurnEnd(toolResults?: AgentMessage[]): NormalizedEvent[] {\n if (!toolResults?.length) return [];\n\n const events: NormalizedEvent[] = [];\n\n for (const result of toolResults) {\n const toolName = result.toolName ?? \"unknown\";\n const outputData = result.data ?? result.content;\n const output = typeof outputData === \"string\" ? outputData : JSON.stringify(outputData);\n\n // Check if this is a subagent result\n if (toolName === \"Agent\" || this.isSubagentResult(result)) {\n events.push(...this.handleSubagentResult(result, output));\n } else {\n events.push(...this.handleToolResult(toolName, outputData, output, result.parentToolUseId));\n }\n }\n\n return events;\n }\n\n private handleSubagentResult(result: AgentMessage, output: string): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n const agentName = this.resolveSubagentName(result);\n const description = output.slice(0, 200);\n events.push({ type: \"subagent\", name: agentName, status: \"finished\", description });\n\n if (agentName === \"dev-server\") events.push(...this.detectDevServerReady(output));\n return events;\n }\n\n private handleToolResult(\n toolName: string,\n outputData: unknown,\n output: string,\n parentToolUseId?: string,\n ): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n events.push({\n type: \"tool_result\",\n tool: toolName,\n output: outputData,\n summary: summarizeToolResult(toolName, outputData),\n ...(parentToolUseId ? { parentToolUseId } : {}),\n });\n\n // Detect file changes from Write/Edit results\n const fileEvents = detectFileChanges(toolName, outputData);\n if (fileEvents.length > 0) events.push(...fileEvents);\n\n // Detect dev servers from Bash output\n if (toolName === \"Bash\") events.push(...this.detectDevServerReady(output));\n return events;\n }\n\n private isSubagentResult(result: AgentMessage): boolean {\n // Check if the tool result's id maps to a tracked subagent\n if (result.toolName && this.activeSubagents.has(result.toolName)) return true;\n return false;\n }\n\n private resolveSubagentName(result: AgentMessage): string {\n // toolName on bridge AgentMessage is resolved from toolIdToName in the harness\n const name = result.toolName ? this.activeSubagents.get(result.toolName) : undefined;\n if (name) {\n this.activeSubagents.delete(result.toolName!);\n return name;\n }\n return result.toolName ?? \"unknown\";\n }\n\n // ---------------------------------------------------------------------------\n // result → finished or error\n // ---------------------------------------------------------------------------\n\n private handleResult(event: BridgeEvent & { type: \"result\" }): NormalizedEvent[] {\n const usage = resultUsageFields(event);\n if (event.subtype === \"success\") {\n return [\n {\n type: \"finished\",\n summary: event.summary ?? \"Task completed\",\n costUsd: event.costUsd ?? 0,\n ...usage,\n ...(event.selfStarted === true ? { selfStarted: true as const } : {}),\n },\n ];\n }\n\n const errors = event.errors ?? [];\n // Run the same classifier the claude-sdk harness uses on its `error`\n // event so the result-error path also surfaces a category and hint\n // (harnesses other than claude-sdk emit `result` without a paired\n // `error`, so this is the only place they get classified).\n const detail = classifyClaudeSdkError({ errors, subtype: event.subtype });\n // The turn billed even though it failed: carry its usage so a ledger\n // that only writes on `finished` can write here too. Unlike the finished\n // branch, no `costUsd: 0` fallback — an absent figure stays absent.\n return [\n {\n type: \"error\",\n message: `Agent stopped: ${event.subtype}${errors.length ? ` — ${errors.join(\"; \")}` : \"\"}`,\n fatal: event.subtype === \"error_during_execution\",\n category: detail.category,\n ...(detail.hint ? { hint: detail.hint } : {}),\n ...(typeof event.costUsd === \"number\" ? { costUsd: event.costUsd } : {}),\n ...usage,\n ...(event.selfStarted === true ? { selfStarted: true as const } : {}),\n },\n ];\n }\n\n // ---------------------------------------------------------------------------\n // Dev server detection\n // ---------------------------------------------------------------------------\n\n private detectDevServerStarting(command: string): NormalizedEvent | null {\n if (this.devServerStartingEmitted) return null;\n const cmd = command.toLowerCase();\n const isFrontendStart =\n (cmd.includes(\"pnpm run dev\") || cmd.includes(\"pnpm dev\") || cmd.includes(\"vite\")) &&\n (cmd.includes(\"frontend\") || cmd.includes(\"dev:preview\"));\n if (isFrontendStart) {\n this.devServerStartingEmitted = true;\n return { type: \"dev_server\", url: \"http://localhost:3000\", status: \"starting\" };\n }\n return null;\n }\n\n /** One `ready` event per URL in `text` not announced before in this session. */\n private detectDevServerReady(text: string): NormalizedEvent[] {\n const events: NormalizedEvent[] = [];\n for (const url of devServerReadyUrls(text)) {\n if (this.announcedDevServers.has(url)) continue;\n this.announcedDevServers.add(url);\n events.push({ type: \"dev_server\", url, status: \"ready\" });\n }\n return events;\n }\n\n // ---------------------------------------------------------------------------\n // Helpers\n // ---------------------------------------------------------------------------\n\n private getContentBlocks(message: AgentMessage): ContentBlock[] {\n if (Array.isArray(message.content)) return message.content;\n if (typeof message.content === \"string\" && message.content) {\n return [{ type: \"text\", text: message.content }];\n }\n return [];\n }\n}\n\nconst ESC = String.fromCharCode(27);\nconst BEL = String.fromCharCode(7);\n/**\n * CSI (`ESC [ … m`, cursor moves) and OSC (`ESC ] … BEL`, hyperlinks) escape sequences, plus\n * CSI written as the text `\\u001b[` / `\\x1b[`: a non-string tool result reaches the detector\n * JSON-encoded, which spells ESC out.\n */\nconst ANSI_ESCAPE = new RegExp(\n `(?:${ESC}|\\\\\\\\u001b|\\\\\\\\x1b)\\\\[[0-?]*[ -/]*[@-~]|${ESC}\\\\][^${BEL}${ESC}]*(?:${BEL}|${ESC}\\\\\\\\)`,\n \"g\",\n);\n\n/** A dev server's `Local:` line on a loopback host (Vite, Nuxt, Storybook, Next). */\nconst LOCAL_URL = /Local:\\s+(https?):\\/\\/(?:localhost|127\\.0\\.0\\.1|\\[::1\\]|0\\.0\\.0\\.0):(\\d+)\\/?/g;\nconst EXPLICIT_URL = /DEVSERVER_READY:(https?:\\/\\/[^\\s\"\\\\]+)/g;\n\n/**\n * The URLs a dev server's ready output announces, without duplicates; empty\n * when there are none. One output can hold several servers\n * (`concurrently \"vite\" \"storybook dev\"`, a combined log). Explicit\n * `DEVSERVER_READY:<url>` lines come first (a bare trailing `/` after the\n * port dropped, so it matches the `Local:` form), then every `Local:` line, after\n * stripping ANSI colours, on any loopback host, announced as `localhost` (what\n * a browser opens; `0.0.0.0` is not one). `FRONTEND_READY` →\n * `http://localhost:3000` only when neither is present. A `Network:` line (LAN\n * address) never matches.\n */\nfunction devServerReadyUrls(text: string): string[] {\n const explicit = [...text.matchAll(EXPLICIT_URL)].map((m) =>\n m[1]!.replace(/^(https?:\\/\\/[^/]+)\\/$/, \"$1\"),\n );\n const local = [...text.replace(ANSI_ESCAPE, \"\").matchAll(LOCAL_URL)].map(\n (m) => `${m[1]}://localhost:${m[2]}`,\n );\n const urls = [...new Set([...explicit, ...local])];\n if (urls.length > 0) return urls;\n return text.includes(\"FRONTEND_READY\") ? [\"http://localhost:3000\"] : [];\n}\n\n// ---------------------------------------------------------------------------\n// Pure helper functions (exported for reuse)\n// ---------------------------------------------------------------------------\n\n/**\n * Produce a human-readable one-line summary of a tool call for the activity log.\n *\n * Returns a string like `$ git status` for Bash, `Read src/index.ts` for Read, etc.\n * Falls back to `ToolName({...input...})` for unrecognised tools.\n *\n * @param tool - Tool name (e.g. `\"Bash\"`, `\"Write\"`, `\"Grep\"`).\n * @param input - Tool input record passed to the call.\n * @returns A short display string suitable for the activity feed.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function summarizeToolCall(tool: string, input: Record<string, unknown>): string {\n // A harness that sent a bare value instead of named args has it under `input`.\n const arg = (key: string) => String(input[key] ?? input.input);\n switch (tool) {\n case \"Bash\":\n return `$ ${String(input.command ?? input.input ?? \"\").slice(0, 200)}`;\n case \"Write\":\n return `Create ${arg(\"file_path\")}`;\n case \"Edit\":\n return `Edit ${arg(\"file_path\")}`;\n case \"Read\":\n return `Read ${arg(\"file_path\")}`;\n case \"Glob\":\n return `Find ${arg(\"pattern\")}`;\n case \"Grep\":\n return `Search for ${arg(\"pattern\")}`;\n case \"ApplyPatch\": {\n // Paths only: stringifying the input would serialize every full diff.\n const changes = Array.isArray(input.changes) ? input.changes : [];\n const paths = changes\n .map((change) => (change as { path?: unknown } | null)?.path)\n .filter((path): path is string => typeof path === \"string\");\n return `Edit ${paths.join(\", \").slice(0, 200) || \"files\"}`;\n }\n default:\n return `${tool}(${JSON.stringify(input).slice(0, 100)})`;\n }\n}\n\n/**\n * Produce the plain-language label shown to non-technical users while a tool\n * call runs: the agent's own `activity_label`, Bash's `description`, else a\n * derived phrase for Claude Code built-ins. `undefined` for any other tool —\n * the UI then falls back to a generic \"working\" line rather than raw input.\n *\n * @param tool - Tool name as the model called it.\n * @param input - Tool input record, still carrying `activity_label`.\n * @returns A trimmed label capped at `TOOL_ACTIVITY_LABEL_MAX_CHARS`, or `undefined`.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function labelToolCall(tool: string, input: Record<string, unknown>): string | undefined {\n const authored =\n nonEmpty(input[TOOL_ACTIVITY_LABEL_PARAM]) ??\n (tool === \"Bash\" ? nonEmpty(input.description) : undefined);\n const label = authored ?? builtinToolLabel(tool, input);\n if (!label) return undefined;\n return label.length > TOOL_ACTIVITY_LABEL_MAX_CHARS\n ? `${label.slice(0, TOOL_ACTIVITY_LABEL_MAX_CHARS - 1).trimEnd()}…`\n : label;\n}\n\nfunction nonEmpty(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.replace(/\\s+/g, \" \").trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\nfunction builtinToolLabel(tool: string, input: Record<string, unknown>): string | undefined {\n switch (tool) {\n case \"Read\":\n return withTarget(\"Reading\", baseName(input.file_path));\n case \"Edit\":\n case \"MultiEdit\":\n case \"NotebookEdit\":\n return withTarget(\"Editing\", baseName(input.file_path ?? input.notebook_path));\n case \"Write\":\n return withTarget(\"Creating\", baseName(input.file_path));\n case \"Grep\":\n case \"Glob\":\n return \"Searching files\";\n case \"WebSearch\":\n return \"Searching the web\";\n case \"WebFetch\":\n return withTarget(\"Fetching\", hostOf(input.url), \"a web page\");\n case \"TodoWrite\":\n return \"Updating the task list\";\n case \"ApplyPatch\":\n return \"Editing files\";\n default:\n return undefined;\n }\n}\n\nfunction withTarget(verb: string, target: string | undefined, fallback = \"a file\"): string {\n return `${verb} ${target ?? fallback}`;\n}\n\nfunction baseName(value: unknown): string | undefined {\n if (typeof value !== \"string\" || value.length === 0) return undefined;\n return value.split(/[\\\\/]/).filter(Boolean).pop();\n}\n\nfunction hostOf(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n try {\n return new URL(value).host || undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Extract plain text from an Anthropic content-block array (e.g. tool results returned by Claude SDK). */\nfunction extractContentBlockText(blocks: unknown[]): string | null {\n const textBlocks = blocks.filter(\n (b): b is { type: \"text\"; text: string } =>\n typeof b === \"object\" &&\n b !== null &&\n (b as Record<string, unknown>).type === \"text\" &&\n typeof (b as Record<string, unknown>).text === \"string\",\n );\n if (textBlocks.length === 0) return null;\n return textBlocks.map((b) => b.text).join(\"\\n\");\n}\n\n/**\n * Produce a human-readable one-line summary of a tool result for the activity log.\n *\n * Handles Bash stdout/stderr, Write/Edit file paths, ApplyPatch change counts, and\n * Anthropic content-block arrays. Falls back to `JSON.stringify` for unknown shapes.\n *\n * @param tool - Tool name.\n * @param result - Raw tool result payload.\n * @returns A short display string, truncated to 200 characters.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function summarizeToolResult(tool: string, result: unknown): string {\n // Handle Anthropic content-block arrays: [{ type: \"text\", text: \"...\" }, ...]\n if (Array.isArray(result)) {\n const text = extractContentBlockText(result);\n return (text ?? JSON.stringify(result)).slice(0, 200);\n }\n if (typeof result !== \"object\" || !result) {\n return String(result).slice(0, 200);\n }\n const r = result as Record<string, unknown>;\n switch (tool) {\n case \"Bash\": {\n const stderr = String(r.stderr ?? \"\").trim();\n if (stderr) return `stderr: ${stderr.slice(0, 200)}`;\n return (\n String(r.stdout ?? \"\")\n .trim()\n .slice(0, 200) || \"(no output)\"\n );\n }\n case \"Write\":\n return `${String(r.type)}: ${String(r.filePath)}`;\n case \"Edit\":\n return `Edited ${String(r.filePath)}`;\n case \"ApplyPatch\":\n return `${Array.isArray(r.changes) ? r.changes.length : 0} file changes`;\n default:\n return JSON.stringify(result).slice(0, 200);\n }\n}\n\n/**\n * Detect file-change events from a tool result, returning zero or more `file_changed` events.\n *\n * Handles `Write` (single create/edit), `Edit` (single edit), and `ApplyPatch` (multi-file\n * patch with per-change `kind` classification). Returns an empty array for all other tools.\n *\n * @param toolName - Name of the tool that produced the result.\n * @param result - Raw tool result payload.\n * @returns Array of `file_changed` normalized events.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function detectFileChanges(toolName: string, result: unknown): NormalizedEvent[] {\n if (typeof result !== \"object\" || !result) return [];\n const r = result as Record<string, unknown>;\n\n if (toolName === \"Write\" && r.filePath) {\n return [\n {\n type: \"file_changed\",\n path: String(r.filePath),\n action: r.type === \"create\" ? \"create\" : \"edit\",\n },\n ];\n }\n if (toolName === \"Edit\" && r.filePath) {\n return [{ type: \"file_changed\", path: String(r.filePath), action: \"edit\" }];\n }\n if (toolName === \"ApplyPatch\" && Array.isArray(r.changes)) {\n return r.changes\n .filter(\n (change): change is { path: string; kind: \"add\" | \"delete\" | \"update\" } =>\n typeof change === \"object\" &&\n change !== null &&\n typeof (change as Record<string, unknown>).path === \"string\" &&\n typeof (change as Record<string, unknown>).kind === \"string\",\n )\n .map((change) => ({\n type: \"file_changed\" as const,\n path: change.path,\n action: change.kind === \"add\" ? \"create\" : change.kind === \"delete\" ? \"delete\" : \"edit\",\n }));\n }\n\n return [];\n}\n\n/**\n * Backward-compatible single-event helper; returns the first `file_changed` event or `null`.\n *\n * Prefer {@link detectFileChanges} for multi-file patches (e.g. `ApplyPatch`).\n *\n * @param toolName - Name of the tool that produced the result.\n * @param result - Raw tool result payload.\n * @returns First detected `file_changed` event, or `null`.\n * @docLink packages/bridge/api-reference#normalizer\n */\nexport function detectFileChange(toolName: string, result: unknown): NormalizedEvent | null {\n return detectFileChanges(toolName, result)[0] ?? null;\n}\n","/**\n * BridgeRuntime — implements IAgentRuntime from @skaile/workspaces/types by wrapping\n * an AgentHarness + EventNormalizer. This is the primary integration point for\n * consumers that want normalized events from any harness.\n */\n\nimport type {\n AgentEvent,\n AgentPromptInput,\n AgentReconfigureOptions,\n AgentRuntimeConfig,\n IAgentRuntime,\n} from \"@skaile/workspaces/types\";\n\nimport { EventNormalizer } from \"./normalizer.js\";\nimport { toMergedRegistry } from \"./provider-registry-derive.js\";\nimport { createHarness } from \"./registry.js\";\nimport type { AgentConfig, AgentHarness } from \"./types.js\";\n\n/**\n * Implements `IAgentRuntime` from `@skaile/workspaces/types` by wrapping an {@link AgentHarness}\n * and an {@link EventNormalizer}.\n *\n * This is the primary integration point for consumers that want normalized `AgentEvent`\n * payloads from any harness without managing the harness lifecycle directly. Create via\n * {@link createRuntime} to avoid coupling to `BridgeRuntime` directly.\n *\n * @docLink packages/bridge/api-reference#runtime\n */\nexport class BridgeRuntime implements IAgentRuntime {\n private harness: AgentHarness | null = null;\n private normalizer = new EventNormalizer();\n private handlers = new Set<(event: AgentEvent) => void>();\n private boundEventHandler: ((event: any) => void) | null = null;\n private harnessId: string;\n\n constructor(harnessId: string = \"claude-sdk\") {\n this.harnessId = harnessId;\n }\n\n async start(config: AgentRuntimeConfig): Promise<void> {\n // Dispose previous harness if any\n if (this.harness) {\n await this.dispose();\n }\n\n this.normalizer.reset();\n\n const bridgeConfig: AgentConfig = {\n cwd: config.cwd,\n model: config.model,\n systemPrompt: config.systemPrompt,\n env: config.env,\n agentDir: config.agentDir,\n sessionId: config.sessionId,\n resumeSessionId: config.resumeSessionId,\n maxTurns: config.maxTurns,\n ...(config.registry ? { registry: toMergedRegistry(config.registry, \"runtime\") } : {}),\n ...(config.modelRef ? { modelRef: config.modelRef } : {}),\n };\n\n this.harness = await createHarness(this.harnessId, bridgeConfig);\n\n // Wire bridge events through normalizer to handlers\n this.boundEventHandler = (bridgeEvent: any) => {\n const normalized = this.normalizer.normalize(bridgeEvent);\n for (const event of normalized) {\n for (const handler of this.handlers) {\n handler(event);\n }\n }\n };\n this.harness.on(\"agent-event\", this.boundEventHandler);\n\n await this.harness.start();\n }\n\n async configure(_config: AgentReconfigureOptions): Promise<void> {\n // Runtime reconfiguration for BridgeRuntime is a no-op for now.\n // Future: reconnect connectors, reload ai-assets, update subagents.\n }\n\n async prompt(message: string): Promise<void> {\n if (!this.harness) throw new Error(\"Runtime not started — call start() first\");\n await this.harness.prompt(message);\n }\n\n async promptInput(input: AgentPromptInput): Promise<void> {\n if (!this.harness) throw new Error(\"Runtime not started — call start() first\");\n await this.harness.promptInput(input);\n }\n\n async reply(answer: string, question?: string, requestId?: string): Promise<void> {\n if (!this.harness) throw new Error(\"Runtime not started — call start() first\");\n // Mirror serve.ts handleReply: an answer must resume the paused turn. Falling through to\n // prompt() would deny the question as superseded and drop the structured answer.\n if (\n this.harness?.hasPendingQuestion() &&\n this.harness.answerQuestion(answer, question, requestId)\n )\n return;\n if (this.harness?.acceptsReplyAsPrompt) await this.prompt(answer);\n }\n\n async abort(): Promise<void> {\n if (this.harness) {\n await this.harness.abort();\n }\n }\n\n async dispose(): Promise<void> {\n if (this.harness) {\n if (this.boundEventHandler) {\n this.harness.off(\"agent-event\", this.boundEventHandler);\n this.boundEventHandler = null;\n }\n this.harness.kill();\n this.harness = null;\n }\n this.normalizer.reset();\n }\n\n onEvent(handler: (event: AgentEvent) => void): void {\n this.handlers.add(handler);\n }\n\n offEvent(handler: (event: AgentEvent) => void): void {\n this.handlers.delete(handler);\n }\n\n get isRunning(): boolean {\n return this.harness?.isRunning ?? false;\n }\n}\n\n/**\n * Factory function to create a {@link BridgeRuntime} with the specified harness.\n *\n * @param harnessId - Registered harness id (default: `\"claude-sdk\"`).\n * @returns A new `IAgentRuntime` wrapping the selected harness with event normalization.\n * @docLink packages/bridge/api-reference#runtime\n */\nexport function createRuntime(harnessId: string = \"claude-sdk\"): IAgentRuntime {\n return new BridgeRuntime(harnessId);\n}\n","/** Provider API key validation — hits each provider's models endpoint to verify the key works. */\n\nimport {\n buildCredentialHeaders,\n expandPreset,\n getProviderPreset,\n resolvePresetBaseUrl,\n resolveProbeUrl,\n} from \"./provider-catalog.js\";\n\n/**\n * Result of an API key validation check performed by {@link validateApiKey}.\n *\n * @docLink packages/bridge/api-reference#validation\n */\nexport interface ValidationResult {\n /** `true` when the API key was accepted by the provider's models endpoint. */\n ok: boolean;\n /** Human-readable error description when `ok` is `false`. */\n error?: string;\n}\n\n/**\n * Validate an API key by sending a lightweight GET request to the provider's models endpoint.\n *\n * Returns `{ ok: true }` when the provider accepts the key (HTTP 2xx). Returns\n * `{ ok: false, error }` on 401/403 (invalid key), other HTTP errors, network failures,\n * or unsupported providers. Requests time out after 8 seconds.\n *\n * @param provider - Catalog preset id (e.g. `\"anthropic\"`, `\"openai\"`, `\"google\"`).\n * @param key - API key to validate.\n * @param options - Optional base-URL / environment overrides; defaults to the\n * provider's own API, or its `base_url_env` value when one is set.\n * @returns Validation result with optional error description.\n * @docLink packages/bridge/api-reference#validation\n */\nexport async function validateApiKey(\n provider: string,\n key: string,\n options: { baseUrl?: string; env?: Record<string, string | undefined> } = {},\n): Promise<ValidationResult> {\n const preset = getProviderPreset(provider);\n if (!preset) return { ok: false, error: `Unknown provider: ${provider}` };\n\n // Validate against the same endpoint discovery/dispatch use: behind a gateway\n // the key is the gateway's, and the provider's public API would reject it.\n const baseUrl = resolvePresetBaseUrl(preset, {\n ...(options.baseUrl ? { baseUrl: options.baseUrl } : {}),\n env: options.env ?? process.env,\n });\n const entry = expandPreset(preset, baseUrl ? { baseUrl } : {});\n const url = resolveProbeUrl(entry);\n if (!url) return { ok: false, error: `Provider ${provider} exposes no models endpoint` };\n // Static non-secret headers (Anthropic's `anthropic-version`) plus the\n // credential carrier the preset's `auth_header` names.\n const headers = { ...entry.headers, ...buildCredentialHeaders(entry, key) };\n\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 8000);\n\n const response = await fetch(url, {\n method: \"GET\",\n headers,\n signal: controller.signal,\n });\n\n clearTimeout(timeout);\n\n if (response.ok) return { ok: true };\n\n const status = response.status;\n if (status === 401 || status === 403) {\n return { ok: false, error: \"Invalid API key (authentication failed)\" };\n }\n return { ok: false, error: `API returned HTTP ${status}` };\n } catch (err: any) {\n if (err.name === \"AbortError\") return { ok: false, error: \"Request timed out (8s)\" };\n return { ok: false, error: err.message ?? \"Network error\" };\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/ensure-sources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,gBAAgB,GAAA,EAAqB;AAC5C,EAAA,OAAY,IAAA,CAAA,IAAA,CAAK,iBAAA,EAAkB,EAAG,GAAG,CAAA;AAC3C;AASA,SAAS,kBAAA,CAAmB,UAAkB,KAAA,EAAsC;AAClF,EAAA,IAAI;AACF,IAAA,OAAO,mBAAA,CAAoB,IAAA,CAAK,QAAQ,CAAA,CAAE,UAAA,EAAW;AAAA,EACvD,SAAS,GAAA,EAAK;AACZ,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,MAAA,CAAO,CAAA,eAAA,EAAkB,QAAQ,CAAA,EAAA,EAAK,GAAA,YAAe,KAAA,GAAQ,IAAI,OAAA,GAAU,MAAA,CAAO,GAAG,CAAC,CAAA,CAAE,CAAA;AAAA,IAC1F;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAMA,SAAS,kBAAA,CAAmB,KAAA,EAAoB,KAAA,EAAgB,MAAA,EA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AA,GAAS,CAAA,EAAG;AAC5B,IAAA,OAAA,CAAQ,yBAAyB,MAAA,CAAO,MAAA,CAAO,IAAA,CAAK,IAAI,CAAC,CAAA,CAAE,CAAA;AAAA,EAC7D;AACF;AAUO,SAAS,mBAAA,CACd,UAAA,EACA,IAAA,GAA4B,EAAC,EACf;AACd,EAAA,MAAM,MAAA,GAAuB,EAAE,MAAA,EAAQ,EAAC,EAAG,QAAQ,EAAC,EAAG,MAAA,EAAQ,EAAC,EAAE;AAClE,EAAA,MAAM,QAAA,GAAgB,IAAA,CAAA,IAAA,CAAK,UAAA,EAAY,aAAa,CAAA;AACpD,EAAA,IAAI,CAAC,UAAA,CAAW,QAAQ,CAAA,EAAG,OAAO,MAAA;AAElC,EAAA,MAAM,KAAA,GAAQ,KAAK,KAAA,IAAS,KAAA;AAC5B,EAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,QAAA,EAAU,KAAK,CAAA;AAClD,EAAA,IAAI,OAAA,KAAY,MAAM,OAAO,MAAA;AAC7B,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,MAAA;AAEjC,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,kBAAA,CAAmB,KAAA,EAAO,OAAO,MAAM,CAAA;AAAA,EACzC;AAEA,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,iBAAA,CAAkB,MAAM,CAAA;AAAA,EAC1B;AAEA,EAAA,OAAO,MAAA;AACT","file":"ensure-sources-CAMWJTMR.js","sourcesContent":["/**\n * ensure-sources.ts — hydrate the `~/.skaile/cache/sources/` clone cache from a\n * project's `skaile.yaml` `sources:` entries.\n *\n * Called by `skaile init` (idempotent: no-op when no sources declared) and\n * `skaile install` so checking out a project pulls its source clones onto\n * the local machine.\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, mkdirSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n discardUnclonedSourceDir,\n getGlobalCacheDir,\n isSourceCloned,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n WorkspaceYamlEditor,\n} from \"@skaile/workspaces/core\";\nimport { logErr, logInfo, logOk } from \"./helpers.ts\";\n\nfunction sourceClonePath(key: string): string {\n return path.join(getGlobalCacheDir(), key);\n}\n\nexport interface EnsureResult {\n cloned: string[];\n cached: string[];\n failed: string[];\n}\n\n/** Load `sources:` from a project's `skaile.yaml`, or `null` when unavailable. */\nfunction loadProjectSources(yamlPath: string, quiet: boolean): SourceEntry[] | null {\n try {\n return WorkspaceYamlEditor.load(yamlPath).getSources();\n } catch (err) {\n if (!quiet) {\n logErr(`Could not read ${yamlPath}: ${err instanceof Error ? err.message : String(err)}`);\n }\n return null;\n }\n}\n\n/**\n * Hydrate a single source entry into `result`: skip when already cached,\n * otherwise clone and record success/failure. Mutates `result` in place.\n */\nfunction hydrateSourceEntry(entry: SourceEntry, quiet: boolean, result: EnsureResult): void {\n const key = sourceCacheKey(entry.url);\n const slug = sourceShortName(entry.url);\n const dest = sourceClonePath(key);\n // A folder without a git checkout (a failed first clone left it) is not a cached clone.\n if (isSourceCloned(dest)) {\n result.cached.push(slug);\n return;\n }\n discardUnclonedSourceDir(dest);\n mkdirSync(path.dirname(dest), { recursive: true });\n const args = [\"clone\", entry.url, dest];\n if (entry.pin) args.splice(1, 0, \"--branch\", entry.pin);\n const clone = spawnSync(\"git\", args, { stdio: quiet ? \"pipe\" : \"inherit\" });\n if (clone.status !== 0) {\n discardUnclonedSourceDir(dest);\n if (quiet) {\n logErr(`git clone failed for ${entry.url}`);\n }\n return;\n }\n result.cloned.push(slug);\n}\n\n/** Log a full-hydrate summary of cloned + reused-cached entries. */\nfunction logHydrateSummary(result: EnsureResult): void {\n for (const n of result.cloned) logOk(`Cloned source \"${n}\".`);\n if (result.cached.length > 0) {\n logInfo(`Reused cached clones: ${result.cached.join(\", \")}`);\n }\n}\n\n/**\n * Walk `projectDir/skaile.yaml` `sources:` and clone any entries whose\n * clone directory does not yet exist under `~/.skaile/cache/sources/`. Existing\n * clones are left untouched — this is hydration, not sync.\n *\n * Quiet by default: when `quiet: true` the helper only prints failures.\n * On full hydrate (`quiet: false`) it logs each cloned/cached entry.\n */\nexport function ensureSourcesCloned(\n projectDir: string,\n opts: { quiet?: boolean } = {},\n): EnsureResult {\n const result: EnsureResult = { cloned: [], cached: [], failed: [] };\n const yamlPath = path.join(projectDir, \"skaile.yaml\");\n if (!existsSync(yamlPath)) return result;\n\n const quiet = opts.quiet ?? false;\n const sources = loadProjectSources(yamlPath, quiet);\n if (sources === null) return result;\n if (sources.length === 0) return result;\n\n for (const entry of sources) {\n hydrateSourceEntry(entry, quiet, result);\n }\n\n if (!quiet) {\n logHydrateSummary(result);\n }\n\n return result;\n}\n"]}
|