@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217083314 → 1.41.1

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.
Files changed (350) hide show
  1. package/dist/_virtual/rolldown_runtime.js +1 -22
  2. package/dist/adapters/ai.js +1 -82
  3. package/dist/adapters/factory.js +1 -36
  4. package/dist/adapters/fs.js +1 -118
  5. package/dist/adapters/git.js +1 -54
  6. package/dist/adapters/index.js +1 -7
  7. package/dist/adapters/logger.js +1 -80
  8. package/dist/adapters/watcher.js +1 -69
  9. package/dist/adapters/workspace.js +2 -190
  10. package/dist/ai/agents/claude-code-agent.js +9 -146
  11. package/dist/ai/agents/cursor-agent.js +17 -286
  12. package/dist/ai/agents/index.js +1 -5
  13. package/dist/ai/agents/openai-codex-agent.js +8 -140
  14. package/dist/ai/agents/orchestrator.js +1 -142
  15. package/dist/ai/agents/simple-agent.js +4 -80
  16. package/dist/ai/client.js +1 -162
  17. package/dist/ai/index.js +1 -27
  18. package/dist/ai/prompts/code-generation.js +13 -55
  19. package/dist/ai/prompts/index.js +1 -12
  20. package/dist/ai/prompts/spec-creation.js +20 -61
  21. package/dist/ai/providers.js +1 -40
  22. package/dist/formatters/index.js +1 -18
  23. package/dist/formatters/json.js +1 -71
  24. package/dist/formatters/sarif.js +1 -163
  25. package/dist/formatters/text.js +2 -208
  26. package/dist/index.js +1 -81
  27. package/dist/services/agent-guide/adapters/claude-code.js +3 -144
  28. package/dist/services/agent-guide/adapters/cursor-cli.js +3 -135
  29. package/dist/services/agent-guide/adapters/generic-mcp.js +3 -159
  30. package/dist/services/agent-guide/adapters/index.js +1 -30
  31. package/dist/services/agent-guide/agent-guide-service.js +1 -148
  32. package/dist/services/agent-guide/index.js +1 -5
  33. package/dist/services/build.js +1 -140
  34. package/dist/services/ci-check/ci-check-service.js +1 -393
  35. package/dist/services/ci-check/index.js +1 -2
  36. package/dist/services/ci-check/types.js +1 -28
  37. package/dist/services/clean.js +1 -71
  38. package/dist/services/config.js +1 -76
  39. package/dist/services/deps.js +1 -62
  40. package/dist/services/diff.js +1 -33
  41. package/dist/services/doctor/checks/ai.js +2 -118
  42. package/dist/services/doctor/checks/cli.js +1 -146
  43. package/dist/services/doctor/checks/config.js +1 -170
  44. package/dist/services/doctor/checks/deps.js +1 -180
  45. package/dist/services/doctor/checks/index.js +1 -6
  46. package/dist/services/doctor/checks/mcp.js +1 -144
  47. package/dist/services/doctor/checks/workspace.js +1 -243
  48. package/dist/services/doctor/doctor-service.js +2 -115
  49. package/dist/services/doctor/index.js +1 -2
  50. package/dist/services/doctor/types.js +1 -26
  51. package/dist/services/implementation/discovery.js +2 -143
  52. package/dist/services/implementation/index.js +1 -2
  53. package/dist/services/implementation/resolver.js +1 -223
  54. package/dist/services/index.js +1 -53
  55. package/dist/services/integrity-diagram.js +6 -274
  56. package/dist/services/integrity.js +1 -272
  57. package/dist/services/list.js +1 -35
  58. package/dist/services/openapi/export-service.js +2 -51
  59. package/dist/services/openapi/import-service.js +1 -75
  60. package/dist/services/openapi/index.js +1 -4
  61. package/dist/services/openapi/sync-service.js +1 -121
  62. package/dist/services/openapi/validate-service.js +1 -130
  63. package/dist/services/regenerator.js +1 -23
  64. package/dist/services/registry.js +1 -73
  65. package/dist/services/setup/config-generators.js +26 -113
  66. package/dist/services/setup/file-merger.js +2 -60
  67. package/dist/services/setup/index.js +1 -4
  68. package/dist/services/setup/setup-service.js +1 -95
  69. package/dist/services/setup/targets/agents-md.js +1 -46
  70. package/dist/services/setup/targets/cli-config.js +1 -59
  71. package/dist/services/setup/targets/cursor-rules.js +1 -47
  72. package/dist/services/setup/targets/mcp-claude.js +1 -59
  73. package/dist/services/setup/targets/mcp-cursor.js +1 -58
  74. package/dist/services/setup/targets/vscode-settings.js +1 -62
  75. package/dist/services/setup/types.js +1 -26
  76. package/dist/services/sync.js +1 -62
  77. package/dist/services/test.js +1 -30
  78. package/dist/services/validate-implementation.js +1 -69
  79. package/dist/services/validate.js +1 -47
  80. package/dist/services/verification-cache/adapters/filesystem.js +1 -121
  81. package/dist/services/verification-cache/adapters/in-memory.js +1 -45
  82. package/dist/services/verification-cache/adapters/index.js +1 -3
  83. package/dist/services/verification-cache/adapters/workspace-state.js +1 -90
  84. package/dist/services/verification-cache/cache-service.js +1 -255
  85. package/dist/services/verification-cache/index.js +1 -6
  86. package/dist/services/verification-cache/types.js +1 -15
  87. package/dist/services/verify/ai-verifier.js +9 -336
  88. package/dist/services/verify/behavior-verifier.js +1 -185
  89. package/dist/services/verify/index.js +1 -4
  90. package/dist/services/verify/structure-verifier.js +2 -195
  91. package/dist/services/verify/verify-service.js +3 -203
  92. package/dist/services/watch.js +1 -31
  93. package/dist/services/workspace-info.js +2 -102
  94. package/dist/templates/app-config.template.js +28 -101
  95. package/dist/templates/data-view.template.js +27 -42
  96. package/dist/templates/event.template.js +14 -29
  97. package/dist/templates/experiment.template.js +51 -77
  98. package/dist/templates/handler.template.js +17 -53
  99. package/dist/templates/index.js +1 -36
  100. package/dist/templates/integration.template.js +50 -134
  101. package/dist/templates/knowledge.template.js +21 -62
  102. package/dist/templates/migration.template.js +26 -50
  103. package/dist/templates/operation.template.js +28 -44
  104. package/dist/templates/presentation.template.js +20 -46
  105. package/dist/templates/telemetry.template.js +53 -74
  106. package/dist/templates/workflow-runner.template.js +6 -12
  107. package/dist/templates/workflow.template.js +24 -51
  108. package/package.json +10 -15
  109. package/dist/adapters/ai.d.ts +0 -11
  110. package/dist/adapters/factory.d.ts +0 -28
  111. package/dist/adapters/fs.d.ts +0 -10
  112. package/dist/adapters/git.d.ts +0 -10
  113. package/dist/adapters/logger.d.ts +0 -17
  114. package/dist/adapters/watcher.d.ts +0 -10
  115. package/dist/adapters/workspace.d.ts +0 -93
  116. package/dist/ai/agents/claude-code-agent.d.ts +0 -21
  117. package/dist/ai/agents/cursor-agent.d.ts +0 -67
  118. package/dist/ai/agents/openai-codex-agent.d.ts +0 -21
  119. package/dist/ai/agents/orchestrator.d.ts +0 -49
  120. package/dist/ai/agents/simple-agent.d.ts +0 -16
  121. package/dist/ai/agents/types.d.ts +0 -35
  122. package/dist/ai/client.d.ts +0 -82
  123. package/dist/ai/index.d.ts +0 -16
  124. package/dist/ai/prompts/code-generation.d.ts +0 -25
  125. package/dist/ai/prompts/index.d.ts +0 -9
  126. package/dist/ai/prompts/spec-creation.d.ts +0 -28
  127. package/dist/ai/providers.d.ts +0 -28
  128. package/dist/formatters/index.d.ts +0 -10
  129. package/dist/formatters/json.d.ts +0 -88
  130. package/dist/formatters/sarif.d.ts +0 -100
  131. package/dist/formatters/text.d.ts +0 -34
  132. package/dist/index.d.ts +0 -66
  133. package/dist/libs/ai-providers/dist/factory.js +0 -154
  134. package/dist/libs/ai-providers/dist/index.js +0 -4
  135. package/dist/libs/ai-providers/dist/legacy.js +0 -72
  136. package/dist/libs/ai-providers/dist/models.js +0 -287
  137. package/dist/libs/ai-providers/dist/validation.js +0 -1
  138. package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
  139. package/dist/libs/contracts/dist/client/index.js +0 -5
  140. package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
  141. package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
  142. package/dist/libs/contracts/dist/client/react/index.js +0 -4
  143. package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
  144. package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
  145. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  146. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  147. package/dist/libs/contracts/dist/docs/index.js +0 -29
  148. package/dist/libs/contracts/dist/docs/presentations.js +0 -71
  149. package/dist/libs/contracts/dist/docs/registry.js +0 -44
  150. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  151. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  152. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  153. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  154. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  155. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
  156. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
  157. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  158. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
  159. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  160. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  161. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  162. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  163. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
  164. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
  165. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  166. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  167. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  168. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
  169. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  170. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
  171. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
  172. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  173. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
  174. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  175. package/dist/libs/contracts/dist/events.js +0 -8
  176. package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
  177. package/dist/libs/contracts/dist/index.js +0 -72
  178. package/dist/libs/contracts/dist/install.js +0 -2
  179. package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
  180. package/dist/libs/contracts/dist/integrations/index.js +0 -18
  181. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
  182. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
  183. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  184. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
  185. package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
  186. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
  187. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  188. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  189. package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
  190. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
  191. package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
  192. package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
  193. package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
  194. package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
  195. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
  196. package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
  197. package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
  198. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  199. package/dist/libs/contracts/dist/jsonschema.js +0 -24
  200. package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
  201. package/dist/libs/contracts/dist/knowledge/index.js +0 -7
  202. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  203. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  204. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  205. package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
  206. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  207. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  208. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  209. package/dist/libs/contracts/dist/llm/exporters.js +0 -352
  210. package/dist/libs/contracts/dist/llm/index.js +0 -2
  211. package/dist/libs/contracts/dist/llm/prompts.js +0 -211
  212. package/dist/libs/contracts/dist/onboarding-base.js +0 -196
  213. package/dist/libs/contracts/dist/openapi.js +0 -75
  214. package/dist/libs/contracts/dist/ownership.js +0 -21
  215. package/dist/libs/contracts/dist/presentations.js +0 -1
  216. package/dist/libs/contracts/dist/presentations.v2.js +0 -11
  217. package/dist/libs/contracts/dist/prompt.js +0 -1
  218. package/dist/libs/contracts/dist/promptRegistry.js +0 -1
  219. package/dist/libs/contracts/dist/regenerator/index.js +0 -2
  220. package/dist/libs/contracts/dist/regenerator/service.js +0 -92
  221. package/dist/libs/contracts/dist/regenerator/utils.js +0 -51
  222. package/dist/libs/contracts/dist/registry.js +0 -208
  223. package/dist/libs/contracts/dist/resources.js +0 -1
  224. package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
  225. package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
  226. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
  227. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -34
  228. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  229. package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
  230. package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
  231. package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
  232. package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
  233. package/dist/libs/contracts/dist/server/index.js +0 -8
  234. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
  235. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
  236. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
  237. package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
  238. package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
  239. package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
  240. package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
  241. package/dist/libs/contracts/dist/server/rest-express.js +0 -1
  242. package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
  243. package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
  244. package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
  245. package/dist/libs/contracts/dist/spec.js +0 -35
  246. package/dist/libs/contracts/dist/telemetry/index.js +0 -1
  247. package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
  248. package/dist/libs/contracts/dist/tests/index.js +0 -1
  249. package/dist/libs/contracts/dist/tests/runner.js +0 -150
  250. package/dist/libs/contracts/dist/workflow/index.js +0 -1
  251. package/dist/libs/contracts/dist/workflow/runner.js +0 -1
  252. package/dist/libs/contracts-transformers/dist/common/utils.js +0 -47
  253. package/dist/libs/contracts-transformers/dist/openapi/exporter.js +0 -1
  254. package/dist/libs/contracts-transformers/dist/openapi/importer.js +0 -255
  255. package/dist/libs/contracts-transformers/dist/openapi/index.js +0 -4
  256. package/dist/libs/contracts-transformers/dist/openapi/parser.js +0 -231
  257. package/dist/libs/contracts-transformers/dist/openapi/schema-converter.js +0 -201
  258. package/dist/modules/contractspec-workspace/dist/ai/code-generation.js +0 -137
  259. package/dist/modules/contractspec-workspace/dist/ai/spec-creation.js +0 -101
  260. package/dist/modules/contractspec-workspace/dist/analysis/deps/graph.js +0 -84
  261. package/dist/modules/contractspec-workspace/dist/analysis/deps/parse-imports.js +0 -30
  262. package/dist/modules/contractspec-workspace/dist/analysis/diff/semantic.js +0 -96
  263. package/dist/modules/contractspec-workspace/dist/analysis/feature-scan.js +0 -151
  264. package/dist/modules/contractspec-workspace/dist/analysis/spec-scan.js +0 -344
  265. package/dist/modules/contractspec-workspace/dist/analysis/validate/spec-structure.js +0 -122
  266. package/dist/modules/contractspec-workspace/dist/templates/app-config.js +0 -105
  267. package/dist/modules/contractspec-workspace/dist/templates/data-view.js +0 -68
  268. package/dist/modules/contractspec-workspace/dist/templates/event.js +0 -38
  269. package/dist/modules/contractspec-workspace/dist/templates/experiment.js +0 -87
  270. package/dist/modules/contractspec-workspace/dist/templates/handler.js +0 -95
  271. package/dist/modules/contractspec-workspace/dist/templates/integration-utils.js +0 -104
  272. package/dist/modules/contractspec-workspace/dist/templates/integration.js +0 -62
  273. package/dist/modules/contractspec-workspace/dist/templates/knowledge.js +0 -68
  274. package/dist/modules/contractspec-workspace/dist/templates/migration.js +0 -60
  275. package/dist/modules/contractspec-workspace/dist/templates/operation.js +0 -100
  276. package/dist/modules/contractspec-workspace/dist/templates/presentation.js +0 -78
  277. package/dist/modules/contractspec-workspace/dist/templates/telemetry.js +0 -89
  278. package/dist/modules/contractspec-workspace/dist/templates/utils.js +0 -38
  279. package/dist/modules/contractspec-workspace/dist/templates/workflow-runner.js +0 -48
  280. package/dist/modules/contractspec-workspace/dist/templates/workflow.js +0 -67
  281. package/dist/modules/contractspec-workspace/dist/types/generation-types.js +0 -20
  282. package/dist/ports/ai.d.ts +0 -58
  283. package/dist/ports/fs.d.ts +0 -80
  284. package/dist/ports/git.d.ts +0 -32
  285. package/dist/ports/logger.d.ts +0 -87
  286. package/dist/ports/watcher.d.ts +0 -51
  287. package/dist/services/agent-guide/adapters/claude-code.d.ts +0 -34
  288. package/dist/services/agent-guide/adapters/cursor-cli.d.ts +0 -38
  289. package/dist/services/agent-guide/adapters/generic-mcp.d.ts +0 -52
  290. package/dist/services/agent-guide/adapters/index.d.ts +0 -22
  291. package/dist/services/agent-guide/agent-guide-service.d.ts +0 -55
  292. package/dist/services/agent-guide/types.d.ts +0 -57
  293. package/dist/services/build.d.ts +0 -58
  294. package/dist/services/ci-check/ci-check-service.d.ts +0 -15
  295. package/dist/services/ci-check/types.d.ts +0 -142
  296. package/dist/services/clean.d.ts +0 -40
  297. package/dist/services/config.d.ts +0 -25
  298. package/dist/services/deps.d.ts +0 -52
  299. package/dist/services/diff.d.ts +0 -33
  300. package/dist/services/doctor/doctor-service.d.ts +0 -23
  301. package/dist/services/doctor/types.d.ts +0 -117
  302. package/dist/services/implementation/discovery.d.ts +0 -29
  303. package/dist/services/implementation/resolver.d.ts +0 -43
  304. package/dist/services/implementation/types.d.ts +0 -78
  305. package/dist/services/integrity-diagram.d.ts +0 -35
  306. package/dist/services/integrity.d.ts +0 -133
  307. package/dist/services/list.d.ts +0 -30
  308. package/dist/services/openapi/export-service.d.ts +0 -52
  309. package/dist/services/openapi/import-service.d.ts +0 -15
  310. package/dist/services/openapi/sync-service.d.ts +0 -18
  311. package/dist/services/openapi/types.d.ts +0 -184
  312. package/dist/services/openapi/validate-service.d.ts +0 -15
  313. package/dist/services/regenerator.d.ts +0 -17
  314. package/dist/services/registry.d.ts +0 -52
  315. package/dist/services/setup/config-generators.d.ts +0 -41
  316. package/dist/services/setup/file-merger.d.ts +0 -26
  317. package/dist/services/setup/setup-service.d.ts +0 -11
  318. package/dist/services/setup/types.d.ts +0 -84
  319. package/dist/services/sync.d.ts +0 -40
  320. package/dist/services/test.d.ts +0 -14
  321. package/dist/services/validate-implementation.d.ts +0 -31
  322. package/dist/services/validate.d.ts +0 -40
  323. package/dist/services/verification-cache/adapters/filesystem.d.ts +0 -45
  324. package/dist/services/verification-cache/adapters/in-memory.d.ts +0 -26
  325. package/dist/services/verification-cache/adapters/workspace-state.d.ts +0 -48
  326. package/dist/services/verification-cache/cache-service.d.ts +0 -69
  327. package/dist/services/verification-cache/types.d.ts +0 -123
  328. package/dist/services/verify/ai-verifier.d.ts +0 -24
  329. package/dist/services/verify/behavior-verifier.d.ts +0 -11
  330. package/dist/services/verify/structure-verifier.d.ts +0 -11
  331. package/dist/services/verify/types.d.ts +0 -136
  332. package/dist/services/verify/verify-service.d.ts +0 -59
  333. package/dist/services/watch.d.ts +0 -24
  334. package/dist/services/workspace-info.d.ts +0 -61
  335. package/dist/templates/app-config.template.d.ts +0 -6
  336. package/dist/templates/data-view.template.d.ts +0 -6
  337. package/dist/templates/event.template.d.ts +0 -10
  338. package/dist/templates/experiment.template.d.ts +0 -6
  339. package/dist/templates/handler.template.d.ts +0 -15
  340. package/dist/templates/index.d.ts +0 -20
  341. package/dist/templates/integration.template.d.ts +0 -6
  342. package/dist/templates/knowledge.template.d.ts +0 -6
  343. package/dist/templates/migration.template.d.ts +0 -6
  344. package/dist/templates/operation.template.d.ts +0 -10
  345. package/dist/templates/presentation.template.d.ts +0 -10
  346. package/dist/templates/telemetry.template.d.ts +0 -6
  347. package/dist/templates/workflow-runner.template.d.ts +0 -15
  348. package/dist/templates/workflow.template.d.ts +0 -6
  349. package/dist/types/config.d.ts +0 -33
  350. package/dist/types.d.ts +0 -323
@@ -1,69 +1 @@
1
- import { scanSpecSource } from "../modules/contractspec-workspace/dist/analysis/spec-scan.js";
2
-
3
- //#region src/services/validate-implementation.ts
4
- /**
5
- * Implementation validation service (handlers + tests).
6
- *
7
- * Deterministic, static checks intended for reuse across CLI/VSCode/web tooling.
8
- * This does NOT execute spec modules.
9
- */
10
- function toKebabCase(value) {
11
- return value.replace(/\./g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
12
- }
13
- function toPascalCase(value) {
14
- return value.split(/[-_.]/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
15
- }
16
- async function validateImplementationFiles(specFile, adapters, config, options = {}) {
17
- const { fs } = adapters;
18
- const errors = [];
19
- const warnings = [];
20
- if (!await fs.exists(specFile)) return {
21
- valid: false,
22
- errors: [`Spec file not found: ${specFile}`],
23
- warnings: [],
24
- expected: {}
25
- };
26
- const scan = scanSpecSource(await fs.readFile(specFile), specFile);
27
- const specName = scan.name ?? fs.basename(specFile).replace(/\.[jt]s$/, "");
28
- const outRoot = options.outputDir ?? config.outputDir ?? "./src";
29
- const kebab = toKebabCase(specName);
30
- const expected = {};
31
- if (scan.specType === "operation") {
32
- expected.handlerPath = fs.join(outRoot, "handlers", `${kebab}.handler.ts`);
33
- expected.handlerTestPath = fs.join(outRoot, "handlers", `${kebab}.handler.test.ts`);
34
- }
35
- if (scan.specType === "presentation") {
36
- expected.componentPath = fs.join(outRoot, "components", `${kebab}.tsx`);
37
- expected.componentTestPath = fs.join(outRoot, "components", `${kebab}.test.tsx`);
38
- }
39
- if (scan.specType === "form") {
40
- expected.formPath = fs.join(outRoot, "forms", `${kebab}.form.tsx`);
41
- expected.formTestPath = fs.join(outRoot, "forms", `${kebab}.form.test.tsx`);
42
- }
43
- if (options.checkHandlers && expected.handlerPath) if (!await fs.exists(expected.handlerPath)) errors.push(`Missing handler file: ${expected.handlerPath}`);
44
- else {
45
- const handlerCode = await fs.readFile(expected.handlerPath);
46
- const expectedSpecVar = `${toPascalCase(specName.split(".").pop() ?? specName)}Spec`;
47
- const hasContractHandlerType = /ContractHandler<\s*typeof\s+\w+\s*>/.test(handlerCode);
48
- const referencesExpectedSpec = (/* @__PURE__ */ new RegExp(`typeof\\s+${expectedSpecVar}\\b`)).test(handlerCode);
49
- if (!hasContractHandlerType) warnings.push(`Handler does not appear to type itself as ContractHandler<typeof Spec>: ${expected.handlerPath}`);
50
- else if (!referencesExpectedSpec) warnings.push(`Handler ContractHandler typing does not reference expected spec var (${expectedSpecVar}): ${expected.handlerPath}`);
51
- }
52
- if (options.checkTests) {
53
- const candidateTests = [
54
- expected.handlerTestPath,
55
- expected.componentTestPath,
56
- expected.formTestPath
57
- ].filter((p) => typeof p === "string");
58
- for (const testPath of candidateTests) if (!await fs.exists(testPath)) errors.push(`Missing test file: ${testPath}`);
59
- }
60
- return {
61
- valid: errors.length === 0,
62
- errors,
63
- warnings,
64
- expected
65
- };
66
- }
67
-
68
- //#endregion
69
- export { validateImplementationFiles };
1
+ import{scanSpecSource as e}from"@lssm/module.contractspec-workspace";function t(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function n(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}async function r(r,i,a,o={}){let{fs:s}=i,c=[],l=[];if(!await s.exists(r))return{valid:!1,errors:[`Spec file not found: ${r}`],warnings:[],expected:{}};let u=e(await s.readFile(r),r),d=u.name??s.basename(r).replace(/\.[jt]s$/,``),f=o.outputDir??a.outputDir??`./src`,p=t(d),m={};if(u.specType===`operation`&&(m.handlerPath=s.join(f,`handlers`,`${p}.handler.ts`),m.handlerTestPath=s.join(f,`handlers`,`${p}.handler.test.ts`)),u.specType===`presentation`&&(m.componentPath=s.join(f,`components`,`${p}.tsx`),m.componentTestPath=s.join(f,`components`,`${p}.test.tsx`)),u.specType===`form`&&(m.formPath=s.join(f,`forms`,`${p}.form.tsx`),m.formTestPath=s.join(f,`forms`,`${p}.form.test.tsx`)),o.checkHandlers&&m.handlerPath)if(!await s.exists(m.handlerPath))c.push(`Missing handler file: ${m.handlerPath}`);else{let e=await s.readFile(m.handlerPath),t=`${n(d.split(`.`).pop()??d)}Spec`,r=/ContractHandler<\s*typeof\s+\w+\s*>/.test(e),i=RegExp(`typeof\\s+${t}\\b`).test(e);r?i||l.push(`Handler ContractHandler typing does not reference expected spec var (${t}): ${m.handlerPath}`):l.push(`Handler does not appear to type itself as ContractHandler<typeof Spec>: ${m.handlerPath}`)}if(o.checkTests){let e=[m.handlerTestPath,m.componentTestPath,m.formTestPath].filter(e=>typeof e==`string`);for(let t of e)await s.exists(t)||c.push(`Missing test file: ${t}`)}return{valid:c.length===0,errors:c,warnings:l,expected:m}}export{r as validateImplementationFiles};
@@ -1,47 +1 @@
1
- import { validateSpecStructure } from "../modules/contractspec-workspace/dist/analysis/validate/spec-structure.js";
2
-
3
- //#region src/services/validate.ts
4
- /**
5
- * Validation service.
6
- */
7
- /**
8
- * Validate a spec file.
9
- */
10
- async function validateSpec(specFile, adapters, options = {}) {
11
- const { fs } = adapters;
12
- if (!await fs.exists(specFile)) return {
13
- valid: false,
14
- errors: [`Spec file not found: ${specFile}`],
15
- warnings: []
16
- };
17
- const specCode = await fs.readFile(specFile);
18
- const fileName = fs.basename(specFile);
19
- const allErrors = [];
20
- const allWarnings = [];
21
- let structureResult;
22
- if (!options.skipStructure) {
23
- structureResult = validateSpecStructure(specCode, fileName);
24
- allErrors.push(...structureResult.errors);
25
- allWarnings.push(...structureResult.warnings);
26
- }
27
- return {
28
- valid: allErrors.length === 0,
29
- structureResult,
30
- errors: allErrors,
31
- warnings: allWarnings
32
- };
33
- }
34
- /**
35
- * Validate multiple spec files.
36
- */
37
- async function validateSpecs(specFiles, adapters, options = {}) {
38
- const results = /* @__PURE__ */ new Map();
39
- for (const specFile of specFiles) {
40
- const result = await validateSpec(specFile, adapters, options);
41
- results.set(specFile, result);
42
- }
43
- return results;
44
- }
45
-
46
- //#endregion
47
- export { validateSpec, validateSpecs };
1
+ import{validateSpecStructure as e}from"@lssm/module.contractspec-workspace";async function t(t,n,r={}){let{fs:i}=n;if(!await i.exists(t))return{valid:!1,errors:[`Spec file not found: ${t}`],warnings:[]};let a=await i.readFile(t),o=i.basename(t),s=[],c=[],l;return r.skipStructure||(l=e(a,o),s.push(...l.errors),c.push(...l.warnings)),{valid:s.length===0,structureResult:l,errors:s,warnings:c}}async function n(e,n,r={}){let i=new Map;for(let a of e){let e=await t(a,n,r);i.set(a,e)}return i}export{t as validateSpec,n as validateSpecs};
@@ -1,121 +1 @@
1
- import { __require } from "../../../_virtual/rolldown_runtime.js";
2
- import { dirname, join } from "path";
3
- import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
4
-
5
- //#region src/services/verification-cache/adapters/filesystem.ts
6
- /**
7
- * Filesystem cache storage adapter.
8
- *
9
- * Stores cache entries in a JSON file for CLI and CI environments.
10
- * Uses atomic writes to prevent corruption.
11
- */
12
- /**
13
- * Default cache file location.
14
- */
15
- const DEFAULT_CACHE_FILE = ".contractspec/verification-cache.json";
16
- const CURRENT_VERSION = 1;
17
- /**
18
- * Filesystem storage adapter.
19
- */
20
- var FileSystemCacheStorage = class {
21
- filePath;
22
- cache;
23
- isDirty = false;
24
- constructor(filePath, workspaceRoot) {
25
- const root = workspaceRoot ?? process.cwd();
26
- this.filePath = filePath ?? join(root, DEFAULT_CACHE_FILE);
27
- this.cache = /* @__PURE__ */ new Map();
28
- this.loadSync();
29
- }
30
- /**
31
- * Load cache from disk synchronously.
32
- */
33
- loadSync() {
34
- try {
35
- if (!existsSync(this.filePath)) return;
36
- const content = readFileSync(this.filePath, "utf-8");
37
- const data = JSON.parse(content);
38
- if (data.version !== CURRENT_VERSION) return;
39
- for (const [key, entry] of Object.entries(data.entries)) this.cache.set(key, entry);
40
- } catch {}
41
- }
42
- /**
43
- * Save cache to disk.
44
- */
45
- saveSync() {
46
- if (!this.isDirty) return;
47
- try {
48
- const dir = dirname(this.filePath);
49
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
50
- const data = {
51
- version: CURRENT_VERSION,
52
- entries: Object.fromEntries(this.cache.entries())
53
- };
54
- const tempPath = `${this.filePath}.tmp`;
55
- writeFileSync(tempPath, JSON.stringify(data, null, 2), "utf-8");
56
- const { renameSync } = __require("fs");
57
- renameSync(tempPath, this.filePath);
58
- this.isDirty = false;
59
- } catch {}
60
- }
61
- async get(key) {
62
- return this.cache.get(key) ?? null;
63
- }
64
- async set(key, entry) {
65
- this.cache.set(key, entry);
66
- this.isDirty = true;
67
- this.saveSync();
68
- }
69
- async delete(key) {
70
- const existed = this.cache.delete(key);
71
- if (existed) {
72
- this.isDirty = true;
73
- this.saveSync();
74
- }
75
- return existed;
76
- }
77
- async has(key) {
78
- return this.cache.has(key);
79
- }
80
- async keys() {
81
- return Array.from(this.cache.keys());
82
- }
83
- async clear() {
84
- this.cache.clear();
85
- this.isDirty = true;
86
- this.saveSync();
87
- }
88
- async stats() {
89
- let fileSize = 0;
90
- try {
91
- if (existsSync(this.filePath)) fileSize = statSync(this.filePath).size;
92
- } catch {}
93
- return {
94
- entryCount: this.cache.size,
95
- memoryUsage: fileSize
96
- };
97
- }
98
- /**
99
- * Force save any pending changes.
100
- */
101
- flush() {
102
- this.saveSync();
103
- }
104
- /**
105
- * Reload cache from disk.
106
- */
107
- reload() {
108
- this.cache.clear();
109
- this.loadSync();
110
- this.isDirty = false;
111
- }
112
- };
113
- /**
114
- * Create a filesystem cache storage adapter.
115
- */
116
- function createFileSystemCacheStorage(filePath, workspaceRoot) {
117
- return new FileSystemCacheStorage(filePath, workspaceRoot);
118
- }
119
-
120
- //#endregion
121
- export { FileSystemCacheStorage, createFileSystemCacheStorage };
1
+ import{__require as e}from"../../../_virtual/rolldown_runtime.js";import{dirname as t,join as n}from"path";import{existsSync as r,mkdirSync as i,readFileSync as a,statSync as o,writeFileSync as s}from"fs";var c=class{filePath;cache;isDirty=!1;constructor(e,t){let r=t??process.cwd();this.filePath=e??n(r,`.contractspec/verification-cache.json`),this.cache=new Map,this.loadSync()}loadSync(){try{if(!r(this.filePath))return;let e=a(this.filePath,`utf-8`),t=JSON.parse(e);if(t.version!==1)return;for(let[e,n]of Object.entries(t.entries))this.cache.set(e,n)}catch{}}saveSync(){if(this.isDirty)try{let n=t(this.filePath);r(n)||i(n,{recursive:!0});let a={version:1,entries:Object.fromEntries(this.cache.entries())},o=`${this.filePath}.tmp`;s(o,JSON.stringify(a,null,2),`utf-8`);let{renameSync:c}=e(`fs`);c(o,this.filePath),this.isDirty=!1}catch{}}async get(e){return this.cache.get(e)??null}async set(e,t){this.cache.set(e,t),this.isDirty=!0,this.saveSync()}async delete(e){let t=this.cache.delete(e);return t&&(this.isDirty=!0,this.saveSync()),t}async has(e){return this.cache.has(e)}async keys(){return Array.from(this.cache.keys())}async clear(){this.cache.clear(),this.isDirty=!0,this.saveSync()}async stats(){let e=0;try{r(this.filePath)&&(e=o(this.filePath).size)}catch{}return{entryCount:this.cache.size,memoryUsage:e}}flush(){this.saveSync()}reload(){this.cache.clear(),this.loadSync(),this.isDirty=!1}};function l(e,t){return new c(e,t)}export{c as FileSystemCacheStorage,l as createFileSystemCacheStorage};
@@ -1,45 +1 @@
1
- //#region src/services/verification-cache/adapters/in-memory.ts
2
- /**
3
- * In-memory storage adapter using a Map.
4
- */
5
- var InMemoryCacheStorage = class {
6
- cache = /* @__PURE__ */ new Map();
7
- async get(key) {
8
- return this.cache.get(key) ?? null;
9
- }
10
- async set(key, entry) {
11
- this.cache.set(key, entry);
12
- }
13
- async delete(key) {
14
- return this.cache.delete(key);
15
- }
16
- async has(key) {
17
- return this.cache.has(key);
18
- }
19
- async keys() {
20
- return Array.from(this.cache.keys());
21
- }
22
- async clear() {
23
- this.cache.clear();
24
- }
25
- async stats() {
26
- let memoryUsage = 0;
27
- for (const [key, value] of this.cache.entries()) {
28
- memoryUsage += key.length * 2;
29
- memoryUsage += JSON.stringify(value).length * 2;
30
- }
31
- return {
32
- entryCount: this.cache.size,
33
- memoryUsage
34
- };
35
- }
36
- };
37
- /**
38
- * Create an in-memory cache storage adapter.
39
- */
40
- function createInMemoryCacheStorage() {
41
- return new InMemoryCacheStorage();
42
- }
43
-
44
- //#endregion
45
- export { InMemoryCacheStorage, createInMemoryCacheStorage };
1
+ var e=class{cache=new Map;async get(e){return this.cache.get(e)??null}async set(e,t){this.cache.set(e,t)}async delete(e){return this.cache.delete(e)}async has(e){return this.cache.has(e)}async keys(){return Array.from(this.cache.keys())}async clear(){this.cache.clear()}async stats(){let e=0;for(let[t,n]of this.cache.entries())e+=t.length*2,e+=JSON.stringify(n).length*2;return{entryCount:this.cache.size,memoryUsage:e}}};function t(){return new e}export{e as InMemoryCacheStorage,t as createInMemoryCacheStorage};
@@ -1,3 +1 @@
1
- import { InMemoryCacheStorage, createInMemoryCacheStorage } from "./in-memory.js";
2
- import { FileSystemCacheStorage, createFileSystemCacheStorage } from "./filesystem.js";
3
- import { WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage } from "./workspace-state.js";
1
+ import{InMemoryCacheStorage as e,createInMemoryCacheStorage as t}from"./in-memory.js";import{FileSystemCacheStorage as n,createFileSystemCacheStorage as r}from"./filesystem.js";import{WorkspaceStateCacheStorage as i,createWorkspaceStateCacheStorage as a}from"./workspace-state.js";
@@ -1,90 +1 @@
1
- //#region src/services/verification-cache/adapters/workspace-state.ts
2
- /**
3
- * Cache key prefix to avoid collisions.
4
- */
5
- const CACHE_PREFIX = "contractspec.verification-cache.";
6
- /**
7
- * Index key for tracking all cache keys.
8
- */
9
- const INDEX_KEY = `${CACHE_PREFIX}__index__`;
10
- /**
11
- * Workspace state storage adapter.
12
- */
13
- var WorkspaceStateCacheStorage = class {
14
- store;
15
- keyIndex;
16
- constructor(store) {
17
- this.store = store;
18
- this.keyIndex = new Set(this.loadKeyIndex());
19
- }
20
- /**
21
- * Load the key index from storage.
22
- */
23
- loadKeyIndex() {
24
- try {
25
- return this.store.get(INDEX_KEY) ?? [];
26
- } catch {
27
- return [];
28
- }
29
- }
30
- /**
31
- * Save the key index to storage.
32
- */
33
- async saveKeyIndex() {
34
- await this.store.update(INDEX_KEY, Array.from(this.keyIndex));
35
- }
36
- /**
37
- * Get the storage key for a cache key.
38
- */
39
- getStorageKey(key) {
40
- return `${CACHE_PREFIX}${key}`;
41
- }
42
- async get(key) {
43
- const storageKey = this.getStorageKey(key);
44
- return this.store.get(storageKey) ?? null;
45
- }
46
- async set(key, entry) {
47
- const storageKey = this.getStorageKey(key);
48
- await this.store.update(storageKey, entry);
49
- if (!this.keyIndex.has(key)) {
50
- this.keyIndex.add(key);
51
- await this.saveKeyIndex();
52
- }
53
- }
54
- async delete(key) {
55
- const storageKey = this.getStorageKey(key);
56
- const existed = this.keyIndex.has(key);
57
- if (existed) {
58
- await this.store.update(storageKey, void 0);
59
- this.keyIndex.delete(key);
60
- await this.saveKeyIndex();
61
- }
62
- return existed;
63
- }
64
- async has(key) {
65
- return this.keyIndex.has(key);
66
- }
67
- async keys() {
68
- return Array.from(this.keyIndex);
69
- }
70
- async clear() {
71
- for (const key of this.keyIndex) {
72
- const storageKey = this.getStorageKey(key);
73
- await this.store.update(storageKey, void 0);
74
- }
75
- this.keyIndex.clear();
76
- await this.saveKeyIndex();
77
- }
78
- async stats() {
79
- return { entryCount: this.keyIndex.size };
80
- }
81
- };
82
- /**
83
- * Create a workspace state cache storage adapter.
84
- */
85
- function createWorkspaceStateCacheStorage(store) {
86
- return new WorkspaceStateCacheStorage(store);
87
- }
88
-
89
- //#endregion
90
- export { WorkspaceStateCacheStorage, createWorkspaceStateCacheStorage };
1
+ const e=`contractspec.verification-cache.`,t=`${e}__index__`;var n=class{store;keyIndex;constructor(e){this.store=e,this.keyIndex=new Set(this.loadKeyIndex())}loadKeyIndex(){try{return this.store.get(t)??[]}catch{return[]}}async saveKeyIndex(){await this.store.update(t,Array.from(this.keyIndex))}getStorageKey(t){return`${e}${t}`}async get(e){let t=this.getStorageKey(e);return this.store.get(t)??null}async set(e,t){let n=this.getStorageKey(e);await this.store.update(n,t),this.keyIndex.has(e)||(this.keyIndex.add(e),await this.saveKeyIndex())}async delete(e){let t=this.getStorageKey(e),n=this.keyIndex.has(e);return n&&(await this.store.update(t,void 0),this.keyIndex.delete(e),await this.saveKeyIndex()),n}async has(e){return this.keyIndex.has(e)}async keys(){return Array.from(this.keyIndex)}async clear(){for(let e of this.keyIndex){let t=this.getStorageKey(e);await this.store.update(t,void 0)}this.keyIndex.clear(),await this.saveKeyIndex()}async stats(){return{entryCount:this.keyIndex.size}}};function r(e){return new n(e)}export{n as WorkspaceStateCacheStorage,r as createWorkspaceStateCacheStorage};
@@ -1,255 +1 @@
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 };
1
+ import{DEFAULT_CACHE_CONFIG as e}from"./types.js";import{createHash as t}from"crypto";function n(e){return t(`sha256`).update(e).digest(`hex`)}function r(e){let t=[`spec:${e.specHash.substring(0,16)}`,`impl:${e.implHash.substring(0,16)}`,`tier:${e.tier}`];return e.aiModelVersion&&t.push(`model:${e.aiModelVersion}`),t.join(`|`)}function i(e){try{let t=e.split(`|`),n=new Map;for(let e of t){let[t,r]=e.split(`:`);t&&r&&n.set(t,r)}let r=n.get(`spec`),i=n.get(`impl`),a=n.get(`tier`);return!r||!i||!a?null:{specHash:r,implHash:i,tier:a,aiModelVersion:n.get(`model`)}}catch{return null}}function a(e,t){switch(e){case`structure`:return t.structureTtlMs;case`behavior`:return t.behaviorTtlMs;case`ai_review`:return t.aiTtlMs;default:return t.defaultTtlMs}}var o=class{storage;config;stats;constructor(t,n={}){this.storage=t,this.config={...e,...n},this.stats={hits:0,misses:0}}createKey(e,t,r,i){return{specHash:n(e),implHash:n(t),tier:r,aiModelVersion:r===`ai_review`?i:void 0}}async lookup(e){let t=r(e),n=await this.storage.get(t);if(!n)return this.stats.misses++,{hit:!1,reason:`not_found`};if(n.meta.expiresAt){let e=new Date(n.meta.expiresAt).getTime();if(Date.now()>e)return this.stats.misses++,await this.storage.delete(t),{hit:!1,reason:`expired`}}return n.key.specHash===e.specHash?n.key.implHash===e.implHash?e.tier===`ai_review`&&e.aiModelVersion&&n.key.aiModelVersion!==e.aiModelVersion?(this.stats.misses++,{hit:!1,reason:`model_changed`}):(this.stats.hits++,{hit:!0,entry:n}):(this.stats.misses++,{hit:!1,reason:`impl_changed`}):(this.stats.misses++,{hit:!1,reason:`spec_changed`})}async store(e,t,n={}){let i=r(e),o=a(e.tier,this.config),s={key:e,result:t,meta:{createdAt:new Date().toISOString(),expiresAt:new Date(Date.now()+o).toISOString(),dependencies:n.dependencies??[],specName:n.specName,implPath:n.implPath}};await this.storage.set(i,s),await this.pruneIfNeeded()}async invalidateForFile(e){if(!this.config.transitiveInvalidation)return 0;let t=await this.storage.keys(),n=0;for(let r of t){let t=await this.storage.get(r);t&&(t.meta.dependencies.includes(e)&&(await this.storage.delete(r),n++),(t.meta.specName===e||t.meta.implPath===e)&&(await this.storage.delete(r),n++))}return n}async invalidateForSpec(e){let t=await this.storage.keys(),n=0;for(let r of t){let t=i(r);t&&t.specHash.startsWith(e.substring(0,16))&&(await this.storage.delete(r),n++)}return n}async clear(){await this.storage.clear(),this.stats={hits:0,misses:0}}async getStats(){let e=await this.storage.stats?.();return{totalEntries:e?.entryCount??(await this.storage.keys()).length,hits:this.stats.hits,misses:this.stats.misses,hitRate:this.stats.hits+this.stats.misses>0?Math.round(this.stats.hits/(this.stats.hits+this.stats.misses)*100):0,memoryUsage:e?.memoryUsage}}async pruneIfNeeded(){let e=await this.storage.keys();if(e.length<=this.config.maxEntries)return;let t=[];for(let n of e){let e=await this.storage.get(n);e&&t.push({key:n,createdAt:new Date(e.meta.createdAt).getTime()})}t.sort((e,t)=>e.createdAt-t.createdAt);let n=t.length-this.config.maxEntries;for(let e=0;e<n;e++){let n=t[e];n&&await this.storage.delete(n.key)}}};function s(e,t){return new o(e,t)}export{o as VerificationCacheService,r as cacheKeyToString,n as computeContentHash,s as createVerificationCacheService,i as stringToCacheKey};
@@ -1,6 +1 @@
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";
1
+ import{DEFAULT_CACHE_CONFIG as e}from"./types.js";import{VerificationCacheService as t,cacheKeyToString as n,computeContentHash as r,createVerificationCacheService as i,stringToCacheKey as a}from"./cache-service.js";import{InMemoryCacheStorage as o,createInMemoryCacheStorage as s}from"./adapters/in-memory.js";import{FileSystemCacheStorage as c,createFileSystemCacheStorage as l}from"./adapters/filesystem.js";import{WorkspaceStateCacheStorage as u,createWorkspaceStateCacheStorage as d}from"./adapters/workspace-state.js";import"./adapters/index.js";
@@ -1,15 +1 @@
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 };
1
+ const e={maxEntries:1e3,defaultTtlMs:1440*60*1e3,structureTtlMs:10080*60*1e3,behaviorTtlMs:1440*60*1e3,aiTtlMs:1440*60*1e3,transitiveInvalidation:!0};export{e as DEFAULT_CACHE_CONFIG};