@skillsmith/core 0.12.1 → 0.12.3
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 +164 -0
- package/README.md +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/api/client.d.ts +5 -3
- package/dist/src/api/client.d.ts.map +1 -1
- package/dist/src/api/client.js +23 -33
- package/dist/src/api/client.js.map +1 -1
- package/dist/src/api/client.registry-sync.d.ts +28 -0
- package/dist/src/api/client.registry-sync.d.ts.map +1 -0
- package/dist/src/api/client.registry-sync.js +36 -0
- package/dist/src/api/client.registry-sync.js.map +1 -0
- package/dist/src/api/client.test.js +185 -0
- package/dist/src/api/client.test.js.map +1 -1
- package/dist/src/api/client.toSkill.d.ts +16 -0
- package/dist/src/api/client.toSkill.d.ts.map +1 -0
- package/dist/src/api/client.toSkill.js +46 -0
- package/dist/src/api/client.toSkill.js.map +1 -0
- package/dist/src/api/client.types.d.ts +22 -0
- package/dist/src/api/client.types.d.ts.map +1 -1
- package/dist/src/api/index.d.ts +1 -1
- package/dist/src/api/index.d.ts.map +1 -1
- package/dist/src/api/index.js.map +1 -1
- package/dist/src/api/schemas.d.ts +28 -0
- package/dist/src/api/schemas.d.ts.map +1 -1
- package/dist/src/api/schemas.js +13 -0
- package/dist/src/api/schemas.js.map +1 -1
- package/dist/src/audit/remote-audit.d.ts +85 -0
- package/dist/src/audit/remote-audit.d.ts.map +1 -1
- package/dist/src/audit/remote-audit.js +126 -3
- package/dist/src/audit/remote-audit.js.map +1 -1
- package/dist/src/audit/remote-audit.test.js +217 -1
- package/dist/src/audit/remote-audit.test.js.map +1 -1
- package/dist/src/config/index.d.ts +1 -0
- package/dist/src/config/index.d.ts.map +1 -1
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/db/migration-runner.d.ts.map +1 -1
- package/dist/src/db/migration-runner.js +6 -0
- package/dist/src/db/migration-runner.js.map +1 -1
- package/dist/src/db/migrations/v18-skill-versions-real-content-hash.d.ts +36 -0
- package/dist/src/db/migrations/v18-skill-versions-real-content-hash.d.ts.map +1 -0
- package/dist/src/db/migrations/v18-skill-versions-real-content-hash.js +38 -0
- package/dist/src/db/migrations/v18-skill-versions-real-content-hash.js.map +1 -0
- package/dist/src/db/schema.d.ts +1 -1
- package/dist/src/db/schema.d.ts.map +1 -1
- package/dist/src/db/schema.js +3 -1
- package/dist/src/db/schema.js.map +1 -1
- package/dist/src/exports/services.d.ts +3 -7
- package/dist/src/exports/services.d.ts.map +1 -1
- package/dist/src/exports/services.install.d.ts +18 -0
- package/dist/src/exports/services.install.d.ts.map +1 -0
- package/dist/src/exports/services.install.js +62 -0
- package/dist/src/exports/services.install.js.map +1 -0
- package/dist/src/exports/services.js +12 -32
- package/dist/src/exports/services.js.map +1 -1
- package/dist/src/exports/types.d.ts +1 -1
- package/dist/src/exports/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/install/agent-config-merge.json.d.ts +5 -4
- package/dist/src/install/agent-config-merge.json.d.ts.map +1 -1
- package/dist/src/install/agent-config-merge.json.js +10 -9
- package/dist/src/install/agent-config-merge.json.js.map +1 -1
- package/dist/src/install/agent-config-merge.types.d.ts +11 -1
- package/dist/src/install/agent-config-merge.types.d.ts.map +1 -1
- package/dist/src/install/agent-config-merge.types.js.map +1 -1
- package/dist/src/install/agent-harness-targets.d.ts +30 -2
- package/dist/src/install/agent-harness-targets.d.ts.map +1 -1
- package/dist/src/install/agent-harness-targets.js +17 -0
- package/dist/src/install/agent-harness-targets.js.map +1 -1
- package/dist/src/install/agent-manifest-path-guard.d.ts +28 -3
- package/dist/src/install/agent-manifest-path-guard.d.ts.map +1 -1
- package/dist/src/install/agent-manifest-path-guard.js +59 -3
- package/dist/src/install/agent-manifest-path-guard.js.map +1 -1
- package/dist/src/install/agent-manifest-path-guard.test.js +27 -1
- package/dist/src/install/agent-manifest-path-guard.test.js.map +1 -1
- package/dist/src/install/agent-pack-installer.antigravity-mcp.d.ts +74 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.js +106 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.js.map +1 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.test.d.ts +2 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.test.js +157 -0
- package/dist/src/install/agent-pack-installer.antigravity-mcp.test.js.map +1 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.d.ts +53 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.js +207 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.js.map +1 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.test.d.ts +2 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.test.js +285 -0
- package/dist/src/install/agent-pack-installer.cursor-mcp.test.js.map +1 -0
- package/dist/src/install/agent-pack-installer.d.ts +8 -0
- package/dist/src/install/agent-pack-installer.d.ts.map +1 -1
- package/dist/src/install/agent-pack-installer.entry.d.ts +120 -3
- package/dist/src/install/agent-pack-installer.entry.d.ts.map +1 -1
- package/dist/src/install/agent-pack-installer.entry.js +166 -3
- package/dist/src/install/agent-pack-installer.entry.js.map +1 -1
- package/dist/src/install/agent-pack-installer.js +97 -3
- package/dist/src/install/agent-pack-installer.js.map +1 -1
- package/dist/src/install/agent-pack-installer.types.d.ts +27 -0
- package/dist/src/install/agent-pack-installer.types.d.ts.map +1 -1
- package/dist/src/install/agent-pack-installer.types.js +6 -0
- package/dist/src/install/agent-pack-installer.types.js.map +1 -1
- package/dist/src/install/agent-pack-installer.workspace-scope.test.d.ts +2 -0
- package/dist/src/install/agent-pack-installer.workspace-scope.test.d.ts.map +1 -0
- package/dist/src/install/agent-pack-installer.workspace-scope.test.js +148 -0
- package/dist/src/install/agent-pack-installer.workspace-scope.test.js.map +1 -0
- package/dist/src/install/agent-pack-uninstaller.d.ts +18 -7
- package/dist/src/install/agent-pack-uninstaller.d.ts.map +1 -1
- package/dist/src/install/agent-pack-uninstaller.js +59 -9
- package/dist/src/install/agent-pack-uninstaller.js.map +1 -1
- package/dist/src/install/agent-pack-uninstaller.test.js +74 -1
- package/dist/src/install/agent-pack-uninstaller.test.js.map +1 -1
- package/dist/src/install/fan-out.d.ts.map +1 -1
- package/dist/src/install/fan-out.js +6 -0
- package/dist/src/install/fan-out.js.map +1 -1
- package/dist/src/install/index.d.ts +2 -0
- package/dist/src/install/index.d.ts.map +1 -1
- package/dist/src/install/index.js +2 -0
- package/dist/src/install/index.js.map +1 -1
- package/dist/src/install/workspace-scope.d.ts +207 -0
- package/dist/src/install/workspace-scope.d.ts.map +1 -0
- package/dist/src/install/workspace-scope.js +275 -0
- package/dist/src/install/workspace-scope.js.map +1 -0
- package/dist/src/install/workspace-scope.test.d.ts +2 -0
- package/dist/src/install/workspace-scope.test.d.ts.map +1 -0
- package/dist/src/install/workspace-scope.test.js +378 -0
- package/dist/src/install/workspace-scope.test.js.map +1 -0
- package/dist/src/scripts/__tests__/scan-imported-skills.test.js +9 -1
- package/dist/src/scripts/__tests__/scan-imported-skills.test.js.map +1 -1
- package/dist/src/scripts/scan-imported-skills.d.ts +7 -1
- package/dist/src/scripts/scan-imported-skills.d.ts.map +1 -1
- package/dist/src/scripts/scan-imported-skills.js +15 -2
- package/dist/src/scripts/scan-imported-skills.js.map +1 -1
- package/dist/src/scripts/skill-scanner/allowlist.d.ts +10 -0
- package/dist/src/scripts/skill-scanner/allowlist.d.ts.map +1 -1
- package/dist/src/scripts/skill-scanner/allowlist.js +10 -0
- package/dist/src/scripts/skill-scanner/allowlist.js.map +1 -1
- package/dist/src/scripts/skill-scanner/index.d.ts +8 -0
- package/dist/src/scripts/skill-scanner/index.d.ts.map +1 -1
- package/dist/src/scripts/skill-scanner/index.js +13 -5
- package/dist/src/scripts/skill-scanner/index.js.map +1 -1
- package/dist/src/scripts/skill-scanner/trust-scorer.d.ts.map +1 -1
- package/dist/src/scripts/skill-scanner/trust-scorer.js +6 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.js.map +1 -1
- package/dist/src/security/__tests__/pathValidation.test.js +30 -1
- package/dist/src/security/__tests__/pathValidation.test.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.action-context.d.ts +15 -0
- package/dist/src/security/scanner/SecurityScanner.action-context.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.action-context.js +209 -0
- package/dist/src/security/scanner/SecurityScanner.action-context.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts +25 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.helpers.d.ts +40 -1
- package/dist/src/security/scanner/SecurityScanner.helpers.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.helpers.js +88 -51
- package/dist/src/security/scanner/SecurityScanner.helpers.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.js +39 -6
- package/dist/src/security/scanner/SecurityScanner.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.pii.d.ts +30 -0
- package/dist/src/security/scanner/SecurityScanner.pii.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.pii.js +8 -1
- package/dist/src/security/scanner/SecurityScanner.pii.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.prose-lexicon.d.ts +60 -0
- package/dist/src/security/scanner/SecurityScanner.prose-lexicon.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.prose-lexicon.js +228 -0
- package/dist/src/security/scanner/SecurityScanner.prose-lexicon.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.scanners.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.scanners.js +35 -5
- package/dist/src/security/scanner/SecurityScanner.scanners.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.value-gate.d.ts +49 -0
- package/dist/src/security/scanner/SecurityScanner.value-gate.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.value-gate.js +134 -0
- package/dist/src/security/scanner/SecurityScanner.value-gate.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.weak-passwords.d.ts +55 -0
- package/dist/src/security/scanner/SecurityScanner.weak-passwords.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.weak-passwords.js +313 -0
- package/dist/src/security/scanner/SecurityScanner.weak-passwords.js.map +1 -0
- package/dist/src/security/scanner/patterns.d.ts +16 -6
- package/dist/src/security/scanner/patterns.d.ts.map +1 -1
- package/dist/src/security/scanner/patterns.js +25 -61
- package/dist/src/security/scanner/patterns.js.map +1 -1
- package/dist/src/security/scanner/patterns.sensitive-path.d.ts +45 -0
- package/dist/src/security/scanner/patterns.sensitive-path.d.ts.map +1 -0
- package/dist/src/security/scanner/patterns.sensitive-path.js +137 -0
- package/dist/src/security/scanner/patterns.sensitive-path.js.map +1 -0
- package/dist/src/security/scanner/regex-utils.d.ts +31 -17
- package/dist/src/security/scanner/regex-utils.d.ts.map +1 -1
- package/dist/src/security/scanner/regex-utils.js +31 -17
- package/dist/src/security/scanner/regex-utils.js.map +1 -1
- package/dist/src/security/scanner/types.d.ts +9 -0
- package/dist/src/security/scanner/types.d.ts.map +1 -1
- package/dist/src/services/SubagentGenerator.client-profiles.d.ts +258 -0
- package/dist/src/services/SubagentGenerator.client-profiles.d.ts.map +1 -0
- package/dist/src/services/SubagentGenerator.client-profiles.js +260 -0
- package/dist/src/services/SubagentGenerator.client-profiles.js.map +1 -0
- package/dist/src/services/SubagentGenerator.d.ts +19 -41
- package/dist/src/services/SubagentGenerator.d.ts.map +1 -1
- package/dist/src/services/SubagentGenerator.helpers.d.ts +64 -0
- package/dist/src/services/SubagentGenerator.helpers.d.ts.map +1 -0
- package/dist/src/services/SubagentGenerator.helpers.js +228 -0
- package/dist/src/services/SubagentGenerator.helpers.js.map +1 -0
- package/dist/src/services/SubagentGenerator.js +66 -208
- package/dist/src/services/SubagentGenerator.js.map +1 -1
- package/dist/src/services/SubagentGenerator.types.d.ts +45 -0
- package/dist/src/services/SubagentGenerator.types.d.ts.map +1 -0
- package/dist/src/services/SubagentGenerator.types.js +14 -0
- package/dist/src/services/SubagentGenerator.types.js.map +1 -0
- package/dist/src/services/TransformationService.d.ts +18 -61
- package/dist/src/services/TransformationService.d.ts.map +1 -1
- package/dist/src/services/TransformationService.js +29 -17
- package/dist/src/services/TransformationService.js.map +1 -1
- package/dist/src/services/TransformationService.types.d.ts +74 -0
- package/dist/src/services/TransformationService.types.d.ts.map +1 -0
- package/dist/src/services/TransformationService.types.js +8 -0
- package/dist/src/services/TransformationService.types.js.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.d.ts +5 -0
- package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.js +72 -0
- package/dist/src/services/__tests__/SubagentGenerator.client-profiles.test.js.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.helpers.test.d.ts +2 -0
- package/dist/src/services/__tests__/SubagentGenerator.helpers.test.d.ts.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.helpers.test.js +61 -0
- package/dist/src/services/__tests__/SubagentGenerator.helpers.test.js.map +1 -0
- package/dist/src/services/__tests__/SubagentGenerator.test.js +155 -0
- package/dist/src/services/__tests__/SubagentGenerator.test.js.map +1 -1
- package/dist/src/services/__tests__/TransformationService.test.js +48 -0
- package/dist/src/services/__tests__/TransformationService.test.js.map +1 -1
- package/dist/src/services/agent-pack/agent-pack.test.js +1 -0
- package/dist/src/services/agent-pack/agent-pack.test.js.map +1 -1
- package/dist/src/services/agent-pack/prompt-source.d.ts +1 -1
- package/dist/src/services/agent-pack/prompt-source.d.ts.map +1 -1
- package/dist/src/services/agent-pack/prompt-source.js +10 -3
- package/dist/src/services/agent-pack/prompt-source.js.map +1 -1
- package/dist/src/services/agent-pack/types.d.ts +26 -2
- package/dist/src/services/agent-pack/types.d.ts.map +1 -1
- package/dist/src/services/agent-pack/types.js +13 -0
- package/dist/src/services/agent-pack/types.js.map +1 -1
- package/dist/src/services/agent-tool-profile.d.ts.map +1 -1
- package/dist/src/services/agent-tool-profile.js +7 -0
- package/dist/src/services/agent-tool-profile.js.map +1 -1
- package/dist/src/services/agent-tool-profile.test.js +2 -2
- package/dist/src/services/skill-content-comparison.d.ts +71 -0
- package/dist/src/services/skill-content-comparison.d.ts.map +1 -0
- package/dist/src/services/skill-content-comparison.js +90 -0
- package/dist/src/services/skill-content-comparison.js.map +1 -0
- package/dist/src/services/skill-content-comparison.test.d.ts +6 -0
- package/dist/src/services/skill-content-comparison.test.d.ts.map +1 -0
- package/dist/src/services/skill-content-comparison.test.js +83 -0
- package/dist/src/services/skill-content-comparison.test.js.map +1 -0
- package/dist/src/services/skill-identity-classification.d.ts +202 -0
- package/dist/src/services/skill-identity-classification.d.ts.map +1 -0
- package/dist/src/services/skill-identity-classification.js +295 -0
- package/dist/src/services/skill-identity-classification.js.map +1 -0
- package/dist/src/services/skill-identity-classification.test.d.ts +6 -0
- package/dist/src/services/skill-identity-classification.test.d.ts.map +1 -0
- package/dist/src/services/skill-identity-classification.test.js +314 -0
- package/dist/src/services/skill-identity-classification.test.js.map +1 -0
- package/dist/src/services/skill-installation.content.d.ts.map +1 -1
- package/dist/src/services/skill-installation.content.js +6 -1
- package/dist/src/services/skill-installation.content.js.map +1 -1
- package/dist/src/services/skill-installation.helpers.d.ts +8 -15
- package/dist/src/services/skill-installation.helpers.d.ts.map +1 -1
- package/dist/src/services/skill-installation.helpers.js +11 -105
- package/dist/src/services/skill-installation.helpers.js.map +1 -1
- package/dist/src/services/skill-installation.helpers.test.js +106 -1
- package/dist/src/services/skill-installation.helpers.test.js.map +1 -1
- package/dist/src/services/skill-installation.service.js +1 -1
- package/dist/src/services/skill-installation.service.js.map +1 -1
- package/dist/src/services/skill-installation.types.d.ts +33 -0
- package/dist/src/services/skill-installation.types.d.ts.map +1 -1
- package/dist/src/services/skill-installation.types.js.map +1 -1
- package/dist/src/services/skill-installation.uninstall.d.ts +84 -0
- package/dist/src/services/skill-installation.uninstall.d.ts.map +1 -0
- package/dist/src/services/skill-installation.uninstall.js +252 -0
- package/dist/src/services/skill-installation.uninstall.js.map +1 -0
- package/dist/src/services/skill-manifest.d.ts +41 -0
- package/dist/src/services/skill-manifest.d.ts.map +1 -1
- package/dist/src/services/skill-manifest.js +93 -0
- package/dist/src/services/skill-manifest.js.map +1 -1
- package/dist/src/services/skill-manifest.test.js +27 -0
- package/dist/src/services/skill-manifest.test.js.map +1 -1
- package/dist/src/sync/SyncEngine.d.ts.map +1 -1
- package/dist/src/sync/SyncEngine.js +69 -77
- package/dist/src/sync/SyncEngine.js.map +1 -1
- package/dist/src/telemetry/agent-marker.d.ts +8 -0
- package/dist/src/telemetry/agent-marker.d.ts.map +1 -1
- package/dist/src/telemetry/agent-marker.js +7 -0
- package/dist/src/telemetry/agent-marker.js.map +1 -1
- package/dist/src/telemetry/agent-marker.test.js +7 -1
- package/dist/src/telemetry/agent-marker.test.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +1 -1
- package/dist/src/telemetry/index.d.ts.map +1 -1
- package/dist/src/telemetry/index.js +1 -1
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/wrap.d.ts +6 -0
- package/dist/src/telemetry/wrap.d.ts.map +1 -1
- package/dist/src/telemetry/wrap.js +65 -10
- package/dist/src/telemetry/wrap.js.map +1 -1
- package/dist/src/telemetry/wrap.test.js +81 -1
- package/dist/src/telemetry/wrap.test.js.map +1 -1
- package/dist/src/telemetry/wrap.tool-call-sink.test.d.ts +26 -0
- package/dist/src/telemetry/wrap.tool-call-sink.test.d.ts.map +1 -0
- package/dist/src/telemetry/wrap.tool-call-sink.test.js +162 -0
- package/dist/src/telemetry/wrap.tool-call-sink.test.js.map +1 -0
- package/dist/src/types/skill.d.ts +9 -1
- package/dist/src/types/skill.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +2 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +3 -1
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/skill-name.d.ts +19 -0
- package/dist/src/utils/skill-name.d.ts.map +1 -0
- package/dist/src/utils/skill-name.js +26 -0
- package/dist/src/utils/skill-name.js.map +1 -0
- package/dist/src/utils/skill-name.test.d.ts +2 -0
- package/dist/src/utils/skill-name.test.d.ts.map +1 -0
- package/dist/src/utils/skill-name.test.js +34 -0
- package/dist/src/utils/skill-name.test.js.map +1 -0
- package/dist/src/utils/version-check.d.ts +61 -0
- package/dist/src/utils/version-check.d.ts.map +1 -1
- package/dist/src/utils/version-check.js +78 -1
- package/dist/src/utils/version-check.js.map +1 -1
- package/dist/src/utils/version-check.test.js +130 -1
- package/dist/src/utils/version-check.test.js.map +1 -1
- package/dist/tests/db/migration-runner-race.test.js +19 -9
- package/dist/tests/db/migration-runner-race.test.js.map +1 -1
- package/dist/tests/install/fan-out.test.js +27 -0
- package/dist/tests/install/fan-out.test.js.map +1 -1
- package/dist/tests/security/ContinuousSecurity.performance.test.js +12 -7
- package/dist/tests/security/ContinuousSecurity.performance.test.js.map +1 -1
- package/dist/tests/security/ContinuousSecurity.test.js +14 -2
- package/dist/tests/security/ContinuousSecurity.test.js.map +1 -1
- package/dist/tests/security/ai-defence-multiline-promotion.test.d.ts +10 -12
- package/dist/tests/security/ai-defence-multiline-promotion.test.d.ts.map +1 -1
- package/dist/tests/security/ai-defence-multiline-promotion.test.js +26 -33
- package/dist/tests/security/ai-defence-multiline-promotion.test.js.map +1 -1
- package/dist/tests/security/nested-instruction-long-attribute.test.js +20 -10
- package/dist/tests/security/nested-instruction-long-attribute.test.js.map +1 -1
- package/dist/tests/security/scanner-evidence-tiers.test.js +15 -0
- package/dist/tests/security/scanner-evidence-tiers.test.js.map +1 -1
- package/dist/tests/security/scanner-multiline-cap.test.d.ts +21 -0
- package/dist/tests/security/scanner-multiline-cap.test.d.ts.map +1 -0
- package/dist/tests/security/scanner-multiline-cap.test.js +152 -0
- package/dist/tests/security/scanner-multiline-cap.test.js.map +1 -0
- package/dist/tests/security/scanner-regression-guard.test.js +37 -0
- package/dist/tests/security/scanner-regression-guard.test.js.map +1 -1
- package/dist/tests/security/scanner-witness-sw1.test.d.ts +32 -0
- package/dist/tests/security/scanner-witness-sw1.test.d.ts.map +1 -0
- package/dist/tests/security/scanner-witness-sw1.test.js +255 -0
- package/dist/tests/security/scanner-witness-sw1.test.js.map +1 -0
- package/dist/tests/security/sensitive-path-adversarial-review.test.d.ts +2 -0
- package/dist/tests/security/sensitive-path-adversarial-review.test.d.ts.map +1 -0
- package/dist/tests/security/sensitive-path-adversarial-review.test.js +193 -0
- package/dist/tests/security/sensitive-path-adversarial-review.test.js.map +1 -0
- package/dist/tests/security/sensitive-path-fp.test.js +248 -0
- package/dist/tests/security/sensitive-path-fp.test.js.map +1 -1
- package/dist/tests/security/smi5879-corroboration.core.test.js +44 -0
- package/dist/tests/security/smi5879-corroboration.core.test.js.map +1 -1
- package/dist/tests/security/weak-password-lexicon.test.d.ts +18 -0
- package/dist/tests/security/weak-password-lexicon.test.d.ts.map +1 -0
- package/dist/tests/security/weak-password-lexicon.test.js +122 -0
- package/dist/tests/security/weak-password-lexicon.test.js.map +1 -0
- package/dist/tests/skill-scanner/allowlist.test.js +58 -4
- package/dist/tests/skill-scanner/allowlist.test.js.map +1 -1
- package/dist/tests/skill-scanner/categorizer.test.d.ts +2 -0
- package/dist/tests/skill-scanner/categorizer.test.d.ts.map +1 -0
- package/dist/tests/skill-scanner/categorizer.test.js +71 -0
- package/dist/tests/skill-scanner/categorizer.test.js.map +1 -0
- package/dist/tests/skill-scanner/cli-guard.test.d.ts +23 -0
- package/dist/tests/skill-scanner/cli-guard.test.d.ts.map +1 -0
- package/dist/tests/skill-scanner/cli-guard.test.js +71 -0
- package/dist/tests/skill-scanner/cli-guard.test.js.map +1 -0
- package/dist/tests/sync/SyncEngine.abort.test.js +15 -11
- package/dist/tests/sync/SyncEngine.abort.test.js.map +1 -1
- package/dist/tests/sync/SyncEngine.status.test.js +1 -1
- package/dist/tests/sync/SyncEngine.status.test.js.map +1 -1
- package/dist/tests/sync/SyncEngine.test.d.ts +11 -2
- package/dist/tests/sync/SyncEngine.test.d.ts.map +1 -1
- package/dist/tests/sync/SyncEngine.test.js +164 -13
- package/dist/tests/sync/SyncEngine.test.js.map +1 -1
- package/dist/tests/unit/migrations/migration-v18.test.d.ts +16 -0
- package/dist/tests/unit/migrations/migration-v18.test.d.ts.map +1 -0
- package/dist/tests/unit/migrations/migration-v18.test.js +192 -0
- package/dist/tests/unit/migrations/migration-v18.test.js.map +1 -0
- package/dist/tests/unit/services/skill-installation.content.test.js +101 -1
- package/dist/tests/unit/services/skill-installation.content.test.js.map +1 -1
- package/dist/tests/unit/services/skill-installation.service.sensitive-path-fp.test.d.ts +29 -0
- package/dist/tests/unit/services/skill-installation.service.sensitive-path-fp.test.d.ts.map +1 -0
- package/dist/tests/unit/services/skill-installation.service.sensitive-path-fp.test.js +200 -0
- package/dist/tests/unit/services/skill-installation.service.sensitive-path-fp.test.js.map +1 -0
- package/dist/tests/unit/services/skill-installation.service.test.js +9 -8
- package/dist/tests/unit/services/skill-installation.service.test.js.map +1 -1
- package/dist/tests/unit/sync-engine.source-aware.test.js +5 -5
- package/dist/tests/unit/sync-engine.source-aware.test.js.map +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-6276 (Wave 6 Step 1): per-client generation profile for companion
|
|
3
|
+
* subagent files (`SubagentGenerator.ts`).
|
|
4
|
+
*
|
|
5
|
+
* `SubagentGenerator.generateSubagentContent()` predates multi-client support
|
|
6
|
+
* entirely — it always emitted Claude-native tool names (`Read, Write, Bash,
|
|
7
|
+
* WebFetch, Grep, Glob, WebSearch`) plus a `model: <haiku|sonnet|opus>`
|
|
8
|
+
* frontmatter field, for every client `COMPANION_AGENT_TARGETS`
|
|
9
|
+
* (`../install/paths.ts`) writes a companion-agent file for — including
|
|
10
|
+
* clients whose own agent-definition format doesn't have a `tools:` or
|
|
11
|
+
* `model:` concept, has one with entirely different value semantics, or (a
|
|
12
|
+
* real, spec-documented failure mode for AntiGravity specifically — see
|
|
13
|
+
* below) can HANG the subagent process on an unmapped tool name.
|
|
14
|
+
*
|
|
15
|
+
* This module is the exhaustive per-client answer, keyed on `ClientId`
|
|
16
|
+
* (matching `COMPANION_AGENT_TARGETS`'s own key set, not the narrower
|
|
17
|
+
* `HarnessId` — every `ClientId` gets a companion-agent file written
|
|
18
|
+
* somewhere per `COMPANION_AGENT_TARGETS`, so every one needs a content
|
|
19
|
+
* decision here too). For each client:
|
|
20
|
+
*
|
|
21
|
+
* 1. Which frontmatter fields it accepts (`includeSkillsField`,
|
|
22
|
+
* `toolsPolicy`, `modelPolicy`, `extraFrontmatterLines`).
|
|
23
|
+
* 2. Its tool-identifier vocabulary and value SHAPE — `'claude-native'`
|
|
24
|
+
* (Skillsmith's internal tool names ARE that client's own names, emitted
|
|
25
|
+
* as a comma-separated scalar, no translation needed), `'mapped-array'`
|
|
26
|
+
* (the client has its OWN, confirmed-different tool vocabulary AND
|
|
27
|
+
* expects a YAML array rather than a scalar — translate through
|
|
28
|
+
* `toolNameMap`, silently drop any internal name with no confirmed
|
|
29
|
+
* mapping, and omit the field entirely if nothing maps), or `'omit'`
|
|
30
|
+
* (vocabulary not independently verified at all — never emit the field
|
|
31
|
+
* rather than guess a wrong value).
|
|
32
|
+
* 3. Its model-selection policy — `'claude-enum'` (accepts Claude's
|
|
33
|
+
* `haiku|sonnet|opus` values directly) or `'omit'` (either no `model:`
|
|
34
|
+
* concept at all, or one with value semantics that don't line up with
|
|
35
|
+
* Skillsmith's internal enum — including a DIFFERENT PROVIDER's own
|
|
36
|
+
* model-tier vocabulary, which is a family swap, not just a renaming).
|
|
37
|
+
*
|
|
38
|
+
* Confidence levels (style follows `../install/agent-harness-targets.ts`'s
|
|
39
|
+
* own header — HIGH/MEDIUM/LOW per client, dated citation, never asserted
|
|
40
|
+
* past what the citation actually supports):
|
|
41
|
+
*
|
|
42
|
+
* - **claude-code** — HIGH. Claude Code's own native subagent format
|
|
43
|
+
* (`.claude/agents/*.md`): `name`, `description`, `tools` (comma-separated
|
|
44
|
+
* Claude tool names), `model`. This is this repo's pre-existing behavior
|
|
45
|
+
* (unchanged by this wave) and matches `renderClaudeShim()`
|
|
46
|
+
* (`agent-pack/shims.ts`), which uses the identical `name`/`description`/
|
|
47
|
+
* `tools` frontmatter shape for the fixed named-agent shim.
|
|
48
|
+
* - **cursor** — HIGH, verified live against cursor.com/docs/subagents
|
|
49
|
+
* (fetched 2026-08-30): "Cursor recognizes subagent files across multiple
|
|
50
|
+
* directory formats: `.cursor/agents/` (Cursor format), `.claude/agents/`
|
|
51
|
+
* (Claude compatibility), `.codex/agents/` (Codex compatibility)."
|
|
52
|
+
* `COMPANION_AGENT_TARGETS.cursor` resolves to the SAME path as
|
|
53
|
+
* `claude-code` (`~/.claude/agents/<name>-specialist.md` — see that
|
|
54
|
+
* table's own comment: "Cursor 2.4+ reads `.claude/agents/` natively — no
|
|
55
|
+
* separate shim file"), so the file this generator actually writes for
|
|
56
|
+
* `--client cursor` is read by Cursor through that Claude-compatibility
|
|
57
|
+
* path and must carry genuine Claude-format frontmatter — this profile
|
|
58
|
+
* mirrors `claude-code`'s exactly (same object, not a coincidental
|
|
59
|
+
* duplicate). Cursor's OWN native `.cursor/agents/*.md` format is verified
|
|
60
|
+
* DIFFERENT (fields: `name`, `description`, `model` — values `inherit`,
|
|
61
|
+
* `fast`, or a hardcoded model ID, NOT Claude's `haiku|sonnet|opus` enum —
|
|
62
|
+
* `readonly`, `is_background`; explicitly NO `tools` field: "Subagents
|
|
63
|
+
* inherit all tools from the parent, including MCP tools from configured
|
|
64
|
+
* servers") but Skillsmith never writes to that native directory (no
|
|
65
|
+
* `.cursor/agents/` entry exists in `COMPANION_AGENT_TARGETS`), so that
|
|
66
|
+
* narrower native schema does not govern the file this generator produces.
|
|
67
|
+
* - **antigravity** — HIGH for the schema itself, verified live against
|
|
68
|
+
* `antigravity.google/docs/subagents/` (fetched 2026-08-30, cross-checked
|
|
69
|
+
* by an independent WebSearch and by Wayback snapshots bracketing
|
|
70
|
+
* 2026-08-06 through 2026-08-16 — see
|
|
71
|
+
* `docs/internal/implementation/smi-6276-subagent-true-antigravity-repro.md`
|
|
72
|
+
* for the full investigation, filed for the separate `subagent: true`
|
|
73
|
+
* question but covering this same schema). **Correction of SMI-5982's
|
|
74
|
+
* original sourcing**: that wave cited
|
|
75
|
+
* `antigravity.google/docs/cli/commands/agents` (the CLI `/agents` TUI
|
|
76
|
+
* command reference, whose example happens to show only `name`+
|
|
77
|
+
* `description`) as if it were the full schema. The real, richer schema
|
|
78
|
+
* lives at `/docs/subagents`: `name`, `description` (both required),
|
|
79
|
+
* `tools` (`string[]`, default `[]` — a YAML ARRAY, not a scalar, of
|
|
80
|
+
* AntiGravity's OWN tool names, e.g. `view_file`, `replace_file_content`,
|
|
81
|
+
* `grep_search`, `run_command` — confirmed DIFFERENT from Skillsmith's
|
|
82
|
+
* Claude-style names), `mainAgent`/`subagent` (booleans, both default
|
|
83
|
+
* `true` — the `subagent: true` question is Step 2's separate scope, not
|
|
84
|
+
* touched here), `model` (`inherit|flash|pro`, default `inherit` — NOT
|
|
85
|
+
* Claude's `haiku|sonnet|opus`), `commandExecutionPolicy`, `mcpServers`,
|
|
86
|
+
* `skills`/`plugins` (skill PATHS like `skills/my-helper-skill` — a
|
|
87
|
+
* DIFFERENT concept from Skillsmith's own `skills: <bare-name>` extension
|
|
88
|
+
* field below, not reused here for that reason).
|
|
89
|
+
*
|
|
90
|
+
* MEDIUM for the specific tool-name MAPPING used here: the docs page only
|
|
91
|
+
* gives 4 example tool names (not a complete enumeration), so
|
|
92
|
+
* `toolNameMap` below covers only those 4, mapped by clear name
|
|
93
|
+
* correspondence (`view_file`→Read, `replace_file_content`→Write/Edit,
|
|
94
|
+
* `grep_search`→Grep, `run_command`→Bash); Skillsmith's `Glob`, `WebFetch`,
|
|
95
|
+
* and `WebSearch` have no confirmed AntiGravity equivalent and are
|
|
96
|
+
* silently dropped, never guessed. This is deliberately a `'mapped-array'`
|
|
97
|
+
* policy rather than `'omit'`, unlike every other unverified-vocabulary
|
|
98
|
+
* client in this table: AntiGravity's own schema documents `tools`
|
|
99
|
+
* defaulting to `[]` (empty) when omitted — the OPPOSITE of Cursor's
|
|
100
|
+
* "inherits from parent" or Copilot's "all tools available" defaults — so
|
|
101
|
+
* omitting the field here would ship a companion subagent with literally
|
|
102
|
+
* ZERO tool access, not a harmlessly-permissive default. A confidently-cited
|
|
103
|
+
* partial mapping is more correct than that, and strictly safer than
|
|
104
|
+
* guessing at unconfirmed names: the same docs page's own "Known Issue
|
|
105
|
+
* (Tool Validation)" warns that "specifying an unmapped or misspelled tool
|
|
106
|
+
* name in the `tools` list may cause the subagent process to hang during
|
|
107
|
+
* execution" — every name emitted here is a name AntiGravity's own docs
|
|
108
|
+
* use as a worked example, never an invented one.
|
|
109
|
+
*
|
|
110
|
+
* `model:` is OMITTED for AntiGravity, not mapped — deliberately, not for
|
|
111
|
+
* lack of trying. AntiGravity's `flash`/`pro` are Gemini model tiers;
|
|
112
|
+
* Skillsmith's `haiku`/`sonnet`/`opus` are Claude model tiers. These are
|
|
113
|
+
* two DIFFERENT model families from two different vendors, not two
|
|
114
|
+
* spellings of the same capability scale — `haiku→flash` and `opus→pro`
|
|
115
|
+
* are plausible analogies, but `sonnet` (Skillsmith's own default "for
|
|
116
|
+
* balanced workloads", `determineModel()`) has no principled third rung to
|
|
117
|
+
* land on in a 2-tier scale, and no official source equates any Claude
|
|
118
|
+
* tier to any Gemini tier. Omitting the field uses AntiGravity's own
|
|
119
|
+
* documented default (`inherit` — defer to whatever tier the invoking
|
|
120
|
+
* session already uses), which is a real, working, spec-sanctioned value,
|
|
121
|
+
* not an absence of a decision.
|
|
122
|
+
* - **copilot** — MEDIUM, verified live against GitHub's own docs
|
|
123
|
+
* (docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/create-custom-agents,
|
|
124
|
+
* fetched 2026-08-30): `.agent.md` frontmatter DOES support a `tools` list
|
|
125
|
+
* (documented examples: `"read"`, `"edit"`, `"search"`) and a `model`
|
|
126
|
+
* field. NOT verified: a full mapping from Skillsmith's own 8-tool
|
|
127
|
+
* vocabulary (`Read`/`Write`/`Edit`/`Bash`/`Grep`/`Glob`/`WebFetch`/
|
|
128
|
+
* `WebSearch`) onto Copilot's identifier set — only 2-3 of the 8 have a
|
|
129
|
+
* plausible lowercase counterpart in the documented examples, with no
|
|
130
|
+
* confirmed equivalents for `Bash`/`Grep`/`Glob`/`WebFetch` specifically.
|
|
131
|
+
* Unlike AntiGravity, Copilot's own docs confirm omission is SAFE here —
|
|
132
|
+
* "Omitting tools grants access to all available tools — the default is
|
|
133
|
+
* permissive" — so, per this wave's fallback rule, omit `tools:` rather
|
|
134
|
+
* than emit a guessed-wrong partial mapping; the omission doesn't cripple
|
|
135
|
+
* the subagent the way it would for AntiGravity. `model:` is likewise
|
|
136
|
+
* omitted — its value format (Copilot's own model catalog IDs) has no
|
|
137
|
+
* confirmed correspondence to Skillsmith's internal `haiku|sonnet|opus`
|
|
138
|
+
* abstraction.
|
|
139
|
+
* - **opencode** — MEDIUM, verified live against opencode.ai/v2/docs/agents/
|
|
140
|
+
* (fetched 2026-08-30): confirmed frontmatter fields `description`, `mode`
|
|
141
|
+
* (`primary|subagent|all`), `model` (`provider/model#variant` format — NOT
|
|
142
|
+
* Claude's `haiku|sonnet|opus` enum), `color`, `steps`, `permissions`. This
|
|
143
|
+
* repo's own `renderOpenCodeShim()` (`agent-pack/shims.ts`) already
|
|
144
|
+
* documents the load-bearing fact this profile reuses: "OpenCode's
|
|
145
|
+
* frontmatter `tools` field is a permission map, not a plain list; setting
|
|
146
|
+
* it wrong would restrict tools rather than reference them" — same
|
|
147
|
+
* precedent applied here, omitting `tools:` rather than writing a
|
|
148
|
+
* Claude-shaped value into a boolean-permission-map field (a different,
|
|
149
|
+
* harder mapping problem than AntiGravity's plain array — not attempted in
|
|
150
|
+
* this wave). `mode: subagent` IS included (HIGH confidence for this one
|
|
151
|
+
* line specifically — mirrors the already-shipped `renderOpenCodeShim()`
|
|
152
|
+
* verbatim). `model:` omitted — no confirmed mapping from Skillsmith's
|
|
153
|
+
* internal enum to OpenCode's `provider/model` format.
|
|
154
|
+
* - **windsurf** — LOW. No independently confirmed per-subagent-file
|
|
155
|
+
* frontmatter schema for tool/model restriction was found; Windsurf's
|
|
156
|
+
* Cascade agent runtime is additionally documented as being retired (EOL
|
|
157
|
+
* 2026-07-01, superseded by Devin Local). Omit `tools:` and `model:`,
|
|
158
|
+
* matching this table's existing conservative default for windsurf
|
|
159
|
+
* (`COMPANION_AGENT_TARGETS.windsurf`'s own comment: "No
|
|
160
|
+
* `AGENT_SHIM_TARGETS` entry exists for windsurf ... defaults to today's
|
|
161
|
+
* actual behavior" — that comment covers the file PATH only; this module
|
|
162
|
+
* makes the equivalent conservative call for the file's CONTENT).
|
|
163
|
+
* - **agents** — LOW. This `ClientId` is the generic cross-agent /
|
|
164
|
+
* `AGENTS.md` convention (also Codex's install target — "Codex: reads
|
|
165
|
+
* ONLY `~/.agents/skills`", `../install/paths.ts`'s own header comment).
|
|
166
|
+
* The `AGENTS.md` standard itself has no required fields and no YAML
|
|
167
|
+
* frontmatter for its single project-instructions file (openai/codex's own
|
|
168
|
+
* `AGENTS.md`; agents.md spec) — there is no confirmed per-agent-definition
|
|
169
|
+
* file schema with tool/model fields for this identifier at all. Omit
|
|
170
|
+
* `tools:` and `model:`.
|
|
171
|
+
* - **hermes** — LOW. Hermes's own documented frontmatter
|
|
172
|
+
* (hermes-agent.nousresearch.com/docs/) is for SKILL files (`name`,
|
|
173
|
+
* `description`, `version`, `author`, `platforms`), not a separate
|
|
174
|
+
* subagent-definition schema with tool/model restriction fields. Omit
|
|
175
|
+
* `tools:` and `model:`.
|
|
176
|
+
* - **grok** — LOW. Grok Build (docs.x.ai/build/overview,
|
|
177
|
+
* github.com/xai-org/grok-build) confirms agent frontmatter EXISTS
|
|
178
|
+
* ("Subagents can declare their own `mcpServers` in agent frontmatter") but
|
|
179
|
+
* no built-in tool-identifier vocabulary or Claude-comparable model enum is
|
|
180
|
+
* documented. Omit `tools:` and `model:`.
|
|
181
|
+
*
|
|
182
|
+
* @see docs/internal/implementation/cursor-antigravity-tier-parity-plan.md (Wave 6 Step 1)
|
|
183
|
+
* @see docs/internal/implementation/smi-6276-subagent-true-antigravity-repro.md (AntiGravity schema source-of-truth)
|
|
184
|
+
*/
|
|
185
|
+
import { CANONICAL_CLIENT } from '../install/paths.js';
|
|
186
|
+
/** claude-code's own native format — this generator's pre-existing (unchanged) behavior. */
|
|
187
|
+
const CLAUDE_FORMAT_PROFILE = {
|
|
188
|
+
confidence: 'HIGH',
|
|
189
|
+
citation: "Claude Code's native `.claude/agents/*.md` subagent format (name/description/tools/model) — this repo's pre-existing behavior; matches renderClaudeShim() (agent-pack/shims.ts).",
|
|
190
|
+
includeSkillsField: true,
|
|
191
|
+
toolsPolicy: 'claude-native',
|
|
192
|
+
modelPolicy: 'claude-enum',
|
|
193
|
+
extraFrontmatterLines: [],
|
|
194
|
+
};
|
|
195
|
+
/** Minimal name+description-only shape shared by every unverified-vocabulary client. */
|
|
196
|
+
function minimalProfile(confidence, citation, extraFrontmatterLines = []) {
|
|
197
|
+
return {
|
|
198
|
+
confidence,
|
|
199
|
+
citation,
|
|
200
|
+
includeSkillsField: false,
|
|
201
|
+
toolsPolicy: 'omit',
|
|
202
|
+
modelPolicy: 'omit',
|
|
203
|
+
extraFrontmatterLines,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* AntiGravity's own tool vocabulary (antigravity.google/docs/subagents/,
|
|
208
|
+
* fetched 2026-08-30) — only the 4 names the docs page itself uses as
|
|
209
|
+
* worked examples. See module header for why this is `'mapped-array'`
|
|
210
|
+
* rather than `'omit'` (AntiGravity's own `tools` default is `[]`, not
|
|
211
|
+
* permissive) and why `Glob`/`WebFetch`/`WebSearch` have no entry.
|
|
212
|
+
*/
|
|
213
|
+
const ANTIGRAVITY_TOOL_NAME_MAP = {
|
|
214
|
+
Read: 'view_file',
|
|
215
|
+
Write: 'replace_file_content',
|
|
216
|
+
Edit: 'replace_file_content',
|
|
217
|
+
Bash: 'run_command',
|
|
218
|
+
Grep: 'grep_search',
|
|
219
|
+
};
|
|
220
|
+
export const SUBAGENT_CLIENT_PROFILES = {
|
|
221
|
+
'claude-code': CLAUDE_FORMAT_PROFILE,
|
|
222
|
+
// Mirrors claude-code exactly: COMPANION_AGENT_TARGETS.cursor writes into
|
|
223
|
+
// the SAME `~/.claude/agents/<name>-specialist.md` path, and Cursor reads
|
|
224
|
+
// that directory as a documented Claude-compatibility surface (see module
|
|
225
|
+
// header). This is a deliberate object reuse, not accidental sharing.
|
|
226
|
+
cursor: CLAUDE_FORMAT_PROFILE,
|
|
227
|
+
antigravity: {
|
|
228
|
+
confidence: 'HIGH',
|
|
229
|
+
citation: 'antigravity.google/docs/subagents/ (fetched 2026-08-30, cross-checked via independent WebSearch + Wayback bracketing 2026-08-06..2026-08-16; see smi-6276-subagent-true-antigravity-repro.md): tools is a YAML array of AntiGravity-own names defaulting to [] when omitted; model is inherit|flash|pro (a different vendor/model family from Claude — omitted rather than force-mapped).',
|
|
230
|
+
includeSkillsField: false,
|
|
231
|
+
toolsPolicy: 'mapped-array',
|
|
232
|
+
toolNameMap: ANTIGRAVITY_TOOL_NAME_MAP,
|
|
233
|
+
modelPolicy: 'omit',
|
|
234
|
+
extraFrontmatterLines: [],
|
|
235
|
+
},
|
|
236
|
+
copilot: minimalProfile('MEDIUM', "docs.github.com custom-agents docs (fetched 2026-08-30): tools/model fields exist and omitting tools is documented as permissive ('all tools available') — safe to omit rather than guess the full Skillsmith-tool-name mapping."),
|
|
237
|
+
opencode: minimalProfile('MEDIUM', "opencode.ai/v2/docs/agents/ (fetched 2026-08-30) + this repo's own renderOpenCodeShim(): tools is a boolean permission map, not a list — omit rather than mis-shape it. mode: subagent is HIGH-confidence and included.", ['mode: subagent']),
|
|
238
|
+
windsurf: minimalProfile('LOW', 'No confirmed per-subagent-file tools/model schema found; Cascade is documented as being retired (EOL 2026-07-01).'),
|
|
239
|
+
agents: minimalProfile('LOW', 'The generic AGENTS.md convention has no required fields and no confirmed per-agent-definition-file schema at all.'),
|
|
240
|
+
hermes: minimalProfile('LOW', 'hermes-agent.nousresearch.com/docs/: documented frontmatter is for SKILL files (name/description/version/author/platforms), not a subagent tools/model schema.'),
|
|
241
|
+
grok: minimalProfile('LOW', 'docs.x.ai/build/overview + xai-org/grok-build: agent frontmatter exists but no built-in tool-identifier vocabulary or Claude-comparable model enum is documented.'),
|
|
242
|
+
};
|
|
243
|
+
/** Resolve the per-client generation profile for `client` (default: canonical / claude-code). */
|
|
244
|
+
export function getSubagentGenerationProfile(client = CANONICAL_CLIENT) {
|
|
245
|
+
return SUBAGENT_CLIENT_PROFILES[client];
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Translate Skillsmith-internal tool names through `profile.toolNameMap`,
|
|
249
|
+
* dropping any name with no confirmed entry and de-duplicating the result
|
|
250
|
+
* (two internal names can map to the same client tool, e.g. AntiGravity's
|
|
251
|
+
* `Write`/`Edit` -> `replace_file_content`). Returns `[]` when nothing maps
|
|
252
|
+
* — callers must omit the `tools:` field entirely in that case, not emit an
|
|
253
|
+
* empty array, per this module's own fallback philosophy.
|
|
254
|
+
*/
|
|
255
|
+
export function mapToolNames(tools, profile) {
|
|
256
|
+
const map = profile.toolNameMap ?? {};
|
|
257
|
+
const mapped = tools.map((tool) => map[tool]).filter((tool) => tool !== undefined);
|
|
258
|
+
return Array.from(new Set(mapped));
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=SubagentGenerator.client-profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubagentGenerator.client-profiles.js","sourceRoot":"","sources":["../../../src/services/SubagentGenerator.client-profiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuLG;AAEH,OAAO,EAAE,gBAAgB,EAAiB,MAAM,qBAAqB,CAAA;AAiErE,4FAA4F;AAC5F,MAAM,qBAAqB,GAA8B;IACvD,UAAU,EAAE,MAAM;IAClB,QAAQ,EACN,kLAAkL;IACpL,kBAAkB,EAAE,IAAI;IACxB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,aAAa;IAC1B,qBAAqB,EAAE,EAAE;CAC1B,CAAA;AAED,wFAAwF;AACxF,SAAS,cAAc,CACrB,UAAmD,EACnD,QAAgB,EAChB,wBAA2C,EAAE;IAE7C,OAAO;QACL,UAAU;QACV,QAAQ;QACR,kBAAkB,EAAE,KAAK;QACzB,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,MAAM;QACnB,qBAAqB;KACtB,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,yBAAyB,GAAqC;IAClE,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;CACpB,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAA0D;IAC7F,aAAa,EAAE,qBAAqB;IACpC,0EAA0E;IAC1E,0EAA0E;IAC1E,0EAA0E;IAC1E,sEAAsE;IACtE,MAAM,EAAE,qBAAqB;IAC7B,WAAW,EAAE;QACX,UAAU,EAAE,MAAM;QAClB,QAAQ,EACN,2XAA2X;QAC7X,kBAAkB,EAAE,KAAK;QACzB,WAAW,EAAE,cAAc;QAC3B,WAAW,EAAE,yBAAyB;QACtC,WAAW,EAAE,MAAM;QACnB,qBAAqB,EAAE,EAAE;KAC1B;IACD,OAAO,EAAE,cAAc,CACrB,QAAQ,EACR,kOAAkO,CACnO;IACD,QAAQ,EAAE,cAAc,CACtB,QAAQ,EACR,yNAAyN,EACzN,CAAC,gBAAgB,CAAC,CACnB;IACD,QAAQ,EAAE,cAAc,CACtB,KAAK,EACL,mHAAmH,CACpH;IACD,MAAM,EAAE,cAAc,CACpB,KAAK,EACL,mHAAmH,CACpH;IACD,MAAM,EAAE,cAAc,CACpB,KAAK,EACL,gKAAgK,CACjK;IACD,IAAI,EAAE,cAAc,CAClB,KAAK,EACL,mKAAmK,CACpK;CACF,CAAA;AAED,iGAAiG;AACjG,MAAM,UAAU,4BAA4B,CAC1C,SAAmB,gBAAgB;IAEnC,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAwB,EACxB,OAAkC;IAElC,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAA;IACrC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;IAClG,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -9,47 +9,19 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Part of the Skillsmith Optimization Layer for transforming
|
|
11
11
|
* community skills into more performant versions.
|
|
12
|
+
*
|
|
13
|
+
* SMI-6276 (Wave 6 Step 1): companion-agent frontmatter is now generated
|
|
14
|
+
* per TARGET CLIENT via `SubagentGenerator.client-profiles.ts` — this file
|
|
15
|
+
* no longer emits Claude-native tool names / a Claude `model:` value
|
|
16
|
+
* unconditionally for every client `COMPANION_AGENT_TARGETS` writes a
|
|
17
|
+
* companion file for. Types split to `.types.ts`, pure helpers split to
|
|
18
|
+
* `.helpers.ts` (500-line standard).
|
|
12
19
|
*/
|
|
20
|
+
export type { ClaudeModel, SubagentDefinition, SubagentGenerationResult, } from './SubagentGenerator.types.js';
|
|
21
|
+
export { CLAUDE_MODELS } from './SubagentGenerator.types.js';
|
|
13
22
|
import type { SkillAnalysis } from './SkillAnalyzer.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
export declare const CLAUDE_MODELS: {
|
|
18
|
-
readonly HAIKU: "haiku";
|
|
19
|
-
readonly SONNET: "sonnet";
|
|
20
|
-
readonly OPUS: "opus";
|
|
21
|
-
};
|
|
22
|
-
export type ClaudeModel = (typeof CLAUDE_MODELS)[keyof typeof CLAUDE_MODELS];
|
|
23
|
-
/**
|
|
24
|
-
* Generated subagent definition
|
|
25
|
-
*/
|
|
26
|
-
export interface SubagentDefinition {
|
|
27
|
-
/** Subagent name (e.g., "jest-helper-specialist") */
|
|
28
|
-
name: string;
|
|
29
|
-
/** Description for the Task tool */
|
|
30
|
-
description: string;
|
|
31
|
-
/** Trigger phrases that should invoke this subagent */
|
|
32
|
-
triggerPhrases: string[];
|
|
33
|
-
/** Tools the subagent needs access to */
|
|
34
|
-
tools: string[];
|
|
35
|
-
/** Recommended model */
|
|
36
|
-
model: ClaudeModel;
|
|
37
|
-
/** The full markdown content for ~/.claude/agents/ */
|
|
38
|
-
content: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Result of subagent generation
|
|
42
|
-
*/
|
|
43
|
-
export interface SubagentGenerationResult {
|
|
44
|
-
/** Whether a subagent was generated */
|
|
45
|
-
generated: boolean;
|
|
46
|
-
/** The subagent definition (if generated) */
|
|
47
|
-
subagent?: SubagentDefinition;
|
|
48
|
-
/** Reason if not generated */
|
|
49
|
-
reason?: string;
|
|
50
|
-
/** CLAUDE.md integration snippet */
|
|
51
|
-
claudeMdSnippet?: string;
|
|
52
|
-
}
|
|
23
|
+
import { type ClientId } from '../install/paths.js';
|
|
24
|
+
import { type SubagentGenerationResult } from './SubagentGenerator.types.js';
|
|
53
25
|
/**
|
|
54
26
|
* Generate a companion subagent for a skill
|
|
55
27
|
*
|
|
@@ -57,18 +29,24 @@ export interface SubagentGenerationResult {
|
|
|
57
29
|
* @param description - The skill's description
|
|
58
30
|
* @param content - The full SKILL.md content
|
|
59
31
|
* @param analysis - Analysis from SkillAnalyzer
|
|
32
|
+
* @param client - SMI-6276: target client for the generated companion-agent
|
|
33
|
+
* frontmatter shape (default: canonical / `claude-code`, preserving prior
|
|
34
|
+
* behavior for every existing caller). See `SubagentGenerator.client-profiles.ts`.
|
|
60
35
|
* @returns Subagent generation result
|
|
61
36
|
*/
|
|
62
|
-
export declare function generateSubagent(skillName: string, description: string, content: string, analysis: SkillAnalysis): SubagentGenerationResult;
|
|
37
|
+
export declare function generateSubagent(skillName: string, description: string, content: string, analysis: SkillAnalysis, client?: ClientId): SubagentGenerationResult;
|
|
63
38
|
/**
|
|
64
39
|
* Generate a minimal subagent for skills that don't need full analysis
|
|
65
40
|
*
|
|
66
41
|
* @param skillName - The name of the skill
|
|
67
42
|
* @param description - The skill's description
|
|
68
43
|
* @param content - The full SKILL.md content
|
|
44
|
+
* @param client - SMI-6276: target client for the generated companion-agent
|
|
45
|
+
* frontmatter shape (default: canonical / `claude-code`, preserving prior
|
|
46
|
+
* behavior for every existing caller). See `SubagentGenerator.client-profiles.ts`.
|
|
69
47
|
* @returns Subagent generation result
|
|
70
48
|
*/
|
|
71
|
-
export declare function generateMinimalSubagent(skillName: string, description: string, content: string): SubagentGenerationResult;
|
|
49
|
+
export declare function generateMinimalSubagent(skillName: string, description: string, content: string, client?: ClientId): SubagentGenerationResult;
|
|
72
50
|
declare const _default: {
|
|
73
51
|
generateSubagent: typeof generateSubagent;
|
|
74
52
|
generateMinimalSubagent: typeof generateMinimalSubagent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubagentGenerator.d.ts","sourceRoot":"","sources":["../../../src/services/SubagentGenerator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SubagentGenerator.d.ts","sourceRoot":"","sources":["../../../src/services/SubagentGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAErE,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,8BAA8B,CAAA;AA0GrC;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,EACvB,MAAM,GAAE,QAA2B,GAClC,wBAAwB,CAoE1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,QAA2B,GAClC,wBAAwB,CAmD1B;;;;;AAED,wBAA4D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1788: Pure helper functions for SubagentGenerator — tool detection,
|
|
3
|
+
* trigger-phrase extraction, model selection, and Claude-tool-named
|
|
4
|
+
* guidance text. Split out under the 500-line standard (SMI-6276) following
|
|
5
|
+
* this directory's existing `.helpers.ts` convention (see
|
|
6
|
+
* SkillAnalyzer.helpers.ts / SkillDecomposer.helpers.ts).
|
|
7
|
+
*/
|
|
8
|
+
import type { ToolUsageAnalysis } from './SkillAnalyzer.js';
|
|
9
|
+
import { type ClaudeModel } from './SubagentGenerator.types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Tool detection patterns for analyzing skill content
|
|
12
|
+
*/
|
|
13
|
+
export declare const TOOL_PATTERNS: Record<string, {
|
|
14
|
+
patterns: string[];
|
|
15
|
+
priority: number;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Minimum tools that most subagents need
|
|
19
|
+
*/
|
|
20
|
+
export declare const BASE_TOOLS: string[];
|
|
21
|
+
/**
|
|
22
|
+
* SMI-1819: Maximum length for subagent names to prevent overly long identifiers
|
|
23
|
+
*/
|
|
24
|
+
export declare const MAX_SUBAGENT_NAME_LENGTH = 100;
|
|
25
|
+
/**
|
|
26
|
+
* Generate tool usage guidelines for a subagent (Claude-named tools).
|
|
27
|
+
* Only used for clients whose `toolsPolicy` is `'claude-native'` — see
|
|
28
|
+
* `SubagentGenerator.client-profiles.ts` and `OMITTED_TOOLS_GUIDANCE`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function generateToolGuidelines(tools: string[]): string;
|
|
31
|
+
/**
|
|
32
|
+
* SMI-6276: fallback tool-usage guidance for any client whose companion
|
|
33
|
+
* subagent file does not carry Claude-named tools in its `tools:`
|
|
34
|
+
* frontmatter — either because the field is omitted entirely, or because it
|
|
35
|
+
* was translated into that client's OWN vocabulary (`mapped-array`, e.g.
|
|
36
|
+
* AntiGravity's `view_file`/`run_command`). Naming Claude-specific tool
|
|
37
|
+
* identifiers in this prose body would be misleading either way, so this
|
|
38
|
+
* stays generic. See `SubagentGenerator.client-profiles.ts`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const OMITTED_TOOLS_GUIDANCE = "- Use the tools available on this platform minimally and efficiently";
|
|
41
|
+
/**
|
|
42
|
+
* Generate CLAUDE.md integration snippet
|
|
43
|
+
*
|
|
44
|
+
* NOTE (SMI-6276): deliberately NOT client-parameterized — CLAUDE.md is
|
|
45
|
+
* inherently a Claude Code artifact regardless of which client the
|
|
46
|
+
* companion-agent FILE itself targets, so this always describes the
|
|
47
|
+
* Claude-side delegation recommendation. Out of this wave's scope; see
|
|
48
|
+
* `SubagentGenerator.client-profiles.ts`'s header for what IS in scope.
|
|
49
|
+
*/
|
|
50
|
+
export declare function generateClaudeMdSnippet(skillName: string, description: string, triggerPhrases: string[], tools: string[], model: ClaudeModel): string;
|
|
51
|
+
/**
|
|
52
|
+
* Extract trigger phrases from skill description and content
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractTriggerPhrases(description: string, content: string): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Determine optimal model for subagent
|
|
57
|
+
* SMI-1795: Uses CLAUDE_MODELS constants for type safety
|
|
58
|
+
*/
|
|
59
|
+
export declare function determineModel(toolUsage: ToolUsageAnalysis, lineCount: number): ClaudeModel;
|
|
60
|
+
/**
|
|
61
|
+
* Detect tools needed from skill content
|
|
62
|
+
*/
|
|
63
|
+
export declare function detectTools(content: string): string[];
|
|
64
|
+
//# sourceMappingURL=SubagentGenerator.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubagentGenerator.helpers.d.ts","sourceRoot":"","sources":["../../../src/services/SubagentGenerator.helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAE9E;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAoDlF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,UAAW,CAAA;AAElC;;GAEG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CA6B9D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,yEACqC,CAAA;AAExE;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EAAE,EACxB,KAAK,EAAE,MAAM,EAAE,EACf,KAAK,EAAE,WAAW,GACjB,MAAM,CA0BR;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAwDpF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CAgB3F;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAcrD"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SMI-1788: Pure helper functions for SubagentGenerator — tool detection,
|
|
3
|
+
* trigger-phrase extraction, model selection, and Claude-tool-named
|
|
4
|
+
* guidance text. Split out under the 500-line standard (SMI-6276) following
|
|
5
|
+
* this directory's existing `.helpers.ts` convention (see
|
|
6
|
+
* SkillAnalyzer.helpers.ts / SkillDecomposer.helpers.ts).
|
|
7
|
+
*/
|
|
8
|
+
import { CLAUDE_MODELS } from './SubagentGenerator.types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Tool detection patterns for analyzing skill content
|
|
11
|
+
*/
|
|
12
|
+
export const TOOL_PATTERNS = {
|
|
13
|
+
Read: {
|
|
14
|
+
patterns: ['read file', 'read the', 'examine', 'view file', 'Read tool', 'check file'],
|
|
15
|
+
priority: 1,
|
|
16
|
+
},
|
|
17
|
+
Write: {
|
|
18
|
+
patterns: ['write file', 'create file', 'save to', 'output to', 'Write tool', 'generate file'],
|
|
19
|
+
priority: 2,
|
|
20
|
+
},
|
|
21
|
+
Edit: {
|
|
22
|
+
patterns: [
|
|
23
|
+
'edit file',
|
|
24
|
+
'modify',
|
|
25
|
+
'update file',
|
|
26
|
+
'patch',
|
|
27
|
+
'Edit tool',
|
|
28
|
+
'change file',
|
|
29
|
+
'refactor',
|
|
30
|
+
],
|
|
31
|
+
priority: 2,
|
|
32
|
+
},
|
|
33
|
+
Bash: {
|
|
34
|
+
patterns: [
|
|
35
|
+
'bash',
|
|
36
|
+
'npm',
|
|
37
|
+
'npx',
|
|
38
|
+
'git',
|
|
39
|
+
'docker',
|
|
40
|
+
'yarn',
|
|
41
|
+
'pnpm',
|
|
42
|
+
'terminal',
|
|
43
|
+
'shell',
|
|
44
|
+
'command',
|
|
45
|
+
],
|
|
46
|
+
priority: 3,
|
|
47
|
+
},
|
|
48
|
+
Grep: {
|
|
49
|
+
patterns: ['grep', 'search for', 'find text', 'pattern match', 'Grep tool', 'search in'],
|
|
50
|
+
priority: 1,
|
|
51
|
+
},
|
|
52
|
+
Glob: {
|
|
53
|
+
patterns: ['glob', 'find file', 'file pattern', 'list files', 'Glob tool', 'locate'],
|
|
54
|
+
priority: 1,
|
|
55
|
+
},
|
|
56
|
+
WebFetch: {
|
|
57
|
+
patterns: ['fetch', 'http', 'api call', 'url', 'WebFetch', 'download', 'request'],
|
|
58
|
+
priority: 2,
|
|
59
|
+
},
|
|
60
|
+
WebSearch: {
|
|
61
|
+
patterns: ['web search', 'search online', 'lookup online', 'WebSearch', 'search the web'],
|
|
62
|
+
priority: 2,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Minimum tools that most subagents need
|
|
67
|
+
*/
|
|
68
|
+
export const BASE_TOOLS = ['Read'];
|
|
69
|
+
/**
|
|
70
|
+
* SMI-1819: Maximum length for subagent names to prevent overly long identifiers
|
|
71
|
+
*/
|
|
72
|
+
export const MAX_SUBAGENT_NAME_LENGTH = 100;
|
|
73
|
+
/**
|
|
74
|
+
* Generate tool usage guidelines for a subagent (Claude-named tools).
|
|
75
|
+
* Only used for clients whose `toolsPolicy` is `'claude-native'` — see
|
|
76
|
+
* `SubagentGenerator.client-profiles.ts` and `OMITTED_TOOLS_GUIDANCE`.
|
|
77
|
+
*/
|
|
78
|
+
export function generateToolGuidelines(tools) {
|
|
79
|
+
const guidelines = [];
|
|
80
|
+
if (tools.includes('Read')) {
|
|
81
|
+
guidelines.push('- **Read**: Use to examine files before modifications');
|
|
82
|
+
}
|
|
83
|
+
if (tools.includes('Write')) {
|
|
84
|
+
guidelines.push('- **Write**: Use for creating new files only');
|
|
85
|
+
}
|
|
86
|
+
if (tools.includes('Edit')) {
|
|
87
|
+
guidelines.push('- **Edit**: Use for modifying existing files');
|
|
88
|
+
}
|
|
89
|
+
if (tools.includes('Bash')) {
|
|
90
|
+
guidelines.push('- **Bash**: Use for command execution, prefer non-destructive commands');
|
|
91
|
+
}
|
|
92
|
+
if (tools.includes('Grep')) {
|
|
93
|
+
guidelines.push('- **Grep**: Use for searching file contents');
|
|
94
|
+
}
|
|
95
|
+
if (tools.includes('Glob')) {
|
|
96
|
+
guidelines.push('- **Glob**: Use for finding files by pattern');
|
|
97
|
+
}
|
|
98
|
+
if (tools.includes('WebFetch')) {
|
|
99
|
+
guidelines.push('- **WebFetch**: Use for fetching web content');
|
|
100
|
+
}
|
|
101
|
+
if (tools.includes('WebSearch')) {
|
|
102
|
+
guidelines.push('- **WebSearch**: Use for searching the web');
|
|
103
|
+
}
|
|
104
|
+
return guidelines.length > 0 ? guidelines.join('\n') : '- Use tools minimally and efficiently';
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* SMI-6276: fallback tool-usage guidance for any client whose companion
|
|
108
|
+
* subagent file does not carry Claude-named tools in its `tools:`
|
|
109
|
+
* frontmatter — either because the field is omitted entirely, or because it
|
|
110
|
+
* was translated into that client's OWN vocabulary (`mapped-array`, e.g.
|
|
111
|
+
* AntiGravity's `view_file`/`run_command`). Naming Claude-specific tool
|
|
112
|
+
* identifiers in this prose body would be misleading either way, so this
|
|
113
|
+
* stays generic. See `SubagentGenerator.client-profiles.ts`.
|
|
114
|
+
*/
|
|
115
|
+
export const OMITTED_TOOLS_GUIDANCE = '- Use the tools available on this platform minimally and efficiently';
|
|
116
|
+
/**
|
|
117
|
+
* Generate CLAUDE.md integration snippet
|
|
118
|
+
*
|
|
119
|
+
* NOTE (SMI-6276): deliberately NOT client-parameterized — CLAUDE.md is
|
|
120
|
+
* inherently a Claude Code artifact regardless of which client the
|
|
121
|
+
* companion-agent FILE itself targets, so this always describes the
|
|
122
|
+
* Claude-side delegation recommendation. Out of this wave's scope; see
|
|
123
|
+
* `SubagentGenerator.client-profiles.ts`'s header for what IS in scope.
|
|
124
|
+
*/
|
|
125
|
+
export function generateClaudeMdSnippet(skillName, description, triggerPhrases, tools, model) {
|
|
126
|
+
const triggerPatterns = triggerPhrases.length > 0
|
|
127
|
+
? triggerPhrases.map((p) => `- "${p}"`).join('\n')
|
|
128
|
+
: '- [add trigger patterns]';
|
|
129
|
+
const exampleTask = triggerPhrases.length > 0 ? triggerPhrases[0] : `execute ${skillName} task`;
|
|
130
|
+
return `
|
|
131
|
+
### Subagent Delegation: ${skillName}
|
|
132
|
+
|
|
133
|
+
When tasks match ${skillName} triggers, delegate to the ${skillName}-specialist
|
|
134
|
+
subagent instead of executing directly. This provides context isolation and
|
|
135
|
+
~37-97% token savings.
|
|
136
|
+
|
|
137
|
+
**Trigger Patterns:**
|
|
138
|
+
${triggerPatterns}
|
|
139
|
+
|
|
140
|
+
**Delegation Example:**
|
|
141
|
+
\`\`\`
|
|
142
|
+
Task("${skillName}-specialist", "${exampleTask}", "${skillName}-specialist")
|
|
143
|
+
\`\`\`
|
|
144
|
+
|
|
145
|
+
**Model:** ${model}
|
|
146
|
+
**Tools:** ${tools.join(', ')}
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Extract trigger phrases from skill description and content
|
|
151
|
+
*/
|
|
152
|
+
export function extractTriggerPhrases(description, content) {
|
|
153
|
+
const phrases = [];
|
|
154
|
+
// Common trigger phrase patterns. CodeQL finding (SMI-6276, polynomial
|
|
155
|
+
// regex / ReDoS): the original patterns paired an optional word group
|
|
156
|
+
// (e.g. `(?:you\s+)?`) directly against a lazy wildcard capture
|
|
157
|
+
// (`(.+?)`) — since `.` also matches the letters/spaces the optional
|
|
158
|
+
// group matches, the engine has exponentially many ways to split
|
|
159
|
+
// ambiguous input (long runs of repeated words/spaces) between "the
|
|
160
|
+
// optional group matched" and "the wildcard consumed it instead".
|
|
161
|
+
// `textToSearch` includes up to 2000 chars of externally-authored
|
|
162
|
+
// SKILL.md content (a real untrusted-input path in a skill registry).
|
|
163
|
+
// Fix: bound each capture group to a small fixed max length instead of
|
|
164
|
+
// an unbounded lazy wildcard — extracted phrases are truncated to <=50
|
|
165
|
+
// chars a few lines below regardless, so this changes no real-world
|
|
166
|
+
// behavior, but caps worst-case backtracking work to a small constant
|
|
167
|
+
// instead of growing with input length.
|
|
168
|
+
const MAX_CANDIDATE_PHRASE_LENGTH = 60;
|
|
169
|
+
const patterns = [
|
|
170
|
+
new RegExp(`when\\s+(?:you\\s+)?(?:need\\s+to\\s+)?([^.,]{1,${MAX_CANDIDATE_PHRASE_LENGTH}})(?:[.,]|$)`, 'gi'),
|
|
171
|
+
new RegExp(`use\\s+(?:this\\s+)?(?:when|for)\\s+([^.,]{1,${MAX_CANDIDATE_PHRASE_LENGTH}})(?:[.,]|$)`, 'gi'),
|
|
172
|
+
new RegExp(`(?:helps?\\s+(?:you\\s+)?(?:to\\s+)?)?([^\\n]{1,${MAX_CANDIDATE_PHRASE_LENGTH}}?)(?:\\s+tasks?|\\s+operations?)`, 'gi'),
|
|
173
|
+
];
|
|
174
|
+
const textToSearch = description + ' ' + content.slice(0, 2000); // Search first 2000 chars
|
|
175
|
+
for (const pattern of patterns) {
|
|
176
|
+
for (const match of textToSearch.matchAll(pattern)) {
|
|
177
|
+
const phrase = match[1].trim().toLowerCase();
|
|
178
|
+
if (phrase.length >= 5 && phrase.length <= 50 && !phrases.includes(phrase)) {
|
|
179
|
+
phrases.push(phrase);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// Extract from "trigger" or "invoke" mentions
|
|
184
|
+
const triggerMatch = content.match(/trigger[s]?\s*[:=]\s*["`']([^"`']+)["`']/gi);
|
|
185
|
+
if (triggerMatch) {
|
|
186
|
+
for (const match of triggerMatch) {
|
|
187
|
+
const phrase = match.replace(/trigger[s]?\s*[:=]\s*["`']/i, '').replace(/["`']$/, '');
|
|
188
|
+
if (!phrases.includes(phrase.toLowerCase())) {
|
|
189
|
+
phrases.push(phrase.toLowerCase());
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return phrases.slice(0, 5); // Limit to 5 phrases
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Determine optimal model for subagent
|
|
197
|
+
* SMI-1795: Uses CLAUDE_MODELS constants for type safety
|
|
198
|
+
*/
|
|
199
|
+
export function determineModel(toolUsage, lineCount) {
|
|
200
|
+
// Haiku for simple, fast operations
|
|
201
|
+
if (toolUsage.detectedTools.length <= 2 && lineCount < 200) {
|
|
202
|
+
return CLAUDE_MODELS.HAIKU;
|
|
203
|
+
}
|
|
204
|
+
// Opus for complex, reasoning-heavy tasks
|
|
205
|
+
if (toolUsage.bashCommandCount > 5 ||
|
|
206
|
+
(toolUsage.fileReadCount > 3 && toolUsage.fileWriteCount > 3)) {
|
|
207
|
+
return CLAUDE_MODELS.OPUS;
|
|
208
|
+
}
|
|
209
|
+
// Sonnet for balanced workloads (default)
|
|
210
|
+
return CLAUDE_MODELS.SONNET;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Detect tools needed from skill content
|
|
214
|
+
*/
|
|
215
|
+
export function detectTools(content) {
|
|
216
|
+
const lowerContent = content.toLowerCase();
|
|
217
|
+
const detectedTools = new Set(BASE_TOOLS);
|
|
218
|
+
for (const [tool, config] of Object.entries(TOOL_PATTERNS)) {
|
|
219
|
+
for (const pattern of config.patterns) {
|
|
220
|
+
if (lowerContent.includes(pattern.toLowerCase())) {
|
|
221
|
+
detectedTools.add(tool);
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return Array.from(detectedTools);
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=SubagentGenerator.helpers.js.map
|