agent-rulebook 0.1.6 → 0.2.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.
Files changed (284) hide show
  1. package/README.md +54 -138
  2. package/dist/commands/index.js +11 -10
  3. package/dist/commands/index.js.map +1 -1
  4. package/dist/commands/init.js +3 -6
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/output.d.ts +0 -5
  7. package/dist/commands/output.js +0 -47
  8. package/dist/commands/output.js.map +1 -1
  9. package/dist/commands/project.d.ts +2 -0
  10. package/dist/commands/project.js +33 -0
  11. package/dist/commands/project.js.map +1 -0
  12. package/dist/commands/resolution.d.ts +2 -0
  13. package/dist/commands/resolution.js +32 -0
  14. package/dist/commands/resolution.js.map +1 -0
  15. package/dist/commands/sync.d.ts +6 -3
  16. package/dist/commands/sync.js +130 -177
  17. package/dist/commands/sync.js.map +1 -1
  18. package/dist/core/attempt-outcome.d.ts +21 -0
  19. package/dist/core/attempt-outcome.js +61 -0
  20. package/dist/core/attempt-outcome.js.map +1 -0
  21. package/dist/core/change-policy.d.ts +7 -0
  22. package/dist/core/change-policy.js +14 -0
  23. package/dist/core/change-policy.js.map +1 -0
  24. package/dist/core/index.d.ts +34 -31
  25. package/dist/core/index.js +18 -13
  26. package/dist/core/index.js.map +1 -1
  27. package/dist/core/outcome-schema.d.ts +55 -0
  28. package/dist/core/outcome-schema.js +44 -0
  29. package/dist/core/outcome-schema.js.map +1 -0
  30. package/dist/core/problem-fingerprint.d.ts +4 -0
  31. package/dist/core/problem-fingerprint.js +37 -0
  32. package/dist/core/problem-fingerprint.js.map +1 -0
  33. package/dist/core/problem-schema.d.ts +34 -0
  34. package/dist/core/problem-schema.js +37 -0
  35. package/dist/core/problem-schema.js.map +1 -0
  36. package/dist/core/project-environment-detector.d.ts +2 -2
  37. package/dist/core/project-environment-detector.js +8 -52
  38. package/dist/core/project-environment-detector.js.map +1 -1
  39. package/dist/core/project-file-scan.d.ts +17 -0
  40. package/dist/core/project-file-scan.js +73 -0
  41. package/dist/core/project-file-scan.js.map +1 -0
  42. package/dist/core/project-registry.d.ts +8 -0
  43. package/dist/core/project-registry.js +38 -0
  44. package/dist/core/project-registry.js.map +1 -0
  45. package/dist/core/repository-identity.d.ts +7 -0
  46. package/dist/core/repository-identity.js +27 -0
  47. package/dist/core/repository-identity.js.map +1 -0
  48. package/dist/core/resolution-applicability.d.ts +20 -0
  49. package/dist/core/resolution-applicability.js +38 -0
  50. package/dist/core/resolution-applicability.js.map +1 -0
  51. package/dist/core/resolution-parser.d.ts +20 -0
  52. package/dist/core/resolution-parser.js +47 -0
  53. package/dist/core/resolution-parser.js.map +1 -0
  54. package/dist/core/resolution-ranker.d.ts +34 -0
  55. package/dist/core/resolution-ranker.js +40 -0
  56. package/dist/core/resolution-ranker.js.map +1 -0
  57. package/dist/core/resolution-relation.d.ts +14 -0
  58. package/dist/core/resolution-relation.js +29 -0
  59. package/dist/core/resolution-relation.js.map +1 -0
  60. package/dist/core/resolution-schema.d.ts +109 -0
  61. package/dist/core/resolution-schema.js +29 -0
  62. package/dist/core/resolution-schema.js.map +1 -0
  63. package/dist/core/resolution-search-types.d.ts +37 -0
  64. package/dist/core/resolution-search-types.js +2 -0
  65. package/dist/core/resolution-search-types.js.map +1 -0
  66. package/dist/core/resolution-semantic-checksum.d.ts +12 -0
  67. package/dist/core/resolution-semantic-checksum.js +24 -0
  68. package/dist/core/resolution-semantic-checksum.js.map +1 -0
  69. package/dist/core/resolution-writer.d.ts +7 -0
  70. package/dist/core/resolution-writer.js +33 -0
  71. package/dist/core/resolution-writer.js.map +1 -0
  72. package/dist/core/solution-schema.d.ts +42 -0
  73. package/dist/core/solution-schema.js +28 -0
  74. package/dist/core/solution-schema.js.map +1 -0
  75. package/dist/core/source-evidence-schema.d.ts +26 -0
  76. package/dist/core/source-evidence-schema.js +29 -0
  77. package/dist/core/source-evidence-schema.js.map +1 -0
  78. package/dist/core/source-evidence.d.ts +14 -0
  79. package/dist/core/source-evidence.js +69 -0
  80. package/dist/core/source-evidence.js.map +1 -0
  81. package/dist/core/stack-detector.d.ts +2 -2
  82. package/dist/core/stack-detector.js +11 -63
  83. package/dist/core/stack-detector.js.map +1 -1
  84. package/dist/index.d.ts +3 -4
  85. package/dist/index.js +2 -2
  86. package/dist/index.js.map +1 -1
  87. package/dist/mcp/index.d.ts +3 -3
  88. package/dist/mcp/index.js +2 -2
  89. package/dist/mcp/index.js.map +1 -1
  90. package/dist/mcp/resolution-change.d.ts +19 -0
  91. package/dist/mcp/resolution-change.js +136 -0
  92. package/dist/mcp/resolution-change.js.map +1 -0
  93. package/dist/mcp/resolutions-commit-change-tool.d.ts +5 -0
  94. package/dist/mcp/resolutions-commit-change-tool.js +21 -0
  95. package/dist/mcp/resolutions-commit-change-tool.js.map +1 -0
  96. package/dist/mcp/resolutions-find-tool.d.ts +5 -0
  97. package/dist/mcp/resolutions-find-tool.js +75 -0
  98. package/dist/mcp/resolutions-find-tool.js.map +1 -0
  99. package/dist/mcp/resolutions-get-source-tool.d.ts +5 -0
  100. package/dist/mcp/resolutions-get-source-tool.js +30 -0
  101. package/dist/mcp/resolutions-get-source-tool.js.map +1 -0
  102. package/dist/mcp/resolutions-get-tool.d.ts +5 -0
  103. package/dist/mcp/resolutions-get-tool.js +27 -0
  104. package/dist/mcp/resolutions-get-tool.js.map +1 -0
  105. package/dist/mcp/resolutions-list-facets-tool.d.ts +4 -0
  106. package/dist/mcp/resolutions-list-facets-tool.js +18 -0
  107. package/dist/mcp/resolutions-list-facets-tool.js.map +1 -0
  108. package/dist/mcp/resolutions-prepare-change-tool.d.ts +5 -0
  109. package/dist/mcp/resolutions-prepare-change-tool.js +7 -0
  110. package/dist/mcp/resolutions-prepare-change-tool.js.map +1 -0
  111. package/dist/mcp/resolutions-report-attempt-tool.d.ts +5 -0
  112. package/dist/mcp/resolutions-report-attempt-tool.js +87 -0
  113. package/dist/mcp/resolutions-report-attempt-tool.js.map +1 -0
  114. package/dist/mcp/schemas.d.ts +265 -197
  115. package/dist/mcp/schemas.js +28 -93
  116. package/dist/mcp/schemas.js.map +1 -1
  117. package/dist/mcp/tool-output.d.ts +0 -34
  118. package/dist/mcp/tool-output.js +2 -71
  119. package/dist/mcp/tool-output.js.map +1 -1
  120. package/dist/mcp/tools.d.ts +973 -204
  121. package/dist/mcp/tools.js +47 -101
  122. package/dist/mcp/tools.js.map +1 -1
  123. package/dist/program.js +5 -9
  124. package/dist/program.js.map +1 -1
  125. package/dist/storage/index.d.ts +10 -15
  126. package/dist/storage/index.js +8 -8
  127. package/dist/storage/index.js.map +1 -1
  128. package/dist/storage/project-code-index-source.d.ts +2 -0
  129. package/dist/storage/project-code-index-source.js +23 -0
  130. package/dist/storage/project-code-index-source.js.map +1 -0
  131. package/dist/storage/resolution-candidate-service.d.ts +6 -0
  132. package/dist/storage/resolution-candidate-service.js +94 -0
  133. package/dist/storage/resolution-candidate-service.js.map +1 -0
  134. package/dist/storage/resolution-change-transaction.d.ts +11 -0
  135. package/dist/storage/resolution-change-transaction.js +56 -0
  136. package/dist/storage/resolution-change-transaction.js.map +1 -0
  137. package/dist/storage/resolution-home.d.ts +20 -0
  138. package/dist/storage/resolution-home.js +59 -0
  139. package/dist/storage/resolution-home.js.map +1 -0
  140. package/dist/storage/resolution-index-check.d.ts +28 -0
  141. package/dist/storage/resolution-index-check.js +30 -0
  142. package/dist/storage/resolution-index-check.js.map +1 -0
  143. package/dist/storage/resolution-indexer.d.ts +19 -0
  144. package/dist/storage/resolution-indexer.js +158 -0
  145. package/dist/storage/resolution-indexer.js.map +1 -0
  146. package/dist/storage/resolution-migrations.d.ts +3 -0
  147. package/dist/storage/resolution-migrations.js +39 -0
  148. package/dist/storage/resolution-migrations.js.map +1 -0
  149. package/package.json +5 -3
  150. package/dist/commands/add.d.ts +0 -2
  151. package/dist/commands/add.js +0 -134
  152. package/dist/commands/add.js.map +0 -1
  153. package/dist/commands/migrate.d.ts +0 -2
  154. package/dist/commands/migrate.js +0 -73
  155. package/dist/commands/migrate.js.map +0 -1
  156. package/dist/commands/rule.d.ts +0 -23
  157. package/dist/commands/rule.js +0 -158
  158. package/dist/commands/rule.js.map +0 -1
  159. package/dist/commands/search.d.ts +0 -2
  160. package/dist/commands/search.js +0 -57
  161. package/dist/commands/search.js.map +0 -1
  162. package/dist/core/compatibility-matcher.d.ts +0 -17
  163. package/dist/core/compatibility-matcher.js +0 -146
  164. package/dist/core/compatibility-matcher.js.map +0 -1
  165. package/dist/core/dedup.d.ts +0 -22
  166. package/dist/core/dedup.js +0 -54
  167. package/dist/core/dedup.js.map +0 -1
  168. package/dist/core/error-signature.d.ts +0 -15
  169. package/dist/core/error-signature.js +0 -59
  170. package/dist/core/error-signature.js.map +0 -1
  171. package/dist/core/facets.d.ts +0 -9
  172. package/dist/core/facets.js +0 -46
  173. package/dist/core/facets.js.map +0 -1
  174. package/dist/core/lesson-importer.d.ts +0 -22
  175. package/dist/core/lesson-importer.js +0 -94
  176. package/dist/core/lesson-importer.js.map +0 -1
  177. package/dist/core/ranker.d.ts +0 -3
  178. package/dist/core/ranker.js +0 -83
  179. package/dist/core/ranker.js.map +0 -1
  180. package/dist/core/rule-compatibility.d.ts +0 -66
  181. package/dist/core/rule-compatibility.js +0 -53
  182. package/dist/core/rule-compatibility.js.map +0 -1
  183. package/dist/core/rule-parser.d.ts +0 -25
  184. package/dist/core/rule-parser.js +0 -81
  185. package/dist/core/rule-parser.js.map +0 -1
  186. package/dist/core/rule-schema.d.ts +0 -265
  187. package/dist/core/rule-schema.js +0 -202
  188. package/dist/core/rule-schema.js.map +0 -1
  189. package/dist/core/rule-writer.d.ts +0 -35
  190. package/dist/core/rule-writer.js +0 -63
  191. package/dist/core/rule-writer.js.map +0 -1
  192. package/dist/core/search-types.d.ts +0 -57
  193. package/dist/core/search-types.js +0 -2
  194. package/dist/core/search-types.js.map +0 -1
  195. package/dist/core/semantic-checksum.d.ts +0 -6
  196. package/dist/core/semantic-checksum.js +0 -34
  197. package/dist/core/semantic-checksum.js.map +0 -1
  198. package/dist/core/slug.d.ts +0 -13
  199. package/dist/core/slug.js +0 -42
  200. package/dist/core/slug.js.map +0 -1
  201. package/dist/mcp/lesson-capture.d.ts +0 -30
  202. package/dist/mcp/lesson-capture.js +0 -144
  203. package/dist/mcp/lesson-capture.js.map +0 -1
  204. package/dist/mcp/rules-add-lesson-tool.d.ts +0 -4
  205. package/dist/mcp/rules-add-lesson-tool.js +0 -73
  206. package/dist/mcp/rules-add-lesson-tool.js.map +0 -1
  207. package/dist/mcp/rules-dedup-lesson-tool.d.ts +0 -4
  208. package/dist/mcp/rules-dedup-lesson-tool.js +0 -69
  209. package/dist/mcp/rules-dedup-lesson-tool.js.map +0 -1
  210. package/dist/mcp/rules-list-facets-tool.d.ts +0 -3
  211. package/dist/mcp/rules-list-facets-tool.js +0 -31
  212. package/dist/mcp/rules-list-facets-tool.js.map +0 -1
  213. package/dist/mcp/rules-prepare-lesson-tool.d.ts +0 -4
  214. package/dist/mcp/rules-prepare-lesson-tool.js +0 -7
  215. package/dist/mcp/rules-prepare-lesson-tool.js.map +0 -1
  216. package/dist/mcp/rules-search-error-tool.d.ts +0 -4
  217. package/dist/mcp/rules-search-error-tool.js +0 -103
  218. package/dist/mcp/rules-search-error-tool.js.map +0 -1
  219. package/dist/mcp/rules-search-for-project-tool.d.ts +0 -4
  220. package/dist/mcp/rules-search-for-project-tool.js +0 -105
  221. package/dist/mcp/rules-search-for-project-tool.js.map +0 -1
  222. package/dist/mcp/rules-search-tool.d.ts +0 -7
  223. package/dist/mcp/rules-search-tool.js +0 -65
  224. package/dist/mcp/rules-search-tool.js.map +0 -1
  225. package/dist/migration/adapters/fenced-lessons.d.ts +0 -2
  226. package/dist/migration/adapters/fenced-lessons.js +0 -55
  227. package/dist/migration/adapters/fenced-lessons.js.map +0 -1
  228. package/dist/migration/adapters/global-rules.d.ts +0 -2
  229. package/dist/migration/adapters/global-rules.js +0 -72
  230. package/dist/migration/adapters/global-rules.js.map +0 -1
  231. package/dist/migration/adapters/index.d.ts +0 -2
  232. package/dist/migration/adapters/index.js +0 -13
  233. package/dist/migration/adapters/index.js.map +0 -1
  234. package/dist/migration/adapters/markdown-lessons.d.ts +0 -2
  235. package/dist/migration/adapters/markdown-lessons.js +0 -36
  236. package/dist/migration/adapters/markdown-lessons.js.map +0 -1
  237. package/dist/migration/adapters/structured-lessons.d.ts +0 -2
  238. package/dist/migration/adapters/structured-lessons.js +0 -8
  239. package/dist/migration/adapters/structured-lessons.js.map +0 -1
  240. package/dist/migration/adapters/structured-shared.d.ts +0 -3
  241. package/dist/migration/adapters/structured-shared.js +0 -97
  242. package/dist/migration/adapters/structured-shared.js.map +0 -1
  243. package/dist/migration/applier.d.ts +0 -32
  244. package/dist/migration/applier.js +0 -559
  245. package/dist/migration/applier.js.map +0 -1
  246. package/dist/migration/index.d.ts +0 -11
  247. package/dist/migration/index.js +0 -7
  248. package/dist/migration/index.js.map +0 -1
  249. package/dist/migration/manifest.d.ts +0 -263
  250. package/dist/migration/manifest.js +0 -91
  251. package/dist/migration/manifest.js.map +0 -1
  252. package/dist/migration/migration-report.d.ts +0 -151
  253. package/dist/migration/migration-report.js +0 -85
  254. package/dist/migration/migration-report.js.map +0 -1
  255. package/dist/migration/scanner.d.ts +0 -2
  256. package/dist/migration/scanner.js +0 -312
  257. package/dist/migration/scanner.js.map +0 -1
  258. package/dist/migration/source-adapter.d.ts +0 -37
  259. package/dist/migration/source-adapter.js +0 -2
  260. package/dist/migration/source-adapter.js.map +0 -1
  261. package/dist/migration/verifier.d.ts +0 -5
  262. package/dist/migration/verifier.js +0 -218
  263. package/dist/migration/verifier.js.map +0 -1
  264. package/dist/storage/index-check.d.ts +0 -21
  265. package/dist/storage/index-check.js +0 -136
  266. package/dist/storage/index-check.js.map +0 -1
  267. package/dist/storage/indexer.d.ts +0 -19
  268. package/dist/storage/indexer.js +0 -367
  269. package/dist/storage/indexer.js.map +0 -1
  270. package/dist/storage/migrations.d.ts +0 -3
  271. package/dist/storage/migrations.js +0 -126
  272. package/dist/storage/migrations.js.map +0 -1
  273. package/dist/storage/rule-discovery.d.ts +0 -4
  274. package/dist/storage/rule-discovery.js +0 -34
  275. package/dist/storage/rule-discovery.js.map +0 -1
  276. package/dist/storage/rule-store.d.ts +0 -10
  277. package/dist/storage/rule-store.js +0 -12
  278. package/dist/storage/rule-store.js.map +0 -1
  279. package/dist/storage/rulebook-home.d.ts +0 -21
  280. package/dist/storage/rulebook-home.js +0 -78
  281. package/dist/storage/rulebook-home.js.map +0 -1
  282. package/dist/storage/search-service.d.ts +0 -17
  283. package/dist/storage/search-service.js +0 -275
  284. package/dist/storage/search-service.js.map +0 -1
package/dist/mcp/tools.js CHANGED
@@ -1,123 +1,69 @@
1
- import { MCP_DEFAULT_SEARCH_LIMIT, MCP_MAX_SEARCH_LIMIT, McpAddLessonInputSchema, McpDedupLessonInputSchema, McpListFacetsInputSchema, McpPrepareLessonInputSchema, McpSearchErrorInputSchema, McpSearchForProjectInputSchema, McpSearchInputSchema, } from './schemas.js';
2
- import { handleRulesAddLesson } from './rules-add-lesson-tool.js';
3
- import { handleRulesDedupLesson } from './rules-dedup-lesson-tool.js';
4
- import { handleRulesListFacets } from './rules-list-facets-tool.js';
5
- import { handleRulesPrepareLesson } from './rules-prepare-lesson-tool.js';
6
- import { handleRulesSearchError } from './rules-search-error-tool.js';
7
- import { handleRulesSearchForProject } from './rules-search-for-project-tool.js';
8
- import { handleRulesSearch } from './rules-search-tool.js';
9
- import { jsonToolResult } from './tool-output.js';
10
- export const MCP_SEARCH_LIMIT_POLICY = {
11
- defaultLimit: MCP_DEFAULT_SEARCH_LIMIT,
12
- maxLimit: MCP_MAX_SEARCH_LIMIT,
13
- };
1
+ import { MCP_DEFAULT_SEARCH_LIMIT, MCP_MAX_SEARCH_LIMIT, McpResolutionsFindInputSchema, McpResolutionsGetInputSchema, McpResolutionsGetSourceInputSchema, McpResolutionsListFacetsInputSchema, McpResolutionsReportAttemptInputSchema, McpResolutionsPrepareChangeInputSchema, McpResolutionsCommitChangeInputSchema, } from './schemas.js';
2
+ import { handleResolutionsFind } from './resolutions-find-tool.js';
3
+ import { handleResolutionsGet } from './resolutions-get-tool.js';
4
+ import { handleResolutionsGetSource } from './resolutions-get-source-tool.js';
5
+ import { handleResolutionsListFacets } from './resolutions-list-facets-tool.js';
6
+ import { handleResolutionsReportAttempt } from './resolutions-report-attempt-tool.js';
7
+ import { handleResolutionsPrepareChange } from './resolutions-prepare-change-tool.js';
8
+ import { handleResolutionsCommitChange } from './resolutions-commit-change-tool.js';
9
+ export const MCP_SEARCH_LIMIT_POLICY = { defaultLimit: MCP_DEFAULT_SEARCH_LIMIT, maxLimit: MCP_MAX_SEARCH_LIMIT };
14
10
  export const AGENT_RULEBOOK_MCP_TOOL_NAMES = [
15
- 'rules.search',
16
- 'rules.search_for_project',
17
- 'rules.search_error',
18
- 'rules.list_facets',
19
- 'rules.dedup_lesson',
20
- 'rules.prepare_lesson',
21
- 'rules.add_lesson',
11
+ 'resolutions.find',
12
+ 'resolutions.get',
13
+ 'resolutions.get_source',
14
+ 'resolutions.list_facets',
15
+ 'resolutions.report_attempt',
16
+ 'resolutions.prepare_change',
17
+ 'resolutions.commit_change',
22
18
  ];
23
19
  export const AGENT_RULEBOOK_MCP_TOOLS = [
24
20
  {
25
- name: 'rules.search',
26
- title: 'Search rules',
27
- description: 'Search shared rules and compatible project-scoped reference candidates by natural-language query and optional filters.',
28
- inputSchema: McpSearchInputSchema,
29
- annotations: readOnlyAnnotations(),
30
- handler: handleSearch,
21
+ name: 'resolutions.find', title: 'Find applicable resolutions',
22
+ description: 'Call at the first unexpected problem. Separate observations from hypotheses, then inspect match evidence and required checks before applying one candidate.',
23
+ inputSchema: McpResolutionsFindInputSchema, annotations: readOnlyAnnotations(), handler: handleFind,
31
24
  },
32
25
  {
33
- name: 'rules.search_for_project',
34
- title: 'Search rules for project',
35
- description: 'Search current-project, shared, and compatible foreign-project reference rules using a project path and task description.',
36
- inputSchema: McpSearchForProjectInputSchema,
37
- annotations: readOnlyAnnotations(),
38
- handler: handleSearchForProject,
26
+ name: 'resolutions.get', title: 'Get a resolution',
27
+ description: 'Read the selected solution applicability, inspections, actions, verification, safety, and source handles.',
28
+ inputSchema: McpResolutionsGetInputSchema, annotations: readOnlyAnnotations(), handler: handleGet,
39
29
  },
40
30
  {
41
- name: 'rules.search_error',
42
- title: 'Search rules for error log',
43
- description: 'Search rules using a build or test error log.',
44
- inputSchema: McpSearchErrorInputSchema,
45
- annotations: readOnlyAnnotations(),
46
- handler: handleSearchError,
31
+ name: 'resolutions.get_source', title: 'Get exact source evidence',
32
+ description: 'Read one registered source handle at its recorded revision and hash; arbitrary paths are not accepted.',
33
+ inputSchema: McpResolutionsGetSourceInputSchema, annotations: readOnlyAnnotations(), handler: handleGetSource,
47
34
  },
48
35
  {
49
- name: 'rules.list_facets',
50
- title: 'List rule facets',
51
- description: 'List canonical rule facets, aliases, and indexed counts.',
52
- inputSchema: McpListFacetsInputSchema,
53
- annotations: readOnlyAnnotations(),
54
- handler: handleListFacets,
36
+ name: 'resolutions.list_facets', title: 'List resolution facets',
37
+ description: 'List canonical environment facets and indexed counts.',
38
+ inputSchema: McpResolutionsListFacetsInputSchema, annotations: readOnlyAnnotations(), handler: handleListFacets,
55
39
  },
56
40
  {
57
- name: 'rules.dedup_lesson',
58
- title: 'Deduplicate lesson',
59
- description: 'Classify a lesson candidate as duplicate, related, or new.',
60
- inputSchema: McpDedupLessonInputSchema,
61
- annotations: readOnlyAnnotations(),
62
- handler: handleDedupLesson,
41
+ name: 'resolutions.report_attempt', title: 'Report resolution attempt',
42
+ description: 'Report the verified result of one exact solution revision.',
43
+ inputSchema: McpResolutionsReportAttemptInputSchema, annotations: writeAnnotations(true), handler: handleReportAttempt,
63
44
  },
64
45
  {
65
- name: 'rules.prepare_lesson',
66
- title: 'Prepare lesson rule',
67
- description: 'Validate, redact, scope, deduplicate, and hash a lesson without writing.',
68
- inputSchema: McpPrepareLessonInputSchema,
69
- annotations: readOnlyAnnotations(),
70
- handler: handlePrepareLesson,
46
+ name: 'resolutions.prepare_change', title: 'Prepare verified resolution change',
47
+ description: 'Validate and classify a verified resolution change without writing.',
48
+ inputSchema: McpResolutionsPrepareChangeInputSchema, annotations: readOnlyAnnotations(), handler: handlePrepareChange,
71
49
  },
72
50
  {
73
- name: 'rules.add_lesson',
74
- title: 'Append lesson rule',
75
- description: 'Append an eligible prepared lesson as a new active rule and rebuild the index.',
76
- inputSchema: McpAddLessonInputSchema,
77
- annotations: {
78
- readOnlyHint: false,
79
- destructiveHint: false,
80
- idempotentHint: false,
81
- openWorldHint: false,
82
- },
83
- handler: handleAddLesson,
51
+ name: 'resolutions.commit_change', title: 'Commit verified resolution change',
52
+ description: 'Commit an unchanged prepared resolution payload and rebuild the index.',
53
+ inputSchema: McpResolutionsCommitChangeInputSchema, annotations: writeAnnotations(true), handler: handleCommitChange,
84
54
  },
85
55
  ];
86
- async function handleSearch(args, context) {
87
- return handleRulesSearch(args, context);
88
- }
89
- async function handleSearchForProject(args, context) {
90
- return handleRulesSearchForProject(args, context);
91
- }
92
- async function handleSearchError(args, context) {
93
- return handleRulesSearchError(args, context);
94
- }
95
- async function handleDedupLesson(args, context) {
96
- return handleRulesDedupLesson(args, context);
97
- }
98
- async function handleListFacets(args, context) {
99
- return handleRulesListFacets(args, context);
100
- }
101
- async function handlePrepareLesson(args, context) {
102
- return handleRulesPrepareLesson(args, context);
103
- }
104
- async function handleAddLesson(args, context) {
105
- return handleRulesAddLesson(args, context);
106
- }
56
+ async function handleFind(args, context) { return handleResolutionsFind(args, context); }
57
+ async function handleGet(args, context) { return handleResolutionsGet(args, context); }
58
+ async function handleGetSource(args, context) { return handleResolutionsGetSource(args, context); }
59
+ async function handleListFacets(args, context) { return handleResolutionsListFacets(args, context); }
60
+ async function handleReportAttempt(args, context) { return handleResolutionsReportAttempt(args, context); }
61
+ async function handlePrepareChange(args, context) { return handleResolutionsPrepareChange(args, context); }
62
+ async function handleCommitChange(args, context) { return handleResolutionsCommitChange(args, context); }
107
63
  function readOnlyAnnotations() {
108
- return {
109
- readOnlyHint: true,
110
- destructiveHint: false,
111
- idempotentHint: true,
112
- openWorldHint: false,
113
- };
64
+ return { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
114
65
  }
115
- export function notImplementedToolResult(tool) {
116
- return jsonToolResult({
117
- status: 'error',
118
- code: 'not_implemented',
119
- tool,
120
- message: `${tool} is registered but not implemented in this step.`,
121
- }, true);
66
+ function writeAnnotations(idempotent) {
67
+ return { readOnlyHint: false, destructiveHint: false, idempotentHint: idempotent, openWorldHint: false };
122
68
  }
123
69
  //# sourceMappingURL=tools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,8BAA8B,EAC9B,oBAAoB,GAQrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,YAAY,EAAE,wBAAwB;IACtC,QAAQ,EAAE,oBAAoB;CACtB,CAAC;AAEX,MAAM,CAAC,MAAM,6BAA6B,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qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAC5I,KAAK,UAAU,SAAS,CAAC,IAA4B,EAAE,OAAiC,IAAI,OAAO,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACzI,KAAK,UAAU,eAAe,CAAC,IAAkC,EAAE,OAAiC,IAAI,OAAO,0BAA0B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3J,KAAK,UAAU,gBAAgB,CAAC,IAAmC,EAAE,OAAiC,IAAI,OAAO,2BAA2B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAC9J,KAAK,UAAU,mBAAmB,CAAC,IAAsC,EAAE,OAAiC,IAAI,OAAO,8BAA8B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACvK,KAAK,UAAU,mBAAmB,CAAC,IAAsC,EAAE,OAAiC,IAAI,OAAO,8BAA8B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AACvK,KAAK,UAAU,kBAAkB,CAAC,IAAqC,EAAE,OAAiC,IAAI,OAAO,6BAA6B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAEpK,SAAS,mBAAmB;IAC1B,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAW,CAAC;AAC7G,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAmB;IAC3C,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAW,CAAC;AACpH,CAAC"}
package/dist/program.js CHANGED
@@ -1,25 +1,21 @@
1
1
  import { Command } from 'commander';
2
- import { registerAddCommand } from './commands/add.js';
3
2
  import { registerIndexCommand } from './commands/index.js';
4
3
  import { registerInitCommand } from './commands/init.js';
5
4
  import { registerMcpCommand } from './commands/mcp.js';
6
- import { registerMigrateCommand } from './commands/migrate.js';
7
- import { registerSearchCommand } from './commands/search.js';
8
- import { registerRuleCommand } from './commands/rule.js';
5
+ import { registerProjectCommand } from './commands/project.js';
6
+ import { registerResolutionCommand } from './commands/resolution.js';
9
7
  import { registerSyncCommand } from './commands/sync.js';
10
8
  import { AGENT_RULEBOOK_VERSION } from './version.js';
11
9
  export function createCliProgram() {
12
10
  const program = new Command()
13
11
  .name('agent-rulebook')
14
- .description('Manage reusable agent rules')
12
+ .description('Agent-native problem, solution, and verified outcome memory')
15
13
  .version(AGENT_RULEBOOK_VERSION);
16
14
  registerInitCommand(program);
17
- registerAddCommand(program);
18
15
  registerIndexCommand(program);
19
16
  registerMcpCommand(program);
20
- registerMigrateCommand(program);
21
- registerSearchCommand(program);
22
- registerRuleCommand(program);
17
+ registerProjectCommand(program);
18
+ registerResolutionCommand(program);
23
19
  registerSyncCommand(program);
24
20
  return program;
25
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,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AC;IAC7B,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC5B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACnC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE7B,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,16 +1,11 @@
1
- export { createRulebookLayout } from './rulebook-home.js';
1
+ export { createResolutionIndexSchema, RESOLUTION_DATABASE_VERSION } from './resolution-migrations.js';
2
+ export { loadCanonicalResolutions, rebuildResolutionIndex } from './resolution-indexer.js';
3
+ export { checkResolutionIndex } from './resolution-index-check.js';
4
+ export { findResolutionCandidates } from './resolution-candidate-service.js';
5
+ export { commitResolutionDocuments } from './resolution-change-transaction.js';
6
+ export { isSafeTrackedPath, listSafeTrackedFiles } from './project-code-index-source.js';
7
+ export { createResolutionHome, executeLegacyReset, previewLegacyReset, LEGACY_RESET_TARGETS, RESOLUTION_HOME_DIRECTORIES, RESOLUTION_HOME_FILES } from './resolution-home.js';
2
8
  export { replaceFileAtomically } from './atomic-file.js';
3
- export { checkRulebookIndex } from './index-check.js';
4
- export { RulebookIndexCorruptError, RulebookIndexLockTimeoutError, RulebookIndexMigrationError, RulebookIndexRebuildError, rebuildRulebookIndex, } from './indexer.js';
5
- export { CURRENT_RULEBOOK_DATABASE_VERSION, migrateRulebookDatabase, } from './migrations.js';
6
- export { SEARCH_LIMIT_POLICIES, searchRules } from './search-service.js';
7
- export { discoverRuleFiles } from './rule-discovery.js';
8
- export { closeRulebookDatabase, openRulebookDatabase, readRulebookDatabaseRuntime, } from './sqlite.js';
9
- export { saveRulePreview } from './rule-store.js';
10
- export type { CheckRulebookIndexOptions, IndexCheckResult, IndexRuntimeCheck, IndexCheckStatus, } from './index-check.js';
11
- export type { SearchRulesOptions } from './search-service.js';
12
- export type { RebuildRulebookIndexOptions, RebuildRulebookIndexResult, SkippedRuleFile, } from './indexer.js';
13
- export type { DiscoverRuleFilesOptions } from './rule-discovery.js';
14
- export type { OpenRulebookDatabaseOptions, RulebookDatabase, RulebookDatabaseRuntime, } from './sqlite.js';
15
- export type { SaveRulePreviewOptions, SaveRulePreviewResult } from './rule-store.js';
16
- export type { CreateRulebookLayoutOptions, CreateRulebookLayoutResult, RulebookLayoutEntry, RulebookLayoutEntryKind, RulebookLayoutEntryStatus, } from './rulebook-home.js';
9
+ export { closeRulebookDatabase, openRulebookDatabase, readRulebookDatabaseRuntime } from './sqlite.js';
10
+ export type { RebuildResolutionIndexOptions } from './resolution-indexer.js';
11
+ export type { OpenRulebookDatabaseOptions, RulebookDatabase, RulebookDatabaseRuntime } from './sqlite.js';
@@ -1,10 +1,10 @@
1
- export { createRulebookLayout } from './rulebook-home.js';
1
+ export { createResolutionIndexSchema, RESOLUTION_DATABASE_VERSION } from './resolution-migrations.js';
2
+ export { loadCanonicalResolutions, rebuildResolutionIndex } from './resolution-indexer.js';
3
+ export { checkResolutionIndex } from './resolution-index-check.js';
4
+ export { findResolutionCandidates } from './resolution-candidate-service.js';
5
+ export { commitResolutionDocuments } from './resolution-change-transaction.js';
6
+ export { isSafeTrackedPath, listSafeTrackedFiles } from './project-code-index-source.js';
7
+ export { createResolutionHome, executeLegacyReset, previewLegacyReset, LEGACY_RESET_TARGETS, RESOLUTION_HOME_DIRECTORIES, RESOLUTION_HOME_FILES } from './resolution-home.js';
2
8
  export { replaceFileAtomically } from './atomic-file.js';
3
- export { checkRulebookIndex } from './index-check.js';
4
- export { RulebookIndexCorruptError, RulebookIndexLockTimeoutError, RulebookIndexMigrationError, RulebookIndexRebuildError, rebuildRulebookIndex, } from './indexer.js';
5
- export { CURRENT_RULEBOOK_DATABASE_VERSION, migrateRulebookDatabase, } from './migrations.js';
6
- export { SEARCH_LIMIT_POLICIES, searchRules } from './search-service.js';
7
- export { discoverRuleFiles } from './rule-discovery.js';
8
- export { closeRulebookDatabase, openRulebookDatabase, readRulebookDatabaseRuntime, } from './sqlite.js';
9
- export { saveRulePreview } from './rule-store.js';
9
+ export { closeRulebookDatabase, openRulebookDatabase, readRulebookDatabaseRuntime } from './sqlite.js';
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iCAAiC,EACjC,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9K,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function listSafeTrackedFiles(projectRoot: string): Promise<string[]>;
2
+ export declare function isSafeTrackedPath(relativePath: string): boolean;
@@ -0,0 +1,23 @@
1
+ import { extname } from 'node:path';
2
+ import { runGit, splitGitLines } from '../core/git.js';
3
+ const EXCLUDED_SEGMENTS = new Set([
4
+ '.build', 'build', 'dist', 'artifacts', 'artifact', 'deriveddata', 'node_modules', '.git',
5
+ ]);
6
+ const BINARY_EXTENSIONS = new Set([
7
+ '.png', '.jpg', '.jpeg', '.gif', '.pdf', '.zip', '.gz', '.sqlite', '.db', '.mov', '.mp4', '.a', '.o',
8
+ ]);
9
+ const SECRET_NAMES = /(^|\/)(\.env(?:\..*)?|id_rsa|id_ed25519|.*\.(?:pem|p12|key))$/i;
10
+ export async function listSafeTrackedFiles(projectRoot) {
11
+ const result = await runGit(projectRoot, ['ls-files']);
12
+ if (result.exitCode !== 0)
13
+ throw new Error('Unable to list tracked project files');
14
+ return splitGitLines(result.stdout).filter(isSafeTrackedPath);
15
+ }
16
+ export function isSafeTrackedPath(relativePath) {
17
+ const normalized = relativePath.replace(/\\/g, '/');
18
+ const segments = normalized.toLowerCase().split('/');
19
+ return !segments.some((segment) => EXCLUDED_SEGMENTS.has(segment))
20
+ && !BINARY_EXTENSIONS.has(extname(normalized).toLowerCase())
21
+ && !SECRET_NAMES.test(normalized);
22
+ }
23
+ //# sourceMappingURL=project-code-index-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-code-index-source.js","sourceRoot":"","sources":["../../src/storage/project-code-index-source.ts"],"names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AO,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;WACzD,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ProblemSearchInput, ResolutionCandidateResponse } from '../core/resolution-search-types.js';
2
+ export declare function findResolutionCandidates(options: {
3
+ indexPath: string;
4
+ input: ProblemSearchInput;
5
+ limit?: number;
6
+ }): ResolutionCandidateResponse;
@@ -0,0 +1,94 @@
1
+ import { closeRulebookDatabase, openRulebookDatabase } from './sqlite.js';
2
+ import { fingerprintProblem, normalizeProblemInput, normalizeSearchText } from '../core/problem-fingerprint.js';
3
+ const STOP_TOKENS = new Set(['the', 'and', 'for', 'with', 'from', 'that', 'this', 'when', 'into', 'after', 'before', 'error', 'issue', 'problem']);
4
+ export function findResolutionCandidates(options) {
5
+ const input = normalizeProblemInput(options.input);
6
+ const fingerprint = fingerprintProblem(input);
7
+ const database = openRulebookDatabase({ databasePath: options.indexPath });
8
+ try {
9
+ const problems = database.prepare('SELECT id, title, observations, hypotheses FROM problems').all();
10
+ const solutions = database.prepare('SELECT * FROM solutions').all();
11
+ const sources = database.prepare('SELECT * FROM source_chunks').all();
12
+ const evidenceByProblem = new Map();
13
+ for (const problem of problems)
14
+ evidenceByProblem.set(problem.id, matchProblem(problem, input));
15
+ const candidates = [];
16
+ for (const solution of solutions) {
17
+ const evidence = [...(evidenceByProblem.get(solution.problem_id) ?? []), ...matchSolution(solution, input), ...matchSources(solution, sources, input)];
18
+ if (evidence.length === 0)
19
+ continue;
20
+ const deduped = deduplicateEvidence(evidence);
21
+ candidates.push({
22
+ problemId: solution.problem_id,
23
+ solutionId: solution.id,
24
+ solutionRevision: solution.revision,
25
+ title: solution.title,
26
+ fingerprint,
27
+ matchEvidence: deduped,
28
+ recallScore: deduped.reduce((sum, item) => sum + item.rawScore, 0),
29
+ });
30
+ }
31
+ candidates.sort((left, right) => right.recallScore - left.recallScore || left.solutionId.localeCompare(right.solutionId) || left.solutionRevision - right.solutionRevision);
32
+ return { fingerprint, candidates: candidates.slice(0, Math.max(1, Math.min(options.limit ?? 20, 50))) };
33
+ }
34
+ finally {
35
+ closeRulebookDatabase(database);
36
+ }
37
+ }
38
+ function matchProblem(row, input) {
39
+ const observations = JSON.parse(row.observations);
40
+ const hypotheses = JSON.parse(row.hypotheses);
41
+ return [
42
+ ...matchLists(input.observations.error_signatures ?? [], observations.error_signatures, 'error_signature', 'observations.error_signatures', 100, 'fact'),
43
+ ...matchLists(input.observations.symbols ?? [], observations.symbols, 'symbol', 'observations.symbols', 80, 'fact'),
44
+ ...matchLists(input.observations.operations ?? [], observations.operations, 'operation', 'observations.operations', 65, 'fact'),
45
+ ...matchLists(input.observations.symptoms, observations.symptoms, 'symptom', 'observations.symptoms', 55, 'fact'),
46
+ ...matchLists([input.observations.expected, input.observations.observed], [observations.expected, observations.observed], 'expected_observed', 'observations.expected_observed', 45, 'fact'),
47
+ ...matchLists([...(input.hypotheses?.suspected_causes ?? []), ...(input.hypotheses?.components ?? [])], [...hypotheses.suspected_causes, ...hypotheses.components], 'hypothesis', 'hypotheses', 15, 'hypothesis'),
48
+ ];
49
+ }
50
+ function matchSolution(row, input) {
51
+ const factTerms = [...input.observations.symptoms, ...(input.observations.operations ?? []), input.observations.expected, input.observations.observed];
52
+ return matchLists(factTerms, [row.title, row.cause, ...jsonStrings(row.inspections), ...jsonStrings(row.actions), ...jsonStrings(row.verification)], 'weak_lexical', 'solution', 5, 'low_signal', 'solution');
53
+ }
54
+ function matchSources(solution, sources, input) {
55
+ const locators = JSON.parse(solution.source_evidence);
56
+ const linked = sources.filter((source) => locators.some((locator) => locator.project_key === source.project_key && locator.relative_path === source.relative_path && locator.content_hash === source.content_hash));
57
+ const terms = [...(input.observations.symbols ?? []), ...(input.observations.error_signatures ?? [])];
58
+ return linked.flatMap((source) => matchLists(terms, [source.symbol ?? '', source.relative_path, source.content], 'source_code', `source:${source.handle}`, 60, 'fact', 'source_chunk'));
59
+ }
60
+ function matchLists(queries, targets, channel, field, score, confidence, source = 'problem') {
61
+ const normalizedTargets = targets.map(normalizeSearchText);
62
+ const matches = [];
63
+ for (const query of queries.map(normalizeSearchText).filter(Boolean)) {
64
+ const queryTokens = tokens(query);
65
+ for (const target of normalizedTargets) {
66
+ const exact = target === query;
67
+ const phrase = query.length >= 4 && (target.includes(query) || query.includes(target));
68
+ const overlap = queryTokens.filter((token) => target.includes(token));
69
+ if (!exact && !phrase && overlap.length < Math.min(2, queryTokens.length))
70
+ continue;
71
+ matches.push({ channel, field, matchedValue: query, source, confidence, rawScore: exact ? score : phrase ? Math.round(score * 0.8) : Math.round(score * 0.4) });
72
+ break;
73
+ }
74
+ }
75
+ return matches;
76
+ }
77
+ function tokens(value) {
78
+ return [...new Set((value.match(/[\p{L}\p{N}_]+/gu) ?? []).filter((token) => token.length > 2 && !STOP_TOKENS.has(token)))];
79
+ }
80
+ function jsonStrings(value) {
81
+ const parsed = JSON.parse(value);
82
+ return Array.isArray(parsed) ? parsed.filter((item) => typeof item === 'string') : [];
83
+ }
84
+ function deduplicateEvidence(evidence) {
85
+ const byKey = new Map();
86
+ for (const item of evidence) {
87
+ const key = `${item.channel}\0${item.field}\0${item.matchedValue}\0${item.source}`;
88
+ const existing = byKey.get(key);
89
+ if (existing === undefined || item.rawScore > existing.rawScore)
90
+ byKey.set(key, item);
91
+ }
92
+ return [...byKey.values()].sort((left, right) => right.rawScore - left.rawScore || left.channel.localeCompare(right.channel) || left.matchedValue.localeCompare(right.matchedValue));
93
+ }
94
+ //# sourceMappingURL=resolution-candidate-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolution-candidate-service.js","sourceRoot":"","sources":["../../src/storage/resolution-candidate-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC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AG,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ;YAAE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;AACvL,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ResolutionDocument } from '../core/index.js';
2
+ import type { SourceChunkChecksumInput } from '../core/resolution-semantic-checksum.js';
3
+ export declare function commitResolutionDocuments(options: {
4
+ home: string;
5
+ documents: ResolutionDocument[];
6
+ rebuild?: (home: string, sourceChunks: SourceChunkChecksumInput[]) => Promise<unknown>;
7
+ }): Promise<{
8
+ status: "ok";
9
+ created: string[];
10
+ index: unknown;
11
+ }>;
@@ -0,0 +1,56 @@
1
+ import { access, readFile, rm } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { canonicalResolutionPath, parseResolutionYaml, writeCanonicalResolution } from '../core/index.js';
4
+ import { closeRulebookDatabase, openRulebookDatabase } from './sqlite.js';
5
+ import { rebuildResolutionIndex } from './resolution-indexer.js';
6
+ export async function commitResolutionDocuments(options) {
7
+ const created = [];
8
+ try {
9
+ for (const document of options.documents) {
10
+ const path = canonicalResolutionPath(options.home, document);
11
+ if (await exists(path)) {
12
+ const parsed = parseResolutionYaml(await readFile(path, 'utf8'), path);
13
+ if (parsed.success && JSON.stringify(parsed.document) === JSON.stringify(document))
14
+ continue;
15
+ throw new Error(`Immutable canonical target already exists: ${path}`);
16
+ }
17
+ created.push((await writeCanonicalResolution(options.home, document)).path);
18
+ }
19
+ const sourceChunks = readIndexedSourceChunks(options.home);
20
+ const index = options.rebuild === undefined
21
+ ? await rebuildResolutionIndex({ home: options.home, sourceChunks })
22
+ : await options.rebuild(options.home, sourceChunks);
23
+ return { status: 'ok', created, index };
24
+ }
25
+ catch (error) {
26
+ for (const path of created.reverse())
27
+ await rm(path, { force: true });
28
+ throw error;
29
+ }
30
+ }
31
+ function readIndexedSourceChunks(home) {
32
+ const indexPath = join(home, 'index/resolutions.sqlite');
33
+ try {
34
+ const database = openRulebookDatabase({ databasePath: indexPath });
35
+ try {
36
+ const rows = database.prepare('SELECT handle, project_key, revision, relative_path, symbol, content_hash, content FROM source_chunks').all();
37
+ return rows.map((row) => ({ handle: row.handle, projectKey: row.project_key, revision: row.revision, relativePath: row.relative_path, ...(row.symbol === null ? {} : { symbol: row.symbol }), contentHash: row.content_hash, content: row.content }));
38
+ }
39
+ finally {
40
+ closeRulebookDatabase(database);
41
+ }
42
+ }
43
+ catch {
44
+ return [];
45
+ }
46
+ }
47
+ async function exists(path) {
48
+ try {
49
+ await access(path);
50
+ return true;
51
+ }
52
+ catch {
53
+ return false;
54
+ }
55
+ }
56
+ //# sourceMappingURL=resolution-change-transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolution-change-transaction.js","sourceRoot":"","sources":["../../src/storage/resolution-change-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE1G,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAE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C;AAClE,CAAC"}
@@ -0,0 +1,20 @@
1
+ export declare const RESOLUTION_HOME_DIRECTORIES: readonly ["problems", "solutions", "outcomes", "index", "logs"];
2
+ export declare const RESOLUTION_HOME_FILES: {
3
+ readonly 'config.yaml': "schema_version: 3\nlayout: resolution-memory\n";
4
+ readonly 'projects.local.yaml': "schema_version: 1\nprojects: {}\n";
5
+ readonly '.gitignore': string;
6
+ };
7
+ export declare const LEGACY_RESET_TARGETS: readonly ["rules", "index"];
8
+ export declare function createResolutionHome(home: string): Promise<void>;
9
+ export type LegacyResetPreview = {
10
+ home: string;
11
+ deletionTargets: string[];
12
+ preserved: string[];
13
+ };
14
+ export declare function previewLegacyReset(home: string): Promise<LegacyResetPreview>;
15
+ export declare function executeLegacyReset(options: {
16
+ home: string;
17
+ expectedHome: string;
18
+ confirmation: 'RESET LEGACY RULEBOOK';
19
+ privateGitVerified: boolean;
20
+ }): Promise<LegacyResetPreview>;
@@ -0,0 +1,59 @@
1
+ import { access, mkdir, realpath, rm, writeFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ export const RESOLUTION_HOME_DIRECTORIES = ['problems', 'solutions', 'outcomes', 'index', 'logs'];
4
+ export const RESOLUTION_HOME_FILES = {
5
+ 'config.yaml': 'schema_version: 3\nlayout: resolution-memory\n',
6
+ 'projects.local.yaml': 'schema_version: 1\nprojects: {}\n',
7
+ '.gitignore': ['projects.local.yaml', 'index/', 'logs/', '*.lock', '*.tmp', ''].join('\n'),
8
+ };
9
+ export const LEGACY_RESET_TARGETS = ['rules', 'index'];
10
+ export async function createResolutionHome(home) {
11
+ await mkdir(home, { recursive: true });
12
+ for (const directory of RESOLUTION_HOME_DIRECTORIES)
13
+ await mkdir(join(home, directory), { recursive: true });
14
+ for (const [relativePath, content] of Object.entries(RESOLUTION_HOME_FILES)) {
15
+ if (!(await exists(join(home, relativePath)))) {
16
+ await writeFile(join(home, relativePath), content, { encoding: 'utf8', flag: 'wx' });
17
+ }
18
+ }
19
+ }
20
+ export async function previewLegacyReset(home) {
21
+ const resolvedHome = await realpath(home);
22
+ const deletionTargets = [];
23
+ for (const target of LEGACY_RESET_TARGETS) {
24
+ const absolutePath = join(resolvedHome, target);
25
+ if (await exists(absolutePath))
26
+ deletionTargets.push(absolutePath);
27
+ }
28
+ return {
29
+ home: resolvedHome,
30
+ deletionTargets,
31
+ preserved: ['.git', 'config.yaml', 'projects.local.yaml'].map((item) => join(resolvedHome, item)),
32
+ };
33
+ }
34
+ export async function executeLegacyReset(options) {
35
+ const preview = await previewLegacyReset(options.home);
36
+ const expectedHome = await realpath(options.expectedHome);
37
+ if (preview.home !== expectedHome) {
38
+ throw new Error('Resolved home does not match the exact reset target');
39
+ }
40
+ if (!options.privateGitVerified || !(await exists(join(preview.home, '.git')))) {
41
+ throw new Error('Reset requires a verified private Git worktree');
42
+ }
43
+ if (options.confirmation !== 'RESET LEGACY RULEBOOK')
44
+ throw new Error('Explicit reset confirmation is required');
45
+ for (const target of preview.deletionTargets)
46
+ await rm(target, { recursive: true, force: false });
47
+ await createResolutionHome(preview.home);
48
+ return preview;
49
+ }
50
+ async function exists(path) {
51
+ try {
52
+ await access(path);
53
+ return true;
54
+ }
55
+ catch {
56
+ return false;
57
+ }
58
+ }
59
+ //# sourceMappingURL=resolution-home.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolution-home.js","sourceRoot":"","sources":["../../src/storage/resolution-home.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAC3G,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,aAAa,EAAE,gDAAgD;IAC/D,qBAAq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