@ai-primitives-hub/core 0.2.0 → 0.2.2-next.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/dist/domain/bundle/version.d.ts +13 -0
- package/dist/domain/bundle/version.d.ts.map +1 -1
- package/dist/domain/bundle/version.js +27 -0
- package/dist/domain/bundle/version.js.map +1 -1
- package/dist/domain/collection/apm-release-plan.d.ts +39 -0
- package/dist/domain/collection/apm-release-plan.d.ts.map +1 -0
- package/dist/domain/collection/apm-release-plan.js +185 -0
- package/dist/domain/collection/apm-release-plan.js.map +1 -0
- package/dist/domain/collection/contribution.d.ts +126 -0
- package/dist/domain/collection/contribution.d.ts.map +1 -0
- package/dist/domain/collection/contribution.js +462 -0
- package/dist/domain/collection/contribution.js.map +1 -0
- package/dist/domain/collection/diagnostics.d.ts +166 -0
- package/dist/domain/collection/diagnostics.d.ts.map +1 -0
- package/dist/domain/collection/diagnostics.js +3 -0
- package/dist/domain/collection/diagnostics.js.map +1 -0
- package/dist/domain/collection/manifest-validator.d.ts +3 -2
- package/dist/domain/collection/manifest-validator.d.ts.map +1 -1
- package/dist/domain/collection/manifest-validator.js +99 -17
- package/dist/domain/collection/manifest-validator.js.map +1 -1
- package/dist/domain/collection/release-manifest-plan.d.ts +9 -0
- package/dist/domain/collection/release-manifest-plan.d.ts.map +1 -1
- package/dist/domain/collection/release-manifest-plan.js +45 -14
- package/dist/domain/collection/release-manifest-plan.js.map +1 -1
- package/dist/domain/collection/validate.d.ts +5 -0
- package/dist/domain/collection/validate.d.ts.map +1 -1
- package/dist/domain/collection/validate.js +7 -2
- package/dist/domain/collection/validate.js.map +1 -1
- package/dist/domain/diagnostics/primitives/catalogue.d.ts +40 -0
- package/dist/domain/diagnostics/primitives/catalogue.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/catalogue.js +78 -0
- package/dist/domain/diagnostics/primitives/catalogue.js.map +1 -0
- package/dist/domain/diagnostics/primitives/classifier.d.ts +81 -0
- package/dist/domain/diagnostics/primitives/classifier.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/classifier.js +138 -0
- package/dist/domain/diagnostics/primitives/classifier.js.map +1 -0
- package/dist/domain/diagnostics/primitives/evaluators.d.ts +138 -0
- package/dist/domain/diagnostics/primitives/evaluators.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/evaluators.js +485 -0
- package/dist/domain/diagnostics/primitives/evaluators.js.map +1 -0
- package/dist/domain/diagnostics/primitives/fixture.d.ts +97 -0
- package/dist/domain/diagnostics/primitives/fixture.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/fixture.js +265 -0
- package/dist/domain/diagnostics/primitives/fixture.js.map +1 -0
- package/dist/domain/diagnostics/primitives/index.d.ts +18 -0
- package/dist/domain/diagnostics/primitives/index.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/index.js +34 -0
- package/dist/domain/diagnostics/primitives/index.js.map +1 -0
- package/dist/domain/diagnostics/primitives/known-gaps.d.ts +50 -0
- package/dist/domain/diagnostics/primitives/known-gaps.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/known-gaps.js +148 -0
- package/dist/domain/diagnostics/primitives/known-gaps.js.map +1 -0
- package/dist/domain/diagnostics/primitives/manifest-view.d.ts +28 -0
- package/dist/domain/diagnostics/primitives/manifest-view.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/manifest-view.js +50 -0
- package/dist/domain/diagnostics/primitives/manifest-view.js.map +1 -0
- package/dist/domain/diagnostics/primitives/placements.d.ts +51 -0
- package/dist/domain/diagnostics/primitives/placements.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/placements.js +76 -0
- package/dist/domain/diagnostics/primitives/placements.js.map +1 -0
- package/dist/domain/diagnostics/primitives/planner.d.ts +60 -0
- package/dist/domain/diagnostics/primitives/planner.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/planner.js +60 -0
- package/dist/domain/diagnostics/primitives/planner.js.map +1 -0
- package/dist/domain/diagnostics/primitives/plugin-projection.d.ts +38 -0
- package/dist/domain/diagnostics/primitives/plugin-projection.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/plugin-projection.js +173 -0
- package/dist/domain/diagnostics/primitives/plugin-projection.js.map +1 -0
- package/dist/domain/diagnostics/primitives/report.d.ts +122 -0
- package/dist/domain/diagnostics/primitives/report.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/report.js +85 -0
- package/dist/domain/diagnostics/primitives/report.js.map +1 -0
- package/dist/domain/diagnostics/primitives/sandbox.d.ts +59 -0
- package/dist/domain/diagnostics/primitives/sandbox.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/sandbox.js +193 -0
- package/dist/domain/diagnostics/primitives/sandbox.js.map +1 -0
- package/dist/domain/diagnostics/primitives/support-matrix.d.ts +36 -0
- package/dist/domain/diagnostics/primitives/support-matrix.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/support-matrix.js +69 -0
- package/dist/domain/diagnostics/primitives/support-matrix.js.map +1 -0
- package/dist/domain/diagnostics/primitives/types.d.ts +117 -0
- package/dist/domain/diagnostics/primitives/types.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/types.js +62 -0
- package/dist/domain/diagnostics/primitives/types.js.map +1 -0
- package/dist/domain/governance/catalogue.d.ts +11 -0
- package/dist/domain/governance/catalogue.d.ts.map +1 -0
- package/dist/domain/governance/catalogue.js +45 -0
- package/dist/domain/governance/catalogue.js.map +1 -0
- package/dist/domain/governance/effective-rules.d.ts +19 -0
- package/dist/domain/governance/effective-rules.d.ts.map +1 -0
- package/dist/domain/governance/effective-rules.js +49 -0
- package/dist/domain/governance/effective-rules.js.map +1 -0
- package/dist/domain/governance/evaluate.d.ts +16 -0
- package/dist/domain/governance/evaluate.d.ts.map +1 -0
- package/dist/domain/governance/evaluate.js +34 -0
- package/dist/domain/governance/evaluate.js.map +1 -0
- package/dist/domain/governance/hub-scope.d.ts +74 -0
- package/dist/domain/governance/hub-scope.d.ts.map +1 -0
- package/dist/domain/governance/hub-scope.js +202 -0
- package/dist/domain/governance/hub-scope.js.map +1 -0
- package/dist/domain/governance/hub-scoped-inventory.d.ts +22 -0
- package/dist/domain/governance/hub-scoped-inventory.d.ts.map +1 -0
- package/dist/domain/governance/hub-scoped-inventory.js +59 -0
- package/dist/domain/governance/hub-scoped-inventory.js.map +1 -0
- package/dist/domain/governance/index.d.ts +15 -0
- package/dist/domain/governance/index.d.ts.map +1 -0
- package/dist/domain/governance/index.js +31 -0
- package/dist/domain/governance/index.js.map +1 -0
- package/dist/domain/governance/rule-registry.d.ts +20 -0
- package/dist/domain/governance/rule-registry.d.ts.map +1 -0
- package/dist/domain/governance/rule-registry.js +40 -0
- package/dist/domain/governance/rule-registry.js.map +1 -0
- package/dist/domain/governance/rules/collection.d.ts +32 -0
- package/dist/domain/governance/rules/collection.d.ts.map +1 -0
- package/dist/domain/governance/rules/collection.js +153 -0
- package/dist/domain/governance/rules/collection.js.map +1 -0
- package/dist/domain/governance/rules/config.d.ts +15 -0
- package/dist/domain/governance/rules/config.d.ts.map +1 -0
- package/dist/domain/governance/rules/config.js +38 -0
- package/dist/domain/governance/rules/config.js.map +1 -0
- package/dist/domain/governance/rules/hub.d.ts +7 -0
- package/dist/domain/governance/rules/hub.d.ts.map +1 -0
- package/dist/domain/governance/rules/hub.js +10 -0
- package/dist/domain/governance/rules/hub.js.map +1 -0
- package/dist/domain/governance/types.d.ts +70 -0
- package/dist/domain/governance/types.d.ts.map +1 -0
- package/dist/domain/governance/types.js +7 -0
- package/dist/domain/governance/types.js.map +1 -0
- package/dist/domain/hub/diagnostics.d.ts +92 -0
- package/dist/domain/hub/diagnostics.d.ts.map +1 -0
- package/dist/domain/hub/diagnostics.js +11 -0
- package/dist/domain/hub/diagnostics.js.map +1 -0
- package/dist/domain/hub/profile-requirements.d.ts +16 -0
- package/dist/domain/hub/profile-requirements.d.ts.map +1 -0
- package/dist/domain/hub/profile-requirements.js +16 -0
- package/dist/domain/hub/profile-requirements.js.map +1 -0
- package/dist/domain/hub/replicate.d.ts +23 -0
- package/dist/domain/hub/replicate.d.ts.map +1 -1
- package/dist/domain/hub/replicate.js +13 -0
- package/dist/domain/hub/replicate.js.map +1 -1
- package/dist/domain/hub/types.d.ts +2 -0
- package/dist/domain/hub/types.d.ts.map +1 -1
- package/dist/domain/hub/validate.d.ts +150 -2
- package/dist/domain/hub/validate.d.ts.map +1 -1
- package/dist/domain/hub/validate.js +421 -37
- package/dist/domain/hub/validate.js.map +1 -1
- package/dist/domain/index.d.ts +17 -0
- package/dist/domain/index.d.ts.map +1 -1
- package/dist/domain/index.js +17 -0
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/install/category.d.ts +31 -0
- package/dist/domain/install/category.d.ts.map +1 -0
- package/dist/domain/install/category.js +33 -0
- package/dist/domain/install/category.js.map +1 -0
- package/dist/domain/install/file-mode.d.ts +49 -0
- package/dist/domain/install/file-mode.d.ts.map +1 -0
- package/dist/domain/install/file-mode.js +54 -0
- package/dist/domain/install/file-mode.js.map +1 -0
- package/dist/domain/install/git-exclude.d.ts +22 -0
- package/dist/domain/install/git-exclude.d.ts.map +1 -0
- package/dist/domain/install/git-exclude.js +56 -0
- package/dist/domain/install/git-exclude.js.map +1 -0
- package/dist/domain/install/installable.d.ts +2 -0
- package/dist/domain/install/installable.d.ts.map +1 -1
- package/dist/domain/install/kind-route.d.ts +80 -0
- package/dist/domain/install/kind-route.d.ts.map +1 -0
- package/dist/domain/install/kind-route.js +135 -0
- package/dist/domain/install/kind-route.js.map +1 -0
- package/dist/domain/install/record-errors.d.ts +53 -0
- package/dist/domain/install/record-errors.d.ts.map +1 -0
- package/dist/domain/install/record-errors.js +104 -0
- package/dist/domain/install/record-errors.js.map +1 -0
- package/dist/domain/install/record-object.d.ts +21 -0
- package/dist/domain/install/record-object.d.ts.map +1 -0
- package/dist/domain/install/record-object.js +38 -0
- package/dist/domain/install/record-object.js.map +1 -0
- package/dist/domain/install/record-parse.d.ts +23 -0
- package/dist/domain/install/record-parse.d.ts.map +1 -0
- package/dist/domain/install/record-parse.js +73 -0
- package/dist/domain/install/record-parse.js.map +1 -0
- package/dist/domain/install/record-path.d.ts +26 -0
- package/dist/domain/install/record-path.d.ts.map +1 -0
- package/dist/domain/install/record-path.js +130 -0
- package/dist/domain/install/record-path.js.map +1 -0
- package/dist/domain/install/record-types.d.ts +183 -0
- package/dist/domain/install/record-types.d.ts.map +1 -0
- package/dist/domain/install/record-types.js +92 -0
- package/dist/domain/install/record-types.js.map +1 -0
- package/dist/domain/install/types.d.ts +2 -0
- package/dist/domain/install/types.d.ts.map +1 -1
- package/dist/domain/mcp/index.d.ts +1 -0
- package/dist/domain/mcp/index.d.ts.map +1 -1
- package/dist/domain/mcp/index.js +1 -0
- package/dist/domain/mcp/index.js.map +1 -1
- package/dist/domain/mcp/server-key.d.ts +35 -0
- package/dist/domain/mcp/server-key.d.ts.map +1 -0
- package/dist/domain/mcp/server-key.js +44 -0
- package/dist/domain/mcp/server-key.js.map +1 -0
- package/dist/domain/plugin/agent-plugin-spec.d.ts +8 -0
- package/dist/domain/plugin/agent-plugin-spec.d.ts.map +1 -1
- package/dist/domain/plugin/agent-plugin-spec.js +22 -8
- package/dist/domain/plugin/agent-plugin-spec.js.map +1 -1
- package/dist/domain/registry-error.d.ts +1 -1
- package/dist/domain/registry-error.d.ts.map +1 -1
- package/dist/domain/registry-error.js +2 -1
- package/dist/domain/registry-error.js.map +1 -1
- package/dist/domain/security/fingerprint.d.ts +18 -0
- package/dist/domain/security/fingerprint.d.ts.map +1 -0
- package/dist/domain/security/fingerprint.js +34 -0
- package/dist/domain/security/fingerprint.js.map +1 -0
- package/dist/domain/security/high-impact-rules.d.ts +30 -0
- package/dist/domain/security/high-impact-rules.d.ts.map +1 -0
- package/dist/domain/security/high-impact-rules.js +160 -0
- package/dist/domain/security/high-impact-rules.js.map +1 -0
- package/dist/domain/security/index.d.ts +10 -0
- package/dist/domain/security/index.d.ts.map +1 -0
- package/dist/domain/security/index.js +26 -0
- package/dist/domain/security/index.js.map +1 -0
- package/dist/domain/security/markdown-context.d.ts +17 -0
- package/dist/domain/security/markdown-context.d.ts.map +1 -0
- package/dist/domain/security/markdown-context.js +74 -0
- package/dist/domain/security/markdown-context.js.map +1 -0
- package/dist/domain/security/policy.d.ts +17 -0
- package/dist/domain/security/policy.d.ts.map +1 -0
- package/dist/domain/security/policy.js +31 -0
- package/dist/domain/security/policy.js.map +1 -0
- package/dist/domain/security/rating/findings-document.d.ts +22 -0
- package/dist/domain/security/rating/findings-document.d.ts.map +1 -0
- package/dist/domain/security/rating/findings-document.js +57 -0
- package/dist/domain/security/rating/findings-document.js.map +1 -0
- package/dist/domain/security/rating/index.d.ts +5 -0
- package/dist/domain/security/rating/index.d.ts.map +1 -0
- package/dist/domain/security/rating/index.js +21 -0
- package/dist/domain/security/rating/index.js.map +1 -0
- package/dist/domain/security/rating/scoring.d.ts +83 -0
- package/dist/domain/security/rating/scoring.d.ts.map +1 -0
- package/dist/domain/security/rating/scoring.js +115 -0
- package/dist/domain/security/rating/scoring.js.map +1 -0
- package/dist/domain/security/rating/security-rating-report.d.ts +111 -0
- package/dist/domain/security/rating/security-rating-report.d.ts.map +1 -0
- package/dist/domain/security/rating/security-rating-report.js +152 -0
- package/dist/domain/security/rating/security-rating-report.js.map +1 -0
- package/dist/domain/security/rating/types.d.ts +22 -0
- package/dist/domain/security/rating/types.d.ts.map +1 -0
- package/dist/domain/security/rating/types.js +11 -0
- package/dist/domain/security/rating/types.js.map +1 -0
- package/dist/domain/security/remediations.d.ts +17 -0
- package/dist/domain/security/remediations.d.ts.map +1 -0
- package/dist/domain/security/remediations.js +61 -0
- package/dist/domain/security/remediations.js.map +1 -0
- package/dist/domain/security/rule-engine.d.ts +8 -0
- package/dist/domain/security/rule-engine.d.ts.map +1 -0
- package/dist/domain/security/rule-engine.js +875 -0
- package/dist/domain/security/rule-engine.js.map +1 -0
- package/dist/domain/security/suppression.d.ts +19 -0
- package/dist/domain/security/suppression.d.ts.map +1 -0
- package/dist/domain/security/suppression.js +78 -0
- package/dist/domain/security/suppression.js.map +1 -0
- package/dist/domain/security/types.d.ts +91 -0
- package/dist/domain/security/types.d.ts.map +1 -0
- package/dist/domain/security/types.js +10 -0
- package/dist/domain/security/types.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/ports/app-storage.d.ts +11 -15
- package/dist/ports/app-storage.d.ts.map +1 -1
- package/dist/ports/app-storage.js +8 -8
- package/dist/ports/argv-process-runner.d.ts +6 -0
- package/dist/ports/argv-process-runner.d.ts.map +1 -0
- package/dist/ports/argv-process-runner.js +3 -0
- package/dist/ports/argv-process-runner.js.map +1 -0
- package/dist/ports/bundle-extractor.d.ts +16 -3
- package/dist/ports/bundle-extractor.d.ts.map +1 -1
- package/dist/ports/collection-contribution.d.ts +36 -0
- package/dist/ports/collection-contribution.d.ts.map +1 -0
- package/dist/ports/collection-contribution.js +3 -0
- package/dist/ports/collection-contribution.js.map +1 -0
- package/dist/ports/filesystem.d.ts +12 -0
- package/dist/ports/filesystem.d.ts.map +1 -1
- package/dist/ports/hub-collection-index.d.ts +27 -0
- package/dist/ports/hub-collection-index.d.ts.map +1 -0
- package/dist/ports/hub-collection-index.js +3 -0
- package/dist/ports/hub-collection-index.js.map +1 -0
- package/dist/ports/hub-contribution.d.ts +158 -0
- package/dist/ports/hub-contribution.d.ts.map +1 -0
- package/dist/ports/hub-contribution.js +3 -0
- package/dist/ports/hub-contribution.js.map +1 -0
- package/dist/ports/index.d.ts +12 -0
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +12 -0
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/primitive-diagnostics-driver.d.ts +96 -0
- package/dist/ports/primitive-diagnostics-driver.d.ts.map +1 -0
- package/dist/ports/primitive-diagnostics-driver.js +3 -0
- package/dist/ports/primitive-diagnostics-driver.js.map +1 -0
- package/dist/ports/record-fs.d.ts +46 -0
- package/dist/ports/record-fs.d.ts.map +1 -0
- package/dist/ports/record-fs.js +9 -0
- package/dist/ports/record-fs.js.map +1 -0
- package/dist/ports/registry-operations.d.ts +3 -2
- package/dist/ports/registry-operations.d.ts.map +1 -1
- package/dist/ports/release-lookup.d.ts +24 -0
- package/dist/ports/release-lookup.d.ts.map +1 -0
- package/dist/ports/release-lookup.js +7 -0
- package/dist/ports/release-lookup.js.map +1 -0
- package/dist/ports/release-source.d.ts +17 -3
- package/dist/ports/release-source.d.ts.map +1 -1
- package/dist/ports/repository-exclusion.d.ts +30 -0
- package/dist/ports/repository-exclusion.d.ts.map +1 -0
- package/dist/ports/repository-exclusion.js +3 -0
- package/dist/ports/repository-exclusion.js.map +1 -0
- package/dist/ports/schema-validator.d.ts +25 -0
- package/dist/ports/schema-validator.d.ts.map +1 -0
- package/dist/ports/schema-validator.js +7 -0
- package/dist/ports/schema-validator.js.map +1 -0
- package/dist/ports/security-report-store.d.ts +9 -0
- package/dist/ports/security-report-store.d.ts.map +1 -0
- package/dist/ports/security-report-store.js +4 -0
- package/dist/ports/security-report-store.js.map +1 -0
- package/dist/ports/security-scan-engine.d.ts +32 -0
- package/dist/ports/security-scan-engine.d.ts.map +1 -0
- package/dist/ports/security-scan-engine.js +6 -0
- package/dist/ports/security-scan-engine.js.map +1 -0
- package/dist/ports/security-scan-input.d.ts +63 -0
- package/dist/ports/security-scan-input.d.ts.map +1 -0
- package/dist/ports/security-scan-input.js +3 -0
- package/dist/ports/security-scan-input.js.map +1 -0
- package/dist/ports/source-adapter.d.ts +11 -0
- package/dist/ports/source-adapter.d.ts.map +1 -1
- package/dist/public/schemas/collection.schema.json +0 -1
- package/dist/public/schemas/hub-governance.schema.json +21 -0
- package/dist/public/schemas/install-record.schema.json +343 -0
- package/dist/public/schemas/security-rating-report.schema.json +113 -0
- package/package.json +2 -2
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describeRecordError = exports.recordErrorDetails = exports.isRecordError = exports.recordError = exports.RECORD_ERROR_CODES = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Install record error codes and helpers. Record failures are plain
|
|
6
|
+
* `RegistryError`s in the `RECORD` namespace; the file and detail travel in
|
|
7
|
+
* `context`. Messages never include file contents.
|
|
8
|
+
* @module domain/install/record-errors
|
|
9
|
+
*/
|
|
10
|
+
const registry_error_1 = require("../registry-error");
|
|
11
|
+
/** Stable `RECORD.*` codes. New codes may be added; none are renamed or removed. */
|
|
12
|
+
exports.RECORD_ERROR_CODES = [
|
|
13
|
+
'RECORD.MALFORMED',
|
|
14
|
+
'RECORD.NEWER_FORMAT',
|
|
15
|
+
'RECORD.PATH_OUTSIDE_ROOT',
|
|
16
|
+
'RECORD.LEGACY_UNMIGRATED',
|
|
17
|
+
'RECORD.UNKNOWN_TOOL',
|
|
18
|
+
'RECORD.WRITE_FAILED',
|
|
19
|
+
'RECORD.CLI_MANAGED',
|
|
20
|
+
'RECORD.ENTRY_NOT_FOUND',
|
|
21
|
+
'RECORD.HUB_CONFLICT',
|
|
22
|
+
'RECORD.MCP_CONFLICT',
|
|
23
|
+
'RECORD.MCP_CONFIG_UNREADABLE'
|
|
24
|
+
];
|
|
25
|
+
const DEFAULT_MESSAGES = {
|
|
26
|
+
'RECORD.MALFORMED': 'The install record is malformed and was left unchanged.',
|
|
27
|
+
'RECORD.NEWER_FORMAT': 'The install record was written by a newer release and was left unchanged.',
|
|
28
|
+
'RECORD.PATH_OUTSIDE_ROOT': 'The install record lists a path outside the repository; nothing was written or deleted.',
|
|
29
|
+
'RECORD.LEGACY_UNMIGRATED': 'The install record uses an older format that this release cannot migrate yet.',
|
|
30
|
+
'RECORD.UNKNOWN_TOOL': 'The tool is not a known install target.',
|
|
31
|
+
'RECORD.WRITE_FAILED': 'The install record could not be written; the previous file was left intact.',
|
|
32
|
+
'RECORD.CLI_MANAGED': 'This bundle was installed with the ai-primitives-hub CLI.',
|
|
33
|
+
'RECORD.ENTRY_NOT_FOUND': 'The install record has no entry for this bundle and tool; nothing was removed.',
|
|
34
|
+
'RECORD.HUB_CONFLICT': 'The source is already recorded from another hub; nothing was recorded.',
|
|
35
|
+
'RECORD.MCP_CONFLICT': 'The MCP file already has a server of this name that no install recorded; it was left unchanged.',
|
|
36
|
+
'RECORD.MCP_CONFIG_UNREADABLE': 'The MCP file is not plain JSON, so its servers were left unchanged.'
|
|
37
|
+
};
|
|
38
|
+
const DEFAULT_HINTS = {
|
|
39
|
+
'RECORD.MALFORMED': 'Fix or remove the file, then run the command again.',
|
|
40
|
+
'RECORD.NEWER_FORMAT': 'Upgrade ai-primitives-hub to a release that reads this record format.',
|
|
41
|
+
'RECORD.PATH_OUTSIDE_ROOT': 'Remove the offending entry from the record, then run the command again.',
|
|
42
|
+
'RECORD.LEGACY_UNMIGRATED': 'Upgrade ai-primitives-hub to a release that migrates older records.',
|
|
43
|
+
'RECORD.UNKNOWN_TOOL': 'Use one of the supported target types.',
|
|
44
|
+
'RECORD.WRITE_FAILED': 'Check that the folder is writable and has free space, then run the command again.',
|
|
45
|
+
'RECORD.CLI_MANAGED': 'Manage this bundle with the ai-primitives-hub CLI for now.',
|
|
46
|
+
'RECORD.ENTRY_NOT_FOUND': 'Check the bundle id and target with `ai-primitives-hub list`, then run the command again.',
|
|
47
|
+
'RECORD.HUB_CONFLICT': 'A source belongs to one hub. Uninstall its bundles, or install them through the hub already recorded.',
|
|
48
|
+
'RECORD.MCP_CONFLICT': 'Rename or remove that server in the MCP file, then run the command again.',
|
|
49
|
+
'RECORD.MCP_CONFIG_UNREADABLE': 'Remove comments and trailing commas from the MCP file, or fix it, then run the command again.'
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Build a `RegistryError` for a record failure.
|
|
53
|
+
* @param code - `RECORD.*` code.
|
|
54
|
+
* @param details - File, detail, hint and overrides.
|
|
55
|
+
*/
|
|
56
|
+
const recordError = (code, details = {}) => {
|
|
57
|
+
const context = {};
|
|
58
|
+
if (details.file !== undefined) {
|
|
59
|
+
context.file = details.file;
|
|
60
|
+
}
|
|
61
|
+
if (details.detail !== undefined) {
|
|
62
|
+
context.detail = details.detail;
|
|
63
|
+
}
|
|
64
|
+
for (const [key, value] of Object.entries(details.context ?? {})) {
|
|
65
|
+
context[key] = value;
|
|
66
|
+
}
|
|
67
|
+
return new registry_error_1.RegistryError({
|
|
68
|
+
code,
|
|
69
|
+
message: details.message ?? DEFAULT_MESSAGES[code],
|
|
70
|
+
hint: details.hint ?? DEFAULT_HINTS[code],
|
|
71
|
+
cause: details.cause,
|
|
72
|
+
context: Object.keys(context).length > 0 ? context : undefined
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
exports.recordError = recordError;
|
|
76
|
+
/**
|
|
77
|
+
* Whether a value is a record error.
|
|
78
|
+
* @param value - Anything thrown.
|
|
79
|
+
* @param code - Code to match; any `RECORD.*` code when omitted.
|
|
80
|
+
*/
|
|
81
|
+
const isRecordError = (value, code) => value instanceof registry_error_1.RegistryError
|
|
82
|
+
&& (code === undefined ? exports.RECORD_ERROR_CODES.includes(value.code) : value.code === code);
|
|
83
|
+
exports.isRecordError = isRecordError;
|
|
84
|
+
/**
|
|
85
|
+
* The `file` and `detail` a record error carries in its context.
|
|
86
|
+
* @param error - A record error.
|
|
87
|
+
*/
|
|
88
|
+
const recordErrorDetails = (error) => ({
|
|
89
|
+
...(typeof error.context?.file === 'string' ? { file: error.context.file } : {}),
|
|
90
|
+
...(typeof error.context?.detail === 'string' ? { detail: error.context.detail } : {})
|
|
91
|
+
});
|
|
92
|
+
exports.recordErrorDetails = recordErrorDetails;
|
|
93
|
+
/**
|
|
94
|
+
* User text for a record error: the message plus ` File: <file>.` and ` Reason: <detail>.` when known.
|
|
95
|
+
* @param error - A record error.
|
|
96
|
+
* @param fileLabel - File to name instead of the one in the error's context.
|
|
97
|
+
*/
|
|
98
|
+
const describeRecordError = (error, fileLabel) => {
|
|
99
|
+
const { file, detail } = (0, exports.recordErrorDetails)(error);
|
|
100
|
+
const named = fileLabel ?? file;
|
|
101
|
+
return `${error.message}${named === undefined ? '' : ` File: ${named}.`}${detail === undefined ? '' : ` Reason: ${detail}.`}`;
|
|
102
|
+
};
|
|
103
|
+
exports.describeRecordError = describeRecordError;
|
|
104
|
+
//# sourceMappingURL=record-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-errors.js","sourceRoot":"","sources":["../../../src/domain/install/record-errors.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,sDAE2B;AAE3B,oFAAoF;AACvE,QAAA,kBAAkB,GAAG;IAChC,kBAAkB;IAClB,qBAAqB;IACrB,0BAA0B;IAC1B,0BAA0B;IAC1B,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;IACpB,wBAAwB;IACxB,qBAAqB;IACrB,qBAAqB;IACrB,8BAA8B;CACtB,CAAC;AAqBX,MAAM,gBAAgB,GAA8C;IAClE,kBAAkB,EAAE,yDAAyD;IAC7E,qBAAqB,EAAE,2EAA2E;IAClG,0BAA0B,EAAE,yFAAyF;IACrH,0BAA0B,EAAE,+EAA+E;IAC3G,qBAAqB,EAAE,yCAAyC;IAChE,qBAAqB,EAAE,6EAA6E;IACpG,oBAAoB,EAAE,2DAA2D;IACjF,wBAAwB,EAAE,gFAAgF;IAC1G,qBAAqB,EAAE,wEAAwE;IAC/F,qBAAqB,EAAE,iGAAiG;IACxH,8BAA8B,EAAE,qEAAqE;CACtG,CAAC;AAEF,MAAM,aAAa,GAA8C;IAC/D,kBAAkB,EAAE,qDAAqD;IACzE,qBAAqB,EAAE,uEAAuE;IAC9F,0BAA0B,EAAE,yEAAyE;IACrG,0BAA0B,EAAE,qEAAqE;IACjG,qBAAqB,EAAE,wCAAwC;IAC/D,qBAAqB,EAAE,mFAAmF;IAC1G,oBAAoB,EAAE,4DAA4D;IAClF,wBAAwB,EAAE,2FAA2F;IACrH,qB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AAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAFpG,QAAA,aAAa,iBAEuF;AAEjH;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAAoB,EAAsC,EAAE,CAAC,CAAC;IAC/F,GAAG,CAAC,OAAO,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAChF,GAAG,CAAC,OAAO,KAAK,CAAC,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CACvF,CAAC,CAAC;AAHU,QAAA,kBAAkB,sBAG5B;AAEH;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAoB,EAAE,SAAkB,EAAU,EAAE;IACtF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAkB,EAAC,KAAK,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,SAAS,IAAI,IAAI,CAAC;IAChC,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,GAAG,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,MAAM,GAAG,EAAE,CAAC;AAChI,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object and ordering helpers shared by every install record reader and writer.
|
|
3
|
+
* @module domain/install/record-object
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Whether a value is a JSON object: not `null` and not an array.
|
|
7
|
+
* @param value - Any value.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isJsonObject: (value: unknown) => value is Record<string, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Locale-independent code-unit order, used for every sorted key and path in a record.
|
|
12
|
+
* @param left - First text.
|
|
13
|
+
* @param right - Second text.
|
|
14
|
+
*/
|
|
15
|
+
export declare const compareCodeUnits: (left: string, right: string) => number;
|
|
16
|
+
/**
|
|
17
|
+
* Shallow copy of an object's own string keys into a `null`-prototype object.
|
|
18
|
+
* @param value - Object to copy.
|
|
19
|
+
*/
|
|
20
|
+
export declare const nullPrototypeCopy: <T extends object>(value: T) => T;
|
|
21
|
+
//# sourceMappingURL=record-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-object.d.ts","sourceRoot":"","sources":["../../../src/domain/install/record-object.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACP,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAK9D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC,KAAG,CAM9D,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Object and ordering helpers shared by every install record reader and writer.
|
|
4
|
+
* @module domain/install/record-object
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.nullPrototypeCopy = exports.compareCodeUnits = exports.isJsonObject = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Whether a value is a JSON object: not `null` and not an array.
|
|
10
|
+
* @param value - Any value.
|
|
11
|
+
*/
|
|
12
|
+
const isJsonObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
13
|
+
exports.isJsonObject = isJsonObject;
|
|
14
|
+
/**
|
|
15
|
+
* Locale-independent code-unit order, used for every sorted key and path in a record.
|
|
16
|
+
* @param left - First text.
|
|
17
|
+
* @param right - Second text.
|
|
18
|
+
*/
|
|
19
|
+
const compareCodeUnits = (left, right) => {
|
|
20
|
+
if (left < right) {
|
|
21
|
+
return -1;
|
|
22
|
+
}
|
|
23
|
+
return left > right ? 1 : 0;
|
|
24
|
+
};
|
|
25
|
+
exports.compareCodeUnits = compareCodeUnits;
|
|
26
|
+
/**
|
|
27
|
+
* Shallow copy of an object's own string keys into a `null`-prototype object.
|
|
28
|
+
* @param value - Object to copy.
|
|
29
|
+
*/
|
|
30
|
+
const nullPrototypeCopy = (value) => {
|
|
31
|
+
const copy = Object.create(null);
|
|
32
|
+
for (const key of Object.keys(value)) {
|
|
33
|
+
copy[key] = value[key];
|
|
34
|
+
}
|
|
35
|
+
return copy;
|
|
36
|
+
};
|
|
37
|
+
exports.nullPrototypeCopy = nullPrototypeCopy;
|
|
38
|
+
//# sourceMappingURL=record-object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-object.js","sourceRoot":"","sources":["../../../src/domain/install/record-object.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,KAAc,EAAoC,EAAE,CAC/E,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAD1D,QAAA,YAAY,gBAC8C;AAEvE;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE;IACtE,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;IACD,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B;AAEF;;;GAGG;AACI,MAAM,iBAAiB,GAAG,CAAmB,KAAQ,EAAK,EAAE;IACjE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAM,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAyB,EAAE,CAAC;QAC7D,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A parsed record that passed the version gate but not yet the schema gate.
|
|
3
|
+
* Every object in it has a `null` prototype.
|
|
4
|
+
*/
|
|
5
|
+
export interface UnvalidatedRecord {
|
|
6
|
+
readonly version: string;
|
|
7
|
+
readonly [key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `JSON.parse` that refuses prototype keys and builds `null`-prototype objects; no shape check.
|
|
11
|
+
* @param text - File contents.
|
|
12
|
+
* @param file - File to name in errors, if any.
|
|
13
|
+
* @throws {RegistryError} `RECORD.MALFORMED` for invalid JSON or a forbidden key.
|
|
14
|
+
*/
|
|
15
|
+
export declare const parseJsonWithoutPrototypes: (text: string, file?: string) => unknown;
|
|
16
|
+
/**
|
|
17
|
+
* Parse an `ai-primitives-hub.*` record file and check its major version is 3.
|
|
18
|
+
* @param text - File contents.
|
|
19
|
+
* @param file - Record file to name in errors, if any.
|
|
20
|
+
* @throws {RegistryError} `RECORD.MALFORMED`, `RECORD.NEWER_FORMAT` or `RECORD.LEGACY_UNMIGRATED`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const parseRecord: (text: string, file?: string) => UnvalidatedRecord;
|
|
23
|
+
//# sourceMappingURL=record-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-parse.d.ts","sourceRoot":"","sources":["../../../src/domain/install/record-parse.ts"],"names":[],"mappings":"AAuBA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,OAexE,CAAC;AAsBF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,iBAOzD,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRecord = exports.parseJsonWithoutPrototypes = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Prototype-free parsing and the version gate for install records. Forbidden
|
|
6
|
+
* keys are refused at any depth and every object gets a `null` prototype; the
|
|
7
|
+
* schema check runs afterwards in `infra`.
|
|
8
|
+
* @module domain/install/record-parse
|
|
9
|
+
*/
|
|
10
|
+
const registry_error_1 = require("../registry-error");
|
|
11
|
+
const record_errors_1 = require("./record-errors");
|
|
12
|
+
const record_object_1 = require("./record-object");
|
|
13
|
+
const record_types_1 = require("./record-types");
|
|
14
|
+
const SEMVER_CORE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
15
|
+
/**
|
|
16
|
+
* `JSON.parse` that refuses prototype keys and builds `null`-prototype objects; no shape check.
|
|
17
|
+
* @param text - File contents.
|
|
18
|
+
* @param file - File to name in errors, if any.
|
|
19
|
+
* @throws {RegistryError} `RECORD.MALFORMED` for invalid JSON or a forbidden key.
|
|
20
|
+
*/
|
|
21
|
+
const parseJsonWithoutPrototypes = (text, file) => {
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(text, (key, value) => {
|
|
24
|
+
if (record_types_1.FORBIDDEN_KEYS.has(key)) {
|
|
25
|
+
throw (0, record_errors_1.recordError)('RECORD.MALFORMED', { file, detail: `forbidden key ${key}` });
|
|
26
|
+
}
|
|
27
|
+
return (0, record_object_1.isJsonObject)(value) ? (0, record_object_1.nullPrototypeCopy)(value) : value;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if ((0, registry_error_1.isRegistryError)(error)) {
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
// The SyntaxError message can quote file contents, so it stays in `cause` only.
|
|
35
|
+
throw (0, record_errors_1.recordError)('RECORD.MALFORMED', { file, detail: 'not valid JSON', cause: error });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.parseJsonWithoutPrototypes = parseJsonWithoutPrototypes;
|
|
39
|
+
const checkVersion = (version, file) => {
|
|
40
|
+
if (version === undefined) {
|
|
41
|
+
throw (0, record_errors_1.recordError)('RECORD.MALFORMED', { file, detail: 'missing version' });
|
|
42
|
+
}
|
|
43
|
+
if (typeof version !== 'string') {
|
|
44
|
+
throw (0, record_errors_1.recordError)('RECORD.MALFORMED', { file, detail: 'version is not a string' });
|
|
45
|
+
}
|
|
46
|
+
const match = SEMVER_CORE.exec(version);
|
|
47
|
+
if (match === null) {
|
|
48
|
+
throw (0, record_errors_1.recordError)('RECORD.MALFORMED', { file, detail: `version ${JSON.stringify(version)} is not MAJOR.MINOR.PATCH` });
|
|
49
|
+
}
|
|
50
|
+
const major = Number(match[1]);
|
|
51
|
+
if (major > record_types_1.RECORD_FORMAT_MAJOR) {
|
|
52
|
+
throw (0, record_errors_1.recordError)('RECORD.NEWER_FORMAT', { file, detail: `format ${version}` });
|
|
53
|
+
}
|
|
54
|
+
if (major < record_types_1.RECORD_FORMAT_MAJOR) {
|
|
55
|
+
throw (0, record_errors_1.recordError)('RECORD.LEGACY_UNMIGRATED', { file, detail: `format ${version}` });
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Parse an `ai-primitives-hub.*` record file and check its major version is 3.
|
|
60
|
+
* @param text - File contents.
|
|
61
|
+
* @param file - Record file to name in errors, if any.
|
|
62
|
+
* @throws {RegistryError} `RECORD.MALFORMED`, `RECORD.NEWER_FORMAT` or `RECORD.LEGACY_UNMIGRATED`.
|
|
63
|
+
*/
|
|
64
|
+
const parseRecord = (text, file) => {
|
|
65
|
+
const parsed = (0, exports.parseJsonWithoutPrototypes)(text, file);
|
|
66
|
+
if (!(0, record_object_1.isJsonObject)(parsed)) {
|
|
67
|
+
throw (0, record_errors_1.recordError)('RECORD.MALFORMED', { file, detail: 'top level is not an object' });
|
|
68
|
+
}
|
|
69
|
+
checkVersion(parsed.version, file);
|
|
70
|
+
return parsed;
|
|
71
|
+
};
|
|
72
|
+
exports.parseRecord = parseRecord;
|
|
73
|
+
//# sourceMappingURL=record-parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-parse.js","sourceRoot":"","sources":["../../../src/domain/install/record-parse.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,sDAE2B;AAC3B,mDAEyB;AACzB,mDAGyB;AACzB,iDAGwB;AAExB,MAAM,WAAW,GAAG,4CAA4C,CAAC;AAWjE;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAE,IAAa,EAAW,EAAE;IACjF,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,GAAW,EAAE,KAAc,EAAE,EAAE;YACtD,IAAI,6BAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5B,MAAM,IAAA,2BAAW,EAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,GAAG,EAAE,EAAE,CAAC,CAAC;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kCAAmB,EAAE,CAAC;QAChC,MAAM,IAAA,2BAAW,EAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC,CAAC;IAClF,CAAC;IACD,IAAI,KAAK,GAAG,kCAAmB,EAAE,CAAC;QAChC,MAAM,IAAA,2BAAW,EAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC,CAAC;IACvF,CAAC;AACH,CAAC,CAAC;AAEF;;;;;GAKG;AACI,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,IAAa,EAAqB,EAAE;IAC5E,MAAM,MAAM,GAAG,IAAA,kCAA0B,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,IAAI,CAAC,IAAA,4BAAY,EAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAA,2BAAW,EAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC,CAAC;IACxF,CAAC;IACD,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnC,OAAO,MAA2B,CAAC;AACrC,CAAC,CAAC;AAPW,QAAA,WAAW,eAOtB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a recorded path is not allowed, or `undefined` when it is.
|
|
3
|
+
* @param recordedPath - Path as recorded.
|
|
4
|
+
*/
|
|
5
|
+
export declare const findRecordedPathProblem: (recordedPath: string) => string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Check a recorded path and normalize it to forward slashes.
|
|
8
|
+
* @param recordedPath - Path as recorded.
|
|
9
|
+
* @param file - Record file to name in the error, if any.
|
|
10
|
+
* @throws {RegistryError} `RECORD.PATH_OUTSIDE_ROOT` when the path is not allowed.
|
|
11
|
+
*/
|
|
12
|
+
export declare const checkRecordedPath: (recordedPath: string, file?: string) => string;
|
|
13
|
+
/** Options of {@link relativeInside}. */
|
|
14
|
+
export interface RelativeInsideOptions {
|
|
15
|
+
/** Count the root itself as inside; it then gives `''`. Defaults to `false`. */
|
|
16
|
+
allowRoot?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Path of `candidate` relative to `root`, with forward slashes, or `undefined`
|
|
20
|
+
* when it is outside. Segments are compared, not string prefixes.
|
|
21
|
+
* @param root - Absolute folder.
|
|
22
|
+
* @param candidate - Absolute path.
|
|
23
|
+
* @param options - Whether the root itself counts as inside.
|
|
24
|
+
*/
|
|
25
|
+
export declare const relativeInside: (root: string, candidate: string, options?: RelativeInsideOptions) => string | undefined;
|
|
26
|
+
//# sourceMappingURL=record-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-path.d.ts","sourceRoot":"","sources":["../../../src/domain/install/record-path.ts"],"names":[],"mappings":"AAqCA;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,cAAc,MAAM,KAAG,MAAM,GAAG,SAoBvE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,cAAc,MAAM,EAAE,OAAO,MAAM,KAAG,MASvE,CAAC;AAEF,yCAAyC;AACzC,MAAM,WAAW,qBAAqB;IACpC,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,EAAE,UAAS,qBAA0B,KAAG,MAAM,GAAG,SAS9G,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.relativeInside = exports.checkRecordedPath = exports.findRecordedPathProblem = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* Text-only checks for recorded paths. Both `/` and `\` count as separators,
|
|
39
|
+
* so a path is judged the same way on every OS; `confinePath` in `app` adds
|
|
40
|
+
* the filesystem check.
|
|
41
|
+
* @module domain/install/record-path
|
|
42
|
+
*/
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const record_errors_1 = require("./record-errors");
|
|
45
|
+
const DRIVE_LETTER = /^[A-Za-z]:/;
|
|
46
|
+
const SHORT_NAME = /~\d/;
|
|
47
|
+
const SEPARATORS = /[/\\]/;
|
|
48
|
+
const segmentProblem = (segment) => {
|
|
49
|
+
if (segment === '' || segment === '.' || segment === '..') {
|
|
50
|
+
return 'empty, "." or ".." segment';
|
|
51
|
+
}
|
|
52
|
+
if (segment.toLowerCase() === '.git') {
|
|
53
|
+
return '".git" segment';
|
|
54
|
+
}
|
|
55
|
+
if (segment.endsWith('.') || segment.endsWith(' ')) {
|
|
56
|
+
return 'segment ends in a dot or a space';
|
|
57
|
+
}
|
|
58
|
+
if (SHORT_NAME.test(segment)) {
|
|
59
|
+
return 'segment looks like an 8.3 short name';
|
|
60
|
+
}
|
|
61
|
+
if (segment.includes(':')) {
|
|
62
|
+
return 'segment contains ":"';
|
|
63
|
+
}
|
|
64
|
+
if (segment.includes('\0')) {
|
|
65
|
+
return 'segment contains a NUL character';
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Why a recorded path is not allowed, or `undefined` when it is.
|
|
71
|
+
* @param recordedPath - Path as recorded.
|
|
72
|
+
*/
|
|
73
|
+
const findRecordedPathProblem = (recordedPath) => {
|
|
74
|
+
if (typeof recordedPath !== 'string' || recordedPath === '') {
|
|
75
|
+
return 'empty path';
|
|
76
|
+
}
|
|
77
|
+
if (recordedPath.startsWith('//') || recordedPath.startsWith('\\\\')) {
|
|
78
|
+
return 'UNC path';
|
|
79
|
+
}
|
|
80
|
+
if (recordedPath.startsWith('/') || recordedPath.startsWith('\\')) {
|
|
81
|
+
return 'absolute path';
|
|
82
|
+
}
|
|
83
|
+
if (DRIVE_LETTER.test(recordedPath)) {
|
|
84
|
+
return 'drive letter';
|
|
85
|
+
}
|
|
86
|
+
for (const segment of recordedPath.split(SEPARATORS)) {
|
|
87
|
+
const problem = segmentProblem(segment);
|
|
88
|
+
if (problem !== undefined) {
|
|
89
|
+
return problem;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
};
|
|
94
|
+
exports.findRecordedPathProblem = findRecordedPathProblem;
|
|
95
|
+
/**
|
|
96
|
+
* Check a recorded path and normalize it to forward slashes.
|
|
97
|
+
* @param recordedPath - Path as recorded.
|
|
98
|
+
* @param file - Record file to name in the error, if any.
|
|
99
|
+
* @throws {RegistryError} `RECORD.PATH_OUTSIDE_ROOT` when the path is not allowed.
|
|
100
|
+
*/
|
|
101
|
+
const checkRecordedPath = (recordedPath, file) => {
|
|
102
|
+
const problem = (0, exports.findRecordedPathProblem)(recordedPath);
|
|
103
|
+
if (problem !== undefined) {
|
|
104
|
+
throw (0, record_errors_1.recordError)('RECORD.PATH_OUTSIDE_ROOT', {
|
|
105
|
+
file,
|
|
106
|
+
detail: `${problem}: ${JSON.stringify(recordedPath)}`
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return recordedPath.split(SEPARATORS).join('/');
|
|
110
|
+
};
|
|
111
|
+
exports.checkRecordedPath = checkRecordedPath;
|
|
112
|
+
/**
|
|
113
|
+
* Path of `candidate` relative to `root`, with forward slashes, or `undefined`
|
|
114
|
+
* when it is outside. Segments are compared, not string prefixes.
|
|
115
|
+
* @param root - Absolute folder.
|
|
116
|
+
* @param candidate - Absolute path.
|
|
117
|
+
* @param options - Whether the root itself counts as inside.
|
|
118
|
+
*/
|
|
119
|
+
const relativeInside = (root, candidate, options = {}) => {
|
|
120
|
+
const relative = path.relative(root, candidate);
|
|
121
|
+
if (relative === '') {
|
|
122
|
+
return options.allowRoot === true ? '' : undefined;
|
|
123
|
+
}
|
|
124
|
+
if (path.isAbsolute(relative) || relative === '..' || relative.startsWith(`..${path.sep}`)) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
return relative.split(path.sep).join('/');
|
|
128
|
+
};
|
|
129
|
+
exports.relativeInside = relativeInside;
|
|
130
|
+
//# sourceMappingURL=record-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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AAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAChD,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACrD,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QAC3F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC,CAAC;AATW,QAAA,cAAc,kBASzB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { TargetType } from './target';
|
|
2
|
+
import type { RepositoryCommitMode } from './types';
|
|
3
|
+
/** Record format version written by this release. */
|
|
4
|
+
export declare const RECORD_FORMAT_VERSION = "3.0.0";
|
|
5
|
+
/** Major version this release reads and writes. */
|
|
6
|
+
export declare const RECORD_FORMAT_MAJOR = 3;
|
|
7
|
+
/** `$schema` URL written into every record. */
|
|
8
|
+
export declare const RECORD_SCHEMA_URL = "https://github.com/AmadeusITGroup/ai-primitives-hub/schemas/lockfile.schema.json";
|
|
9
|
+
/** Committed repository record, at the git root. */
|
|
10
|
+
export declare const RECORD_FILE_NAME = "ai-primitives-hub.lock.json";
|
|
11
|
+
/** Local-only repository record, at the git root and listed in `.git/info/exclude`. */
|
|
12
|
+
export declare const LOCAL_RECORD_FILE_NAME = "ai-primitives-hub.local.lock.json";
|
|
13
|
+
/** Both repository record file names, committed first. */
|
|
14
|
+
export declare const RECORD_FILE_NAMES: readonly ["ai-primitives-hub.lock.json", "ai-primitives-hub.local.lock.json"];
|
|
15
|
+
/** The one user-level install record per machine, in the user config folder. */
|
|
16
|
+
export declare const USER_RECORD_FILE_NAME = "ai-primitives-hub.user.lock.json";
|
|
17
|
+
/** Largest record file accepted, in bytes. */
|
|
18
|
+
export declare const RECORD_MAX_BYTES: number;
|
|
19
|
+
/** Keys refused at any depth because they could change an object's prototype. */
|
|
20
|
+
export declare const FORBIDDEN_KEYS: ReadonlySet<string>;
|
|
21
|
+
/** Pattern every tool key and `sourceType` must match to be read. */
|
|
22
|
+
export declare const RECORD_NAME_PATTERN: RegExp;
|
|
23
|
+
/** Tool key for migrated entries whose tool could not be identified. */
|
|
24
|
+
export declare const UNKNOWN_TOOL_NAME = "unknown";
|
|
25
|
+
/** User-record field holding when the old user lockfile was imported; once set, it is not imported again. */
|
|
26
|
+
export declare const IMPORTED_USER_LOCKFILE_FIELD = "importedUserLockfileAt";
|
|
27
|
+
/** Level a record belongs to. */
|
|
28
|
+
export type RecordLevel = 'repository' | 'user';
|
|
29
|
+
/**
|
|
30
|
+
* Tool key of a {@link ToolEntry}. Readers keep any key matching
|
|
31
|
+
* {@link RECORD_NAME_PATTERN}, so other values can appear on read.
|
|
32
|
+
*/
|
|
33
|
+
export type RecordToolName = TargetType | typeof UNKNOWN_TOOL_NAME;
|
|
34
|
+
/** One file a tool entry wrote. */
|
|
35
|
+
export interface RecordedFile {
|
|
36
|
+
/** Path relative to the entry's `root` (default: the level root), with forward slashes. */
|
|
37
|
+
path: string;
|
|
38
|
+
/** `sha256:` plus 64 lowercase hex digits of the bytes on disk. */
|
|
39
|
+
checksum: string;
|
|
40
|
+
/** Path of the file inside the bundle. */
|
|
41
|
+
sourcePath?: string;
|
|
42
|
+
/** File mode such as `0755`, only when not the default. */
|
|
43
|
+
mode?: string;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
/** One Agent Plugin (a `plugin.json` folder) a tool entry installed; its files are also in `files`. */
|
|
47
|
+
export interface RecordedPlugin {
|
|
48
|
+
name: string;
|
|
49
|
+
version?: string;
|
|
50
|
+
/** `sha256:` of the plugin manifest. */
|
|
51
|
+
manifestDigest?: string;
|
|
52
|
+
/** Plugin folder, relative like `files[].path`. */
|
|
53
|
+
root: string;
|
|
54
|
+
/** Skill folders the plugin projects. */
|
|
55
|
+
skills?: string[];
|
|
56
|
+
/** Names of the MCP servers the plugin projects, as in `mcpServers[].name`. */
|
|
57
|
+
mcpServers?: string[];
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One MCP server a tool entry owns. The definition stays in the tool's own MCP
|
|
62
|
+
* file; `${env:VAR}` stays unresolved and no secret is recorded.
|
|
63
|
+
*/
|
|
64
|
+
export interface RecordedMcpServer {
|
|
65
|
+
/** The tool's MCP file, such as `.vscode/mcp.json`. */
|
|
66
|
+
config: string;
|
|
67
|
+
/** Server name in that file. */
|
|
68
|
+
name: string;
|
|
69
|
+
/** Bundle item the server came from. */
|
|
70
|
+
item?: string;
|
|
71
|
+
/** `sha256:` of the server definition as written. */
|
|
72
|
+
checksum?: string;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
/** What one tool has installed for one bundle. */
|
|
76
|
+
export interface ToolEntry {
|
|
77
|
+
version: string;
|
|
78
|
+
/** Key of the entry's source in {@link InstallRecord.sources}. */
|
|
79
|
+
sourceId: string;
|
|
80
|
+
sourceType: string;
|
|
81
|
+
/** ISO 8601 UTC time the entry was written. */
|
|
82
|
+
installedAt: string;
|
|
83
|
+
/** `sha256:` of the downloaded bundle content: each bundle path with its file's sha256, sorted. */
|
|
84
|
+
integrity?: string;
|
|
85
|
+
/** Folder the tool writes to when it is not the level root, `~`-relative; `files[].path` is relative to it. */
|
|
86
|
+
root?: string;
|
|
87
|
+
/** Present, and `true`, only under the `'unknown'` tool key. */
|
|
88
|
+
needsReinstall?: true;
|
|
89
|
+
/** Files this entry owns, sorted by `path`. */
|
|
90
|
+
files: RecordedFile[];
|
|
91
|
+
plugins?: RecordedPlugin[];
|
|
92
|
+
mcpServers?: RecordedMcpServer[];
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
}
|
|
95
|
+
/** All tool entries for one bundle at one level; never empty. */
|
|
96
|
+
export interface BundleRecord {
|
|
97
|
+
/** Collection, manifest or index id of the bundle, without a version. */
|
|
98
|
+
name?: string;
|
|
99
|
+
tools: Record<string, ToolEntry>;
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
}
|
|
102
|
+
/** Where bundles came from. Same shape as format 2.0.0. */
|
|
103
|
+
export interface SourceRecord {
|
|
104
|
+
type: string;
|
|
105
|
+
/** Source URL with credentials removed. */
|
|
106
|
+
url: string;
|
|
107
|
+
branch?: string;
|
|
108
|
+
collectionsPath?: string;
|
|
109
|
+
indexFile?: string;
|
|
110
|
+
authMode?: string;
|
|
111
|
+
/** A reference to a credential, never a secret value. */
|
|
112
|
+
credentialRef?: string;
|
|
113
|
+
/** Key of the shared hub the source came from, in {@link InstallRecord.hubs}. */
|
|
114
|
+
hubId?: string;
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}
|
|
117
|
+
/** A shared hub's import reference: what `hub add` needs, never a credential. */
|
|
118
|
+
export interface RecordHub {
|
|
119
|
+
name: string;
|
|
120
|
+
type: string;
|
|
121
|
+
/** Hub location with credentials removed; never a local path. */
|
|
122
|
+
location: string;
|
|
123
|
+
/** Git ref of a GitHub hub. */
|
|
124
|
+
ref?: string;
|
|
125
|
+
/** Relative config path of an Artifactory hub. */
|
|
126
|
+
configFile?: string;
|
|
127
|
+
[key: string]: unknown;
|
|
128
|
+
}
|
|
129
|
+
/** One install record file (format 3.0.0). */
|
|
130
|
+
export interface InstallRecord {
|
|
131
|
+
$schema: string;
|
|
132
|
+
version: string;
|
|
133
|
+
level: RecordLevel;
|
|
134
|
+
generatedAt: string;
|
|
135
|
+
/** `ai-primitives-hub-cli@<version>` or `ai-primitives-hub-extension@<version>`. */
|
|
136
|
+
generatedBy: string;
|
|
137
|
+
bundles: Record<string, BundleRecord>;
|
|
138
|
+
sources: Record<string, SourceRecord>;
|
|
139
|
+
/** Hubs named by a source's `hubId`; entries carried over by migration may have another shape. */
|
|
140
|
+
hubs?: Record<string, unknown>;
|
|
141
|
+
profiles?: Record<string, unknown>;
|
|
142
|
+
[key: string]: unknown;
|
|
143
|
+
}
|
|
144
|
+
/** Where a record file lives. Not stored in the file. */
|
|
145
|
+
export interface RecordLocation {
|
|
146
|
+
level: RecordLevel;
|
|
147
|
+
/** Absolute level root; the git root at repository level. */
|
|
148
|
+
root: string;
|
|
149
|
+
/** Absolute path of the record file. */
|
|
150
|
+
path: string;
|
|
151
|
+
/** Repository level only: which of the two files this is. */
|
|
152
|
+
commitMode?: RepositoryCommitMode;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Both repository record locations at a root, committed first.
|
|
156
|
+
* @param root - Absolute git root.
|
|
157
|
+
*/
|
|
158
|
+
export declare const repositoryLocations: (root: string) => [RecordLocation, RecordLocation];
|
|
159
|
+
/**
|
|
160
|
+
* The other repository record file at the same root.
|
|
161
|
+
* @param location - A record location.
|
|
162
|
+
* @returns `undefined` when the location is not a repository file.
|
|
163
|
+
*/
|
|
164
|
+
export declare const otherRepositoryLocation: (location: RecordLocation) => RecordLocation | undefined;
|
|
165
|
+
/** Identifies one tool entry of one bundle. */
|
|
166
|
+
export interface RecordEntryKey {
|
|
167
|
+
bundleId: string;
|
|
168
|
+
tool: string;
|
|
169
|
+
}
|
|
170
|
+
/** Outcome of a record update. */
|
|
171
|
+
export interface RecordChange {
|
|
172
|
+
/** Entries added, replaced or moved. */
|
|
173
|
+
changedEntries: RecordEntryKey[];
|
|
174
|
+
/** Root-relative paths the caller deletes after the save. */
|
|
175
|
+
deletedFiles: string[];
|
|
176
|
+
/** Root-relative paths kept because another entry still lists them. */
|
|
177
|
+
keptSharedFiles: string[];
|
|
178
|
+
/** MCP servers the caller removes from their files after the save; no other entry lists them. */
|
|
179
|
+
removedMcpServers?: RecordedMcpServer[];
|
|
180
|
+
/** The file the change was recorded in. */
|
|
181
|
+
location: RecordLocation;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=record-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-types.d.ts","sourceRoot":"","sources":["../../../src/domain/install/record-types.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,UAAU,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAE7C,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,qFAAqF,CAAC;AAEpH,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,gCAAgC,CAAC;AAE9D,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,sCAAsC,CAAC;AAE1E,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,+EAAsD,CAAC;AAErF,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,qCAAqC,CAAC;AAExE,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB,QAAmB,CAAC;AAEjD,iFAAiF;AACjF,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAAsD,CAAC;AAEtG,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,QAAsB,CAAC;AAEvD,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,6GAA6G;AAC7G,eAAO,MAAM,4BAA4B,2BAA2B,CAAC;AAErE,iCAAiC;AACjC,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,MAAM,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,OAAO,iBAAiB,CAAC;AAEnE,mCAAmC;AACnC,MAAM,WAAW,YAAY;IAC3B,2FAA2F;IAC3F,IAAI,EAAE,MAAM,CA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