@open-agreements/open-agreements 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 (358) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +359 -0
  3. package/bin/open-agreements.js +4 -0
  4. package/content/external/LICENSE +27 -0
  5. package/content/external/README.md +38 -0
  6. package/content/external/yc-safe-discount/README.md +16 -0
  7. package/content/external/yc-safe-discount/clean.json +4 -0
  8. package/content/external/yc-safe-discount/metadata.yaml +67 -0
  9. package/content/external/yc-safe-discount/replacements.json +13 -0
  10. package/content/external/yc-safe-discount/template.docx +0 -0
  11. package/content/external/yc-safe-mfn/README.md +16 -0
  12. package/content/external/yc-safe-mfn/clean.json +4 -0
  13. package/content/external/yc-safe-mfn/metadata.yaml +64 -0
  14. package/content/external/yc-safe-mfn/replacements.json +12 -0
  15. package/content/external/yc-safe-mfn/template.docx +0 -0
  16. package/content/external/yc-safe-pro-rata-side-letter/README.md +16 -0
  17. package/content/external/yc-safe-pro-rata-side-letter/clean.json +4 -0
  18. package/content/external/yc-safe-pro-rata-side-letter/metadata.yaml +49 -0
  19. package/content/external/yc-safe-pro-rata-side-letter/replacements.json +9 -0
  20. package/content/external/yc-safe-pro-rata-side-letter/template.docx +0 -0
  21. package/content/external/yc-safe-valuation-cap/README.md +16 -0
  22. package/content/external/yc-safe-valuation-cap/clean.json +4 -0
  23. package/content/external/yc-safe-valuation-cap/metadata.yaml +64 -0
  24. package/content/external/yc-safe-valuation-cap/replacements.json +12 -0
  25. package/content/external/yc-safe-valuation-cap/template.docx +0 -0
  26. package/content/recipes/nvca-certificate-of-incorporation/clean.json +8 -0
  27. package/content/recipes/nvca-certificate-of-incorporation/metadata.yaml +43 -0
  28. package/content/recipes/nvca-certificate-of-incorporation/replacements.json +9 -0
  29. package/content/recipes/nvca-indemnification-agreement/clean.json +17 -0
  30. package/content/recipes/nvca-indemnification-agreement/metadata.yaml +79 -0
  31. package/content/recipes/nvca-indemnification-agreement/replacements.json +17 -0
  32. package/content/recipes/nvca-investors-rights-agreement/clean.json +12 -0
  33. package/content/recipes/nvca-investors-rights-agreement/metadata.yaml +71 -0
  34. package/content/recipes/nvca-investors-rights-agreement/replacements.json +18 -0
  35. package/content/recipes/nvca-management-rights-letter/clean.json +7 -0
  36. package/content/recipes/nvca-management-rights-letter/metadata.yaml +47 -0
  37. package/content/recipes/nvca-management-rights-letter/replacements.json +11 -0
  38. package/content/recipes/nvca-rofr-co-sale-agreement/clean.json +7 -0
  39. package/content/recipes/nvca-rofr-co-sale-agreement/metadata.yaml +76 -0
  40. package/content/recipes/nvca-rofr-co-sale-agreement/replacements.json +17 -0
  41. package/content/recipes/nvca-stock-purchase-agreement/clean.json +13 -0
  42. package/content/recipes/nvca-stock-purchase-agreement/computed.json +103 -0
  43. package/content/recipes/nvca-stock-purchase-agreement/metadata.yaml +138 -0
  44. package/content/recipes/nvca-stock-purchase-agreement/normalize.json +83 -0
  45. package/content/recipes/nvca-stock-purchase-agreement/replacements.json +41 -0
  46. package/content/recipes/nvca-voting-agreement/README.md +53 -0
  47. package/content/recipes/nvca-voting-agreement/clean.json +7 -0
  48. package/content/recipes/nvca-voting-agreement/metadata.yaml +66 -0
  49. package/content/recipes/nvca-voting-agreement/replacements.json +18 -0
  50. package/content/templates/bonterms-mutual-nda/README.md +27 -0
  51. package/content/templates/bonterms-mutual-nda/metadata.yaml +58 -0
  52. package/content/templates/bonterms-mutual-nda/source.json +18 -0
  53. package/content/templates/bonterms-mutual-nda/template.docx +0 -0
  54. package/content/templates/bonterms-professional-services-agreement/README.md +24 -0
  55. package/content/templates/bonterms-professional-services-agreement/metadata.yaml +45 -0
  56. package/content/templates/bonterms-professional-services-agreement/selections.json +12 -0
  57. package/content/templates/bonterms-professional-services-agreement/source.json +18 -0
  58. package/content/templates/bonterms-professional-services-agreement/template.docx +0 -0
  59. package/content/templates/closing-checklist/metadata.yaml +39 -0
  60. package/content/templates/closing-checklist/template.docx +0 -0
  61. package/content/templates/common-paper-ai-addendum/README.md +23 -0
  62. package/content/templates/common-paper-ai-addendum/metadata.yaml +31 -0
  63. package/content/templates/common-paper-ai-addendum/template.docx +0 -0
  64. package/content/templates/common-paper-ai-addendum-in-app/README.md +21 -0
  65. package/content/templates/common-paper-ai-addendum-in-app/metadata.yaml +21 -0
  66. package/content/templates/common-paper-ai-addendum-in-app/template.docx +0 -0
  67. package/content/templates/common-paper-amendment/README.md +27 -0
  68. package/content/templates/common-paper-amendment/metadata.yaml +53 -0
  69. package/content/templates/common-paper-amendment/template.docx +0 -0
  70. package/content/templates/common-paper-business-associate-agreement/README.md +29 -0
  71. package/content/templates/common-paper-business-associate-agreement/metadata.yaml +56 -0
  72. package/content/templates/common-paper-business-associate-agreement/replacements.json +3 -0
  73. package/content/templates/common-paper-business-associate-agreement/template.docx +0 -0
  74. package/content/templates/common-paper-cloud-service-agreement/README.md +32 -0
  75. package/content/templates/common-paper-cloud-service-agreement/metadata.yaml +354 -0
  76. package/content/templates/common-paper-cloud-service-agreement/template.docx +0 -0
  77. package/content/templates/common-paper-csa-click-through/README.md +33 -0
  78. package/content/templates/common-paper-csa-click-through/metadata.yaml +73 -0
  79. package/content/templates/common-paper-csa-click-through/template.docx +0 -0
  80. package/content/templates/common-paper-csa-with-ai/README.md +49 -0
  81. package/content/templates/common-paper-csa-with-ai/metadata.yaml +143 -0
  82. package/content/templates/common-paper-csa-with-ai/replacements.json +7 -0
  83. package/content/templates/common-paper-csa-with-ai/template.docx +0 -0
  84. package/content/templates/common-paper-csa-with-sla/README.md +53 -0
  85. package/content/templates/common-paper-csa-with-sla/metadata.yaml +159 -0
  86. package/content/templates/common-paper-csa-with-sla/replacements.json +7 -0
  87. package/content/templates/common-paper-csa-with-sla/template.docx +0 -0
  88. package/content/templates/common-paper-csa-without-sla/README.md +47 -0
  89. package/content/templates/common-paper-csa-without-sla/metadata.yaml +135 -0
  90. package/content/templates/common-paper-csa-without-sla/replacements.json +7 -0
  91. package/content/templates/common-paper-csa-without-sla/template.docx +0 -0
  92. package/content/templates/common-paper-data-processing-agreement/README.md +46 -0
  93. package/content/templates/common-paper-data-processing-agreement/metadata.yaml +130 -0
  94. package/content/templates/common-paper-data-processing-agreement/replacements.json +3 -0
  95. package/content/templates/common-paper-data-processing-agreement/template.docx +0 -0
  96. package/content/templates/common-paper-design-partner-agreement/README.md +29 -0
  97. package/content/templates/common-paper-design-partner-agreement/metadata.yaml +59 -0
  98. package/content/templates/common-paper-design-partner-agreement/replacements.json +4 -0
  99. package/content/templates/common-paper-design-partner-agreement/template.docx +0 -0
  100. package/content/templates/common-paper-independent-contractor-agreement/README.md +27 -0
  101. package/content/templates/common-paper-independent-contractor-agreement/metadata.yaml +55 -0
  102. package/content/templates/common-paper-independent-contractor-agreement/template.docx +0 -0
  103. package/content/templates/common-paper-letter-of-intent/README.md +25 -0
  104. package/content/templates/common-paper-letter-of-intent/metadata.yaml +42 -0
  105. package/content/templates/common-paper-letter-of-intent/template.docx +0 -0
  106. package/content/templates/common-paper-mutual-nda/README.md +29 -0
  107. package/content/templates/common-paper-mutual-nda/metadata.yaml +59 -0
  108. package/content/templates/common-paper-mutual-nda/selections.json +38 -0
  109. package/content/templates/common-paper-mutual-nda/template.docx +0 -0
  110. package/content/templates/common-paper-one-way-nda/README.md +27 -0
  111. package/content/templates/common-paper-one-way-nda/metadata.yaml +59 -0
  112. package/content/templates/common-paper-one-way-nda/template.docx +0 -0
  113. package/content/templates/common-paper-order-form/README.md +36 -0
  114. package/content/templates/common-paper-order-form/metadata.yaml +87 -0
  115. package/content/templates/common-paper-order-form/replacements.json +5 -0
  116. package/content/templates/common-paper-order-form/template.docx +0 -0
  117. package/content/templates/common-paper-order-form-with-sla/README.md +42 -0
  118. package/content/templates/common-paper-order-form-with-sla/metadata.yaml +111 -0
  119. package/content/templates/common-paper-order-form-with-sla/replacements.json +5 -0
  120. package/content/templates/common-paper-order-form-with-sla/template.docx +0 -0
  121. package/content/templates/common-paper-partnership-agreement/README.md +34 -0
  122. package/content/templates/common-paper-partnership-agreement/metadata.yaml +78 -0
  123. package/content/templates/common-paper-partnership-agreement/replacements.json +7 -0
  124. package/content/templates/common-paper-partnership-agreement/template.docx +0 -0
  125. package/content/templates/common-paper-pilot-agreement/README.md +34 -0
  126. package/content/templates/common-paper-pilot-agreement/metadata.yaml +100 -0
  127. package/content/templates/common-paper-pilot-agreement/replacements.json +4 -0
  128. package/content/templates/common-paper-pilot-agreement/selections.json +37 -0
  129. package/content/templates/common-paper-pilot-agreement/template.docx +0 -0
  130. package/content/templates/common-paper-professional-services-agreement/README.md +44 -0
  131. package/content/templates/common-paper-professional-services-agreement/metadata.yaml +124 -0
  132. package/content/templates/common-paper-professional-services-agreement/replacements.json +8 -0
  133. package/content/templates/common-paper-professional-services-agreement/template.docx +0 -0
  134. package/content/templates/common-paper-software-license-agreement/README.md +18 -0
  135. package/content/templates/common-paper-software-license-agreement/metadata.yaml +13 -0
  136. package/content/templates/common-paper-software-license-agreement/template.docx +0 -0
  137. package/content/templates/common-paper-statement-of-work/README.md +32 -0
  138. package/content/templates/common-paper-statement-of-work/metadata.yaml +71 -0
  139. package/content/templates/common-paper-statement-of-work/replacements.json +3 -0
  140. package/content/templates/common-paper-statement-of-work/template.docx +0 -0
  141. package/content/templates/common-paper-term-sheet/README.md +22 -0
  142. package/content/templates/common-paper-term-sheet/metadata.yaml +28 -0
  143. package/content/templates/common-paper-term-sheet/template.docx +0 -0
  144. package/content/templates/openagreements-employee-ip-inventions-assignment/README.md +31 -0
  145. package/content/templates/openagreements-employee-ip-inventions-assignment/metadata.yaml +71 -0
  146. package/content/templates/openagreements-employee-ip-inventions-assignment/template.docx +0 -0
  147. package/content/templates/openagreements-employee-ip-inventions-assignment/template.md +80 -0
  148. package/content/templates/openagreements-employment-confidentiality-acknowledgement/README.md +30 -0
  149. package/content/templates/openagreements-employment-confidentiality-acknowledgement/metadata.yaml +60 -0
  150. package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.docx +0 -0
  151. package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.md +51 -0
  152. package/content/templates/openagreements-employment-offer-letter/README.md +33 -0
  153. package/content/templates/openagreements-employment-offer-letter/metadata.yaml +75 -0
  154. package/content/templates/openagreements-employment-offer-letter/template.docx +0 -0
  155. package/content/templates/openagreements-employment-offer-letter/template.md +90 -0
  156. package/content/templates/working-group-list/metadata.yaml +22 -0
  157. package/content/templates/working-group-list/template.docx +0 -0
  158. package/dist/cli/index.d.ts +4 -0
  159. package/dist/cli/index.d.ts.map +1 -0
  160. package/dist/cli/index.js +199 -0
  161. package/dist/cli/index.js.map +1 -0
  162. package/dist/commands/checklist.d.ts +22 -0
  163. package/dist/commands/checklist.d.ts.map +1 -0
  164. package/dist/commands/checklist.js +222 -0
  165. package/dist/commands/checklist.js.map +1 -0
  166. package/dist/commands/fill.d.ts +18 -0
  167. package/dist/commands/fill.d.ts.map +1 -0
  168. package/dist/commands/fill.js +119 -0
  169. package/dist/commands/fill.js.map +1 -0
  170. package/dist/commands/list.d.ts +7 -0
  171. package/dist/commands/list.d.ts.map +1 -0
  172. package/dist/commands/list.js +247 -0
  173. package/dist/commands/list.js.map +1 -0
  174. package/dist/commands/recipe.d.ts +24 -0
  175. package/dist/commands/recipe.d.ts.map +1 -0
  176. package/dist/commands/recipe.js +96 -0
  177. package/dist/commands/recipe.js.map +1 -0
  178. package/dist/commands/scan.d.ts +28 -0
  179. package/dist/commands/scan.d.ts.map +1 -0
  180. package/dist/commands/scan.js +138 -0
  181. package/dist/commands/scan.js.map +1 -0
  182. package/dist/commands/validate.d.ts +6 -0
  183. package/dist/commands/validate.d.ts.map +1 -0
  184. package/dist/commands/validate.js +158 -0
  185. package/dist/commands/validate.js.map +1 -0
  186. package/dist/core/checklist/index.d.ts +38 -0
  187. package/dist/core/checklist/index.d.ts.map +1 -0
  188. package/dist/core/checklist/index.js +229 -0
  189. package/dist/core/checklist/index.js.map +1 -0
  190. package/dist/core/checklist/patch-apply.d.ts +65 -0
  191. package/dist/core/checklist/patch-apply.d.ts.map +1 -0
  192. package/dist/core/checklist/patch-apply.js +274 -0
  193. package/dist/core/checklist/patch-apply.js.map +1 -0
  194. package/dist/core/checklist/patch-schemas.d.ts +86 -0
  195. package/dist/core/checklist/patch-schemas.d.ts.map +1 -0
  196. package/dist/core/checklist/patch-schemas.js +89 -0
  197. package/dist/core/checklist/patch-schemas.js.map +1 -0
  198. package/dist/core/checklist/patch-validator.d.ts +76 -0
  199. package/dist/core/checklist/patch-validator.d.ts.map +1 -0
  200. package/dist/core/checklist/patch-validator.js +404 -0
  201. package/dist/core/checklist/patch-validator.js.map +1 -0
  202. package/dist/core/checklist/schemas.d.ts +270 -0
  203. package/dist/core/checklist/schemas.d.ts.map +1 -0
  204. package/dist/core/checklist/schemas.js +229 -0
  205. package/dist/core/checklist/schemas.js.map +1 -0
  206. package/dist/core/checklist/test-utils.d.ts +7 -0
  207. package/dist/core/checklist/test-utils.d.ts.map +1 -0
  208. package/dist/core/checklist/test-utils.js +13 -0
  209. package/dist/core/checklist/test-utils.js.map +1 -0
  210. package/dist/core/command-generation/adapters/claude.d.ts +11 -0
  211. package/dist/core/command-generation/adapters/claude.d.ts.map +1 -0
  212. package/dist/core/command-generation/adapters/claude.js +91 -0
  213. package/dist/core/command-generation/adapters/claude.js.map +1 -0
  214. package/dist/core/command-generation/types.d.ts +14 -0
  215. package/dist/core/command-generation/types.d.ts.map +1 -0
  216. package/dist/core/command-generation/types.js +2 -0
  217. package/dist/core/command-generation/types.js.map +1 -0
  218. package/dist/core/employment/jurisdiction-rules.d.ts +20 -0
  219. package/dist/core/employment/jurisdiction-rules.d.ts.map +1 -0
  220. package/dist/core/employment/jurisdiction-rules.js +57 -0
  221. package/dist/core/employment/jurisdiction-rules.js.map +1 -0
  222. package/dist/core/employment/memo.d.ts +57 -0
  223. package/dist/core/employment/memo.d.ts.map +1 -0
  224. package/dist/core/employment/memo.js +589 -0
  225. package/dist/core/employment/memo.js.map +1 -0
  226. package/dist/core/engine.d.ts +13 -0
  227. package/dist/core/engine.d.ts.map +1 -0
  228. package/dist/core/engine.js +182 -0
  229. package/dist/core/engine.js.map +1 -0
  230. package/dist/core/external/index.d.ts +8 -0
  231. package/dist/core/external/index.d.ts.map +1 -0
  232. package/dist/core/external/index.js +50 -0
  233. package/dist/core/external/index.js.map +1 -0
  234. package/dist/core/external/types.d.ts +18 -0
  235. package/dist/core/external/types.d.ts.map +1 -0
  236. package/dist/core/external/types.js +2 -0
  237. package/dist/core/external/types.js.map +1 -0
  238. package/dist/core/fill-pipeline.d.ts +64 -0
  239. package/dist/core/fill-pipeline.d.ts.map +1 -0
  240. package/dist/core/fill-pipeline.js +350 -0
  241. package/dist/core/fill-pipeline.js.map +1 -0
  242. package/dist/core/fill-utils.d.ts +39 -0
  243. package/dist/core/fill-utils.d.ts.map +1 -0
  244. package/dist/core/fill-utils.js +127 -0
  245. package/dist/core/fill-utils.js.map +1 -0
  246. package/dist/core/metadata.d.ts +194 -0
  247. package/dist/core/metadata.d.ts.map +1 -0
  248. package/dist/core/metadata.js +197 -0
  249. package/dist/core/metadata.js.map +1 -0
  250. package/dist/core/recipe/bracket-normalizer.d.ts +46 -0
  251. package/dist/core/recipe/bracket-normalizer.d.ts.map +1 -0
  252. package/dist/core/recipe/bracket-normalizer.js +354 -0
  253. package/dist/core/recipe/bracket-normalizer.js.map +1 -0
  254. package/dist/core/recipe/cleaner.d.ts +27 -0
  255. package/dist/core/recipe/cleaner.d.ts.map +1 -0
  256. package/dist/core/recipe/cleaner.js +345 -0
  257. package/dist/core/recipe/cleaner.js.map +1 -0
  258. package/dist/core/recipe/computed.d.ts +136 -0
  259. package/dist/core/recipe/computed.d.ts.map +1 -0
  260. package/dist/core/recipe/computed.js +225 -0
  261. package/dist/core/recipe/computed.js.map +1 -0
  262. package/dist/core/recipe/downloader.d.ts +8 -0
  263. package/dist/core/recipe/downloader.d.ts.map +1 -0
  264. package/dist/core/recipe/downloader.js +58 -0
  265. package/dist/core/recipe/downloader.js.map +1 -0
  266. package/dist/core/recipe/index.d.ts +17 -0
  267. package/dist/core/recipe/index.d.ts.map +1 -0
  268. package/dist/core/recipe/index.js +90 -0
  269. package/dist/core/recipe/index.js.map +1 -0
  270. package/dist/core/recipe/ooxml-parts.d.ts +21 -0
  271. package/dist/core/recipe/ooxml-parts.d.ts.map +1 -0
  272. package/dist/core/recipe/ooxml-parts.js +33 -0
  273. package/dist/core/recipe/ooxml-parts.js.map +1 -0
  274. package/dist/core/recipe/patcher.d.ts +34 -0
  275. package/dist/core/recipe/patcher.d.ts.map +1 -0
  276. package/dist/core/recipe/patcher.js +423 -0
  277. package/dist/core/recipe/patcher.js.map +1 -0
  278. package/dist/core/recipe/replacement-keys.d.ts +33 -0
  279. package/dist/core/recipe/replacement-keys.d.ts.map +1 -0
  280. package/dist/core/recipe/replacement-keys.js +53 -0
  281. package/dist/core/recipe/replacement-keys.js.map +1 -0
  282. package/dist/core/recipe/source-drift.d.ts +33 -0
  283. package/dist/core/recipe/source-drift.d.ts.map +1 -0
  284. package/dist/core/recipe/source-drift.js +113 -0
  285. package/dist/core/recipe/source-drift.js.map +1 -0
  286. package/dist/core/recipe/types.d.ts +33 -0
  287. package/dist/core/recipe/types.d.ts.map +1 -0
  288. package/dist/core/recipe/types.js +2 -0
  289. package/dist/core/recipe/types.js.map +1 -0
  290. package/dist/core/recipe/verifier.d.ts +24 -0
  291. package/dist/core/recipe/verifier.d.ts.map +1 -0
  292. package/dist/core/recipe/verifier.js +158 -0
  293. package/dist/core/recipe/verifier.js.map +1 -0
  294. package/dist/core/selector.d.ts +41 -0
  295. package/dist/core/selector.d.ts.map +1 -0
  296. package/dist/core/selector.js +323 -0
  297. package/dist/core/selector.js.map +1 -0
  298. package/dist/core/unified-pipeline.d.ts +53 -0
  299. package/dist/core/unified-pipeline.d.ts.map +1 -0
  300. package/dist/core/unified-pipeline.js +107 -0
  301. package/dist/core/unified-pipeline.js.map +1 -0
  302. package/dist/core/validation/external.d.ts +16 -0
  303. package/dist/core/validation/external.d.ts.map +1 -0
  304. package/dist/core/validation/external.js +114 -0
  305. package/dist/core/validation/external.js.map +1 -0
  306. package/dist/core/validation/license.d.ts +15 -0
  307. package/dist/core/validation/license.d.ts.map +1 -0
  308. package/dist/core/validation/license.js +30 -0
  309. package/dist/core/validation/license.js.map +1 -0
  310. package/dist/core/validation/output.d.ts +12 -0
  311. package/dist/core/validation/output.d.ts.map +1 -0
  312. package/dist/core/validation/output.js +47 -0
  313. package/dist/core/validation/output.js.map +1 -0
  314. package/dist/core/validation/recipe.d.ts +19 -0
  315. package/dist/core/validation/recipe.d.ts.map +1 -0
  316. package/dist/core/validation/recipe.js +159 -0
  317. package/dist/core/validation/recipe.js.map +1 -0
  318. package/dist/core/validation/scan-metadata.d.ts +21 -0
  319. package/dist/core/validation/scan-metadata.d.ts.map +1 -0
  320. package/dist/core/validation/scan-metadata.js +70 -0
  321. package/dist/core/validation/scan-metadata.js.map +1 -0
  322. package/dist/core/validation/template.d.ts +11 -0
  323. package/dist/core/validation/template.d.ts.map +1 -0
  324. package/dist/core/validation/template.js +248 -0
  325. package/dist/core/validation/template.js.map +1 -0
  326. package/dist/index.d.ts +16 -0
  327. package/dist/index.d.ts.map +1 -0
  328. package/dist/index.js +23 -0
  329. package/dist/index.js.map +1 -0
  330. package/dist/utils/paths.d.ts +43 -0
  331. package/dist/utils/paths.d.ts.map +1 -0
  332. package/dist/utils/paths.js +149 -0
  333. package/dist/utils/paths.js.map +1 -0
  334. package/package.json +148 -0
  335. package/skills/cloud-service-agreement/CONNECTORS.md +19 -0
  336. package/skills/cloud-service-agreement/SKILL.md +172 -0
  337. package/skills/data-privacy-agreement/CONNECTORS.md +19 -0
  338. package/skills/data-privacy-agreement/SKILL.md +158 -0
  339. package/skills/delaware-franchise-tax/CONNECTORS.md +16 -0
  340. package/skills/delaware-franchise-tax/SKILL.md +206 -0
  341. package/skills/delaware-franchise-tax/reference/ecorp-portal-playwright-notes.md +136 -0
  342. package/skills/delaware-franchise-tax/reference/faq.md +101 -0
  343. package/skills/delaware-franchise-tax/reference/filing-instructions.md +111 -0
  344. package/skills/delaware-franchise-tax/reference/tax-calculation.md +167 -0
  345. package/skills/employment-contract/CONNECTORS.md +19 -0
  346. package/skills/employment-contract/SKILL.md +157 -0
  347. package/skills/nda/CONNECTORS.md +19 -0
  348. package/skills/nda/SKILL.md +153 -0
  349. package/skills/open-agreements/CONNECTORS.md +19 -0
  350. package/skills/open-agreements/SKILL.md +182 -0
  351. package/skills/safe/CONNECTORS.md +19 -0
  352. package/skills/safe/SKILL.md +161 -0
  353. package/skills/services-agreement/CONNECTORS.md +19 -0
  354. package/skills/services-agreement/SKILL.md +156 -0
  355. package/skills/unit-test-philosophy/SKILL.md +113 -0
  356. package/skills/unit-test-philosophy/references/allure-test-spec-writing-guide.md +164 -0
  357. package/skills/venture-financing/CONNECTORS.md +19 -0
  358. package/skills/venture-financing/SKILL.md +169 -0
@@ -0,0 +1,274 @@
1
+ import { ClosingChecklistSchema } from './schemas.js';
2
+ import { ChecklistPatchApplyRequestSchema } from './patch-schemas.js';
3
+ import { applyChecklistPatchOperations, computeChecklistPatchHash, getChecklistPatchValidationArtifact, getChecklistPatchValidationStore, } from './patch-validator.js';
4
+ class InMemoryChecklistAppliedPatchStore {
5
+ map = new Map();
6
+ key(checklistId, patchId) {
7
+ return `${checklistId}:${patchId}`;
8
+ }
9
+ async get(checklistId, patchId) {
10
+ return this.map.get(this.key(checklistId, patchId)) ?? null;
11
+ }
12
+ async set(record) {
13
+ this.map.set(this.key(record.checklist_id, record.patch_id), record);
14
+ }
15
+ }
16
+ class InMemoryChecklistProposedPatchStore {
17
+ map = new Map();
18
+ key(checklistId, patchId) {
19
+ return `${checklistId}:${patchId}`;
20
+ }
21
+ async get(checklistId, patchId) {
22
+ return this.map.get(this.key(checklistId, patchId)) ?? null;
23
+ }
24
+ async set(record) {
25
+ this.map.set(this.key(record.checklist_id, record.patch_id), record);
26
+ }
27
+ }
28
+ let appliedPatchStore = null;
29
+ let proposedPatchStore = null;
30
+ export function setChecklistAppliedPatchStore(store) {
31
+ appliedPatchStore = store;
32
+ }
33
+ export function getChecklistAppliedPatchStore() {
34
+ if (!appliedPatchStore) {
35
+ appliedPatchStore = new InMemoryChecklistAppliedPatchStore();
36
+ }
37
+ return appliedPatchStore;
38
+ }
39
+ export function setChecklistProposedPatchStore(store) {
40
+ proposedPatchStore = store;
41
+ }
42
+ export function getChecklistProposedPatchStore() {
43
+ if (!proposedPatchStore) {
44
+ proposedPatchStore = new InMemoryChecklistProposedPatchStore();
45
+ }
46
+ return proposedPatchStore;
47
+ }
48
+ function cloneValue(value) {
49
+ if (typeof structuredClone === 'function') {
50
+ return structuredClone(value);
51
+ }
52
+ return JSON.parse(JSON.stringify(value));
53
+ }
54
+ function issuePath(path) {
55
+ if (path.length === 0)
56
+ return '<root>';
57
+ return path
58
+ .map((segment) => (typeof segment === 'symbol' ? segment.toString() : String(segment)))
59
+ .join('.');
60
+ }
61
+ function parsedChecklistOrFailure(checklist) {
62
+ const parsed = ClosingChecklistSchema.safeParse(checklist);
63
+ if (parsed.success) {
64
+ return { ok: true, checklist: parsed.data };
65
+ }
66
+ return {
67
+ ok: false,
68
+ error_code: 'CHECKLIST_SCHEMA_INVALID',
69
+ message: 'Checklist payload failed schema validation.',
70
+ diagnostics: parsed.error.issues.map((issue) => ({
71
+ code: 'CHECKLIST_SCHEMA_INVALID',
72
+ message: issue.message,
73
+ path: issuePath(issue.path),
74
+ })),
75
+ };
76
+ }
77
+ function parsedRequestOrFailure(request) {
78
+ const parsed = ChecklistPatchApplyRequestSchema.safeParse(request);
79
+ if (parsed.success) {
80
+ return { ok: true, request: parsed.data };
81
+ }
82
+ return {
83
+ ok: false,
84
+ error_code: 'APPLY_REQUEST_SCHEMA_INVALID',
85
+ message: 'Patch apply request failed schema validation.',
86
+ diagnostics: parsed.error.issues.map((issue) => ({
87
+ code: 'PATCH_SCHEMA_INVALID',
88
+ message: issue.message,
89
+ path: issuePath(issue.path),
90
+ })),
91
+ };
92
+ }
93
+ export async function applyChecklistPatch(input) {
94
+ const checklistParsed = parsedChecklistOrFailure(input.checklist);
95
+ if (!checklistParsed.ok)
96
+ return checklistParsed;
97
+ const requestParsed = parsedRequestOrFailure(input.request);
98
+ if (!requestParsed.ok)
99
+ return requestParsed;
100
+ const request = requestParsed.request;
101
+ const mode = request.patch.mode;
102
+ const patchHash = computeChecklistPatchHash(request.patch);
103
+ const validationStore = input.validation_store ?? getChecklistPatchValidationStore();
104
+ const validationArtifact = await getChecklistPatchValidationArtifact(request.validation_id, {
105
+ now_ms: input.now_ms,
106
+ store: validationStore,
107
+ });
108
+ if (!validationArtifact) {
109
+ return {
110
+ ok: false,
111
+ error_code: 'VALIDATION_REQUIRED',
112
+ message: 'Missing or expired validation_id. Re-run validate before apply.',
113
+ diagnostics: [],
114
+ };
115
+ }
116
+ if (validationArtifact.checklist_id !== input.checklist_id) {
117
+ return {
118
+ ok: false,
119
+ error_code: 'VALIDATION_MISMATCH',
120
+ message: 'validation_id does not belong to this checklist.',
121
+ diagnostics: [],
122
+ };
123
+ }
124
+ if (validationArtifact.patch_hash !== patchHash) {
125
+ return {
126
+ ok: false,
127
+ error_code: 'VALIDATION_MISMATCH',
128
+ message: 'Patch payload does not match the validated patch hash.',
129
+ diagnostics: [],
130
+ };
131
+ }
132
+ if (validationArtifact.patch_id !== request.patch.patch_id) {
133
+ return {
134
+ ok: false,
135
+ error_code: 'VALIDATION_MISMATCH',
136
+ message: 'Patch ID does not match the validated patch.',
137
+ diagnostics: [],
138
+ };
139
+ }
140
+ const appliedStore = input.applied_patch_store ?? getChecklistAppliedPatchStore();
141
+ const existing = await appliedStore.get(input.checklist_id, request.patch.patch_id);
142
+ if (existing) {
143
+ if (existing.patch_hash === patchHash) {
144
+ return {
145
+ ok: true,
146
+ checklist: checklistParsed.checklist,
147
+ previous_revision: input.current_revision,
148
+ new_revision: input.current_revision,
149
+ patch_id: request.patch.patch_id,
150
+ patch_hash: patchHash,
151
+ idempotent_replay: true,
152
+ mode,
153
+ applied: false,
154
+ resolved_operations: validationArtifact.resolved_operations,
155
+ };
156
+ }
157
+ return {
158
+ ok: false,
159
+ error_code: 'PATCH_ID_CONFLICT',
160
+ message: `patch_id "${request.patch.patch_id}" already exists with different payload hash.`,
161
+ diagnostics: [],
162
+ };
163
+ }
164
+ if (mode === 'PROPOSED') {
165
+ const proposedStore = input.proposed_patch_store ?? getChecklistProposedPatchStore();
166
+ const existingProposal = await proposedStore.get(input.checklist_id, request.patch.patch_id);
167
+ if (existingProposal) {
168
+ if (existingProposal.patch_hash === patchHash) {
169
+ return {
170
+ ok: true,
171
+ checklist: checklistParsed.checklist,
172
+ previous_revision: input.current_revision,
173
+ new_revision: input.current_revision,
174
+ patch_id: request.patch.patch_id,
175
+ patch_hash: patchHash,
176
+ idempotent_replay: true,
177
+ mode,
178
+ applied: false,
179
+ resolved_operations: validationArtifact.resolved_operations,
180
+ };
181
+ }
182
+ return {
183
+ ok: false,
184
+ error_code: 'PATCH_ID_CONFLICT',
185
+ message: `patch_id "${request.patch.patch_id}" already exists with different payload hash.`,
186
+ diagnostics: [],
187
+ };
188
+ }
189
+ const proposedAt = input.now_ms ?? Date.now();
190
+ await proposedStore.set({
191
+ checklist_id: input.checklist_id,
192
+ patch_id: request.patch.patch_id,
193
+ patch_hash: patchHash,
194
+ proposed_at_ms: proposedAt,
195
+ expected_revision: request.patch.expected_revision,
196
+ validation_id: request.validation_id,
197
+ resolved_operations: validationArtifact.resolved_operations,
198
+ });
199
+ return {
200
+ ok: true,
201
+ checklist: checklistParsed.checklist,
202
+ previous_revision: input.current_revision,
203
+ new_revision: input.current_revision,
204
+ patch_id: request.patch.patch_id,
205
+ patch_hash: patchHash,
206
+ idempotent_replay: false,
207
+ mode,
208
+ applied: false,
209
+ resolved_operations: validationArtifact.resolved_operations,
210
+ };
211
+ }
212
+ if (request.patch.expected_revision !== input.current_revision) {
213
+ return {
214
+ ok: false,
215
+ error_code: 'REVISION_CONFLICT',
216
+ message: `expected_revision ${request.patch.expected_revision} does not match current revision ${input.current_revision}.`,
217
+ diagnostics: [],
218
+ };
219
+ }
220
+ if (validationArtifact.expected_revision !== input.current_revision) {
221
+ return {
222
+ ok: false,
223
+ error_code: 'REVISION_CONFLICT',
224
+ message: `Validated revision ${validationArtifact.expected_revision} does not match current revision ${input.current_revision}.`,
225
+ diagnostics: [],
226
+ };
227
+ }
228
+ const updatedChecklist = cloneValue(checklistParsed.checklist);
229
+ const applyResult = applyChecklistPatchOperations(updatedChecklist, request.patch.operations);
230
+ if (!applyResult.ok) {
231
+ return {
232
+ ok: false,
233
+ error_code: 'APPLY_OPERATION_FAILED',
234
+ message: 'Patch operation failed during apply.',
235
+ diagnostics: [applyResult.diagnostic],
236
+ };
237
+ }
238
+ const postPatch = ClosingChecklistSchema.safeParse(updatedChecklist);
239
+ if (!postPatch.success) {
240
+ return {
241
+ ok: false,
242
+ error_code: 'POST_PATCH_SCHEMA_INVALID',
243
+ message: 'Patched checklist failed schema validation.',
244
+ diagnostics: postPatch.error.issues.map((issue) => ({
245
+ code: 'POST_PATCH_SCHEMA_INVALID',
246
+ message: issue.message,
247
+ path: issuePath(issue.path),
248
+ })),
249
+ };
250
+ }
251
+ const appliedAt = input.now_ms ?? Date.now();
252
+ await appliedStore.set({
253
+ checklist_id: input.checklist_id,
254
+ patch_id: request.patch.patch_id,
255
+ patch_hash: patchHash,
256
+ applied_at_ms: appliedAt,
257
+ revision_before: input.current_revision,
258
+ revision_after: input.current_revision + 1,
259
+ patch: request.patch,
260
+ });
261
+ return {
262
+ ok: true,
263
+ checklist: postPatch.data,
264
+ previous_revision: input.current_revision,
265
+ new_revision: input.current_revision + 1,
266
+ patch_id: request.patch.patch_id,
267
+ patch_hash: patchHash,
268
+ idempotent_replay: false,
269
+ mode,
270
+ applied: true,
271
+ resolved_operations: applyResult.resolved_operations,
272
+ };
273
+ }
274
+ //# sourceMappingURL=patch-apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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<{
3
+ APPLY: "APPLY";
4
+ PROPOSED: "PROPOSED";
5
+ }>;
6
+ export type ChecklistPatchMode = z.infer<typeof ChecklistPatchModeEnum>;
7
+ export declare const JsonPointerSchema: z.ZodString;
8
+ export type JsonPointer = z.infer<typeof JsonPointerSchema>;
9
+ export declare const PatchCitationSchema: z.ZodObject<{
10
+ text: z.ZodString;
11
+ link: z.ZodOptional<z.ZodString>;
12
+ filepath: z.ZodOptional<z.ZodString>;
13
+ }, z.core.$strip>;
14
+ export type PatchCitation = z.infer<typeof PatchCitationSchema>;
15
+ export declare const ChecklistPatchSourceEventSchema: z.ZodObject<{
16
+ provider: z.ZodOptional<z.ZodString>;
17
+ message_id: z.ZodOptional<z.ZodString>;
18
+ conversation_id: z.ZodOptional<z.ZodString>;
19
+ }, z.core.$strip>;
20
+ export type ChecklistPatchSourceEvent = z.infer<typeof ChecklistPatchSourceEventSchema>;
21
+ export declare const ChecklistPatchOperationSchema: z.ZodObject<{
22
+ op: z.ZodEnum<{
23
+ replace: "replace";
24
+ add: "add";
25
+ remove: "remove";
26
+ }>;
27
+ path: z.ZodString;
28
+ value: z.ZodOptional<z.ZodUnknown>;
29
+ rationale: z.ZodOptional<z.ZodString>;
30
+ source: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>;
32
+ export type ChecklistPatchOperation = z.infer<typeof ChecklistPatchOperationSchema>;
33
+ export declare const ChecklistPatchEnvelopeSchema: z.ZodObject<{
34
+ patch_id: z.ZodString;
35
+ expected_revision: z.ZodNumber;
36
+ mode: z.ZodDefault<z.ZodEnum<{
37
+ APPLY: "APPLY";
38
+ PROPOSED: "PROPOSED";
39
+ }>>;
40
+ source_event: z.ZodOptional<z.ZodObject<{
41
+ provider: z.ZodOptional<z.ZodString>;
42
+ message_id: z.ZodOptional<z.ZodString>;
43
+ conversation_id: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>>;
45
+ operations: z.ZodArray<z.ZodObject<{
46
+ op: z.ZodEnum<{
47
+ replace: "replace";
48
+ add: "add";
49
+ remove: "remove";
50
+ }>;
51
+ path: z.ZodString;
52
+ value: z.ZodOptional<z.ZodUnknown>;
53
+ rationale: z.ZodOptional<z.ZodString>;
54
+ source: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>>;
56
+ }, z.core.$strip>;
57
+ export type ChecklistPatchEnvelope = z.infer<typeof ChecklistPatchEnvelopeSchema>;
58
+ export declare const ChecklistPatchApplyRequestSchema: z.ZodObject<{
59
+ validation_id: z.ZodString;
60
+ patch: z.ZodObject<{
61
+ patch_id: z.ZodString;
62
+ expected_revision: z.ZodNumber;
63
+ mode: z.ZodDefault<z.ZodEnum<{
64
+ APPLY: "APPLY";
65
+ PROPOSED: "PROPOSED";
66
+ }>>;
67
+ source_event: z.ZodOptional<z.ZodObject<{
68
+ provider: z.ZodOptional<z.ZodString>;
69
+ message_id: z.ZodOptional<z.ZodString>;
70
+ conversation_id: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>>;
72
+ operations: z.ZodArray<z.ZodObject<{
73
+ op: z.ZodEnum<{
74
+ replace: "replace";
75
+ add: "add";
76
+ remove: "remove";
77
+ }>;
78
+ path: z.ZodString;
79
+ value: z.ZodOptional<z.ZodUnknown>;
80
+ rationale: z.ZodOptional<z.ZodString>;
81
+ source: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strip>>;
83
+ }, z.core.$strip>;
84
+ }, z.core.$strip>;
85
+ export type ChecklistPatchApplyRequest = z.infer<typeof ChecklistPatchApplyRequestSchema>;
86
+ //# sourceMappingURL=patch-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-schemas.d.ts","sourceRoot":"","sources":["../../../src/core/checklist/patch-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,sBAAsB;;;EAAgC,CAAC;AACpE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAExE,eAAO,MAAM,iBAAiB,aAO5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,+BAA+B;;;;iBAI1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,6BAA6B;;;;;;;;;;iBA6CxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;iBAMvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { z } from 'zod';
2
+ const JSON_PATCH_OPS = ['add', 'replace', 'remove'];
3
+ function isValidJsonPointer(pointer) {
4
+ if (!pointer.startsWith('/'))
5
+ return false;
6
+ for (let index = 0; index < pointer.length; index += 1) {
7
+ const char = pointer[index];
8
+ if (char !== '~')
9
+ continue;
10
+ const next = pointer[index + 1];
11
+ if (next !== '0' && next !== '1')
12
+ return false;
13
+ index += 1;
14
+ }
15
+ return true;
16
+ }
17
+ export const ChecklistPatchModeEnum = z.enum(['APPLY', 'PROPOSED']);
18
+ export const JsonPointerSchema = z.string().min(1).superRefine((pointer, ctx) => {
19
+ if (!isValidJsonPointer(pointer)) {
20
+ ctx.addIssue({
21
+ code: z.ZodIssueCode.custom,
22
+ message: 'path must be a valid JSON Pointer starting with "/" and using "~0"/"~1" escapes',
23
+ });
24
+ }
25
+ });
26
+ export const PatchCitationSchema = z.object({
27
+ text: z.string().min(1),
28
+ link: z.string().min(1).optional(),
29
+ filepath: z.string().min(1).optional(),
30
+ });
31
+ export const ChecklistPatchSourceEventSchema = z.object({
32
+ provider: z.string().min(1).optional(),
33
+ message_id: z.string().min(1).optional(),
34
+ conversation_id: z.string().min(1).optional(),
35
+ });
36
+ export const ChecklistPatchOperationSchema = z.object({
37
+ op: z.enum(JSON_PATCH_OPS),
38
+ path: JsonPointerSchema,
39
+ value: z.unknown().optional(),
40
+ rationale: z.string().min(1).optional(),
41
+ source: z.string().min(1).optional(),
42
+ }).superRefine((operation, ctx) => {
43
+ const expectsValue = operation.op === 'add' || operation.op === 'replace';
44
+ const hasValue = operation.value !== undefined;
45
+ if (expectsValue && !hasValue) {
46
+ ctx.addIssue({
47
+ code: z.ZodIssueCode.custom,
48
+ path: ['value'],
49
+ message: `"${operation.op}" operations require a value`,
50
+ });
51
+ }
52
+ if (!expectsValue && hasValue) {
53
+ ctx.addIssue({
54
+ code: z.ZodIssueCode.custom,
55
+ path: ['value'],
56
+ message: `"${operation.op}" operations must not include value`,
57
+ });
58
+ }
59
+ if ((operation.op === 'remove' || operation.op === 'replace') && operation.path.endsWith('/-')) {
60
+ ctx.addIssue({
61
+ code: z.ZodIssueCode.custom,
62
+ path: ['path'],
63
+ message: `"${operation.op}" cannot target the append index "-"`,
64
+ });
65
+ }
66
+ const isCitationPath = /\/citations\/(?:-|[0-9]+)$/.test(operation.path);
67
+ if (expectsValue && isCitationPath) {
68
+ const citation = PatchCitationSchema.safeParse(operation.value);
69
+ if (!citation.success) {
70
+ ctx.addIssue({
71
+ code: z.ZodIssueCode.custom,
72
+ path: ['value'],
73
+ message: 'citation writes require value to match PatchCitationSchema',
74
+ });
75
+ }
76
+ }
77
+ });
78
+ export const ChecklistPatchEnvelopeSchema = z.object({
79
+ patch_id: z.string().min(1),
80
+ expected_revision: z.number().int().nonnegative(),
81
+ mode: ChecklistPatchModeEnum.default('APPLY'),
82
+ source_event: ChecklistPatchSourceEventSchema.optional(),
83
+ operations: z.array(ChecklistPatchOperationSchema).min(1),
84
+ });
85
+ export const ChecklistPatchApplyRequestSchema = z.object({
86
+ validation_id: z.string().min(1),
87
+ patch: ChecklistPatchEnvelopeSchema,
88
+ });
89
+ //# sourceMappingURL=patch-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-schemas.js","sourceRoot":"","sources":["../../../src/core/checklist/patch-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAE7D,SAAS,kBAAkB,CAAC,OAAe;IACzC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAE3C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,IAAI,KAAK,GAAG;YAAE,SAAS;QAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAChC,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QAC/C,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AAGpE,MAAM,C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,sCAAsC;SAChE,CAAC,CAAC;IACL,CAAC;IAED,MAAM,cAAc,GAAG,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACzE,IAAI,YAAY,IAAI,cAAc,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;gBAC3B,IAAI,EAAE,CAAC,OAAO,CAAC;gBACf,OAAO,EAAE,4DAA4D;aACtE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACjD,IAAI,EAAE,sBAAsB,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7C,YAAY,EAAE,+BAA+B,CAAC,QAAQ,EAAE;IACxD,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1D,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,KAAK,EAAE,4BAA4B;CACpC,CAAC,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { type ClosingChecklist } from './schemas.js';
2
+ import { type ChecklistPatchEnvelope, type ChecklistPatchOperation } from './patch-schemas.js';
3
+ export declare const CHECKLIST_PATCH_VALIDATION_TTL_MS: number;
4
+ export type ChecklistPatchValidationErrorCode = 'CHECKLIST_SCHEMA_INVALID' | 'PATCH_SCHEMA_INVALID' | 'REVISION_CONFLICT' | 'TARGET_NOT_FOUND' | 'TARGET_PATH_INVALID' | 'TARGET_PARENT_INVALID' | 'POST_PATCH_SCHEMA_INVALID';
5
+ export interface ChecklistPatchValidationDiagnostic {
6
+ code: ChecklistPatchValidationErrorCode;
7
+ message: string;
8
+ path?: string;
9
+ operation_index?: number;
10
+ }
11
+ export interface ResolvedChecklistPatchOperation {
12
+ operation_index: number;
13
+ op: ChecklistPatchOperation['op'];
14
+ path: string;
15
+ parent_path: string;
16
+ parent_container: 'object' | 'array';
17
+ target_exists_before: boolean;
18
+ }
19
+ export interface ChecklistPatchValidationArtifact {
20
+ validation_id: string;
21
+ checklist_id: string;
22
+ patch_id: string;
23
+ patch_hash: string;
24
+ expected_revision: number;
25
+ created_at_ms: number;
26
+ expires_at_ms: number;
27
+ resolved_operations: ResolvedChecklistPatchOperation[];
28
+ }
29
+ export interface ChecklistPatchValidationStore {
30
+ set(artifact: ChecklistPatchValidationArtifact): Promise<void>;
31
+ get(validationId: string): Promise<ChecklistPatchValidationArtifact | null>;
32
+ delete(validationId: string): Promise<void>;
33
+ }
34
+ export declare function setChecklistPatchValidationStore(store: ChecklistPatchValidationStore | null): void;
35
+ export declare function getChecklistPatchValidationStore(): ChecklistPatchValidationStore;
36
+ export interface ValidateChecklistPatchInput {
37
+ checklist_id: string;
38
+ checklist: unknown;
39
+ current_revision: number;
40
+ patch: unknown;
41
+ now_ms?: number;
42
+ validation_ttl_ms?: number;
43
+ store?: ChecklistPatchValidationStore;
44
+ }
45
+ export interface ChecklistPatchValidationSuccess {
46
+ ok: true;
47
+ validation_id: string;
48
+ patch_hash: string;
49
+ patch: ChecklistPatchEnvelope;
50
+ resolved_operations: ResolvedChecklistPatchOperation[];
51
+ resulting_state_valid: true;
52
+ artifact_expires_at_ms: number;
53
+ }
54
+ export interface ChecklistPatchValidationFailure {
55
+ ok: false;
56
+ diagnostics: ChecklistPatchValidationDiagnostic[];
57
+ patch?: ChecklistPatchEnvelope;
58
+ resolved_operations: ResolvedChecklistPatchOperation[];
59
+ }
60
+ export type ChecklistPatchValidationResult = ChecklistPatchValidationSuccess | ChecklistPatchValidationFailure;
61
+ export declare function computeChecklistPatchHash(patch: ChecklistPatchEnvelope): string;
62
+ export declare const DANGEROUS_KEYS: Set<string>;
63
+ export type ChecklistPatchOperationApplyResult = {
64
+ ok: true;
65
+ resolved_operations: ResolvedChecklistPatchOperation[];
66
+ } | {
67
+ ok: false;
68
+ diagnostic: ChecklistPatchValidationDiagnostic;
69
+ };
70
+ export declare function applyChecklistPatchOperations(root: ClosingChecklist, operations: ChecklistPatchOperation[]): ChecklistPatchOperationApplyResult;
71
+ export declare function getChecklistPatchValidationArtifact(validationId: string, opts?: {
72
+ now_ms?: number;
73
+ store?: ChecklistPatchValidationStore;
74
+ }): Promise<ChecklistPatchValidationArtifact | null>;
75
+ export declare function validateChecklistPatch(input: ValidateChecklistPatchInput): Promise<ChecklistPatchValidationResult>;
76
+ //# sourceMappingURL=patch-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-validator.d.ts","sourceRoot":"","sources":["../../../src/core/checklist/patch-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAgC,KAAK,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7H,eAAO,MAAM,iCAAiC,QAAiB,CAAC;AAEhE,MAAM,MAAM,iCAAiC,GACzC,0BAA0B,GAC1B,sBAAsB,GACtB,mBAAmB,GACnB,kBAAkB,GAClB,qBAAqB,GACrB,uBAAuB,GACvB,2BAA2B,CAAC;AAEhC,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;I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