@skaile/workspaces 1.15.1 → 2.0.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 +271 -0
- package/dist/{asset-feeds-MWEMXMZA.js → asset-feeds-7VQVISDI.js} +25 -24
- package/dist/asset-feeds-7VQVISDI.js.map +1 -0
- package/dist/asset-manager/catalog-deployer.js +13 -1
- package/dist/asset-manager/index.js +10 -9
- package/dist/asset-manager/installer.js +7 -6
- package/dist/asset-manager/src/catalog-deployer.d.ts +70 -5
- package/dist/asset-manager/src/catalog-deployer.d.ts.map +1 -1
- package/dist/asset-manager/src/index.d.ts +22 -17
- package/dist/asset-manager/src/index.d.ts.map +1 -1
- package/dist/bridge/drivers/claude-sdk.js +108 -56
- package/dist/bridge/drivers/claude-sdk.js.map +1 -1
- package/dist/bridge/drivers/codex.js +3 -2
- package/dist/bridge/drivers/codex.js.map +1 -1
- package/dist/bridge/drivers/continue.js +4 -3
- package/dist/bridge/drivers/continue.js.map +1 -1
- package/dist/bridge/drivers/echo.js +3 -2
- package/dist/bridge/drivers/echo.js.map +1 -1
- package/dist/bridge/drivers/gemini.js +5 -4
- package/dist/bridge/drivers/goose.js +4 -3
- package/dist/bridge/drivers/goose.js.map +1 -1
- package/dist/bridge/drivers/omp.js +3 -2
- package/dist/bridge/drivers/omp.js.map +1 -1
- package/dist/bridge/drivers/opencode.js +4 -3
- package/dist/bridge/drivers/opencode.js.map +1 -1
- package/dist/bridge/drivers/qwen.js +5 -4
- package/dist/bridge/drivers/qwen.js.map +1 -1
- package/dist/bridge/index.js +4 -3
- package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
- package/dist/bridge/src/drivers/scrub-transcript.d.ts +21 -1
- package/dist/bridge/src/drivers/scrub-transcript.d.ts.map +1 -1
- package/dist/{chunk-344DEXZS.js → chunk-35ELAMQ5.js} +4 -4
- package/dist/{chunk-344DEXZS.js.map → chunk-35ELAMQ5.js.map} +1 -1
- package/dist/{chunk-73HV7RV3.js → chunk-6FJH63NN.js} +4 -4
- package/dist/{chunk-73HV7RV3.js.map → chunk-6FJH63NN.js.map} +1 -1
- package/dist/{chunk-ISA7R7PK.js → chunk-72EOJJOM.js} +82 -38
- package/dist/chunk-72EOJJOM.js.map +1 -0
- package/dist/chunk-7GOCNYUV.js +300 -0
- package/dist/chunk-7GOCNYUV.js.map +1 -0
- package/dist/{chunk-TFIFNDT2.js → chunk-A5OYCQGT.js} +4 -4
- package/dist/{chunk-TFIFNDT2.js.map → chunk-A5OYCQGT.js.map} +1 -1
- package/dist/{chunk-KY5NY7LB.js → chunk-BCTU4TN7.js} +11 -11
- package/dist/chunk-BCTU4TN7.js.map +1 -0
- package/dist/chunk-BEAIJRVF.js +159 -0
- package/dist/chunk-BEAIJRVF.js.map +1 -0
- package/dist/chunk-BK3WL3QK.js +10 -0
- package/dist/chunk-BK3WL3QK.js.map +1 -0
- package/dist/{chunk-BI2NKPA4.js → chunk-CA5CWLGN.js} +3 -2
- package/dist/chunk-CA5CWLGN.js.map +1 -0
- package/dist/{chunk-2TSSCHCQ.js → chunk-CKVIN4H3.js} +5 -5
- package/dist/{chunk-2TSSCHCQ.js.map → chunk-CKVIN4H3.js.map} +1 -1
- package/dist/{chunk-GXC3TYMQ.js → chunk-CZZRDYT4.js} +70 -32
- package/dist/chunk-CZZRDYT4.js.map +1 -0
- package/dist/{chunk-MNKUZUN2.js → chunk-DRXDEL3A.js} +3 -3
- package/dist/{chunk-MNKUZUN2.js.map → chunk-DRXDEL3A.js.map} +1 -1
- package/dist/{chunk-Z6NGK5YC.js → chunk-DY2AK577.js} +3 -3
- package/dist/{chunk-Z6NGK5YC.js.map → chunk-DY2AK577.js.map} +1 -1
- package/dist/chunk-DYMWJAL4.js +552 -0
- package/dist/chunk-DYMWJAL4.js.map +1 -0
- package/dist/{chunk-ACXLKNIM.js → chunk-E7HKNQTH.js} +10 -4
- package/dist/chunk-E7HKNQTH.js.map +1 -0
- package/dist/{chunk-O5VCUU6D.js → chunk-KUZEIKZH.js} +4 -4
- package/dist/{chunk-O5VCUU6D.js.map → chunk-KUZEIKZH.js.map} +1 -1
- package/dist/{chunk-RADBQ5XJ.js → chunk-KYLWY3A7.js} +10 -10
- package/dist/{chunk-RADBQ5XJ.js.map → chunk-KYLWY3A7.js.map} +1 -1
- package/dist/{chunk-2BQBWWFX.js → chunk-LBZP2IYG.js} +6 -6
- package/dist/chunk-LBZP2IYG.js.map +1 -0
- package/dist/{chunk-MZV6WCF3.js → chunk-MAN7AGQJ.js} +3 -3
- package/dist/{chunk-MZV6WCF3.js.map → chunk-MAN7AGQJ.js.map} +1 -1
- package/dist/{chunk-7J7LQP6T.js → chunk-MMD2KQ3A.js} +31 -19
- package/dist/chunk-MMD2KQ3A.js.map +1 -0
- package/dist/{chunk-NRXVS7E4.js → chunk-NYCJ7B27.js} +19 -11
- package/dist/chunk-NYCJ7B27.js.map +1 -0
- package/dist/{chunk-ACWCVB5Q.js → chunk-ORZW7MMO.js} +3 -3
- package/dist/{chunk-ACWCVB5Q.js.map → chunk-ORZW7MMO.js.map} +1 -1
- package/dist/{chunk-M5GJT3D7.js → chunk-OYX22NJL.js} +3 -3
- package/dist/{chunk-M5GJT3D7.js.map → chunk-OYX22NJL.js.map} +1 -1
- package/dist/{chunk-MJEUK6VJ.js → chunk-QIQTYN7F.js} +3 -3
- package/dist/{chunk-MJEUK6VJ.js.map → chunk-QIQTYN7F.js.map} +1 -1
- package/dist/{chunk-2IJFUAZB.js → chunk-RK3HU3H3.js} +123 -18
- package/dist/chunk-RK3HU3H3.js.map +1 -0
- package/dist/{chunk-5NZ56R63.js → chunk-ST3DLLNZ.js} +18 -6
- package/dist/chunk-ST3DLLNZ.js.map +1 -0
- package/dist/{chunk-MTM6C7IS.js → chunk-SVL4EZJT.js} +463 -251
- package/dist/chunk-SVL4EZJT.js.map +1 -0
- package/dist/{chunk-JB35MVBN.js → chunk-U5POE4BA.js} +4 -298
- package/dist/chunk-U5POE4BA.js.map +1 -0
- package/dist/{chunk-DB264AVQ.js → chunk-UAQVFATZ.js} +8 -8
- package/dist/{chunk-DB264AVQ.js.map → chunk-UAQVFATZ.js.map} +1 -1
- package/dist/{chunk-DPUZJI45.js → chunk-UVW3R6S7.js} +72 -37
- package/dist/chunk-UVW3R6S7.js.map +1 -0
- package/dist/{chunk-STQOPWPS.js → chunk-VCU4NPUS.js} +4 -4
- package/dist/{chunk-STQOPWPS.js.map → chunk-VCU4NPUS.js.map} +1 -1
- package/dist/{chunk-MB6563TL.js → chunk-WCWXDW22.js} +3 -3
- package/dist/{chunk-MB6563TL.js.map → chunk-WCWXDW22.js.map} +1 -1
- package/dist/{chunk-EKGB4ZWR.js → chunk-WZPADAE7.js} +255 -136
- package/dist/chunk-WZPADAE7.js.map +1 -0
- package/dist/{chunk-SRWIVMJI.js → chunk-Y3JVBJ3Y.js} +5 -5
- package/dist/{chunk-SRWIVMJI.js.map → chunk-Y3JVBJ3Y.js.map} +1 -1
- package/dist/{chunk-3EBFDMZC.js → chunk-Y662DNQQ.js} +14 -3
- package/dist/chunk-Y662DNQQ.js.map +1 -0
- package/dist/cli/index.js +348 -128
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/src/asset-feeds.d.ts +2 -2
- package/dist/cli/src/asset-feeds.d.ts.map +1 -1
- package/dist/cli/src/commands/catalog.d.ts +51 -2
- package/dist/cli/src/commands/catalog.d.ts.map +1 -1
- package/dist/cli/src/commands/connector.d.ts +1 -1
- package/dist/cli/src/commands/connector.d.ts.map +1 -1
- package/dist/cli/src/commands/logs.d.ts.map +1 -1
- package/dist/cli/src/commands/manage.d.ts +30 -3
- package/dist/cli/src/commands/manage.d.ts.map +1 -1
- package/dist/cli/src/commands/project.d.ts +5 -2
- package/dist/cli/src/commands/project.d.ts.map +1 -1
- package/dist/connectors/config.js +7 -6
- package/dist/connectors/index.js +9 -8
- package/dist/connectors/src/connector-manager.d.ts.map +1 -1
- package/dist/connectors/src/connector-prompt.d.ts.map +1 -1
- package/dist/connectors/src/watcher.d.ts.map +1 -1
- package/dist/connectors/src/worktree.d.ts +20 -2
- package/dist/connectors/src/worktree.d.ts.map +1 -1
- package/dist/core/index.js +6 -5
- package/dist/core/logging.js +2 -1
- package/dist/core/manifest.js +2 -1
- package/dist/core/runtime-assets.js +4 -3
- package/dist/core/src/fs-deadline.d.ts +84 -0
- package/dist/core/src/fs-deadline.d.ts.map +1 -0
- package/dist/core/src/index.d.ts +4 -3
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/manifest.d.ts +142 -18
- package/dist/core/src/manifest.d.ts.map +1 -1
- package/dist/core/src/repo-manager.d.ts +2 -2
- package/dist/core/src/repo-manager.d.ts.map +1 -1
- package/dist/core/src/runtime-assets.d.ts.map +1 -1
- package/dist/core/src/subprocess.d.ts +33 -1
- package/dist/core/src/subprocess.d.ts.map +1 -1
- package/dist/core/src/walker.d.ts +1 -1
- package/dist/core/src/walker.d.ts.map +1 -1
- package/dist/core/src/workspace-config.d.ts +9 -2
- package/dist/core/src/workspace-config.d.ts.map +1 -1
- package/dist/core/workspace-config.js +3 -2
- package/dist/deploy/index.js +12 -7
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/src/targets/container-runtime.d.ts.map +1 -1
- package/dist/discovery/index.js +3 -2
- package/dist/{ensure-sources-QGL44IRI.js → ensure-sources-JLVHHZI2.js} +13 -12
- package/dist/ensure-sources-JLVHHZI2.js.map +1 -0
- package/dist/factory-assets/connectors/box.js +9 -8
- package/dist/factory-assets/connectors/deploy/CONNECTOR.md +19 -0
- package/dist/factory-assets/connectors/deploy/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/deploy.js +9 -8
- package/dist/factory-assets/connectors/devserver/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/devserver.js +9 -8
- package/dist/factory-assets/connectors/flow/CONNECTOR.md +3 -1
- package/dist/factory-assets/connectors/flow/adapter.d.ts +2 -1
- package/dist/factory-assets/connectors/flow/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/adapter.js +9 -8
- package/dist/factory-assets/connectors/flow/engine.js +6 -5
- package/dist/factory-assets/connectors/flow/prompt-fragments.d.ts +9 -2
- package/dist/factory-assets/connectors/flow/prompt-fragments.d.ts.map +1 -1
- package/dist/factory-assets/connectors/flow/prompt-fragments.js +1 -1
- package/dist/factory-assets/connectors/flow/run-flow.js +11 -10
- package/dist/factory-assets/connectors/flow.js +9 -8
- package/dist/factory-assets/connectors/git/driver.d.ts +12 -1
- package/dist/factory-assets/connectors/git/driver.d.ts.map +1 -1
- package/dist/factory-assets/connectors/git.js +9 -8
- package/dist/factory-assets/connectors/gmail.js +9 -8
- package/dist/factory-assets/connectors/googledrive.js +9 -8
- package/dist/factory-assets/connectors/local/driver.d.ts +25 -1
- package/dist/factory-assets/connectors/local/driver.d.ts.map +1 -1
- package/dist/factory-assets/connectors/local.js +9 -8
- package/dist/factory-assets/connectors/mattermost.js +9 -8
- package/dist/factory-assets/connectors/memory.js +9 -8
- package/dist/factory-assets/connectors/minio.js +9 -8
- package/dist/factory-assets/connectors/postgres.js +9 -8
- package/dist/factory-assets/connectors/s3/driver.d.ts +15 -0
- package/dist/factory-assets/connectors/s3/driver.d.ts.map +1 -1
- package/dist/factory-assets/connectors/s3.js +9 -8
- package/dist/factory-assets/connectors/sharepoint.js +9 -8
- package/dist/factory-assets/connectors/sqlite/adapter.d.ts +8 -1
- package/dist/factory-assets/connectors/sqlite/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/sqlite.js +9 -8
- package/dist/factory-assets/connectors/static-server/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/static-server.js +9 -8
- package/dist/factory-assets/connectors/tunnel.js +9 -8
- package/dist/factory-assets/connectors/webdav.js +9 -8
- package/dist/factory-assets/connectors/xstate/adapter.d.ts +6 -0
- package/dist/factory-assets/connectors/xstate/adapter.d.ts.map +1 -1
- package/dist/factory-assets/connectors/xstate-store.js +9 -8
- package/dist/factory-assets/connectors/xstate.js +9 -8
- package/dist/flows-LV5WYJ2I.js +20 -0
- package/dist/{flows-FHWBCLXF.js.map → flows-LV5WYJ2I.js.map} +1 -1
- package/dist/{helpers-FMWODXTW.js → helpers-PJ3CPUUL.js} +13 -12
- package/dist/{helpers-FMWODXTW.js.map → helpers-PJ3CPUUL.js.map} +1 -1
- package/dist/library/index.js +8 -7
- package/dist/library/install.js +6 -5
- package/dist/{library-publish-7YDHQGBN.js → library-publish-HVZRCE3C.js} +16 -15
- package/dist/library-publish-HVZRCE3C.js.map +1 -0
- package/dist/{open-library-O6T3ELPK.js → open-library-RMI2FTQ4.js} +14 -13
- package/dist/{open-library-O6T3ELPK.js.map → open-library-RMI2FTQ4.js.map} +1 -1
- package/dist/{paths-5QJJBAND.js → paths-JSVTQAVW.js} +11 -10
- package/dist/{paths-5QJJBAND.js.map → paths-JSVTQAVW.js.map} +1 -1
- package/dist/plugin-registry/src/deploy-helpers.d.ts +1 -1
- package/dist/{plugin-store-ZBJZ7F6D.js → plugin-store-7TVJB2TS.js} +8 -7
- package/dist/plugin-store-7TVJB2TS.js.map +1 -0
- package/dist/{project-HAMLHLD5.js → project-P636MSYT.js} +14 -13
- package/dist/{project-HAMLHLD5.js.map → project-P636MSYT.js.map} +1 -1
- package/dist/resolver/index.js +13 -1
- package/dist/resolver/src/types.d.ts +7 -0
- package/dist/resolver/src/types.d.ts.map +1 -1
- package/dist/resolver/src/validator.d.ts +8 -1
- package/dist/resolver/src/validator.d.ts.map +1 -1
- package/dist/runner/index.js +14 -13
- package/dist/runner/src/external-mcp.d.ts +1 -1
- package/dist/runner/src/external-mcp.d.ts.map +1 -1
- package/dist/runner/src/mcp-prompt.d.ts +7 -3
- package/dist/runner/src/mcp-prompt.d.ts.map +1 -1
- package/dist/runner/src/mcp-runtime-handlers.d.ts +12 -0
- package/dist/runner/src/mcp-runtime-handlers.d.ts.map +1 -1
- package/dist/runner/src/mixin-resolver.d.ts.map +1 -1
- package/dist/runner/src/recipe-resolver.d.ts +20 -6
- package/dist/runner/src/recipe-resolver.d.ts.map +1 -1
- package/dist/runner/src/resource-handler.d.ts +43 -0
- package/dist/runner/src/resource-handler.d.ts.map +1 -1
- package/dist/runner/src/resources.d.ts +12 -5
- package/dist/runner/src/resources.d.ts.map +1 -1
- package/dist/runner/src/serve.d.ts +5 -5
- package/dist/runner/src/serve.d.ts.map +1 -1
- package/dist/runner/src/session-builder.d.ts +9 -0
- 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/runner/src/workspace-migration.d.ts +37 -3
- package/dist/runner/src/workspace-migration.d.ts.map +1 -1
- package/dist/sdk/asset-manager.js +10 -9
- package/dist/sdk/bridge.js +4 -3
- package/dist/sdk/core.js +6 -5
- package/dist/sdk/flow.js +6 -5
- package/dist/sdk/index.js +14 -13
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/resolver.js +13 -1
- package/dist/sdk/runner.js +14 -13
- package/dist/sdk/session.js +1 -1
- package/dist/sdk/store.js +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/src/dispatcher.d.ts.map +1 -1
- package/dist/{setup-WJPNUE32.js → setup-OYW3W3XK.js} +10 -9
- package/dist/setup-OYW3W3XK.js.map +1 -0
- package/dist/skills-QY5PHBD3.js +20 -0
- package/dist/{skills-BMI6H7HI.js.map → skills-QY5PHBD3.js.map} +1 -1
- package/dist/{source-ITDH4367.js → source-63CHWDC2.js} +15 -14
- package/dist/{source-ITDH4367.js.map → source-63CHWDC2.js.map} +1 -1
- package/dist/{source-manifest-publish-RMHC7R6M.js → source-manifest-publish-DLASGDK5.js} +17 -16
- package/dist/source-manifest-publish-DLASGDK5.js.map +1 -0
- package/dist/store/index.js +1 -1
- package/dist/store/src/store.d.ts +9 -0
- package/dist/store/src/store.d.ts.map +1 -1
- package/dist/tui/index.js +14 -13
- package/dist/tui/index.js.map +1 -1
- package/dist/validator-RN64BKFW.js +5 -0
- package/dist/{validator-VF5M764T.js.map → validator-RN64BKFW.js.map} +1 -1
- package/dist/workspace-plugin/adapters/mcp.js +18 -5
- package/dist/workspace-plugin/adapters/mcp.js.map +1 -1
- package/dist/workspace-plugin/adapters/omp.js +10 -10
- package/dist/workspace-plugin/index.js +3 -2
- package/dist/workspace-plugin/src/tools/validator.d.ts.map +1 -1
- package/dist/workspace-plugin/src/utils/ai-assets.d.ts +11 -6
- package/dist/workspace-plugin/src/utils/ai-assets.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/asset-feeds-MWEMXMZA.js.map +0 -1
- package/dist/chunk-2BQBWWFX.js.map +0 -1
- package/dist/chunk-2IJFUAZB.js.map +0 -1
- package/dist/chunk-3EBFDMZC.js.map +0 -1
- package/dist/chunk-5NZ56R63.js.map +0 -1
- package/dist/chunk-7J7LQP6T.js.map +0 -1
- package/dist/chunk-ACXLKNIM.js.map +0 -1
- package/dist/chunk-BI2NKPA4.js.map +0 -1
- package/dist/chunk-BQCGFPHW.js +0 -345
- package/dist/chunk-BQCGFPHW.js.map +0 -1
- package/dist/chunk-DPUZJI45.js.map +0 -1
- package/dist/chunk-EKGB4ZWR.js.map +0 -1
- package/dist/chunk-GXC3TYMQ.js.map +0 -1
- package/dist/chunk-ISA7R7PK.js.map +0 -1
- package/dist/chunk-JB35MVBN.js.map +0 -1
- package/dist/chunk-KY5NY7LB.js.map +0 -1
- package/dist/chunk-LV2HPH3C.js +0 -73
- package/dist/chunk-LV2HPH3C.js.map +0 -1
- package/dist/chunk-MTM6C7IS.js.map +0 -1
- package/dist/chunk-NRXVS7E4.js.map +0 -1
- package/dist/chunk-XCBG2KDC.js +0 -23
- package/dist/chunk-XCBG2KDC.js.map +0 -1
- package/dist/ensure-sources-QGL44IRI.js.map +0 -1
- package/dist/flows-FHWBCLXF.js +0 -7
- package/dist/library-publish-7YDHQGBN.js.map +0 -1
- package/dist/plugin-store-ZBJZ7F6D.js.map +0 -1
- package/dist/setup-WJPNUE32.js.map +0 -1
- package/dist/skills-BMI6H7HI.js +0 -7
- package/dist/source-manifest-publish-RMHC7R6M.js.map +0 -1
- package/dist/validator-VF5M764T.js +0 -5
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import { parseDep, isValidAssetName, slugifyAssetName } from './chunk-GEEW6SY2.js';
|
|
2
|
+
import { createLogger } from './chunk-7GOCNYUV.js';
|
|
3
|
+
import { stat, readFile, opendir } from 'fs/promises';
|
|
4
|
+
import { basename, dirname, join } from 'path';
|
|
5
|
+
import { parse } from 'yaml';
|
|
6
|
+
|
|
7
|
+
// core/src/fs-deadline.ts
|
|
8
|
+
var DEFAULT_FS_DEADLINE_MS = 15e3;
|
|
9
|
+
var FS_DEADLINE_ENV_VAR = "SKAILE_FS_DEADLINE_MS";
|
|
10
|
+
var FsDeadlineError = class extends Error {
|
|
11
|
+
timeoutMs;
|
|
12
|
+
operation;
|
|
13
|
+
constructor(operation, timeoutMs) {
|
|
14
|
+
super(
|
|
15
|
+
`filesystem operation "${operation}" exceeded ${timeoutMs}ms \u2014 the mount may be unresponsive`
|
|
16
|
+
);
|
|
17
|
+
this.name = "FsDeadlineError";
|
|
18
|
+
this.operation = operation;
|
|
19
|
+
this.timeoutMs = timeoutMs;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function fsDeadlineMs(fallback = DEFAULT_FS_DEADLINE_MS) {
|
|
23
|
+
const raw = process.env[FS_DEADLINE_ENV_VAR];
|
|
24
|
+
if (raw === void 0) return fallback;
|
|
25
|
+
const parsed = Number.parseInt(raw, 10);
|
|
26
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
27
|
+
}
|
|
28
|
+
async function withFsDeadline(operation, fn, timeoutMs = fsDeadlineMs()) {
|
|
29
|
+
let timer;
|
|
30
|
+
try {
|
|
31
|
+
return await Promise.race([
|
|
32
|
+
fn(),
|
|
33
|
+
new Promise((_resolve, reject) => {
|
|
34
|
+
timer = setTimeout(() => reject(new FsDeadlineError(operation, timeoutMs)), timeoutMs);
|
|
35
|
+
timer.unref?.();
|
|
36
|
+
})
|
|
37
|
+
]);
|
|
38
|
+
} finally {
|
|
39
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function tryWithFsDeadline(operation, fn, fallback, timeoutMs = fsDeadlineMs()) {
|
|
43
|
+
try {
|
|
44
|
+
return await withFsDeadline(operation, fn, timeoutMs);
|
|
45
|
+
} catch {
|
|
46
|
+
return fallback;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// core/src/manifest.ts
|
|
51
|
+
function readManifestFile(filePath, timeoutMs) {
|
|
52
|
+
return withFsDeadline(`readFile ${filePath}`, () => readFile(filePath, "utf8"), timeoutMs);
|
|
53
|
+
}
|
|
54
|
+
function readManifestFileOrEmpty(filePath, timeoutMs) {
|
|
55
|
+
return tryWithFsDeadline(`readFile ${filePath}`, () => readFile(filePath, "utf8"), "", timeoutMs);
|
|
56
|
+
}
|
|
57
|
+
function parseFrontmatter(text) {
|
|
58
|
+
const m = text.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
59
|
+
if (!m) return { data: {}, body: text.trim() };
|
|
60
|
+
try {
|
|
61
|
+
const data = parse(m[1]) ?? {};
|
|
62
|
+
const body = text.slice(m[0].length).trim();
|
|
63
|
+
return { data, body };
|
|
64
|
+
} catch {
|
|
65
|
+
return { data: {}, body: text.trim() };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function extractVersion(meta) {
|
|
69
|
+
return String(
|
|
70
|
+
meta.version ?? meta.metadata?.version ?? ""
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
function parseRequires(meta) {
|
|
74
|
+
const raw = meta.requires ?? meta.metadata?.requires;
|
|
75
|
+
if (!raw) return [];
|
|
76
|
+
const list = typeof raw === "string" ? raw.split(",").map((s) => s.trim()) : Array.isArray(raw) ? raw : [];
|
|
77
|
+
return list.filter(Boolean).map(parseDep);
|
|
78
|
+
}
|
|
79
|
+
function collectAgentDeps(raw, out) {
|
|
80
|
+
if (!Array.isArray(raw)) return;
|
|
81
|
+
for (const d of raw) {
|
|
82
|
+
if (typeof d === "object" && d !== null && "name" in d) {
|
|
83
|
+
out.push({ kind: "agent", name: String(d.name) });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function collectStringRefs(raw, kind, out) {
|
|
88
|
+
if (!Array.isArray(raw)) return;
|
|
89
|
+
for (const r of raw) {
|
|
90
|
+
if (typeof r === "string" && r) out.push({ kind, name: r });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function collectMixinRefs(raw, defaultKind, out) {
|
|
94
|
+
if (!Array.isArray(raw)) return;
|
|
95
|
+
for (const r of raw) {
|
|
96
|
+
if (typeof r !== "string" || !r) continue;
|
|
97
|
+
if (r.startsWith(".") || r.startsWith("/")) continue;
|
|
98
|
+
const normalized = r.includes(":") ? r : `${defaultKind}:${r}`;
|
|
99
|
+
const colonIdx = normalized.indexOf(":");
|
|
100
|
+
const kind = normalized.slice(0, colonIdx).trim();
|
|
101
|
+
let rest = normalized.slice(colonIdx + 1).trim();
|
|
102
|
+
const hashIdx = rest.indexOf("#");
|
|
103
|
+
if (hashIdx !== -1) rest = rest.slice(0, hashIdx).trim();
|
|
104
|
+
let name;
|
|
105
|
+
if (rest.startsWith("@")) {
|
|
106
|
+
const slashIdx = rest.indexOf("/");
|
|
107
|
+
name = slashIdx !== -1 ? rest.slice(slashIdx + 1).trim() : "";
|
|
108
|
+
} else {
|
|
109
|
+
const atIdx = rest.indexOf("@");
|
|
110
|
+
name = atIdx !== -1 ? rest.slice(0, atIdx).trim() : rest;
|
|
111
|
+
}
|
|
112
|
+
if (name) out.push({ kind, name });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async function fromSkillMd(filePath, repoName) {
|
|
116
|
+
return fromSkillMdContent(await readManifestFile(filePath), repoName, filePath);
|
|
117
|
+
}
|
|
118
|
+
function fromSkillMdContent(content, repoName, filePath) {
|
|
119
|
+
const { data: meta } = parseFrontmatter(content);
|
|
120
|
+
let kind = String(meta.type ?? "skill");
|
|
121
|
+
if (!["skill", "agent", "prompt", "persona", "ruleset", "knowledge"].includes(kind))
|
|
122
|
+
kind = "skill";
|
|
123
|
+
return {
|
|
124
|
+
name: String(meta.name ?? basename(dirname(filePath))),
|
|
125
|
+
kind,
|
|
126
|
+
description: String(meta.description ?? ""),
|
|
127
|
+
source: filePath,
|
|
128
|
+
publisher: repoName,
|
|
129
|
+
version: extractVersion(meta),
|
|
130
|
+
requires: parseRequires(meta),
|
|
131
|
+
dependencies: []
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
async function fromAgentMd(filePath, repoName) {
|
|
135
|
+
return fromAgentMdContent(await readManifestFile(filePath), repoName, filePath);
|
|
136
|
+
}
|
|
137
|
+
function fromAgentMdContent(content, repoName, filePath) {
|
|
138
|
+
const { data: meta } = parseFrontmatter(content);
|
|
139
|
+
return {
|
|
140
|
+
name: String(meta.name ?? basename(dirname(filePath))),
|
|
141
|
+
kind: "agent",
|
|
142
|
+
description: String(meta.description ?? ""),
|
|
143
|
+
source: filePath,
|
|
144
|
+
publisher: repoName,
|
|
145
|
+
version: extractVersion(meta),
|
|
146
|
+
requires: parseRequires(meta),
|
|
147
|
+
dependencies: []
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
async function fromAgentYaml(filePath, repoName) {
|
|
151
|
+
return fromAgentYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);
|
|
152
|
+
}
|
|
153
|
+
function fromAgentYamlContent(content, repoName, filePath) {
|
|
154
|
+
let meta = {};
|
|
155
|
+
try {
|
|
156
|
+
meta = parse(content) ?? {};
|
|
157
|
+
} catch {
|
|
158
|
+
}
|
|
159
|
+
const requires = [];
|
|
160
|
+
collectAgentDeps(meta.requires, requires);
|
|
161
|
+
collectAgentDeps(meta.dependencies, requires);
|
|
162
|
+
collectStringRefs(meta.abilities, "skill", requires);
|
|
163
|
+
collectStringRefs(meta.contracts, "contract", requires);
|
|
164
|
+
for (const [field, defaultKind] of [
|
|
165
|
+
["persona", "persona"],
|
|
166
|
+
["rules", "ruleset"],
|
|
167
|
+
["knowledge", "knowledge"]
|
|
168
|
+
]) {
|
|
169
|
+
collectMixinRefs(meta[field], defaultKind, requires);
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
name: String(meta.name ?? basename(dirname(filePath))),
|
|
173
|
+
kind: "agent",
|
|
174
|
+
description: String(meta.description ?? ""),
|
|
175
|
+
source: filePath,
|
|
176
|
+
publisher: repoName,
|
|
177
|
+
version: String(meta.version ?? ""),
|
|
178
|
+
requires,
|
|
179
|
+
dependencies: []
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
async function fromPromptMd(filePath, repoName) {
|
|
183
|
+
return fromPromptMdContent(await readManifestFile(filePath), repoName, filePath);
|
|
184
|
+
}
|
|
185
|
+
function fromPromptMdContent(content, repoName, filePath) {
|
|
186
|
+
const { data: meta } = parseFrontmatter(content);
|
|
187
|
+
const name = String(meta.name ?? basename(filePath).replace(/\.prompt\.md$/, ""));
|
|
188
|
+
return {
|
|
189
|
+
name,
|
|
190
|
+
kind: "prompt",
|
|
191
|
+
description: String(meta.description ?? ""),
|
|
192
|
+
source: filePath,
|
|
193
|
+
publisher: repoName,
|
|
194
|
+
version: extractVersion(meta),
|
|
195
|
+
requires: parseRequires(meta),
|
|
196
|
+
dependencies: []
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
async function fromFlowYaml(filePath, repoName) {
|
|
200
|
+
return fromFlowYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);
|
|
201
|
+
}
|
|
202
|
+
function fromFlowYamlContent(content, repoName, filePath) {
|
|
203
|
+
let meta = {};
|
|
204
|
+
try {
|
|
205
|
+
meta = parse(content) ?? {};
|
|
206
|
+
} catch {
|
|
207
|
+
}
|
|
208
|
+
const stem = basename(filePath).replace(/\.flow\.yaml$/, "").replace(/\.flow\.json$/, "");
|
|
209
|
+
return {
|
|
210
|
+
name: String(meta.name ?? meta.id ?? stem),
|
|
211
|
+
kind: "flow",
|
|
212
|
+
description: String(meta.description ?? ""),
|
|
213
|
+
source: filePath,
|
|
214
|
+
publisher: repoName,
|
|
215
|
+
version: String(meta.version ?? ""),
|
|
216
|
+
requires: parseRequires(meta),
|
|
217
|
+
dependencies: []
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
async function fromBundleYaml(filePath, repoName) {
|
|
221
|
+
return fromBundleYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);
|
|
222
|
+
}
|
|
223
|
+
function fromBundleYamlContent(content, repoName, filePath) {
|
|
224
|
+
let meta = {};
|
|
225
|
+
try {
|
|
226
|
+
meta = parse(content) ?? {};
|
|
227
|
+
} catch {
|
|
228
|
+
}
|
|
229
|
+
const name = String(meta.name ?? basename(filePath).replace(/\.bundle\.yaml$/, ""));
|
|
230
|
+
const deps = meta.dependencies;
|
|
231
|
+
const dependencies = Array.isArray(deps) ? deps.filter(Boolean) : [];
|
|
232
|
+
return {
|
|
233
|
+
name,
|
|
234
|
+
kind: "bundle",
|
|
235
|
+
description: String(meta.description ?? ""),
|
|
236
|
+
source: filePath,
|
|
237
|
+
publisher: repoName,
|
|
238
|
+
version: String(meta.version ?? ""),
|
|
239
|
+
requires: parseRequires(meta),
|
|
240
|
+
dependencies
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
async function bundleDepRefs(filePath) {
|
|
244
|
+
return bundleDepRefsFromContent(await readManifestFileOrEmpty(filePath), filePath);
|
|
245
|
+
}
|
|
246
|
+
function bundleDepRefsFromContent(content, filePath) {
|
|
247
|
+
const wholeDoc = /\.(bundle\.yaml|flow\.yaml|flow\.json)$/.test(filePath);
|
|
248
|
+
let meta = {};
|
|
249
|
+
try {
|
|
250
|
+
meta = wholeDoc ? parse(content) ?? {} : parseFrontmatter(content).data;
|
|
251
|
+
} catch {
|
|
252
|
+
return [];
|
|
253
|
+
}
|
|
254
|
+
const out = [];
|
|
255
|
+
const collect = (v) => {
|
|
256
|
+
if (Array.isArray(v)) {
|
|
257
|
+
for (const x of v) if (typeof x === "string" && x.trim()) out.push(x.trim());
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
collect(meta.requires);
|
|
261
|
+
collect(meta.metadata?.requires);
|
|
262
|
+
collect(meta.dependencies);
|
|
263
|
+
return [...new Set(out)];
|
|
264
|
+
}
|
|
265
|
+
async function fromContractMd(filePath, repoName) {
|
|
266
|
+
return fromContractMdContent(await readManifestFile(filePath), repoName, filePath);
|
|
267
|
+
}
|
|
268
|
+
function fromContractMdContent(content, repoName, filePath) {
|
|
269
|
+
const { data: meta } = parseFrontmatter(content);
|
|
270
|
+
return {
|
|
271
|
+
name: String(meta.name ?? basename(dirname(filePath))),
|
|
272
|
+
kind: "contract",
|
|
273
|
+
description: String(meta.description ?? ""),
|
|
274
|
+
source: filePath,
|
|
275
|
+
publisher: repoName,
|
|
276
|
+
version: extractVersion(meta),
|
|
277
|
+
requires: parseRequires(meta),
|
|
278
|
+
dependencies: []
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
async function fromMcpServerMd(filePath, repoName) {
|
|
282
|
+
return fromMcpServerMdContent(await readManifestFile(filePath), repoName, filePath);
|
|
283
|
+
}
|
|
284
|
+
function fromMcpServerMdContent(content, repoName, filePath) {
|
|
285
|
+
const { data: meta } = parseFrontmatter(content);
|
|
286
|
+
const metadata = {};
|
|
287
|
+
if (meta.transport) metadata.transport = String(meta.transport);
|
|
288
|
+
if (meta.command) metadata.command = String(meta.command);
|
|
289
|
+
if (Array.isArray(meta.args)) metadata.args = meta.args.map(String);
|
|
290
|
+
if (meta.env && typeof meta.env === "object" && !Array.isArray(meta.env)) {
|
|
291
|
+
metadata.env = meta.env;
|
|
292
|
+
}
|
|
293
|
+
if (meta.url) metadata.url = String(meta.url);
|
|
294
|
+
if (meta.headers && typeof meta.headers === "object" && !Array.isArray(meta.headers)) {
|
|
295
|
+
metadata.headers = meta.headers;
|
|
296
|
+
}
|
|
297
|
+
if (meta.recipe && typeof meta.recipe === "object" && !Array.isArray(meta.recipe)) {
|
|
298
|
+
metadata.recipe = meta.recipe;
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
name: String(meta.name ?? basename(dirname(filePath))),
|
|
302
|
+
kind: "mcp-server",
|
|
303
|
+
description: String(meta.description ?? ""),
|
|
304
|
+
source: filePath,
|
|
305
|
+
publisher: repoName,
|
|
306
|
+
version: extractVersion(meta),
|
|
307
|
+
requires: parseRequires(meta),
|
|
308
|
+
dependencies: [],
|
|
309
|
+
metadata: Object.keys(metadata).length > 0 ? metadata : void 0
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
async function fromKnowledgeYaml(filePath, repoName) {
|
|
313
|
+
return fromKnowledgeYamlContent(await readManifestFileOrEmpty(filePath), repoName, filePath);
|
|
314
|
+
}
|
|
315
|
+
function fromKnowledgeYamlContent(content, repoName, filePath) {
|
|
316
|
+
let meta = {};
|
|
317
|
+
try {
|
|
318
|
+
meta = parse(content) ?? {};
|
|
319
|
+
} catch {
|
|
320
|
+
}
|
|
321
|
+
return {
|
|
322
|
+
name: String(meta.name ?? basename(dirname(filePath))),
|
|
323
|
+
kind: "knowledge",
|
|
324
|
+
description: String(meta.description ?? ""),
|
|
325
|
+
source: filePath,
|
|
326
|
+
publisher: repoName,
|
|
327
|
+
version: String(meta.version ?? ""),
|
|
328
|
+
requires: parseRequires(meta),
|
|
329
|
+
dependencies: []
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
async function fromConnectorMd(filePath, repoName) {
|
|
333
|
+
return fromConnectorMdContent(await readManifestFile(filePath), repoName, filePath);
|
|
334
|
+
}
|
|
335
|
+
function fromConnectorMdContent(content, repoName, filePath) {
|
|
336
|
+
const { data: meta, body } = parseFrontmatter(content);
|
|
337
|
+
const name = String(meta.name ?? basename(dirname(filePath)));
|
|
338
|
+
return {
|
|
339
|
+
name,
|
|
340
|
+
kind: "connector",
|
|
341
|
+
description: String(meta.description ?? ""),
|
|
342
|
+
source: filePath,
|
|
343
|
+
publisher: repoName,
|
|
344
|
+
version: extractVersion(meta),
|
|
345
|
+
requires: parseRequires(meta),
|
|
346
|
+
dependencies: [],
|
|
347
|
+
metadata: {
|
|
348
|
+
entry: meta.entry ?? "./adapter.ts",
|
|
349
|
+
npm_deps: meta.npm_deps ?? {},
|
|
350
|
+
fields: meta.fields ?? [],
|
|
351
|
+
health_check: meta.health_check ?? null,
|
|
352
|
+
body
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
var DEFAULT_WALK_MAX_DEPTH = 32;
|
|
357
|
+
var DEFAULT_WALK_MAX_ENTRIES = 5e4;
|
|
358
|
+
var DEFAULT_WALK_BUDGET_MS = 6e4;
|
|
359
|
+
var WALK_MAX_DEPTH_ENV_VAR = "SKAILE_SCAN_MAX_DEPTH";
|
|
360
|
+
var WALK_MAX_ENTRIES_ENV_VAR = "SKAILE_SCAN_MAX_ENTRIES";
|
|
361
|
+
var WALK_BUDGET_MS_ENV_VAR = "SKAILE_SCAN_DEADLINE_MS";
|
|
362
|
+
function envInt(name, fallback) {
|
|
363
|
+
const raw = process.env[name];
|
|
364
|
+
if (raw === void 0) return fallback;
|
|
365
|
+
const parsed = Number.parseInt(raw, 10);
|
|
366
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
367
|
+
}
|
|
368
|
+
var walkLogger;
|
|
369
|
+
function warnTruncation(info) {
|
|
370
|
+
walkLogger ??= createLogger({ kind: "runner", subkind: "asset-scan" });
|
|
371
|
+
walkLogger.warn(`asset scan truncated (${info.reason}) \u2014 results are incomplete`, {
|
|
372
|
+
...info
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function truncate(state, info) {
|
|
376
|
+
if (state.reported.has(info.reason)) return;
|
|
377
|
+
state.reported.add(info.reason);
|
|
378
|
+
state.onTruncate(info);
|
|
379
|
+
}
|
|
380
|
+
async function dirIdentity(path, timeoutMs) {
|
|
381
|
+
const st = await tryWithFsDeadline(`stat ${path}`, () => stat(path), null, timeoutMs);
|
|
382
|
+
return st ? `${st.dev}:${st.ino}` : null;
|
|
383
|
+
}
|
|
384
|
+
async function readDirEntries(dir, state) {
|
|
385
|
+
const remaining = state.maxEntries - state.examined;
|
|
386
|
+
if (remaining <= 0) return { entries: [], capped: true };
|
|
387
|
+
try {
|
|
388
|
+
return await withFsDeadline(
|
|
389
|
+
`opendir ${dir}`,
|
|
390
|
+
async () => {
|
|
391
|
+
const handle = await opendir(dir);
|
|
392
|
+
const entries = [];
|
|
393
|
+
let capped = false;
|
|
394
|
+
for await (const e of handle) {
|
|
395
|
+
if (entries.length >= remaining) {
|
|
396
|
+
capped = true;
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
entries.push(e);
|
|
400
|
+
}
|
|
401
|
+
entries.sort((a, b) => a.name < b.name ? -1 : 1);
|
|
402
|
+
return { entries, capped };
|
|
403
|
+
},
|
|
404
|
+
state.opTimeoutMs
|
|
405
|
+
);
|
|
406
|
+
} catch {
|
|
407
|
+
truncate(state, { reason: "unreadable", path: dir });
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
async function* walkDir(dir, options = {}) {
|
|
412
|
+
const state = {
|
|
413
|
+
maxDepth: options.maxDepth ?? envInt(WALK_MAX_DEPTH_ENV_VAR, DEFAULT_WALK_MAX_DEPTH),
|
|
414
|
+
maxEntries: options.maxEntries ?? envInt(WALK_MAX_ENTRIES_ENV_VAR, DEFAULT_WALK_MAX_ENTRIES),
|
|
415
|
+
opTimeoutMs: options.opTimeoutMs,
|
|
416
|
+
deadlineAt: Date.now() + (options.budgetMs ?? envInt(WALK_BUDGET_MS_ENV_VAR, DEFAULT_WALK_BUDGET_MS)),
|
|
417
|
+
examined: 0,
|
|
418
|
+
ancestors: /* @__PURE__ */ new Set(),
|
|
419
|
+
reported: /* @__PURE__ */ new Set(),
|
|
420
|
+
onTruncate: options.onTruncate ?? warnTruncation
|
|
421
|
+
};
|
|
422
|
+
const rootId = await dirIdentity(dir, state.opTimeoutMs);
|
|
423
|
+
if (rootId) state.ancestors.add(rootId);
|
|
424
|
+
yield* walkFrom(dir, 0, state);
|
|
425
|
+
}
|
|
426
|
+
async function* walkFrom(dir, depth, state) {
|
|
427
|
+
if (depth > state.maxDepth) {
|
|
428
|
+
truncate(state, { reason: "depth", path: dir, limit: state.maxDepth });
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (Date.now() >= state.deadlineAt) {
|
|
432
|
+
truncate(state, { reason: "budget", path: dir });
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
const read = await readDirEntries(dir, state);
|
|
436
|
+
if (!read) return;
|
|
437
|
+
if (read.capped) truncate(state, { reason: "entries", path: dir, limit: state.maxEntries });
|
|
438
|
+
for (const e of read.entries) {
|
|
439
|
+
if (state.examined >= state.maxEntries) {
|
|
440
|
+
truncate(state, { reason: "entries", path: dir, limit: state.maxEntries });
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (Date.now() >= state.deadlineAt) {
|
|
444
|
+
truncate(state, { reason: "budget", path: dir });
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
state.examined++;
|
|
448
|
+
const full = join(dir, e.name);
|
|
449
|
+
if (e.isSymbolicLink()) {
|
|
450
|
+
const st = await tryWithFsDeadline(`stat ${full}`, () => stat(full), null, state.opTimeoutMs);
|
|
451
|
+
if (!st) continue;
|
|
452
|
+
if (st.isDirectory()) {
|
|
453
|
+
if (e.name === ".git" || e.name === "node_modules") continue;
|
|
454
|
+
const id = `${st.dev}:${st.ino}`;
|
|
455
|
+
if (state.ancestors.has(id)) {
|
|
456
|
+
truncate(state, { reason: "cycle", path: full });
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
state.ancestors.add(id);
|
|
460
|
+
try {
|
|
461
|
+
yield* walkFrom(full, depth + 1, state);
|
|
462
|
+
} finally {
|
|
463
|
+
state.ancestors.delete(id);
|
|
464
|
+
}
|
|
465
|
+
} else {
|
|
466
|
+
yield { path: full, name: e.name };
|
|
467
|
+
}
|
|
468
|
+
} else if (e.isDirectory()) {
|
|
469
|
+
if (e.name !== ".git" && e.name !== "node_modules") yield* walkFrom(full, depth + 1, state);
|
|
470
|
+
} else if (e.isFile()) {
|
|
471
|
+
yield { path: full, name: e.name };
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
function normalizeEntryName(e) {
|
|
476
|
+
if (isValidAssetName(e.name)) return;
|
|
477
|
+
let slug;
|
|
478
|
+
try {
|
|
479
|
+
slug = slugifyAssetName(e.name);
|
|
480
|
+
} catch {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
const original = e.name;
|
|
484
|
+
e.name = slug;
|
|
485
|
+
if (e.metadata?.displayName === void 0) {
|
|
486
|
+
e.metadata = { ...e.metadata, displayName: original };
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function entryFromManifest(name, content, filePath, repoName) {
|
|
490
|
+
if (name === "SKILL.md") return fromSkillMdContent(content, repoName, filePath);
|
|
491
|
+
if (name === "AGENT.md") return fromAgentMdContent(content, repoName, filePath);
|
|
492
|
+
if (name === "agent.yaml") return fromAgentYamlContent(content, repoName, filePath);
|
|
493
|
+
if (name === "CONTRACT.md") return fromContractMdContent(content, repoName, filePath);
|
|
494
|
+
if (name === "MCP.md") return fromMcpServerMdContent(content, repoName, filePath);
|
|
495
|
+
if (name === "CONNECTOR.md") return fromConnectorMdContent(content, repoName, filePath);
|
|
496
|
+
if (name === "knowledge.yaml") return fromKnowledgeYamlContent(content, repoName, filePath);
|
|
497
|
+
if (name.endsWith(".prompt.md")) return fromPromptMdContent(content, repoName, filePath);
|
|
498
|
+
if (name.endsWith(".bundle.yaml")) return fromBundleYamlContent(content, repoName, filePath);
|
|
499
|
+
if (name.endsWith(".flow.yaml") || name.endsWith(".flow.json"))
|
|
500
|
+
return fromFlowYamlContent(content, repoName, filePath);
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
function isManifestName(name) {
|
|
504
|
+
return name === "SKILL.md" || name === "AGENT.md" || name === "agent.yaml" || name === "CONTRACT.md" || name === "MCP.md" || name === "CONNECTOR.md" || name === "knowledge.yaml" || name.endsWith(".prompt.md") || name.endsWith(".bundle.yaml") || name.endsWith(".flow.yaml") || name.endsWith(".flow.json");
|
|
505
|
+
}
|
|
506
|
+
async function scanDirectory(root, repoName, options = {}) {
|
|
507
|
+
const entries = /* @__PURE__ */ new Map();
|
|
508
|
+
const onTruncate = options.onTruncate ?? warnTruncation;
|
|
509
|
+
const reported = /* @__PURE__ */ new Set();
|
|
510
|
+
const relay = (info) => {
|
|
511
|
+
reported.add(info.reason);
|
|
512
|
+
onTruncate(info);
|
|
513
|
+
};
|
|
514
|
+
const opTimeoutMs = options.opTimeoutMs ?? fsDeadlineMs();
|
|
515
|
+
function add(e) {
|
|
516
|
+
normalizeEntryName(e);
|
|
517
|
+
const key = `${e.kind}:${e.name}`;
|
|
518
|
+
const existing = entries.get(key);
|
|
519
|
+
if (!existing) {
|
|
520
|
+
entries.set(key, e);
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
if (e.source > existing.source) entries.set(key, e);
|
|
524
|
+
}
|
|
525
|
+
for await (const { path: filePath, name } of walkDir(root, {
|
|
526
|
+
...options,
|
|
527
|
+
opTimeoutMs,
|
|
528
|
+
onTruncate: relay
|
|
529
|
+
})) {
|
|
530
|
+
if (!isManifestName(name)) continue;
|
|
531
|
+
const content = await tryWithFsDeadline(
|
|
532
|
+
`readFile ${filePath}`,
|
|
533
|
+
() => readFile(filePath, "utf8"),
|
|
534
|
+
null,
|
|
535
|
+
opTimeoutMs
|
|
536
|
+
);
|
|
537
|
+
if (content === null) {
|
|
538
|
+
if (!reported.has("unreadable")) relay({ reason: "unreadable", path: filePath });
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
try {
|
|
542
|
+
const entry = entryFromManifest(name, content, filePath, repoName);
|
|
543
|
+
if (entry) add(entry);
|
|
544
|
+
} catch {
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return [...entries.values()];
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
export { DEFAULT_FS_DEADLINE_MS, DEFAULT_WALK_BUDGET_MS, DEFAULT_WALK_MAX_DEPTH, DEFAULT_WALK_MAX_ENTRIES, FS_DEADLINE_ENV_VAR, FsDeadlineError, WALK_BUDGET_MS_ENV_VAR, WALK_MAX_DEPTH_ENV_VAR, WALK_MAX_ENTRIES_ENV_VAR, bundleDepRefs, fromAgentMd, fromAgentYaml, fromBundleYaml, fromConnectorMd, fromContractMd, fromFlowYaml, fromKnowledgeYaml, fromMcpServerMd, fromMcpServerMdContent, fromPromptMd, fromSkillMd, fsDeadlineMs, parseFrontmatter, parseRequires, scanDirectory, tryWithFsDeadline, walkDir, withFsDeadline };
|
|
551
|
+
//# sourceMappingURL=chunk-DYMWJAL4.js.map
|
|
552
|
+
//# sourceMappingURL=chunk-DYMWJAL4.js.map
|