@skaile/workspaces 5.15.1 → 5.16.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 +54 -0
- package/dist/{asset-feeds-FVDNQ2FM.js → asset-feeds-BELBSJEE.js} +18 -18
- package/dist/{asset-feeds-FVDNQ2FM.js.map → asset-feeds-BELBSJEE.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +7 -7
- package/dist/asset-manager/index.js +13 -13
- package/dist/asset-manager/installer.js +9 -9
- package/dist/asset-manager/renderers.js +8 -8
- package/dist/asset-manager/src/index.d.ts +105 -6
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts +11 -2
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/asset-manager/src/mcp-config.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +150 -19
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +15 -128
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +10 -10
- package/dist/bridge/drivers/echo.js +2 -2
- package/dist/bridge/drivers/gemini.js +7 -7
- package/dist/bridge/drivers/goose.js +10 -10
- package/dist/bridge/drivers/omp.js +61 -5
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +10 -10
- package/dist/bridge/drivers/qwen.js +7 -7
- package/dist/bridge/index.js +13 -12
- package/dist/bridge/src/approval-card.d.ts +24 -0
- package/dist/bridge/src/approval-card.d.ts.map +1 -0
- package/dist/bridge/src/driver-model-check.d.ts +21 -0
- package/dist/bridge/src/driver-model-check.d.ts.map +1 -0
- package/dist/bridge/src/drivers/claude-sdk.d.ts +22 -0
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/omp-models-yml.d.ts.map +1 -1
- package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
- package/dist/bridge/src/index.d.ts +2 -0
- package/dist/bridge/src/index.d.ts.map +1 -1
- package/dist/bridge/src/types.d.ts +23 -0
- package/dist/bridge/src/types.d.ts.map +1 -1
- package/dist/{chunk-YUURCZWY.js → chunk-2SKPPIV7.js} +5 -5
- package/dist/{chunk-YUURCZWY.js.map → chunk-2SKPPIV7.js.map} +1 -1
- package/dist/{chunk-PK5XQBOC.js → chunk-46IRZJV4.js} +4 -4
- package/dist/{chunk-PK5XQBOC.js.map → chunk-46IRZJV4.js.map} +1 -1
- package/dist/{chunk-NVBN3YOH.js → chunk-5CE6J4DB.js} +46 -67
- package/dist/chunk-5CE6J4DB.js.map +1 -0
- package/dist/{chunk-54TVXZP3.js → chunk-5DCOG5B5.js} +3 -3
- package/dist/{chunk-54TVXZP3.js.map → chunk-5DCOG5B5.js.map} +1 -1
- package/dist/{chunk-X7DIT65W.js → chunk-5RDZ5JHH.js} +4 -4
- package/dist/{chunk-X7DIT65W.js.map → chunk-5RDZ5JHH.js.map} +1 -1
- package/dist/{chunk-BV7NLPI6.js → chunk-6GSE63K2.js} +4 -4
- package/dist/{chunk-BV7NLPI6.js.map → chunk-6GSE63K2.js.map} +1 -1
- package/dist/{chunk-GQ5OYFVD.js → chunk-6Q7NKTDG.js} +47 -47
- package/dist/chunk-6Q7NKTDG.js.map +1 -0
- package/dist/chunk-6RTEUWXX.js +125 -0
- package/dist/chunk-6RTEUWXX.js.map +1 -0
- package/dist/{chunk-RTYDYSUV.js → chunk-72KZJE3G.js} +82 -22
- package/dist/chunk-72KZJE3G.js.map +1 -0
- package/dist/{chunk-SAKVAG23.js → chunk-A26MUUN7.js} +7 -7
- package/dist/{chunk-SAKVAG23.js.map → chunk-A26MUUN7.js.map} +1 -1
- package/dist/{chunk-NHH3MRSC.js → chunk-A7AZ3RL5.js} +6 -6
- package/dist/{chunk-NHH3MRSC.js.map → chunk-A7AZ3RL5.js.map} +1 -1
- package/dist/{chunk-LEOXPIC6.js → chunk-AP24HESN.js} +3 -3
- package/dist/{chunk-LEOXPIC6.js.map → chunk-AP24HESN.js.map} +1 -1
- package/dist/{chunk-JJLH4TX4.js → chunk-CQFVKN6S.js} +230 -62
- package/dist/chunk-CQFVKN6S.js.map +1 -0
- package/dist/{chunk-OOQ5Q75W.js → chunk-D3PU3C6F.js} +41 -16
- package/dist/chunk-D3PU3C6F.js.map +1 -0
- package/dist/{chunk-WXKNM2JJ.js → chunk-D5REDKVU.js} +3 -3
- package/dist/{chunk-WXKNM2JJ.js.map → chunk-D5REDKVU.js.map} +1 -1
- package/dist/{chunk-R37L4BNR.js → chunk-DADAZLFW.js} +648 -76
- package/dist/chunk-DADAZLFW.js.map +1 -0
- package/dist/{chunk-U7YMGW7M.js → chunk-DQOAPR4M.js} +2 -2
- package/dist/{chunk-U7YMGW7M.js.map → chunk-DQOAPR4M.js.map} +1 -1
- package/dist/{chunk-7Y7UYNGL.js → chunk-E634MBP6.js} +12 -9
- package/dist/chunk-E634MBP6.js.map +1 -0
- package/dist/{chunk-NKDSU4Q7.js → chunk-ES6ARJPQ.js} +21 -7
- package/dist/chunk-ES6ARJPQ.js.map +1 -0
- package/dist/{chunk-WWUWMOX2.js → chunk-FSLVMZXR.js} +37 -17
- package/dist/chunk-FSLVMZXR.js.map +1 -0
- package/dist/{chunk-MKTJZLQM.js → chunk-FSSRBWYL.js} +4 -4
- package/dist/{chunk-MKTJZLQM.js.map → chunk-FSSRBWYL.js.map} +1 -1
- package/dist/{chunk-VY6NTFE7.js → chunk-FT4ZHLYR.js} +3 -2
- package/dist/chunk-FT4ZHLYR.js.map +1 -0
- package/dist/chunk-FWAJUWXQ.js +1016 -0
- package/dist/chunk-FWAJUWXQ.js.map +1 -0
- package/dist/{chunk-ANSZULXH.js → chunk-H7R7R5BN.js} +21 -6
- package/dist/chunk-H7R7R5BN.js.map +1 -0
- package/dist/{chunk-4AKR4XPQ.js → chunk-HG52NGAV.js} +3 -3
- package/dist/chunk-HG52NGAV.js.map +1 -0
- package/dist/{plugin-store-BIITCNOZ.js → chunk-HUKUYWBJ.js} +32 -23
- package/dist/chunk-HUKUYWBJ.js.map +1 -0
- package/dist/{chunk-JUHDED6J.js → chunk-ISSYT5AZ.js} +3 -3
- package/dist/{chunk-JUHDED6J.js.map → chunk-ISSYT5AZ.js.map} +1 -1
- package/dist/{chunk-GR7TV4XC.js → chunk-J4RRH2NP.js} +4 -4
- package/dist/{chunk-GR7TV4XC.js.map → chunk-J4RRH2NP.js.map} +1 -1
- package/dist/{chunk-NOF73BUH.js → chunk-L6UMSKDF.js} +10 -2
- package/dist/chunk-L6UMSKDF.js.map +1 -0
- package/dist/{chunk-TCWECSEB.js → chunk-NSNM2ZXF.js} +28 -4
- package/dist/chunk-NSNM2ZXF.js.map +1 -0
- package/dist/{chunk-B6I7SF2X.js → chunk-OHNNCXMB.js} +114 -81
- package/dist/chunk-OHNNCXMB.js.map +1 -0
- package/dist/{chunk-MUOSKYI2.js → chunk-OJHPG6HK.js} +10 -10
- package/dist/{chunk-MUOSKYI2.js.map → chunk-OJHPG6HK.js.map} +1 -1
- package/dist/{chunk-SZPE55SB.js → chunk-PGZDSDOB.js} +3 -3
- package/dist/{chunk-SZPE55SB.js.map → chunk-PGZDSDOB.js.map} +1 -1
- package/dist/{chunk-4QINFQ27.js → chunk-PIC23DDE.js} +59 -17
- package/dist/chunk-PIC23DDE.js.map +1 -0
- package/dist/{chunk-GLMKS6V6.js → chunk-RTNWU2UD.js} +4 -4
- package/dist/{chunk-GLMKS6V6.js.map → chunk-RTNWU2UD.js.map} +1 -1
- package/dist/{chunk-354JIEIE.js → chunk-SAGBVBY2.js} +5 -5
- package/dist/{chunk-354JIEIE.js.map → chunk-SAGBVBY2.js.map} +1 -1
- package/dist/{chunk-55VKZUQY.js → chunk-SMUIYYCH.js} +70 -34
- package/dist/chunk-SMUIYYCH.js.map +1 -0
- package/dist/{chunk-N36S36OZ.js → chunk-SPV2CXJ3.js} +3 -3
- package/dist/{chunk-N36S36OZ.js.map → chunk-SPV2CXJ3.js.map} +1 -1
- package/dist/{chunk-KRRHADE7.js → chunk-SXWGLW23.js} +4 -4
- package/dist/{chunk-KRRHADE7.js.map → chunk-SXWGLW23.js.map} +1 -1
- package/dist/{chunk-RNFHJUK7.js → chunk-TADJCATD.js} +3 -3
- package/dist/{chunk-RNFHJUK7.js.map → chunk-TADJCATD.js.map} +1 -1
- package/dist/{chunk-PQF5QHVS.js → chunk-TKI7YDWE.js} +19 -5
- package/dist/chunk-TKI7YDWE.js.map +1 -0
- package/dist/{chunk-O673TBWJ.js → chunk-TXGVG7VH.js} +3 -3
- package/dist/{chunk-O673TBWJ.js.map → chunk-TXGVG7VH.js.map} +1 -1
- package/dist/{chunk-GV3MFKDV.js → chunk-VJ2DZLDM.js} +62 -6
- package/dist/chunk-VJ2DZLDM.js.map +1 -0
- package/dist/{chunk-PV47EEHD.js → chunk-WKEBNB5S.js} +4 -4
- package/dist/{chunk-PV47EEHD.js.map → chunk-WKEBNB5S.js.map} +1 -1
- package/dist/{chunk-ESXZJP4M.js → chunk-WXWQNJCT.js} +3 -3
- package/dist/{chunk-ESXZJP4M.js.map → chunk-WXWQNJCT.js.map} +1 -1
- package/dist/{chunk-DPCEQOIZ.js → chunk-XGR7IDTY.js} +3 -3
- package/dist/{chunk-DPCEQOIZ.js.map → chunk-XGR7IDTY.js.map} +1 -1
- package/dist/{chunk-VQQCA7BD.js → chunk-Y25V2MW2.js} +4 -4
- package/dist/{chunk-VQQCA7BD.js.map → chunk-Y25V2MW2.js.map} +1 -1
- package/dist/{chunk-MGM5EJQQ.js → chunk-YK3XLEQJ.js} +40 -26
- package/dist/chunk-YK3XLEQJ.js.map +1 -0
- package/dist/{chunk-SP5NGNBV.js → chunk-YW2BNDSE.js} +11 -4
- package/dist/chunk-YW2BNDSE.js.map +1 -0
- package/dist/{chunk-J76LDUDS.js → chunk-ZVZTCDUN.js} +26 -10
- package/dist/chunk-ZVZTCDUN.js.map +1 -0
- package/dist/cli/index.js +899 -1617
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/agent-checks.d.ts +22 -10
- package/dist/cli/src/agent-checks.d.ts.map +1 -1
- 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/integration.d.ts.map +1 -1
- package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/library-index.d.ts +6 -0
- package/dist/cli/src/commands/library-index.d.ts.map +1 -1
- package/dist/cli/src/commands/library-publish.d.ts.map +1 -1
- package/dist/cli/src/commands/outdated.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin/codex.d.ts +10 -0
- package/dist/cli/src/commands/plugin/codex.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin/types.d.ts +5 -2
- package/dist/cli/src/commands/plugin/types.d.ts.map +1 -1
- package/dist/cli/src/commands/preset-export.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +6 -0
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/cli/src/commands/rebuild.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 +13 -0
- 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/show.d.ts.map +1 -1
- package/dist/cli/src/commands/source.d.ts +2 -1
- package/dist/cli/src/commands/source.d.ts.map +1 -1
- package/dist/cli/src/commands/store.d.ts.map +1 -1
- package/dist/cli/src/commands/update.d.ts.map +1 -1
- package/dist/cli/src/commands/validate.d.ts +6 -1
- package/dist/cli/src/commands/validate.d.ts.map +1 -1
- package/dist/cli/src/commands/verify.d.ts.map +1 -1
- package/dist/cli/src/helpers.d.ts +23 -0
- package/dist/cli/src/helpers.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/index.d.ts +8 -0
- package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/load.d.ts +1 -0
- package/dist/cli/src/plugin-store/load.d.ts.map +1 -1
- package/dist/cli/src/skill-checks.d.ts +9 -21
- package/dist/cli/src/skill-checks.d.ts.map +1 -1
- package/dist/connectors/config.js +5 -5
- package/dist/connectors/index.js +16 -15
- package/dist/{connectors-TVFFE5H4.js → connectors-44RE2QEM.js} +19 -18
- package/dist/{connectors-TVFFE5H4.js.map → connectors-44RE2QEM.js.map} +1 -1
- package/dist/core/index.js +6 -6
- package/dist/core/manifest.js +2 -2
- package/dist/core/models.js +1 -1
- package/dist/core/publish-manifest.js +3 -3
- package/dist/core/ref.js +1 -1
- package/dist/core/runtime-assets.js +5 -5
- package/dist/core/src/conformance.d.ts.map +1 -1
- package/dist/core/src/driver-sdk.d.ts +12 -2
- package/dist/core/src/driver-sdk.d.ts.map +1 -1
- package/dist/core/src/index.d.ts +4 -4
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts +7 -0
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts +9 -0
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/models.d.ts.map +1 -1
- package/dist/core/src/publish-manifest.d.ts +5 -2
- package/dist/core/src/publish-manifest.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +14 -0
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/workspace-config.js +4 -4
- package/dist/deploy/index.js +6 -6
- package/dist/discovery/index.js +5 -5
- package/dist/discovery/src/index.d.ts +2 -2
- package/dist/discovery/src/index.d.ts.map +1 -1
- package/dist/discovery/src/parse-manifest.d.ts +7 -0
- package/dist/discovery/src/parse-manifest.d.ts.map +1 -1
- package/dist/discovery/src/source-config.d.ts +6 -0
- package/dist/discovery/src/source-config.d.ts.map +1 -1
- package/dist/{ensure-sources-N4E5EDGC.js → ensure-sources-R6AHZ7RV.js} +16 -16
- package/dist/{ensure-sources-N4E5EDGC.js.map → ensure-sources-R6AHZ7RV.js.map} +1 -1
- package/dist/factory-assets/README.md +1 -1
- package/dist/factory-assets/connectors/box.js +16 -15
- package/dist/factory-assets/connectors/deploy.js +16 -15
- package/dist/factory-assets/connectors/devserver.js +16 -15
- package/dist/factory-assets/connectors/flow/adapter.js +16 -15
- package/dist/factory-assets/connectors/flow/engine.js +7 -7
- package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.js +18 -17
- package/dist/factory-assets/connectors/flow.js +16 -15
- package/dist/factory-assets/connectors/git.js +16 -15
- package/dist/factory-assets/connectors/gmail.js +16 -15
- package/dist/factory-assets/connectors/googledrive.js +16 -15
- package/dist/factory-assets/connectors/local.js +16 -15
- package/dist/factory-assets/connectors/mattermost.js +16 -15
- package/dist/factory-assets/connectors/memory.js +16 -15
- package/dist/factory-assets/connectors/minio.js +16 -15
- package/dist/factory-assets/connectors/postgres.js +16 -15
- package/dist/factory-assets/connectors/s3.js +16 -15
- package/dist/factory-assets/connectors/sharepoint.js +16 -15
- package/dist/factory-assets/connectors/sqlite.js +16 -15
- package/dist/factory-assets/connectors/static-server.js +16 -15
- package/dist/factory-assets/connectors/tunnel.js +16 -15
- package/dist/factory-assets/connectors/webdav.js +16 -15
- package/dist/factory-assets/connectors/xstate-store.js +16 -15
- package/dist/factory-assets/connectors/xstate.js +16 -15
- package/dist/factory-assets/skills/authoring-skaile-assets/SKILL.md +12 -11
- package/dist/factory-assets/skills/authoring-skaile-manifests/SKILL.md +11 -7
- package/dist/factory-assets/skills/skailify/SKILL.md +3 -3
- package/dist/{flows-CYJI3URW.js → flows-YKC53LDP.js} +11 -11
- package/dist/{flows-CYJI3URW.js.map → flows-YKC53LDP.js.map} +1 -1
- package/dist/{helpers-PPVGVYIZ.js → helpers-FNQL5PI7.js} +16 -16
- package/dist/{helpers-PPVGVYIZ.js.map → helpers-FNQL5PI7.js.map} +1 -1
- package/dist/library/index.js +10 -10
- package/dist/library/install.js +4 -4
- package/dist/library/src/index.d.ts +1 -1
- package/dist/library/src/index.d.ts.map +1 -1
- package/dist/library/src/local/store-paths.d.ts +8 -0
- package/dist/library/src/local/store-paths.d.ts.map +1 -1
- package/dist/library/src/manifest-writer.d.ts +5 -1
- package/dist/library/src/manifest-writer.d.ts.map +1 -1
- package/dist/library/src/remote/remote-catalog-source.d.ts +3 -2
- package/dist/library/src/remote/remote-catalog-source.d.ts.map +1 -1
- package/dist/{library-publish-EQFYHJ6G.js → library-publish-GHPVY42Y.js} +56 -48
- package/dist/library-publish-GHPVY42Y.js.map +1 -0
- package/dist/model-endpoint/index.js +19 -3
- package/dist/model-endpoint/src/index.d.ts +1 -1
- package/dist/model-endpoint/src/index.d.ts.map +1 -1
- package/dist/model-endpoint/src/resolve.d.ts +5 -0
- package/dist/model-endpoint/src/resolve.d.ts.map +1 -1
- package/dist/model-endpoint/src/server.d.ts +7 -0
- package/dist/model-endpoint/src/server.d.ts.map +1 -1
- package/dist/model-endpoint/src/types.d.ts +41 -7
- package/dist/model-endpoint/src/types.d.ts.map +1 -1
- package/dist/{open-library-JJGDEYYT.js → open-library-YSUGNP36.js} +19 -19
- package/dist/{open-library-JJGDEYYT.js.map → open-library-YSUGNP36.js.map} +1 -1
- package/dist/{open-registry-X6YQVP7V.js → open-registry-YPRQDUMK.js} +14 -14
- package/dist/{open-registry-X6YQVP7V.js.map → open-registry-YPRQDUMK.js.map} +1 -1
- package/dist/{paths-NXWIBZCX.js → paths-P55DTBEK.js} +9 -9
- package/dist/{paths-NXWIBZCX.js.map → paths-P55DTBEK.js.map} +1 -1
- package/dist/plugin-store-IPIBZRBX.js +23 -0
- package/dist/plugin-store-IPIBZRBX.js.map +1 -0
- package/dist/project-NDSLXERO.js +83 -0
- package/dist/{project-5HW3XSOE.js.map → project-NDSLXERO.js.map} +1 -1
- package/dist/resolver/index.js +7 -7
- package/dist/resolver/src/types.d.ts +1 -0
- package/dist/resolver/src/types.d.ts.map +1 -1
- package/dist/resolver/src/validator.d.ts +1 -1
- package/dist/runner/index.js +32 -31
- package/dist/runner/src/agent.d.ts +9 -1
- package/dist/runner/src/agent.d.ts.map +1 -1
- package/dist/runner/src/agents/in-process-host.d.ts.map +1 -1
- package/dist/runner/src/composition/content-source.d.ts.map +1 -1
- package/dist/runner/src/composition/index.d.ts +1 -1
- package/dist/runner/src/composition/index.d.ts.map +1 -1
- package/dist/runner/src/composition/resolve-instance.d.ts +20 -0
- package/dist/runner/src/composition/resolve-instance.d.ts.map +1 -1
- package/dist/runner/src/model-endpoint-discovery.d.ts.map +1 -1
- package/dist/runner/src/resource-handler.d.ts.map +1 -1
- package/dist/runner/src/runner-capabilities.d.ts +9 -3
- package/dist/runner/src/runner-capabilities.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts +10 -0
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts +20 -1
- package/dist/runner/src/session-builder.d.ts.map +1 -1
- package/dist/runner/src/session-capability-wiring.d.ts +5 -0
- package/dist/runner/src/session-capability-wiring.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +13 -13
- package/dist/sdk/bridge.js +13 -12
- package/dist/sdk/core.js +6 -6
- package/dist/sdk/flow.js +7 -7
- package/dist/sdk/index.js +32 -31
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +7 -7
- package/dist/sdk/runner.js +32 -31
- package/dist/sdk/transport/ws/server.js +1 -1
- package/dist/sdk/transport/ws.js +1 -1
- package/dist/sdk/transport.js +1 -1
- package/dist/{serve-preflight-GD7IQFA3.js → serve-preflight-ON2LS3SD.js} +15 -9
- package/dist/serve-preflight-ON2LS3SD.js.map +1 -0
- package/dist/{setup-52NDDR7C.js → setup-MFPEQS2I.js} +23 -22
- package/dist/setup-MFPEQS2I.js.map +1 -0
- package/dist/{skills-XVHOXOOH.js → skills-7G6QCDEM.js} +12 -12
- package/dist/{skills-XVHOXOOH.js.map → skills-7G6QCDEM.js.map} +1 -1
- package/dist/{source-WKV4QFGS.js → source-4QVRD5NV.js} +42 -41
- package/dist/{source-WKV4QFGS.js.map → source-4QVRD5NV.js.map} +1 -1
- package/dist/{source-manifest-publish-3HAX6DPN.js → source-manifest-publish-ZIO24GUM.js} +44 -43
- package/dist/source-manifest-publish-ZIO24GUM.js.map +1 -0
- package/dist/transport/index.js +1 -1
- package/dist/transport/src/ws/server.d.ts +9 -0
- package/dist/transport/src/ws/server.d.ts.map +1 -1
- package/dist/transport/ws/server.js +1 -1
- package/dist/transport/ws.js +1 -1
- package/dist/tui/index.js +107 -41
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/src/repl-session.d.ts +7 -0
- package/dist/tui/src/repl-session.d.ts.map +1 -1
- package/dist/tui/src/repl.d.ts +16 -0
- package/dist/tui/src/repl.d.ts.map +1 -1
- package/dist/types/manifests.js +1 -1
- package/dist/types/src/manifests/index.d.ts +1 -0
- package/dist/types/src/manifests/index.d.ts.map +1 -1
- package/dist/types/src/manifests/scaffold-body.d.ts +8 -0
- package/dist/types/src/manifests/scaffold-body.d.ts.map +1 -0
- package/dist/workspace-plugin/adapters/mcp.js +23 -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-4AKR4XPQ.js.map +0 -1
- package/dist/chunk-4QINFQ27.js.map +0 -1
- package/dist/chunk-55VKZUQY.js.map +0 -1
- package/dist/chunk-7Y7UYNGL.js.map +0 -1
- package/dist/chunk-ANSZULXH.js.map +0 -1
- package/dist/chunk-B6I7SF2X.js.map +0 -1
- package/dist/chunk-GQ5OYFVD.js.map +0 -1
- package/dist/chunk-GV3MFKDV.js.map +0 -1
- package/dist/chunk-J76LDUDS.js.map +0 -1
- package/dist/chunk-JJLH4TX4.js.map +0 -1
- package/dist/chunk-MGM5EJQQ.js.map +0 -1
- package/dist/chunk-NKDSU4Q7.js.map +0 -1
- package/dist/chunk-NOF73BUH.js.map +0 -1
- package/dist/chunk-NVBN3YOH.js.map +0 -1
- package/dist/chunk-OOQ5Q75W.js.map +0 -1
- package/dist/chunk-PQF5QHVS.js.map +0 -1
- package/dist/chunk-R37L4BNR.js.map +0 -1
- package/dist/chunk-RTYDYSUV.js.map +0 -1
- package/dist/chunk-SP5NGNBV.js.map +0 -1
- package/dist/chunk-TCWECSEB.js.map +0 -1
- package/dist/chunk-VY6NTFE7.js.map +0 -1
- package/dist/chunk-WWUWMOX2.js.map +0 -1
- package/dist/library-publish-EQFYHJ6G.js.map +0 -1
- package/dist/plugin-store-BIITCNOZ.js.map +0 -1
- package/dist/project-5HW3XSOE.js +0 -82
- package/dist/serve-preflight-GD7IQFA3.js.map +0 -1
- package/dist/setup-52NDDR7C.js.map +0 -1
- package/dist/source-manifest-publish-3HAX6DPN.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","spawnSync","dest"],"mappings":";;;;;;;;;;;;;;;;;;AAmDA,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;AAkBO,SAAS,gBAAA,CACd,KACA,UAAA,EACqF;AACrF,EAAA,MAAM,IAAA,GAAO,kBAAkB,UAAU,CAAA;AACzC,EAAA,MAAM,UAAA,GAA4B,OAC9B,kBAAA,CAAwBA,KAAA,CAAA,IAAA,CAAK,MAAM,uBAAA,EAAyB,CAAC,CAAA,GAC7D,EAAC;AACL,EAAA,MAAM,KAAA,GAAQ,WAAW,IAAA,CAAK,CAAC,MAAM,gBAAA,CAAiB,CAAA,EAAG,GAAG,CAAC,CAAA;AAC7D,EAAA,MAAM,MAAA,GAAS,CAAC,KAAA,GAAQ,kBAAA,CAAmB,GAAG,CAAA,GAAI,MAAA;AAClD,EAAA,MAAM,MAA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,EACF,CAAC,CAAA;AAGH,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-B6I7SF2X.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, readFileSync, writeFileSync } from \"node:fs\";\nimport * as path from \"node:path\";\nimport {\n type AssetEntry,\n decodeSkaileManifest,\n encodeSkaileManifest,\n findWorkspaceRoot,\n parseAssetRef,\n resolveSourcePublisher,\n type SkPublishManifest,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n storeManifestSlug,\n workspaceConfigFilename,\n} from \"@skaile/workspaces/core\";\nimport { computeDeterministicHash, discoverAssetsInTree } from \"@skaile/workspaces/discovery\";\nimport {\n commitStoreManifest,\n getStoreManifestsDir,\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 collision-free **store slug** (`<host>__<owner>__<repo>`) whose\n * manifest already exists at `~/.skaile/store/manifests/<arg>.yaml`. This\n * 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\n * DIFFERENT slug than the one `init` wrote (e.g. `larksuite`). The slug is\n * the exact identifier `init`'s 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 */\nexport function resolveSourceArg(\n arg: string,\n projectDir: string,\n): { url: string; slug: string; dest: string; manifestFile: string; guessed: boolean } {\n const root = findWorkspaceRoot(projectDir);\n const registered: SourceEntry[] = root\n ? readProjectSources(path.join(root, workspaceConfigFilename()))\n : [];\n const match = registered.find((e) => sourceMatchesKey(e, arg));\n const bySlug = !match ? resolveByStoreSlug(arg) : 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 };\n}\n\n/**\n * When `arg` is a bare store slug (`<host>__<owner>__<repo>`) whose curated\n * manifest already exists on disk, recover the source URL from the slug and\n * point at that manifest file directly. Returns `undefined` when the arg isn't\n * a slug or has no manifest yet (fall back to URL normalization).\n */\nfunction resolveByStoreSlug(arg: string): { url: string; manifestFile: string } | undefined {\n // A slug is our own encoding — no path/URL sigils, at least the `<host>__…`\n // separator. Anything URL/owner-repo shaped is not a slug.\n if (!/^[\\w.-]+__[\\w.-]+/.test(arg) || /[/:\\\\]/.test(arg)) return undefined;\n const manifestFile = path.join(getStoreManifestsDir(), `${arg}.yaml`);\n if (!existsSync(manifestFile)) return undefined;\n // `<host>__<owner>__<repo>` → `https://<host>/<owner>/<repo>` — good enough to\n // key the clone dir + re-derive the same slug; the manifest file is what edit\n // actually opens.\n const [host, owner, repo] = arg.split(\"__\");\n const url = host && owner && repo ? `https://${host}/${owner}/${repo}` : arg;\n return { url, manifestFile };\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 path.join(getStoreManifestsDir(), `${storeManifestSlug(url)}.yaml`);\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 { url, dest, manifestFile: target, guessed } = resolveSourceArg(arg, projectDir);\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 } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(\n `No curated manifest for \"${slug}\" at ${S.dim(target)} — ` +\n \"run `skaile source manifest init` first.\",\n );\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 } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(\n `No curated manifest for \"${slug}\" at ${S.dim(target)} — ` +\n \"run `skaile source manifest init` first.\",\n );\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 } = resolveSourceArg(arg, projectDir);\n\n if (!existsSync(target)) {\n logErr(\n `No curated manifest for \"${slug}\" at ${target}. ` +\n \"Run `skaile source manifest init` first.\",\n );\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 findWorkspaceRoot,\n getGlobalCacheDir,\n getRepoCommit,\n globalCacheRoot,\n legacySourceCacheKey,\n resolveSkWorkspaceConfig,\n type SourceEntry,\n sourceCacheKey,\n sourceShortName,\n WorkspaceYamlEditor,\n workspaceConfigFilename,\n} from \"@skaile/workspaces/core\";\nimport { curatedManifestOverlay, LocalCatalogSource } from \"@skaile/workspaces/library\";\nimport * as p from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { logErr, logInfo, 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 * Normalize a `source add` argument into a clonable git URL. Full URLs and\n * scp-style (`git@host:…`) specs pass through unchanged; 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 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 * 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. 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 ];\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/**\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 = sourceCacheKey(url);\n return sources.find((s) => s.url !== url && sourceCacheKey(s.url) === key);\n}\n\nfunction requireProjectYamlPath(): string {\n const root = findWorkspaceRoot(process.cwd());\n if (!root) {\n logErr(\n \"No skaile.yaml found in the current directory or any parent. \" + \"Run `skaile init` first.\",\n );\n process.exit(1);\n }\n return path.join(root, workspaceConfigFilename());\n}\n\nexport function readProjectSources(yamlPath: string): SourceEntry[] {\n if (!existsSync(yamlPath)) return [];\n try {\n return WorkspaceYamlEditor.load(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 (existsSync(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 before the cache key gained its url hash sits at `<last segment>`.\n // Its library row is this source's: point it at the new clone instead of adding a\n // second row for the same source (`add` would warn \"exists in 2 libraries\").\n const legacyKey = legacySourceCacheKey(entry.url);\n const legacyDir = legacyKey ? path.resolve(sourceClonePath(legacyKey)) : undefined;\n const legacyRow =\n existing || !legacyDir\n ? undefined\n : libs.find((l) => path.resolve(l.path) === legacyDir && l.ownership === \"reader\");\n if (legacyRow && legacyDir) {\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 records the publisher `source add --publisher` declared, so the\n // installer rescans the clone with the one the indexer used.\n const cfg = added.backendConfig;\n const recorded = \"url\" in cfg ? cfg.publisher : undefined;\n // The library row is machine-wide: a project whose entry declares no publisher leaves the\n // one another project recorded alone, and scans with it.\n const publisher = entry.publisher ?? recorded;\n const lib =\n entry.publisher === undefined || recorded === entry.publisher\n ? added\n : await manager.updateLibrary(added.id, {\n backendConfig: { ...added.backendConfig, publisher: entry.publisher },\n });\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 = findWorkspaceRoot(projectDir);\n if (!root) return [];\n const sources = readProjectSources(path.join(root, workspaceConfigFilename()));\n const cached = sources.filter((s) => existsSync(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 = findWorkspaceRoot(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 = findWorkspaceRoot(projectDir) ?? 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 (!existsSync(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 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 for (const advisory of result.advisories) logInfo(`${slug}: ${advisory}`);\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 = findWorkspaceRoot(projectDir) ?? 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 existing = (await manager.listLibraries()).find(\n (l) => path.resolve(l.path) === path.resolve(dest),\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\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 .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 },\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 const url = normalizeSourceUrl(source);\n const yamlPath = requireProjectYamlPath();\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 const collision = findCacheKeyCollision(readProjectSources(yamlPath), url);\n 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 if (\n registered?.publisher !== undefined &&\n entry.publisher !== undefined &&\n registered.publisher !== entry.publisher &&\n !opts.force\n ) {\n let declared: string[] = [];\n try {\n declared = (resolveSkWorkspaceConfig(path.dirname(yamlPath)).dependencies ?? []).filter(\n (d) => d.includes(`@${registered.publisher}/`),\n );\n } catch {\n // an unreadable skaile.yaml stops later; the refusal below still holds\n }\n logErr(\n `${url} is registered with publisher \"${registered.publisher}\"; --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 = existsSync(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 = WorkspaceYamlEditor.load(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 for (const advisory of result.advisories) logInfo(advisory);\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 .action(async (opts: { json?: boolean }) => {\n const yamlPath = requireProjectYamlPath();\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 = existsSync(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 .action(async (key: string) => {\n const yamlPath = requireProjectYamlPath();\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: existsSync(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 .action(async (key: string, opts: { purge: boolean }) => {\n const yamlPath = requireProjectYamlPath();\n const editor = WorkspaceYamlEditor.load(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 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\\`).`,\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(\"--all\", \"Sync every source without prompting\", false)\n .action(async (key: string | undefined, opts: { dev?: boolean; all?: boolean }) => {\n const yamlPath = requireProjectYamlPath();\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 (!existsSync(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 for (const advisory of result.advisories) logInfo(`${slug}: ${advisory}`);\n const legacyHint = legacySourceConfigHint(dest);\n if (legacyHint) logWarn(`${slug}: ${legacyHint}`);\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/driver-capabilities.ts","../bridge/src/provider-catalog.ts","../bridge/src/provider-materialize/credential-env.ts","../bridge/src/registry.ts"],"names":[],"mappings":";;;;;AAqBA,IAAM,2BAAA,GAAkD;AAAA,EACtD,mBAAA,EAAqB,KAAA;AAAA,EACrB,eAAA,EAAiB,IAAA;AAAA,EACjB,cAAA,EAAgB,KAAA;AAAA,EAChB,qBAAA,EAAuB,KAAA;AAAA,EACvB,qBAAA,EAAuB;AACzB,CAAA;AAQO,IAAM,2BAAA,GAA8B;AAAA;AAAA,EAEzC,GAAA,EAAK;AAAA,IACH,mBAAA,EAAqB,KAAA;AAAA,IACrB,eAAA,EAAiB,IAAA;AAAA,IACjB,cAAA,EAAgB,KAAA;AAAA,IAChB,qBAAA,EAAuB,KAAA;AAAA,IACvB,qBAAA,E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AA;AAAA;AAAA,QAIpD,GAAI,QAAQ,QAAA,GAAW,EAAE,UAAU,MAAA,CAAO,QAAA,KAAa,EAAC;AAAA,QACxD,GAAI,QAAQ,iBAAA,GAAoB,EAAE,mBAAmB,MAAA,CAAO,iBAAA,KAAsB,EAAC;AAAA,QACnF,GAAI,QAAQ,YAAA,GAAe,EAAE,cAAc,MAAA,CAAO,YAAA,KAAiB;AAAC,OACrE,CAAA;AAAA,IACH;AAAA,EACF;AACA,EAAA,OAAO,CAAC,GAAG,MAAA,CAAO,MAAA,EAAQ,CAAA;AAC5B;AAqBA,eAAsB,mBAAA,CACpB,QAAA,EACA,QAAA,EACA,OAAA,EACuB;AACvB,EAAA,MAAM,MAAA,GAAS,MAAM,mBAAA,CAAoB,QAAQ,CAAA;AACjD,EAAA,OAAQ,MAAM,MAAA,CAAO,UAAA,GAAa,QAAA,EAAU,OAAO,KAAM,EAAC;AAC5D","file":"chunk-GQ5OYFVD.js","sourcesContent":["/**\n * What the runner may ask of a harness, by driver id.\n *\n * Deliberately light: this module imports no driver, no SDK and no `zod`, so a\n * runner file that only needs a capability can import it without loading the\n * driver graph. The plugin-registry singleton is read through its `internal`\n * module (the same file `@skaile/workspaces/plugin-registry` re-exports, so one\n * instance under the bundler's shared chunks), not through the package index,\n * which pulls in the deploy helpers and their `zod` schemas.\n *\n * @docLink packages/bridge/api-reference#registry\n */\n\nimport { pluginRegistry } from \"../../plugin-registry/src/internal.js\";\nimport type { DriverCapabilities } from \"@skaile/workspaces/types\";\n\n/**\n * Capabilities of a harness that declares none: it recomposes its tools per\n * turn like every bridge driver that is not an in-process SDK, and has no\n * managed session, credentials file or transcript-file resume.\n */\nconst GENERIC_DRIVER_CAPABILITIES: DriverCapabilities = {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: false,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n};\n\n/**\n * Declared capabilities of the built-in harnesses that differ from nothing.\n * `BUILTIN_DRIVER_CATALOG` rows point at these entries, so `listDrivers()` and\n * {@link driverCapabilities} read one table. A built-in absent here (echo,\n * gemini, qwen, opencode, goose, continue) takes the generic defaults.\n */\nexport const BUILTIN_DRIVER_CAPABILITIES = {\n // Recomposes its tools per turn, so a hot-plugged MCP server is live.\n omp: {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: false,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n },\n // The SDK takes in-process server instances and bakes its tool set at\n // creation; it reads Claude's `~/.claude` credentials and JSONL transcripts.\n \"claude-sdk\": {\n inProcessMcpServers: true,\n liveToolUpdates: false,\n managedSession: false,\n claudeCodeCredentials: true,\n resumeNeedsTranscript: true,\n },\n // Standalone SDK recomposes its tools per turn. A host-managed session\n // (native app-server) refreshes its own native tool snapshot instead.\n codex: {\n inProcessMcpServers: false,\n liveToolUpdates: true,\n managedSession: true,\n claudeCodeCredentials: false,\n resumeNeedsTranscript: false,\n },\n} as const satisfies Record<string, DriverCapabilities>;\n\n/**\n * Resolve what the runner may ask of a harness, by driver id, without loading\n * its module. Built-ins read {@link BUILTIN_DRIVER_CAPABILITIES}; a third-party\n * driver reads its registered `DriverTarget`; an unknown or absent id gets the\n * generic defaults. Fields a driver omits take the generic default too.\n *\n * This is the one place the runner learns driver facts — it never compares an\n * id against `\"claude-sdk\"`, `\"codex\"` or `\"omp\"`.\n *\n * @param id - Driver id (e.g. a session's `driverType`); `undefined` resolves to the defaults.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function driverCapabilities(id: string | undefined): DriverCapabilities {\n const declared = id\n ? Object.hasOwn(BUILTIN_DRIVER_CAPABILITIES, id)\n ? BUILTIN_DRIVER_CAPABILITIES[id as keyof typeof BUILTIN_DRIVER_CAPABILITIES]\n : pluginRegistry.get(\"driver\", id)?.capabilities\n : undefined;\n return { ...GENERIC_DRIVER_CAPABILITIES, ...declared };\n}\n\n/**\n * Whether a hot-plugged MCP server reaches the agent's next turn without a\n * driver restart. A host-managed session refreshes its native tool snapshot\n * itself, so it never takes live updates, whatever the standalone driver does.\n *\n * @param id - Driver id of the live session.\n * @param managed - Whether the session is host-managed (`managedCodex`).\n * @docLink packages/bridge/api-reference#registry\n */\nexport function supportsLiveToolUpdates(id: string | undefined, managed = false): boolean {\n const caps = driverCapabilities(id);\n return caps.liveToolUpdates && !(managed && caps.managedSession);\n}\n","/**\n * The AI provider catalog — the preset layer of the provider registry (§1.5,\n * layer 5).\n *\n * A preset is the three-or-four literals an endpoint needs beyond a credential:\n * its wire `surface`, its `base_url` (or the transport that derives one), the\n * header the credential rides in, and the path a read-only probe can GET. With\n * them, `skaile providers add --preset groq` needs nothing but an env var name.\n *\n * This replaced `provider-endpoints.ts` `PROVIDER_ENDPOINTS`: every endpoint\n * that table knew is present here, with the surface/transport/credential facts\n * it could not express.\n *\n * The record types come from `@skaile/workspaces/core/provider-registry` — the\n * schema has exactly one home.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1.2, §1.3, §2.5\n */\n\nimport {\n AI_PROVIDER_BASE_URL_TEMPLATES,\n type AIProviderCredentialKind,\n type AIProviderDiscovery,\n type AIProviderEntry,\n type AIProviderKind,\n type AIProviderLlmEntry,\n type AIProviderRegistry,\n type AIProviderRegistryLayer,\n type AIProviderRegistryPatch,\n type AIProviderSurface,\n type AIProviderTransport,\n type AIProviderVoiceParams,\n resolveEntryBaseUrl,\n} from \"@skaile/workspaces/core/provider-registry\";\n\n/**\n * Where the credential goes on the wire. `{credential}` is replaced with the\n * resolved secret. Needed because `credential.kind` alone is ambiguous:\n * `api_key_header` is `x-api-key` for Anthropic, `x-goog-api-key` for Gemini,\n * `api-key` for Azure OpenAI and `Authorization: Token …` for Deepgram.\n */\nexport interface AIProviderAuthHeader {\n name: string;\n template: string;\n}\n\n/** A catalog preset — the fields an entry inherits by naming it. */\nexport interface AIProviderPreset {\n /** Preset id; also the default entry id `skaile providers add` writes. */\n id: string;\n kind: AIProviderKind;\n label: string;\n /** `llm`/`embed` only. */\n surface?: AIProviderSurface;\n /** `llm`/`embed` only; omitted means `direct`. */\n transport?: AIProviderTransport;\n /** Literal endpoint. Absent when the transport derives one from `params`. */\n base_url?: string;\n /**\n * Env var the vendor's own SDK reads as a base-URL override, when one\n * exists. Consulted by the callers that still address an endpoint by preset\n * id — model discovery, key validation, and `skaile migrate providers` — so\n * a shell already pointed at a gateway keeps pointing there.\n */\n base_url_env?: string;\n /** Static non-secret headers, e.g. Anthropic's `anthropic-version`. */\n headers?: Record<string, string>;\n /** Credential shape plus the conventional env var holding the secret. */\n credential: { kind: AIProviderCredentialKind; env?: string };\n /** Header the credential rides in; defaults per surface when omitted. */\n auth_header?: AIProviderAuthHeader;\n /** Default routing/voice parameters. */\n params?: Record<string, string>;\n /** `params` keys the operator must supply — the preset cannot know them. */\n required_params?: string[];\n /**\n * Read-only path a health probe GETs, relative to `base_url`: the models\n * list for LLM surfaces, an equivalent authenticated read for voice.\n * Absent when the endpoint has none (Bedrock's runtime host).\n */\n probe_path?: string;\n discovery?: AIProviderDiscovery;\n /** Anything the operator has to know that the fields do not say. */\n notes?: string;\n}\n\nconst ANTHROPIC_VERSION_HEADER: Record<string, string> = { \"anthropic-version\": \"2023-06-01\" };\n\nconst X_API_KEY: AIProviderAuthHeader = { name: \"x-api-key\", template: \"{credential}\" };\n\nconst OPENAI_MODELS_PATH = \"/v1/models\";\n\n/**\n * Every preset the runtime ships.\n *\n * Insertion order is display order in `skaile providers list`: first-party\n * clouds, then OpenAI-compatible vendors, then the transports that need\n * routing parameters, then local runtimes and gateways, then voice.\n *\n * Sources: `platform/_devlog/reports/2026-09-20-inference-provider-market-survey.md`\n * (36 endpoints, base URLs and auth headers verified there).\n */\nexport const AI_PROVIDER_PRESETS: Record<string, AIProviderPreset> = {\n anthropic: {\n id: \"anthropic\",\n kind: \"llm\",\n label: \"Anthropic\",\n surface: \"anthropic-messages\",\n base_url: \"https://api.anthropic.com\",\n base_url_env: \"ANTHROPIC_BASE_URL\",\n headers: ANTHROPIC_VERSION_HEADER,\n credential: { kind: \"api_key_header\", env: \"ANTHROPIC_API_KEY\" },\n auth_header: X_API_KEY,\n probe_path: \"/v1/models\",\n discovery: { type: \"anthropic-models-list\" },\n },\n openai: {\n id: \"openai\",\n kind: \"llm\",\n label: \"OpenAI\",\n surface: \"openai-responses\",\n base_url: \"https://api.openai.com/v1\",\n base_url_env: \"OPENAI_BASE_URL\",\n credential: { kind: \"bearer\", env: \"OPENAI_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes:\n \"Responses is OpenAI's current API; set surface openai-completions for chat-only clients.\",\n },\n google: {\n id: \"google\",\n kind: \"llm\",\n label: \"Google Gemini API\",\n surface: \"google-generative-ai\",\n base_url: \"https://generativelanguage.googleapis.com/v1beta\",\n credential: { kind: \"api_key_header\", env: \"GEMINI_API_KEY\" },\n auth_header: { name: \"x-goog-api-key\", template: \"{credential}\" },\n probe_path: \"/v1beta/models\",\n discovery: { type: \"google-models-list\" },\n },\n groq: {\n id: \"groq\",\n kind: \"llm\",\n label: \"Groq\",\n surface: \"openai-completions\",\n base_url: \"https://api.groq.com/openai/v1\",\n credential: { kind: \"bearer\", env: \"GROQ_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n deepseek: {\n id: \"deepseek\",\n kind: \"llm\",\n label: \"DeepSeek\",\n surface: \"openai-completions\",\n base_url: \"https://api.deepseek.com\",\n credential: { kind: \"bearer\", env: \"DEEPSEEK_API_KEY\" },\n probe_path: \"/models\",\n discovery: { type: \"openai-models-list\" },\n notes:\n \"Anthropic-shaped clients use https://api.deepseek.com/anthropic with surface anthropic-messages.\",\n },\n openrouter: {\n id: \"openrouter\",\n kind: \"llm\",\n label: \"OpenRouter\",\n surface: \"openai-completions\",\n base_url: \"https://openrouter.ai/api/v1\",\n credential: { kind: \"bearer\", env: \"OPENROUTER_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n mistral: {\n id: \"mistral\",\n kind: \"llm\",\n label: \"Mistral\",\n surface: \"openai-completions\",\n base_url: \"https://api.mistral.ai/v1\",\n credential: { kind: \"bearer\", env: \"MISTRAL_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n xai: {\n id: \"xai\",\n kind: \"llm\",\n label: \"xAI (Grok)\",\n surface: \"openai-completions\",\n base_url: \"https://api.x.ai/v1\",\n credential: { kind: \"bearer\", env: \"XAI_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n together: {\n id: \"together\",\n kind: \"llm\",\n label: \"Together AI\",\n surface: \"openai-completions\",\n base_url: \"https://api.together.ai/v1\",\n credential: { kind: \"bearer\", env: \"TOGETHER_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n fireworks: {\n id: \"fireworks\",\n kind: \"llm\",\n label: \"Fireworks AI\",\n surface: \"openai-completions\",\n base_url: \"https://api.fireworks.ai/inference/v1\",\n credential: { kind: \"bearer\", env: \"FIREWORKS_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n bedrock: {\n id: \"bedrock\",\n kind: \"llm\",\n label: \"AWS Bedrock\",\n surface: \"bedrock-converse-stream\",\n transport: \"bedrock\",\n credential: { kind: \"sigv4\" },\n required_params: [\"region\"],\n notes: \"Credentials come from the AWS default chain; the runtime host serves no models list.\",\n },\n vertex: {\n id: \"vertex\",\n kind: \"llm\",\n label: \"Google Vertex AI\",\n surface: \"google-vertex\",\n transport: \"vertex\",\n credential: { kind: \"google_adc\" },\n params: { publisher: \"google\" },\n required_params: [\"project\", \"location\"],\n probe_path: \"/models\",\n },\n \"azure-openai\": {\n id: \"azure-openai\",\n kind: \"llm\",\n label: \"Azure OpenAI\",\n surface: \"azure-openai-responses\",\n transport: \"azure-openai\",\n credential: { kind: \"api_key_header\", env: \"AZURE_OPENAI_API_KEY\" },\n auth_header: { name: \"api-key\", template: \"{credential}\" },\n required_params: [\"resource\", \"deployment\", \"api_version\"],\n probe_path: \"/models\",\n notes:\n \"api_version is mirrored into query_params['api-version']; switch credential.kind to azure_entra for Entra tokens.\",\n },\n foundry: {\n id: \"foundry\",\n kind: \"llm\",\n label: \"Claude on Microsoft Foundry\",\n surface: \"anthropic-messages\",\n transport: \"foundry\",\n headers: ANTHROPIC_VERSION_HEADER,\n credential: { kind: \"api_key_header\", env: \"ANTHROPIC_FOUNDRY_API_KEY\" },\n auth_header: X_API_KEY,\n required_params: [\"resource\"],\n probe_path: \"/v1/models\",\n },\n ollama: {\n id: \"ollama\",\n kind: \"llm\",\n label: \"Ollama (local)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:11434/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n lmstudio: {\n id: \"lmstudio\",\n kind: \"llm\",\n label: \"LM Studio (local)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:1234/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n },\n vllm: {\n id: \"vllm\",\n kind: \"llm\",\n label: \"vLLM (self-hosted)\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:8000/v1\",\n credential: { kind: \"none\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes: \"A server started with --api-key expects credential.kind bearer and an env: ref.\",\n },\n litellm: {\n id: \"litellm\",\n kind: \"llm\",\n label: \"LiteLLM proxy\",\n surface: \"openai-completions\",\n base_url: \"http://localhost:4000\",\n credential: { kind: \"bearer\", env: \"LITELLM_API_KEY\" },\n probe_path: OPENAI_MODELS_PATH,\n discovery: { type: \"openai-models-list\" },\n notes: \"The credential is the proxy's virtual key; upstream keys stay in the proxy config.\",\n },\n deepgram: {\n id: \"deepgram\",\n kind: \"stt\",\n label: \"Deepgram\",\n base_url: \"https://api.deepgram.com\",\n credential: { kind: \"api_key_header\", env: \"DEEPGRAM_API_KEY\" },\n auth_header: { name: \"Authorization\", template: \"Token {credential}\" },\n params: { model: \"nova-3\", language: \"en\" },\n probe_path: \"/v1/projects\",\n },\n elevenlabs: {\n id: \"elevenlabs\",\n kind: \"tts\",\n label: \"ElevenLabs\",\n base_url: \"https://api.elevenlabs.io\",\n credential: { kind: \"api_key_header\", env: \"ELEVENLABS_API_KEY\" },\n auth_header: { name: \"xi-api-key\", template: \"{credential}\" },\n params: { voice_id: \"21m00Tcm4TlvDq8ikWAM\", output_format: \"mp3_44100_128\" },\n probe_path: \"/v1/models\",\n },\n};\n\n/** Presets in catalog order. */\nexport function listProviderPresets(): AIProviderPreset[] {\n return Object.values(AI_PROVIDER_PRESETS);\n}\n\n/** Look up a preset by id. */\nexport function getProviderPreset(id: string): AIProviderPreset | undefined {\n return AI_PROVIDER_PRESETS[id];\n}\n\n/**\n * The endpoint `skaile providers list` shows for a preset: the literal when\n * there is one, otherwise the transport's `base_url` template (§1.3) with its\n * `{param}` placeholders left in — they are exactly what the operator must\n * supply.\n */\nexport function presetBaseUrl(preset: AIProviderPreset): string | undefined {\n if (preset.base_url) return preset.base_url;\n if (!preset.transport || preset.transport === \"direct\") return undefined;\n return AI_PROVIDER_BASE_URL_TEMPLATES[preset.transport];\n}\n\n/**\n * The endpoint a request to this preset should actually go to: an explicit\n * override first, then the vendor's own `*_BASE_URL` variable\n * ({@link AIProviderPreset.base_url_env}), then the preset literal.\n *\n * Behind a gateway the credential in play is the *gateway's*, not the\n * vendor's, so discovery and key validation have to follow dispatch — firing\n * either at the vendor's public API 401s and yields an empty catalog, which a\n * caller that reads \"empty\" as \"unknown\" then degrades into \"accept anything\".\n *\n * Pure: reads only the `env` record it is handed.\n */\nexport function resolvePresetBaseUrl(\n preset: AIProviderPreset,\n options: { baseUrl?: string; env?: Record<string, string | undefined> } = {},\n): string | undefined {\n const explicit = options.baseUrl?.trim();\n if (explicit) return explicit;\n const fromEnv = preset.base_url_env ? options.env?.[preset.base_url_env]?.trim() : undefined;\n return fromEnv || preset.base_url;\n}\n\n/** Overrides {@link expandPreset} accepts from `skaile providers add`. */\nexport interface ExpandPresetOptions {\n /** `env:NAME` / `cmd:…` / `platform:…` / `keyring:…`. Never a literal. */\n credentialRef?: string;\n baseUrl?: string;\n surface?: AIProviderSurface;\n label?: string;\n /** Transport routing parameters, or voice parameters for `stt`/`tts`. */\n params?: Record<string, string>;\n}\n\n/**\n * Materialize a preset into a registry entry.\n *\n * The credential is always a reference: the preset's conventional `env:` var\n * unless the caller names another ref. No code path here can write a secret.\n * For `transport: azure-openai` the `api_version` parameter is mirrored into\n * `query_params['api-version']`, which is where the wire expects it (§1.3).\n */\nexport function expandPreset(\n preset: AIProviderPreset,\n options: ExpandPresetOptions = {},\n): AIProviderEntry {\n const ref =\n options.credentialRef ?? (preset.credential.env ? `env:${preset.credential.env}` : undefined);\n const credential = ref ? { kind: preset.credential.kind, ref } : { kind: preset.credential.kind };\n const base_url = options.baseUrl ?? preset.base_url;\n const params = { ...preset.params, ...options.params };\n\n if (preset.kind === \"stt\" || preset.kind === \"tts\") {\n return {\n kind: preset.kind,\n label: options.label ?? preset.label,\n preset: preset.id,\n ...(base_url ? { base_url } : {}),\n ...(preset.headers ? { headers: { ...preset.headers } } : {}),\n credential,\n ...(Object.keys(params).length > 0 ? { params: params as AIProviderVoiceParams } : {}),\n };\n }\n\n const transport = preset.transport ?? \"direct\";\n const entry: AIProviderLlmEntry = {\n kind: preset.kind === \"embed\" ? \"embed\" : \"llm\",\n label: options.label ?? preset.label,\n preset: preset.id,\n ...((options.surface ?? preset.surface) ? { surface: options.surface ?? preset.surface } : {}),\n ...(base_url ? { base_url } : {}),\n ...(preset.headers ? { headers: { ...preset.headers } } : {}),\n credential,\n ...(preset.discovery ? { discovery: { ...preset.discovery } } : {}),\n } as AIProviderLlmEntry;\n\n if (transport !== \"direct\") {\n Object.assign(entry, { transport, params });\n if (transport === \"azure-openai\" && params.api_version) {\n entry.query_params = { \"api-version\": params.api_version };\n }\n }\n return entry;\n}\n\n/**\n * Build the catalog merge layer for a set of configured entries (§1.5).\n *\n * Only the presets actually referenced by a `preset:` key are expanded, keyed\n * by the *entry* id — so `groq: {kind: llm, preset: groq}` deep-merges onto a\n * full Groq definition while an unreferenced preset stays out of the registry.\n *\n * Takes the **pre-gate** merge (`LoadedProviderRegistry.patches`), not the\n * gated registry: an entry that leaves `kind` or its transport `params` to the\n * preset is exactly the one the gate drops before this layer exists, and a\n * dropped entry names no preset to expand.\n */\nexport function catalogLayer(providers: AIProviderRegistryPatch): AIProviderRegistryLayer {\n const expanded: AIProviderRegistry = {};\n for (const [id, entry] of Object.entries(providers)) {\n if (!entry.preset) continue;\n const preset = AI_PROVIDER_PRESETS[entry.preset];\n if (!preset) continue;\n expanded[id] = expandPreset(preset);\n }\n return { layer: \"catalog\", providers: expanded };\n}\n\n/**\n * Join a base URL and a path without duplicating a shared leading segment:\n * `(\"https://gw/v1\", \"/v1/models\")` → `https://gw/v1/models`. Both spellings\n * are common in the wild, and a preset's path must work against a gateway base\n * the operator typed either way.\n */\nfunction joinBaseAndPath(base: string, path: string): string {\n const trimmed = base.replace(/\\/+$/, \"\");\n const segments = path.split(\"/\").filter(Boolean);\n const lead = segments[0];\n if (lead && trimmed.toLowerCase().endsWith(`/${lead.toLowerCase()}`)) {\n return `${trimmed}/${segments.slice(1).join(\"/\")}`;\n }\n return `${trimmed}${path}`;\n}\n\n/**\n * The read-only URL a health probe or model discovery can GET for an entry —\n * the models list on LLM surfaces, the equivalent authenticated read on voice\n * ones. `undefined` when the entry has no endpoint yet (missing transport\n * parameters) or the surface serves no such path (Bedrock runtime).\n *\n * This is the catalog method that supersedes `resolveProviderModelsUrl`.\n */\nexport function resolveProbeUrl(entry: AIProviderEntry): string | undefined {\n const base = resolveEntryBaseUrl(entry);\n if (!base) return undefined;\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n const path = (entry as AIProviderLlmEntry).discovery?.path ?? preset?.probe_path;\n if (!path) return undefined;\n const url = joinBaseAndPath(base, path);\n const query = (entry as AIProviderLlmEntry).query_params;\n if (!query || Object.keys(query).length === 0) return url;\n const search = new URLSearchParams(query).toString();\n return `${url}${url.includes(\"?\") ? \"&\" : \"?\"}${search}`;\n}\n\n/**\n * The header(s) that present a credential on the wire for an entry.\n *\n * `credential.kind` alone does not determine the header — `api_key_header` is\n * `x-api-key` at Anthropic, `x-goog-api-key` at Google and `api-key` at Azure —\n * so the preset's `auth_header` wins, then a per-surface default.\n * Returns `{}` when the credential is signed elsewhere (`sigv4`, `google_adc`)\n * or absent.\n */\nexport function buildCredentialHeaders(\n entry: AIProviderEntry,\n secret: string | undefined,\n): Record<string, string> {\n const kind = entry.credential?.kind ?? \"none\";\n if (!secret || kind === \"none\" || kind === \"sigv4\" || kind === \"google_adc\") return {};\n\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n if (preset?.auth_header) {\n return {\n [preset.auth_header.name]: preset.auth_header.template.replace(\"{credential}\", secret),\n };\n }\n if (kind === \"api_key_header\") {\n const surface = (entry as AIProviderLlmEntry).surface;\n if (surface === \"google-generative-ai\") return { \"x-goog-api-key\": secret };\n if (surface === \"azure-openai-responses\") return { \"api-key\": secret };\n return { \"x-api-key\": secret };\n }\n return { Authorization: `Bearer ${secret}` };\n}\n\n/** Outcome of {@link probeProviderEntry}. Never carries the credential. */\nexport interface AIProviderProbeResult {\n /** The endpoint answered 2xx. */\n ok: boolean;\n /** `false` when no request was made — nothing was verified either way. */\n probed: boolean;\n url?: string;\n status?: number;\n /** Human-readable outcome. Secret-free. */\n detail: string;\n}\n\n/** Options for {@link probeProviderEntry}. */\nexport interface ProbeProviderOptions {\n /** Resolved credential value, if the entry has one. Never logged. */\n secret?: string;\n /** Request deadline; default 8000 ms, matching `validateApiKey`. */\n timeoutMs?: number;\n}\n\n/**\n * Send one minimal, read-only request to an entry's endpoint and report what\n * came back.\n *\n * Returns `probed: false` — rather than a false negative — when the entry has\n * no probe path (Bedrock's runtime host) or no resolvable endpoint yet: a\n * SigV4- or ADC-signed request is the transport SDK's job, not this function's.\n */\nexport async function probeProviderEntry(\n entry: AIProviderEntry,\n options: ProbeProviderOptions = {},\n): Promise<AIProviderProbeResult> {\n const url = resolveProbeUrl(entry);\n if (!url) {\n const base = resolveEntryBaseUrl(entry);\n return {\n ok: false,\n probed: false,\n detail: base\n ? `no read-only probe endpoint is defined for this entry (${base})`\n : \"no base_url could be resolved — set base_url or the transport's params\",\n };\n }\n\n const headers: Record<string, string> = {\n ...entry.headers,\n ...buildCredentialHeaders(entry, options.secret),\n };\n\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 8000);\n try {\n const response = await fetch(url, { method: \"GET\", headers, signal: controller.signal });\n if (response.ok) {\n return { ok: true, probed: true, url, status: response.status, detail: \"endpoint reachable\" };\n }\n const detail =\n response.status === 401 || response.status === 403\n ? \"credential rejected (authentication failed)\"\n : `endpoint returned HTTP ${response.status}`;\n return { ok: false, probed: true, url, status: response.status, detail };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n const detail =\n err instanceof Error && err.name === \"AbortError\"\n ? `request timed out after ${options.timeoutMs ?? 8000}ms`\n : message;\n return { ok: false, probed: true, url, detail };\n } finally {\n clearTimeout(timeout);\n }\n}\n","/**\n * Credential delivery for driver adapters — the one naming rule (§2.3).\n *\n * Every adapter that hands a registry entry's secret to a child process, and\n * every renderer that has to *name* that secret in a config file it writes\n * (omp's `models.yml` `apiKey:`, Codex's `env_key`, OpenCode's `{env:…}`),\n * agrees on one env-var name per entry: `SKAILE_AIP_<UPPER_ID>_KEY`. The name\n * goes in the file, the value goes in the child environment — a rendered\n * config never contains a secret.\n *\n * The platform's secret-env allowlist is a prefix rule on exactly that name,\n * and forge-common delivers the same names when it spawns `skaile serve`, so\n * the transform below is a cross-repo contract: uppercase, every character\n * outside `[A-Za-z0-9]` mapped to `_` (registry ids are `[a-z0-9][a-z0-9_-]*`,\n * so in practice only `-`).\n *\n * Alongside the canonical name, {@link registryCredentialEnv} also sets the\n * *conventional* carrier a CLI already reads (`ANTHROPIC_API_KEY`,\n * `GEMINI_API_KEY`, `GROQ_API_KEY`, …) so a catalog-preset entry works in a\n * harness that has no per-endpoint config file yet.\n *\n * @see PROVIDER-CONFIG-PLAN.md §1.4, §2.3\n */\n\nimport {\n type AIProviderEntry,\n type AIProviderRegistry,\n isEntryEnabled,\n type MergedAIProviderRegistry,\n parseCredentialRef,\n registryEntries,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport { resolveCredential } from \"@skaile/workspaces/core/provider-registry-credentials\";\nimport { AI_PROVIDER_PRESETS } from \"../provider-catalog.js\";\n\n/** Options shared by every registry-shaped credential resolution. */\nexport interface RegistryCredentialOptions {\n /** Restrict resolution to one entry — the provider half of a `modelRef`. */\n providerId?: string;\n /** Environment `env:` refs resolve against. Defaults to `process.env`. */\n env?: Record<string, string | undefined>;\n /** Control-plane secrets keyed by config id, for `platform:` refs. */\n secrets?: Record<string, string>;\n /** Run `cmd:` references. Default `true`. */\n allowCommand?: boolean;\n}\n\n/** Prefix of the canonical per-entry credential variable. */\nexport const PROVIDER_CREDENTIAL_ENV_PREFIX = \"SKAILE_AIP_\";\n\n/** Suffix of the canonical per-entry credential variable. */\nexport const PROVIDER_CREDENTIAL_ENV_SUFFIX = \"_KEY\";\n\n/**\n * The env-var name that carries a registry entry's credential:\n * `anthropic` → `SKAILE_AIP_ANTHROPIC_KEY`, `my-gw.eu` → `SKAILE_AIP_MY_GW_EU_KEY`.\n *\n * Pure: no environment, no registry, no I/O. Renderers call it per entry while\n * emitting a config file, adapters call it while assembling a child env, and\n * the platform allowlist matches the prefix.\n */\nexport function providerCredentialEnvName(providerId: string): string {\n const slug = providerId.replace(/[^A-Za-z0-9]/g, \"_\").toUpperCase();\n return `${PROVIDER_CREDENTIAL_ENV_PREFIX}${slug}${PROVIDER_CREDENTIAL_ENV_SUFFIX}`;\n}\n\n/**\n * The env var a harness already looks for on its own, when the entry names one.\n *\n * The catalog preset's conventional carrier wins (`GEMINI_API_KEY` for\n * `google`), because that is the name the vendor's own CLI reads; otherwise an\n * `env:NAME` credential reference is taken at face value — the operator named\n * that variable, so the child gets it under the same name. `cmd:`, `platform:`\n * and `keyring:` refs have no conventional carrier and return `undefined`.\n */\nexport function conventionalCredentialEnvName(entry: AIProviderEntry): string | undefined {\n const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : undefined;\n if (preset?.credential.env) return preset.credential.env;\n const ref = entry.credential?.ref ? parseCredentialRef(entry.credential.ref) : undefined;\n return ref?.form === \"env\" ? ref.name : undefined;\n}\n\n/**\n * Resolve one entry's credential to its value, or `undefined` when there is\n * none to hand over (`kind: none`, an ambient `sigv4`/`google_adc` chain, an\n * unset variable, a reserved `keyring:` ref).\n */\nexport function resolveEntryCredential(\n entry: AIProviderEntry,\n options: RegistryCredentialOptions = {},\n): string | undefined {\n return resolveCredential(entry, {\n ...(options.env ? { env: options.env } : {}),\n ...(options.secrets ? { secrets: options.secrets } : {}),\n ...(options.allowCommand === undefined ? {} : { allowCommand: options.allowCommand }),\n }).value;\n}\n\n/**\n * One entry's credential value, including the one the session boundary\n * already resolved for it.\n *\n * A `platform:<configId>` reference is resolved by the runner — it holds the\n * `session_init` secrets map, the driver does not — and materialized into the\n * child environment under {@link providerCredentialEnvName}. So when the\n * reference itself yields nothing, that carrier is consulted: it is the same\n * secret, delivered one step earlier.\n */\nexport function entryCredentialValue(\n providerId: string,\n entry: AIProviderEntry,\n options: RegistryCredentialOptions = {},\n): string | undefined {\n return (\n resolveEntryCredential(entry, options) ?? options.env?.[providerCredentialEnvName(providerId)]\n );\n}\n\n/** One enabled entry whose credential is declared but cannot be resolved. */\nexport interface UnresolvedProviderCredential {\n providerId: string;\n /** Why it does not resolve, e.g. `environment variable ANTHROPIC_API_KEY is not set`. */\n reason: string;\n}\n\n/**\n * The enabled LLM/embed entries that name a credential this process cannot\n * resolve (the variable is unset, the command fails). A driver must not be\n * handed such an entry: the child would send an empty key and fail with a 401\n * instead of using its own login. Entries with no credential, an ambient\n * signing chain, or a value the session boundary already delivered under\n * {@link providerCredentialEnvName} are fine.\n */\nexport function unresolvedProviderCredentials(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options: RegistryCredentialOptions = {},\n): UnresolvedProviderCredential[] {\n const out: UnresolvedProviderCredential[] = [];\n for (const [id, entry] of registryEntries(registry)) {\n if (entry.kind !== \"llm\" && entry.kind !== \"embed\") continue;\n if (!isEntryEnabled(entry)) continue;\n if (options.providerId && id !== options.providerId) continue;\n const resolved = resolveCredential(entry, {\n ...(options.env ? { env: options.env } : {}),\n ...(options.secrets ? { secrets: options.secrets } : {}),\n ...(options.allowCommand === undefined ? {} : { allowCommand: options.allowCommand }),\n });\n if (!resolved.error) continue;\n if (options.env?.[providerCredentialEnvName(id)]) continue;\n out.push({ providerId: id, reason: resolved.error });\n }\n return out;\n}\n\n/** Options for {@link entryCredentialEnv} / {@link registryCredentialEnv}. */\nexport interface RegistryCredentialEnvOptions extends RegistryCredentialOptions {\n /**\n * Also set the harness-conventional carrier\n * ({@link conventionalCredentialEnvName}). Default `true`. Set `false` for a\n * harness that reads every endpoint out of a rendered config file and must\n * not inherit a vendor default from a neighbouring entry.\n */\n aliases?: boolean;\n}\n\n/**\n * The credential variables one entry contributes: always\n * `SKAILE_AIP_<ID>_KEY`, plus the conventional carrier unless `aliases` is\n * `false`. Empty when the entry has no resolvable secret.\n */\nexport function entryCredentialEnv(\n providerId: string,\n entry: AIProviderEntry,\n options: RegistryCredentialEnvOptions = {},\n): Record<string, string> {\n const value = resolveEntryCredential(entry, options);\n if (!value) return {};\n const out: Record<string, string> = { [providerCredentialEnvName(providerId)]: value };\n if (options.aliases !== false) {\n const alias = conventionalCredentialEnvName(entry);\n if (alias) out[alias] = value;\n }\n return out;\n}\n\n/**\n * Every enabled entry's credential, as a child-process environment fragment.\n *\n * One canonical `SKAILE_AIP_<ID>_KEY` per entry whose credential resolves; the\n * conventional carriers are added underneath, first entry in registry order\n * winning a collision (registry order is highest-precedence layer first, so\n * the alias follows the same precedence the selector does). Entries whose\n * credential cannot be resolved contribute nothing.\n */\nexport function registryCredentialEnv(\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options: RegistryCredentialEnvOptions = {},\n): Record<string, string> {\n const canonical: Record<string, string> = {};\n const aliases: Record<string, string> = {};\n for (const [id, entry] of registryEntries(registry)) {\n if (options.providerId && id !== options.providerId) continue;\n if (!isEntryEnabled(entry)) continue;\n const value = resolveEntryCredential(entry, options);\n if (!value) continue;\n canonical[providerCredentialEnvName(id)] = value;\n if (options.aliases === false) continue;\n const alias = conventionalCredentialEnvName(entry);\n if (alias && aliases[alias] === undefined) aliases[alias] = value;\n }\n return { ...aliases, ...canonical };\n}\n","import type {\n AIProviderRegistry,\n AIProviderSurface,\n MergedAIProviderRegistry,\n} from \"@skaile/workspaces/core/provider-registry\";\nimport type { DriverContext } from \"@skaile/workspaces/plugin-registry\";\nimport { type PluginRegistry, pluginRegistry } from \"@skaile/workspaces/plugin-registry\";\nimport type { ModelEntry } from \"./models.js\";\nimport type { RegistryCredentialOptions } from \"./provider-materialize/credential-env.js\";\nimport { BUILTIN_DRIVER_CAPABILITIES } from \"./driver-capabilities.js\";\nimport type { AgentConfig, AgentDriver, DriverInfo } from \"./types.js\";\n\n// Build-time harness gating. `bun build --compile --define:__INCLUDE_*__=...`\n// folds these to literal booleans so an excluded harness's driver module and\n// its SDK are dead-code-stripped from the binary. Under tsup / vitest / bun\n// run-on-source no `--define` runs and the `typeof` guard defaults to `true` —\n// every harness is available (the SDKs stay optional peers).\ndeclare const __INCLUDE_CLAUDE_SDK__: boolean;\ndeclare const __INCLUDE_CODEX__: boolean;\nconst INCLUDE_CLAUDE_SDK =\n typeof __INCLUDE_CLAUDE_SDK__ === \"undefined\" ? true : __INCLUDE_CLAUDE_SDK__;\nconst INCLUDE_CODEX = typeof __INCLUDE_CODEX__ === \"undefined\" ? true : __INCLUDE_CODEX__;\n\n/**\n * Every wire surface omp can speak — it is the harness the `surface` enum was\n * lifted from, so its list is the enum.\n */\nconst OMP_SURFACES = [\n \"anthropic-messages\",\n \"openai-completions\",\n \"openai-responses\",\n \"openai-codex-responses\",\n \"azure-openai-responses\",\n \"bedrock-converse-stream\",\n \"google-generative-ai\",\n \"google-vertex\",\n] as const satisfies readonly AIProviderSurface[];\n\n/**\n * Static capability metadata for every built-in harness.\n *\n * Pure data — this object imports no driver module and references no harness\n * SDK. {@link listDrivers} returns it (merged with any third-party drivers)\n * so selection UIs can enumerate every harness without loading a single\n * driver module. The matching driver module's `DriverTarget` is registered\n * into the plugin registry by {@link registerBuiltinDrivers}.\n *\n * `surfaces` and `providerPlurality` are the driver-capability declaration\n * the AI provider registry resolves against (plan §2.3): which wire protocols\n * a harness can be pointed at, and how many registry entries it can use at\n * once. The platform's resolver filters candidate entries on `surfaces`\n * instead of matching vendor names.\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport const BUILTIN_DRIVER_CATALOG: Record<string, DriverInfo> = {\n omp: {\n id: \"omp\",\n name: \"omp (oh-my-pi)\",\n modelAgnostic: true,\n supportsInBandAbort: true,\n surfaces: OMP_SURFACES,\n // omp renders the whole registry as its own `models.yml`, so every entry\n // stays selectable and roles / per-subagent models resolve across them.\n providerPlurality: \"registry\",\n capabilities: BUILTIN_DRIVER_CAPABILITIES.omp,\n },\n \"claude-sdk\": {\n id: \"claude-sdk\",\n name: \"Claude Agent SDK\",\n modelAgnostic: false,\n supportsInBandAbort: true,\n // Anthropic's own API, plus the two clouds the SDK addresses natively.\n // Foundry is `anthropic-messages` at a different host, not a surface.\n surfaces: [\"anthropic-messages\", \"bedrock-converse-stream\", \"google-vertex\"],\n providerPlurality: \"single\",\n capabilities: BUILTIN_DRIVER_CAPABILITIES[\"claude-sdk\"],\n },\n codex: {\n id: \"codex\",\n name: \"OpenAI Codex\",\n modelAgnostic: false,\n supportsInBandAbort: true,\n // Codex's `wire_api` is `responses` or `chat`; its subscription transport\n // is the codex-specific responses flavour.\n surfaces: [\"openai-codex-responses\", \"openai-responses\", \"openai-completions\"],\n providerPlurality: \"single\",\n capabilities: BUILTIN_DRIVER_CAPABILITIES.codex,\n },\n echo: {\n id: \"echo\",\n name: \"Echo (E2E mock)\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n // Deterministic mock: it never opens a connection, so it speaks no wire\n // surface and no registry entry can be dispatched to it.\n surfaces: [],\n providerPlurality: \"single\",\n },\n gemini: {\n id: \"gemini\",\n name: \"Gemini CLI\",\n modelAgnostic: false,\n supportsInBandAbort: false,\n surfaces: [\"google-generative-ai\"],\n providerPlurality: \"single\",\n },\n qwen: {\n id: \"qwen\",\n name: \"Qwen Code\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n // Driven entirely through OPENAI_BASE_URL / OPENAI_API_KEY.\n surfaces: [\"openai-completions\"],\n providerPlurality: \"single\",\n },\n opencode: {\n id: \"opencode\",\n name: \"OpenCode\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\n \"anthropic-messages\",\n \"openai-completions\",\n \"openai-responses\",\n \"google-generative-ai\",\n ],\n providerPlurality: \"credentials-n\",\n },\n goose: {\n id: \"goose\",\n name: \"Goose\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\n \"anthropic-messages\",\n \"openai-completions\",\n \"google-generative-ai\",\n \"bedrock-converse-stream\",\n ],\n providerPlurality: \"credentials-n\",\n },\n continue: {\n id: \"continue\",\n name: \"Continue CLI\",\n modelAgnostic: true,\n supportsInBandAbort: false,\n surfaces: [\"anthropic-messages\", \"openai-completions\", \"google-generative-ai\"],\n providerPlurality: \"credentials-n\",\n },\n};\n\n/**\n * Back-compat alias for {@link BUILTIN_DRIVER_CATALOG}. Consumers and tests that\n * predate the plugin-registry refactor still import `DRIVER_CATALOG`.\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport const DRIVER_CATALOG = BUILTIN_DRIVER_CATALOG;\n\nlet _driversRegistered = false;\n\n/**\n * Register every built-in driver's `DriverTarget` into the plugin registry.\n *\n * This is the single id → module map in bridge core. Every specifier is a\n * literal string so `bun --compile` can statically bundle the driver module\n * (and, transitively, its SDK). The in-process-SDK harnesses (`claude-sdk`,\n * `codex`) are wrapped in build-constant guards so an excluded harness's\n * `await import` folds to dead code in the compiled binary. `omp` and `echo`\n * carry no SDK weight and are always available.\n *\n * **Static import discipline.** Every `import()` specifier below must be a\n * string literal — never aliased through a variable. Indirection defeats\n * `bun --compile`'s static analysis and silently drops the module from the\n * binary.\n *\n * Idempotent: guarded by a module flag so a second call is a no-op (a duplicate\n * `register` would otherwise throw `RegistrationError`).\n *\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function registerBuiltinDrivers(\n registry: PluginRegistry = pluginRegistry,\n): Promise<void> {\n if (registry === pluginRegistry && _driversRegistered) return;\n\n if (!registry.get(\"driver\", \"omp\")) {\n const m = await import(\"@skaile/workspaces/drivers/omp\");\n registry.register(\"driver\", m.ompDriverTarget);\n }\n if (!registry.get(\"driver\", \"echo\")) {\n const m = await import(\"@skaile/workspaces/drivers/echo\");\n registry.register(\"driver\", m.echoDriverTarget);\n }\n if (INCLUDE_CLAUDE_SDK && !registry.get(\"driver\", \"claude-sdk\")) {\n const m = await import(\"@skaile/workspaces/drivers/claude-sdk\");\n registry.register(\"driver\", m.claudeSdkDriverTarget);\n }\n if (INCLUDE_CODEX && !registry.get(\"driver\", \"codex\")) {\n const m = await import(\"@skaile/workspaces/drivers/codex\");\n registry.register(\"driver\", m.codexDriverTarget);\n }\n // Subprocess CLI harnesses spawn an external binary the user installs\n // separately — no bundled SDK to dead-code-strip, so (like omp/echo) they\n // carry no build constant and are always registered.\n if (!registry.get(\"driver\", \"gemini\")) {\n const m = await import(\"@skaile/workspaces/drivers/gemini\");\n registry.register(\"driver\", m.geminiDriverTarget);\n }\n if (!registry.get(\"driver\", \"qwen\")) {\n const m = await import(\"@skaile/workspaces/drivers/qwen\");\n registry.register(\"driver\", m.qwenDriverTarget);\n }\n if (!registry.get(\"driver\", \"opencode\")) {\n const m = await import(\"@skaile/workspaces/drivers/opencode\");\n registry.register(\"driver\", m.opencodeDriverTarget);\n }\n if (!registry.get(\"driver\", \"goose\")) {\n const m = await import(\"@skaile/workspaces/drivers/goose\");\n registry.register(\"driver\", m.gooseDriverTarget);\n }\n if (!registry.get(\"driver\", \"continue\")) {\n const m = await import(\"@skaile/workspaces/drivers/continue\");\n registry.register(\"driver\", m.continueDriverTarget);\n }\n\n if (registry === pluginRegistry) _driversRegistered = true;\n}\n\n/**\n * Creates a new driver instance for the given harness id.\n *\n * Ensures the built-in driver targets are registered (idempotent), then looks\n * up the target in the plugin registry and calls its `create()`. The returned\n * driver has not been started yet — call `driver.start()` before sending\n * prompts.\n *\n * @param id - Registered driver identifier (e.g. `\"omp\"`, `\"claude-sdk\"`).\n * @param config - Configuration forwarded to the driver constructor.\n * @param ctx - Optional driver context (logger / abort signal). Defaults to `{}`.\n * @returns A freshly constructed (not yet started) {@link AgentDriver}.\n * @throws {Error} When `id` is a known harness excluded from this build, or\n * when `id` does not match any registered driver at all.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function createDriver(\n id: string,\n config: AgentConfig,\n ctx?: DriverContext,\n): Promise<AgentDriver> {\n const target = await resolveDriverTarget(id);\n return target.create(config, ctx ?? {});\n}\n\n/**\n * Resolve a registered driver target by id, ensuring the built-ins are\n * registered first. Throws the canonical \"not bundled\" / \"unknown driver\"\n * errors so every caller (`createDriver`, `listModelsForDriver`) reports an\n * unrecognized id the same way instead of silently degrading.\n *\n * @throws {Error} When `id` is a known harness excluded from this build, or\n * when `id` does not match any registered driver at all.\n */\nasync function resolveDriverTarget(id: string) {\n await registerBuiltinDrivers();\n const target = pluginRegistry.get(\"driver\", id);\n if (!target) {\n if (id in BUILTIN_DRIVER_CATALOG) {\n throw new Error(`Agent driver \"${id}\" is not bundled in this build.`);\n }\n throw new Error(\n `Unknown agent driver: \"${id}\". Available: ${listDrivers()\n .map((d) => d.id)\n .join(\", \")}`,\n );\n }\n return target;\n}\n\n/**\n * Returns the capability metadata for every available driver.\n *\n * Enumerates every built-in harness from {@link BUILTIN_DRIVER_CATALOG} without\n * loading a single driver module or harness SDK, then merges in any third-party\n * driver targets registered into the plugin registry that are not already in\n * the catalog. Use this to populate driver selection UIs.\n *\n * @returns Array of {@link DriverInfo} objects, one per available driver.\n * @docLink packages/bridge/api-reference#registry\n */\nexport function listDrivers(): DriverInfo[] {\n const merged = new Map<string, DriverInfo>();\n for (const info of Object.values(BUILTIN_DRIVER_CATALOG)) {\n merged.set(info.id, info);\n }\n for (const meta of pluginRegistry.list(\"driver\")) {\n if (!merged.has(meta.id)) {\n // Third-party drivers carry no DriverInfo row; read the capability flags\n // off the registered target (defaulting to conservative false) so a\n // model-agnostic / in-band-abort harness can still advertise them.\n const target = pluginRegistry.get(\"driver\", meta.id);\n merged.set(meta.id, {\n id: meta.id,\n name: meta.displayName,\n modelAgnostic: target?.modelAgnostic ?? false,\n supportsInBandAbort: target?.supportsInBandAbort ?? false,\n // Left absent when the target declares nothing: \"speaks no surface\" and\n // \"did not say\" are different claims, and the platform resolver must be\n // able to tell them apart before it filters a driver out.\n ...(target?.surfaces ? { surfaces: target.surfaces } : {}),\n ...(target?.providerPlurality ? { providerPlurality: target.providerPlurality } : {}),\n ...(target?.capabilities ? { capabilities: target.capabilities } : {}),\n });\n }\n }\n return [...merged.values()];\n}\n\n/**\n * List models available to a specific driver without starting a full agent session.\n *\n * Ensures the built-in driver targets are registered (idempotent), then\n * delegates to the target's optional `listModels()`. Throws on an unknown /\n * not-bundled id (same contract as {@link createDriver}); returns `[]` only\n * when the target exists but exposes no `listModels`.\n *\n * @param driverId - Registered driver id (e.g. `\"omp\"`, `\"claude-sdk\"`, `\"codex\"`).\n * @param registry - The AI provider registry to discover against — either the\n * bare `id → entry` map or a merged view. Each entry names its credential by\n * reference, resolved through `options` and delivered to the throwaway\n * driver as `SKAILE_AIP_<ID>_KEY` environment entries.\n * @param options - Which entry to restrict to, and where `env:` / `platform:`\n * references resolve from. Defaults to the whole registry against\n * `process.env`.\n * @throws {Error} When `driverId` is unknown or excluded from this build.\n * @docLink packages/bridge/api-reference#registry\n */\nexport async function listModelsForDriver(\n driverId: string,\n registry: AIProviderRegistry | MergedAIProviderRegistry,\n options?: RegistryCredentialOptions,\n): Promise<ModelEntry[]> {\n const target = await resolveDriverTarget(driverId);\n return (await target.listModels?.(registry, options)) ?? [];\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/helpers.ts"],"names":[],"mappings":";;;;;;AAWO,IAAM,CAAA,GAAI;AAAA,EACf,KAAA,EAAO,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,EAAA,CAAG,IAAA,CAAK,CAAC,CAAC,CAAA;AAAA,EACxC,GAAA,EAAK,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EAC7B,OAAA,EAAS,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EACjC,IAAA,EAAM,CAAC,CAAA,KAAc,EAAA,CAAG,KAAK,CAAC,CAAA;AAAA,EAC9B,GAAA,EAAK,CAAC,CAAA,KAAc,EAAA,CAAG,IAAI,CAAC,CAAA;AAAA,EAC5B,EAAA,EAAI,CAAC,CAAA,KAAc,EAAA,CAAG,MAAM,CAAC,CAAA;AAAA,EAC7B,IAAA,EAAM,CAAC,CAAA,KAAc,EAAA,CAAG,OAAO,CAAC,CAAA;AAAA,EAChC,GAAA,EAAK,CAAC,CAAA,KAAc,EAAA,CAAG,IAAI,CAAC,CAAA;AAAA,EAC5B,KAAA,EAAO,CAAC,CAAA,KAAc,EAAA,CAAG,IAAI,CAAC,CAAA;AAAA,EAC9B,IAAA,EAAM,CAAC,CAAA,GAAI,EAAA,KAAO,GAAG,GAAA,CAAI,QAAA,CAAI,MAAA,CA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AACpF;AAOO,SAAS,0BAAA,CAA2B,MAAc,OAAA,EAA2B;AAClF,EAAA,IAAI,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG,OAAO,EAAA;AACjC,EAAA,OAAO,CAAA,CAAE,IAAI,CAAA,SAAA,EAAY,IAAI,iBAAiB,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,WAAA,CAAa,CAAA;AAC/E;AAGO,SAAS,mBAAmB,IAAA,EAAoB;AACrD,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,GAAA,EAAI,GAAI,KAAK,OAAA,EAAQ;AACvC,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,IAAA,GAAO,GAAI,CAAA;AACtC,EAAA,IAAI,OAAA,GAAU,IAAI,OAAO,UAAA;AACzB,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,OAAA,GAAU,EAAE,CAAA;AACvC,EAAA,IAAI,OAAA,GAAU,EAAA,EAAI,OAAO,CAAA,EAAG,OAAO,CAAA,KAAA,CAAA;AACnC,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,OAAA,GAAU,EAAE,CAAA;AACrC,EAAA,IAAI,KAAA,GAAQ,EAAA,EAAI,OAAO,CAAA,EAAG,KAAK,CAAA,KAAA,CAAA;AAC/B,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,EAAE,CAAA;AAClC,EAAA,OAAO,GAAG,IAAI,CAAA,KAAA,CAAA;AAChB","file":"chunk-GV3MFKDV.js","sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { softDepName } from \"@skaile/workspaces/asset-manager\";\nimport { resolveSkWorkspaceConfig, SKAILE_YAML_DEFAULT } from \"@skaile/workspaces/core\";\nimport pc from \"picocolors\";\n\n/**\n * Terminal styling helpers used across all CLI commands.\n *\n * @docLink cli/dev-guide#helpers\n */\nexport const S = {\n brand: (s: string) => pc.cyan(pc.bold(s)),\n cmd: (s: string) => pc.cyan(s),\n heading: (s: string) => pc.bold(s),\n bold: (s: string) => pc.bold(s),\n dim: (s: string) => pc.dim(s),\n ok: (s: string) => pc.green(s),\n warn: (s: string) => pc.yellow(s),\n err: (s: string) => pc.red(s),\n label: (s: string) => pc.dim(s),\n rule: (w = 40) => pc.dim(\"─\".repeat(w)),\n};\n\nconst KIND_COLORS: Record<string, (s: string) => string> = {\n skill: pc.blue,\n agent: pc.magenta,\n prompt: pc.yellow,\n flow: pc.green,\n preset: pc.cyan,\n contract: pc.red,\n connector: pc.green,\n knowledge: pc.cyan,\n persona: pc.cyan,\n ruleset: pc.cyan,\n \"mcp-server\": pc.magenta,\n};\n\n/**\n * Fit a plain (ANSI-free) string into exactly `width` columns: truncate with a\n * trailing `…` when too long, pad with spaces when too short. Keeps fixed-width\n * columns from overflowing the row when a value (e.g. an asset name) is wider\n * than its budget.\n */\nexport function fitWidth(s: string, width: number): string {\n if (width <= 0) return \"\";\n if (s.length > width) return width === 1 ? \"…\" : `${s.slice(0, width - 1)}…`;\n return s.padEnd(width);\n}\n\n/** Color-code an asset kind string. */\nexport function kindColor(kind: string): string {\n const colorFn = KIND_COLORS[kind] ?? pc.dim;\n return colorFn(kind);\n}\n\n/**\n * Widest kind label (`mcp-server`); the default kind-column width fits it so\n * long kinds don't shove the rest of the row out of alignment.\n */\nexport const KIND_COL_WIDTH = 10;\n\n/**\n * Shared `--target` help suffix: with no flag, the manager deploys into the\n * harness the project is configured for (the driver `skaile config show`\n * resolves), and only then falls back to `claude-code`.\n */\nexport const TARGET_DEFAULT_HINT = \"default: the project's configured harness, else claude-code\";\n\n/**\n * Color-code an asset kind string fit to exactly `width` columns — pads short\n * kinds, truncates over-long ones (via {@link fitWidth}) so the column can never\n * overflow and break row alignment.\n */\nexport function kindColorPad(kind: string, width = KIND_COL_WIDTH): string {\n const colorFn = KIND_COLORS[kind] ?? pc.dim;\n return colorFn(fitWidth(kind, width));\n}\n\n/** Color-code a \"kind:name\" reference string. */\nexport function colorRef(ref: string): string {\n const colonIdx = ref.indexOf(\":\");\n if (colonIdx === -1) return ref;\n const kind = ref.slice(0, colonIdx);\n const rest = ref.slice(colonIdx);\n return `${kindColor(kind)}${rest}`;\n}\n\n/**\n * Print a success line prefixed with a green check mark.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logOk(msg: string) {\n console.log(` ${pc.green(\"✓\")} ${msg}`);\n}\n/**\n * Print an error line prefixed with a red cross to stderr.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logErr(msg: string) {\n console.error(` ${pc.red(\"✗\")} ${msg}`);\n}\n/**\n * Print a warning line prefixed with a yellow exclamation mark.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logWarn(msg: string) {\n console.log(` ${pc.yellow(\"!\")} ${msg}`);\n}\n/**\n * Print an info line prefixed with a dim dot.\n *\n * @param msg - Message to display.\n * @docLink cli/dev-guide#helpers\n */\nexport function logInfo(msg: string) {\n console.log(` ${pc.dim(\"·\")} ${msg}`);\n}\n\n/** The nearest parent directory of `dir` that holds a `skaile.yaml`, or `undefined`. */\nfunction nearestParentProject(dir: string): string | undefined {\n for (let up = path.dirname(dir); up !== dir; dir = up, up = path.dirname(dir)) {\n if (existsSync(path.join(up, SKAILE_YAML_DEFAULT))) return up;\n }\n return undefined;\n}\n\n/**\n * Print the `No skaile.yaml found` line for `projectDir`, plus a second line naming the nearest\n * parent directory that holds a `skaile.yaml` and `--project-dir`, when there is one: skaile\n * does not search parent directories.\n */\nexport function logNoProject(projectDir: string): void {\n const dir = path.resolve(projectDir);\n logErr(`No ${S.cmd(\"skaile.yaml\")} found. Run ${S.cmd(\"skaile init\")} to create one.`);\n const parent = nearestParentProject(dir);\n if (parent) {\n logErr(\n `${S.cmd(parent)} holds a ${S.cmd(\"skaile.yaml\")}: run from there or pass ${S.cmd(`--project-dir ${parent}`)}.`,\n );\n }\n}\n\n/**\n * Stop a project command that has no usable project: print one `✗` line and exit 1, before\n * the command deploys, undeploys, locks or clones anything. Two causes: no `skaile.yaml` in\n * `projectDir` (`No skaile.yaml found`), or a `skaile.yaml` — project, app or user scope —\n * that does not parse (`<file> — parse error: …`, a duplicate key included). Without this a\n * broken file would read as \"nothing declared\" and `install` would undeploy every asset.\n *\n * Library-level commands (`library …`, `search`, `init`) have no project and do not call it.\n */\nexport function requireProjectConfig(\n projectDir: string,\n opts: { allowMissing?: boolean } = {},\n): void {\n const dir = path.resolve(projectDir);\n if (!existsSync(path.join(dir, SKAILE_YAML_DEFAULT))) {\n if (opts.allowMissing) return;\n logNoProject(dir);\n process.exit(1);\n }\n try {\n resolveSkWorkspaceConfig(dir);\n } catch (err) {\n logErr(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n}\n\n/**\n * Hold warnings raised while a spinner animates and print them once it stops:\n * on a TTY a line written mid-spin is overwritten by the next frame. Pass\n * `push` as `AssetManager`'s `onLibraryCollision`, call `flush()` after\n * `spinner.stop(...)`. Warnings pushed after `flush()` print immediately.\n */\nexport function deferredWarnings(): { push: (msg: string) => void; flush: () => void } {\n const held: string[] = [];\n let live = false;\n return {\n push: (msg) => {\n if (live) logWarn(msg);\n else held.push(msg);\n },\n flush: () => {\n for (const msg of held.splice(0)) logWarn(msg);\n live = true;\n },\n };\n}\n\n/** Max stale `.claude/` copies named inline by {@link warnLegacyClaudeCopies}. */\nconst LEGACY_COPY_LIST_MAX = 5;\n\n/**\n * Print ONE warning when tracked assets still have a copy in `.claude/` although\n * the project deploys to another harness (the old default target, see\n * MIGRATION.md). Those copies are orphans: `remove` / `clean` / `list` only look\n * in the active harness dir. Nothing is deleted. Silent when there are none.\n */\nexport function warnLegacyClaudeCopies(am: {\n projectDir: string;\n driverTarget: string;\n listLegacyClaudeDeployed(): Array<{ path: string }>;\n}): void {\n let legacy: Array<{ path: string }>;\n try {\n legacy = am.listLegacyClaudeDeployed();\n } catch {\n return; // advisory only — never fail the command\n }\n if (legacy.length === 0) return;\n const rel = legacy.map((l) => path.relative(am.projectDir, l.path));\n const shown = rel.slice(0, LEGACY_COPY_LIST_MAX).join(\", \");\n const more =\n rel.length > LEGACY_COPY_LIST_MAX ? `, +${rel.length - LEGACY_COPY_LIST_MAX} more` : \"\";\n logWarn(\n `Stale ${S.cmd(\".claude/\")} copies no longer managed (deploying to ${am.driverTarget}): ${shown}${more}. ` +\n `Delete them once ${S.cmd(\"skaile install\")} has deployed to ${am.driverTarget}, or pass ${S.cmd(\"--target claude-code\")} to keep using .claude/.`,\n );\n}\n\n/**\n * Bare asset name of a canonical soft-dep target ref (`@pub/name@ver` → `name`),\n * for compact rendering in `info` / `tree` / `why`. Delegates to the asset-manager\n * parser (the soft-dep read surface) so the two never diverge.\n */\nexport function bareSoftDepName(ref: string): string {\n return softDepName(ref);\n}\n\n/**\n * The report-only soft-dep hint line shared by the `add` no-TTY branch and the\n * `install` surface, so the two user-facing wordings can't drift. Appends a\n * runnable `skaile add` suffix only when the target has a parseable ref.\n */\nexport function formatSoftDepHint(edge: { from: string; to: string; toRef?: string }): string {\n const suffix = edge.toRef ? ` — run \\`skaile add ${edge.toRef}\\` to include it.` : \"\";\n return `${bareSoftDepName(edge.from)} references ${bareSoftDepName(edge.to)} (soft dependency)${suffix}`;\n}\n\n/**\n * Build the \"Soft dependencies (inferred)\" section for `skaile info`. Returns one\n * header line plus one line per soft-dep target, each marked `(soft)` to read\n * differently from a typed `requires`. Empty array when there are no soft deps,\n * so the caller prints nothing.\n */\nexport function formatSoftDepSection(targets: string[]): string[] {\n if (targets.length === 0) return [];\n const out = [` ${S.label(\"Soft dependencies (inferred)\")}:`];\n for (const t of targets) out.push(` ${S.dim(\"·\")} ${t} ${S.dim(\"(soft)\")}`);\n return out;\n}\n\n/**\n * Footer line previewing the soft deps that *adding* the highlighted asset would\n * reference (manage TUI). \"references\" + \"not auto-added\" makes clear the pull is\n * report-only. Empty string when there are no targets, so the caller clears.\n */\nexport function formatSoftDepAddPreview(name: string, targets: string[]): string {\n if (targets.length === 0) return \"\";\n return S.dim(`${name} references ${targets.join(\", \")} (soft dep, not auto-added)`);\n}\n\n/**\n * Footer line previewing the soft deps that *removing* the highlighted asset\n * would orphan (manage TUI) — symmetric with {@link formatSoftDepAddPreview}.\n * Empty string when nothing would be orphaned, so the caller clears.\n */\nexport function formatSoftDepRemovePreview(name: string, targets: string[]): string {\n if (targets.length === 0) return \"\";\n return S.dim(`removing ${name} would orphan ${targets.join(\", \")} (soft dep)`);\n}\n\n/** Format a Date as a human-readable relative time string (e.g. \"5m ago\"). */\nexport function formatRelativeTime(date: Date): string {\n const diff = Date.now() - date.getTime();\n const seconds = Math.floor(diff / 1000);\n if (seconds < 60) return \"just now\";\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m ago`;\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n const days = Math.floor(hours / 24);\n return `${days}d ago`;\n}\n"]}
|