@skaile/workspaces 6.3.0 → 6.4.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 +22 -0
- package/dist/ai-sdk.js +28 -16
- package/dist/ai-sdk.js.map +1 -1
- package/dist/app-sdk/index.js +1 -1
- package/dist/{asset-feeds-3YO2352Y.js → asset-feeds-UJSYGKCX.js} +19 -19
- package/dist/{asset-feeds-3YO2352Y.js.map → asset-feeds-UJSYGKCX.js.map} +1 -1
- package/dist/asset-manager/catalog-deployer.js +6 -6
- package/dist/asset-manager/index.js +11 -11
- package/dist/asset-manager/installer.js +7 -7
- package/dist/asset-manager/renderers.js +6 -6
- package/dist/asset-manager/src/index.d.ts +42 -15
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/asset-manager/src/install-instances.d.ts +2 -0
- package/dist/asset-manager/src/install-instances.d.ts.map +1 -1
- package/dist/asset-manager/src/installer.d.ts.map +1 -1
- package/dist/bridge/harnesses/claude-sdk.js +10 -10
- package/dist/bridge/harnesses/codex.js +8 -8
- package/dist/bridge/harnesses/continue.js +9 -9
- package/dist/bridge/harnesses/echo.js +4 -4
- package/dist/bridge/harnesses/gemini.js +5 -5
- package/dist/bridge/harnesses/goose.js +9 -9
- package/dist/bridge/harnesses/omp.js +6 -6
- package/dist/bridge/harnesses/opencode.js +9 -9
- package/dist/bridge/harnesses/qwen.js +5 -5
- package/dist/bridge/index.js +15 -15
- package/dist/bridge/src/ai-sdk.d.ts +5 -0
- package/dist/bridge/src/ai-sdk.d.ts.map +1 -1
- package/dist/bridge/src/harness-model-check.d.ts +11 -7
- package/dist/bridge/src/harness-model-check.d.ts.map +1 -1
- package/dist/{chunk-72NT2TJU.js → chunk-24D7IW5O.js} +6 -6
- package/dist/{chunk-72NT2TJU.js.map → chunk-24D7IW5O.js.map} +1 -1
- package/dist/{chunk-HH2H2ZV7.js → chunk-2WOA3TKK.js} +12 -12
- package/dist/chunk-2WOA3TKK.js.map +1 -0
- package/dist/{chunk-6WH2WE4B.js → chunk-3ENE6ZOF.js} +4 -4
- package/dist/{chunk-6WH2WE4B.js.map → chunk-3ENE6ZOF.js.map} +1 -1
- package/dist/{chunk-32FYVSSW.js → chunk-45KLCFQB.js} +5 -5
- package/dist/{chunk-32FYVSSW.js.map → chunk-45KLCFQB.js.map} +1 -1
- package/dist/{chunk-BPTWWKGF.js → chunk-5NHBLKKU.js} +3 -3
- package/dist/{chunk-BPTWWKGF.js.map → chunk-5NHBLKKU.js.map} +1 -1
- package/dist/{chunk-7MV3NHPT.js → chunk-5T3DTK7A.js} +41 -23
- package/dist/chunk-5T3DTK7A.js.map +1 -0
- package/dist/{chunk-XBQTXGY4.js → chunk-6WQGJF65.js} +18 -6
- package/dist/chunk-6WQGJF65.js.map +1 -0
- package/dist/{chunk-H622YULS.js → chunk-6X3GDPCB.js} +3 -3
- package/dist/{chunk-H622YULS.js.map → chunk-6X3GDPCB.js.map} +1 -1
- package/dist/{chunk-7QG2WRSN.js → chunk-76WSWPOB.js} +15 -7
- package/dist/{chunk-7QG2WRSN.js.map → chunk-76WSWPOB.js.map} +1 -1
- package/dist/{chunk-J5JRGBKK.js → chunk-ABVWUM2E.js} +27 -17
- package/dist/chunk-ABVWUM2E.js.map +1 -0
- package/dist/{chunk-V5BPDB4J.js → chunk-ACBL7X62.js} +3 -3
- package/dist/{chunk-V5BPDB4J.js.map → chunk-ACBL7X62.js.map} +1 -1
- package/dist/{chunk-VUJXZDCY.js → chunk-BOS7P2Y4.js} +3 -3
- package/dist/{chunk-VUJXZDCY.js.map → chunk-BOS7P2Y4.js.map} +1 -1
- package/dist/{chunk-PNUM7GUY.js → chunk-BUU2DLPC.js} +3 -3
- package/dist/{chunk-PNUM7GUY.js.map → chunk-BUU2DLPC.js.map} +1 -1
- package/dist/{chunk-PL52CI4U.js → chunk-BX7PSWJA.js} +4 -4
- package/dist/{chunk-PL52CI4U.js.map → chunk-BX7PSWJA.js.map} +1 -1
- package/dist/{chunk-URCJIV7T.js → chunk-C7TQARGC.js} +3 -3
- package/dist/{chunk-URCJIV7T.js.map → chunk-C7TQARGC.js.map} +1 -1
- package/dist/{chunk-E5NQRHEB.js → chunk-CK3CJSRY.js} +3 -3
- package/dist/{chunk-E5NQRHEB.js.map → chunk-CK3CJSRY.js.map} +1 -1
- package/dist/{chunk-4QRJBY2P.js → chunk-DCJ4BION.js} +2 -2
- package/dist/{chunk-4QRJBY2P.js.map → chunk-DCJ4BION.js.map} +1 -1
- package/dist/{chunk-HGOJEVHY.js → chunk-DF5WJC3Q.js} +4 -4
- package/dist/{chunk-HGOJEVHY.js.map → chunk-DF5WJC3Q.js.map} +1 -1
- package/dist/{chunk-QK7AG5AV.js → chunk-E237FGGX.js} +4 -4
- package/dist/{chunk-QK7AG5AV.js.map → chunk-E237FGGX.js.map} +1 -1
- package/dist/{chunk-ZEH4WFEG.js → chunk-EXRQKOY6.js} +11 -11
- package/dist/{chunk-ZEH4WFEG.js.map → chunk-EXRQKOY6.js.map} +1 -1
- package/dist/{chunk-QFFMFZIR.js → chunk-G63KOHFS.js} +3 -3
- package/dist/{chunk-QFFMFZIR.js.map → chunk-G63KOHFS.js.map} +1 -1
- package/dist/{chunk-Y3I4KGLX.js → chunk-GBXQFJ4G.js} +8 -8
- package/dist/{chunk-Y3I4KGLX.js.map → chunk-GBXQFJ4G.js.map} +1 -1
- package/dist/{chunk-6GWSDPBP.js → chunk-GTMANMBZ.js} +3 -3
- package/dist/{chunk-6GWSDPBP.js.map → chunk-GTMANMBZ.js.map} +1 -1
- package/dist/{chunk-YW4ASEUP.js → chunk-HSF665NV.js} +5 -5
- package/dist/{chunk-YW4ASEUP.js.map → chunk-HSF665NV.js.map} +1 -1
- package/dist/{chunk-LEJQAX7G.js → chunk-HXZ3FQQN.js} +14 -14
- package/dist/{chunk-LEJQAX7G.js.map → chunk-HXZ3FQQN.js.map} +1 -1
- package/dist/{chunk-ROVZCGTN.js → chunk-IYZAJ2J2.js} +16 -13
- package/dist/chunk-IYZAJ2J2.js.map +1 -0
- package/dist/{chunk-PHAMYCZH.js → chunk-IZV3HDVG.js} +5 -5
- package/dist/{chunk-PHAMYCZH.js.map → chunk-IZV3HDVG.js.map} +1 -1
- package/dist/{chunk-ELSGFI3I.js → chunk-JSWMRYLM.js} +3 -3
- package/dist/{chunk-ELSGFI3I.js.map → chunk-JSWMRYLM.js.map} +1 -1
- package/dist/{chunk-TSTRH4SM.js → chunk-L45IHRDH.js} +3 -3
- package/dist/{chunk-TSTRH4SM.js.map → chunk-L45IHRDH.js.map} +1 -1
- package/dist/{chunk-Q7CU5GQO.js → chunk-L4OYPFLB.js} +3 -3
- package/dist/{chunk-Q7CU5GQO.js.map → chunk-L4OYPFLB.js.map} +1 -1
- package/dist/{chunk-7TSNR5H5.js → chunk-O7KAQQAI.js} +4 -4
- package/dist/{chunk-7TSNR5H5.js.map → chunk-O7KAQQAI.js.map} +1 -1
- package/dist/{chunk-EQNIBBB6.js → chunk-P7EL7QRD.js} +14 -14
- package/dist/{chunk-EQNIBBB6.js.map → chunk-P7EL7QRD.js.map} +1 -1
- package/dist/{chunk-2TFKXSB5.js → chunk-PTBX55QF.js} +4 -4
- package/dist/{chunk-2TFKXSB5.js.map → chunk-PTBX55QF.js.map} +1 -1
- package/dist/{chunk-DU26AVK2.js → chunk-Q4XWCVFA.js} +7 -7
- package/dist/{chunk-DU26AVK2.js.map → chunk-Q4XWCVFA.js.map} +1 -1
- package/dist/{chunk-S6KZHPR4.js → chunk-QJQQNBVT.js} +2 -2
- package/dist/{chunk-S6KZHPR4.js.map → chunk-QJQQNBVT.js.map} +1 -1
- package/dist/{chunk-HDVLBEEX.js → chunk-QSIFEHSN.js} +3 -3
- package/dist/{chunk-HDVLBEEX.js.map → chunk-QSIFEHSN.js.map} +1 -1
- package/dist/{chunk-VUWRGMT6.js → chunk-RKI35EAN.js} +3 -3
- package/dist/{chunk-VUWRGMT6.js.map → chunk-RKI35EAN.js.map} +1 -1
- package/dist/{chunk-7RH6E332.js → chunk-SISUT7VR.js} +7 -7
- package/dist/{chunk-7RH6E332.js.map → chunk-SISUT7VR.js.map} +1 -1
- package/dist/{chunk-TGV2EWGL.js → chunk-TDKZL5ZC.js} +3 -3
- package/dist/{chunk-TGV2EWGL.js.map → chunk-TDKZL5ZC.js.map} +1 -1
- package/dist/{chunk-KIPCBIFJ.js → chunk-TF5CWJQZ.js} +5 -5
- package/dist/{chunk-KIPCBIFJ.js.map → chunk-TF5CWJQZ.js.map} +1 -1
- package/dist/{chunk-KGHYXXXV.js → chunk-TGB4E5Z6.js} +188 -52
- package/dist/chunk-TGB4E5Z6.js.map +1 -0
- package/dist/{chunk-AMJ6KEV7.js → chunk-TPQKFX6X.js} +4 -4
- package/dist/{chunk-AMJ6KEV7.js.map → chunk-TPQKFX6X.js.map} +1 -1
- package/dist/{chunk-KPKGWXUJ.js → chunk-U6S5CXKB.js} +3 -3
- package/dist/{chunk-KPKGWXUJ.js.map → chunk-U6S5CXKB.js.map} +1 -1
- package/dist/{chunk-JGH7NB47.js → chunk-UAOHR6AL.js} +4 -4
- package/dist/{chunk-JGH7NB47.js.map → chunk-UAOHR6AL.js.map} +1 -1
- package/dist/{chunk-COUJOTAJ.js → chunk-UBLZALKP.js} +3 -3
- package/dist/{chunk-COUJOTAJ.js.map → chunk-UBLZALKP.js.map} +1 -1
- package/dist/{chunk-BIRW3HOG.js → chunk-UUKCPPTQ.js} +3 -3
- package/dist/{chunk-BIRW3HOG.js.map → chunk-UUKCPPTQ.js.map} +1 -1
- package/dist/{chunk-TO5SSMRI.js → chunk-UVTN4O7N.js} +42 -17
- package/dist/chunk-UVTN4O7N.js.map +1 -0
- package/dist/{chunk-LD6O6QKU.js → chunk-V4OXHEWY.js} +3 -3
- package/dist/{chunk-LD6O6QKU.js.map → chunk-V4OXHEWY.js.map} +1 -1
- package/dist/{chunk-QTLUZUF2.js → chunk-VSCLUPGZ.js} +28 -26
- package/dist/chunk-VSCLUPGZ.js.map +1 -0
- package/dist/{chunk-JMIKGAUA.js → chunk-VV2DJT4I.js} +15 -5
- package/dist/chunk-VV2DJT4I.js.map +1 -0
- package/dist/{chunk-JCPD4QRM.js → chunk-VZU67OKK.js} +2 -2
- package/dist/{chunk-JCPD4QRM.js.map → chunk-VZU67OKK.js.map} +1 -1
- package/dist/{chunk-XEVFSDIF.js → chunk-WENTJ5KP.js} +4 -4
- package/dist/{chunk-XEVFSDIF.js.map → chunk-WENTJ5KP.js.map} +1 -1
- package/dist/{chunk-MD3FUZS3.js → chunk-YFGXYQW4.js} +3 -3
- package/dist/{chunk-MD3FUZS3.js.map → chunk-YFGXYQW4.js.map} +1 -1
- package/dist/{chunk-MYXFR27L.js → chunk-YJNE4V2M.js} +16 -9
- package/dist/chunk-YJNE4V2M.js.map +1 -0
- package/dist/{chunk-RFQONXET.js → chunk-ZWCGJYR7.js} +3 -3
- package/dist/{chunk-RFQONXET.js.map → chunk-ZWCGJYR7.js.map} +1 -1
- package/dist/{claude-code-EUKDGOOO.js → claude-code-UBT4ZME7.js} +4 -4
- package/dist/{claude-code-EUKDGOOO.js.map → claude-code-UBT4ZME7.js.map} +1 -1
- package/dist/cli/index.js +103 -89
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/commands/library-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/library-index.d.ts.map +1 -1
- package/dist/cli/src/commands/plugin-registry-cmd.d.ts.map +1 -1
- package/dist/cli/src/commands/preset-cmd.d.ts.map +1 -1
- package/dist/cli/src/helpers.d.ts +10 -2
- package/dist/cli/src/helpers.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/index.d.ts +1 -1
- package/dist/cli/src/plugin-store/index.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/reconcile.d.ts.map +1 -1
- package/dist/cli/src/plugin-store/spec.d.ts +19 -14
- package/dist/cli/src/plugin-store/spec.d.ts.map +1 -1
- package/dist/cli/src/setup.d.ts.map +1 -1
- package/dist/connectors/config.js +4 -4
- package/dist/connectors/index.js +19 -19
- package/dist/{connectors-XYPE2DCQ.js → connectors-4WH32NK2.js} +22 -22
- package/dist/{connectors-XYPE2DCQ.js.map → connectors-4WH32NK2.js.map} +1 -1
- package/dist/connectors-shared/index.js +2 -2
- package/dist/core/index.js +5 -5
- package/dist/core/manifest.js +1 -1
- package/dist/core/publish-manifest.js +2 -2
- package/dist/core/runtime-assets.js +4 -4
- package/dist/core/src/index.d.ts +1 -1
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/lock.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts +9 -3
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +15 -0
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/src/workspace-yaml-editor.d.ts.map +1 -1
- package/dist/core/workspace-config.js +3 -3
- package/dist/deploy/index.js +5 -5
- package/dist/discovery/index.js +3 -3
- package/dist/{ensure-sources-IN3VKHUA.js → ensure-sources-UC2RBYMP.js} +24 -24
- package/dist/{ensure-sources-IN3VKHUA.js.map → ensure-sources-UC2RBYMP.js.map} +1 -1
- package/dist/factory-assets/connectors/box.js +19 -19
- package/dist/factory-assets/connectors/deploy.js +19 -19
- package/dist/factory-assets/connectors/devserver.js +19 -19
- package/dist/factory-assets/connectors/flow/adapter.js +19 -19
- package/dist/factory-assets/connectors/flow/engine.js +6 -6
- package/dist/factory-assets/connectors/flow/run-flow.js +21 -21
- package/dist/factory-assets/connectors/flow.js +19 -19
- package/dist/factory-assets/connectors/git.js +19 -19
- package/dist/factory-assets/connectors/gmail.js +19 -19
- package/dist/factory-assets/connectors/googledrive.js +19 -19
- package/dist/factory-assets/connectors/local.js +19 -19
- package/dist/factory-assets/connectors/mattermost.js +19 -19
- package/dist/factory-assets/connectors/memory.js +19 -19
- package/dist/factory-assets/connectors/minio.js +19 -19
- package/dist/factory-assets/connectors/postgres.js +19 -19
- package/dist/factory-assets/connectors/s3.js +19 -19
- package/dist/factory-assets/connectors/sharepoint.js +19 -19
- package/dist/factory-assets/connectors/sqlite.js +19 -19
- package/dist/factory-assets/connectors/static-server.js +19 -19
- package/dist/factory-assets/connectors/tunnel.js +19 -19
- package/dist/factory-assets/connectors/webdav.js +19 -19
- package/dist/factory-assets/connectors/xstate-store.js +19 -19
- package/dist/factory-assets/connectors/xstate.js +19 -19
- package/dist/{flows-QAO63TDV.js → flows-LYTKNGKE.js} +10 -10
- package/dist/{flows-QAO63TDV.js.map → flows-LYTKNGKE.js.map} +1 -1
- package/dist/{helpers-HDVGCF3M.js → helpers-SSSKT5XK.js} +24 -24
- package/dist/{helpers-HDVGCF3M.js.map → helpers-SSSKT5XK.js.map} +1 -1
- package/dist/library/index.js +8 -8
- package/dist/library/install.js +3 -3
- package/dist/{library-publish-62OWCNB5.js → library-publish-GQMNTAKK.js} +48 -48
- package/dist/{library-publish-62OWCNB5.js.map → library-publish-GQMNTAKK.js.map} +1 -1
- package/dist/model-endpoint/index.js +8 -8
- package/dist/{open-library-TZ7OSDEJ.js → open-library-XGUCUJYE.js} +27 -27
- package/dist/{open-library-TZ7OSDEJ.js.map → open-library-XGUCUJYE.js.map} +1 -1
- package/dist/{open-registry-RLZKTJG3.js → open-registry-DIFEPDF6.js} +12 -12
- package/dist/{open-registry-RLZKTJG3.js.map → open-registry-DIFEPDF6.js.map} +1 -1
- package/dist/{paths-D6LBQETQ.js → paths-G4GFJLE2.js} +8 -8
- package/dist/{paths-D6LBQETQ.js.map → paths-G4GFJLE2.js.map} +1 -1
- package/dist/{plugin-store-A5J4TLCH.js → plugin-store-BBLDFD3L.js} +8 -8
- package/dist/{plugin-store-A5J4TLCH.js.map → plugin-store-BBLDFD3L.js.map} +1 -1
- package/dist/{project-4AVRES3M.js → project-LB745WVZ.js} +44 -44
- package/dist/{project-4AVRES3M.js.map → project-LB745WVZ.js.map} +1 -1
- package/dist/resolver/index.js +6 -6
- package/dist/runner/index.js +34 -34
- package/dist/runner/src/capability-roundtrip.d.ts +4 -1
- package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +11 -11
- package/dist/sdk/bridge.js +15 -15
- package/dist/sdk/core.js +5 -5
- package/dist/sdk/flow.js +6 -6
- package/dist/sdk/index.js +34 -34
- package/dist/sdk/resolver.js +6 -6
- package/dist/sdk/runner.js +34 -34
- package/dist/sdk/session.js +2 -2
- package/dist/sdk/transport/ws/server.js +6 -6
- package/dist/sdk/transport/ws.js +6 -6
- package/dist/sdk/transport.js +6 -6
- package/dist/sdk/types.js +1 -1
- package/dist/{serve-preflight-H2AYMGJ6.js → serve-preflight-NPWI4MV6.js} +25 -25
- package/dist/{serve-preflight-H2AYMGJ6.js.map → serve-preflight-NPWI4MV6.js.map} +1 -1
- package/dist/session/index.js +2 -2
- package/dist/{setup-NSPQD4V4.js → setup-X6ZYH2MW.js} +30 -27
- package/dist/setup-X6ZYH2MW.js.map +1 -0
- package/dist/{skills-B533SRVZ.js → skills-62PXDBPJ.js} +11 -11
- package/dist/{skills-B533SRVZ.js.map → skills-62PXDBPJ.js.map} +1 -1
- package/dist/{source-VTECABUO.js → source-LAYCTRHP.js} +44 -44
- package/dist/{source-VTECABUO.js.map → source-LAYCTRHP.js.map} +1 -1
- package/dist/{source-manifest-publish-YORI42MN.js → source-manifest-publish-3S6PJ25W.js} +46 -46
- package/dist/{source-manifest-publish-YORI42MN.js.map → source-manifest-publish-3S6PJ25W.js.map} +1 -1
- package/dist/transport/index.js +6 -6
- package/dist/transport/ws/server.js +6 -6
- package/dist/transport/ws.js +6 -6
- package/dist/tui/index.js +34 -34
- package/dist/types/index.js +1 -1
- package/dist/types/src/capabilities.d.ts +9 -1
- package/dist/types/src/capabilities.d.ts.map +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +26 -26
- package/dist/workspace-plugin/adapters/omp.js +14 -14
- package/dist/workspace-plugin/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-7MV3NHPT.js.map +0 -1
- package/dist/chunk-HH2H2ZV7.js.map +0 -1
- package/dist/chunk-J5JRGBKK.js.map +0 -1
- package/dist/chunk-JMIKGAUA.js.map +0 -1
- package/dist/chunk-KGHYXXXV.js.map +0 -1
- package/dist/chunk-MYXFR27L.js.map +0 -1
- package/dist/chunk-QTLUZUF2.js.map +0 -1
- package/dist/chunk-ROVZCGTN.js.map +0 -1
- package/dist/chunk-TO5SSMRI.js.map +0 -1
- package/dist/chunk-XBQTXGY4.js.map +0 -1
- package/dist/setup-NSPQD4V4.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../cli/src/type-guards.ts","../cli/src/commands/validate-instances.ts","../cli/src/config-checks.ts"],"names":["parseYaml","agentInstanceDiagnostics","fs","path"],"mappings":";;;;;;;;AACO,SAAS,SAAS,KAAA,EAAkD;AACzE,EAAA,OAAO,KAAA,KAAU,QAAQ,OAAO,KAAA,KAAU,YAAY,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;;;ACqBA,IAAM,mBAAA,GAAsB,YAAA;AAG5B,IAAM,uBAAA,GAAuF;AAAA,EAC3F,QAAA,EAAU,CAAC,MAAA,EAAQ,QAAQ,CAAA;AAAA,EAC3B,OAAA,EAAS,CAAC,QAAQ,CAAA;AAAA,EAClB,OAAA,EAAS,CAAC,MAAM,CAAA;AAAA,EAChB,KAAA,EAAO,CAAC,OAAO;AACjB,CAAA;AAEA,IAAM,GAAA,GAAM,CAAC,IAAA,EAAc,OAAA,EAAiB,EAAA,MAA4B;AAAA,EACtE,IAAA;AAAA,EACA,QAAA,EAAU,OAAA;AAAA,EACV,OAAA;AAAA,EACA,IAAA,EAAM;AACR,CAAA,CAAA;AAaA,SAAS,eAAe,QAAA,EAA+C;AACrE,EAAA,MAAM,KAAA,GAAoB;AAAA,IACxB,WAAW,QAAA,CAAS,SAAA;AAAA,IACpB,KAAA,EAAO,QAAA,CAAS,EAAA,KAAO,MAAA,IAAa,SAAS,EAAA,KAAO,IAAA;AAAA,IACpD,gBAAgB,EAAC;AAAA,I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,CAAA;AACtE,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,GAAI,IAAA,CAAK,OAAA,GAAU,MAAM,oBAAA,CAAqB,YAAY,IAAA,CAAK,MAAA,EAAQ,aAAa,CAAA,GAAI,EAAC;AAAA,IACzF,GAAI,IAAA,CAAK,SAAA,GAAY,uBAAA,CAAwB,UAAU,IAAI;AAAC,GAC9D;AACA,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAA;AACtC,EAAA,OAAO,MAAA,CAAO,MAAA;AAChB","file":"chunk-KIPCBIFJ.js","sourcesContent":["/** Narrow to a plain-object-shaped value (not `null`, not an array); fields stay `unknown`. */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n","/**\n * `skaile validate` rules for the root `agents:` map of one `skaile.yaml`.\n *\n * Normalisation errors, the `agent:` + `agents.default` conflict, and the\n * asset-dependent rules: every `ref` resolves to an `agent.yaml`, role\n * instances need the asset's `io`, `connectors` bind real connector slots to\n * real `connectors[]` ids, and trigger ids are unique and known.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n AgentRefResolutionError,\n type AgentInstanceConfig,\n type AgentInstanceTrigger,\n agentBlockKeyDiagnostics,\n agentInstanceDiagnostics,\n type Diagnostic,\n normalizeAgentInstances,\n resolveAgentDefinitionDir,\n} from \"@skaile/workspaces/core\";\nimport { parse as parseYaml } from \"yaml\";\nimport { isRecord } from \"../type-guards.ts\";\n\nconst AGENT_MANIFEST_FILE = \"agent.yaml\";\n\n/** Fields a trigger needs when it declares itself in full (no asset trigger to override). */\nconst TRIGGER_REQUIRED_FIELDS: Record<NonNullable<AgentInstanceTrigger[\"kind\"]>, string[]> = {\n schedule: [\"cron\", \"prompt\"],\n webhook: [\"prompt\"],\n channel: [\"when\"],\n event: [\"event\"],\n};\n\nconst err = (code: string, message: string, at: string): Diagnostic => ({\n code,\n severity: \"error\",\n message,\n path: at,\n});\n\n/** The parts of an agent asset the instance rules read. */\ninterface AssetFacts {\n lifecycle: unknown;\n hasIo: boolean;\n /** `composes[].id` of `kind: connector` items. */\n connectorSlots: string[];\n /** `composes[].id` of every other item that has one. */\n otherSlots: string[];\n triggerIds: string[];\n}\n\nfunction readAssetFacts(manifest: Record<string, unknown>): AssetFacts {\n const facts: AssetFacts = {\n lifecycle: manifest.lifecycle,\n hasIo: manifest.io !== undefined && manifest.io !== null,\n connectorSlots: [],\n otherSlots: [],\n triggerIds: [],\n };\n for (const item of Array.isArray(manifest.composes) ? manifest.composes : []) {\n if (!isRecord(item) || typeof item.id !== \"string\") continue;\n (item.kind === \"connector\" ? facts.connectorSlots : facts.otherSlots).push(item.id);\n }\n for (const t of Array.isArray(manifest.triggers) ? manifest.triggers : []) {\n if (isRecord(t) && typeof t.id === \"string\") facts.triggerIds.push(t.id);\n }\n return facts;\n}\n\n/** Resolve an instance `ref` to its parsed `agent.yaml`, or an error diagnostic. */\nfunction loadAsset(\n projectDir: string,\n id: string,\n ref: string,\n): { facts: AssetFacts } | { diagnostic: Diagnostic } {\n const at = `agents.${id}.ref`;\n let dir: string | undefined;\n try {\n dir = resolveAgentDefinitionDir(projectDir, ref);\n } catch (e) {\n if (!(e instanceof AgentRefResolutionError)) throw e;\n return { diagnostic: err(\"agent_ref_unresolved\", `agents.${id}: ${e.message}`, at) };\n }\n if (dir === undefined) {\n return {\n diagnostic: err(\n \"agent_ref_unresolved\",\n `agents.${id}: ref \"${ref}\" cannot be resolved — no ai-assets/ directory above the project`,\n at,\n ),\n };\n }\n const manifestPath = path.join(dir, AGENT_MANIFEST_FILE);\n let text: string;\n try {\n text = fs.readFileSync(manifestPath, \"utf-8\");\n } catch {\n return {\n diagnostic: err(\n \"agent_ref_unresolved\",\n `agents.${id}: ref \"${ref}\" resolves to ${dir}, which has no ${AGENT_MANIFEST_FILE}`,\n at,\n ),\n };\n }\n let manifest: unknown;\n try {\n manifest = parseYaml(text);\n } catch (e) {\n return {\n diagnostic: err(\n \"agent_manifest_invalid\",\n `agents.${id}: ${manifestPath} is not valid YAML: ${e instanceof Error ? e.message : String(e)}`,\n at,\n ),\n };\n }\n if (!isRecord(manifest)) {\n return {\n diagnostic: err(\n \"agent_manifest_invalid\",\n `agents.${id}: ${manifestPath} is not a mapping`,\n at,\n ),\n };\n }\n return { facts: readAssetFacts(manifest) };\n}\n\n/**\n * Trigger rules. Duplicate ids are always an error; the asset-dependent rules\n * (known id, complete full declaration) run only when `assetTriggerIds` is\n * known — i.e. the instance's `ref` resolved.\n */\nfunction checkTriggers(\n id: string,\n triggers: AgentInstanceTrigger[],\n assetTriggerIds: string[] | undefined,\n): Diagnostic[] {\n const out: Diagnostic[] = [];\n const seen = new Set<string>();\n triggers.forEach((trigger, i) => {\n const at = `agents.${id}.triggers[${i}]`;\n if (seen.has(trigger.id)) {\n out.push(\n err(\n \"agent_trigger_duplicate\",\n `agents.${id}: trigger id \"${trigger.id}\" is declared twice`,\n `${at}.id`,\n ),\n );\n return;\n }\n seen.add(trigger.id);\n if (!assetTriggerIds || assetTriggerIds.includes(trigger.id)) return;\n if (!trigger.kind) {\n out.push(\n err(\n \"agent_trigger_unknown\",\n `agents.${id}: trigger \"${trigger.id}\" is not declared by the agent asset (${assetTriggerIds.length > 0 ? `has: ${assetTriggerIds.join(\", \")}` : \"it declares no triggers\"}) — add \\`kind\\` and the trigger's fields to declare a new one`,\n `${at}.id`,\n ),\n );\n return;\n }\n const missing = TRIGGER_REQUIRED_FIELDS[trigger.kind].filter(\n (field) => (trigger as unknown as Record<string, unknown>)[field] === undefined,\n );\n if (missing.length > 0) {\n out.push(\n err(\n \"agent_trigger_incomplete\",\n `agents.${id}: trigger \"${trigger.id}\" (kind ${trigger.kind}) is not in the asset, so it must declare ${missing.join(\", \")}`,\n at,\n ),\n );\n }\n });\n return out;\n}\n\nfunction checkConnectors(\n id: string,\n instance: AgentInstanceConfig,\n facts: AssetFacts,\n connectorIds: string[],\n): Diagnostic[] {\n const out: Diagnostic[] = [];\n for (const [slot, connectorId] of Object.entries(instance.connectors ?? {})) {\n const at = `agents.${id}.connectors.${slot}`;\n if (!facts.connectorSlots.includes(slot)) {\n const hint = facts.otherSlots.includes(slot)\n ? `\"${slot}\" is a slot of a non-connector item`\n : facts.connectorSlots.length > 0\n ? `the asset's connector slots are: ${facts.connectorSlots.join(\", \")}`\n : \"the asset declares no connector slots\";\n out.push(\n err(\n \"agent_connector_slot_unknown\",\n `agents.${id}: connectors.${slot} is not a connector slot id of the agent asset (${hint})`,\n at,\n ),\n );\n }\n if (!connectorIds.includes(connectorId)) {\n out.push(\n err(\n \"agent_connector_unknown\",\n `agents.${id}: connectors.${slot} points at \"${connectorId}\", which is not in skaile.yaml connectors[]${connectorIds.length > 0 ? ` (has: ${connectorIds.join(\", \")})` : \"\"}`,\n at,\n ),\n );\n }\n }\n return out;\n}\n\n/**\n * Diagnostics for the `agents:` map of a parsed `skaile.yaml`.\n *\n * @param projectDir - Directory of the `skaile.yaml`; local and catalog refs resolve against it.\n * @param parsed - The raw YAML document.\n */\nexport function checkAgentInstances(\n projectDir: string,\n parsed: Record<string, unknown>,\n): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n const instances = normalizeAgentInstances(parsed.agents, diagnostics);\n const agent = isRecord(parsed.agent) ? parsed.agent : undefined;\n diagnostics.push(...agentBlockKeyDiagnostics(parsed.agent));\n if (agent?.subagents !== undefined) {\n diagnostics.push(\n err(\n \"agent_subagents_removed\",\n \"`agent.subagents` was removed — declare each subagent as an agent asset and bind it under `agents:` with `lifecycle: role`\",\n \"agent.subagents\",\n ),\n );\n }\n if (agent?.instances !== undefined) {\n diagnostics.push(\n err(\n \"misplaced_agent_instances\",\n \"`agent.instances` is not a skaile.yaml key — declare instances under root `agents:`\",\n \"agent.instances\",\n ),\n );\n }\n diagnostics.push(\n ...agentInstanceDiagnostics({\n agent: {\n definition: typeof agent?.definition === \"string\" ? agent.definition : undefined,\n instances,\n },\n }),\n );\n // `serve` refuses an `agent.definition` that does not resolve, so `validate` must too (p1733).\n if (typeof agent?.definition === \"string\" && agent.definition !== \"\") {\n try {\n resolveAgentDefinitionDir(projectDir, agent.definition);\n } catch (e) {\n if (!(e instanceof AgentRefResolutionError)) throw e;\n diagnostics.push(err(\"agent_ref_unresolved\", e.message, \"agent.definition\"));\n }\n }\n if (!instances) return diagnostics;\n\n const connectorIds = (Array.isArray(parsed.connectors) ? parsed.connectors : []).flatMap((c) =>\n isRecord(c) && typeof c.id === \"string\" ? [c.id] : [],\n );\n\n for (const [id, instance] of Object.entries(instances)) {\n const loaded = loadAsset(projectDir, id, instance.ref);\n if (\"diagnostic\" in loaded) {\n // Asset-independent trigger rules still apply when the ref is broken.\n diagnostics.push(loaded.diagnostic, ...checkTriggers(id, instance.triggers ?? [], undefined));\n continue;\n }\n const { facts } = loaded;\n const lifecycle = instance.lifecycle ?? facts.lifecycle ?? \"standing\";\n if (lifecycle === \"role\" && !facts.hasIo) {\n diagnostics.push(\n err(\n \"agent_role_missing_io\",\n `agents.${id}: lifecycle \"role\" needs the agent asset to declare \\`io\\` ({ input, output } JSON Schemas)`,\n `agents.${id}.lifecycle`,\n ),\n );\n }\n diagnostics.push(...checkConnectors(id, instance, facts, connectorIds));\n diagnostics.push(...checkTriggers(id, instance.triggers ?? [], facts.triggerIds));\n }\n return diagnostics;\n}\n","/**\n * Checks of a project's `skaile.yaml` that `validate`, `check`, `doctor` and `run` share:\n * keys nothing reads (p1474) and a `harness:` no harness registers (p1022).\n */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { Diagnostic, SkWorkspaceConfig } from \"@skaile/workspaces/core\";\nimport { loadSkWorkspaceConfig, SKAILE_YAML_DEFAULT } from \"@skaile/workspaces/core\";\nimport { parse as parseYaml } from \"yaml\";\nimport { checkAgentInstances } from \"./commands/validate-instances.ts\";\nimport { unknownHarnessMessage } from \"./harness-error.ts\";\nimport { logErr, logWarn } from \"./helpers.ts\";\nimport { loadDeclaredPlugins } from \"./plugin-store/index.ts\";\n\n/** One warning line per key of the file that nothing reads. */\nexport function unknownKeyWarnings(diagnostics: readonly Diagnostic[], label: string): string[] {\n return diagnostics\n .filter((d) => d.code === \"unknown_config_key\" || d.code === \"unknown_profile_key\")\n .map((d) => `${label}: ${d.message}`);\n}\n\n/**\n * One error line per `agent-config` profile whose `harness:` nothing registers. The harnesses of\n * the plugins the project declares count, so they are loaded before the verdict, and only when\n * some profile names a harness the built-in ones do not.\n *\n * @param projectDir - Project whose `plugins:` are loaded.\n * @param config - The decoded config file.\n * @param label - File name for the line.\n */\nexport async function unknownHarnessErrors(\n projectDir: string,\n config: SkWorkspaceConfig,\n label: string,\n): Promise<string[]> {\n const profiles = Object.entries(config.agent_config ?? {}).filter(\n (e): e is [string, { harness: string }] => typeof e[1]?.harness === \"string\",\n );\n if (profiles.every(([, p]) => unknownHarnessMessage(p.harness) === undefined)) return [];\n await loadDeclaredPlugins(projectDir);\n const errors: string[] = [];\n for (const [name, p] of profiles) {\n const refusal = unknownHarnessMessage(p.harness);\n if (refusal) errors.push(`${label}: agent-config.${name}.harness: ${refusal}`);\n }\n return errors;\n}\n\n/**\n * Print the `✗` line for each `agent-config` profile whose `harness:` nothing registers and\n * return how many were printed. The harness check `install`, `list` and `config show` share with\n * `validate`, `check` and `run` (p1754); a file that does not load is not this function's to\n * report.\n */\nexport async function reportUnknownHarnesses(projectDir: string): Promise<number> {\n let config: SkWorkspaceConfig | undefined;\n try {\n config = loadSkWorkspaceConfig(projectDir)?.config;\n } catch {\n return 0;\n }\n if (!config) return 0;\n const errors = await unknownHarnessErrors(projectDir, config, \"skaile.yaml\");\n for (const line of errors) logErr(line);\n return errors.length;\n}\n\n/** The `agents:` / `agent:` diagnostics of the project's `skaile.yaml` as `validate` gives them. */\nfunction agentInstanceDiagnostics(projectDir: string): Diagnostic[] {\n let parsed: unknown;\n try {\n parsed = parseYaml(fs.readFileSync(path.join(projectDir, SKAILE_YAML_DEFAULT), \"utf-8\"));\n } catch {\n return [];\n }\n if (typeof parsed !== \"object\" || parsed === null) return [];\n return checkAgentInstances(projectDir, parsed as Record<string, unknown>);\n}\n\n/** One line the way `validate` prints a diagnostic of the `agents:` map. */\nfunction agentInstanceLine(d: Diagnostic): string {\n return `${SKAILE_YAML_DEFAULT} [agents] — ${d.code}: ${d.path ? `${d.path}: ` : \"\"}${d.message}`;\n}\n\n/**\n * The errors `skaile validate` gives the `agents:` map of the project's `skaile.yaml`, as the\n * lines `validate` prints (p1512): a lifecycle or memory scope that is none of the known ones, a\n * `role` instance whose agent declares no `io`, a connector or trigger the agent does not have.\n * `install`, `check`, `run`, `repl` and `rebuild` refuse the project with them, so they never\n * accept what `validate` rejects. A ref that does not resolve is left out: `install` resolves a\n * catalog ref itself and `check` reports an unbound ref as a gap.\n *\n * @param projectDir - Project directory.\n */\nexport function agentInstanceErrorLines(projectDir: string): string[] {\n return agentInstanceDiagnostics(projectDir)\n .filter((d) => d.severity === \"error\" && d.code !== \"agent_ref_unresolved\")\n .map(agentInstanceLine);\n}\n\n/**\n * The warnings `skaile validate` gives for keys of `agent:` and `agents:` that nothing reads\n * (p1712), as the lines `validate` prints: `agents.audit.colour`, `agent.modle`,\n * `agents.<id>.model.preffered`. Without them a typo leaves the default model or budget in\n * place and says nothing.\n *\n * @param projectDir - Project directory.\n */\nexport function agentInstanceWarningLines(projectDir: string): string[] {\n return agentInstanceDiagnostics(projectDir)\n .filter(\n (d) =>\n d.severity === \"warning\" &&\n (d.code === \"unknown_agent_instance_key\" || d.code === \"unknown_agent_key\"),\n )\n .map(agentInstanceLine);\n}\n\n/**\n * The checks of the project's own `skaile.yaml`, printed: `!` lines for unknown keys (also the\n * ones of `agent:` and `agents:`, p1712), `✗` lines for an unknown harness and for an `agents:`\n * map `validate` rejects. Returns the number of errors printed. A file that does not load is not\n * this function's to report: the command reads it again and says so.\n *\n * @param projectDir - Project directory.\n * @param opts.harness - Also refuse an unknown `harness:` (`check`, `doctor`).\n * @param opts.instances - Also refuse an `agents:` map `validate` rejects (p1512).\n */\nexport async function reportProjectConfig(\n projectDir: string,\n opts: { harness: boolean; instances?: boolean },\n): Promise<number> {\n let file: ReturnType<typeof loadSkWorkspaceConfig>;\n try {\n file = loadSkWorkspaceConfig(projectDir);\n } catch {\n return 0;\n }\n if (!file) return 0;\n for (const line of unknownKeyWarnings(file.diagnostics ?? [], \"skaile.yaml\")) logWarn(line);\n for (const line of agentInstanceWarningLines(projectDir)) logWarn(line);\n const errors = [\n ...(opts.harness ? await unknownHarnessErrors(projectDir, file.config, \"skaile.yaml\") : []),\n ...(opts.instances ? agentInstanceErrorLines(projectDir) : []),\n ];\n for (const line of errors) logErr(line);\n return errors.length;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../cli/src/type-guards.ts","../cli/src/commands/validate-instances.ts","../cli/src/config-checks.ts"],"names":["parseYaml","agentInstanceDiagnostics","fs","path"],"mappings":";;;;;;;;AACO,SAAS,SAAS,KAAA,EAAkD;AACzE,EAAA,OAAO,KAAA,KAAU,QAAQ,OAAO,KAAA,KAAU,YAAY,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;;;ACqBA,IAAM,mBAAA,GAAsB,YAAA;AAG5B,IAAM,uBAAA,GAAuF;AAAA,EAC3F,QAAA,EAAU,CAAC,MAAA,EAAQ,QAAQ,CAAA;AAAA,EAC3B,OAAA,EAAS,CAAC,QAAQ,CAAA;AAAA,EAClB,OAAA,EAAS,CAAC,MAAM,CAAA;AAAA,EAChB,KAAA,EAAO,CAAC,OAAO;AACjB,CAAA;AAEA,IAAM,GAAA,GAAM,CAAC,IAAA,EAAc,OAAA,EAAiB,EAAA,MAA4B;AAAA,EACtE,IAAA;AAAA,EACA,QAAA,EAAU,OAAA;AAAA,EACV,OAAA;AAAA,EACA,IAAA,EAAM;AACR,CAAA,CAAA;AAaA,SAAS,eAAe,QAAA,EAA+C;AACrE,EAAA,MAAM,KAAA,GAAoB;AAAA,IACxB,WAAW,QAAA,CAAS,SAAA;AAAA,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AAA,EAAG,OAAA,CAAQ,IAAI,CAAA;AAC1F,EAAA,KAAA,MAAW,IAAA,IAAQ,yBAAA,CAA0B,UAAU,CAAA,UAAW,IAAI,CAAA;AACtE,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,GAAI,IAAA,CAAK,OAAA,GAAU,MAAM,oBAAA,CAAqB,YAAY,IAAA,CAAK,MAAA,EAAQ,aAAa,CAAA,GAAI,EAAC;AAAA,IACzF,GAAI,IAAA,CAAK,SAAA,GAAY,uBAAA,CAAwB,UAAU,IAAI;AAAC,GAC9D;AACA,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAA;AACtC,EAAA,OAAO,MAAA,CAAO,MAAA;AAChB","file":"chunk-TF5CWJQZ.js","sourcesContent":["/** Narrow to a plain-object-shaped value (not `null`, not an array); fields stay `unknown`. */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n","/**\n * `skaile validate` rules for the root `agents:` map of one `skaile.yaml`.\n *\n * Normalisation errors, the `agent:` + `agents.default` conflict, and the\n * asset-dependent rules: every `ref` resolves to an `agent.yaml`, role\n * instances need the asset's `io`, `connectors` bind real connector slots to\n * real `connectors[]` ids, and trigger ids are unique and known.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport {\n AgentRefResolutionError,\n type AgentInstanceConfig,\n type AgentInstanceTrigger,\n agentBlockKeyDiagnostics,\n agentInstanceDiagnostics,\n type Diagnostic,\n normalizeAgentInstances,\n resolveAgentDefinitionDir,\n} from \"@skaile/workspaces/core\";\nimport { parse as parseYaml } from \"yaml\";\nimport { isRecord } from \"../type-guards.ts\";\n\nconst AGENT_MANIFEST_FILE = \"agent.yaml\";\n\n/** Fields a trigger needs when it declares itself in full (no asset trigger to override). */\nconst TRIGGER_REQUIRED_FIELDS: Record<NonNullable<AgentInstanceTrigger[\"kind\"]>, string[]> = {\n schedule: [\"cron\", \"prompt\"],\n webhook: [\"prompt\"],\n channel: [\"when\"],\n event: [\"event\"],\n};\n\nconst err = (code: string, message: string, at: string): Diagnostic => ({\n code,\n severity: \"error\",\n message,\n path: at,\n});\n\n/** The parts of an agent asset the instance rules read. */\ninterface AssetFacts {\n lifecycle: unknown;\n hasIo: boolean;\n /** `composes[].id` of `kind: connector` items. */\n connectorSlots: string[];\n /** `composes[].id` of every other item that has one. */\n otherSlots: string[];\n triggerIds: string[];\n}\n\nfunction readAssetFacts(manifest: Record<string, unknown>): AssetFacts {\n const facts: AssetFacts = {\n lifecycle: manifest.lifecycle,\n hasIo: manifest.io !== undefined && manifest.io !== null,\n connectorSlots: [],\n otherSlots: [],\n triggerIds: [],\n };\n for (const item of Array.isArray(manifest.composes) ? manifest.composes : []) {\n if (!isRecord(item) || typeof item.id !== \"string\") continue;\n (item.kind === \"connector\" ? facts.connectorSlots : facts.otherSlots).push(item.id);\n }\n for (const t of Array.isArray(manifest.triggers) ? manifest.triggers : []) {\n if (isRecord(t) && typeof t.id === \"string\") facts.triggerIds.push(t.id);\n }\n return facts;\n}\n\n/** Resolve an instance `ref` to its parsed `agent.yaml`, or an error diagnostic. */\nfunction loadAsset(\n projectDir: string,\n id: string,\n ref: string,\n): { facts: AssetFacts } | { diagnostic: Diagnostic } {\n const at = `agents.${id}.ref`;\n let dir: string | undefined;\n try {\n dir = resolveAgentDefinitionDir(projectDir, ref);\n } catch (e) {\n if (!(e instanceof AgentRefResolutionError)) throw e;\n return { diagnostic: err(\"agent_ref_unresolved\", `agents.${id}: ${e.message}`, at) };\n }\n if (dir === undefined) {\n return {\n diagnostic: err(\n \"agent_ref_unresolved\",\n `agents.${id}: ref \"${ref}\" cannot be resolved — no ai-assets/ directory above the project`,\n at,\n ),\n };\n }\n const manifestPath = path.join(dir, AGENT_MANIFEST_FILE);\n let text: string;\n try {\n text = fs.readFileSync(manifestPath, \"utf-8\");\n } catch {\n return {\n diagnostic: err(\n \"agent_ref_unresolved\",\n `agents.${id}: ref \"${ref}\" resolves to ${dir}, which has no ${AGENT_MANIFEST_FILE}`,\n at,\n ),\n };\n }\n let manifest: unknown;\n try {\n manifest = parseYaml(text);\n } catch (e) {\n return {\n diagnostic: err(\n \"agent_manifest_invalid\",\n `agents.${id}: ${manifestPath} is not valid YAML: ${e instanceof Error ? e.message : String(e)}`,\n at,\n ),\n };\n }\n if (!isRecord(manifest)) {\n return {\n diagnostic: err(\n \"agent_manifest_invalid\",\n `agents.${id}: ${manifestPath} is not a mapping`,\n at,\n ),\n };\n }\n return { facts: readAssetFacts(manifest) };\n}\n\n/**\n * Trigger rules. Duplicate ids are always an error; the asset-dependent rules\n * (known id, complete full declaration) run only when `assetTriggerIds` is\n * known — i.e. the instance's `ref` resolved.\n */\nfunction checkTriggers(\n id: string,\n triggers: AgentInstanceTrigger[],\n assetTriggerIds: string[] | undefined,\n): Diagnostic[] {\n const out: Diagnostic[] = [];\n const seen = new Set<string>();\n triggers.forEach((trigger, i) => {\n const at = `agents.${id}.triggers[${i}]`;\n if (seen.has(trigger.id)) {\n out.push(\n err(\n \"agent_trigger_duplicate\",\n `agents.${id}: trigger id \"${trigger.id}\" is declared twice`,\n `${at}.id`,\n ),\n );\n return;\n }\n seen.add(trigger.id);\n if (!assetTriggerIds || assetTriggerIds.includes(trigger.id)) return;\n if (!trigger.kind) {\n out.push(\n err(\n \"agent_trigger_unknown\",\n `agents.${id}: trigger \"${trigger.id}\" is not declared by the agent asset (${assetTriggerIds.length > 0 ? `has: ${assetTriggerIds.join(\", \")}` : \"it declares no triggers\"}) — add \\`kind\\` and the trigger's fields to declare a new one`,\n `${at}.id`,\n ),\n );\n return;\n }\n const missing = TRIGGER_REQUIRED_FIELDS[trigger.kind].filter(\n (field) => (trigger as unknown as Record<string, unknown>)[field] === undefined,\n );\n if (missing.length > 0) {\n out.push(\n err(\n \"agent_trigger_incomplete\",\n `agents.${id}: trigger \"${trigger.id}\" (kind ${trigger.kind}) is not in the asset, so it must declare ${missing.join(\", \")}`,\n at,\n ),\n );\n }\n });\n return out;\n}\n\nfunction checkConnectors(\n id: string,\n instance: AgentInstanceConfig,\n facts: AssetFacts,\n connectorIds: string[],\n): Diagnostic[] {\n const out: Diagnostic[] = [];\n for (const [slot, connectorId] of Object.entries(instance.connectors ?? {})) {\n const at = `agents.${id}.connectors.${slot}`;\n if (!facts.connectorSlots.includes(slot)) {\n const hint = facts.otherSlots.includes(slot)\n ? `\"${slot}\" is a slot of a non-connector item`\n : facts.connectorSlots.length > 0\n ? `the asset's connector slots are: ${facts.connectorSlots.join(\", \")}`\n : \"the asset declares no connector slots\";\n out.push(\n err(\n \"agent_connector_slot_unknown\",\n `agents.${id}: connectors.${slot} is not a connector slot id of the agent asset (${hint})`,\n at,\n ),\n );\n }\n if (!connectorIds.includes(connectorId)) {\n out.push(\n err(\n \"agent_connector_unknown\",\n `agents.${id}: connectors.${slot} points at \"${connectorId}\", which is not in skaile.yaml connectors[]${connectorIds.length > 0 ? ` (has: ${connectorIds.join(\", \")})` : \"\"}`,\n at,\n ),\n );\n }\n }\n return out;\n}\n\n/**\n * Diagnostics for the `agents:` map of a parsed `skaile.yaml`.\n *\n * @param projectDir - Directory of the `skaile.yaml`; local and catalog refs resolve against it.\n * @param parsed - The raw YAML document.\n */\nexport function checkAgentInstances(\n projectDir: string,\n parsed: Record<string, unknown>,\n): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n const instances = normalizeAgentInstances(parsed.agents, diagnostics);\n const agent = isRecord(parsed.agent) ? parsed.agent : undefined;\n diagnostics.push(...agentBlockKeyDiagnostics(parsed.agent));\n if (agent?.subagents !== undefined) {\n diagnostics.push(\n err(\n \"agent_subagents_removed\",\n \"`agent.subagents` was removed — declare each subagent as an agent asset and bind it under `agents:` with `lifecycle: role`\",\n \"agent.subagents\",\n ),\n );\n }\n if (agent?.instances !== undefined) {\n diagnostics.push(\n err(\n \"misplaced_agent_instances\",\n \"`agent.instances` is not a skaile.yaml key — declare instances under root `agents:`\",\n \"agent.instances\",\n ),\n );\n }\n diagnostics.push(\n ...agentInstanceDiagnostics({\n agent: {\n definition: typeof agent?.definition === \"string\" ? agent.definition : undefined,\n instances,\n },\n }),\n );\n // `serve` refuses an `agent.definition` that does not resolve, so `validate` must too (p1733).\n if (typeof agent?.definition === \"string\" && agent.definition !== \"\") {\n try {\n resolveAgentDefinitionDir(projectDir, agent.definition);\n } catch (e) {\n if (!(e instanceof AgentRefResolutionError)) throw e;\n diagnostics.push(err(\"agent_ref_unresolved\", e.message, \"agent.definition\"));\n }\n }\n if (!instances) return diagnostics;\n\n const connectorIds = (Array.isArray(parsed.connectors) ? parsed.connectors : []).flatMap((c) =>\n isRecord(c) && typeof c.id === \"string\" ? [c.id] : [],\n );\n\n for (const [id, instance] of Object.entries(instances)) {\n const loaded = loadAsset(projectDir, id, instance.ref);\n if (\"diagnostic\" in loaded) {\n // Asset-independent trigger rules still apply when the ref is broken.\n diagnostics.push(loaded.diagnostic, ...checkTriggers(id, instance.triggers ?? [], undefined));\n continue;\n }\n const { facts } = loaded;\n const lifecycle = instance.lifecycle ?? facts.lifecycle ?? \"standing\";\n if (lifecycle === \"role\" && !facts.hasIo) {\n diagnostics.push(\n err(\n \"agent_role_missing_io\",\n `agents.${id}: lifecycle \"role\" needs the agent asset to declare \\`io\\` ({ input, output } JSON Schemas)`,\n `agents.${id}.lifecycle`,\n ),\n );\n }\n diagnostics.push(...checkConnectors(id, instance, facts, connectorIds));\n diagnostics.push(...checkTriggers(id, instance.triggers ?? [], facts.triggerIds));\n }\n return diagnostics;\n}\n","/**\n * Checks of a project's `skaile.yaml` that `validate`, `check`, `doctor` and `run` share:\n * keys nothing reads (p1474) and a `harness:` no harness registers (p1022).\n */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { Diagnostic, SkWorkspaceConfig } from \"@skaile/workspaces/core\";\nimport { loadSkWorkspaceConfig, SKAILE_YAML_DEFAULT } from \"@skaile/workspaces/core\";\nimport { parse as parseYaml } from \"yaml\";\nimport { checkAgentInstances } from \"./commands/validate-instances.ts\";\nimport { unknownHarnessMessage } from \"./harness-error.ts\";\nimport { logErr, logWarn } from \"./helpers.ts\";\nimport { loadDeclaredPlugins } from \"./plugin-store/index.ts\";\n\n/** One warning line per key of the file that nothing reads. */\nexport function unknownKeyWarnings(diagnostics: readonly Diagnostic[], label: string): string[] {\n return diagnostics\n .filter((d) => d.code === \"unknown_config_key\" || d.code === \"unknown_profile_key\")\n .map((d) => `${label}: ${d.message}`);\n}\n\n/**\n * One error line per `agent-config` profile whose `harness:` nothing registers. The harnesses of\n * the plugins the project declares count, so they are loaded before the verdict, and only when\n * some profile names a harness the built-in ones do not.\n *\n * @param projectDir - Project whose `plugins:` are loaded.\n * @param config - The decoded config file.\n * @param label - File name for the line.\n */\nexport async function unknownHarnessErrors(\n projectDir: string,\n config: SkWorkspaceConfig,\n label: string,\n): Promise<string[]> {\n const profiles = Object.entries(config.agent_config ?? {}).filter(\n (e): e is [string, { harness: string }] => typeof e[1]?.harness === \"string\",\n );\n if (profiles.every(([, p]) => unknownHarnessMessage(p.harness) === undefined)) return [];\n await loadDeclaredPlugins(projectDir);\n const errors: string[] = [];\n for (const [name, p] of profiles) {\n const refusal = unknownHarnessMessage(p.harness);\n if (refusal) errors.push(`${label}: agent-config.${name}.harness: ${refusal}`);\n }\n return errors;\n}\n\n/**\n * Print the `✗` line for each `agent-config` profile whose `harness:` nothing registers and\n * return how many were printed. The harness check `install`, `list` and `config show` share with\n * `validate`, `check` and `run` (p1754); a file that does not load is not this function's to\n * report.\n */\nexport async function reportUnknownHarnesses(projectDir: string): Promise<number> {\n let config: SkWorkspaceConfig | undefined;\n try {\n config = loadSkWorkspaceConfig(projectDir)?.config;\n } catch {\n return 0;\n }\n if (!config) return 0;\n const errors = await unknownHarnessErrors(projectDir, config, \"skaile.yaml\");\n for (const line of errors) logErr(line);\n return errors.length;\n}\n\n/** The `agents:` / `agent:` diagnostics of the project's `skaile.yaml` as `validate` gives them. */\nfunction agentInstanceDiagnostics(projectDir: string): Diagnostic[] {\n let parsed: unknown;\n try {\n parsed = parseYaml(fs.readFileSync(path.join(projectDir, SKAILE_YAML_DEFAULT), \"utf-8\"));\n } catch {\n return [];\n }\n if (typeof parsed !== \"object\" || parsed === null) return [];\n return checkAgentInstances(projectDir, parsed as Record<string, unknown>);\n}\n\n/** One line the way `validate` prints a diagnostic of the `agents:` map. */\nfunction agentInstanceLine(d: Diagnostic): string {\n return `${SKAILE_YAML_DEFAULT} [agents] — ${d.code}: ${d.path ? `${d.path}: ` : \"\"}${d.message}`;\n}\n\n/**\n * The errors `skaile validate` gives the `agents:` map of the project's `skaile.yaml`, as the\n * lines `validate` prints (p1512): a lifecycle or memory scope that is none of the known ones, a\n * `role` instance whose agent declares no `io`, a connector or trigger the agent does not have.\n * `install`, `check`, `run`, `repl` and `rebuild` refuse the project with them, so they never\n * accept what `validate` rejects. A ref that does not resolve is left out: `install` resolves a\n * catalog ref itself and `check` reports an unbound ref as a gap.\n *\n * @param projectDir - Project directory.\n */\nexport function agentInstanceErrorLines(projectDir: string): string[] {\n return agentInstanceDiagnostics(projectDir)\n .filter((d) => d.severity === \"error\" && d.code !== \"agent_ref_unresolved\")\n .map(agentInstanceLine);\n}\n\n/**\n * The warnings `skaile validate` gives for keys of `agent:` and `agents:` that nothing reads\n * (p1712), as the lines `validate` prints: `agents.audit.colour`, `agent.modle`,\n * `agents.<id>.model.preffered`. Without them a typo leaves the default model or budget in\n * place and says nothing.\n *\n * @param projectDir - Project directory.\n */\nexport function agentInstanceWarningLines(projectDir: string): string[] {\n return agentInstanceDiagnostics(projectDir)\n .filter(\n (d) =>\n d.severity === \"warning\" &&\n (d.code === \"unknown_agent_instance_key\" || d.code === \"unknown_agent_key\"),\n )\n .map(agentInstanceLine);\n}\n\n/**\n * The checks of the project's own `skaile.yaml`, printed: `!` lines for unknown keys (also the\n * ones of `agent:` and `agents:`, p1712), `✗` lines for an unknown harness and for an `agents:`\n * map `validate` rejects. Returns the number of errors printed. A file that does not load is not\n * this function's to report: the command reads it again and says so.\n *\n * @param projectDir - Project directory.\n * @param opts.harness - Also refuse an unknown `harness:` (`check`, `doctor`).\n * @param opts.instances - Also refuse an `agents:` map `validate` rejects (p1512).\n */\nexport async function reportProjectConfig(\n projectDir: string,\n opts: { harness: boolean; instances?: boolean },\n): Promise<number> {\n let file: ReturnType<typeof loadSkWorkspaceConfig>;\n try {\n file = loadSkWorkspaceConfig(projectDir);\n } catch {\n return 0;\n }\n if (!file) return 0;\n for (const line of unknownKeyWarnings(file.diagnostics ?? [], \"skaile.yaml\")) logWarn(line);\n for (const line of agentInstanceWarningLines(projectDir)) logWarn(line);\n const errors = [\n ...(opts.harness ? await unknownHarnessErrors(projectDir, file.config, \"skaile.yaml\") : []),\n ...(opts.instances ? agentInstanceErrorLines(projectDir) : []),\n ];\n for (const line of errors) logErr(line);\n return errors.length;\n}\n"]}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { unregisteredLibraryNames, renamedLibraryName, resolveConfig, RemoteCatalogSource, OfflineError, describeCatalogError, CatalogHttpError, scanUnlistedAssets, missingRootAssets, storeManifestFile, missingLibraryDirMessage, lastLibraryName, filesEntryPaths } from './chunk-
|
|
2
|
-
import { SEMVER_RE, invalidSemverMessage, flowFileNameError, computeDeterministicHash, readManifestSourceConfig, discoverAssetsInTree, isManifestMode } from './chunk-
|
|
1
|
+
import { unregisteredLibraryNames, renamedLibraryName, resolveConfig, RemoteCatalogSource, OfflineError, describeCatalogError, CatalogHttpError, scanUnlistedAssets, missingRootAssets, storeManifestFile, missingLibraryDirMessage, lastLibraryName, filesEntryPaths } from './chunk-GBXQFJ4G.js';
|
|
2
|
+
import { SEMVER_RE, invalidSemverMessage, flowFileNameError, computeDeterministicHash, readManifestSourceConfig, discoverAssetsInTree, isManifestMode } from './chunk-WENTJ5KP.js';
|
|
3
3
|
import { parseFlowDefinition } from './chunk-JRN5QF4C.js';
|
|
4
|
-
import { installTargetOf, readKeptLegacyCopies, writeKeptLegacyCopies, canonicalEntryRef, diffDeployedAgent, deployedAssetDrift, assertNoLibrarySymlinks, deployAll, removeAsset, composedDriftRefs, sourceComposedFiles, cachedComposedFiles, createScaffold, installAgent } from './chunk-
|
|
4
|
+
import { installTargetOf, readKeptLegacyCopies, writeKeptLegacyCopies, canonicalEntryRef, diffDeployedAgent, deployedAssetDrift, assertNoLibrarySymlinks, deployAll, removeAsset, composedDriftRefs, sourceComposedFiles, cachedComposedFiles, createScaffold, installAgent } from './chunk-YJNE4V2M.js';
|
|
5
5
|
import { appendHistory, getRecentHistory, clearHistory } from './chunk-KTBKW2FI.js';
|
|
6
6
|
import { commitChanges } from './chunk-UQ6LFBPZ.js';
|
|
7
|
-
import { harnessTargetSupportsAgents, CODEX_IDENTITY_DIR, agentRenderFiles } from './chunk-
|
|
7
|
+
import { harnessTargetSupportsAgents, CODEX_IDENTITY_DIR, agentRenderFiles } from './chunk-V4OXHEWY.js';
|
|
8
8
|
import { isScaffoldBody, isScaffoldDescription } from './chunk-76FLBODK.js';
|
|
9
|
-
import { resolveConfiguredHarnessName, FACTORY_SOURCE_URL, GLOBAL_INSTALL_DIR_NAME, resolveLibraryDir, buildLibraryLockEntries, writeLock, computeHash, buildLockFile, readLock, assertLockHashes, verifyLock, mergeLockFile, resyncLockSources, extractForPatch, generatePatch, savePatch, applyPatch, LOCK_SCHEMA_VERSION } from './chunk-
|
|
10
|
-
import { resolveRuntimeAssets, factoryAssetRoots } from './chunk-
|
|
9
|
+
import { resolveConfiguredHarnessName, FACTORY_SOURCE_URL, GLOBAL_INSTALL_DIR_NAME, resolveLibraryDir, buildLibraryLockEntries, writeLock, computeHash, buildLockFile, readLock, assertLockHashes, verifyLock, mergeLockFile, resyncLockSources, extractForPatch, generatePatch, savePatch, applyPatch, LOCK_SCHEMA_VERSION } from './chunk-ABVWUM2E.js';
|
|
10
|
+
import { resolveRuntimeAssets, factoryAssetRoots } from './chunk-3ENE6ZOF.js';
|
|
11
11
|
import { deployedBase, isDeployed, deployedPaths, deployedDir } from './chunk-5KRMNUL4.js';
|
|
12
|
-
import { resolveSkWorkspaceConfig, effectiveAgentInstances, mcpDeclarationFromMdContent, loadMcpServerDeclarations, resolveGlobalHarnesses, resolveGlobalSkWorkspaceConfig, getGlobalCacheDir, sourceCacheKey, getRepoCommit, matchPin, buildProvenanceIndex, coerceVersion, sourceShortName, readLinks, isCommitOnRemote, findWorkspaceRoot, resolveAll, agentSourceCacheDir, ensureRepo, resolveAgentDefinitionDir, scanRepo, SKAILE_YAML_DEFAULT, checkRepoStatus, resolveAsset, MAX_PRESET_DEPTH, PresetDepthError, DEFAULT_AGENT_INSTANCE_ID } from './chunk-
|
|
12
|
+
import { resolveSkWorkspaceConfig, effectiveAgentInstances, mcpDeclarationFromMdContent, loadMcpServerDeclarations, resolveGlobalHarnesses, resolveGlobalSkWorkspaceConfig, getGlobalCacheDir, sourceCacheKey, getRepoCommit, matchPin, buildProvenanceIndex, coerceVersion, sourceShortName, readLinks, isCommitOnRemote, findWorkspaceRoot, resolveAll, agentSourceCacheDir, ensureRepo, resolveAgentDefinitionDir, scanRepo, SKAILE_YAML_DEFAULT, checkRepoStatus, resolveAsset, MAX_PRESET_DEPTH, PresetDepthError, DEFAULT_AGENT_INSTANCE_ID } from './chunk-6WQGJF65.js';
|
|
13
13
|
import { globalSkaileDir, globalCacheRoot, migrateLegacyDir } from './chunk-L5VSIPQD.js';
|
|
14
14
|
import { HARNESS_TARGETS, SUPPORTED_HARNESSES } from './chunk-VTETQCR6.js';
|
|
15
|
-
import { listAssetFiles, loadSkPublishManifest, decodeSkaileManifest, isNonAssetDir, isNonAssetFile } from './chunk-
|
|
16
|
-
import { scanDirectory, parseFrontmatter, parseRequires, dedupeRequirements, readAssetBody } from './chunk-
|
|
15
|
+
import { listAssetFiles, loadSkPublishManifest, decodeSkaileManifest, isNonAssetDir, isNonAssetFile } from './chunk-U6S5CXKB.js';
|
|
16
|
+
import { scanDirectory, parseFrontmatter, parseRequires, dedupeRequirements, readAssetBody } from './chunk-VV2DJT4I.js';
|
|
17
17
|
import { parseAssetRef, parseAssetRefLoose, assetRefToStr, slugifyAssetName, depToStr, parseDep } from './chunk-IZQOO6MN.js';
|
|
18
18
|
import { spawnSync } from 'child_process';
|
|
19
19
|
import { existsSync, rmSync, readFileSync, writeFileSync, readdirSync, lstatSync, statSync, unlinkSync, mkdirSync } from 'fs';
|
|
@@ -128,10 +128,18 @@ function removeAgentInstanceRenderings(opts) {
|
|
|
128
128
|
}
|
|
129
129
|
return removed;
|
|
130
130
|
}
|
|
131
|
+
function readInstanceFile(abs) {
|
|
132
|
+
try {
|
|
133
|
+
return statSync(abs).isDirectory() ? "\0dir" : readFileSync(abs, "utf-8");
|
|
134
|
+
} catch {
|
|
135
|
+
return void 0;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
131
138
|
function installAgentInstances(opts) {
|
|
132
139
|
const { projectDir, harness, log } = opts;
|
|
133
140
|
const result = {
|
|
134
141
|
instances: [],
|
|
142
|
+
changed: [],
|
|
135
143
|
removed: [],
|
|
136
144
|
warnings: [],
|
|
137
145
|
errors: []
|
|
@@ -151,6 +159,9 @@ function installAgentInstances(opts) {
|
|
|
151
159
|
if (previous[id]) owned[id] = previous[id];
|
|
152
160
|
continue;
|
|
153
161
|
}
|
|
162
|
+
const before = /* @__PURE__ */ new Map();
|
|
163
|
+
for (const rel of previous[id] ?? [])
|
|
164
|
+
before.set(rel, readInstanceFile(resolve(projectDir, rel)));
|
|
154
165
|
const rendered = installAgent(
|
|
155
166
|
srcDir,
|
|
156
167
|
agentDeployDir,
|
|
@@ -169,6 +180,13 @@ function installAgentInstances(opts) {
|
|
|
169
180
|
const files = [...new Set(rendered.created)];
|
|
170
181
|
owned[id] = files;
|
|
171
182
|
result.instances.push({ id, files });
|
|
183
|
+
const sameFiles = files.length === before.size && files.every((rel) => before.has(rel));
|
|
184
|
+
if (!sameFiles || files.some((rel) => {
|
|
185
|
+
const old = before.get(rel);
|
|
186
|
+
return old === void 0 || readInstanceFile(resolve(projectDir, rel)) !== old;
|
|
187
|
+
})) {
|
|
188
|
+
result.changed.push(id);
|
|
189
|
+
}
|
|
172
190
|
}
|
|
173
191
|
const claimed = new Set(Object.values(owned).flat());
|
|
174
192
|
const root = resolve(projectDir);
|
|
@@ -1920,6 +1938,7 @@ var AssetManager = class {
|
|
|
1920
1938
|
for (const w of [...result.warnings, ...result.errors]) console.warn(`skaile: ${w}`);
|
|
1921
1939
|
return {
|
|
1922
1940
|
agentInstances: result.instances,
|
|
1941
|
+
agentInstancesChanged: result.changed,
|
|
1923
1942
|
agentFilesRemoved: result.removed,
|
|
1924
1943
|
...result.errors.length > 0 ? { agentInstanceErrors: result.errors } : {},
|
|
1925
1944
|
...details.length > 0 ? { agentInstanceDetails: details } : {}
|
|
@@ -2952,6 +2971,30 @@ var AssetManager = class {
|
|
|
2952
2971
|
})
|
|
2953
2972
|
);
|
|
2954
2973
|
}
|
|
2974
|
+
/**
|
|
2975
|
+
* Whether every declared ref is locked and no declared pin differs from the locked version:
|
|
2976
|
+
* `skaile.yaml` asks for nothing the lock does not hold. A declared preset counts when the
|
|
2977
|
+
* lock records it.
|
|
2978
|
+
*/
|
|
2979
|
+
declaredMatchesLock(lock, declared) {
|
|
2980
|
+
const keys = Object.keys(lock.assets).map((key) => parseCanonicalLockKey(key));
|
|
2981
|
+
for (const d of declared) {
|
|
2982
|
+
const want = parseRefTolerant(d.split(" ")[0] ?? d);
|
|
2983
|
+
if (!want) return false;
|
|
2984
|
+
if (want.kind === "preset") {
|
|
2985
|
+
if (!this.presetRecorded(want)) return false;
|
|
2986
|
+
continue;
|
|
2987
|
+
}
|
|
2988
|
+
const held = keys.filter(
|
|
2989
|
+
(id) => id.kind === want.kind && id.name === want.name && (!want.publisher || !id.publisher || id.publisher === want.publisher)
|
|
2990
|
+
);
|
|
2991
|
+
if (held.length === 0) return false;
|
|
2992
|
+
if (want.pin && !held.some((id) => !id.version || matchPin(want.pin, id.version))) {
|
|
2993
|
+
return false;
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2996
|
+
return true;
|
|
2997
|
+
}
|
|
2955
2998
|
/**
|
|
2956
2999
|
* Lock keys that `skaile.yaml` still wants: the entries a declared ref names, plus every
|
|
2957
3000
|
* entry such an asset requires, transitively. All keys when a `preset:` is declared.
|
|
@@ -2985,7 +3028,12 @@ var AssetManager = class {
|
|
|
2985
3028
|
* assets on this machine (not registered, or registered with its directory gone). Plain
|
|
2986
3029
|
* `install` stops on a non-empty list, the same lines `install --locked` prints: it must
|
|
2987
3030
|
* not re-resolve a locked asset from another origin. The ONE function that decides "the
|
|
2988
|
-
* locked library is not here", so a
|
|
3031
|
+
* locked library is not here", so a store-restore fallback extends it in one place.
|
|
3032
|
+
*
|
|
3033
|
+
* An entry `install --locked` already restored from a store (its library is not registered
|
|
3034
|
+
* here and the store cache holds the locked version, see {@link restoredFromStoreCache}) is no
|
|
3035
|
+
* line: it is returned in `restored`, and plain `install` then restores the lock as
|
|
3036
|
+
* `install --locked` does instead of re-resolving it from another origin (OQ8, p1655).
|
|
2989
3037
|
*
|
|
2990
3038
|
* Only entries `skaile.yaml` still declares, or that a declared asset requires
|
|
2991
3039
|
* (transitively, read from the deployed copy), count. A stale entry nothing declares is
|
|
@@ -3000,21 +3048,26 @@ var AssetManager = class {
|
|
|
3000
3048
|
const locked = Object.entries(lock.assets).filter(
|
|
3001
3049
|
([key, e]) => e.library !== void 0 && !e.library.installed && inScope.has(key)
|
|
3002
3050
|
);
|
|
3003
|
-
if (locked.length === 0) return [];
|
|
3004
|
-
const snap = await this.loadLibraryIndex();
|
|
3005
3051
|
const lines = [];
|
|
3052
|
+
const restored = [];
|
|
3053
|
+
if (locked.length === 0) return { lines, restored };
|
|
3054
|
+
const snap = await this.loadLibraryIndex();
|
|
3006
3055
|
for (const [ref, e] of locked) {
|
|
3007
3056
|
const { publisher, kind, name } = parseCanonicalLockKey(ref);
|
|
3008
3057
|
if (!publisher || !kind || !name) continue;
|
|
3009
3058
|
const lookup = this.lockedLibrary(e.library, snap, { kind, publisher, name });
|
|
3010
3059
|
if (lookup.state === "ok") continue;
|
|
3060
|
+
if (await this.restoredFromStoreCache(ref, e, snap)) {
|
|
3061
|
+
restored.push(ref);
|
|
3062
|
+
continue;
|
|
3063
|
+
}
|
|
3011
3064
|
const component = this.installTarget(kind);
|
|
3012
3065
|
const deployed = component !== void 0 && isDeployed(component, name, this.harness, this.global, this.projectDir);
|
|
3013
3066
|
const problem = lockedLibraryProblem(lookup, e.library, `${kind}:@${publisher}/${name}`);
|
|
3014
3067
|
const kept = deployed ? "the deployed copy and its lock entry are kept" : "its lock entry is kept; no deployed copy exists";
|
|
3015
3068
|
lines.push(`${ref} (${problem}; ${kept})`);
|
|
3016
3069
|
}
|
|
3017
|
-
return lines;
|
|
3070
|
+
return { lines, restored };
|
|
3018
3071
|
}
|
|
3019
3072
|
/**
|
|
3020
3073
|
* Re-resolve every library-origin lock entry from its named library, for
|
|
@@ -3023,17 +3076,21 @@ var AssetManager = class {
|
|
|
3023
3076
|
* version; anything else is reported in `missing` with the reason.
|
|
3024
3077
|
*
|
|
3025
3078
|
* @param opts.storeFallback - `install --locked` only: an entry whose library is not registered
|
|
3026
|
-
* here is restored from a store that serves the locked sha256 (OQ15, p1490).
|
|
3027
|
-
* the
|
|
3079
|
+
* here is restored from a store that serves the locked sha256 (OQ8, OQ15, p1490, p1655). The
|
|
3080
|
+
* lock records the library's remote and hash but no commit and no file list, so the library
|
|
3081
|
+
* remote itself cannot be fetched at a locked commit; the store pointer names the upstream
|
|
3082
|
+
* repository and commit that hold exactly the hashed bytes. Reads such as the drift check
|
|
3083
|
+
* never ask a store.
|
|
3028
3084
|
*/
|
|
3029
3085
|
async restoreLibraryLockEntries(lock, opts) {
|
|
3030
3086
|
const entries = [];
|
|
3031
3087
|
const missing = [];
|
|
3032
3088
|
const viaStore = [];
|
|
3089
|
+
const storeOrigins = {};
|
|
3033
3090
|
const locked = Object.entries(lock.assets).filter(
|
|
3034
3091
|
([, e]) => e.library !== void 0 && !e.library.installed
|
|
3035
3092
|
);
|
|
3036
|
-
if (locked.length === 0) return { entries, missing, viaStore };
|
|
3093
|
+
if (locked.length === 0) return { entries, missing, viaStore, storeOrigins };
|
|
3037
3094
|
const snap = await this.loadLibraryIndex();
|
|
3038
3095
|
const diskHashes = /* @__PURE__ */ new Map();
|
|
3039
3096
|
const fileSets = /* @__PURE__ */ new Map();
|
|
@@ -3048,8 +3105,9 @@ var AssetManager = class {
|
|
|
3048
3105
|
if (lookup.state !== "ok") {
|
|
3049
3106
|
const fallback = lookup.state === "unregistered" && opts?.storeFallback ? await this.storeEntryForLockedLibraryAsset(publisher, kind, name, origin) : null;
|
|
3050
3107
|
if (fallback) {
|
|
3051
|
-
entries.push(fallback);
|
|
3108
|
+
entries.push(fallback.entry);
|
|
3052
3109
|
viaStore.push(ref);
|
|
3110
|
+
storeOrigins[ref] = fallback.from;
|
|
3053
3111
|
continue;
|
|
3054
3112
|
}
|
|
3055
3113
|
missing.push(
|
|
@@ -3094,17 +3152,21 @@ var AssetManager = class {
|
|
|
3094
3152
|
found.version = sameVersion ? origin.version : current;
|
|
3095
3153
|
entries.push(withLibraryFiles(found, libPath, fileSets, this.registry));
|
|
3096
3154
|
}
|
|
3097
|
-
return { entries, missing, viaStore };
|
|
3155
|
+
return { entries, missing, viaStore, storeOrigins };
|
|
3098
3156
|
}
|
|
3099
3157
|
/**
|
|
3100
|
-
* Whether a library-origin lock entry was restored from
|
|
3158
|
+
* Whether a library-origin lock entry was restored from a store: its library is not
|
|
3101
3159
|
* registered here, and the project's store cache holds the locked version (`install --locked`
|
|
3102
|
-
* fetched and SHA-verified
|
|
3103
|
-
* as restorable as a source- or store-origin one: `check
|
|
3104
|
-
* from the deployed copy and do not ask for the library (OQ8,
|
|
3105
|
-
* that never restored anything here stays a gap.
|
|
3160
|
+
* fetched it there and SHA-verified every file against the sha256 the lock recorded). Such an
|
|
3161
|
+
* entry is as restorable as a source- or store-origin one: `check`, `doctor` and plain
|
|
3162
|
+
* `install` read its requirements from the deployed copy and do not ask for the library (OQ8,
|
|
3163
|
+
* p1655). An unregistered library that never restored anything here stays a gap.
|
|
3164
|
+
*
|
|
3165
|
+
* This only checks that the cache directory of the locked version is not empty: the bytes were
|
|
3166
|
+
* verified when they were fetched, and a later edit of the deployed copy is the `modified`
|
|
3167
|
+
* drift check's job, not this one's.
|
|
3106
3168
|
*/
|
|
3107
|
-
async
|
|
3169
|
+
async restoredFromStoreCache(key, entry, snap) {
|
|
3108
3170
|
const origin = entry.library;
|
|
3109
3171
|
if (!origin || origin.installed || !origin.sha256 || !origin.version) return false;
|
|
3110
3172
|
if (isPseudoVersion(origin.version)) return false;
|
|
@@ -3124,7 +3186,8 @@ var AssetManager = class {
|
|
|
3124
3186
|
* store (project `stores:` or the global catalog) that serves `kind:@publisher/name#version`
|
|
3125
3187
|
* under the very sha256 the lock recorded holds the same bytes. The entry is fetched and
|
|
3126
3188
|
* verified like any store asset; the lock stays as it is. `null` when the lock has no hash,
|
|
3127
|
-
* no store answers, or the hash differs (OQ15, p1490).
|
|
3189
|
+
* no store answers, or the hash differs (OQ15, p1490). `from` names the store and the
|
|
3190
|
+
* upstream repository and commit its pointer gives, for the notice.
|
|
3128
3191
|
*/
|
|
3129
3192
|
async storeEntryForLockedLibraryAsset(publisher, kind, name, origin) {
|
|
3130
3193
|
if (!origin.sha256 || !origin.version || isPseudoVersion(origin.version)) return null;
|
|
@@ -3155,7 +3218,12 @@ var AssetManager = class {
|
|
|
3155
3218
|
],
|
|
3156
3219
|
repositories
|
|
3157
3220
|
);
|
|
3158
|
-
if (entry)
|
|
3221
|
+
if (entry) {
|
|
3222
|
+
return {
|
|
3223
|
+
entry,
|
|
3224
|
+
from: `${store.url} (${sourceShortName(m.sourceUrl)}@${m.commit.slice(0, 7)})`
|
|
3225
|
+
};
|
|
3226
|
+
}
|
|
3159
3227
|
} catch (err) {
|
|
3160
3228
|
this.noteStoreFailure(store.url, err);
|
|
3161
3229
|
}
|
|
@@ -3942,18 +4010,25 @@ var AssetManager = class {
|
|
|
3942
4010
|
return this.installLocked(repositories, patches, dependencies);
|
|
3943
4011
|
}
|
|
3944
4012
|
const lockForLibraries = this.tryReadLock();
|
|
4013
|
+
const restoredFromStore = /* @__PURE__ */ new Set();
|
|
3945
4014
|
if (lockForLibraries) {
|
|
3946
4015
|
const unavailable = await this.unavailableLockedLibraries(lockForLibraries, dependencies);
|
|
3947
|
-
|
|
4016
|
+
for (const key of unavailable.restored) restoredFromStore.add(key);
|
|
4017
|
+
if (unavailable.lines.length > 0) {
|
|
3948
4018
|
return {
|
|
3949
4019
|
deployed: [],
|
|
3950
4020
|
removed: [],
|
|
3951
|
-
missing: unavailable,
|
|
4021
|
+
missing: unavailable.lines,
|
|
3952
4022
|
lockWritten: false,
|
|
3953
4023
|
npmInstalled: [],
|
|
3954
4024
|
npmFailed: []
|
|
3955
4025
|
};
|
|
3956
4026
|
}
|
|
4027
|
+
if (unavailable.restored.length > 0 && this.declaredMatchesLock(lockForLibraries, dependencies) && [...await this.declaredLockKeys(lockForLibraries, dependencies)].every(
|
|
4028
|
+
(key) => restoredFromStore.has(key)
|
|
4029
|
+
)) {
|
|
4030
|
+
return this.installLocked(repositories, patches, dependencies);
|
|
4031
|
+
}
|
|
3957
4032
|
const orphans = await this.orphanedSourceGaps(
|
|
3958
4033
|
await this.declaredLockKeys(lockForLibraries, dependencies),
|
|
3959
4034
|
true
|
|
@@ -4070,6 +4145,27 @@ var AssetManager = class {
|
|
|
4070
4145
|
const entries = [...await this.buildCatalogEntries(resolved, repositories), ...lib.entries];
|
|
4071
4146
|
assertFlowsLoad(entries, "installed");
|
|
4072
4147
|
assertNoLibrarySymlinks(entries, this.registry, repositories, opts?.link === true);
|
|
4148
|
+
if (libraryAssetCheck && lib.entries.length > 0) {
|
|
4149
|
+
const lockedIds = new Set([...lockedKeys].map((k) => k.split("#")[0]));
|
|
4150
|
+
const snap = await this.loadLibraryIndex();
|
|
4151
|
+
for (const e of lib.entries) {
|
|
4152
|
+
if (lockedIds.has(canonicalEntryRef(e).split("#")[0])) continue;
|
|
4153
|
+
const origin = lib.libraryOf.get(e);
|
|
4154
|
+
const libPath = origin ? this.libraryPath({ name: origin }, snap) : null;
|
|
4155
|
+
if (!origin || !libPath || !e.source) continue;
|
|
4156
|
+
const lines = libraryAssetCheck(
|
|
4157
|
+
{ kind: e.kind, name: e.name, source: e.source },
|
|
4158
|
+
libPath
|
|
4159
|
+
).filter((l) => /placeholder/i.test(l));
|
|
4160
|
+
if (lines.length > 0) {
|
|
4161
|
+
throw new Error(
|
|
4162
|
+
`${canonicalEntryRef(e)} in library "${origin}" fails the checks of \`skaile validate\` - nothing was installed:
|
|
4163
|
+
${lines.map((l) => ` ${l}`).join("\n")}
|
|
4164
|
+
Fix the asset, then run \`skaile library index ${origin}\` and install again.`
|
|
4165
|
+
);
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
}
|
|
4073
4169
|
const forceCommand = opts?.moveLibraries === true ? "skaile update --force" : "skaile install --force";
|
|
4074
4170
|
if (!opts?.force) {
|
|
4075
4171
|
await this.assertNoHandEditsPruned(
|
|
@@ -4147,8 +4243,15 @@ var AssetManager = class {
|
|
|
4147
4243
|
}
|
|
4148
4244
|
this.recordInstallHistory(deployed, removed);
|
|
4149
4245
|
const { npmInstalled, npmFailed } = await this.installRuntimeAssetDeps();
|
|
4150
|
-
const
|
|
4246
|
+
const restoredRefs = stillMissing.filter((m) => {
|
|
4247
|
+
const keys = kept.keysByRef.get(m) ?? [];
|
|
4248
|
+
return keys.length > 0 && keys.every((k) => restoredFromStore.has(k));
|
|
4249
|
+
});
|
|
4250
|
+
const reportedMissing = stillMissing.filter(
|
|
4251
|
+
(m) => !storeNotChecked.some((n) => n.ref === m) && !restoredRefs.includes(m)
|
|
4252
|
+
);
|
|
4151
4253
|
for (const n of storeNotChecked) delete missingHints[n.ref];
|
|
4254
|
+
for (const m of restoredRefs) delete missingHints[m];
|
|
4152
4255
|
await this.adviseMissing(reportedMissing, missingHints);
|
|
4153
4256
|
const placeholderBodies = scaffoldBodyRefs(lib.entries, deployed);
|
|
4154
4257
|
const placeholderDescriptions = scaffoldDescriptionRefs(lib.entries, deployed);
|
|
@@ -4564,7 +4667,11 @@ Nothing was changed. Move your edits away, or run \`${forceCommand}\` to overwri
|
|
|
4564
4667
|
).split(sep).join("/");
|
|
4565
4668
|
files = files.map((f) => `${dir}/${f}`);
|
|
4566
4669
|
}
|
|
4567
|
-
if (files.length > 0)
|
|
4670
|
+
if (files.length > 0) {
|
|
4671
|
+
lines.push(
|
|
4672
|
+
d.unrecorded ? `${d.ref} (${files.join(", ")} differs from the library's content now; the lock keeps no per-file record, so it may be a library change, not your edit)` : `${d.ref} (${files.join(", ")} was edited)`
|
|
4673
|
+
);
|
|
4674
|
+
}
|
|
4568
4675
|
}
|
|
4569
4676
|
if (lines.length === 0) return;
|
|
4570
4677
|
throw new Error(
|
|
@@ -4939,7 +5046,7 @@ Nothing was changed. Copy your edits away, or run \`${forceCommand}\` to replace
|
|
|
4939
5046
|
const p = parseRefTolerant(g.ref);
|
|
4940
5047
|
return !(p && alreadyMissing.has(`${p.kind}:${p.name}`));
|
|
4941
5048
|
}).map((g) => g.message);
|
|
4942
|
-
const libraryNotices = this.
|
|
5049
|
+
const libraryNotices = this.storeRestoreNotices(lock, library.viaStore, library.storeOrigins);
|
|
4943
5050
|
const placeholderBodies = scaffoldBodyRefs(library.entries, deployed);
|
|
4944
5051
|
const placeholderDescriptions = scaffoldDescriptionRefs(library.entries, deployed);
|
|
4945
5052
|
return {
|
|
@@ -4958,22 +5065,31 @@ Nothing was changed. Copy your edits away, or run \`${forceCommand}\` to replace
|
|
|
4958
5065
|
}
|
|
4959
5066
|
/**
|
|
4960
5067
|
* One notice line per locked library that is not registered here and whose assets
|
|
4961
|
-
* `install --locked` restored from
|
|
4962
|
-
*
|
|
5068
|
+
* `install --locked` restored from a store: names the library, how many assets came from
|
|
5069
|
+
* which store (and the upstream repository and commit its pointer names), and how to register
|
|
5070
|
+
* the library to move the lock later (OQ8, p1655). Every file was SHA-verified against the
|
|
5071
|
+
* hash the lock recorded.
|
|
4963
5072
|
*/
|
|
4964
|
-
|
|
5073
|
+
storeRestoreNotices(lock, viaStore, storeOrigins) {
|
|
4965
5074
|
const byLibrary = /* @__PURE__ */ new Map();
|
|
4966
5075
|
for (const key of viaStore) {
|
|
4967
5076
|
const origin = lock.assets[key]?.library;
|
|
4968
5077
|
if (!origin) continue;
|
|
4969
5078
|
const name = unregisteredLibraryName(origin);
|
|
4970
|
-
const row = byLibrary.get(name) ?? {
|
|
5079
|
+
const row = byLibrary.get(name) ?? {
|
|
5080
|
+
...origin.url ? { url: origin.url } : {},
|
|
5081
|
+
refs: [],
|
|
5082
|
+
from: /* @__PURE__ */ new Set()
|
|
5083
|
+
};
|
|
4971
5084
|
row.refs.push(key);
|
|
5085
|
+
const from = storeOrigins[key];
|
|
5086
|
+
if (from) row.from.add(from);
|
|
4972
5087
|
byLibrary.set(name, row);
|
|
4973
5088
|
}
|
|
4974
|
-
return [...byLibrary].map(([name, { url, refs }]) => {
|
|
5089
|
+
return [...byLibrary].map(([name, { url, refs, from }]) => {
|
|
4975
5090
|
const register = url ? `skaile library init ${name} --git ${url}` : `skaile library init ${name} --path <dir>`;
|
|
4976
|
-
|
|
5091
|
+
const where = from.size > 0 ? ` from the store ${[...from].join(", ")}` : " from a store";
|
|
5092
|
+
return `Library "${name}" is not registered here: restored ${refs.length} asset${refs.length === 1 ? "" : "s"}${where}, every file checked against the lock. Register it with \`${register}\` to move the lock later.`;
|
|
4977
5093
|
});
|
|
4978
5094
|
}
|
|
4979
5095
|
/**
|
|
@@ -7500,7 +7616,7 @@ Fix the asset in the source repo, then run \`skaile source sync\` and add it aga
|
|
|
7500
7616
|
break;
|
|
7501
7617
|
}
|
|
7502
7618
|
librarySnap ??= { snap: await this.loadLibraryIndex() };
|
|
7503
|
-
if (await this.
|
|
7619
|
+
if (await this.restoredFromStoreCache(key, e, librarySnap.snap)) {
|
|
7504
7620
|
restorable = true;
|
|
7505
7621
|
break;
|
|
7506
7622
|
}
|
|
@@ -7702,11 +7818,15 @@ Fix the asset in the source repo, then run \`skaile source sync\` and add it aga
|
|
|
7702
7818
|
named.add(gapIdentity(ref));
|
|
7703
7819
|
}
|
|
7704
7820
|
for (const d of await this.lockedCopyDrift()) {
|
|
7705
|
-
if (named.has(gapIdentity(d.ref)))
|
|
7821
|
+
if (named.has(gapIdentity(d.ref))) {
|
|
7822
|
+
const at = d.libraryChanged ? gaps.findIndex((g) => g.type === "content" && gapIdentity(g.ref) === gapIdentity(d.ref)) : -1;
|
|
7823
|
+
if (at < 0) continue;
|
|
7824
|
+
gaps.splice(at, 1);
|
|
7825
|
+
}
|
|
7706
7826
|
const parts = [
|
|
7707
7827
|
...d.modified.map((f) => {
|
|
7708
7828
|
const instance = d.instanceOf?.get(f);
|
|
7709
|
-
return instance ? `${f}, the file of agent instance "${instance}", was edited` : `${f} was edited`;
|
|
7829
|
+
return instance ? `${f}, the file of agent instance "${instance}", was edited` : d.unrecorded ? `${f} differs from the library's content now (the lock keeps no per-file record: it may be a library change, not your edit)` : `${f} was edited`;
|
|
7710
7830
|
}),
|
|
7711
7831
|
...d.extra.map((f) => `${f} is not part of the asset`)
|
|
7712
7832
|
];
|
|
@@ -7995,7 +8115,7 @@ Fix the asset in the source repo, then run \`skaile source sync\` and add it aga
|
|
|
7995
8115
|
continue;
|
|
7996
8116
|
}
|
|
7997
8117
|
if (lookup.state === "unregistered") {
|
|
7998
|
-
if (await this.
|
|
8118
|
+
if (await this.restoredFromStoreCache(key, entry, snap)) continue;
|
|
7999
8119
|
const reason2 = `is locked, but library "${unregisteredLibraryName(origin)}" is not registered (renamed or removed?) \u2014 ${unregisteredLibraryFix(origin, ref)}`;
|
|
8000
8120
|
gaps.push({ type: "library", ref, reason: reason2, message: `${ref} ${reason2}`, manualFix: true });
|
|
8001
8121
|
continue;
|
|
@@ -8439,7 +8559,15 @@ Fix the asset in the source repo, then run \`skaile source sync\` and add it aga
|
|
|
8439
8559
|
})?.modified ?? [];
|
|
8440
8560
|
}
|
|
8441
8561
|
if (modified.length > 0) {
|
|
8442
|
-
out.push({
|
|
8562
|
+
out.push({
|
|
8563
|
+
ref,
|
|
8564
|
+
key,
|
|
8565
|
+
modified,
|
|
8566
|
+
extra: [],
|
|
8567
|
+
library: true,
|
|
8568
|
+
libraryChanged: true,
|
|
8569
|
+
...entry.copied && entry.copied.length > 0 ? {} : { unrecorded: true }
|
|
8570
|
+
});
|
|
8443
8571
|
}
|
|
8444
8572
|
}
|
|
8445
8573
|
return out;
|
|
@@ -8487,15 +8615,10 @@ Fix the asset in the source repo, then run \`skaile source sync\` and add it aga
|
|
|
8487
8615
|
const ref = `${e.kind}:@${(e.publisher ?? "").replace(/^@/, "")}/${e.name}`;
|
|
8488
8616
|
out.push({ ref, key: keyOf.get(ref) ?? ref, ...drift, library: true });
|
|
8489
8617
|
}
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
lock,
|
|
8493
|
-
new Set(
|
|
8494
|
-
entries.map((e) => `${e.kind}:@${(e.publisher ?? "").replace(/^@/, "")}/${e.name}`)
|
|
8495
|
-
),
|
|
8496
|
-
patches
|
|
8497
|
-
)
|
|
8618
|
+
const restoredRefs = new Set(
|
|
8619
|
+
entries.map((e) => `${e.kind}:@${(e.publisher ?? "").replace(/^@/, "")}/${e.name}`)
|
|
8498
8620
|
);
|
|
8621
|
+
out.push(...await this.changedLibraryCopyEdits(lock, restoredRefs, patches));
|
|
8499
8622
|
for (const [key, entry] of Object.entries(lock.assets)) {
|
|
8500
8623
|
if (!entry.source || entry.files.length === 0) continue;
|
|
8501
8624
|
const { kind, name } = parseCanonicalLockKey(key);
|
|
@@ -8529,6 +8652,7 @@ Fix the asset in the source repo, then run \`skaile source sync\` and add it aga
|
|
|
8529
8652
|
if (modified.length > 0 || extra.length > 0)
|
|
8530
8653
|
out.push({ ref: refOf(key), key, modified, extra, library: false });
|
|
8531
8654
|
}
|
|
8655
|
+
let snapForAgents;
|
|
8532
8656
|
for (const [key, entry] of Object.entries(lock.assets)) {
|
|
8533
8657
|
const recorded = [...entry.rendered ?? [], ...entry.composed ?? []];
|
|
8534
8658
|
if (recorded.length === 0 || entry.library?.installed) continue;
|
|
@@ -8550,12 +8674,24 @@ Fix the asset in the source repo, then run \`skaile source sync\` and add it aga
|
|
|
8550
8674
|
for (const inst of renderedInstanceFiles(this.projectDir, this.harness)) {
|
|
8551
8675
|
for (const f of inst.files) if (modified.includes(f)) instanceOf.set(f, inst.id);
|
|
8552
8676
|
}
|
|
8677
|
+
let libraryChanged = false;
|
|
8678
|
+
const origin = entry.library;
|
|
8679
|
+
const id = parseCanonicalLockKey(key);
|
|
8680
|
+
if (origin && id.publisher && !restoredRefs.has(refOf(key))) {
|
|
8681
|
+
snapForAgents ??= await this.loadLibraryIndex();
|
|
8682
|
+
libraryChanged = this.lockedLibrary(origin, snapForAgents, {
|
|
8683
|
+
kind,
|
|
8684
|
+
publisher: id.publisher,
|
|
8685
|
+
name
|
|
8686
|
+
}).state === "ok";
|
|
8687
|
+
}
|
|
8553
8688
|
out.push({
|
|
8554
8689
|
ref: refOf(key),
|
|
8555
8690
|
key,
|
|
8556
8691
|
modified,
|
|
8557
8692
|
extra: [],
|
|
8558
8693
|
library: false,
|
|
8694
|
+
...libraryChanged ? { libraryChanged: true } : {},
|
|
8559
8695
|
rendered: true,
|
|
8560
8696
|
lockedSha: new Map(recorded.map((f) => [f.path, f.sha256])),
|
|
8561
8697
|
instanceOf
|
|
@@ -9167,5 +9303,5 @@ Fix the asset in the source repo, then run \`skaile source sync\` and add it aga
|
|
|
9167
9303
|
};
|
|
9168
9304
|
|
|
9169
9305
|
export { AssetManager, LibraryEntryError, MissingManifestError, installAgentInstances, labelDiffHeaders, mcpNotRunnableReason, normalizeRepoUrl, parseCanonicalLockKey, parseRefTolerant, renderMcpServerConfig, setLibraryAssetCheck, setRenamedEntryLookup, softDepName };
|
|
9170
|
-
//# sourceMappingURL=chunk-
|
|
9171
|
-
//# sourceMappingURL=chunk-
|
|
9306
|
+
//# sourceMappingURL=chunk-TGB4E5Z6.js.map
|
|
9307
|
+
//# sourceMappingURL=chunk-TGB4E5Z6.js.map
|