@skillsmith/core 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/analysis/tree-sitter/pythonIncremental.d.ts +23 -0
- package/dist/src/analysis/tree-sitter/pythonIncremental.d.ts.map +1 -1
- package/dist/src/analysis/tree-sitter/pythonIncremental.hardening.test.js +137 -0
- package/dist/src/analysis/tree-sitter/pythonIncremental.hardening.test.js.map +1 -1
- package/dist/src/analysis/tree-sitter/pythonIncremental.js +83 -10
- package/dist/src/analysis/tree-sitter/pythonIncremental.js.map +1 -1
- package/dist/src/analysis/tree-sitter/queryExtractionMatchesOrExceedsRegex.test.js +6 -1
- package/dist/src/analysis/tree-sitter/queryExtractionMatchesOrExceedsRegex.test.js.map +1 -1
- package/dist/src/api/client.d.ts.map +1 -1
- package/dist/src/api/client.js +6 -0
- package/dist/src/api/client.js.map +1 -1
- package/dist/src/api/client.test.d.ts +9 -0
- package/dist/src/api/client.test.d.ts.map +1 -0
- package/dist/src/api/client.test.js +81 -0
- package/dist/src/api/client.test.js.map +1 -0
- package/dist/src/config/audit-notify-state.d.ts +46 -0
- package/dist/src/config/audit-notify-state.d.ts.map +1 -0
- package/dist/src/config/audit-notify-state.js +55 -0
- package/dist/src/config/audit-notify-state.js.map +1 -0
- package/dist/src/config/audit-notify-state.test.d.ts +9 -0
- package/dist/src/config/audit-notify-state.test.d.ts.map +1 -0
- package/dist/src/config/audit-notify-state.test.js +63 -0
- package/dist/src/config/audit-notify-state.test.js.map +1 -0
- package/dist/src/config/index.d.ts +10 -0
- package/dist/src/config/index.d.ts.map +1 -1
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/exports/services.d.ts +3 -1
- package/dist/src/exports/services.d.ts.map +1 -1
- package/dist/src/exports/services.js +9 -1
- package/dist/src/exports/services.js.map +1 -1
- package/dist/src/index.d.ts +6 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/install/agent-config-merge.json-array.d.ts +29 -0
- package/dist/src/install/agent-config-merge.json-array.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.json-array.js +100 -0
- package/dist/src/install/agent-config-merge.json-array.js.map +1 -0
- package/dist/src/install/agent-config-merge.json.d.ts +37 -0
- package/dist/src/install/agent-config-merge.json.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.json.js +134 -0
- package/dist/src/install/agent-config-merge.json.js.map +1 -0
- package/dist/src/install/agent-config-merge.toml-block.d.ts +48 -0
- package/dist/src/install/agent-config-merge.toml-block.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.toml-block.js +107 -0
- package/dist/src/install/agent-config-merge.toml-block.js.map +1 -0
- package/dist/src/install/agent-config-merge.types.d.ts +87 -0
- package/dist/src/install/agent-config-merge.types.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.types.js +83 -0
- package/dist/src/install/agent-config-merge.types.js.map +1 -0
- package/dist/src/install/agent-config-merge.yaml.d.ts +46 -0
- package/dist/src/install/agent-config-merge.yaml.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.yaml.js +133 -0
- package/dist/src/install/agent-config-merge.yaml.js.map +1 -0
- package/dist/src/install/agent-config-merge.yaml.test.d.ts +2 -0
- package/dist/src/install/agent-config-merge.yaml.test.d.ts.map +1 -0
- package/dist/src/install/agent-config-merge.yaml.test.js +210 -0
- package/dist/src/install/agent-config-merge.yaml.test.js.map +1 -0
- package/dist/src/install/agent-harness-targets.d.ts +98 -0
- package/dist/src/install/agent-harness-targets.d.ts.map +1 -0
- package/dist/src/install/agent-harness-targets.js +154 -0
- package/dist/src/install/agent-harness-targets.js.map +1 -0
- package/dist/src/install/agent-home-relocate.d.ts +29 -0
- package/dist/src/install/agent-home-relocate.d.ts.map +1 -0
- package/dist/src/install/agent-home-relocate.js +38 -0
- package/dist/src/install/agent-home-relocate.js.map +1 -0
- package/dist/src/install/agent-manifest-path-guard.d.ts +55 -0
- package/dist/src/install/agent-manifest-path-guard.d.ts.map +1 -0
- package/dist/src/install/agent-manifest-path-guard.js +109 -0
- package/dist/src/install/agent-manifest-path-guard.js.map +1 -0
- package/dist/src/install/agent-manifest-path-guard.test.d.ts +2 -0
- package/dist/src/install/agent-manifest-path-guard.test.d.ts.map +1 -0
- package/dist/src/install/agent-manifest-path-guard.test.js +72 -0
- package/dist/src/install/agent-manifest-path-guard.test.js.map +1 -0
- package/dist/src/install/agent-manifest.d.ts +58 -0
- package/dist/src/install/agent-manifest.d.ts.map +1 -0
- package/dist/src/install/agent-manifest.js +103 -0
- package/dist/src/install/agent-manifest.js.map +1 -0
- package/dist/src/install/agent-pack-installer.d.ts +39 -0
- package/dist/src/install/agent-pack-installer.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.entry.d.ts +55 -0
- package/dist/src/install/agent-pack-installer.entry.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.entry.js +90 -0
- package/dist/src/install/agent-pack-installer.entry.js.map +1 -0
- package/dist/src/install/agent-pack-installer.fs-helpers.d.ts +33 -0
- package/dist/src/install/agent-pack-installer.fs-helpers.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.fs-helpers.js +59 -0
- package/dist/src/install/agent-pack-installer.fs-helpers.js.map +1 -0
- package/dist/src/install/agent-pack-installer.harness.d.ts +66 -0
- package/dist/src/install/agent-pack-installer.harness.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.harness.js +310 -0
- package/dist/src/install/agent-pack-installer.harness.js.map +1 -0
- package/dist/src/install/agent-pack-installer.js +221 -0
- package/dist/src/install/agent-pack-installer.js.map +1 -0
- package/dist/src/install/agent-pack-installer.preserve.test.d.ts +11 -0
- package/dist/src/install/agent-pack-installer.preserve.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.preserve.test.js +72 -0
- package/dist/src/install/agent-pack-installer.preserve.test.js.map +1 -0
- package/dist/src/install/agent-pack-installer.test.d.ts +2 -0
- package/dist/src/install/agent-pack-installer.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.test.js +350 -0
- package/dist/src/install/agent-pack-installer.test.js.map +1 -0
- package/dist/src/install/agent-pack-installer.types.d.ts +51 -0
- package/dist/src/install/agent-pack-installer.types.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.types.js +16 -0
- package/dist/src/install/agent-pack-installer.types.js.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.d.ts +43 -0
- package/dist/src/install/agent-pack-uninstaller.d.ts.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.js +113 -0
- package/dist/src/install/agent-pack-uninstaller.js.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.test.d.ts +2 -0
- package/dist/src/install/agent-pack-uninstaller.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.test.js +212 -0
- package/dist/src/install/agent-pack-uninstaller.test.js.map +1 -0
- package/dist/src/install/index.d.ts +7 -0
- package/dist/src/install/index.d.ts.map +1 -1
- package/dist/src/install/index.js +7 -0
- package/dist/src/install/index.js.map +1 -1
- package/dist/src/install/paths.d.ts +1 -1
- package/dist/src/install/paths.d.ts.map +1 -1
- package/dist/src/install/paths.js +4 -0
- package/dist/src/install/paths.js.map +1 -1
- package/dist/src/install/paths.test.js +15 -0
- package/dist/src/install/paths.test.js.map +1 -1
- package/dist/src/journal/hash.d.ts +13 -0
- package/dist/src/journal/hash.d.ts.map +1 -0
- package/dist/src/journal/hash.js +16 -0
- package/dist/src/journal/hash.js.map +1 -0
- package/dist/src/journal/index.d.ts +15 -0
- package/dist/src/journal/index.d.ts.map +1 -0
- package/dist/src/journal/index.js +15 -0
- package/dist/src/journal/index.js.map +1 -0
- package/dist/src/journal/journal.test.d.ts +16 -0
- package/dist/src/journal/journal.test.d.ts.map +1 -0
- package/dist/src/journal/journal.test.js +171 -0
- package/dist/src/journal/journal.test.js.map +1 -0
- package/dist/src/journal/path.d.ts +44 -0
- package/dist/src/journal/path.d.ts.map +1 -0
- package/dist/src/journal/path.js +61 -0
- package/dist/src/journal/path.js.map +1 -0
- package/dist/src/journal/reader.d.ts +38 -0
- package/dist/src/journal/reader.d.ts.map +1 -0
- package/dist/src/journal/reader.js +93 -0
- package/dist/src/journal/reader.js.map +1 -0
- package/dist/src/journal/types.d.ts +87 -0
- package/dist/src/journal/types.d.ts.map +1 -0
- package/dist/src/journal/types.js +21 -0
- package/dist/src/journal/types.js.map +1 -0
- package/dist/src/journal/writer.d.ts +52 -0
- package/dist/src/journal/writer.d.ts.map +1 -0
- package/dist/src/journal/writer.js +125 -0
- package/dist/src/journal/writer.js.map +1 -0
- package/dist/src/logging/context.d.ts +58 -0
- package/dist/src/logging/context.d.ts.map +1 -0
- package/dist/src/logging/context.js +62 -0
- package/dist/src/logging/context.js.map +1 -0
- package/dist/src/logging/context.test.d.ts +14 -0
- package/dist/src/logging/context.test.d.ts.map +1 -0
- package/dist/src/logging/context.test.js +88 -0
- package/dist/src/logging/context.test.js.map +1 -0
- package/dist/src/logging/index.d.ts +13 -0
- package/dist/src/logging/index.d.ts.map +1 -0
- package/dist/src/logging/index.js +12 -0
- package/dist/src/logging/index.js.map +1 -0
- package/dist/src/logging/logger.d.ts +71 -0
- package/dist/src/logging/logger.d.ts.map +1 -0
- package/dist/src/logging/logger.js +264 -0
- package/dist/src/logging/logger.js.map +1 -0
- package/dist/src/logging/logger.test.d.ts +9 -0
- package/dist/src/logging/logger.test.d.ts.map +1 -0
- package/dist/src/logging/logger.test.js +320 -0
- package/dist/src/logging/logger.test.js.map +1 -0
- package/dist/src/logging/redact.d.ts +35 -0
- package/dist/src/logging/redact.d.ts.map +1 -0
- package/dist/src/logging/redact.js +152 -0
- package/dist/src/logging/redact.js.map +1 -0
- package/dist/src/logging/redact.test.d.ts +8 -0
- package/dist/src/logging/redact.test.d.ts.map +1 -0
- package/dist/src/logging/redact.test.js +330 -0
- package/dist/src/logging/redact.test.js.map +1 -0
- package/dist/src/logging/rotation.d.ts +75 -0
- package/dist/src/logging/rotation.d.ts.map +1 -0
- package/dist/src/logging/rotation.js +284 -0
- package/dist/src/logging/rotation.js.map +1 -0
- package/dist/src/logging/rotation.test.d.ts +11 -0
- package/dist/src/logging/rotation.test.d.ts.map +1 -0
- package/dist/src/logging/rotation.test.js +132 -0
- package/dist/src/logging/rotation.test.js.map +1 -0
- package/dist/src/logging/types.d.ts +69 -0
- package/dist/src/logging/types.d.ts.map +1 -0
- package/dist/src/logging/types.js +9 -0
- package/dist/src/logging/types.js.map +1 -0
- package/dist/src/paywall-triggers/index.d.ts +13 -0
- package/dist/src/paywall-triggers/index.d.ts.map +1 -0
- package/dist/src/paywall-triggers/index.js +13 -0
- package/dist/src/paywall-triggers/index.js.map +1 -0
- package/dist/src/paywall-triggers/path.d.ts +47 -0
- package/dist/src/paywall-triggers/path.d.ts.map +1 -0
- package/dist/src/paywall-triggers/path.js +73 -0
- package/dist/src/paywall-triggers/path.js.map +1 -0
- package/dist/src/paywall-triggers/store.d.ts +75 -0
- package/dist/src/paywall-triggers/store.d.ts.map +1 -0
- package/dist/src/paywall-triggers/store.js +122 -0
- package/dist/src/paywall-triggers/store.js.map +1 -0
- package/dist/src/paywall-triggers/store.test.d.ts +2 -0
- package/dist/src/paywall-triggers/store.test.d.ts.map +1 -0
- package/dist/src/paywall-triggers/store.test.js +121 -0
- package/dist/src/paywall-triggers/store.test.js.map +1 -0
- package/dist/src/paywall-triggers/types.d.ts +24 -0
- package/dist/src/paywall-triggers/types.d.ts.map +1 -0
- package/dist/src/paywall-triggers/types.js +13 -0
- package/dist/src/paywall-triggers/types.js.map +1 -0
- package/dist/src/security/index.d.ts +2 -0
- package/dist/src/security/index.d.ts.map +1 -1
- package/dist/src/security/index.js +4 -0
- package/dist/src/security/index.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.compound.d.ts +13 -0
- package/dist/src/security/scanner/SecurityScanner.compound.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.compound.js +127 -0
- package/dist/src/security/scanner/SecurityScanner.compound.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.hostile-update.d.ts +46 -0
- package/dist/src/security/scanner/SecurityScanner.hostile-update.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.hostile-update.js +209 -0
- package/dist/src/security/scanner/SecurityScanner.hostile-update.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.js +10 -1
- package/dist/src/security/scanner/SecurityScanner.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.pii.d.ts +23 -0
- package/dist/src/security/scanner/SecurityScanner.pii.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.pii.js +152 -0
- package/dist/src/security/scanner/SecurityScanner.pii.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.scanners.d.ts +5 -12
- package/dist/src/security/scanner/SecurityScanner.scanners.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.scanners.js +63 -137
- package/dist/src/security/scanner/SecurityScanner.scanners.js.map +1 -1
- package/dist/src/security/scanner/index.d.ts +2 -1
- package/dist/src/security/scanner/index.d.ts.map +1 -1
- package/dist/src/security/scanner/index.js +2 -0
- package/dist/src/security/scanner/index.js.map +1 -1
- package/dist/src/security/scanner/patterns.d.ts +2 -0
- package/dist/src/security/scanner/patterns.d.ts.map +1 -1
- package/dist/src/security/scanner/patterns.js +79 -11
- package/dist/src/security/scanner/patterns.js.map +1 -1
- package/dist/src/security/scanner/types.d.ts +23 -0
- package/dist/src/security/scanner/types.d.ts.map +1 -1
- package/dist/src/services/agent-pack/agent-pack.test.d.ts +18 -0
- package/dist/src/services/agent-pack/agent-pack.test.d.ts.map +1 -0
- package/dist/src/services/agent-pack/agent-pack.test.js +344 -0
- package/dist/src/services/agent-pack/agent-pack.test.js.map +1 -0
- package/dist/src/services/agent-pack/hooks.d.ts +29 -0
- package/dist/src/services/agent-pack/hooks.d.ts.map +1 -0
- package/dist/src/services/agent-pack/hooks.js +139 -0
- package/dist/src/services/agent-pack/hooks.js.map +1 -0
- package/dist/src/services/agent-pack/index.d.ts +26 -0
- package/dist/src/services/agent-pack/index.d.ts.map +1 -0
- package/dist/src/services/agent-pack/index.js +109 -0
- package/dist/src/services/agent-pack/index.js.map +1 -0
- package/dist/src/services/agent-pack/prompt-source.d.ts +47 -0
- package/dist/src/services/agent-pack/prompt-source.d.ts.map +1 -0
- package/dist/src/services/agent-pack/prompt-source.js +182 -0
- package/dist/src/services/agent-pack/prompt-source.js.map +1 -0
- package/dist/src/services/agent-pack/shims.d.ts +40 -0
- package/dist/src/services/agent-pack/shims.d.ts.map +1 -0
- package/dist/src/services/agent-pack/shims.js +96 -0
- package/dist/src/services/agent-pack/shims.js.map +1 -0
- package/dist/src/services/agent-pack/skill-md.d.ts +35 -0
- package/dist/src/services/agent-pack/skill-md.d.ts.map +1 -0
- package/dist/src/services/agent-pack/skill-md.js +89 -0
- package/dist/src/services/agent-pack/skill-md.js.map +1 -0
- package/dist/src/services/agent-pack/types.d.ts +118 -0
- package/dist/src/services/agent-pack/types.d.ts.map +1 -0
- package/dist/src/services/agent-pack/types.js +61 -0
- package/dist/src/services/agent-pack/types.js.map +1 -0
- package/dist/src/services/agent-tool-profile.d.ts +59 -0
- package/dist/src/services/agent-tool-profile.d.ts.map +1 -0
- package/dist/src/services/agent-tool-profile.js +76 -0
- package/dist/src/services/agent-tool-profile.js.map +1 -0
- package/dist/src/services/agent-tool-profile.test.d.ts +2 -0
- package/dist/src/services/agent-tool-profile.test.d.ts.map +1 -0
- package/dist/src/services/agent-tool-profile.test.js +28 -0
- package/dist/src/services/agent-tool-profile.test.js.map +1 -0
- package/dist/src/services/bundled-sibling-scan.d.ts +111 -0
- package/dist/src/services/bundled-sibling-scan.d.ts.map +1 -0
- package/dist/src/services/bundled-sibling-scan.js +170 -0
- package/dist/src/services/bundled-sibling-scan.js.map +1 -0
- package/dist/src/services/skill-installation.io.d.ts +16 -5
- package/dist/src/services/skill-installation.io.d.ts.map +1 -1
- package/dist/src/services/skill-installation.io.js +63 -22
- package/dist/src/services/skill-installation.io.js.map +1 -1
- package/dist/src/services/skill-installation.policy.d.ts +96 -0
- package/dist/src/services/skill-installation.policy.d.ts.map +1 -0
- package/dist/src/services/skill-installation.policy.js +144 -0
- package/dist/src/services/skill-installation.policy.js.map +1 -0
- package/dist/src/services/skill-installation.service.d.ts.map +1 -1
- package/dist/src/services/skill-installation.service.js +9 -3
- package/dist/src/services/skill-installation.service.js.map +1 -1
- package/dist/src/sources/index.d.ts +1 -0
- package/dist/src/sources/index.d.ts.map +1 -1
- package/dist/src/sources/index.js +4 -0
- package/dist/src/sources/index.js.map +1 -1
- package/dist/src/sync/access-token.d.ts +27 -0
- package/dist/src/sync/access-token.d.ts.map +1 -0
- package/dist/src/sync/access-token.js +40 -0
- package/dist/src/sync/access-token.js.map +1 -0
- package/dist/src/sync/audit-notify-client.d.ts +83 -0
- package/dist/src/sync/audit-notify-client.d.ts.map +1 -0
- package/dist/src/sync/audit-notify-client.js +126 -0
- package/dist/src/sync/audit-notify-client.js.map +1 -0
- package/dist/src/sync/audit-notify-client.test.d.ts +14 -0
- package/dist/src/sync/audit-notify-client.test.d.ts.map +1 -0
- package/dist/src/sync/audit-notify-client.test.js +133 -0
- package/dist/src/sync/audit-notify-client.test.js.map +1 -0
- package/dist/src/sync/index.d.ts +2 -1
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/index.js +3 -1
- package/dist/src/sync/index.js.map +1 -1
- package/dist/src/sync/inventory-client.d.ts +16 -0
- package/dist/src/sync/inventory-client.d.ts.map +1 -1
- package/dist/src/sync/inventory-client.js +59 -16
- package/dist/src/sync/inventory-client.js.map +1 -1
- package/dist/src/sync/inventory-client.test.js +67 -1
- package/dist/src/sync/inventory-client.test.js.map +1 -1
- package/dist/src/sync/inventory-collector.d.ts.map +1 -1
- package/dist/src/sync/inventory-collector.js +32 -5
- package/dist/src/sync/inventory-collector.js.map +1 -1
- package/dist/src/sync/inventory-collector.test.js +50 -1
- package/dist/src/sync/inventory-collector.test.js.map +1 -1
- package/dist/src/sync/inventory-types.d.ts +9 -0
- package/dist/src/sync/inventory-types.d.ts.map +1 -1
- package/dist/src/sync/inventory-types.js +3 -0
- package/dist/src/sync/inventory-types.js.map +1 -1
- package/dist/src/telemetry/agent-marker.d.ts +137 -0
- package/dist/src/telemetry/agent-marker.d.ts.map +1 -0
- package/dist/src/telemetry/agent-marker.js +242 -0
- package/dist/src/telemetry/agent-marker.js.map +1 -0
- package/dist/src/telemetry/agent-marker.test.d.ts +13 -0
- package/dist/src/telemetry/agent-marker.test.d.ts.map +1 -0
- package/dist/src/telemetry/agent-marker.test.js +202 -0
- package/dist/src/telemetry/agent-marker.test.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +2 -1
- package/dist/src/telemetry/index.d.ts.map +1 -1
- package/dist/src/telemetry/index.js +6 -1
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/posthog.d.ts +25 -0
- package/dist/src/telemetry/posthog.d.ts.map +1 -1
- package/dist/src/telemetry/posthog.js +10 -1
- package/dist/src/telemetry/posthog.js.map +1 -1
- package/dist/src/telemetry/wrap.bench.js +5 -0
- package/dist/src/telemetry/wrap.bench.js.map +1 -1
- package/dist/src/telemetry/wrap.correlation.test.d.ts +20 -0
- package/dist/src/telemetry/wrap.correlation.test.d.ts.map +1 -0
- package/dist/src/telemetry/wrap.correlation.test.js +174 -0
- package/dist/src/telemetry/wrap.correlation.test.js.map +1 -0
- package/dist/src/telemetry/wrap.d.ts +28 -7
- package/dist/src/telemetry/wrap.d.ts.map +1 -1
- package/dist/src/telemetry/wrap.gate.test.d.ts +22 -0
- package/dist/src/telemetry/wrap.gate.test.d.ts.map +1 -0
- package/dist/src/telemetry/wrap.gate.test.js +202 -0
- package/dist/src/telemetry/wrap.gate.test.js.map +1 -0
- package/dist/src/telemetry/wrap.js +196 -52
- package/dist/src/telemetry/wrap.js.map +1 -1
- package/dist/src/telemetry/wrap.marker.test.d.ts +16 -0
- package/dist/src/telemetry/wrap.marker.test.d.ts.map +1 -0
- package/dist/src/telemetry/wrap.marker.test.js +190 -0
- package/dist/src/telemetry/wrap.marker.test.js.map +1 -0
- package/dist/src/telemetry/wrap.test.js +14 -0
- package/dist/src/telemetry/wrap.test.js.map +1 -1
- package/dist/src/types.d.ts +6 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tests/SecurityScanner.exec.test.js +60 -0
- package/dist/tests/SecurityScanner.exec.test.js.map +1 -1
- package/dist/tests/security/ContinuousSecurity.test.js +10 -4
- package/dist/tests/security/ContinuousSecurity.test.js.map +1 -1
- package/dist/tests/security/SecurityScanner.chmod-evasion.test.d.ts +2 -0
- package/dist/tests/security/SecurityScanner.chmod-evasion.test.d.ts.map +1 -0
- package/dist/tests/security/SecurityScanner.chmod-evasion.test.js +126 -0
- package/dist/tests/security/SecurityScanner.chmod-evasion.test.js.map +1 -0
- package/dist/tests/security/chmod-compound.test.d.ts +2 -0
- package/dist/tests/security/chmod-compound.test.d.ts.map +1 -0
- package/dist/tests/security/chmod-compound.test.js +188 -0
- package/dist/tests/security/chmod-compound.test.js.map +1 -0
- package/dist/tests/security/pii-detection.test.js +24 -0
- package/dist/tests/security/pii-detection.test.js.map +1 -1
- package/dist/tests/security/scanner-regression-guard.test.d.ts +23 -7
- package/dist/tests/security/scanner-regression-guard.test.d.ts.map +1 -1
- package/dist/tests/security/scanner-regression-guard.test.js +206 -12
- package/dist/tests/security/scanner-regression-guard.test.js.map +1 -1
- package/dist/tests/security/sensitive-path-fp.test.d.ts +2 -0
- package/dist/tests/security/sensitive-path-fp.test.d.ts.map +1 -0
- package/dist/tests/security/sensitive-path-fp.test.js +142 -0
- package/dist/tests/security/sensitive-path-fp.test.js.map +1 -0
- package/dist/tests/services/bundled-sibling-scan.test.d.ts +2 -0
- package/dist/tests/services/bundled-sibling-scan.test.d.ts.map +1 -0
- package/dist/tests/services/bundled-sibling-scan.test.js +139 -0
- package/dist/tests/services/bundled-sibling-scan.test.js.map +1 -0
- package/dist/tests/unit/services/skill-installation.io.test.js +166 -0
- package/dist/tests/unit/services/skill-installation.io.test.js.map +1 -1
- package/dist/tests/unit/services/skill-installation.policy.test.d.ts +8 -0
- package/dist/tests/unit/services/skill-installation.policy.test.d.ts.map +1 -0
- package/dist/tests/unit/services/skill-installation.policy.test.js +151 -0
- package/dist/tests/unit/services/skill-installation.policy.test.js.map +1 -0
- package/package.json +28 -3
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-harness on-disk targets for the `sklx agent install` / `uninstall`
|
|
3
|
+
* commands (SMI-5456 Wave 1 Step 5).
|
|
4
|
+
*
|
|
5
|
+
* This module is pure data (no filesystem access) — it says WHERE each
|
|
6
|
+
* harness's MCP config and hook config live and in what format, so
|
|
7
|
+
* `agent-config-merge*.ts` can merge into them generically and
|
|
8
|
+
* `agent-pack-installer.ts` doesn't hard-code per-harness path logic inline.
|
|
9
|
+
*
|
|
10
|
+
* Confidence levels (documented per plan's own Validation Ladder philosophy —
|
|
11
|
+
* Level 2a/3 in docs/internal/implementation/smi-5456-skillsmith-agent-wave1.md
|
|
12
|
+
* is explicitly where per-harness wire formats get confirmed against real
|
|
13
|
+
* harness binaries; Step-6 eval-worker web-verification 2026-07-01 upgraded
|
|
14
|
+
* three rows from the original Step-5 estimates):
|
|
15
|
+
* - claude-code, cursor, windsurf: HIGH — MCP config path/shape verified
|
|
16
|
+
* against `packages/cli/src/templates/mcp-server.template.snippets.ts`
|
|
17
|
+
* (SMI-4580, already shipped and used in docs/website).
|
|
18
|
+
* - hermes: HIGH for the skill path + YAML config shape (spike report §(b),
|
|
19
|
+
* 3 independent official doc pages agree); hooks are spike-verified
|
|
20
|
+
* ABSENT (no SessionStart equivalent) — {@link AGENT_HOOK_TARGETS}
|
|
21
|
+
* therefore carries no hook target for hermes.
|
|
22
|
+
* - codex: HIGH for the config file path (`~/.codex/config.toml`, same
|
|
23
|
+
* snippet table) AND — per Step-6 verification of
|
|
24
|
+
* developers.openai.com/codex/hooks — HIGH for the hook-registration
|
|
25
|
+
* shape: inline `[[hooks.SessionStart]]` / `[[hooks.SessionStart.hooks]]`
|
|
26
|
+
* array-of-tables carrying `{type, command, timeout, statusMessage}`.
|
|
27
|
+
* Codex has NO SessionEnd event, and its Stop event fires PER-TURN (not
|
|
28
|
+
* per-session) — see `installCodexHooks` in
|
|
29
|
+
* `agent-pack-installer.harness.ts` for why nothing is wired for cleanup.
|
|
30
|
+
* - copilot: HIGH — `~/.copilot/mcp-config.json`, top-level `mcpServers`
|
|
31
|
+
* key (Step-6 verified; the earlier `mcp.json` guess was wrong). Global,
|
|
32
|
+
* not VS Code's workspace `.vscode/mcp.json`, remains correct: Copilot
|
|
33
|
+
* CLI removed `.vscode/mcp.json` support, and `sklx agent install` is a
|
|
34
|
+
* global (not per-project) command.
|
|
35
|
+
* - opencode: HIGH — `~/.config/opencode/opencode.json` under the `mcp`
|
|
36
|
+
* key, entries typed `local|remote` (Step-6 verified against
|
|
37
|
+
* opencode.ai/docs; entry VALUE shape differs from the mcpServers
|
|
38
|
+
* convention — see `buildOpenCodeMcpEntryValue` in
|
|
39
|
+
* `agent-pack-installer.entry.ts`). Agent markdown lives at
|
|
40
|
+
* `~/.config/opencode/agents/` — plural (opencode.ai/docs/agents/; the
|
|
41
|
+
* earlier singular `agent/` guess was wrong).
|
|
42
|
+
*/
|
|
43
|
+
import { homedir } from 'node:os';
|
|
44
|
+
import { join } from 'node:path';
|
|
45
|
+
const home = homedir();
|
|
46
|
+
/** MCP registration targets for every harness the pack supports (PRD §3.1). */
|
|
47
|
+
export const AGENT_MCP_TARGETS = {
|
|
48
|
+
'claude-code': {
|
|
49
|
+
harness: 'claude-code',
|
|
50
|
+
path: join(home, '.claude', 'settings.json'),
|
|
51
|
+
format: 'json',
|
|
52
|
+
keyPath: ['mcpServers'],
|
|
53
|
+
},
|
|
54
|
+
cursor: {
|
|
55
|
+
harness: 'cursor',
|
|
56
|
+
path: join(home, '.cursor', 'mcp.json'),
|
|
57
|
+
format: 'json',
|
|
58
|
+
keyPath: ['mcpServers'],
|
|
59
|
+
},
|
|
60
|
+
copilot: {
|
|
61
|
+
harness: 'copilot',
|
|
62
|
+
path: join(home, '.copilot', 'mcp-config.json'),
|
|
63
|
+
format: 'json',
|
|
64
|
+
keyPath: ['mcpServers'],
|
|
65
|
+
},
|
|
66
|
+
windsurf: {
|
|
67
|
+
harness: 'windsurf',
|
|
68
|
+
path: join(home, '.codeium', 'windsurf', 'mcp_config.json'),
|
|
69
|
+
format: 'json',
|
|
70
|
+
keyPath: ['mcpServers'],
|
|
71
|
+
},
|
|
72
|
+
opencode: {
|
|
73
|
+
harness: 'opencode',
|
|
74
|
+
path: join(home, '.config', 'opencode', 'opencode.json'),
|
|
75
|
+
format: 'json',
|
|
76
|
+
keyPath: ['mcp'],
|
|
77
|
+
},
|
|
78
|
+
codex: {
|
|
79
|
+
harness: 'codex',
|
|
80
|
+
path: join(home, '.codex', 'config.toml'),
|
|
81
|
+
format: 'toml-block',
|
|
82
|
+
keyPath: [],
|
|
83
|
+
},
|
|
84
|
+
hermes: {
|
|
85
|
+
harness: 'hermes',
|
|
86
|
+
path: join(home, '.hermes', 'config.yaml'),
|
|
87
|
+
format: 'yaml',
|
|
88
|
+
keyPath: ['mcp_servers'],
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Named-agent shim file targets, per {@link HarnessId} (PRD §3.1 constraint
|
|
93
|
+
* 2 / architecture doc artifacts A2-A5). Cursor and (VS Code's) Copilot both
|
|
94
|
+
* read `.claude/agents/*.md` natively per the constraint matrix, so they
|
|
95
|
+
* share the claude-code shim file rather than getting a second copy — only
|
|
96
|
+
* harnesses with their OWN native shim format get a dedicated target here.
|
|
97
|
+
*/
|
|
98
|
+
export const AGENT_SHIM_TARGETS = {
|
|
99
|
+
'claude-code': {
|
|
100
|
+
harness: 'claude-code',
|
|
101
|
+
path: join(home, '.claude', 'agents', 'skillsmith-agent.md'),
|
|
102
|
+
},
|
|
103
|
+
// Cursor 2.4+ reads `.claude/agents/` natively — no separate shim file.
|
|
104
|
+
cursor: null,
|
|
105
|
+
copilot: {
|
|
106
|
+
harness: 'copilot',
|
|
107
|
+
path: join(home, '.copilot', 'agents', 'skillsmith-agent.agent.md'),
|
|
108
|
+
},
|
|
109
|
+
opencode: {
|
|
110
|
+
harness: 'opencode',
|
|
111
|
+
// Step-6 verified (opencode.ai/docs/agents/): global agent markdown
|
|
112
|
+
// lives at ~/.config/opencode/agents/ — plural.
|
|
113
|
+
path: join(home, '.config', 'opencode', 'agents', 'skillsmith-agent.md'),
|
|
114
|
+
},
|
|
115
|
+
// Codex's shim is a TOML `[agents.*]` table entry merged into
|
|
116
|
+
// ~/.codex/config.toml, not a standalone file — see AGENT_MCP_TARGETS.codex
|
|
117
|
+
// and agent-config-merge.toml-block.ts. No separate ShimTarget.
|
|
118
|
+
codex: null,
|
|
119
|
+
};
|
|
120
|
+
/** Hook install targets — only harnesses with a real SessionStart hook (HOOK_HARNESSES). */
|
|
121
|
+
export const AGENT_HOOK_TARGETS = {
|
|
122
|
+
'claude-code': {
|
|
123
|
+
harness: 'claude-code',
|
|
124
|
+
scriptDir: join(home, '.claude', 'hooks'),
|
|
125
|
+
configPath: join(home, '.claude', 'settings.json'),
|
|
126
|
+
configFormat: 'json',
|
|
127
|
+
sessionStartKeyPath: ['hooks', 'SessionStart'],
|
|
128
|
+
sessionEndKeyPath: ['hooks', 'SessionEnd'],
|
|
129
|
+
},
|
|
130
|
+
cursor: {
|
|
131
|
+
harness: 'cursor',
|
|
132
|
+
scriptDir: join(home, '.cursor', 'hooks'),
|
|
133
|
+
configPath: join(home, '.cursor', 'hooks.json'),
|
|
134
|
+
configFormat: 'json',
|
|
135
|
+
// Cursor's hooks.json is Claude-compatible (PRD §3.1) but is itself the
|
|
136
|
+
// hooks map (no wrapping "hooks" key) — see module header confidence note.
|
|
137
|
+
sessionStartKeyPath: ['SessionStart'],
|
|
138
|
+
sessionEndKeyPath: ['SessionEnd'],
|
|
139
|
+
},
|
|
140
|
+
codex: {
|
|
141
|
+
harness: 'codex',
|
|
142
|
+
scriptDir: join(home, '.codex', 'hooks'),
|
|
143
|
+
configPath: join(home, '.codex', 'config.toml'),
|
|
144
|
+
configFormat: 'toml-block',
|
|
145
|
+
// Unused for toml-block wiring (the block text carries its own
|
|
146
|
+
// `[[hooks.SessionStart]]` headers); SessionEnd does not exist as a
|
|
147
|
+
// Codex event at all — see `installCodexHooks`.
|
|
148
|
+
sessionStartKeyPath: [],
|
|
149
|
+
sessionEndKeyPath: [],
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
/** Codex's `[agents.skillsmith-agent]` TOML entry lives in the same config file as its MCP registration. */
|
|
153
|
+
export const CODEX_CONFIG_TOML_PATH = AGENT_MCP_TARGETS.codex.path;
|
|
154
|
+
//# sourceMappingURL=agent-harness-targets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-harness-targets.js","sourceRoot":"","sources":["../../../src/install/agent-harness-targets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAiDhC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;AAEtB,+EAA+E;AAC/E,MAAM,CAAC,MAAM,iBAAiB,GAAoD;IAChF,aAAa,EAAE;QACb,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC;QAC5C,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,CAAC,YAAY,CAAC;KACxB;IACD,MAAM,EAAE;QACN,OAAO,EAAE,QAAQ;QACjB,IAAI,EA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AAY,EAAE,YAAY;QAC1B,+DAA+D;QAC/D,oEAAoE;QACpE,gDAAgD;QAChD,mBAAmB,EAAE,EAAE;QACvB,iBAAiB,EAAE,EAAE;KACtB;CACF,CAAA;AAED,4GAA4G;AAC5G,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Home-dir relocation test seam for `sklx agent install` (SMI-5456 Wave 1
|
|
3
|
+
* Step 5).
|
|
4
|
+
*
|
|
5
|
+
* `paths.ts`'s `CLIENT_NATIVE_PATHS` and `agent-harness-targets.ts`'s target
|
|
6
|
+
* tables are computed ONCE at module load via `os.homedir()` — the
|
|
7
|
+
* established pattern in this codebase (paths.ts has no `homeDir` override;
|
|
8
|
+
* `enumerateHarnessPresence()` takes none either). Rather than widen that
|
|
9
|
+
* shared contract (used across many consumers) or fight macOS's
|
|
10
|
+
* `os.homedir()` ignoring `process.env.HOME` mutations (the exact problem
|
|
11
|
+
* `journal/path.ts` and `telemetry/agent-marker.ts` solve with their own
|
|
12
|
+
* per-module env overrides), the installer re-roots any already-computed
|
|
13
|
+
* absolute path onto an alternate directory for tests: strip the real
|
|
14
|
+
* `os.homedir()` prefix and re-join under the test's temp `homeDir`. This
|
|
15
|
+
* keeps every existing static table intact and untouched while giving
|
|
16
|
+
* `installAgentPack({ homeDir })` a real, disk-backed temp-HOME test seam
|
|
17
|
+
* (P-5 "install to a temp HOME" requirement) without adding a second
|
|
18
|
+
* parallel path-computation system to maintain in sync with `paths.ts`.
|
|
19
|
+
*
|
|
20
|
+
* @module @skillsmith/core/install/agent-home-relocate
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Re-root `absolutePath` (assumed computed under the REAL `os.homedir()`)
|
|
24
|
+
* onto `homeDir`. Returns `absolutePath` unchanged when `homeDir` is
|
|
25
|
+
* undefined, or when `absolutePath` is not actually under the real home
|
|
26
|
+
* directory (defensive — never silently misroute an unrelated path).
|
|
27
|
+
*/
|
|
28
|
+
export declare function relocateUnderHome(absolutePath: string, homeDir?: string): string;
|
|
29
|
+
//# sourceMappingURL=agent-home-relocate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-home-relocate.d.ts","sourceRoot":"","sources":["../../../src/install/agent-home-relocate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAKhF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Home-dir relocation test seam for `sklx agent install` (SMI-5456 Wave 1
|
|
3
|
+
* Step 5).
|
|
4
|
+
*
|
|
5
|
+
* `paths.ts`'s `CLIENT_NATIVE_PATHS` and `agent-harness-targets.ts`'s target
|
|
6
|
+
* tables are computed ONCE at module load via `os.homedir()` — the
|
|
7
|
+
* established pattern in this codebase (paths.ts has no `homeDir` override;
|
|
8
|
+
* `enumerateHarnessPresence()` takes none either). Rather than widen that
|
|
9
|
+
* shared contract (used across many consumers) or fight macOS's
|
|
10
|
+
* `os.homedir()` ignoring `process.env.HOME` mutations (the exact problem
|
|
11
|
+
* `journal/path.ts` and `telemetry/agent-marker.ts` solve with their own
|
|
12
|
+
* per-module env overrides), the installer re-roots any already-computed
|
|
13
|
+
* absolute path onto an alternate directory for tests: strip the real
|
|
14
|
+
* `os.homedir()` prefix and re-join under the test's temp `homeDir`. This
|
|
15
|
+
* keeps every existing static table intact and untouched while giving
|
|
16
|
+
* `installAgentPack({ homeDir })` a real, disk-backed temp-HOME test seam
|
|
17
|
+
* (P-5 "install to a temp HOME" requirement) without adding a second
|
|
18
|
+
* parallel path-computation system to maintain in sync with `paths.ts`.
|
|
19
|
+
*
|
|
20
|
+
* @module @skillsmith/core/install/agent-home-relocate
|
|
21
|
+
*/
|
|
22
|
+
import { homedir } from 'node:os';
|
|
23
|
+
import { isAbsolute, join, relative } from 'node:path';
|
|
24
|
+
/**
|
|
25
|
+
* Re-root `absolutePath` (assumed computed under the REAL `os.homedir()`)
|
|
26
|
+
* onto `homeDir`. Returns `absolutePath` unchanged when `homeDir` is
|
|
27
|
+
* undefined, or when `absolutePath` is not actually under the real home
|
|
28
|
+
* directory (defensive — never silently misroute an unrelated path).
|
|
29
|
+
*/
|
|
30
|
+
export function relocateUnderHome(absolutePath, homeDir) {
|
|
31
|
+
if (!homeDir)
|
|
32
|
+
return absolutePath;
|
|
33
|
+
const rel = relative(homedir(), absolutePath);
|
|
34
|
+
if (rel.startsWith('..') || isAbsolute(rel))
|
|
35
|
+
return absolutePath;
|
|
36
|
+
return join(homeDir, rel);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=agent-home-relocate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-home-relocate.js","sourceRoot":"","sources":["../../../src/install/agent-home-relocate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAoB,EAAE,OAAgB;IACtE,IAAI,CAAC,OAAO;QAAE,OAAO,YAAY,CAAA;IACjC,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAA;IAC7C,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,YAAY,CAAA;IAChE,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest-path validation for `uninstallAgentPack` (SMI-5456 governance
|
|
3
|
+
* follow-up, code review 2026-07-01).
|
|
4
|
+
*
|
|
5
|
+
* `uninstallAgentPack` reads `~/.skillsmith/agent-install/manifest.json` and,
|
|
6
|
+
* for every entry, either `unlinkSync`s `entry.path` or `writeFileSync`s
|
|
7
|
+
* content read from `entry.backupPath` INTO `entry.path` — with no
|
|
8
|
+
* validation that either path is one this installer could actually have
|
|
9
|
+
* produced. The manifest is an ordinary 0600 JSON file under the user's own
|
|
10
|
+
* HOME, not a signed or otherwise tamper-evident record; if it is ever
|
|
11
|
+
* corrupted, hand-edited, or overwritten by an unrelated bug elsewhere in
|
|
12
|
+
* the process (prototype pollution, a bad merge, a copy-paste from another
|
|
13
|
+
* user's manifest), `uninstallAgentPack` would happily `unlinkSync` or
|
|
14
|
+
* overwrite ANY path on disk the current user can write to — an
|
|
15
|
+
* arbitrary-file-delete/overwrite primitive completely disconnected from
|
|
16
|
+
* "what a real `sklx agent install` run actually wrote".
|
|
17
|
+
*
|
|
18
|
+
* This module closes that gap by checking every entry against the FIXED,
|
|
19
|
+
* finite set of relative-to-HOME suffixes the installer is capable of ever
|
|
20
|
+
* writing (every {@link CLIENT_NATIVE_PATHS} skill-pack path, every
|
|
21
|
+
* {@link AGENT_SHIM_TARGETS} shim, every {@link AGENT_HOOK_TARGETS} hook
|
|
22
|
+
* script + hook config file, every {@link AGENT_MCP_TARGETS} MCP config
|
|
23
|
+
* file) before any destructive fs call touches it. `backupPath` is checked
|
|
24
|
+
* separately: it must resolve under the current run's manifest/backups
|
|
25
|
+
* directory. An entry failing either check is never touched — the caller
|
|
26
|
+
* treats it as `rejected`, not `removed`/`restored`.
|
|
27
|
+
*
|
|
28
|
+
* Suffix (not full-path-prefix) matching is deliberate: `installAgentPack`
|
|
29
|
+
* supports a `homeDir` test-seam that relocates every target under an
|
|
30
|
+
* arbitrary temp directory (`agent-home-relocate.ts`), and
|
|
31
|
+
* `uninstallAgentPack` has no matching `homeDir` wiring (paths recorded in
|
|
32
|
+
* the manifest are already fully resolved at install time) — validating by
|
|
33
|
+
* suffix works identically in both the real-HOME production path and the
|
|
34
|
+
* relocated-HOME test path without needing to thread a redundant `homeDir`
|
|
35
|
+
* through uninstall. This still shrinks the achievable blast radius from
|
|
36
|
+
* "any file the process can write" down to "a file whose path happens to end
|
|
37
|
+
* with one of a dozen known per-harness relative locations" — a tampered
|
|
38
|
+
* manifest can no longer name `/etc/passwd` or `~/.ssh/id_rsa`.
|
|
39
|
+
*
|
|
40
|
+
* @module @skillsmith/core/install/agent-manifest-path-guard
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* True when `path` structurally matches one of the installer's known
|
|
44
|
+
* relative target locations (see module header). Normalizes via
|
|
45
|
+
* `path.resolve` first so a `..`-laden path can't dodge the suffix check by
|
|
46
|
+
* embedding traversal segments before the matched tail.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isAllowedManifestEntryPath(path: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* True when `backupPath` resolves under this run's manifest backups
|
|
51
|
+
* directory ({@link getAgentInstallBackupsDir}). A `null` backupPath is not
|
|
52
|
+
* validated here — callers only invoke this when `backupPath` is non-null.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isAllowedManifestBackupPath(backupPath: string): boolean;
|
|
55
|
+
//# sourceMappingURL=agent-manifest-path-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-manifest-path-guard.d.ts","sourceRoot":"","sources":["../../../src/install/agent-manifest-path-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAsDH;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMhE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAIvE"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest-path validation for `uninstallAgentPack` (SMI-5456 governance
|
|
3
|
+
* follow-up, code review 2026-07-01).
|
|
4
|
+
*
|
|
5
|
+
* `uninstallAgentPack` reads `~/.skillsmith/agent-install/manifest.json` and,
|
|
6
|
+
* for every entry, either `unlinkSync`s `entry.path` or `writeFileSync`s
|
|
7
|
+
* content read from `entry.backupPath` INTO `entry.path` — with no
|
|
8
|
+
* validation that either path is one this installer could actually have
|
|
9
|
+
* produced. The manifest is an ordinary 0600 JSON file under the user's own
|
|
10
|
+
* HOME, not a signed or otherwise tamper-evident record; if it is ever
|
|
11
|
+
* corrupted, hand-edited, or overwritten by an unrelated bug elsewhere in
|
|
12
|
+
* the process (prototype pollution, a bad merge, a copy-paste from another
|
|
13
|
+
* user's manifest), `uninstallAgentPack` would happily `unlinkSync` or
|
|
14
|
+
* overwrite ANY path on disk the current user can write to — an
|
|
15
|
+
* arbitrary-file-delete/overwrite primitive completely disconnected from
|
|
16
|
+
* "what a real `sklx agent install` run actually wrote".
|
|
17
|
+
*
|
|
18
|
+
* This module closes that gap by checking every entry against the FIXED,
|
|
19
|
+
* finite set of relative-to-HOME suffixes the installer is capable of ever
|
|
20
|
+
* writing (every {@link CLIENT_NATIVE_PATHS} skill-pack path, every
|
|
21
|
+
* {@link AGENT_SHIM_TARGETS} shim, every {@link AGENT_HOOK_TARGETS} hook
|
|
22
|
+
* script + hook config file, every {@link AGENT_MCP_TARGETS} MCP config
|
|
23
|
+
* file) before any destructive fs call touches it. `backupPath` is checked
|
|
24
|
+
* separately: it must resolve under the current run's manifest/backups
|
|
25
|
+
* directory. An entry failing either check is never touched — the caller
|
|
26
|
+
* treats it as `rejected`, not `removed`/`restored`.
|
|
27
|
+
*
|
|
28
|
+
* Suffix (not full-path-prefix) matching is deliberate: `installAgentPack`
|
|
29
|
+
* supports a `homeDir` test-seam that relocates every target under an
|
|
30
|
+
* arbitrary temp directory (`agent-home-relocate.ts`), and
|
|
31
|
+
* `uninstallAgentPack` has no matching `homeDir` wiring (paths recorded in
|
|
32
|
+
* the manifest are already fully resolved at install time) — validating by
|
|
33
|
+
* suffix works identically in both the real-HOME production path and the
|
|
34
|
+
* relocated-HOME test path without needing to thread a redundant `homeDir`
|
|
35
|
+
* through uninstall. This still shrinks the achievable blast radius from
|
|
36
|
+
* "any file the process can write" down to "a file whose path happens to end
|
|
37
|
+
* with one of a dozen known per-harness relative locations" — a tampered
|
|
38
|
+
* manifest can no longer name `/etc/passwd` or `~/.ssh/id_rsa`.
|
|
39
|
+
*
|
|
40
|
+
* @module @skillsmith/core/install/agent-manifest-path-guard
|
|
41
|
+
*/
|
|
42
|
+
import { homedir } from 'node:os';
|
|
43
|
+
import { join, relative, resolve, sep } from 'node:path';
|
|
44
|
+
import { AGENT_PACK_SKILL_NAME } from '../services/agent-pack/index.js';
|
|
45
|
+
import { AGENT_HOOK_TARGETS, AGENT_MCP_TARGETS, AGENT_SHIM_TARGETS, } from './agent-harness-targets.js';
|
|
46
|
+
import { getAgentInstallBackupsDir } from './agent-manifest.js';
|
|
47
|
+
import { CLIENT_NATIVE_PATHS } from './paths.js';
|
|
48
|
+
/** Relative-to-`os.homedir()` suffix for every path the installer can ever write. */
|
|
49
|
+
function computeAllowedPathSuffixes() {
|
|
50
|
+
const suffixes = new Set();
|
|
51
|
+
const home = homedir();
|
|
52
|
+
const addSuffix = (absPath) => {
|
|
53
|
+
const rel = relative(home, absPath);
|
|
54
|
+
// Skip anything that isn't actually under the real home dir (defensive —
|
|
55
|
+
// every constant table below is homedir()-rooted by construction, so
|
|
56
|
+
// this should never trigger; guards against a future table that isn't).
|
|
57
|
+
if (rel.startsWith('..') || rel === '')
|
|
58
|
+
return;
|
|
59
|
+
suffixes.add(rel);
|
|
60
|
+
};
|
|
61
|
+
for (const nativePath of Object.values(CLIENT_NATIVE_PATHS)) {
|
|
62
|
+
addSuffix(join(nativePath, AGENT_PACK_SKILL_NAME, 'SKILL.md'));
|
|
63
|
+
}
|
|
64
|
+
for (const target of Object.values(AGENT_SHIM_TARGETS)) {
|
|
65
|
+
if (target)
|
|
66
|
+
addSuffix(target.path);
|
|
67
|
+
}
|
|
68
|
+
for (const target of Object.values(AGENT_HOOK_TARGETS)) {
|
|
69
|
+
addSuffix(join(target.scriptDir, 'session-start.sh'));
|
|
70
|
+
addSuffix(join(target.scriptDir, 'session-end.sh'));
|
|
71
|
+
addSuffix(target.configPath);
|
|
72
|
+
}
|
|
73
|
+
for (const target of Object.values(AGENT_MCP_TARGETS)) {
|
|
74
|
+
addSuffix(target.path);
|
|
75
|
+
}
|
|
76
|
+
return suffixes;
|
|
77
|
+
}
|
|
78
|
+
let cachedSuffixes = null;
|
|
79
|
+
/** Lazily computed + cached — the target tables are static, module-load-time constants. */
|
|
80
|
+
function allowedPathSuffixes() {
|
|
81
|
+
if (!cachedSuffixes)
|
|
82
|
+
cachedSuffixes = computeAllowedPathSuffixes();
|
|
83
|
+
return cachedSuffixes;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* True when `path` structurally matches one of the installer's known
|
|
87
|
+
* relative target locations (see module header). Normalizes via
|
|
88
|
+
* `path.resolve` first so a `..`-laden path can't dodge the suffix check by
|
|
89
|
+
* embedding traversal segments before the matched tail.
|
|
90
|
+
*/
|
|
91
|
+
export function isAllowedManifestEntryPath(path) {
|
|
92
|
+
const normalized = resolve(path);
|
|
93
|
+
for (const suffix of allowedPathSuffixes()) {
|
|
94
|
+
if (normalized.endsWith(sep + suffix) || normalized === suffix)
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* True when `backupPath` resolves under this run's manifest backups
|
|
101
|
+
* directory ({@link getAgentInstallBackupsDir}). A `null` backupPath is not
|
|
102
|
+
* validated here — callers only invoke this when `backupPath` is non-null.
|
|
103
|
+
*/
|
|
104
|
+
export function isAllowedManifestBackupPath(backupPath) {
|
|
105
|
+
const backupsDir = resolve(getAgentInstallBackupsDir());
|
|
106
|
+
const normalized = resolve(backupPath);
|
|
107
|
+
return normalized === backupsDir || normalized.startsWith(backupsDir + sep);
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=agent-manifest-path-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-manifest-path-guard.js","sourceRoot":"","sources":["../../../src/install/agent-manifest-path-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,qFAAqF;AACrF,SAAS,0BAA0B;IACjC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAA;IAClC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAA;IAEtB,MAAM,SAAS,GAAG,CAAC,OAAe,EAAQ,EAAE;QAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACnC,yEAAyE;QACzE,qEAAqE;QACrE,wEAAwE;QACxE,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,EAAE;YAAE,OAAM;QAC9C,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACnB,CAAC,CAAA;IAED,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CA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AK,CAAA;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,UAAkB;IAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAAA;IACvD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IACtC,OAAO,UAAU,KAAK,UAAU,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,CAAA;AAC7E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-manifest-path-guard.test.d.ts","sourceRoot":"","sources":["../../../src/install/agent-manifest-path-guard.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Unit tests for the manifest-path validation guard
|
|
3
|
+
* (SMI-5456 governance follow-up, code review 2026-07-01).
|
|
4
|
+
* @module @skillsmith/core/install/agent-manifest-path-guard.test
|
|
5
|
+
*/
|
|
6
|
+
import { homedir } from 'node:os';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { describe, expect, it } from 'vitest';
|
|
9
|
+
import { AGENT_INSTALL_DIR_ENV_VAR, getAgentInstallBackupsDir } from './agent-manifest.js';
|
|
10
|
+
import { isAllowedManifestBackupPath, isAllowedManifestEntryPath, } from './agent-manifest-path-guard.js';
|
|
11
|
+
describe('isAllowedManifestEntryPath', () => {
|
|
12
|
+
it('allows a real claude-code skill pack path', () => {
|
|
13
|
+
expect(isAllowedManifestEntryPath(join(homedir(), '.claude', 'skills', 'skillsmith-agent', 'SKILL.md'))).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
it('allows a real claude-code settings.json (MCP config target)', () => {
|
|
16
|
+
expect(isAllowedManifestEntryPath(join(homedir(), '.claude', 'settings.json'))).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it('allows a real hermes YAML config path', () => {
|
|
19
|
+
expect(isAllowedManifestEntryPath(join(homedir(), '.hermes', 'config.yaml'))).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
it('allows a real codex hook script path', () => {
|
|
22
|
+
expect(isAllowedManifestEntryPath(join(homedir(), '.codex', 'hooks', 'session-start.sh'))).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
it('rejects an arbitrary sensitive path never written by the installer', () => {
|
|
25
|
+
expect(isAllowedManifestEntryPath('/etc/passwd')).toBe(false);
|
|
26
|
+
expect(isAllowedManifestEntryPath(join(homedir(), '.ssh', 'id_rsa'))).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
it('rejects a path that merely CONTAINS a known suffix as a substring, not a true path segment', () => {
|
|
29
|
+
// "evilclaude/settings.json" is not the same path component as
|
|
30
|
+
// ".claude/settings.json" — must not match on naive substring search.
|
|
31
|
+
expect(isAllowedManifestEntryPath(join(homedir(), 'evil.claude', 'settings.json'))).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
it('rejects a hand-edited traversal string that resolves outside every known harness dir', () => {
|
|
34
|
+
// A tampered manifest entry could embed literal ".." segments (not
|
|
35
|
+
// produced by `path.join`, which would normalize them away before this
|
|
36
|
+
// function ever sees them) — `resolve()` inside the guard must still
|
|
37
|
+
// collapse them and reject the resulting real path.
|
|
38
|
+
expect(isAllowedManifestEntryPath(`${homedir()}/../../../../etc/passwd`)).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
it('rejects a bare directory that only partially matches (no filename)', () => {
|
|
41
|
+
expect(isAllowedManifestEntryPath(join(homedir(), '.claude', 'skills'))).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('isAllowedManifestBackupPath', () => {
|
|
45
|
+
it('allows a path under the current backups directory', () => {
|
|
46
|
+
const backupsDir = getAgentInstallBackupsDir();
|
|
47
|
+
expect(isAllowedManifestBackupPath(join(backupsDir, '2026-01-01-settings.json.bak'))).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
it('rejects a path outside the backups directory', () => {
|
|
50
|
+
expect(isAllowedManifestBackupPath(join(homedir(), '.ssh', 'id_rsa'))).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
it('rejects a path that only shares a string prefix with the backups dir, not a real path boundary', () => {
|
|
53
|
+
const backupsDir = getAgentInstallBackupsDir();
|
|
54
|
+
expect(isAllowedManifestBackupPath(`${backupsDir}-evil-sibling/file.bak`)).toBe(false);
|
|
55
|
+
});
|
|
56
|
+
it('respects the SKILLSMITH_AGENT_INSTALL_DIR test-isolation override', () => {
|
|
57
|
+
const prev = process.env[AGENT_INSTALL_DIR_ENV_VAR];
|
|
58
|
+
process.env[AGENT_INSTALL_DIR_ENV_VAR] = join(homedir(), '.skillsmith-test-override');
|
|
59
|
+
try {
|
|
60
|
+
const backupsDir = getAgentInstallBackupsDir();
|
|
61
|
+
expect(backupsDir).toContain('.skillsmith-test-override');
|
|
62
|
+
expect(isAllowedManifestBackupPath(join(backupsDir, 'x.bak'))).toBe(true);
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
if (prev !== undefined)
|
|
66
|
+
process.env[AGENT_INSTALL_DIR_ENV_VAR] = prev;
|
|
67
|
+
else
|
|
68
|
+
delete process.env[AGENT_INSTALL_DIR_ENV_VAR];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=agent-manifest-path-guard.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-manifest-path-guard.test.js","sourceRoot":"","sources":["../../../src/install/agent-manifest-path-guard.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EACL,2BAA2B,E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EAAE;QACxG,MAAM,UAAU,GAAG,yBAAyB,EAAE,CAAA;QAC9C,MAAM,CAAC,2BAA2B,CAAC,GAAG,UAAU,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACxF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;QACnD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,2BAA2B,CAAC,CAAA;QACrF,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,yBAAyB,EAAE,CAAA;YAC9C,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAA;YACzD,MAAM,CAAC,2BAA2B,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC3E,CAAC;gBAAS,CAAC;YACT,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAA;;gBAChE,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;QACpD,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install manifest for `sklx agent install` / `uninstall` (SMI-5456 Wave 1
|
|
3
|
+
* Step 5).
|
|
4
|
+
*
|
|
5
|
+
* `sklx agent uninstall` must reverse EXACTLY what install wrote — per-
|
|
6
|
+
* changeset file identity, not a re-derivation from the current pack
|
|
7
|
+
* generator (which could have changed between install and uninstall, e.g.
|
|
8
|
+
* across a version bump). The manifest is the durable record of every path
|
|
9
|
+
* the installer created or modified, plus a backup reference for anything it
|
|
10
|
+
* modified (so a foreign file's pre-existing content is restorable) or `null`
|
|
11
|
+
* for anything it created outright (so uninstall deletes rather than
|
|
12
|
+
* restores).
|
|
13
|
+
*
|
|
14
|
+
* Location: `~/.skillsmith/agent-install/manifest.json` — a sibling
|
|
15
|
+
* directory to `~/.skillsmith/journal` (Step 3) and `~/.skillsmith/agent-markers`
|
|
16
|
+
* (Step 1), following the same `getConfigDir()`-rooted, env-override-for-
|
|
17
|
+
* tests convention as both.
|
|
18
|
+
*
|
|
19
|
+
* @module @skillsmith/core/install/agent-manifest
|
|
20
|
+
*/
|
|
21
|
+
/** Env var overriding the manifest directory (test isolation — mirrors SKILLSMITH_JOURNAL_DIR). */
|
|
22
|
+
export declare const AGENT_INSTALL_DIR_ENV_VAR = "SKILLSMITH_AGENT_INSTALL_DIR";
|
|
23
|
+
export declare const AGENT_MANIFEST_SCHEMA_VERSION = 1;
|
|
24
|
+
export type AgentManifestEntryKind = 'skill' | 'shim' | 'hook-script' | 'mcp-config' | 'hook-config';
|
|
25
|
+
/**
|
|
26
|
+
* One path the installer touched. `backupPath` is set only when a
|
|
27
|
+
* PRE-EXISTING file was modified (config-file merges); it is `null` for
|
|
28
|
+
* anything the installer created fresh (skill pack copies, shim files, hook
|
|
29
|
+
* scripts) since there is nothing meaningful to restore — uninstall deletes.
|
|
30
|
+
*/
|
|
31
|
+
export interface AgentManifestEntry {
|
|
32
|
+
path: string;
|
|
33
|
+
kind: AgentManifestEntryKind;
|
|
34
|
+
/** Harness this entry belongs to, or null for the harness-neutral SKILL.md pack. */
|
|
35
|
+
harness: string | null;
|
|
36
|
+
backupPath: string | null;
|
|
37
|
+
/** True when the installer set the executable bit (hook scripts). */
|
|
38
|
+
executable: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface AgentInstallManifest {
|
|
41
|
+
schemaVersion: number;
|
|
42
|
+
installedAt: string;
|
|
43
|
+
/** `AGENT_PACK_SCHEMA_VERSION` at install time — informational, not enforced. */
|
|
44
|
+
packSchemaVersion: number;
|
|
45
|
+
entries: AgentManifestEntry[];
|
|
46
|
+
}
|
|
47
|
+
export declare function getAgentManifestPath(): string;
|
|
48
|
+
export declare function getAgentInstallBackupsDir(): string;
|
|
49
|
+
/** Load the manifest, or an empty (never-installed) manifest if none exists or it is corrupt. */
|
|
50
|
+
export declare function loadAgentManifest(): AgentInstallManifest;
|
|
51
|
+
/**
|
|
52
|
+
* Persist a manifest, replacing any prior one. Re-running install writes a
|
|
53
|
+
* fresh manifest reflecting the CURRENT full set of entries (deduped by
|
|
54
|
+
* `path` — later entries in `entries` win) so a double-install never
|
|
55
|
+
* accumulates duplicate entries (P-5 idempotency test).
|
|
56
|
+
*/
|
|
57
|
+
export declare function saveAgentManifest(manifest: AgentInstallManifest): void;
|
|
58
|
+
//# sourceMappingURL=agent-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-manifest.d.ts","sourceRoot":"","sources":["../../../src/install/agent-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,mGAAmG;AACnG,eAAO,MAAM,yBAAyB,iCAAiC,CAAA;AAEvE,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAE9C,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,aAAa,CAAA;AAEpG;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,sBAAsB,CAAA;IAC5B,oFAAoF;IACpF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,iBAAiB,EAAE,MAAM,CAAA;IACzB,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AAOD,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED,iGAAiG;AACjG,wBAAgB,iBAAiB,IAAI,oBAAoB,CAexD;AAWD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAMtE"}
|