@opensip-cli/core 0.1.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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/config-resolution.test.d.ts +2 -0
- package/dist/__tests__/config-resolution.test.d.ts.map +1 -0
- package/dist/__tests__/config-resolution.test.js +94 -0
- package/dist/__tests__/config-resolution.test.js.map +1 -0
- package/dist/__tests__/public-api.test.d.ts +16 -0
- package/dist/__tests__/public-api.test.d.ts.map +1 -0
- package/dist/__tests__/public-api.test.js +209 -0
- package/dist/__tests__/public-api.test.js.map +1 -0
- package/dist/__tests__/signal-batch.test.d.ts +2 -0
- package/dist/__tests__/signal-batch.test.d.ts.map +1 -0
- package/dist/__tests__/signal-batch.test.js +39 -0
- package/dist/__tests__/signal-batch.test.js.map +1 -0
- package/dist/__tests__/signal-sink.test.d.ts +2 -0
- package/dist/__tests__/signal-sink.test.d.ts.map +1 -0
- package/dist/__tests__/signal-sink.test.js +25 -0
- package/dist/__tests__/signal-sink.test.js.map +1 -0
- package/dist/__tests__/strip-utils.test.d.ts +2 -0
- package/dist/__tests__/strip-utils.test.d.ts.map +1 -0
- package/dist/__tests__/strip-utils.test.js +397 -0
- package/dist/__tests__/strip-utils.test.js.map +1 -0
- package/dist/__tests__/text-tree.test.d.ts +2 -0
- package/dist/__tests__/text-tree.test.d.ts.map +1 -0
- package/dist/__tests__/text-tree.test.js +31 -0
- package/dist/__tests__/text-tree.test.js.map +1 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts +2 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.d.ts.map +1 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.js +69 -0
- package/dist/baseline/__tests__/fingerprint-strategy.test.js.map +1 -0
- package/dist/baseline/fingerprint-strategy.d.ts +70 -0
- package/dist/baseline/fingerprint-strategy.d.ts.map +1 -0
- package/dist/baseline/fingerprint-strategy.js +90 -0
- package/dist/baseline/fingerprint-strategy.js.map +1 -0
- package/dist/config-resolution.d.ts +27 -0
- package/dist/config-resolution.d.ts.map +1 -0
- package/dist/config-resolution.js +92 -0
- package/dist/config-resolution.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index.js.map +1 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.d.ts +2 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.d.ts.map +1 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.js +87 -0
- package/dist/languages/__tests__/content-filter-dispatch.test.js.map +1 -0
- package/dist/languages/__tests__/non-code-formats.test.d.ts +2 -0
- package/dist/languages/__tests__/non-code-formats.test.d.ts.map +1 -0
- package/dist/languages/__tests__/non-code-formats.test.js +31 -0
- package/dist/languages/__tests__/non-code-formats.test.js.map +1 -0
- package/dist/languages/__tests__/parse-cache.test.d.ts +2 -0
- package/dist/languages/__tests__/parse-cache.test.d.ts.map +1 -0
- package/dist/languages/__tests__/parse-cache.test.js +228 -0
- package/dist/languages/__tests__/parse-cache.test.js.map +1 -0
- package/dist/languages/__tests__/registry.test.d.ts +2 -0
- package/dist/languages/__tests__/registry.test.d.ts.map +1 -0
- package/dist/languages/__tests__/registry.test.js +193 -0
- package/dist/languages/__tests__/registry.test.js.map +1 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.d.ts +2 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.d.ts.map +1 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.js +66 -0
- package/dist/languages/__tests__/workspace-unit-contract.test.js.map +1 -0
- package/dist/languages/adapter.d.ts +66 -0
- package/dist/languages/adapter.d.ts.map +1 -0
- package/dist/languages/adapter.js +2 -0
- package/dist/languages/adapter.js.map +1 -0
- package/dist/languages/content-filter-dispatch.d.ts +36 -0
- package/dist/languages/content-filter-dispatch.d.ts.map +1 -0
- package/dist/languages/content-filter-dispatch.js +75 -0
- package/dist/languages/content-filter-dispatch.js.map +1 -0
- package/dist/languages/generic-types.d.ts +22 -0
- package/dist/languages/generic-types.d.ts.map +1 -0
- package/dist/languages/generic-types.js +3 -0
- package/dist/languages/generic-types.js.map +1 -0
- package/dist/languages/index.d.ts +12 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +7 -0
- package/dist/languages/index.js.map +1 -0
- package/dist/languages/non-code-formats.d.ts +37 -0
- package/dist/languages/non-code-formats.d.ts.map +1 -0
- package/dist/languages/non-code-formats.js +45 -0
- package/dist/languages/non-code-formats.js.map +1 -0
- package/dist/languages/parse-cache-class.d.ts +69 -0
- package/dist/languages/parse-cache-class.d.ts.map +1 -0
- package/dist/languages/parse-cache-class.js +135 -0
- package/dist/languages/parse-cache-class.js.map +1 -0
- package/dist/languages/parse-cache.d.ts +54 -0
- package/dist/languages/parse-cache.d.ts.map +1 -0
- package/dist/languages/parse-cache.js +88 -0
- package/dist/languages/parse-cache.js.map +1 -0
- package/dist/languages/registry.d.ts +35 -0
- package/dist/languages/registry.d.ts.map +1 -0
- package/dist/languages/registry.js +123 -0
- package/dist/languages/registry.js.map +1 -0
- package/dist/languages/strip-scanners.d.ts +170 -0
- package/dist/languages/strip-scanners.d.ts.map +1 -0
- package/dist/languages/strip-scanners.js +233 -0
- package/dist/languages/strip-scanners.js.map +1 -0
- package/dist/languages/strip-utils.d.ts +66 -0
- package/dist/languages/strip-utils.d.ts.map +1 -0
- package/dist/languages/strip-utils.js +88 -0
- package/dist/languages/strip-utils.js.map +1 -0
- package/dist/languages/text-tree.d.ts +44 -0
- package/dist/languages/text-tree.d.ts.map +1 -0
- package/dist/languages/text-tree.js +34 -0
- package/dist/languages/text-tree.js.map +1 -0
- package/dist/languages/workspace-unit.d.ts +18 -0
- package/dist/languages/workspace-unit.d.ts.map +1 -0
- package/dist/languages/workspace-unit.js +2 -0
- package/dist/languages/workspace-unit.js.map +1 -0
- package/dist/lib/__tests__/config-version.test.d.ts +12 -0
- package/dist/lib/__tests__/config-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/config-version.test.js +92 -0
- package/dist/lib/__tests__/config-version.test.js.map +1 -0
- package/dist/lib/__tests__/diagnostics-bus.test.d.ts +7 -0
- package/dist/lib/__tests__/diagnostics-bus.test.d.ts.map +1 -0
- package/dist/lib/__tests__/diagnostics-bus.test.js +44 -0
- package/dist/lib/__tests__/diagnostics-bus.test.js.map +1 -0
- package/dist/lib/__tests__/env-registry.test.d.ts +7 -0
- package/dist/lib/__tests__/env-registry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/env-registry.test.js +82 -0
- package/dist/lib/__tests__/env-registry.test.js.map +1 -0
- package/dist/lib/__tests__/errors.test.d.ts +2 -0
- package/dist/lib/__tests__/errors.test.d.ts.map +1 -0
- package/dist/lib/__tests__/errors.test.js +218 -0
- package/dist/lib/__tests__/errors.test.js.map +1 -0
- package/dist/lib/__tests__/format.test.d.ts +2 -0
- package/dist/lib/__tests__/format.test.d.ts.map +1 -0
- package/dist/lib/__tests__/format.test.js +23 -0
- package/dist/lib/__tests__/format.test.js.map +1 -0
- package/dist/lib/__tests__/ids.test.d.ts +2 -0
- package/dist/lib/__tests__/ids.test.d.ts.map +1 -0
- package/dist/lib/__tests__/ids.test.js +80 -0
- package/dist/lib/__tests__/ids.test.js.map +1 -0
- package/dist/lib/__tests__/logger.test.d.ts +2 -0
- package/dist/lib/__tests__/logger.test.d.ts.map +1 -0
- package/dist/lib/__tests__/logger.test.js +284 -0
- package/dist/lib/__tests__/logger.test.js.map +1 -0
- package/dist/lib/__tests__/package-version.test.d.ts +2 -0
- package/dist/lib/__tests__/package-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/package-version.test.js +47 -0
- package/dist/lib/__tests__/package-version.test.js.map +1 -0
- package/dist/lib/__tests__/paths.test.d.ts +5 -0
- package/dist/lib/__tests__/paths.test.d.ts.map +1 -0
- package/dist/lib/__tests__/paths.test.js +59 -0
- package/dist/lib/__tests__/paths.test.js.map +1 -0
- package/dist/lib/__tests__/payload-version.test.d.ts +2 -0
- package/dist/lib/__tests__/payload-version.test.d.ts.map +1 -0
- package/dist/lib/__tests__/payload-version.test.js +35 -0
- package/dist/lib/__tests__/payload-version.test.js.map +1 -0
- package/dist/lib/__tests__/phantom-detect.test.d.ts +10 -0
- package/dist/lib/__tests__/phantom-detect.test.d.ts.map +1 -0
- package/dist/lib/__tests__/phantom-detect.test.js +84 -0
- package/dist/lib/__tests__/phantom-detect.test.js.map +1 -0
- package/dist/lib/__tests__/project-context.test.d.ts +10 -0
- package/dist/lib/__tests__/project-context.test.d.ts.map +1 -0
- package/dist/lib/__tests__/project-context.test.js +240 -0
- package/dist/lib/__tests__/project-context.test.js.map +1 -0
- package/dist/lib/__tests__/registry.test.d.ts +2 -0
- package/dist/lib/__tests__/registry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/registry.test.js +333 -0
- package/dist/lib/__tests__/registry.test.js.map +1 -0
- package/dist/lib/__tests__/retry.test.d.ts +2 -0
- package/dist/lib/__tests__/retry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/retry.test.js +71 -0
- package/dist/lib/__tests__/retry.test.js.map +1 -0
- package/dist/lib/__tests__/run-diagnostics.test.d.ts +9 -0
- package/dist/lib/__tests__/run-diagnostics.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-diagnostics.test.js +61 -0
- package/dist/lib/__tests__/run-diagnostics.test.js.map +1 -0
- package/dist/lib/__tests__/run-scope.test.d.ts +2 -0
- package/dist/lib/__tests__/run-scope.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-scope.test.js +202 -0
- package/dist/lib/__tests__/run-scope.test.js.map +1 -0
- package/dist/lib/__tests__/run-timer.test.d.ts +2 -0
- package/dist/lib/__tests__/run-timer.test.d.ts.map +1 -0
- package/dist/lib/__tests__/run-timer.test.js +152 -0
- package/dist/lib/__tests__/run-timer.test.js.map +1 -0
- package/dist/lib/__tests__/severity-policy.test.d.ts +6 -0
- package/dist/lib/__tests__/severity-policy.test.d.ts.map +1 -0
- package/dist/lib/__tests__/severity-policy.test.js +47 -0
- package/dist/lib/__tests__/severity-policy.test.js.map +1 -0
- package/dist/lib/__tests__/telemetry.test.d.ts +2 -0
- package/dist/lib/__tests__/telemetry.test.d.ts.map +1 -0
- package/dist/lib/__tests__/telemetry.test.js +212 -0
- package/dist/lib/__tests__/telemetry.test.js.map +1 -0
- package/dist/lib/__tests__/verdict-policy.test.d.ts +7 -0
- package/dist/lib/__tests__/verdict-policy.test.d.ts.map +1 -0
- package/dist/lib/__tests__/verdict-policy.test.js +91 -0
- package/dist/lib/__tests__/verdict-policy.test.js.map +1 -0
- package/dist/lib/__tests__/yaml.test.d.ts +6 -0
- package/dist/lib/__tests__/yaml.test.d.ts.map +1 -0
- package/dist/lib/__tests__/yaml.test.js +79 -0
- package/dist/lib/__tests__/yaml.test.js.map +1 -0
- package/dist/lib/config-version.d.ts +49 -0
- package/dist/lib/config-version.d.ts.map +1 -0
- package/dist/lib/config-version.js +56 -0
- package/dist/lib/config-version.js.map +1 -0
- package/dist/lib/diagnostics-bus.d.ts +48 -0
- package/dist/lib/diagnostics-bus.d.ts.map +1 -0
- package/dist/lib/diagnostics-bus.js +74 -0
- package/dist/lib/diagnostics-bus.js.map +1 -0
- package/dist/lib/env-registry.d.ts +108 -0
- package/dist/lib/env-registry.d.ts.map +1 -0
- package/dist/lib/env-registry.js +92 -0
- package/dist/lib/env-registry.js.map +1 -0
- package/dist/lib/errors.d.ts +132 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +160 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/execution/__tests__/execution.test.d.ts +7 -0
- package/dist/lib/execution/__tests__/execution.test.d.ts.map +1 -0
- package/dist/lib/execution/__tests__/execution.test.js +254 -0
- package/dist/lib/execution/__tests__/execution.test.js.map +1 -0
- package/dist/lib/execution/index.d.ts +15 -0
- package/dist/lib/execution/index.d.ts.map +1 -0
- package/dist/lib/execution/index.js +10 -0
- package/dist/lib/execution/index.js.map +1 -0
- package/dist/lib/execution/options.d.ts +32 -0
- package/dist/lib/execution/options.d.ts.map +1 -0
- package/dist/lib/execution/options.js +15 -0
- package/dist/lib/execution/options.js.map +1 -0
- package/dist/lib/execution/pipeline.d.ts +36 -0
- package/dist/lib/execution/pipeline.d.ts.map +1 -0
- package/dist/lib/execution/pipeline.js +38 -0
- package/dist/lib/execution/pipeline.js.map +1 -0
- package/dist/lib/execution/retry.d.ts +38 -0
- package/dist/lib/execution/retry.d.ts.map +1 -0
- package/dist/lib/execution/retry.js +56 -0
- package/dist/lib/execution/retry.js.map +1 -0
- package/dist/lib/execution/run-with-timeout.d.ts +46 -0
- package/dist/lib/execution/run-with-timeout.d.ts.map +1 -0
- package/dist/lib/execution/run-with-timeout.js +86 -0
- package/dist/lib/execution/run-with-timeout.js.map +1 -0
- package/dist/lib/execution/schedule.d.ts +62 -0
- package/dist/lib/execution/schedule.d.ts.map +1 -0
- package/dist/lib/execution/schedule.js +130 -0
- package/dist/lib/execution/schedule.js.map +1 -0
- package/dist/lib/format.d.ts +17 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +26 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/ids.d.ts +13 -0
- package/dist/lib/ids.d.ts.map +1 -0
- package/dist/lib/ids.js +48 -0
- package/dist/lib/ids.js.map +1 -0
- package/dist/lib/logger.d.ts +166 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +283 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/package-version.d.ts +17 -0
- package/dist/lib/package-version.d.ts.map +1 -0
- package/dist/lib/package-version.js +52 -0
- package/dist/lib/package-version.js.map +1 -0
- package/dist/lib/paths.d.ts +139 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/paths.js +105 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/payload-version.d.ts +15 -0
- package/dist/lib/payload-version.d.ts.map +1 -0
- package/dist/lib/payload-version.js +24 -0
- package/dist/lib/payload-version.js.map +1 -0
- package/dist/lib/phantom-detect.d.ts +21 -0
- package/dist/lib/phantom-detect.d.ts.map +1 -0
- package/dist/lib/phantom-detect.js +76 -0
- package/dist/lib/phantom-detect.js.map +1 -0
- package/dist/lib/project-context.d.ts +66 -0
- package/dist/lib/project-context.d.ts.map +1 -0
- package/dist/lib/project-context.js +112 -0
- package/dist/lib/project-context.js.map +1 -0
- package/dist/lib/recipe-id.d.ts +13 -0
- package/dist/lib/recipe-id.d.ts.map +1 -0
- package/dist/lib/recipe-id.js +15 -0
- package/dist/lib/recipe-id.js.map +1 -0
- package/dist/lib/registry.d.ts +98 -0
- package/dist/lib/registry.d.ts.map +1 -0
- package/dist/lib/registry.js +152 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/retry.d.ts +26 -0
- package/dist/lib/retry.d.ts.map +1 -0
- package/dist/lib/retry.js +48 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/run-diagnostics.d.ts +64 -0
- package/dist/lib/run-diagnostics.d.ts.map +1 -0
- package/dist/lib/run-diagnostics.js +25 -0
- package/dist/lib/run-diagnostics.js.map +1 -0
- package/dist/lib/run-scope.d.ts +167 -0
- package/dist/lib/run-scope.d.ts.map +1 -0
- package/dist/lib/run-scope.js +176 -0
- package/dist/lib/run-scope.js.map +1 -0
- package/dist/lib/run-timer.d.ts +82 -0
- package/dist/lib/run-timer.d.ts.map +1 -0
- package/dist/lib/run-timer.js +79 -0
- package/dist/lib/run-timer.js.map +1 -0
- package/dist/lib/scope-types.d.ts +172 -0
- package/dist/lib/scope-types.d.ts.map +1 -0
- package/dist/lib/scope-types.js +27 -0
- package/dist/lib/scope-types.js.map +1 -0
- package/dist/lib/severity-policy.d.ts +38 -0
- package/dist/lib/severity-policy.d.ts.map +1 -0
- package/dist/lib/severity-policy.js +44 -0
- package/dist/lib/severity-policy.js.map +1 -0
- package/dist/lib/telemetry.d.ts +93 -0
- package/dist/lib/telemetry.d.ts.map +1 -0
- package/dist/lib/telemetry.js +144 -0
- package/dist/lib/telemetry.js.map +1 -0
- package/dist/lib/ui-context.d.ts +34 -0
- package/dist/lib/ui-context.d.ts.map +1 -0
- package/dist/lib/ui-context.js +16 -0
- package/dist/lib/ui-context.js.map +1 -0
- package/dist/lib/verdict-policy.d.ts +71 -0
- package/dist/lib/verdict-policy.d.ts.map +1 -0
- package/dist/lib/verdict-policy.js +82 -0
- package/dist/lib/verdict-policy.js.map +1 -0
- package/dist/lib/yaml.d.ts +74 -0
- package/dist/lib/yaml.d.ts.map +1 -0
- package/dist/lib/yaml.js +118 -0
- package/dist/lib/yaml.js.map +1 -0
- package/dist/plugins/__tests__/as-if-external.test.d.ts +18 -0
- package/dist/plugins/__tests__/as-if-external.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/as-if-external.test.js +159 -0
- package/dist/plugins/__tests__/as-if-external.test.js.map +1 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts +8 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.js +97 -0
- package/dist/plugins/__tests__/authored-tool-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-discovery.test.js +349 -0
- package/dist/plugins/__tests__/capability-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.js +172 -0
- package/dist/plugins/__tests__/capability-from-manifest.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-loader.test.js +122 -0
- package/dist/plugins/__tests__/capability-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/capability-registry.test.d.ts +2 -0
- package/dist/plugins/__tests__/capability-registry.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/capability-registry.test.js +185 -0
- package/dist/plugins/__tests__/capability-registry.test.js.map +1 -0
- package/dist/plugins/__tests__/discover.test.d.ts +2 -0
- package/dist/plugins/__tests__/discover.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/discover.test.js +311 -0
- package/dist/plugins/__tests__/discover.test.js.map +1 -0
- package/dist/plugins/__tests__/loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/loader.test.js +191 -0
- package/dist/plugins/__tests__/loader.test.js.map +1 -0
- package/dist/plugins/__tests__/manifest-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/manifest-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/manifest-discovery.test.js +132 -0
- package/dist/plugins/__tests__/manifest-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/manifest-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/manifest-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/manifest-loader.test.js +434 -0
- package/dist/plugins/__tests__/manifest-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/marker-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/marker-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/marker-discovery.test.js +164 -0
- package/dist/plugins/__tests__/marker-discovery.test.js.map +1 -0
- package/dist/plugins/__tests__/node-modules-walk.test.d.ts +2 -0
- package/dist/plugins/__tests__/node-modules-walk.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/node-modules-walk.test.js +76 -0
- package/dist/plugins/__tests__/node-modules-walk.test.js.map +1 -0
- package/dist/plugins/__tests__/package-entry.test.d.ts +9 -0
- package/dist/plugins/__tests__/package-entry.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/package-entry.test.js +117 -0
- package/dist/plugins/__tests__/package-entry.test.js.map +1 -0
- package/dist/plugins/__tests__/recipe-loader.test.d.ts +2 -0
- package/dist/plugins/__tests__/recipe-loader.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/recipe-loader.test.js +130 -0
- package/dist/plugins/__tests__/recipe-loader.test.js.map +1 -0
- package/dist/plugins/__tests__/scope-validation.test.d.ts +2 -0
- package/dist/plugins/__tests__/scope-validation.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/scope-validation.test.js +68 -0
- package/dist/plugins/__tests__/scope-validation.test.js.map +1 -0
- package/dist/plugins/__tests__/single-core-guard.test.d.ts +10 -0
- package/dist/plugins/__tests__/single-core-guard.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/single-core-guard.test.js +89 -0
- package/dist/plugins/__tests__/single-core-guard.test.js.map +1 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.js +215 -0
- package/dist/plugins/__tests__/tool-package-discovery.test.js.map +1 -0
- package/dist/plugins/authored-tool-discovery.d.ts +45 -0
- package/dist/plugins/authored-tool-discovery.d.ts.map +1 -0
- package/dist/plugins/authored-tool-discovery.js +61 -0
- package/dist/plugins/authored-tool-discovery.js.map +1 -0
- package/dist/plugins/capability-discovery.d.ts +80 -0
- package/dist/plugins/capability-discovery.d.ts.map +1 -0
- package/dist/plugins/capability-discovery.js +278 -0
- package/dist/plugins/capability-discovery.js.map +1 -0
- package/dist/plugins/capability-loader.d.ts +50 -0
- package/dist/plugins/capability-loader.d.ts.map +1 -0
- package/dist/plugins/capability-loader.js +85 -0
- package/dist/plugins/capability-loader.js.map +1 -0
- package/dist/plugins/capability-registry.d.ts +169 -0
- package/dist/plugins/capability-registry.d.ts.map +1 -0
- package/dist/plugins/capability-registry.js +319 -0
- package/dist/plugins/capability-registry.js.map +1 -0
- package/dist/plugins/discover.d.ts +64 -0
- package/dist/plugins/discover.d.ts.map +1 -0
- package/dist/plugins/discover.js +303 -0
- package/dist/plugins/discover.js.map +1 -0
- package/dist/plugins/index.d.ts +37 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +40 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/json-guards.d.ts +11 -0
- package/dist/plugins/json-guards.d.ts.map +1 -0
- package/dist/plugins/json-guards.js +15 -0
- package/dist/plugins/json-guards.js.map +1 -0
- package/dist/plugins/loader.d.ts +67 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +137 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/manifest-discovery.d.ts +28 -0
- package/dist/plugins/manifest-discovery.d.ts.map +1 -0
- package/dist/plugins/manifest-discovery.js +103 -0
- package/dist/plugins/manifest-discovery.js.map +1 -0
- package/dist/plugins/manifest-loader.d.ts +120 -0
- package/dist/plugins/manifest-loader.d.ts.map +1 -0
- package/dist/plugins/manifest-loader.js +410 -0
- package/dist/plugins/manifest-loader.js.map +1 -0
- package/dist/plugins/marker-discovery.d.ts +115 -0
- package/dist/plugins/marker-discovery.d.ts.map +1 -0
- package/dist/plugins/marker-discovery.js +172 -0
- package/dist/plugins/marker-discovery.js.map +1 -0
- package/dist/plugins/node-modules-walk.d.ts +61 -0
- package/dist/plugins/node-modules-walk.d.ts.map +1 -0
- package/dist/plugins/node-modules-walk.js +99 -0
- package/dist/plugins/node-modules-walk.js.map +1 -0
- package/dist/plugins/package-entry.d.ts +38 -0
- package/dist/plugins/package-entry.d.ts.map +1 -0
- package/dist/plugins/package-entry.js +86 -0
- package/dist/plugins/package-entry.js.map +1 -0
- package/dist/plugins/recipe-loader.d.ts +63 -0
- package/dist/plugins/recipe-loader.d.ts.map +1 -0
- package/dist/plugins/recipe-loader.js +67 -0
- package/dist/plugins/recipe-loader.js.map +1 -0
- package/dist/plugins/scope-validation.d.ts +35 -0
- package/dist/plugins/scope-validation.d.ts.map +1 -0
- package/dist/plugins/scope-validation.js +55 -0
- package/dist/plugins/scope-validation.js.map +1 -0
- package/dist/plugins/single-core-guard.d.ts +28 -0
- package/dist/plugins/single-core-guard.d.ts.map +1 -0
- package/dist/plugins/single-core-guard.js +69 -0
- package/dist/plugins/single-core-guard.js.map +1 -0
- package/dist/plugins/tool-package-discovery.d.ts +93 -0
- package/dist/plugins/tool-package-discovery.d.ts.map +1 -0
- package/dist/plugins/tool-package-discovery.js +118 -0
- package/dist/plugins/tool-package-discovery.js.map +1 -0
- package/dist/plugins/types.d.ts +78 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +15 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/recipes/__tests__/registry.test.d.ts +2 -0
- package/dist/recipes/__tests__/registry.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/registry.test.js +170 -0
- package/dist/recipes/__tests__/registry.test.js.map +1 -0
- package/dist/recipes/__tests__/selector.test.d.ts +20 -0
- package/dist/recipes/__tests__/selector.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/selector.test.js +173 -0
- package/dist/recipes/__tests__/selector.test.js.map +1 -0
- package/dist/recipes/__tests__/unit-config.test.d.ts +7 -0
- package/dist/recipes/__tests__/unit-config.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/unit-config.test.js +52 -0
- package/dist/recipes/__tests__/unit-config.test.js.map +1 -0
- package/dist/recipes/registry.d.ts +105 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +141 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/selector.d.ts +112 -0
- package/dist/recipes/selector.d.ts.map +1 -0
- package/dist/recipes/selector.js +134 -0
- package/dist/recipes/selector.js.map +1 -0
- package/dist/recipes/unit-config.d.ts +63 -0
- package/dist/recipes/unit-config.d.ts.map +1 -0
- package/dist/recipes/unit-config.js +68 -0
- package/dist/recipes/unit-config.js.map +1 -0
- package/dist/runtime/__tests__/in-process-transport.test.d.ts +6 -0
- package/dist/runtime/__tests__/in-process-transport.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/in-process-transport.test.js +73 -0
- package/dist/runtime/__tests__/in-process-transport.test.js.map +1 -0
- package/dist/runtime/__tests__/subprocess-transport.test.d.ts +11 -0
- package/dist/runtime/__tests__/subprocess-transport.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/subprocess-transport.test.js +118 -0
- package/dist/runtime/__tests__/subprocess-transport.test.js.map +1 -0
- package/dist/runtime/in-process-transport.d.ts +20 -0
- package/dist/runtime/in-process-transport.d.ts.map +1 -0
- package/dist/runtime/in-process-transport.js +49 -0
- package/dist/runtime/in-process-transport.js.map +1 -0
- package/dist/runtime/progress-transport.d.ts +73 -0
- package/dist/runtime/progress-transport.d.ts.map +1 -0
- package/dist/runtime/progress-transport.js +17 -0
- package/dist/runtime/progress-transport.js.map +1 -0
- package/dist/runtime/subprocess-transport.d.ts +43 -0
- package/dist/runtime/subprocess-transport.d.ts.map +1 -0
- package/dist/runtime/subprocess-transport.js +134 -0
- package/dist/runtime/subprocess-transport.js.map +1 -0
- package/dist/signals/comment-openers.d.ts +29 -0
- package/dist/signals/comment-openers.d.ts.map +1 -0
- package/dist/signals/comment-openers.js +41 -0
- package/dist/signals/comment-openers.js.map +1 -0
- package/dist/signals/comment-openers.test.d.ts +7 -0
- package/dist/signals/comment-openers.test.d.ts.map +1 -0
- package/dist/signals/comment-openers.test.js +41 -0
- package/dist/signals/comment-openers.test.js.map +1 -0
- package/dist/signals/create-signal-from-violation.d.ts +29 -0
- package/dist/signals/create-signal-from-violation.d.ts.map +1 -0
- package/dist/signals/create-signal-from-violation.js +29 -0
- package/dist/signals/create-signal-from-violation.js.map +1 -0
- package/dist/signals/signal-sink.d.ts +49 -0
- package/dist/signals/signal-sink.d.ts.map +1 -0
- package/dist/signals/signal-sink.js +6 -0
- package/dist/signals/signal-sink.js.map +1 -0
- package/dist/signals/suppress.d.ts +102 -0
- package/dist/signals/suppress.d.ts.map +1 -0
- package/dist/signals/suppress.js +325 -0
- package/dist/signals/suppress.js.map +1 -0
- package/dist/signals/suppress.test.d.ts +2 -0
- package/dist/signals/suppress.test.d.ts.map +1 -0
- package/dist/signals/suppress.test.js +213 -0
- package/dist/signals/suppress.test.js.map +1 -0
- package/dist/tools/__tests__/command-spec.test.d.ts +2 -0
- package/dist/tools/__tests__/command-spec.test.d.ts.map +1 -0
- package/dist/tools/__tests__/command-spec.test.js +191 -0
- package/dist/tools/__tests__/command-spec.test.js.map +1 -0
- package/dist/tools/__tests__/compatibility.test.d.ts +5 -0
- package/dist/tools/__tests__/compatibility.test.d.ts.map +1 -0
- package/dist/tools/__tests__/compatibility.test.js +41 -0
- package/dist/tools/__tests__/compatibility.test.js.map +1 -0
- package/dist/tools/__tests__/ids.test.d.ts +5 -0
- package/dist/tools/__tests__/ids.test.d.ts.map +1 -0
- package/dist/tools/__tests__/ids.test.js +56 -0
- package/dist/tools/__tests__/ids.test.js.map +1 -0
- package/dist/tools/__tests__/manifest-assert.test.d.ts +5 -0
- package/dist/tools/__tests__/manifest-assert.test.d.ts.map +1 -0
- package/dist/tools/__tests__/manifest-assert.test.js +66 -0
- package/dist/tools/__tests__/manifest-assert.test.js.map +1 -0
- package/dist/tools/__tests__/registry.test.d.ts +2 -0
- package/dist/tools/__tests__/registry.test.d.ts.map +1 -0
- package/dist/tools/__tests__/registry.test.js +93 -0
- package/dist/tools/__tests__/registry.test.js.map +1 -0
- package/dist/tools/__tests__/types.test.d.ts +2 -0
- package/dist/tools/__tests__/types.test.d.ts.map +1 -0
- package/dist/tools/__tests__/types.test.js +51 -0
- package/dist/tools/__tests__/types.test.js.map +1 -0
- package/dist/tools/capability.d.ts +257 -0
- package/dist/tools/capability.d.ts.map +1 -0
- package/dist/tools/capability.js +46 -0
- package/dist/tools/capability.js.map +1 -0
- package/dist/tools/command-spec.d.ts +211 -0
- package/dist/tools/command-spec.d.ts.map +1 -0
- package/dist/tools/command-spec.js +110 -0
- package/dist/tools/command-spec.js.map +1 -0
- package/dist/tools/compatibility.d.ts +45 -0
- package/dist/tools/compatibility.d.ts.map +1 -0
- package/dist/tools/compatibility.js +49 -0
- package/dist/tools/compatibility.js.map +1 -0
- package/dist/tools/ids.d.ts +61 -0
- package/dist/tools/ids.d.ts.map +1 -0
- package/dist/tools/ids.js +61 -0
- package/dist/tools/ids.js.map +1 -0
- package/dist/tools/index.d.ts +22 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +28 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/manifest-assert.d.ts +35 -0
- package/dist/tools/manifest-assert.d.ts.map +1 -0
- package/dist/tools/manifest-assert.js +67 -0
- package/dist/tools/manifest-assert.js.map +1 -0
- package/dist/tools/manifest.d.ts +178 -0
- package/dist/tools/manifest.d.ts.map +1 -0
- package/dist/tools/manifest.js +35 -0
- package/dist/tools/manifest.js.map +1 -0
- package/dist/tools/registry.d.ts +37 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +49 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +1021 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +77 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/__tests__/signal.test.d.ts +2 -0
- package/dist/types/__tests__/signal.test.d.ts.map +1 -0
- package/dist/types/__tests__/signal.test.js +111 -0
- package/dist/types/__tests__/signal.test.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/signal-batch.d.ts +56 -0
- package/dist/types/signal-batch.d.ts.map +1 -0
- package/dist/types/signal-batch.js +54 -0
- package/dist/types/signal-batch.js.map +1 -0
- package/dist/types/signal.d.ts +77 -0
- package/dist/types/signal.d.ts.map +1 -0
- package/dist/types/signal.js +42 -0
- package/dist/types/signal.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Scope-owned capability registry (launch, §5.3).
|
|
3
|
+
*
|
|
4
|
+
* The host-side runtime for the capability model in `tools/capability.ts`.
|
|
5
|
+
* A tool declares the domains it OWNS in its static manifest; the host
|
|
6
|
+
* registers each declared domain here alongside the owner-supplied
|
|
7
|
+
* REGISTRAR, then routes incoming contributions to the owning registrar
|
|
8
|
+
* after a Zod-free schema check. The host never interprets a
|
|
9
|
+
* contribution — it only confirms "targets a declared domain + passes its
|
|
10
|
+
* schema" and hands off (north-star §4.5).
|
|
11
|
+
*
|
|
12
|
+
* **Per-`RunScope`, no module singleton.** Mirrors the simulation §5.11
|
|
13
|
+
* template (`createScenarioRegistry` / `currentScenarioRegistry`):
|
|
14
|
+
*
|
|
15
|
+
* - `createCapabilityRegistry()` — factory the CLI bootstrap calls once
|
|
16
|
+
* per invocation, attaching the result to `scope.capabilities`.
|
|
17
|
+
* - `currentCapabilityRegistry()` — reads the scope-bound registry off
|
|
18
|
+
* `currentScope()`; throws when called outside a `RunScope`.
|
|
19
|
+
*
|
|
20
|
+
* Unlike a tool subscope, the capability registry is a KERNEL concern (the
|
|
21
|
+
* host owns it, not any one tool), so its slot lives directly on
|
|
22
|
+
* `ToolScope` (`capabilities?`) rather than under a tool's name. A run that
|
|
23
|
+
* never constructs one carries `scope.capabilities === undefined` and reads
|
|
24
|
+
* return `undefined`.
|
|
25
|
+
*
|
|
26
|
+
* Errors are typed + structured (§ Steps 2.1.3): an unknown domain is a
|
|
27
|
+
* `NotFoundError` (`CAPABILITY.DOMAIN.UNKNOWN`); a schema mismatch is a
|
|
28
|
+
* `ValidationError` (`CAPABILITY.CONTRIBUTION.SCHEMA_MISMATCH`), both
|
|
29
|
+
* carrying a structured `diagnostic` for the CLI error boundary.
|
|
30
|
+
*/
|
|
31
|
+
import { CapabilitySchemaMismatchError, SystemError, UnknownCapabilityDomainError, } from '../lib/errors.js';
|
|
32
|
+
import { logger as defaultLogger } from '../lib/logger.js';
|
|
33
|
+
import { currentScope } from '../lib/run-scope.js';
|
|
34
|
+
import { isCapabilityValidator, isStructuralContributionSchema, } from '../tools/capability.js';
|
|
35
|
+
/**
|
|
36
|
+
* Per-`RunScope` capability registry. Holds the declared domains (by id)
|
|
37
|
+
* and routes contributions to their owners. Construct one per CLI
|
|
38
|
+
* invocation via {@link createCapabilityRegistry}; read the scope-bound
|
|
39
|
+
* instance via {@link currentCapabilityRegistry}.
|
|
40
|
+
*/
|
|
41
|
+
export class CapabilityRegistry {
|
|
42
|
+
domains = new Map();
|
|
43
|
+
/**
|
|
44
|
+
* Per-domain discovery load-state, keyed by domain id. This is the per-scope
|
|
45
|
+
* memoization that the capability loader reads/writes so a domain's
|
|
46
|
+
* contributions are discovered + routed exactly once per project per scope.
|
|
47
|
+
* Because the registry is itself per-`RunScope`, this state is per-scope too —
|
|
48
|
+
* a second run for the same project re-loads into its own fresh registry.
|
|
49
|
+
* This is the structural fix for the audit's F1 (sim's module-level
|
|
50
|
+
* `scenariosLoadedFor`): the marker lives on a scope-owned object, not a module.
|
|
51
|
+
*/
|
|
52
|
+
loadState = new Map();
|
|
53
|
+
logger;
|
|
54
|
+
constructor(logger = defaultLogger) {
|
|
55
|
+
this.logger = logger;
|
|
56
|
+
}
|
|
57
|
+
/** True when domain `domainId` has been discovery-loaded for `projectKey` in this scope. */
|
|
58
|
+
isDomainLoaded(domainId, projectKey) {
|
|
59
|
+
return this.loadState.get(domainId)?.loadedFor === projectKey;
|
|
60
|
+
}
|
|
61
|
+
/** Record that `domainId` finished discovery-loading for `projectKey`, with any routing errors. */
|
|
62
|
+
markDomainLoaded(domainId, projectKey, errors) {
|
|
63
|
+
this.loadState.set(domainId, { loadedFor: projectKey, errors });
|
|
64
|
+
}
|
|
65
|
+
/** Routing errors recorded during the most recent load of `domainId` (empty if none / never loaded). */
|
|
66
|
+
domainLoadErrors(domainId) {
|
|
67
|
+
return this.loadState.get(domainId)?.errors ?? [];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Register a capability domain + its owner's registrar. First-writer-wins
|
|
71
|
+
* on duplicate domain id: a second registration of the same id is a no-op
|
|
72
|
+
* (logged at debug) — mirrors the discovery walker's nearest-ancestor
|
|
73
|
+
* dedup, so re-running discovery is idempotent.
|
|
74
|
+
*
|
|
75
|
+
* @param spec The domain description (id, owner, epoch, schema, kind).
|
|
76
|
+
* @param registrar The owner callback invoked for a validated contribution.
|
|
77
|
+
*/
|
|
78
|
+
registerDomain(spec, registrar) {
|
|
79
|
+
if (this.domains.has(spec.id)) {
|
|
80
|
+
this.logger.debug({
|
|
81
|
+
evt: 'capability.domain.duplicate',
|
|
82
|
+
module: 'core:plugins',
|
|
83
|
+
domainId: spec.id,
|
|
84
|
+
ownerToolId: spec.ownerToolId,
|
|
85
|
+
msg: `capability domain '${spec.id}' already registered — keeping incumbent`,
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.domains.set(spec.id, { spec, registrar });
|
|
90
|
+
this.logger.debug({
|
|
91
|
+
evt: 'capability.domain.registered',
|
|
92
|
+
module: 'core:plugins',
|
|
93
|
+
domainId: spec.id,
|
|
94
|
+
ownerToolId: spec.ownerToolId,
|
|
95
|
+
apiVersion: spec.apiVersion,
|
|
96
|
+
contributionKind: spec.contributionKind,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Replace the registrar for an ALREADY-REGISTERED domain (Phase 4). The
|
|
101
|
+
* manifest-read path ({@link registerCapabilityDomainsFromManifest})
|
|
102
|
+
* registers each declared domain with a DEFERRED placeholder registrar that
|
|
103
|
+
* throws on any contribution; once the owning tool's runtime module loads,
|
|
104
|
+
* the host calls this to swap in the tool's REAL registrar.
|
|
105
|
+
*
|
|
106
|
+
* This is the deliberate complement to {@link registerDomain}'s
|
|
107
|
+
* first-writer-wins: a domain's REGISTRAR is owner-replaceable (the owner
|
|
108
|
+
* supplies it late), but its SPEC is not — the spec stays exactly as the
|
|
109
|
+
* manifest declared it, so identity/epoch/schema cannot be overwritten by a
|
|
110
|
+
* late registrar wiring. Only the owning tool should call this (the host
|
|
111
|
+
* routes by `ownerToolId`); the spec is left untouched.
|
|
112
|
+
*
|
|
113
|
+
* @param domainId The domain whose registrar to replace.
|
|
114
|
+
* @param registrar The owner's real registrar.
|
|
115
|
+
* @throws {NotFoundError} (`CAPABILITY.DOMAIN.UNKNOWN`) when no domain
|
|
116
|
+
* `domainId` is registered — a registrar cannot be wired for a domain the
|
|
117
|
+
* host never declared (a manifest/tool-id mismatch).
|
|
118
|
+
*/
|
|
119
|
+
setRegistrar(domainId, registrar) {
|
|
120
|
+
const entry = this.domains.get(domainId);
|
|
121
|
+
if (entry === undefined) {
|
|
122
|
+
const known = [...this.domains.keys()];
|
|
123
|
+
throw new UnknownCapabilityDomainError(`capability: cannot wire a registrar for undeclared domain '${domainId}'` +
|
|
124
|
+
(known.length > 0 ? ` (known domains: ${known.join(', ')})` : ' (no domains declared)'), { domainId, knownDomains: known });
|
|
125
|
+
}
|
|
126
|
+
// Replace the registrar; keep the manifest-declared spec verbatim.
|
|
127
|
+
this.domains.set(domainId, { spec: entry.spec, registrar });
|
|
128
|
+
this.logger.debug({
|
|
129
|
+
evt: 'capability.domain.registrar_wired',
|
|
130
|
+
module: 'core:plugins',
|
|
131
|
+
domainId,
|
|
132
|
+
ownerToolId: entry.spec.ownerToolId,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/** Whether a domain with `domainId` is registered. */
|
|
136
|
+
hasDomain(domainId) {
|
|
137
|
+
return this.domains.has(domainId);
|
|
138
|
+
}
|
|
139
|
+
/** Look up a registered domain's spec, or `undefined`. */
|
|
140
|
+
getDomain(domainId) {
|
|
141
|
+
return this.domains.get(domainId)?.spec;
|
|
142
|
+
}
|
|
143
|
+
/** All registered domain specs (registration order). */
|
|
144
|
+
listDomains() {
|
|
145
|
+
return [...this.domains.values()].map((d) => d.spec);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Route a contribution to the owner of `domainId`. The host (a) confirms
|
|
149
|
+
* the domain is declared, (b) validates `contribution` against the
|
|
150
|
+
* domain's `contributionSchema`, then (c) hands it to the owner's
|
|
151
|
+
* registrar. The host never interprets the contribution beyond the
|
|
152
|
+
* schema check — the domain owner does.
|
|
153
|
+
*
|
|
154
|
+
* @throws {NotFoundError} (`CAPABILITY.DOMAIN.UNKNOWN`) when no domain
|
|
155
|
+
* `domainId` is registered.
|
|
156
|
+
* @throws {ValidationError} (`CAPABILITY.CONTRIBUTION.SCHEMA_MISMATCH`)
|
|
157
|
+
* when the contribution fails the domain's schema check.
|
|
158
|
+
*/
|
|
159
|
+
routeContribution(domainId, contribution) {
|
|
160
|
+
const entry = this.domains.get(domainId);
|
|
161
|
+
if (entry === undefined) {
|
|
162
|
+
const known = [...this.domains.keys()];
|
|
163
|
+
throw new UnknownCapabilityDomainError(`capability: no domain '${domainId}' is declared` +
|
|
164
|
+
(known.length > 0 ? ` (known domains: ${known.join(', ')})` : ' (no domains declared)'), { domainId, knownDomains: known });
|
|
165
|
+
}
|
|
166
|
+
const verdict = validateContribution(entry.spec.contributionSchema, contribution);
|
|
167
|
+
if (verdict !== true) {
|
|
168
|
+
throw new CapabilitySchemaMismatchError(`capability: contribution to domain '${domainId}' (owner '${entry.spec.ownerToolId}') ` +
|
|
169
|
+
`failed its schema: ${verdict}`, { domainId, ownerToolId: entry.spec.ownerToolId, diagnostic: verdict });
|
|
170
|
+
}
|
|
171
|
+
entry.registrar(contribution);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Validate a contribution against a domain's `contributionSchema` WITHOUT
|
|
176
|
+
* Zod. Three kinds of schema are accepted:
|
|
177
|
+
*
|
|
178
|
+
* - a {@link CapabilityValidator} function — called; its `true | string`
|
|
179
|
+
* result IS the verdict.
|
|
180
|
+
* - a {@link StructuralContributionSchema} (`{ requiredKeys }`) — each
|
|
181
|
+
* listed key must be present (and non-`undefined`) on a record-shaped
|
|
182
|
+
* contribution.
|
|
183
|
+
* - `undefined` / anything else — treated as "no constraint": any
|
|
184
|
+
* contribution passes (a domain may opt out of host-side checking and
|
|
185
|
+
* validate entirely inside its own registrar).
|
|
186
|
+
*
|
|
187
|
+
* @returns `true` when the contribution satisfies the schema, otherwise a
|
|
188
|
+
* human-readable reason string (surfaced in the `ValidationError`).
|
|
189
|
+
*/
|
|
190
|
+
function validateContribution(schema, contribution) {
|
|
191
|
+
if (isCapabilityValidator(schema)) {
|
|
192
|
+
return schema(contribution);
|
|
193
|
+
}
|
|
194
|
+
if (isStructuralContributionSchema(schema)) {
|
|
195
|
+
if (typeof contribution !== 'object' || contribution === null) {
|
|
196
|
+
return `expected an object contribution with keys [${schema.requiredKeys.join(', ')}], got ${contribution === null ? 'null' : typeof contribution}`;
|
|
197
|
+
}
|
|
198
|
+
const record = contribution;
|
|
199
|
+
const missing = schema.requiredKeys.filter((k) => record[k] === undefined);
|
|
200
|
+
if (missing.length > 0) {
|
|
201
|
+
return `missing required key(s): ${missing.join(', ')}`;
|
|
202
|
+
}
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
// No declared constraint — defer all validation to the owner's registrar.
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
/** Construct a fresh capability registry for a single `RunScope`. */
|
|
209
|
+
export function createCapabilityRegistry(logger) {
|
|
210
|
+
return new CapabilityRegistry(logger);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Read the current scope's capability registry. Throws when no scope is
|
|
214
|
+
* active or when the scope has no capability registry — both indicate the
|
|
215
|
+
* caller is running outside the CLI's pre-action-hook (or a test fixture
|
|
216
|
+
* forgot to construct + attach one).
|
|
217
|
+
*
|
|
218
|
+
* @throws {Error} When called outside `runWithScope(...)`, or when the
|
|
219
|
+
* active scope carries no `capabilities` registry.
|
|
220
|
+
*/
|
|
221
|
+
export function currentCapabilityRegistry() {
|
|
222
|
+
const scope = currentScope();
|
|
223
|
+
if (!scope) {
|
|
224
|
+
throw new Error('core: currentCapabilityRegistry() called outside a RunScope. ' +
|
|
225
|
+
'Wrap the call site in runWithScope (production: the pre-action-hook ' +
|
|
226
|
+
'constructs the scope; tests: construct a RunScope, attach ' +
|
|
227
|
+
'createCapabilityRegistry() to scope.capabilities, then runWithScope).');
|
|
228
|
+
}
|
|
229
|
+
if (!scope.capabilities) {
|
|
230
|
+
throw new Error('core: scope.capabilities is missing. The CLI bootstrap must attach ' +
|
|
231
|
+
'createCapabilityRegistry() to the scope before capability reads ' +
|
|
232
|
+
'(production: the pre-action-hook seeds it; tests: assign ' +
|
|
233
|
+
'scope.capabilities = createCapabilityRegistry()).');
|
|
234
|
+
}
|
|
235
|
+
return scope.capabilities;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Register every capability domain a manifest declares into the per-run
|
|
239
|
+
* {@link CapabilityRegistry}, stamping `ownerToolId = manifest.stableId ??
|
|
240
|
+
* manifest.id` on each (§5.3 / Task 2.2; ADR-0048 — the owner key must equal the
|
|
241
|
+
* owning tool's `metadata.id`, which is the stable UUID for modern tools). This
|
|
242
|
+
* is how `MARKER_KINDS` becomes a BOOTSTRAP DEFAULT:
|
|
243
|
+
* the marker enum still seeds the discovery vocabulary, and a
|
|
244
|
+
* manifest-declared domain EXTENDS that set — registered here without any
|
|
245
|
+
* host-enum edit. Additive: a manifest with no `capabilities` registers
|
|
246
|
+
* nothing.
|
|
247
|
+
*
|
|
248
|
+
* The owner-supplied registrar is NOT known at manifest-read time (the
|
|
249
|
+
* tool's runtime module hasn't been imported), so this registers the
|
|
250
|
+
* domain with a deferred-registrar placeholder that THROWS if a
|
|
251
|
+
* contribution is routed before the owning tool wires its real registrar
|
|
252
|
+
* (Phase 4). The host knows the domain EXISTS and who owns it; the owner
|
|
253
|
+
* supplies the actual registrar when its module loads.
|
|
254
|
+
*
|
|
255
|
+
* Emits one structured `capability.domain.from_manifest` evt per domain so
|
|
256
|
+
* a manifest-sourced domain is observable in structured logs (Task 2.2.3).
|
|
257
|
+
*
|
|
258
|
+
* @param manifest The validated manifest carrying the declarations.
|
|
259
|
+
* @param registry The per-run capability registry to populate.
|
|
260
|
+
* @returns The {@link CapabilityDomainSpec}s registered (owner-stamped).
|
|
261
|
+
*/
|
|
262
|
+
export function registerCapabilityDomainsFromManifest(manifest, registry) {
|
|
263
|
+
const declarations = manifest.capabilities ?? [];
|
|
264
|
+
const registered = [];
|
|
265
|
+
for (const decl of declarations) {
|
|
266
|
+
const spec = {
|
|
267
|
+
id: decl.id,
|
|
268
|
+
// ADR-0048: `ownerToolId` must equal the OWNING TOOL'S `metadata.id`, which
|
|
269
|
+
// the capability loader filters on (`d.ownerToolId === owningTool.metadata.id`).
|
|
270
|
+
// Post-ADR-0048 `metadata.id` is the stable UUID (== `manifest.stableId`) and
|
|
271
|
+
// `manifest.id` is the human name (== `metadata.name`). Prefer the stableId so
|
|
272
|
+
// the owner match works; fall back to the human `id` for legacy tools that
|
|
273
|
+
// declare no `stableId` (where `metadata.id` is still the human id).
|
|
274
|
+
ownerToolId: manifest.stableId ?? manifest.id,
|
|
275
|
+
apiVersion: decl.apiVersion,
|
|
276
|
+
contributionSchema: decl.contributionSchema,
|
|
277
|
+
contributionKind: decl.contributionKind,
|
|
278
|
+
// Carry the discovery descriptor onto the spec so the scope-owned capability
|
|
279
|
+
// loader can drive the generic substrate for this domain (§5.3). Absent →
|
|
280
|
+
// the domain auto-discovers nothing.
|
|
281
|
+
...(decl.discovery === undefined ? {} : { discovery: decl.discovery }),
|
|
282
|
+
};
|
|
283
|
+
registry.registerDomain(spec, makeDeferredRegistrar(spec));
|
|
284
|
+
defaultLogger.info({
|
|
285
|
+
evt: 'capability.domain.from_manifest',
|
|
286
|
+
module: 'core:plugins',
|
|
287
|
+
domainId: spec.id,
|
|
288
|
+
ownerToolId: spec.ownerToolId,
|
|
289
|
+
apiVersion: spec.apiVersion,
|
|
290
|
+
contributionKind: spec.contributionKind,
|
|
291
|
+
});
|
|
292
|
+
registered.push(spec);
|
|
293
|
+
}
|
|
294
|
+
return registered;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* A placeholder registrar for a manifest-declared domain whose owning tool
|
|
298
|
+
* has not wired its real registrar (Phase 4). Routing a contribution
|
|
299
|
+
* before then is a programming error — the host knows the domain exists,
|
|
300
|
+
* but no one can yet accept a contribution to it — so it throws a clear
|
|
301
|
+
* diagnostic rather than silently dropping the contribution.
|
|
302
|
+
*
|
|
303
|
+
* @param spec The domain being registered with this placeholder.
|
|
304
|
+
* @returns A {@link CapabilityRegistrar} that throws a {@link SystemError} on
|
|
305
|
+
* any invocation, until Phase 4 replaces it with the owning tool's real
|
|
306
|
+
* registrar.
|
|
307
|
+
*/
|
|
308
|
+
function makeDeferredRegistrar(spec) {
|
|
309
|
+
return () => {
|
|
310
|
+
// A SystemError (internal invariant violation): the domain exists but its
|
|
311
|
+
// owning tool has not wired a real registrar yet, so a contribution arrived
|
|
312
|
+
// before anyone can accept it. Self-documenting typed error — the throw is
|
|
313
|
+
// intentional (placeholder until Phase 4 wires real registrars).
|
|
314
|
+
throw new SystemError(`capability: domain '${spec.id}' (owner '${spec.ownerToolId}') was declared in a ` +
|
|
315
|
+
`manifest but its owning tool has not registered a runtime registrar yet ` +
|
|
316
|
+
`(Phase 4 wires real registrars). Cannot accept a contribution.`);
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=capability-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-registry.js","sourceRoot":"","sources":["../../src/plugins/capability-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EACL,6BAA6B,EAC7B,WAAW,EACX,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,aAAa,EAAe,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,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CAAC,CAAC;QAC3D,aAAa,CAAC,IAAI,CAAC;YACjB,GAAG,EAAE,iCAAiC;YACtC,MAAM,EAAE,cAAc;YACtB,QAAQ,EAAE,IAAI,CAAC,EAAE;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC,CAAC,CAAC;QACH,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,qBAAqB,CAAC,IAA0B;IACvD,OAAO,GAAG,EAAE;QACV,0EAA0E;QAC1E,4EAA4E;QAC5E,2EAA2E;QAC3E,iEAAiE;QACjE,MAAM,IAAI,WAAW,CACnB,uBAAuB,IAAI,CAAC,EAAE,aAAa,IAAI,CAAC,WAAW,uBAAuB;YAChF,0EAA0E;YAC1E,gEAAgE,CACnE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Plugin discovery for the project-local layout.
|
|
3
|
+
*
|
|
4
|
+
* Discovery is descriptor-driven: the caller passes a `PluginLayout`
|
|
5
|
+
* (`{ domain, userSubdirs }`) declared by the owning tool. The kernel
|
|
6
|
+
* never enumerates tool domains itself (ADR-0009 corollary 1). Two
|
|
7
|
+
* artifact sources are walked for the layout:
|
|
8
|
+
*
|
|
9
|
+
* 1. USER SOURCE — recursive `.js` / `.mjs` files under
|
|
10
|
+
* `<project>/opensip-cli/<domain>/<kind>/`
|
|
11
|
+
* for each `kind` in `layout.userSubdirs` (e.g. `checks`/`recipes`
|
|
12
|
+
* for fitness, `scenarios`/`recipes` for simulation). Auto-loaded
|
|
13
|
+
* by directory presence; no config opt-in.
|
|
14
|
+
*
|
|
15
|
+
* 2. NPM PLUGINS — packages installed under
|
|
16
|
+
* `<project>/opensip-cli/.runtime/plugins/<domain>/node_modules/`
|
|
17
|
+
* whose names appear in the project's
|
|
18
|
+
* `opensip-cli.config.yml#plugins.<domain>: [...]`. The explicit
|
|
19
|
+
* list is required so a `plugin install` step is intentional, not
|
|
20
|
+
* an accidental load of every transitive devDep.
|
|
21
|
+
*
|
|
22
|
+
* A layout with an empty `userSubdirs` and no declared npm plugins
|
|
23
|
+
* (e.g. the language-adapter domain, whose adapters ship as direct CLI
|
|
24
|
+
* deps) discovers nothing — an emergent property, not a special case.
|
|
25
|
+
*/
|
|
26
|
+
import type { DiscoveredPlugin, PluginLayout } from './types.js';
|
|
27
|
+
/**
|
|
28
|
+
* Discover all plugins for a layout in the project layout.
|
|
29
|
+
*
|
|
30
|
+
* Returns a list of `DiscoveredPlugin` entries (loose .mjs files +
|
|
31
|
+
* npm packages) for the loader to import. Discovery is silent on a
|
|
32
|
+
* missing project directory or absent subdirs — callers that care
|
|
33
|
+
* about "did we find anything?" should check the returned length.
|
|
34
|
+
*
|
|
35
|
+
* @param layout The owning tool's `PluginLayout` (`{ domain,
|
|
36
|
+
* userSubdirs }`).
|
|
37
|
+
* @param projectDir Project root. Required — there is no user-global
|
|
38
|
+
* fallback. Pass undefined to discover nothing
|
|
39
|
+
* (used by callers that don't have a project
|
|
40
|
+
* context yet).
|
|
41
|
+
*/
|
|
42
|
+
export declare function discoverPlugins(layout: PluginLayout, projectDir?: string): DiscoveredPlugin[];
|
|
43
|
+
/**
|
|
44
|
+
* Read the declared plugin list for a domain from the project config.
|
|
45
|
+
* Returns undefined when the config is absent, unreadable, or has no
|
|
46
|
+
* entry for the domain. Does NOT throw on YAML parse errors — returns
|
|
47
|
+
* undefined so discovery falls through gracefully and the config-layer
|
|
48
|
+
* schema validation surfaces parse errors on its own path.
|
|
49
|
+
*
|
|
50
|
+
* Config-path resolution mirrors `resolveProjectConfigPath` (the same
|
|
51
|
+
* helper the targets loader uses): --config flag → `package.json#
|
|
52
|
+
* opensip-cli.configPath` pointer → default `<projectDir>/opensip-
|
|
53
|
+
* tools.config.yml`. Without this, projects that locate their config
|
|
54
|
+
* via the package.json pointer have their `plugins.<domain>: [...]`
|
|
55
|
+
* declaration silently ignored — discovery falls through to the empty
|
|
56
|
+
* default path and the plugin pack never registers.
|
|
57
|
+
*
|
|
58
|
+
* The `--config` precedence is honored only when callers pass through
|
|
59
|
+
* their explicit value via `explicitConfigPath`; this entry point is
|
|
60
|
+
* the implicit one (no --config available at the discovery seam), so
|
|
61
|
+
* we resolve without an explicit path and rely on the pointer + default.
|
|
62
|
+
*/
|
|
63
|
+
export declare function readProjectPluginsList(projectDir: string, domain: string): readonly string[] | undefined;
|
|
64
|
+
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/plugins/discover.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAYH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AASjE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAuC7F;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,SAAS,MAAM,EAAE,GAAG,SAAS,CAqB/B"}
|