@contractspec/bundle.workspace 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/_virtual/rolldown_runtime.js +36 -0
- package/dist/adapters/ai.d.ts +12 -0
- package/dist/adapters/ai.d.ts.map +1 -0
- package/dist/adapters/ai.js +83 -0
- package/dist/adapters/ai.js.map +1 -0
- package/dist/adapters/factory.d.ts +29 -0
- package/dist/adapters/factory.d.ts.map +1 -0
- package/dist/adapters/factory.js +37 -0
- package/dist/adapters/factory.js.map +1 -0
- package/dist/adapters/fs.d.ts +11 -0
- package/dist/adapters/fs.d.ts.map +1 -0
- package/dist/adapters/fs.js +131 -0
- package/dist/adapters/fs.js.map +1 -0
- package/dist/adapters/git.d.ts +11 -0
- package/dist/adapters/git.d.ts.map +1 -0
- package/dist/adapters/git.js +55 -0
- package/dist/adapters/git.js.map +1 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/index.js +7 -0
- package/dist/adapters/logger.d.ts +18 -0
- package/dist/adapters/logger.d.ts.map +1 -0
- package/dist/adapters/logger.js +81 -0
- package/dist/adapters/logger.js.map +1 -0
- package/dist/adapters/watcher.d.ts +11 -0
- package/dist/adapters/watcher.d.ts.map +1 -0
- package/dist/adapters/watcher.js +74 -0
- package/dist/adapters/watcher.js.map +1 -0
- package/dist/adapters/workspace.d.ts +148 -0
- package/dist/adapters/workspace.d.ts.map +1 -0
- package/dist/adapters/workspace.js +275 -0
- package/dist/adapters/workspace.js.map +1 -0
- package/dist/ai/agents/claude-code-agent.d.ts +22 -0
- package/dist/ai/agents/claude-code-agent.d.ts.map +1 -0
- package/dist/ai/agents/claude-code-agent.js +182 -0
- package/dist/ai/agents/claude-code-agent.js.map +1 -0
- package/dist/ai/agents/cursor-agent.d.ts +68 -0
- package/dist/ai/agents/cursor-agent.d.ts.map +1 -0
- package/dist/ai/agents/cursor-agent.js +436 -0
- package/dist/ai/agents/cursor-agent.js.map +1 -0
- package/dist/ai/agents/index.js +5 -0
- package/dist/ai/agents/openai-codex-agent.d.ts +22 -0
- package/dist/ai/agents/openai-codex-agent.d.ts.map +1 -0
- package/dist/ai/agents/openai-codex-agent.js +167 -0
- package/dist/ai/agents/openai-codex-agent.js.map +1 -0
- package/dist/ai/agents/orchestrator.d.ts +50 -0
- package/dist/ai/agents/orchestrator.d.ts.map +1 -0
- package/dist/ai/agents/orchestrator.js +143 -0
- package/dist/ai/agents/orchestrator.js.map +1 -0
- package/dist/ai/agents/simple-agent.d.ts +17 -0
- package/dist/ai/agents/simple-agent.d.ts.map +1 -0
- package/dist/ai/agents/simple-agent.js +92 -0
- package/dist/ai/agents/simple-agent.js.map +1 -0
- package/dist/ai/agents/types.d.ts +36 -0
- package/dist/ai/agents/types.d.ts.map +1 -0
- package/dist/ai/client.d.ts +83 -0
- package/dist/ai/client.d.ts.map +1 -0
- package/dist/ai/client.js +163 -0
- package/dist/ai/client.js.map +1 -0
- package/dist/ai/index.d.ts +17 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +28 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/prompts/code-generation.d.ts +26 -0
- package/dist/ai/prompts/code-generation.d.ts.map +1 -0
- package/dist/ai/prompts/code-generation.js +143 -0
- package/dist/ai/prompts/code-generation.js.map +1 -0
- package/dist/ai/prompts/index.d.ts +10 -0
- package/dist/ai/prompts/index.d.ts.map +1 -0
- package/dist/ai/prompts/index.js +13 -0
- package/dist/ai/prompts/index.js.map +1 -0
- package/dist/ai/prompts/spec-creation.d.ts +29 -0
- package/dist/ai/prompts/spec-creation.d.ts.map +1 -0
- package/dist/ai/prompts/spec-creation.js +111 -0
- package/dist/ai/prompts/spec-creation.js.map +1 -0
- package/dist/ai/providers.d.ts +29 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +39 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/formatters/index.d.ts +11 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +19 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/json.d.ts +89 -0
- package/dist/formatters/json.d.ts.map +1 -0
- package/dist/formatters/json.js +72 -0
- package/dist/formatters/json.js.map +1 -0
- package/dist/formatters/sarif.d.ts +101 -0
- package/dist/formatters/sarif.d.ts.map +1 -0
- package/dist/formatters/sarif.js +163 -0
- package/dist/formatters/sarif.js.map +1 -0
- package/dist/formatters/text.d.ts +35 -0
- package/dist/formatters/text.d.ts.map +1 -0
- package/dist/formatters/text.js +209 -0
- package/dist/formatters/text.js.map +1 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +204 -0
- package/dist/index.js.map +1 -0
- package/dist/ports/ai.d.ts +59 -0
- package/dist/ports/ai.d.ts.map +1 -0
- package/dist/ports/fs.d.ts +81 -0
- package/dist/ports/fs.d.ts.map +1 -0
- package/dist/ports/git.d.ts +33 -0
- package/dist/ports/git.d.ts.map +1 -0
- package/dist/ports/index.d.ts +5 -0
- package/dist/ports/logger.d.ts +88 -0
- package/dist/ports/logger.d.ts.map +1 -0
- package/dist/ports/watcher.d.ts +52 -0
- package/dist/ports/watcher.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/claude-code.d.ts +35 -0
- package/dist/services/agent-guide/adapters/claude-code.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/claude-code.js +144 -0
- package/dist/services/agent-guide/adapters/claude-code.js.map +1 -0
- package/dist/services/agent-guide/adapters/cursor-cli.d.ts +39 -0
- package/dist/services/agent-guide/adapters/cursor-cli.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/cursor-cli.js +135 -0
- package/dist/services/agent-guide/adapters/cursor-cli.js.map +1 -0
- package/dist/services/agent-guide/adapters/generic-mcp.d.ts +53 -0
- package/dist/services/agent-guide/adapters/generic-mcp.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/generic-mcp.js +159 -0
- package/dist/services/agent-guide/adapters/generic-mcp.js.map +1 -0
- package/dist/services/agent-guide/adapters/index.d.ts +23 -0
- package/dist/services/agent-guide/adapters/index.d.ts.map +1 -0
- package/dist/services/agent-guide/adapters/index.js +31 -0
- package/dist/services/agent-guide/adapters/index.js.map +1 -0
- package/dist/services/agent-guide/agent-guide-service.d.ts +56 -0
- package/dist/services/agent-guide/agent-guide-service.d.ts.map +1 -0
- package/dist/services/agent-guide/agent-guide-service.js +147 -0
- package/dist/services/agent-guide/agent-guide-service.js.map +1 -0
- package/dist/services/agent-guide/index.d.ts +6 -0
- package/dist/services/agent-guide/index.js +5 -0
- package/dist/services/agent-guide/types.d.ts +58 -0
- package/dist/services/agent-guide/types.d.ts.map +1 -0
- package/dist/services/build.d.ts +59 -0
- package/dist/services/build.d.ts.map +1 -0
- package/dist/services/build.js +140 -0
- package/dist/services/build.js.map +1 -0
- package/dist/services/ci-check/ci-check-service.d.ts +16 -0
- package/dist/services/ci-check/ci-check-service.d.ts.map +1 -0
- package/dist/services/ci-check/ci-check-service.js +392 -0
- package/dist/services/ci-check/ci-check-service.js.map +1 -0
- package/dist/services/ci-check/index.d.ts +2 -0
- package/dist/services/ci-check/index.js +2 -0
- package/dist/services/ci-check/types.d.ts +143 -0
- package/dist/services/ci-check/types.d.ts.map +1 -0
- package/dist/services/ci-check/types.js +29 -0
- package/dist/services/ci-check/types.js.map +1 -0
- package/dist/services/clean.d.ts +41 -0
- package/dist/services/clean.d.ts.map +1 -0
- package/dist/services/clean.js +72 -0
- package/dist/services/clean.js.map +1 -0
- package/dist/services/config.d.ts +26 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +77 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/deps.d.ts +53 -0
- package/dist/services/deps.d.ts.map +1 -0
- package/dist/services/deps.js +62 -0
- package/dist/services/deps.js.map +1 -0
- package/dist/services/diff.d.ts +34 -0
- package/dist/services/diff.d.ts.map +1 -0
- package/dist/services/diff.js +34 -0
- package/dist/services/diff.js.map +1 -0
- package/dist/services/doctor/checks/ai.js +119 -0
- package/dist/services/doctor/checks/ai.js.map +1 -0
- package/dist/services/doctor/checks/cli.js +147 -0
- package/dist/services/doctor/checks/cli.js.map +1 -0
- package/dist/services/doctor/checks/config.js +171 -0
- package/dist/services/doctor/checks/config.js.map +1 -0
- package/dist/services/doctor/checks/deps.js +247 -0
- package/dist/services/doctor/checks/deps.js.map +1 -0
- package/dist/services/doctor/checks/index.js +6 -0
- package/dist/services/doctor/checks/mcp.js +145 -0
- package/dist/services/doctor/checks/mcp.js.map +1 -0
- package/dist/services/doctor/checks/workspace.js +244 -0
- package/dist/services/doctor/checks/workspace.js.map +1 -0
- package/dist/services/doctor/doctor-service.d.ts +24 -0
- package/dist/services/doctor/doctor-service.d.ts.map +1 -0
- package/dist/services/doctor/doctor-service.js +116 -0
- package/dist/services/doctor/doctor-service.js.map +1 -0
- package/dist/services/doctor/index.d.ts +2 -0
- package/dist/services/doctor/index.js +2 -0
- package/dist/services/doctor/types.d.ts +118 -0
- package/dist/services/doctor/types.d.ts.map +1 -0
- package/dist/services/doctor/types.js +27 -0
- package/dist/services/doctor/types.js.map +1 -0
- package/dist/services/impact/formatters.d.ts +27 -0
- package/dist/services/impact/formatters.d.ts.map +1 -0
- package/dist/services/impact/formatters.js +111 -0
- package/dist/services/impact/formatters.js.map +1 -0
- package/dist/services/impact/impact-detection-service.d.ts +22 -0
- package/dist/services/impact/impact-detection-service.d.ts.map +1 -0
- package/dist/services/impact/impact-detection-service.js +96 -0
- package/dist/services/impact/impact-detection-service.js.map +1 -0
- package/dist/services/impact/index.d.ts +11 -0
- package/dist/services/impact/index.d.ts.map +1 -0
- package/dist/services/impact/index.js +16 -0
- package/dist/services/impact/index.js.map +1 -0
- package/dist/services/impact/types.d.ts +58 -0
- package/dist/services/impact/types.d.ts.map +1 -0
- package/dist/services/implementation/discovery.d.ts +30 -0
- package/dist/services/implementation/discovery.d.ts.map +1 -0
- package/dist/services/implementation/discovery.js +144 -0
- package/dist/services/implementation/discovery.js.map +1 -0
- package/dist/services/implementation/index.d.ts +3 -0
- package/dist/services/implementation/index.js +2 -0
- package/dist/services/implementation/resolver.d.ts +44 -0
- package/dist/services/implementation/resolver.d.ts.map +1 -0
- package/dist/services/implementation/resolver.js +224 -0
- package/dist/services/implementation/resolver.js.map +1 -0
- package/dist/services/implementation/types.d.ts +79 -0
- package/dist/services/implementation/types.d.ts.map +1 -0
- package/dist/services/index.d.ts +60 -0
- package/dist/services/index.js +57 -0
- package/dist/services/integrity-diagram.d.ts +36 -0
- package/dist/services/integrity-diagram.d.ts.map +1 -0
- package/dist/services/integrity-diagram.js +275 -0
- package/dist/services/integrity-diagram.js.map +1 -0
- package/dist/services/integrity.d.ts +134 -0
- package/dist/services/integrity.d.ts.map +1 -0
- package/dist/services/integrity.js +272 -0
- package/dist/services/integrity.js.map +1 -0
- package/dist/services/list.d.ts +31 -0
- package/dist/services/list.d.ts.map +1 -0
- package/dist/services/list.js +36 -0
- package/dist/services/list.js.map +1 -0
- package/dist/services/openapi/export-service.d.ts +53 -0
- package/dist/services/openapi/export-service.d.ts.map +1 -0
- package/dist/services/openapi/export-service.js +50 -0
- package/dist/services/openapi/export-service.js.map +1 -0
- package/dist/services/openapi/import-service.d.ts +17 -0
- package/dist/services/openapi/import-service.d.ts.map +1 -0
- package/dist/services/openapi/import-service.js +74 -0
- package/dist/services/openapi/import-service.js.map +1 -0
- package/dist/services/openapi/index.d.ts +5 -0
- package/dist/services/openapi/index.js +4 -0
- package/dist/services/openapi/sync-service.d.ts +17 -0
- package/dist/services/openapi/sync-service.d.ts.map +1 -0
- package/dist/services/openapi/sync-service.js +120 -0
- package/dist/services/openapi/sync-service.js.map +1 -0
- package/dist/services/openapi/types.d.ts +162 -0
- package/dist/services/openapi/types.d.ts.map +1 -0
- package/dist/services/openapi/validate-service.d.ts +16 -0
- package/dist/services/openapi/validate-service.d.ts.map +1 -0
- package/dist/services/openapi/validate-service.js +130 -0
- package/dist/services/openapi/validate-service.js.map +1 -0
- package/dist/services/quickstart/dependencies.d.ts +31 -0
- package/dist/services/quickstart/dependencies.d.ts.map +1 -0
- package/dist/services/quickstart/dependencies.js +57 -0
- package/dist/services/quickstart/dependencies.js.map +1 -0
- package/dist/services/quickstart/index.js +2 -0
- package/dist/services/quickstart/quickstart-service.d.ts +20 -0
- package/dist/services/quickstart/quickstart-service.d.ts.map +1 -0
- package/dist/services/quickstart/quickstart-service.js +196 -0
- package/dist/services/quickstart/quickstart-service.js.map +1 -0
- package/dist/services/quickstart/types.d.ts +81 -0
- package/dist/services/quickstart/types.d.ts.map +1 -0
- package/dist/services/regenerator.d.ts +18 -0
- package/dist/services/regenerator.d.ts.map +1 -0
- package/dist/services/regenerator.js +23 -0
- package/dist/services/regenerator.js.map +1 -0
- package/dist/services/registry.d.ts +53 -0
- package/dist/services/registry.d.ts.map +1 -0
- package/dist/services/registry.js +74 -0
- package/dist/services/registry.js.map +1 -0
- package/dist/services/setup/config-generators.d.ts +42 -0
- package/dist/services/setup/config-generators.d.ts.map +1 -0
- package/dist/services/setup/config-generators.js +238 -0
- package/dist/services/setup/config-generators.js.map +1 -0
- package/dist/services/setup/file-merger.d.ts +27 -0
- package/dist/services/setup/file-merger.d.ts.map +1 -0
- package/dist/services/setup/file-merger.js +61 -0
- package/dist/services/setup/file-merger.js.map +1 -0
- package/dist/services/setup/index.js +4 -0
- package/dist/services/setup/setup-service.d.ts +12 -0
- package/dist/services/setup/setup-service.d.ts.map +1 -0
- package/dist/services/setup/setup-service.js +96 -0
- package/dist/services/setup/setup-service.js.map +1 -0
- package/dist/services/setup/targets/agents-md.js +47 -0
- package/dist/services/setup/targets/agents-md.js.map +1 -0
- package/dist/services/setup/targets/cli-config.js +60 -0
- package/dist/services/setup/targets/cli-config.js.map +1 -0
- package/dist/services/setup/targets/cursor-rules.js +48 -0
- package/dist/services/setup/targets/cursor-rules.js.map +1 -0
- package/dist/services/setup/targets/mcp-claude.js +60 -0
- package/dist/services/setup/targets/mcp-claude.js.map +1 -0
- package/dist/services/setup/targets/mcp-cursor.js +59 -0
- package/dist/services/setup/targets/mcp-cursor.js.map +1 -0
- package/dist/services/setup/targets/vscode-settings.js +63 -0
- package/dist/services/setup/targets/vscode-settings.js.map +1 -0
- package/dist/services/setup/types.d.ts +85 -0
- package/dist/services/setup/types.d.ts.map +1 -0
- package/dist/services/setup/types.js +27 -0
- package/dist/services/setup/types.js.map +1 -0
- package/dist/services/sync.d.ts +41 -0
- package/dist/services/sync.d.ts.map +1 -0
- package/dist/services/sync.js +63 -0
- package/dist/services/sync.js.map +1 -0
- package/dist/services/test.d.ts +15 -0
- package/dist/services/test.d.ts.map +1 -0
- package/dist/services/test.js +30 -0
- package/dist/services/test.js.map +1 -0
- package/dist/services/validate-implementation.d.ts +32 -0
- package/dist/services/validate-implementation.d.ts.map +1 -0
- package/dist/services/validate-implementation.js +64 -0
- package/dist/services/validate-implementation.js.map +1 -0
- package/dist/services/validate.d.ts +41 -0
- package/dist/services/validate.d.ts.map +1 -0
- package/dist/services/validate.js +48 -0
- package/dist/services/validate.js.map +1 -0
- package/dist/services/verification-cache/adapters/filesystem.d.ts +46 -0
- package/dist/services/verification-cache/adapters/filesystem.d.ts.map +1 -0
- package/dist/services/verification-cache/adapters/filesystem.js +120 -0
- package/dist/services/verification-cache/adapters/filesystem.js.map +1 -0
- package/dist/services/verification-cache/adapters/in-memory.d.ts +27 -0
- package/dist/services/verification-cache/adapters/in-memory.d.ts.map +1 -0
- package/dist/services/verification-cache/adapters/in-memory.js +46 -0
- package/dist/services/verification-cache/adapters/in-memory.js.map +1 -0
- package/dist/services/verification-cache/adapters/index.d.ts +3 -0
- package/dist/services/verification-cache/adapters/index.js +3 -0
- package/dist/services/verification-cache/adapters/workspace-state.d.ts +49 -0
- package/dist/services/verification-cache/adapters/workspace-state.d.ts.map +1 -0
- package/dist/services/verification-cache/adapters/workspace-state.js +91 -0
- package/dist/services/verification-cache/adapters/workspace-state.js.map +1 -0
- package/dist/services/verification-cache/cache-service.d.ts +70 -0
- package/dist/services/verification-cache/cache-service.d.ts.map +1 -0
- package/dist/services/verification-cache/cache-service.js +256 -0
- package/dist/services/verification-cache/cache-service.js.map +1 -0
- package/dist/services/verification-cache/index.d.ts +6 -0
- package/dist/services/verification-cache/index.js +6 -0
- package/dist/services/verification-cache/types.d.ts +124 -0
- package/dist/services/verification-cache/types.d.ts.map +1 -0
- package/dist/services/verification-cache/types.js +16 -0
- package/dist/services/verification-cache/types.js.map +1 -0
- package/dist/services/verify/ai-verifier.d.ts +25 -0
- package/dist/services/verify/ai-verifier.d.ts.map +1 -0
- package/dist/services/verify/ai-verifier.js +403 -0
- package/dist/services/verify/ai-verifier.js.map +1 -0
- package/dist/services/verify/behavior-verifier.d.ts +12 -0
- package/dist/services/verify/behavior-verifier.d.ts.map +1 -0
- package/dist/services/verify/behavior-verifier.js +186 -0
- package/dist/services/verify/behavior-verifier.js.map +1 -0
- package/dist/services/verify/index.d.ts +5 -0
- package/dist/services/verify/index.js +4 -0
- package/dist/services/verify/structure-verifier.d.ts +12 -0
- package/dist/services/verify/structure-verifier.d.ts.map +1 -0
- package/dist/services/verify/structure-verifier.js +196 -0
- package/dist/services/verify/structure-verifier.js.map +1 -0
- package/dist/services/verify/types.d.ts +137 -0
- package/dist/services/verify/types.d.ts.map +1 -0
- package/dist/services/verify/verify-service.d.ts +60 -0
- package/dist/services/verify/verify-service.d.ts.map +1 -0
- package/dist/services/verify/verify-service.js +204 -0
- package/dist/services/verify/verify-service.js.map +1 -0
- package/dist/services/watch.d.ts +25 -0
- package/dist/services/watch.d.ts.map +1 -0
- package/dist/services/watch.js +32 -0
- package/dist/services/watch.js.map +1 -0
- package/dist/services/workspace-info.d.ts +62 -0
- package/dist/services/workspace-info.d.ts.map +1 -0
- package/dist/services/workspace-info.js +103 -0
- package/dist/services/workspace-info.js.map +1 -0
- package/dist/templates/app-config.template.d.ts +7 -0
- package/dist/templates/app-config.template.d.ts.map +1 -0
- package/dist/templates/app-config.template.js +107 -0
- package/dist/templates/app-config.template.js.map +1 -0
- package/dist/templates/data-view.template.d.ts +7 -0
- package/dist/templates/data-view.template.d.ts.map +1 -0
- package/dist/templates/data-view.template.js +70 -0
- package/dist/templates/data-view.template.js.map +1 -0
- package/dist/templates/event.template.d.ts +11 -0
- package/dist/templates/event.template.d.ts.map +1 -0
- package/dist/templates/event.template.js +40 -0
- package/dist/templates/event.template.js.map +1 -0
- package/dist/templates/experiment.template.d.ts +7 -0
- package/dist/templates/experiment.template.d.ts.map +1 -0
- package/dist/templates/experiment.template.js +89 -0
- package/dist/templates/experiment.template.js.map +1 -0
- package/dist/templates/handler.template.d.ts +16 -0
- package/dist/templates/handler.template.d.ts.map +1 -0
- package/dist/templates/handler.template.js +100 -0
- package/dist/templates/handler.template.js.map +1 -0
- package/dist/templates/index.d.ts +21 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +37 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/integration.template.d.ts +7 -0
- package/dist/templates/integration.template.d.ts.map +1 -0
- package/dist/templates/integration.template.js +160 -0
- package/dist/templates/integration.template.js.map +1 -0
- package/dist/templates/knowledge.template.d.ts +7 -0
- package/dist/templates/knowledge.template.d.ts.map +1 -0
- package/dist/templates/knowledge.template.js +75 -0
- package/dist/templates/knowledge.template.js.map +1 -0
- package/dist/templates/migration.template.d.ts +7 -0
- package/dist/templates/migration.template.d.ts.map +1 -0
- package/dist/templates/migration.template.js +62 -0
- package/dist/templates/migration.template.js.map +1 -0
- package/dist/templates/operation.template.d.ts +11 -0
- package/dist/templates/operation.template.d.ts.map +1 -0
- package/dist/templates/operation.template.js +105 -0
- package/dist/templates/operation.template.js.map +1 -0
- package/dist/templates/presentation.template.d.ts +11 -0
- package/dist/templates/presentation.template.d.ts.map +1 -0
- package/dist/templates/presentation.template.js +80 -0
- package/dist/templates/presentation.template.js.map +1 -0
- package/dist/templates/telemetry.template.d.ts +7 -0
- package/dist/templates/telemetry.template.d.ts.map +1 -0
- package/dist/templates/telemetry.template.js +91 -0
- package/dist/templates/telemetry.template.js.map +1 -0
- package/dist/templates/workflow-runner.template.d.ts +16 -0
- package/dist/templates/workflow-runner.template.d.ts.map +1 -0
- package/dist/templates/workflow-runner.template.js +50 -0
- package/dist/templates/workflow-runner.template.js.map +1 -0
- package/dist/templates/workflow.template.d.ts +7 -0
- package/dist/templates/workflow.template.d.ts.map +1 -0
- package/dist/templates/workflow.template.js +69 -0
- package/dist/templates/workflow.template.js.map +1 -0
- package/dist/types/config.d.ts +34 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types.d.ts +324 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CacheKeyString, CacheLookupResult, CacheStats, CacheStorageAdapter, VerificationCacheConfig, VerificationCacheKey } from "./types.js";
|
|
2
|
+
import { VerificationReport, VerificationTier } from "@contractspec/lib.contracts/llm";
|
|
3
|
+
|
|
4
|
+
//#region src/services/verification-cache/cache-service.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Compute SHA256 hash of content.
|
|
8
|
+
*/
|
|
9
|
+
declare function computeContentHash(content: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Convert cache key to string for storage.
|
|
12
|
+
*/
|
|
13
|
+
declare function cacheKeyToString(key: VerificationCacheKey): CacheKeyString;
|
|
14
|
+
/**
|
|
15
|
+
* Parse cache key string back to object.
|
|
16
|
+
*/
|
|
17
|
+
declare function stringToCacheKey(str: CacheKeyString): VerificationCacheKey | null;
|
|
18
|
+
/**
|
|
19
|
+
* Verification cache service.
|
|
20
|
+
*/
|
|
21
|
+
declare class VerificationCacheService {
|
|
22
|
+
private storage;
|
|
23
|
+
private config;
|
|
24
|
+
private stats;
|
|
25
|
+
constructor(storage: CacheStorageAdapter, config?: Partial<VerificationCacheConfig>);
|
|
26
|
+
/**
|
|
27
|
+
* Create a cache key from spec and implementation content.
|
|
28
|
+
*/
|
|
29
|
+
createKey(specContent: string, implContent: string, tier: VerificationTier, aiModelVersion?: string): VerificationCacheKey;
|
|
30
|
+
/**
|
|
31
|
+
* Look up a cached verification result.
|
|
32
|
+
*/
|
|
33
|
+
lookup(key: VerificationCacheKey): Promise<CacheLookupResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Store a verification result in cache.
|
|
36
|
+
*/
|
|
37
|
+
store(key: VerificationCacheKey, result: VerificationReport, options?: {
|
|
38
|
+
dependencies?: string[];
|
|
39
|
+
specName?: string;
|
|
40
|
+
implPath?: string;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Invalidate cache entries for a specific file.
|
|
44
|
+
* Used when a file changes to invalidate dependent caches.
|
|
45
|
+
*/
|
|
46
|
+
invalidateForFile(filePath: string): Promise<number>;
|
|
47
|
+
/**
|
|
48
|
+
* Invalidate all cache entries for a specific spec.
|
|
49
|
+
*/
|
|
50
|
+
invalidateForSpec(specHash: string): Promise<number>;
|
|
51
|
+
/**
|
|
52
|
+
* Clear all cache entries.
|
|
53
|
+
*/
|
|
54
|
+
clear(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Get cache statistics.
|
|
57
|
+
*/
|
|
58
|
+
getStats(): Promise<CacheStats>;
|
|
59
|
+
/**
|
|
60
|
+
* Prune cache if over the maximum entry limit.
|
|
61
|
+
*/
|
|
62
|
+
private pruneIfNeeded;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a verification cache service with the given storage adapter.
|
|
66
|
+
*/
|
|
67
|
+
declare function createVerificationCacheService(storage: CacheStorageAdapter, config?: Partial<VerificationCacheConfig>): VerificationCacheService;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { VerificationCacheService, cacheKeyToString, computeContentHash, createVerificationCacheService, stringToCacheKey };
|
|
70
|
+
//# sourceMappingURL=cache-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-service.d.ts","names":[],"sources":["../../../src/services/verification-cache/cache-service.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA6HU,iBAnGM,kBAAA,CAmGN,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;AAciC,iBA1G3B,gBAAA,CA0G2B,GAAA,EA1GL,oBA0GK,CAAA,EA1GkB,cA0GlB;;;;AAiFE,iBA1K7B,gBAAA,CA0K6B,GAAA,EAzKtC,cAyKsC,CAAA,EAxK1C,oBAwK0C,GAAA,IAAA;;;;AA4DzB,cA/KP,wBAAA,CA+KO;EAAO,QAAA,OAAA;EA0DX,QAAA,MAAA;EACL,QAAA,KAAA;EACQ,WAAA,CAAA,OAAA,EArON,mBAqOM,EAAA,MAAA,CAAA,EApOP,OAoOO,CApOC,uBAoOD,CAAA;EAAR;;;4DAvND,4CAEL;;;;cAYe,uBAAuB,QAAQ;;;;aAgD1C,8BACG;;;;MAMP;;;;;uCA0BwC;;;;uCAkCA;;;;WAkB5B;;;;cAQG,QAAQ;;;;;;;;;iBA0DZ,8BAAA,UACL,8BACA,QAAQ,2BAChB"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { DEFAULT_CACHE_CONFIG } from "./types.js";
|
|
2
|
+
import { createHash } from "crypto";
|
|
3
|
+
|
|
4
|
+
//#region src/services/verification-cache/cache-service.ts
|
|
5
|
+
/**
|
|
6
|
+
* Verification cache service.
|
|
7
|
+
*
|
|
8
|
+
* Provides content-hash based caching for verification results
|
|
9
|
+
* to avoid redundant checks and reduce AI costs.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Compute SHA256 hash of content.
|
|
13
|
+
*/
|
|
14
|
+
function computeContentHash(content) {
|
|
15
|
+
return createHash("sha256").update(content).digest("hex");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert cache key to string for storage.
|
|
19
|
+
*/
|
|
20
|
+
function cacheKeyToString(key) {
|
|
21
|
+
const parts = [
|
|
22
|
+
`spec:${key.specHash.substring(0, 16)}`,
|
|
23
|
+
`impl:${key.implHash.substring(0, 16)}`,
|
|
24
|
+
`tier:${key.tier}`
|
|
25
|
+
];
|
|
26
|
+
if (key.aiModelVersion) parts.push(`model:${key.aiModelVersion}`);
|
|
27
|
+
return parts.join("|");
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Parse cache key string back to object.
|
|
31
|
+
*/
|
|
32
|
+
function stringToCacheKey(str) {
|
|
33
|
+
try {
|
|
34
|
+
const parts = str.split("|");
|
|
35
|
+
const keyMap = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const part of parts) {
|
|
37
|
+
const [prefix, value] = part.split(":");
|
|
38
|
+
if (prefix && value) keyMap.set(prefix, value);
|
|
39
|
+
}
|
|
40
|
+
const specHash = keyMap.get("spec");
|
|
41
|
+
const implHash = keyMap.get("impl");
|
|
42
|
+
const tier = keyMap.get("tier");
|
|
43
|
+
if (!specHash || !implHash || !tier) return null;
|
|
44
|
+
return {
|
|
45
|
+
specHash,
|
|
46
|
+
implHash,
|
|
47
|
+
tier,
|
|
48
|
+
aiModelVersion: keyMap.get("model")
|
|
49
|
+
};
|
|
50
|
+
} catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get TTL for a specific tier.
|
|
56
|
+
*/
|
|
57
|
+
function getTtlForTier(tier, config) {
|
|
58
|
+
switch (tier) {
|
|
59
|
+
case "structure": return config.structureTtlMs;
|
|
60
|
+
case "behavior": return config.behaviorTtlMs;
|
|
61
|
+
case "ai_review": return config.aiTtlMs;
|
|
62
|
+
default: return config.defaultTtlMs;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Verification cache service.
|
|
67
|
+
*/
|
|
68
|
+
var VerificationCacheService = class {
|
|
69
|
+
storage;
|
|
70
|
+
config;
|
|
71
|
+
stats;
|
|
72
|
+
constructor(storage, config = {}) {
|
|
73
|
+
this.storage = storage;
|
|
74
|
+
this.config = {
|
|
75
|
+
...DEFAULT_CACHE_CONFIG,
|
|
76
|
+
...config
|
|
77
|
+
};
|
|
78
|
+
this.stats = {
|
|
79
|
+
hits: 0,
|
|
80
|
+
misses: 0
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create a cache key from spec and implementation content.
|
|
85
|
+
*/
|
|
86
|
+
createKey(specContent, implContent, tier, aiModelVersion) {
|
|
87
|
+
return {
|
|
88
|
+
specHash: computeContentHash(specContent),
|
|
89
|
+
implHash: computeContentHash(implContent),
|
|
90
|
+
tier,
|
|
91
|
+
aiModelVersion: tier === "ai_review" ? aiModelVersion : void 0
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Look up a cached verification result.
|
|
96
|
+
*/
|
|
97
|
+
async lookup(key) {
|
|
98
|
+
const keyStr = cacheKeyToString(key);
|
|
99
|
+
const entry = await this.storage.get(keyStr);
|
|
100
|
+
if (!entry) {
|
|
101
|
+
this.stats.misses++;
|
|
102
|
+
return {
|
|
103
|
+
hit: false,
|
|
104
|
+
reason: "not_found"
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (entry.meta.expiresAt) {
|
|
108
|
+
const expiresAt = new Date(entry.meta.expiresAt).getTime();
|
|
109
|
+
if (Date.now() > expiresAt) {
|
|
110
|
+
this.stats.misses++;
|
|
111
|
+
await this.storage.delete(keyStr);
|
|
112
|
+
return {
|
|
113
|
+
hit: false,
|
|
114
|
+
reason: "expired"
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (entry.key.specHash !== key.specHash) {
|
|
119
|
+
this.stats.misses++;
|
|
120
|
+
return {
|
|
121
|
+
hit: false,
|
|
122
|
+
reason: "spec_changed"
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (entry.key.implHash !== key.implHash) {
|
|
126
|
+
this.stats.misses++;
|
|
127
|
+
return {
|
|
128
|
+
hit: false,
|
|
129
|
+
reason: "impl_changed"
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (key.tier === "ai_review" && key.aiModelVersion && entry.key.aiModelVersion !== key.aiModelVersion) {
|
|
133
|
+
this.stats.misses++;
|
|
134
|
+
return {
|
|
135
|
+
hit: false,
|
|
136
|
+
reason: "model_changed"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
this.stats.hits++;
|
|
140
|
+
return {
|
|
141
|
+
hit: true,
|
|
142
|
+
entry
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Store a verification result in cache.
|
|
147
|
+
*/
|
|
148
|
+
async store(key, result, options = {}) {
|
|
149
|
+
const keyStr = cacheKeyToString(key);
|
|
150
|
+
const ttl = getTtlForTier(key.tier, this.config);
|
|
151
|
+
const entry = {
|
|
152
|
+
key,
|
|
153
|
+
result,
|
|
154
|
+
meta: {
|
|
155
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
156
|
+
expiresAt: new Date(Date.now() + ttl).toISOString(),
|
|
157
|
+
dependencies: options.dependencies ?? [],
|
|
158
|
+
specName: options.specName,
|
|
159
|
+
implPath: options.implPath
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
await this.storage.set(keyStr, entry);
|
|
163
|
+
await this.pruneIfNeeded();
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Invalidate cache entries for a specific file.
|
|
167
|
+
* Used when a file changes to invalidate dependent caches.
|
|
168
|
+
*/
|
|
169
|
+
async invalidateForFile(filePath) {
|
|
170
|
+
if (!this.config.transitiveInvalidation) return 0;
|
|
171
|
+
const keys = await this.storage.keys();
|
|
172
|
+
let invalidated = 0;
|
|
173
|
+
for (const keyStr of keys) {
|
|
174
|
+
const entry = await this.storage.get(keyStr);
|
|
175
|
+
if (!entry) continue;
|
|
176
|
+
if (entry.meta.dependencies.includes(filePath)) {
|
|
177
|
+
await this.storage.delete(keyStr);
|
|
178
|
+
invalidated++;
|
|
179
|
+
}
|
|
180
|
+
if (entry.meta.specName === filePath || entry.meta.implPath === filePath) {
|
|
181
|
+
await this.storage.delete(keyStr);
|
|
182
|
+
invalidated++;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return invalidated;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Invalidate all cache entries for a specific spec.
|
|
189
|
+
*/
|
|
190
|
+
async invalidateForSpec(specHash) {
|
|
191
|
+
const keys = await this.storage.keys();
|
|
192
|
+
let invalidated = 0;
|
|
193
|
+
for (const keyStr of keys) {
|
|
194
|
+
const parsed = stringToCacheKey(keyStr);
|
|
195
|
+
if (parsed && parsed.specHash.startsWith(specHash.substring(0, 16))) {
|
|
196
|
+
await this.storage.delete(keyStr);
|
|
197
|
+
invalidated++;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return invalidated;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Clear all cache entries.
|
|
204
|
+
*/
|
|
205
|
+
async clear() {
|
|
206
|
+
await this.storage.clear();
|
|
207
|
+
this.stats = {
|
|
208
|
+
hits: 0,
|
|
209
|
+
misses: 0
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Get cache statistics.
|
|
214
|
+
*/
|
|
215
|
+
async getStats() {
|
|
216
|
+
const storageStats = await this.storage.stats?.();
|
|
217
|
+
return {
|
|
218
|
+
totalEntries: storageStats?.entryCount ?? (await this.storage.keys()).length,
|
|
219
|
+
hits: this.stats.hits,
|
|
220
|
+
misses: this.stats.misses,
|
|
221
|
+
hitRate: this.stats.hits + this.stats.misses > 0 ? Math.round(this.stats.hits / (this.stats.hits + this.stats.misses) * 100) : 0,
|
|
222
|
+
memoryUsage: storageStats?.memoryUsage
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Prune cache if over the maximum entry limit.
|
|
227
|
+
*/
|
|
228
|
+
async pruneIfNeeded() {
|
|
229
|
+
const keys = await this.storage.keys();
|
|
230
|
+
if (keys.length <= this.config.maxEntries) return;
|
|
231
|
+
const entries = [];
|
|
232
|
+
for (const keyStr of keys) {
|
|
233
|
+
const entry = await this.storage.get(keyStr);
|
|
234
|
+
if (entry) entries.push({
|
|
235
|
+
key: keyStr,
|
|
236
|
+
createdAt: new Date(entry.meta.createdAt).getTime()
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
entries.sort((a, b) => a.createdAt - b.createdAt);
|
|
240
|
+
const toRemove = entries.length - this.config.maxEntries;
|
|
241
|
+
for (let i = 0; i < toRemove; i++) {
|
|
242
|
+
const entry = entries[i];
|
|
243
|
+
if (entry) await this.storage.delete(entry.key);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Create a verification cache service with the given storage adapter.
|
|
249
|
+
*/
|
|
250
|
+
function createVerificationCacheService(storage, config) {
|
|
251
|
+
return new VerificationCacheService(storage, config);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
//#endregion
|
|
255
|
+
export { VerificationCacheService, cacheKeyToString, computeContentHash, createVerificationCacheService, stringToCacheKey };
|
|
256
|
+
//# sourceMappingURL=cache-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-service.js","names":["entry: VerificationCacheEntry","entries: { key: string; createdAt: number }[]"],"sources":["../../../src/services/verification-cache/cache-service.ts"],"sourcesContent":["/**\n * Verification cache service.\n *\n * Provides content-hash based caching for verification results\n * to avoid redundant checks and reduce AI costs.\n */\n\nimport { createHash } from 'crypto';\nimport type {\n VerificationReport,\n VerificationTier,\n} from '@contractspec/lib.contracts/llm';\nimport type {\n CacheKeyString,\n CacheLookupResult,\n CacheStats,\n CacheStorageAdapter,\n VerificationCacheConfig,\n VerificationCacheEntry,\n VerificationCacheKey,\n} from './types';\nimport { DEFAULT_CACHE_CONFIG } from './types';\n\n/**\n * Compute SHA256 hash of content.\n */\nexport function computeContentHash(content: string): string {\n return createHash('sha256').update(content).digest('hex');\n}\n\n/**\n * Convert cache key to string for storage.\n */\nexport function cacheKeyToString(key: VerificationCacheKey): CacheKeyString {\n const parts = [\n `spec:${key.specHash.substring(0, 16)}`,\n `impl:${key.implHash.substring(0, 16)}`,\n `tier:${key.tier}`,\n ];\n\n if (key.aiModelVersion) {\n parts.push(`model:${key.aiModelVersion}`);\n }\n\n return parts.join('|');\n}\n\n/**\n * Parse cache key string back to object.\n */\nexport function stringToCacheKey(\n str: CacheKeyString\n): VerificationCacheKey | null {\n try {\n const parts = str.split('|');\n const keyMap = new Map<string, string>();\n\n for (const part of parts) {\n const [prefix, value] = part.split(':');\n if (prefix && value) {\n keyMap.set(prefix, value);\n }\n }\n\n const specHash = keyMap.get('spec');\n const implHash = keyMap.get('impl');\n const tier = keyMap.get('tier') as VerificationTier;\n\n if (!specHash || !implHash || !tier) {\n return null;\n }\n\n return {\n specHash,\n implHash,\n tier,\n aiModelVersion: keyMap.get('model'),\n };\n } catch {\n return null;\n }\n}\n\n/**\n * Get TTL for a specific tier.\n */\nfunction getTtlForTier(\n tier: VerificationTier,\n config: Required<VerificationCacheConfig>\n): number {\n switch (tier) {\n case 'structure':\n return config.structureTtlMs;\n case 'behavior':\n return config.behaviorTtlMs;\n case 'ai_review':\n return config.aiTtlMs;\n default:\n return config.defaultTtlMs;\n }\n}\n\n/**\n * Verification cache service.\n */\nexport class VerificationCacheService {\n private storage: CacheStorageAdapter;\n private config: Required<VerificationCacheConfig>;\n private stats: { hits: number; misses: number };\n\n constructor(\n storage: CacheStorageAdapter,\n config: Partial<VerificationCacheConfig> = {}\n ) {\n this.storage = storage;\n this.config = { ...DEFAULT_CACHE_CONFIG, ...config };\n this.stats = { hits: 0, misses: 0 };\n }\n\n /**\n * Create a cache key from spec and implementation content.\n */\n createKey(\n specContent: string,\n implContent: string,\n tier: VerificationTier,\n aiModelVersion?: string\n ): VerificationCacheKey {\n return {\n specHash: computeContentHash(specContent),\n implHash: computeContentHash(implContent),\n tier,\n aiModelVersion: tier === 'ai_review' ? aiModelVersion : undefined,\n };\n }\n\n /**\n * Look up a cached verification result.\n */\n async lookup(key: VerificationCacheKey): Promise<CacheLookupResult> {\n const keyStr = cacheKeyToString(key);\n const entry = await this.storage.get(keyStr);\n\n if (!entry) {\n this.stats.misses++;\n return { hit: false, reason: 'not_found' };\n }\n\n // Check expiration\n if (entry.meta.expiresAt) {\n const expiresAt = new Date(entry.meta.expiresAt).getTime();\n if (Date.now() > expiresAt) {\n this.stats.misses++;\n await this.storage.delete(keyStr);\n return { hit: false, reason: 'expired' };\n }\n }\n\n // Validate hashes still match\n if (entry.key.specHash !== key.specHash) {\n this.stats.misses++;\n return { hit: false, reason: 'spec_changed' };\n }\n\n if (entry.key.implHash !== key.implHash) {\n this.stats.misses++;\n return { hit: false, reason: 'impl_changed' };\n }\n\n // For AI tier, check model version\n if (\n key.tier === 'ai_review' &&\n key.aiModelVersion &&\n entry.key.aiModelVersion !== key.aiModelVersion\n ) {\n this.stats.misses++;\n return { hit: false, reason: 'model_changed' };\n }\n\n this.stats.hits++;\n return { hit: true, entry };\n }\n\n /**\n * Store a verification result in cache.\n */\n async store(\n key: VerificationCacheKey,\n result: VerificationReport,\n options: {\n dependencies?: string[];\n specName?: string;\n implPath?: string;\n } = {}\n ): Promise<void> {\n const keyStr = cacheKeyToString(key);\n const ttl = getTtlForTier(key.tier, this.config);\n\n const entry: VerificationCacheEntry = {\n key,\n result,\n meta: {\n createdAt: new Date().toISOString(),\n expiresAt: new Date(Date.now() + ttl).toISOString(),\n dependencies: options.dependencies ?? [],\n specName: options.specName,\n implPath: options.implPath,\n },\n };\n\n await this.storage.set(keyStr, entry);\n\n // Prune if over limit\n await this.pruneIfNeeded();\n }\n\n /**\n * Invalidate cache entries for a specific file.\n * Used when a file changes to invalidate dependent caches.\n */\n async invalidateForFile(filePath: string): Promise<number> {\n if (!this.config.transitiveInvalidation) {\n return 0;\n }\n\n const keys = await this.storage.keys();\n let invalidated = 0;\n\n for (const keyStr of keys) {\n const entry = await this.storage.get(keyStr);\n if (!entry) continue;\n\n // Check if this file is in dependencies\n if (entry.meta.dependencies.includes(filePath)) {\n await this.storage.delete(keyStr);\n invalidated++;\n }\n\n // Check if file matches spec or impl path\n if (\n entry.meta.specName === filePath ||\n entry.meta.implPath === filePath\n ) {\n await this.storage.delete(keyStr);\n invalidated++;\n }\n }\n\n return invalidated;\n }\n\n /**\n * Invalidate all cache entries for a specific spec.\n */\n async invalidateForSpec(specHash: string): Promise<number> {\n const keys = await this.storage.keys();\n let invalidated = 0;\n\n for (const keyStr of keys) {\n const parsed = stringToCacheKey(keyStr);\n if (parsed && parsed.specHash.startsWith(specHash.substring(0, 16))) {\n await this.storage.delete(keyStr);\n invalidated++;\n }\n }\n\n return invalidated;\n }\n\n /**\n * Clear all cache entries.\n */\n async clear(): Promise<void> {\n await this.storage.clear();\n this.stats = { hits: 0, misses: 0 };\n }\n\n /**\n * Get cache statistics.\n */\n async getStats(): Promise<CacheStats> {\n const storageStats = await this.storage.stats?.();\n\n return {\n totalEntries:\n storageStats?.entryCount ?? (await this.storage.keys()).length,\n hits: this.stats.hits,\n misses: this.stats.misses,\n hitRate:\n this.stats.hits + this.stats.misses > 0\n ? Math.round(\n (this.stats.hits / (this.stats.hits + this.stats.misses)) * 100\n )\n : 0,\n memoryUsage: storageStats?.memoryUsage,\n };\n }\n\n /**\n * Prune cache if over the maximum entry limit.\n */\n private async pruneIfNeeded(): Promise<void> {\n const keys = await this.storage.keys();\n\n if (keys.length <= this.config.maxEntries) {\n return;\n }\n\n // Get all entries with their creation times\n const entries: { key: string; createdAt: number }[] = [];\n\n for (const keyStr of keys) {\n const entry = await this.storage.get(keyStr);\n if (entry) {\n entries.push({\n key: keyStr,\n createdAt: new Date(entry.meta.createdAt).getTime(),\n });\n }\n }\n\n // Sort by creation time (oldest first)\n entries.sort((a, b) => a.createdAt - b.createdAt);\n\n // Remove oldest entries until under limit\n const toRemove = entries.length - this.config.maxEntries;\n for (let i = 0; i < toRemove; i++) {\n const entry = entries[i];\n if (entry) {\n await this.storage.delete(entry.key);\n }\n }\n }\n}\n\n/**\n * Create a verification cache service with the given storage adapter.\n */\nexport function createVerificationCacheService(\n storage: CacheStorageAdapter,\n config?: Partial<VerificationCacheConfig>\n): VerificationCacheService {\n return new VerificationCacheService(storage, config);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CacheEntryMeta, CacheKeyString, CacheLookupResult, CacheMissReason, CacheStats, CacheStorageAdapter, DEFAULT_CACHE_CONFIG, VerificationCacheConfig, VerificationCacheEntry, VerificationCacheKey } from "./types.js";
|
|
2
|
+
import { VerificationCacheService, cacheKeyToString, computeContentHash, createVerificationCacheService, stringToCacheKey } from "./cache-service.js";
|
|
3
|
+
import { InMemoryCacheStorage, createInMemoryCacheStorage } from "./adapters/in-memory.js";
|
|
4
|
+
import { FileSystemCacheStorage, createFileSystemCacheStorage } from "./adapters/filesystem.js";
|
|
5
|
+
import { KeyValueStore, WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage } from "./adapters/workspace-state.js";
|
|
6
|
+
import "./adapters/index.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DEFAULT_CACHE_CONFIG } from "./types.js";
|
|
2
|
+
import { VerificationCacheService, cacheKeyToString, computeContentHash, createVerificationCacheService, stringToCacheKey } from "./cache-service.js";
|
|
3
|
+
import { InMemoryCacheStorage, createInMemoryCacheStorage } from "./adapters/in-memory.js";
|
|
4
|
+
import { FileSystemCacheStorage, createFileSystemCacheStorage } from "./adapters/filesystem.js";
|
|
5
|
+
import { WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage } from "./adapters/workspace-state.js";
|
|
6
|
+
import "./adapters/index.js";
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { VerificationReport, VerificationTier } from "@contractspec/lib.contracts/llm";
|
|
2
|
+
|
|
3
|
+
//#region src/services/verification-cache/types.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cache key for verification results.
|
|
7
|
+
*/
|
|
8
|
+
interface VerificationCacheKey {
|
|
9
|
+
/** SHA256 hash of spec file content */
|
|
10
|
+
specHash: string;
|
|
11
|
+
/** SHA256 hash of implementation file content */
|
|
12
|
+
implHash: string;
|
|
13
|
+
/** Verification tier */
|
|
14
|
+
tier: VerificationTier;
|
|
15
|
+
/** AI model version (for AI tier, ensures cache invalidation on model change) */
|
|
16
|
+
aiModelVersion?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Serializable cache key string.
|
|
20
|
+
*/
|
|
21
|
+
type CacheKeyString = string;
|
|
22
|
+
/**
|
|
23
|
+
* Cache entry metadata.
|
|
24
|
+
*/
|
|
25
|
+
interface CacheEntryMeta {
|
|
26
|
+
/** When this entry was created */
|
|
27
|
+
createdAt: string;
|
|
28
|
+
/** When this entry expires (optional TTL) */
|
|
29
|
+
expiresAt?: string;
|
|
30
|
+
/** Paths to files that affect this result (for transitive invalidation) */
|
|
31
|
+
dependencies: string[];
|
|
32
|
+
/** Human-readable spec name for debugging */
|
|
33
|
+
specName?: string;
|
|
34
|
+
/** Human-readable impl path for debugging */
|
|
35
|
+
implPath?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Full cache entry with result.
|
|
39
|
+
*/
|
|
40
|
+
interface VerificationCacheEntry {
|
|
41
|
+
/** The cache key */
|
|
42
|
+
key: VerificationCacheKey;
|
|
43
|
+
/** The verification result */
|
|
44
|
+
result: VerificationReport;
|
|
45
|
+
/** Entry metadata */
|
|
46
|
+
meta: CacheEntryMeta;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Cache lookup result.
|
|
50
|
+
*/
|
|
51
|
+
type CacheLookupResult = {
|
|
52
|
+
hit: true;
|
|
53
|
+
entry: VerificationCacheEntry;
|
|
54
|
+
} | {
|
|
55
|
+
hit: false;
|
|
56
|
+
reason: CacheMissReason;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Reasons for cache miss.
|
|
60
|
+
*/
|
|
61
|
+
type CacheMissReason = 'not_found' | 'expired' | 'spec_changed' | 'impl_changed' | 'dependency_changed' | 'model_changed';
|
|
62
|
+
/**
|
|
63
|
+
* Cache statistics.
|
|
64
|
+
*/
|
|
65
|
+
interface CacheStats {
|
|
66
|
+
/** Total entries in cache */
|
|
67
|
+
totalEntries: number;
|
|
68
|
+
/** Number of cache hits since startup */
|
|
69
|
+
hits: number;
|
|
70
|
+
/** Number of cache misses since startup */
|
|
71
|
+
misses: number;
|
|
72
|
+
/** Hit rate percentage (0-100) */
|
|
73
|
+
hitRate: number;
|
|
74
|
+
/** Estimated memory usage in bytes */
|
|
75
|
+
memoryUsage?: number;
|
|
76
|
+
/** Last time cache was pruned */
|
|
77
|
+
lastPruned?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Cache configuration.
|
|
81
|
+
*/
|
|
82
|
+
interface VerificationCacheConfig {
|
|
83
|
+
/** Maximum number of entries to keep */
|
|
84
|
+
maxEntries?: number;
|
|
85
|
+
/** Default TTL in milliseconds (AI tier uses this) */
|
|
86
|
+
defaultTtlMs?: number;
|
|
87
|
+
/** TTL for structure tier (usually longer) */
|
|
88
|
+
structureTtlMs?: number;
|
|
89
|
+
/** TTL for behavior tier */
|
|
90
|
+
behaviorTtlMs?: number;
|
|
91
|
+
/** TTL for AI tier (usually shorter) */
|
|
92
|
+
aiTtlMs?: number;
|
|
93
|
+
/** Enable transitive invalidation */
|
|
94
|
+
transitiveInvalidation?: boolean;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Default cache configuration.
|
|
98
|
+
*/
|
|
99
|
+
declare const DEFAULT_CACHE_CONFIG: Required<VerificationCacheConfig>;
|
|
100
|
+
/**
|
|
101
|
+
* Storage adapter interface for cache persistence.
|
|
102
|
+
*/
|
|
103
|
+
interface CacheStorageAdapter {
|
|
104
|
+
/** Get an entry by key */
|
|
105
|
+
get(key: CacheKeyString): Promise<VerificationCacheEntry | null>;
|
|
106
|
+
/** Set an entry */
|
|
107
|
+
set(key: CacheKeyString, entry: VerificationCacheEntry): Promise<void>;
|
|
108
|
+
/** Delete an entry */
|
|
109
|
+
delete(key: CacheKeyString): Promise<boolean>;
|
|
110
|
+
/** Check if key exists */
|
|
111
|
+
has(key: CacheKeyString): Promise<boolean>;
|
|
112
|
+
/** List all keys */
|
|
113
|
+
keys(): Promise<CacheKeyString[]>;
|
|
114
|
+
/** Clear all entries */
|
|
115
|
+
clear(): Promise<void>;
|
|
116
|
+
/** Get stats (optional) */
|
|
117
|
+
stats?(): Promise<{
|
|
118
|
+
entryCount: number;
|
|
119
|
+
memoryUsage?: number;
|
|
120
|
+
}>;
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
export { CacheEntryMeta, CacheKeyString, CacheLookupResult, CacheMissReason, CacheStats, CacheStorageAdapter, DEFAULT_CACHE_CONFIG, VerificationCacheConfig, VerificationCacheEntry, VerificationCacheKey };
|
|
124
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/services/verification-cache/types.ts"],"sourcesContent":[],"mappings":";;;;AA0BA;AAKA;AAgBA;AAEO,UArCU,oBAAA,CAqCV;EAEG;EAEF,QAAA,EAAA,MAAA;EAAc;EAMV,QAAA,EAAA,MAAA;EAOA;EAWK,IAAA,EA3DT,gBA2DmB;EAkBV;EAkBJ,cAAA,CAAA,EAAA,MAOZ;AAKD;;;;AAIW,KAvGC,cAAA,GAuGD,MAAA;;;;AAEoB,UApGd,cAAA,CAoGc;EAEpB;EAAiB,SAAA,EAAA,MAAA;EAEV;EAAR,SAAA,CAAA,EAAA,MAAA;EAEC;EAEC,YAAA,EAAA,MAAA,EAAA;EAAO;;;;;;;;UA5FF,sBAAA;;OAEV;;UAEG;;QAEF;;;;;KAMI,iBAAA;;SACY;;;UACE;;;;;KAKd,eAAA;;;;UAWK,UAAA;;;;;;;;;;;;;;;;;UAkBA,uBAAA;;;;;;;;;;;;;;;;;cAkBJ,sBAAsB,SAAS;;;;UAY3B,mBAAA;;WAEN,iBAAiB,QAAQ;;WAEzB,uBAAuB,yBAAyB;;cAE7C,iBAAiB;;WAEpB,iBAAiB;;UAElB,QAAQ;;WAEP;;YAEC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/services/verification-cache/types.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default cache configuration.
|
|
4
|
+
*/
|
|
5
|
+
const DEFAULT_CACHE_CONFIG = {
|
|
6
|
+
maxEntries: 1e3,
|
|
7
|
+
defaultTtlMs: 1440 * 60 * 1e3,
|
|
8
|
+
structureTtlMs: 10080 * 60 * 1e3,
|
|
9
|
+
behaviorTtlMs: 1440 * 60 * 1e3,
|
|
10
|
+
aiTtlMs: 1440 * 60 * 1e3,
|
|
11
|
+
transitiveInvalidation: true
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { DEFAULT_CACHE_CONFIG };
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["DEFAULT_CACHE_CONFIG: Required<VerificationCacheConfig>"],"sources":["../../../src/services/verification-cache/types.ts"],"sourcesContent":["/**\n * Types for verification caching.\n */\n\nimport type {\n VerificationReport,\n VerificationTier,\n} from '@contractspec/lib.contracts/llm';\n\n/**\n * Cache key for verification results.\n */\nexport interface VerificationCacheKey {\n /** SHA256 hash of spec file content */\n specHash: string;\n /** SHA256 hash of implementation file content */\n implHash: string;\n /** Verification tier */\n tier: VerificationTier;\n /** AI model version (for AI tier, ensures cache invalidation on model change) */\n aiModelVersion?: string;\n}\n\n/**\n * Serializable cache key string.\n */\nexport type CacheKeyString = string;\n\n/**\n * Cache entry metadata.\n */\nexport interface CacheEntryMeta {\n /** When this entry was created */\n createdAt: string;\n /** When this entry expires (optional TTL) */\n expiresAt?: string;\n /** Paths to files that affect this result (for transitive invalidation) */\n dependencies: string[];\n /** Human-readable spec name for debugging */\n specName?: string;\n /** Human-readable impl path for debugging */\n implPath?: string;\n}\n\n/**\n * Full cache entry with result.\n */\nexport interface VerificationCacheEntry {\n /** The cache key */\n key: VerificationCacheKey;\n /** The verification result */\n result: VerificationReport;\n /** Entry metadata */\n meta: CacheEntryMeta;\n}\n\n/**\n * Cache lookup result.\n */\nexport type CacheLookupResult =\n | { hit: true; entry: VerificationCacheEntry }\n | { hit: false; reason: CacheMissReason };\n\n/**\n * Reasons for cache miss.\n */\nexport type CacheMissReason =\n | 'not_found'\n | 'expired'\n | 'spec_changed'\n | 'impl_changed'\n | 'dependency_changed'\n | 'model_changed';\n\n/**\n * Cache statistics.\n */\nexport interface CacheStats {\n /** Total entries in cache */\n totalEntries: number;\n /** Number of cache hits since startup */\n hits: number;\n /** Number of cache misses since startup */\n misses: number;\n /** Hit rate percentage (0-100) */\n hitRate: number;\n /** Estimated memory usage in bytes */\n memoryUsage?: number;\n /** Last time cache was pruned */\n lastPruned?: string;\n}\n\n/**\n * Cache configuration.\n */\nexport interface VerificationCacheConfig {\n /** Maximum number of entries to keep */\n maxEntries?: number;\n /** Default TTL in milliseconds (AI tier uses this) */\n defaultTtlMs?: number;\n /** TTL for structure tier (usually longer) */\n structureTtlMs?: number;\n /** TTL for behavior tier */\n behaviorTtlMs?: number;\n /** TTL for AI tier (usually shorter) */\n aiTtlMs?: number;\n /** Enable transitive invalidation */\n transitiveInvalidation?: boolean;\n}\n\n/**\n * Default cache configuration.\n */\nexport const DEFAULT_CACHE_CONFIG: Required<VerificationCacheConfig> = {\n maxEntries: 1000,\n defaultTtlMs: 24 * 60 * 60 * 1000, // 24 hours\n structureTtlMs: 7 * 24 * 60 * 60 * 1000, // 7 days\n behaviorTtlMs: 24 * 60 * 60 * 1000, // 24 hours\n aiTtlMs: 24 * 60 * 60 * 1000, // 24 hours\n transitiveInvalidation: true,\n};\n\n/**\n * Storage adapter interface for cache persistence.\n */\nexport interface CacheStorageAdapter {\n /** Get an entry by key */\n get(key: CacheKeyString): Promise<VerificationCacheEntry | null>;\n /** Set an entry */\n set(key: CacheKeyString, entry: VerificationCacheEntry): Promise<void>;\n /** Delete an entry */\n delete(key: CacheKeyString): Promise<boolean>;\n /** Check if key exists */\n has(key: CacheKeyString): Promise<boolean>;\n /** List all keys */\n keys(): Promise<CacheKeyString[]>;\n /** Clear all entries */\n clear(): Promise<void>;\n /** Get stats (optional) */\n stats?(): Promise<{ entryCount: number; memoryUsage?: number }>;\n}\n"],"mappings":";;;;AAiHA,MAAaA,uBAA0D;CACrE,YAAY;CACZ,cAAc,OAAU,KAAK;CAC7B,gBAAgB,QAAc,KAAK;CACnC,eAAe,OAAU,KAAK;CAC9B,SAAS,OAAU,KAAK;CACxB,wBAAwB;CACzB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SemanticVerificationResult, VerifyConfig, VerifyInput } from "./types.js";
|
|
2
|
+
import { VerificationReport } from "@contractspec/lib.contracts/llm";
|
|
3
|
+
|
|
4
|
+
//#region src/services/verify/ai-verifier.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Run AI-powered verification.
|
|
8
|
+
*/
|
|
9
|
+
declare function verifyWithAI(input: VerifyInput, config?: VerifyConfig): Promise<VerificationReport>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a simpler AI review without calling the API.
|
|
12
|
+
* Used as fallback or for quick checks.
|
|
13
|
+
*/
|
|
14
|
+
declare function createQuickAIReview(input: VerifyInput): VerificationReport;
|
|
15
|
+
/**
|
|
16
|
+
* Run semantic field-level verification using AI.
|
|
17
|
+
*/
|
|
18
|
+
declare function verifySemanticFields(input: VerifyInput, config?: VerifyConfig): Promise<SemanticVerificationResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Run enhanced AI verification with semantic field analysis.
|
|
21
|
+
*/
|
|
22
|
+
declare function verifyWithAIEnhanced(input: VerifyInput, config?: VerifyConfig): Promise<VerificationReport>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { createQuickAIReview, verifySemanticFields, verifyWithAI, verifyWithAIEnhanced };
|
|
25
|
+
//# sourceMappingURL=ai-verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-verifier.d.ts","names":[],"sources":["../../../src/services/verify/ai-verifier.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkPA;AAsPsB,iBArTA,YAAA,CAqToB,KAAA,EApTjC,WAoTiC,EAAA,MAAA,CAAA,EAnThC,YAmTgC,CAAA,EAlTvC,OAkTuC,CAlT/B,kBAkT+B,CAAA;;;;;AAGhC,iBAzPM,mBAAA,CAyPN,KAAA,EAzPiC,WAyPjC,CAAA,EAzP+C,kBAyP/C;AAmBV;;;AAGW,iBAzBW,oBAAA,CAyBX,KAAA,EAxBF,WAwBE,EAAA,MAAA,CAAA,EAvBD,YAuBC,CAAA,EAtBR,OAsBQ,CAtBA,0BAsBA,CAAA;;;;iBAHW,oBAAA,QACb,sBACC,eACP,QAAQ"}
|