@weavelogic/knowledge-graph-agent 0.2.0 → 0.3.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 (585) hide show
  1. package/README.md +686 -304
  2. package/dist/_virtual/_commonjsHelpers.js +7 -0
  3. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  4. package/dist/_virtual/additionalItems.js +5 -0
  5. package/dist/_virtual/additionalItems.js.map +1 -0
  6. package/dist/_virtual/additionalProperties.js +5 -0
  7. package/dist/_virtual/additionalProperties.js.map +1 -0
  8. package/dist/_virtual/ajv.js +6 -0
  9. package/dist/_virtual/ajv.js.map +1 -0
  10. package/dist/_virtual/ajv2.js +5 -0
  11. package/dist/_virtual/ajv2.js.map +1 -0
  12. package/dist/_virtual/allOf.js +5 -0
  13. package/dist/_virtual/allOf.js.map +1 -0
  14. package/dist/_virtual/anyOf.js +5 -0
  15. package/dist/_virtual/anyOf.js.map +1 -0
  16. package/dist/_virtual/applicability.js +5 -0
  17. package/dist/_virtual/applicability.js.map +1 -0
  18. package/dist/_virtual/boolSchema.js +5 -0
  19. package/dist/_virtual/boolSchema.js.map +1 -0
  20. package/dist/_virtual/code.js +5 -0
  21. package/dist/_virtual/code.js.map +1 -0
  22. package/dist/_virtual/code2.js +5 -0
  23. package/dist/_virtual/code2.js.map +1 -0
  24. package/dist/_virtual/const.js +5 -0
  25. package/dist/_virtual/const.js.map +1 -0
  26. package/dist/_virtual/contains.js +5 -0
  27. package/dist/_virtual/contains.js.map +1 -0
  28. package/dist/_virtual/core.js +5 -0
  29. package/dist/_virtual/core.js.map +1 -0
  30. package/dist/_virtual/dataType.js +5 -0
  31. package/dist/_virtual/dataType.js.map +1 -0
  32. package/dist/_virtual/defaults.js +5 -0
  33. package/dist/_virtual/defaults.js.map +1 -0
  34. package/dist/_virtual/dependencies.js +5 -0
  35. package/dist/_virtual/dependencies.js.map +1 -0
  36. package/dist/_virtual/draft7.js +5 -0
  37. package/dist/_virtual/draft7.js.map +1 -0
  38. package/dist/_virtual/enum.js +5 -0
  39. package/dist/_virtual/enum.js.map +1 -0
  40. package/dist/_virtual/equal.js +5 -0
  41. package/dist/_virtual/equal.js.map +1 -0
  42. package/dist/_virtual/errors.js +5 -0
  43. package/dist/_virtual/errors.js.map +1 -0
  44. package/dist/_virtual/format.js +5 -0
  45. package/dist/_virtual/format.js.map +1 -0
  46. package/dist/_virtual/formats.js +5 -0
  47. package/dist/_virtual/formats.js.map +1 -0
  48. package/dist/_virtual/id.js +5 -0
  49. package/dist/_virtual/id.js.map +1 -0
  50. package/dist/_virtual/if.js +5 -0
  51. package/dist/_virtual/if.js.map +1 -0
  52. package/dist/_virtual/index.js +8 -0
  53. package/dist/_virtual/index.js.map +1 -0
  54. package/dist/_virtual/index10.js +5 -0
  55. package/dist/_virtual/index10.js.map +1 -0
  56. package/dist/_virtual/index11.js +5 -0
  57. package/dist/_virtual/index11.js.map +1 -0
  58. package/dist/_virtual/index12.js +5 -0
  59. package/dist/_virtual/index12.js.map +1 -0
  60. package/dist/_virtual/index2.js +5 -0
  61. package/dist/_virtual/index2.js.map +1 -0
  62. package/dist/_virtual/index3.js +5 -0
  63. package/dist/_virtual/index3.js.map +1 -0
  64. package/dist/_virtual/index4.js +5 -0
  65. package/dist/_virtual/index4.js.map +1 -0
  66. package/dist/_virtual/index5.js +5 -0
  67. package/dist/_virtual/index5.js.map +1 -0
  68. package/dist/_virtual/index6.js +5 -0
  69. package/dist/_virtual/index6.js.map +1 -0
  70. package/dist/_virtual/index7.js +5 -0
  71. package/dist/_virtual/index7.js.map +1 -0
  72. package/dist/_virtual/index8.js +5 -0
  73. package/dist/_virtual/index8.js.map +1 -0
  74. package/dist/_virtual/index9.js +5 -0
  75. package/dist/_virtual/index9.js.map +1 -0
  76. package/dist/_virtual/items.js +5 -0
  77. package/dist/_virtual/items.js.map +1 -0
  78. package/dist/_virtual/items2020.js +5 -0
  79. package/dist/_virtual/items2020.js.map +1 -0
  80. package/dist/_virtual/keyword.js +5 -0
  81. package/dist/_virtual/keyword.js.map +1 -0
  82. package/dist/_virtual/limit.js +5 -0
  83. package/dist/_virtual/limit.js.map +1 -0
  84. package/dist/_virtual/limitItems.js +5 -0
  85. package/dist/_virtual/limitItems.js.map +1 -0
  86. package/dist/_virtual/limitLength.js +5 -0
  87. package/dist/_virtual/limitLength.js.map +1 -0
  88. package/dist/_virtual/limitNumber.js +5 -0
  89. package/dist/_virtual/limitNumber.js.map +1 -0
  90. package/dist/_virtual/limitProperties.js +5 -0
  91. package/dist/_virtual/limitProperties.js.map +1 -0
  92. package/dist/_virtual/metadata.js +5 -0
  93. package/dist/_virtual/metadata.js.map +1 -0
  94. package/dist/_virtual/multipleOf.js +5 -0
  95. package/dist/_virtual/multipleOf.js.map +1 -0
  96. package/dist/_virtual/names.js +5 -0
  97. package/dist/_virtual/names.js.map +1 -0
  98. package/dist/_virtual/not.js +5 -0
  99. package/dist/_virtual/not.js.map +1 -0
  100. package/dist/_virtual/oneOf.js +5 -0
  101. package/dist/_virtual/oneOf.js.map +1 -0
  102. package/dist/_virtual/pattern.js +5 -0
  103. package/dist/_virtual/pattern.js.map +1 -0
  104. package/dist/_virtual/patternProperties.js +5 -0
  105. package/dist/_virtual/patternProperties.js.map +1 -0
  106. package/dist/_virtual/prefixItems.js +5 -0
  107. package/dist/_virtual/prefixItems.js.map +1 -0
  108. package/dist/_virtual/properties.js +5 -0
  109. package/dist/_virtual/properties.js.map +1 -0
  110. package/dist/_virtual/propertyNames.js +5 -0
  111. package/dist/_virtual/propertyNames.js.map +1 -0
  112. package/dist/_virtual/ref.js +5 -0
  113. package/dist/_virtual/ref.js.map +1 -0
  114. package/dist/_virtual/ref_error.js +5 -0
  115. package/dist/_virtual/ref_error.js.map +1 -0
  116. package/dist/_virtual/required.js +5 -0
  117. package/dist/_virtual/required.js.map +1 -0
  118. package/dist/_virtual/resolve.js +5 -0
  119. package/dist/_virtual/resolve.js.map +1 -0
  120. package/dist/_virtual/rules.js +5 -0
  121. package/dist/_virtual/rules.js.map +1 -0
  122. package/dist/_virtual/scope.js +5 -0
  123. package/dist/_virtual/scope.js.map +1 -0
  124. package/dist/_virtual/subschema.js +5 -0
  125. package/dist/_virtual/subschema.js.map +1 -0
  126. package/dist/_virtual/thenElse.js +5 -0
  127. package/dist/_virtual/thenElse.js.map +1 -0
  128. package/dist/_virtual/types.js +5 -0
  129. package/dist/_virtual/types.js.map +1 -0
  130. package/dist/_virtual/ucs2length.js +5 -0
  131. package/dist/_virtual/ucs2length.js.map +1 -0
  132. package/dist/_virtual/uniqueItems.js +5 -0
  133. package/dist/_virtual/uniqueItems.js.map +1 -0
  134. package/dist/_virtual/uri.js +5 -0
  135. package/dist/_virtual/uri.js.map +1 -0
  136. package/dist/_virtual/util.js +5 -0
  137. package/dist/_virtual/util.js.map +1 -0
  138. package/dist/_virtual/validation_error.js +5 -0
  139. package/dist/_virtual/validation_error.js.map +1 -0
  140. package/dist/agents/analyst-agent.d.ts +230 -0
  141. package/dist/agents/analyst-agent.d.ts.map +1 -0
  142. package/dist/agents/analyst-agent.js +793 -0
  143. package/dist/agents/analyst-agent.js.map +1 -0
  144. package/dist/agents/architect-agent.d.ts +248 -0
  145. package/dist/agents/architect-agent.d.ts.map +1 -0
  146. package/dist/agents/architect-agent.js +685 -0
  147. package/dist/agents/architect-agent.js.map +1 -0
  148. package/dist/agents/base-agent.d.ts +169 -0
  149. package/dist/agents/base-agent.d.ts.map +1 -0
  150. package/dist/agents/base-agent.js +441 -0
  151. package/dist/agents/base-agent.js.map +1 -0
  152. package/dist/agents/coder-agent.d.ts +191 -0
  153. package/dist/agents/coder-agent.d.ts.map +1 -0
  154. package/dist/agents/coder-agent.js +1008 -0
  155. package/dist/agents/coder-agent.js.map +1 -0
  156. package/dist/agents/index.d.ts +18 -0
  157. package/dist/agents/index.d.ts.map +1 -0
  158. package/dist/agents/index.js +40 -0
  159. package/dist/agents/index.js.map +1 -0
  160. package/dist/agents/registry.d.ts +213 -0
  161. package/dist/agents/registry.d.ts.map +1 -0
  162. package/dist/agents/registry.js +419 -0
  163. package/dist/agents/registry.js.map +1 -0
  164. package/dist/agents/researcher-agent.d.ts +226 -0
  165. package/dist/agents/researcher-agent.d.ts.map +1 -0
  166. package/dist/agents/researcher-agent.js +572 -0
  167. package/dist/agents/researcher-agent.js.map +1 -0
  168. package/dist/agents/rules-engine.d.ts +320 -0
  169. package/dist/agents/rules-engine.d.ts.map +1 -0
  170. package/dist/agents/rules-engine.js +552 -0
  171. package/dist/agents/rules-engine.js.map +1 -0
  172. package/dist/agents/tester-agent.d.ts +219 -0
  173. package/dist/agents/tester-agent.d.ts.map +1 -0
  174. package/dist/agents/tester-agent.js +683 -0
  175. package/dist/agents/tester-agent.js.map +1 -0
  176. package/dist/agents/types.d.ts +425 -0
  177. package/dist/agents/types.d.ts.map +1 -0
  178. package/dist/agents/types.js +57 -0
  179. package/dist/agents/types.js.map +1 -0
  180. package/dist/caching/index.d.ts +55 -0
  181. package/dist/caching/index.d.ts.map +1 -0
  182. package/dist/caching/index.js +206 -0
  183. package/dist/caching/index.js.map +1 -0
  184. package/dist/caching/lru-cache.d.ts +254 -0
  185. package/dist/caching/lru-cache.d.ts.map +1 -0
  186. package/dist/caching/types.d.ts +95 -0
  187. package/dist/caching/types.d.ts.map +1 -0
  188. package/dist/chunking/chunker.d.ts +94 -0
  189. package/dist/chunking/chunker.d.ts.map +1 -0
  190. package/dist/chunking/index.d.ts +125 -0
  191. package/dist/chunking/index.d.ts.map +1 -0
  192. package/dist/chunking/index.js +283 -0
  193. package/dist/chunking/index.js.map +1 -0
  194. package/dist/chunking/types.d.ts +92 -0
  195. package/dist/chunking/types.d.ts.map +1 -0
  196. package/dist/cli/commands/commit.d.ts +11 -0
  197. package/dist/cli/commands/commit.d.ts.map +1 -0
  198. package/dist/cli/commands/commit.js +379 -0
  199. package/dist/cli/commands/commit.js.map +1 -0
  200. package/dist/cli/commands/config.d.ts +8 -0
  201. package/dist/cli/commands/config.d.ts.map +1 -0
  202. package/dist/cli/commands/config.js +107 -0
  203. package/dist/cli/commands/config.js.map +1 -0
  204. package/dist/cli/commands/cultivate.d.ts +16 -0
  205. package/dist/cli/commands/cultivate.d.ts.map +1 -0
  206. package/dist/cli/commands/cultivate.js +254 -0
  207. package/dist/cli/commands/cultivate.js.map +1 -0
  208. package/dist/cli/commands/diagnostics.d.ts +8 -0
  209. package/dist/cli/commands/diagnostics.d.ts.map +1 -0
  210. package/dist/cli/commands/diagnostics.js +140 -0
  211. package/dist/cli/commands/diagnostics.js.map +1 -0
  212. package/dist/cli/commands/generate.d.ts +13 -0
  213. package/dist/cli/commands/generate.d.ts.map +1 -0
  214. package/dist/cli/commands/init-primitives.d.ts +19 -0
  215. package/dist/cli/commands/init-primitives.d.ts.map +1 -0
  216. package/dist/cli/commands/init-primitives.js +208 -0
  217. package/dist/cli/commands/init-primitives.js.map +1 -0
  218. package/dist/cli/commands/sop.d.ts +14 -0
  219. package/dist/cli/commands/sop.d.ts.map +1 -0
  220. package/dist/cli/commands/sop.js +598 -0
  221. package/dist/cli/commands/sop.js.map +1 -0
  222. package/dist/cli/index.d.ts.map +1 -1
  223. package/dist/cli/index.js +40 -1
  224. package/dist/cli/index.js.map +1 -1
  225. package/dist/config/index.d.ts +153 -0
  226. package/dist/config/index.d.ts.map +1 -0
  227. package/dist/config/index.js +141 -0
  228. package/dist/config/index.js.map +1 -0
  229. package/dist/config/manager.d.ts +136 -0
  230. package/dist/config/manager.d.ts.map +1 -0
  231. package/dist/config/types.d.ts +127 -0
  232. package/dist/config/types.d.ts.map +1 -0
  233. package/dist/core/cache.d.ts +185 -0
  234. package/dist/core/cache.d.ts.map +1 -0
  235. package/dist/core/cache.js +435 -0
  236. package/dist/core/cache.js.map +1 -0
  237. package/dist/cultivation/deep-analyzer.d.ts +129 -0
  238. package/dist/cultivation/deep-analyzer.d.ts.map +1 -0
  239. package/dist/cultivation/deep-analyzer.js +322 -0
  240. package/dist/cultivation/deep-analyzer.js.map +1 -0
  241. package/dist/cultivation/index.d.ts +13 -0
  242. package/dist/cultivation/index.d.ts.map +1 -0
  243. package/dist/cultivation/seed-generator.d.ts +92 -0
  244. package/dist/cultivation/seed-generator.d.ts.map +1 -0
  245. package/dist/cultivation/seed-generator.js +1033 -0
  246. package/dist/cultivation/seed-generator.js.map +1 -0
  247. package/dist/cultivation/types.d.ts +230 -0
  248. package/dist/cultivation/types.d.ts.map +1 -0
  249. package/dist/generators/claude-md.d.ts +7 -0
  250. package/dist/generators/claude-md.d.ts.map +1 -1
  251. package/dist/generators/claude-md.js.map +1 -1
  252. package/dist/generators/docs-init.d.ts +6 -0
  253. package/dist/generators/docs-init.d.ts.map +1 -1
  254. package/dist/generators/docs-init.js.map +1 -1
  255. package/dist/health/checks.d.ts +135 -0
  256. package/dist/health/checks.d.ts.map +1 -0
  257. package/dist/health/index.d.ts +119 -0
  258. package/dist/health/index.d.ts.map +1 -0
  259. package/dist/health/index.js +191 -0
  260. package/dist/health/index.js.map +1 -0
  261. package/dist/health/monitor.d.ts +146 -0
  262. package/dist/health/monitor.d.ts.map +1 -0
  263. package/dist/health/types.d.ts +135 -0
  264. package/dist/health/types.d.ts.map +1 -0
  265. package/dist/index.d.ts +30 -0
  266. package/dist/index.d.ts.map +1 -1
  267. package/dist/index.js +173 -1
  268. package/dist/index.js.map +1 -1
  269. package/dist/integrations/auto-commit.d.ts +175 -0
  270. package/dist/integrations/auto-commit.d.ts.map +1 -0
  271. package/dist/integrations/auto-commit.js +399 -0
  272. package/dist/integrations/auto-commit.js.map +1 -0
  273. package/dist/integrations/git.d.ts +299 -0
  274. package/dist/integrations/git.d.ts.map +1 -0
  275. package/dist/integrations/git.js +465 -0
  276. package/dist/integrations/git.js.map +1 -0
  277. package/dist/mcp-server/bin.d.ts +11 -0
  278. package/dist/mcp-server/bin.d.ts.map +1 -0
  279. package/dist/mcp-server/handlers/index.d.ts +57 -0
  280. package/dist/mcp-server/handlers/index.d.ts.map +1 -0
  281. package/dist/mcp-server/handlers/index.js +235 -0
  282. package/dist/mcp-server/handlers/index.js.map +1 -0
  283. package/dist/mcp-server/index.d.ts +28 -0
  284. package/dist/mcp-server/index.d.ts.map +1 -0
  285. package/dist/mcp-server/server.d.ts +133 -0
  286. package/dist/mcp-server/server.d.ts.map +1 -0
  287. package/dist/mcp-server/server.js +280 -0
  288. package/dist/mcp-server/server.js.map +1 -0
  289. package/dist/mcp-server/tools/agents/index.d.ts +10 -0
  290. package/dist/mcp-server/tools/agents/index.d.ts.map +1 -0
  291. package/dist/mcp-server/tools/agents/list.d.ts +19 -0
  292. package/dist/mcp-server/tools/agents/list.d.ts.map +1 -0
  293. package/dist/mcp-server/tools/agents/spawn.d.ts +19 -0
  294. package/dist/mcp-server/tools/agents/spawn.d.ts.map +1 -0
  295. package/dist/mcp-server/tools/graph/generate.d.ts +21 -0
  296. package/dist/mcp-server/tools/graph/generate.d.ts.map +1 -0
  297. package/dist/mcp-server/tools/graph/index.d.ts +11 -0
  298. package/dist/mcp-server/tools/graph/index.d.ts.map +1 -0
  299. package/dist/mcp-server/tools/graph/query.d.ts +22 -0
  300. package/dist/mcp-server/tools/graph/query.d.ts.map +1 -0
  301. package/dist/mcp-server/tools/graph/stats.d.ts +22 -0
  302. package/dist/mcp-server/tools/graph/stats.d.ts.map +1 -0
  303. package/dist/mcp-server/tools/health.d.ts +21 -0
  304. package/dist/mcp-server/tools/health.d.ts.map +1 -0
  305. package/dist/mcp-server/tools/index.d.ts +13 -0
  306. package/dist/mcp-server/tools/index.d.ts.map +1 -0
  307. package/dist/mcp-server/tools/registry.d.ts +90 -0
  308. package/dist/mcp-server/tools/registry.d.ts.map +1 -0
  309. package/dist/mcp-server/tools/registry.js +663 -0
  310. package/dist/mcp-server/tools/registry.js.map +1 -0
  311. package/dist/mcp-server/tools/search/index.d.ts +10 -0
  312. package/dist/mcp-server/tools/search/index.d.ts.map +1 -0
  313. package/dist/mcp-server/tools/search/nodes.d.ts +22 -0
  314. package/dist/mcp-server/tools/search/nodes.d.ts.map +1 -0
  315. package/dist/mcp-server/tools/search/tags.d.ts +22 -0
  316. package/dist/mcp-server/tools/search/tags.d.ts.map +1 -0
  317. package/dist/mcp-server/types/index.d.ts +286 -0
  318. package/dist/mcp-server/types/index.d.ts.map +1 -0
  319. package/dist/memory/index.d.ts +10 -0
  320. package/dist/memory/index.d.ts.map +1 -0
  321. package/dist/memory/vault-sync.d.ts +212 -0
  322. package/dist/memory/vault-sync.d.ts.map +1 -0
  323. package/dist/memory/vault-sync.js +463 -0
  324. package/dist/memory/vault-sync.js.map +1 -0
  325. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +296 -0
  326. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
  327. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +71 -0
  328. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
  329. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +26 -0
  330. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  331. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +407 -0
  332. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
  333. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1332 -0
  334. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
  335. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +71 -0
  336. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
  337. package/dist/node_modules/ajv/dist/ajv.js +84 -0
  338. package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
  339. package/dist/node_modules/ajv/dist/compile/codegen/code.js +160 -0
  340. package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
  341. package/dist/node_modules/ajv/dist/compile/codegen/index.js +728 -0
  342. package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
  343. package/dist/node_modules/ajv/dist/compile/codegen/scope.js +152 -0
  344. package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
  345. package/dist/node_modules/ajv/dist/compile/errors.js +131 -0
  346. package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
  347. package/dist/node_modules/ajv/dist/compile/index.js +234 -0
  348. package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
  349. package/dist/node_modules/ajv/dist/compile/names.js +44 -0
  350. package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
  351. package/dist/node_modules/ajv/dist/compile/ref_error.js +22 -0
  352. package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
  353. package/dist/node_modules/ajv/dist/compile/resolve.js +163 -0
  354. package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
  355. package/dist/node_modules/ajv/dist/compile/rules.js +35 -0
  356. package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
  357. package/dist/node_modules/ajv/dist/compile/util.js +173 -0
  358. package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
  359. package/dist/node_modules/ajv/dist/compile/validate/applicability.js +27 -0
  360. package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
  361. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +58 -0
  362. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
  363. package/dist/node_modules/ajv/dist/compile/validate/dataType.js +193 -0
  364. package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
  365. package/dist/node_modules/ajv/dist/compile/validate/defaults.js +43 -0
  366. package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
  367. package/dist/node_modules/ajv/dist/compile/validate/index.js +522 -0
  368. package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
  369. package/dist/node_modules/ajv/dist/compile/validate/keyword.js +126 -0
  370. package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
  371. package/dist/node_modules/ajv/dist/compile/validate/subschema.js +89 -0
  372. package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
  373. package/dist/node_modules/ajv/dist/core.js +628 -0
  374. package/dist/node_modules/ajv/dist/core.js.map +1 -0
  375. package/dist/node_modules/ajv/dist/refs/data.json.js +24 -0
  376. package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
  377. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +25 -0
  378. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
  379. package/dist/node_modules/ajv/dist/runtime/equal.js +16 -0
  380. package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
  381. package/dist/node_modules/ajv/dist/runtime/ucs2length.js +30 -0
  382. package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
  383. package/dist/node_modules/ajv/dist/runtime/uri.js +16 -0
  384. package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  385. package/dist/node_modules/ajv/dist/runtime/validation_error.js +20 -0
  386. package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
  387. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +59 -0
  388. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
  389. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +114 -0
  390. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
  391. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +32 -0
  392. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
  393. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +22 -0
  394. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
  395. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +100 -0
  396. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
  397. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +103 -0
  398. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
  399. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +75 -0
  400. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
  401. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +68 -0
  402. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
  403. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +64 -0
  404. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
  405. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +43 -0
  406. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
  407. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +36 -0
  408. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
  409. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
  410. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
  411. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +81 -0
  412. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
  413. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +22 -0
  414. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
  415. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +66 -0
  416. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
  417. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +49 -0
  418. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
  419. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +23 -0
  420. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
  421. package/dist/node_modules/ajv/dist/vocabularies/code.js +140 -0
  422. package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
  423. package/dist/node_modules/ajv/dist/vocabularies/core/id.js +19 -0
  424. package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
  425. package/dist/node_modules/ajv/dist/vocabularies/core/index.js +27 -0
  426. package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
  427. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +132 -0
  428. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
  429. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +114 -0
  430. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
  431. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +18 -0
  432. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
  433. package/dist/node_modules/ajv/dist/vocabularies/draft7.js +31 -0
  434. package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
  435. package/dist/node_modules/ajv/dist/vocabularies/format/format.js +95 -0
  436. package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
  437. package/dist/node_modules/ajv/dist/vocabularies/format/index.js +16 -0
  438. package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
  439. package/dist/node_modules/ajv/dist/vocabularies/metadata.js +27 -0
  440. package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
  441. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +36 -0
  442. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
  443. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +56 -0
  444. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
  445. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +52 -0
  446. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
  447. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +34 -0
  448. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
  449. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +39 -0
  450. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
  451. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +37 -0
  452. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
  453. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +34 -0
  454. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
  455. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +33 -0
  456. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
  457. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +34 -0
  458. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
  459. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +89 -0
  460. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
  461. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +75 -0
  462. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
  463. package/dist/node_modules/ajv-formats/dist/formats.js +209 -0
  464. package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
  465. package/dist/node_modules/ajv-formats/dist/index.js +51 -0
  466. package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
  467. package/dist/node_modules/ajv-formats/dist/limit.js +80 -0
  468. package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
  469. package/dist/node_modules/fast-deep-equal/index.js +39 -0
  470. package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
  471. package/dist/node_modules/fast-uri/index.js +261 -0
  472. package/dist/node_modules/fast-uri/index.js.map +1 -0
  473. package/dist/node_modules/fast-uri/lib/schemes.js +215 -0
  474. package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
  475. package/dist/node_modules/fast-uri/lib/utils.js +261 -0
  476. package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
  477. package/dist/node_modules/json-schema-traverse/index.js +92 -0
  478. package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
  479. package/dist/node_modules/zod/v4/classic/errors.js +37 -0
  480. package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
  481. package/dist/node_modules/zod/v4/classic/iso.js +43 -0
  482. package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
  483. package/dist/node_modules/zod/v4/classic/parse.js +13 -0
  484. package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
  485. package/dist/node_modules/zod/v4/classic/schemas.js +688 -0
  486. package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
  487. package/dist/node_modules/zod/v4/core/api.js +492 -0
  488. package/dist/node_modules/zod/v4/core/api.js.map +1 -0
  489. package/dist/node_modules/zod/v4/core/checks.js +405 -0
  490. package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
  491. package/dist/node_modules/zod/v4/core/core.js +58 -0
  492. package/dist/node_modules/zod/v4/core/core.js.map +1 -0
  493. package/dist/node_modules/zod/v4/core/doc.js +38 -0
  494. package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
  495. package/dist/node_modules/zod/v4/core/errors.js +82 -0
  496. package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
  497. package/dist/node_modules/zod/v4/core/parse.js +60 -0
  498. package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
  499. package/dist/node_modules/zod/v4/core/regexes.js +87 -0
  500. package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
  501. package/dist/node_modules/zod/v4/core/registries.js +52 -0
  502. package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
  503. package/dist/node_modules/zod/v4/core/schemas.js +1283 -0
  504. package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
  505. package/dist/node_modules/zod/v4/core/util.js +341 -0
  506. package/dist/node_modules/zod/v4/core/util.js.map +1 -0
  507. package/dist/node_modules/zod/v4/core/versions.js +9 -0
  508. package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
  509. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +2 -0
  510. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
  511. package/dist/reasoning/index.d.ts +74 -0
  512. package/dist/reasoning/index.d.ts.map +1 -0
  513. package/dist/reasoning/index.js +124 -0
  514. package/dist/reasoning/index.js.map +1 -0
  515. package/dist/reasoning/tracker.d.ts +210 -0
  516. package/dist/reasoning/tracker.d.ts.map +1 -0
  517. package/dist/reasoning/types.d.ts +146 -0
  518. package/dist/reasoning/types.d.ts.map +1 -0
  519. package/dist/recovery/backup.d.ts +110 -0
  520. package/dist/recovery/backup.d.ts.map +1 -0
  521. package/dist/recovery/index.d.ts +70 -0
  522. package/dist/recovery/index.d.ts.map +1 -0
  523. package/dist/recovery/index.js +186 -0
  524. package/dist/recovery/index.js.map +1 -0
  525. package/dist/recovery/integrity.d.ts +74 -0
  526. package/dist/recovery/integrity.d.ts.map +1 -0
  527. package/dist/recovery/types.d.ts +94 -0
  528. package/dist/recovery/types.d.ts.map +1 -0
  529. package/dist/services/index.d.ts +130 -0
  530. package/dist/services/index.d.ts.map +1 -0
  531. package/dist/services/index.js +134 -0
  532. package/dist/services/index.js.map +1 -0
  533. package/dist/services/manager.d.ts +140 -0
  534. package/dist/services/manager.d.ts.map +1 -0
  535. package/dist/services/types.d.ts +106 -0
  536. package/dist/services/types.d.ts.map +1 -0
  537. package/dist/services/watchers.d.ts +95 -0
  538. package/dist/services/watchers.d.ts.map +1 -0
  539. package/dist/sops/compliance-checker.d.ts +83 -0
  540. package/dist/sops/compliance-checker.d.ts.map +1 -0
  541. package/dist/sops/compliance-checker.js +399 -0
  542. package/dist/sops/compliance-checker.js.map +1 -0
  543. package/dist/sops/gap-analyzer.d.ts +124 -0
  544. package/dist/sops/gap-analyzer.d.ts.map +1 -0
  545. package/dist/sops/gap-analyzer.js +313 -0
  546. package/dist/sops/gap-analyzer.js.map +1 -0
  547. package/dist/sops/index.d.ts +14 -0
  548. package/dist/sops/index.d.ts.map +1 -0
  549. package/dist/sops/overlay-manager.d.ts +115 -0
  550. package/dist/sops/overlay-manager.d.ts.map +1 -0
  551. package/dist/sops/overlay-manager.js +394 -0
  552. package/dist/sops/overlay-manager.js.map +1 -0
  553. package/dist/sops/registry.d.ts +73 -0
  554. package/dist/sops/registry.d.ts.map +1 -0
  555. package/dist/sops/registry.js +919 -0
  556. package/dist/sops/registry.js.map +1 -0
  557. package/dist/sops/types.d.ts +377 -0
  558. package/dist/sops/types.d.ts.map +1 -0
  559. package/dist/sops/types.js +46 -0
  560. package/dist/sops/types.js.map +1 -0
  561. package/dist/utils/error-recovery.d.ts +230 -0
  562. package/dist/utils/error-recovery.d.ts.map +1 -0
  563. package/dist/utils/error-recovery.js +228 -0
  564. package/dist/utils/error-recovery.js.map +1 -0
  565. package/dist/utils/error-taxonomy.d.ts +149 -0
  566. package/dist/utils/error-taxonomy.d.ts.map +1 -0
  567. package/dist/utils/error-taxonomy.js +260 -0
  568. package/dist/utils/error-taxonomy.js.map +1 -0
  569. package/dist/utils/index.d.ts +11 -0
  570. package/dist/utils/index.d.ts.map +1 -0
  571. package/dist/utils/logger.d.ts +139 -0
  572. package/dist/utils/logger.d.ts.map +1 -0
  573. package/dist/utils/logger.js +311 -0
  574. package/dist/utils/logger.js.map +1 -0
  575. package/dist/workflows/index.d.ts +11 -0
  576. package/dist/workflows/index.d.ts.map +1 -0
  577. package/dist/workflows/registry.d.ts +118 -0
  578. package/dist/workflows/registry.d.ts.map +1 -0
  579. package/dist/workflows/registry.js +575 -0
  580. package/dist/workflows/registry.js.map +1 -0
  581. package/dist/workflows/types.d.ts +322 -0
  582. package/dist/workflows/types.d.ts.map +1 -0
  583. package/dist/workflows/types.js +16 -0
  584. package/dist/workflows/types.js.map +1 -0
  585. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","sources":["../../../../../../../../../node_modules/zod-to-json-schema/dist/esm/parsers/string.js"],"sourcesContent":["import { setResponseValueAndErrors } from \"../errorMessages.js\";\nlet emojiRegex = undefined;\n/**\n * Generated from the regular expressions found here as of 2024-05-22:\n * https://github.com/colinhacks/zod/blob/master/src/types.ts.\n *\n * Expressions with /i flag have been changed accordingly.\n */\nexport const zodPatterns = {\n /**\n * `c` was changed to `[cC]` to replicate /i flag\n */\n cuid: /^[cC][^\\s-]{8,}$/,\n cuid2: /^[0-9a-z]+$/,\n ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,\n /**\n * `a-z` was added to replicate /i flag\n */\n email: /^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,\n /**\n * Constructed a valid Unicode RegExp\n *\n * Lazily instantiate since this type of regex isn't supported\n * in all envs (e.g. React Native).\n *\n * See:\n * https://github.com/colinhacks/zod/issues/2433\n * Fix in Zod:\n * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b\n */\n emoji: () => {\n if (emojiRegex === undefined) {\n emojiRegex = RegExp(\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\", \"u\");\n }\n return emojiRegex;\n },\n /**\n * Unused\n */\n uuid: /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/,\n /**\n * Unused\n */\n ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,\n ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,\n /**\n * Unused\n */\n ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,\n ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,\n base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,\n base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,\n nanoid: /^[a-zA-Z0-9_-]{21}$/,\n jwt: /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,\n};\nexport function parseStringDef(def, refs) {\n const res = {\n type: \"string\",\n };\n if (def.checks) {\n for (const check of def.checks) {\n switch (check.kind) {\n case \"min\":\n setResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\"\n ? Math.max(res.minLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"max\":\n setResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\"\n ? Math.min(res.maxLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"email\":\n switch (refs.emailStrategy) {\n case \"format:email\":\n addFormat(res, \"email\", check.message, refs);\n break;\n case \"format:idn-email\":\n addFormat(res, \"idn-email\", check.message, refs);\n break;\n case \"pattern:zod\":\n addPattern(res, zodPatterns.email, check.message, refs);\n break;\n }\n break;\n case \"url\":\n addFormat(res, \"uri\", check.message, refs);\n break;\n case \"uuid\":\n addFormat(res, \"uuid\", check.message, refs);\n break;\n case \"regex\":\n addPattern(res, check.regex, check.message, refs);\n break;\n case \"cuid\":\n addPattern(res, zodPatterns.cuid, check.message, refs);\n break;\n case \"cuid2\":\n addPattern(res, zodPatterns.cuid2, check.message, refs);\n break;\n case \"startsWith\":\n addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);\n break;\n case \"endsWith\":\n addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);\n break;\n case \"datetime\":\n addFormat(res, \"date-time\", check.message, refs);\n break;\n case \"date\":\n addFormat(res, \"date\", check.message, refs);\n break;\n case \"time\":\n addFormat(res, \"time\", check.message, refs);\n break;\n case \"duration\":\n addFormat(res, \"duration\", check.message, refs);\n break;\n case \"length\":\n setResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\"\n ? Math.max(res.minLength, check.value)\n : check.value, check.message, refs);\n setResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\"\n ? Math.min(res.maxLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"includes\": {\n addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);\n break;\n }\n case \"ip\": {\n if (check.version !== \"v6\") {\n addFormat(res, \"ipv4\", check.message, refs);\n }\n if (check.version !== \"v4\") {\n addFormat(res, \"ipv6\", check.message, refs);\n }\n break;\n }\n case \"base64url\":\n addPattern(res, zodPatterns.base64url, check.message, refs);\n break;\n case \"jwt\":\n addPattern(res, zodPatterns.jwt, check.message, refs);\n break;\n case \"cidr\": {\n if (check.version !== \"v6\") {\n addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);\n }\n if (check.version !== \"v4\") {\n addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);\n }\n break;\n }\n case \"emoji\":\n addPattern(res, zodPatterns.emoji(), check.message, refs);\n break;\n case \"ulid\": {\n addPattern(res, zodPatterns.ulid, check.message, refs);\n break;\n }\n case \"base64\": {\n switch (refs.base64Strategy) {\n case \"format:binary\": {\n addFormat(res, \"binary\", check.message, refs);\n break;\n }\n case \"contentEncoding:base64\": {\n setResponseValueAndErrors(res, \"contentEncoding\", \"base64\", check.message, refs);\n break;\n }\n case \"pattern:zod\": {\n addPattern(res, zodPatterns.base64, check.message, refs);\n break;\n }\n }\n break;\n }\n case \"nanoid\": {\n addPattern(res, zodPatterns.nanoid, check.message, refs);\n }\n case \"toLowerCase\":\n case \"toUpperCase\":\n case \"trim\":\n break;\n default:\n ((_) => { })(check);\n }\n }\n }\n return res;\n}\nfunction escapeLiteralCheckValue(literal, refs) {\n return refs.patternStrategy === \"escape\"\n ? escapeNonAlphaNumeric(literal)\n : literal;\n}\nconst ALPHA_NUMERIC = new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");\nfunction escapeNonAlphaNumeric(source) {\n let result = \"\";\n for (let i = 0; i < source.length; i++) {\n if (!ALPHA_NUMERIC.has(source[i])) {\n result += \"\\\\\";\n }\n result += source[i];\n }\n return result;\n}\n// Adds a \"format\" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.\nfunction addFormat(schema, value, message, refs) {\n if (schema.format || schema.anyOf?.some((x) => x.format)) {\n if (!schema.anyOf) {\n schema.anyOf = [];\n }\n if (schema.format) {\n schema.anyOf.push({\n format: schema.format,\n ...(schema.errorMessage &&\n refs.errorMessages && {\n errorMessage: { format: schema.errorMessage.format },\n }),\n });\n delete schema.format;\n if (schema.errorMessage) {\n delete schema.errorMessage.format;\n if (Object.keys(schema.errorMessage).length === 0) {\n delete schema.errorMessage;\n }\n }\n }\n schema.anyOf.push({\n format: value,\n ...(message &&\n refs.errorMessages && { errorMessage: { format: message } }),\n });\n }\n else {\n setResponseValueAndErrors(schema, \"format\", value, message, refs);\n }\n}\n// Adds a \"pattern\" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.\nfunction addPattern(schema, regex, message, refs) {\n if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {\n if (!schema.allOf) {\n schema.allOf = [];\n }\n if (schema.pattern) {\n schema.allOf.push({\n pattern: schema.pattern,\n ...(schema.errorMessage &&\n refs.errorMessages && {\n errorMessage: { pattern: schema.errorMessage.pattern },\n }),\n });\n delete schema.pattern;\n if (schema.errorMessage) {\n delete schema.errorMessage.pattern;\n if (Object.keys(schema.errorMessage).length === 0) {\n delete schema.errorMessage;\n }\n }\n }\n schema.allOf.push({\n pattern: stringifyRegExpWithFlags(regex, refs),\n ...(message &&\n refs.errorMessages && { errorMessage: { pattern: message } }),\n });\n }\n else {\n setResponseValueAndErrors(schema, \"pattern\", stringifyRegExpWithFlags(regex, refs), message, refs);\n }\n}\n// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true\nfunction stringifyRegExpWithFlags(regex, refs) {\n if (!refs.applyRegexFlags || !regex.flags) {\n return regex.source;\n }\n // Currently handled flags\n const flags = {\n i: regex.flags.includes(\"i\"),\n m: regex.flags.includes(\"m\"),\n s: regex.flags.includes(\"s\"), // `.` matches newlines\n };\n // The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril!\n const source = flags.i ? regex.source.toLowerCase() : regex.source;\n let pattern = \"\";\n let isEscaped = false;\n let inCharGroup = false;\n let inCharRange = false;\n for (let i = 0; i < source.length; i++) {\n if (isEscaped) {\n pattern += source[i];\n isEscaped = false;\n continue;\n }\n if (flags.i) {\n if (inCharGroup) {\n if (source[i].match(/[a-z]/)) {\n if (inCharRange) {\n pattern += source[i];\n pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();\n inCharRange = false;\n }\n else if (source[i + 1] === \"-\" && source[i + 2]?.match(/[a-z]/)) {\n pattern += source[i];\n inCharRange = true;\n }\n else {\n pattern += `${source[i]}${source[i].toUpperCase()}`;\n }\n continue;\n }\n }\n else if (source[i].match(/[a-z]/)) {\n pattern += `[${source[i]}${source[i].toUpperCase()}]`;\n continue;\n }\n }\n if (flags.m) {\n if (source[i] === \"^\") {\n pattern += `(^|(?<=[\\r\\n]))`;\n continue;\n }\n else if (source[i] === \"$\") {\n pattern += `($|(?=[\\r\\n]))`;\n continue;\n }\n }\n if (flags.s && source[i] === \".\") {\n pattern += inCharGroup ? `${source[i]}\\r\\n` : `[${source[i]}\\r\\n]`;\n continue;\n }\n pattern += source[i];\n if (source[i] === \"\\\\\") {\n isEscaped = true;\n }\n else if (inCharGroup && source[i] === \"]\") {\n inCharGroup = false;\n }\n else if (!inCharGroup && source[i] === \"[\") {\n inCharGroup = true;\n }\n }\n try {\n new RegExp(pattern);\n }\n catch {\n console.warn(`Could not convert regex pattern at ${refs.currentPath.join(\"/\")} to a flag-independent form! Falling back to the flag-ignorant source`);\n return regex.source;\n }\n return pattern;\n}\n"],"names":[],"mappings":"AAqMsB,IAAI,IAAI,8DAA8D;","x_google_ignoreList":[0]}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Reasoning Module
3
+ *
4
+ * Provides decision tracking, reasoning chains, and explainability.
5
+ */
6
+ export type DecisionType = 'classification' | 'selection' | 'routing' | 'prioritization' | 'validation' | 'transformation';
7
+ export type ConfidenceLevel = 'very_low' | 'low' | 'medium' | 'high' | 'very_high';
8
+ export interface DecisionContext {
9
+ id: string;
10
+ input: Record<string, unknown>;
11
+ options?: string[];
12
+ constraints?: string[];
13
+ timestamp: Date;
14
+ }
15
+ export interface Alternative {
16
+ id: string;
17
+ description: string;
18
+ score: number;
19
+ reasonNotSelected?: string;
20
+ }
21
+ export interface DecisionOutcome {
22
+ selected: string;
23
+ confidence: ConfidenceLevel;
24
+ confidenceScore: number;
25
+ alternatives: Alternative[];
26
+ reasoning: string[];
27
+ }
28
+ export interface Decision {
29
+ id: string;
30
+ type: DecisionType;
31
+ context: DecisionContext;
32
+ outcome: DecisionOutcome;
33
+ duration: number;
34
+ metadata?: Record<string, unknown>;
35
+ }
36
+ export interface ReasoningChain {
37
+ id: string;
38
+ decisions: Decision[];
39
+ conclusion?: string;
40
+ confidence: ConfidenceLevel;
41
+ totalDuration: number;
42
+ metadata?: Record<string, unknown>;
43
+ }
44
+ export declare class DecisionTracker {
45
+ private decisions;
46
+ private chains;
47
+ private currentChainId?;
48
+ startChain(metadata?: Record<string, unknown>): string;
49
+ endChain(conclusion?: string): ReasoningChain | undefined;
50
+ recordDecision(type: DecisionType, context: Omit<DecisionContext, 'id' | 'timestamp'>, outcome: DecisionOutcome, duration: number, metadata?: Record<string, unknown>): Decision;
51
+ getDecision(id: string): Decision | undefined;
52
+ getChain(id: string): ReasoningChain | undefined;
53
+ getAllDecisions(): Decision[];
54
+ getAllChains(): ReasoningChain[];
55
+ getDecisionsByType(type: DecisionType): Decision[];
56
+ getRecentDecisions(limit?: number): Decision[];
57
+ getStatistics(): {
58
+ totalDecisions: number;
59
+ totalChains: number;
60
+ averageDuration: number;
61
+ byType: Record<DecisionType, number>;
62
+ byConfidence: Record<ConfidenceLevel, number>;
63
+ };
64
+ export(): {
65
+ decisions: Decision[];
66
+ chains: ReasoningChain[];
67
+ exportedAt: Date;
68
+ };
69
+ clear(): void;
70
+ private calculateChainConfidence;
71
+ }
72
+ export declare function createDecisionTracker(): DecisionTracker;
73
+ export declare function getDecisionTracker(): DecisionTracker;
74
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reasoning/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB,WAAW,GACX,SAAS,GACT,gBAAgB,GAChB,YAAY,GACZ,gBAAgB,CAAC;AAErB,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAEnF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAi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AAQ;IA4BX,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAI7C,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIhD,eAAe,IAAI,QAAQ,EAAE;IAI7B,YAAY,IAAI,cAAc,EAAE;IAIhC,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,EAAE;IAIlD,kBAAkB,CAAC,KAAK,GAAE,MAAW,GAAG,QAAQ,EAAE;IAMlD,aAAa,IAAI;QACf,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACrC,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;KAC/C;IAuBD,MAAM,IAAI;QACR,SAAS,EAAE,QAAQ,EAAE,CAAC;QACtB,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,UAAU,EAAE,IAAI,CAAC;KAClB;IAQD,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,wBAAwB;CAajC;AAQD,wBAAgB,qBAAqB,IAAI,eAAe,CAEvD;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAKpD"}
@@ -0,0 +1,124 @@
1
+ class DecisionTracker {
2
+ decisions = /* @__PURE__ */ new Map();
3
+ chains = /* @__PURE__ */ new Map();
4
+ currentChainId;
5
+ startChain(metadata) {
6
+ const id = `chain-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
7
+ this.chains.set(id, {
8
+ id,
9
+ decisions: [],
10
+ confidence: "medium",
11
+ totalDuration: 0,
12
+ metadata
13
+ });
14
+ this.currentChainId = id;
15
+ return id;
16
+ }
17
+ endChain(conclusion) {
18
+ if (!this.currentChainId) return void 0;
19
+ const chain = this.chains.get(this.currentChainId);
20
+ if (chain) {
21
+ chain.conclusion = conclusion;
22
+ chain.totalDuration = chain.decisions.reduce((sum, d) => sum + d.duration, 0);
23
+ chain.confidence = this.calculateChainConfidence(chain);
24
+ }
25
+ this.currentChainId = void 0;
26
+ return chain;
27
+ }
28
+ recordDecision(type, context, outcome, duration, metadata) {
29
+ const id = `decision-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
30
+ const decision = {
31
+ id,
32
+ type,
33
+ context: {
34
+ ...context,
35
+ id: `ctx-${id}`,
36
+ timestamp: /* @__PURE__ */ new Date()
37
+ },
38
+ outcome,
39
+ duration,
40
+ metadata
41
+ };
42
+ this.decisions.set(id, decision);
43
+ if (this.currentChainId) {
44
+ const chain = this.chains.get(this.currentChainId);
45
+ if (chain) {
46
+ chain.decisions.push(decision);
47
+ }
48
+ }
49
+ return decision;
50
+ }
51
+ getDecision(id) {
52
+ return this.decisions.get(id);
53
+ }
54
+ getChain(id) {
55
+ return this.chains.get(id);
56
+ }
57
+ getAllDecisions() {
58
+ return Array.from(this.decisions.values());
59
+ }
60
+ getAllChains() {
61
+ return Array.from(this.chains.values());
62
+ }
63
+ getDecisionsByType(type) {
64
+ return Array.from(this.decisions.values()).filter((d) => d.type === type);
65
+ }
66
+ getRecentDecisions(limit = 10) {
67
+ return Array.from(this.decisions.values()).sort((a, b) => b.context.timestamp.getTime() - a.context.timestamp.getTime()).slice(0, limit);
68
+ }
69
+ getStatistics() {
70
+ const decisions = Array.from(this.decisions.values());
71
+ const byType = {};
72
+ const byConfidence = {};
73
+ let totalDuration = 0;
74
+ for (const decision of decisions) {
75
+ byType[decision.type] = (byType[decision.type] || 0) + 1;
76
+ byConfidence[decision.outcome.confidence] = (byConfidence[decision.outcome.confidence] || 0) + 1;
77
+ totalDuration += decision.duration;
78
+ }
79
+ return {
80
+ totalDecisions: decisions.length,
81
+ totalChains: this.chains.size,
82
+ averageDuration: decisions.length > 0 ? totalDuration / decisions.length : 0,
83
+ byType,
84
+ byConfidence
85
+ };
86
+ }
87
+ export() {
88
+ return {
89
+ decisions: Array.from(this.decisions.values()),
90
+ chains: Array.from(this.chains.values()),
91
+ exportedAt: /* @__PURE__ */ new Date()
92
+ };
93
+ }
94
+ clear() {
95
+ this.decisions.clear();
96
+ this.chains.clear();
97
+ this.currentChainId = void 0;
98
+ }
99
+ calculateChainConfidence(chain) {
100
+ if (chain.decisions.length === 0) return "medium";
101
+ const avgScore = chain.decisions.reduce((sum, d) => sum + d.outcome.confidenceScore, 0) / chain.decisions.length;
102
+ if (avgScore >= 0.9) return "very_high";
103
+ if (avgScore >= 0.7) return "high";
104
+ if (avgScore >= 0.5) return "medium";
105
+ if (avgScore >= 0.3) return "low";
106
+ return "very_low";
107
+ }
108
+ }
109
+ let defaultTracker;
110
+ function createDecisionTracker() {
111
+ return new DecisionTracker();
112
+ }
113
+ function getDecisionTracker() {
114
+ if (!defaultTracker) {
115
+ defaultTracker = new DecisionTracker();
116
+ }
117
+ return defaultTracker;
118
+ }
119
+ export {
120
+ DecisionTracker,
121
+ createDecisionTracker,
122
+ getDecisionTracker
123
+ };
124
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/reasoning/index.ts"],"sourcesContent":["/**\n * Reasoning Module\n *\n * Provides decision tracking, reasoning chains, and explainability.\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type DecisionType =\n | 'classification'\n | 'selection'\n | 'routing'\n | 'prioritization'\n | 'validation'\n | 'transformation';\n\nexport type ConfidenceLevel = 'very_low' | 'low' | 'medium' | 'high' | 'very_high';\n\nexport interface DecisionContext {\n id: string;\n input: Record<string, unknown>;\n options?: string[];\n constraints?: string[];\n timestamp: Date;\n}\n\nexport interface Alternative {\n id: string;\n description: string;\n score: number;\n reasonNotSelected?: string;\n}\n\nexport interface DecisionOutcome {\n selected: string;\n confidence: ConfidenceLevel;\n confidenceScore: number;\n alternatives: Alternative[];\n reasoning: string[];\n}\n\nexport interface Decision {\n id: string;\n type: DecisionType;\n context: DecisionContext;\n outcome: DecisionOutcome;\n duration: number;\n metadata?: Record<string, unknown>;\n}\n\nexport interface ReasoningChain {\n id: string;\n decisions: Decision[];\n conclusion?: string;\n confidence: ConfidenceLevel;\n totalDuration: number;\n metadata?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Decision Tracker\n// ============================================================================\n\nexport class DecisionTracker {\n private decisions: Map<string, Decision> = new Map();\n private chains: Map<string, ReasoningChain> = new Map();\n private currentChainId?: string;\n\n startChain(metadata?: Record<string, unknown>): string {\n const id = `chain-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;\n\n this.chains.set(id, {\n id,\n decisions: [],\n confidence: 'medium',\n totalDuration: 0,\n metadata,\n });\n\n this.currentChainId = id;\n return id;\n }\n\n endChain(conclusion?: string): ReasoningChain | undefined {\n if (!this.currentChainId) return undefined;\n\n const chain = this.chains.get(this.currentChainId);\n if (chain) {\n chain.conclusion = conclusion;\n chain.totalDuration = chain.decisions.reduce((sum, d) => sum + d.duration, 0);\n chain.confidence = this.calculateChainConfidence(chain);\n }\n\n this.currentChainId = undefined;\n return chain;\n }\n\n recordDecision(\n type: DecisionType,\n context: Omit<DecisionContext, 'id' | 'timestamp'>,\n outcome: DecisionOutcome,\n duration: number,\n metadata?: Record<string, unknown>\n ): Decision {\n const id = `decision-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;\n\n const decision: Decision = {\n id,\n type,\n context: {\n ...context,\n id: `ctx-${id}`,\n timestamp: new Date(),\n },\n outcome,\n duration,\n metadata,\n };\n\n this.decisions.set(id, decision);\n\n if (this.currentChainId) {\n const chain = this.chains.get(this.currentChainId);\n if (chain) {\n chain.decisions.push(decision);\n }\n }\n\n return decision;\n }\n\n getDecision(id: string): Decision | undefined {\n return this.decisions.get(id);\n }\n\n getChain(id: string): ReasoningChain | undefined {\n return this.chains.get(id);\n }\n\n getAllDecisions(): Decision[] {\n return Array.from(this.decisions.values());\n }\n\n getAllChains(): ReasoningChain[] {\n return Array.from(this.chains.values());\n }\n\n getDecisionsByType(type: DecisionType): Decision[] {\n return Array.from(this.decisions.values()).filter((d) => d.type === type);\n }\n\n getRecentDecisions(limit: number = 10): Decision[] {\n return Array.from(this.decisions.values())\n .sort((a, b) => b.context.timestamp.getTime() - a.context.timestamp.getTime())\n .slice(0, limit);\n }\n\n getStatistics(): {\n totalDecisions: number;\n totalChains: number;\n averageDuration: number;\n byType: Record<DecisionType, number>;\n byConfidence: Record<ConfidenceLevel, number>;\n } {\n const decisions = Array.from(this.decisions.values());\n const byType: Record<string, number> = {};\n const byConfidence: Record<string, number> = {};\n\n let totalDuration = 0;\n\n for (const decision of decisions) {\n byType[decision.type] = (byType[decision.type] || 0) + 1;\n byConfidence[decision.outcome.confidence] =\n (byConfidence[decision.outcome.confidence] || 0) + 1;\n totalDuration += decision.duration;\n }\n\n return {\n totalDecisions: decisions.length,\n totalChains: this.chains.size,\n averageDuration: decisions.length > 0 ? totalDuration / decisions.length : 0,\n byType: byType as Record<DecisionType, number>,\n byConfidence: byConfidence as Record<ConfidenceLevel, number>,\n };\n }\n\n export(): {\n decisions: Decision[];\n chains: ReasoningChain[];\n exportedAt: Date;\n } {\n return {\n decisions: Array.from(this.decisions.values()),\n chains: Array.from(this.chains.values()),\n exportedAt: new Date(),\n };\n }\n\n clear(): void {\n this.decisions.clear();\n this.chains.clear();\n this.currentChainId = undefined;\n }\n\n private calculateChainConfidence(chain: ReasoningChain): ConfidenceLevel {\n if (chain.decisions.length === 0) return 'medium';\n\n const avgScore =\n chain.decisions.reduce((sum, d) => sum + d.outcome.confidenceScore, 0) /\n chain.decisions.length;\n\n if (avgScore >= 0.9) return 'very_high';\n if (avgScore >= 0.7) return 'high';\n if (avgScore >= 0.5) return 'medium';\n if (avgScore >= 0.3) return 'low';\n return 'very_low';\n }\n}\n\n// ============================================================================\n// Singleton Instance\n// ============================================================================\n\nlet defaultTracker: DecisionTracker | undefined;\n\nexport function createDecisionTracker(): DecisionTracker {\n return new DecisionTracker();\n}\n\nexport function getDecisionTracker(): DecisionTracker {\n if (!defa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AAA,EAEJ;AAAA,EAEA,SAIE;AACA,WAAO;AAAA,MACL,WAAW,MAAM,KAAK,KAAK,UAAU,QAAQ;AAAA,MAC7C,QAAQ,MAAM,KAAK,KAAK,OAAO,QAAQ;AAAA,MACvC,gCAAgB,KAAA;AAAA,IAAK;AAAA,EAEzB;AAAA,EAEA,QAAc;AACZ,SAAK,UAAU,MAAA;AACf,SAAK,OAAO,MAAA;AACZ,SAAK,iBAAiB;AAAA,EACxB;AAAA,EAEQ,yBAAyB,OAAwC;AACvE,QAAI,MAAM,UAAU,WAAW,EAAG,QAAO;AAEzC,UAAM,WACJ,MAAM,UAAU,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,QAAQ,iBAAiB,CAAC,IACrE,MAAM,UAAU;AAElB,QAAI,YAAY,IAAK,QAAO;AAC5B,QAAI,YAAY,IAAK,QAAO;AAC5B,QAAI,YAAY,IAAK,QAAO;AAC5B,QAAI,YAAY,IAAK,QAAO;AAC5B,WAAO;AAAA,EACT;AACF;AAMA,IAAI;AAEG,SAAS,wBAAyC;AACvD,SAAO,IAAI,gBAAA;AACb;AAEO,SAAS,qBAAsC;AACpD,MAAI,CAAC,gBAAgB;AACnB,qBAAiB,IAAI,gBAAA;AAAA,EACvB;AACA,SAAO;AACT;"}
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Decision Tracker - Track and explain AI decisions
3
+ *
4
+ * Provides comprehensive tracking of AI reasoning and decision-making,
5
+ * enabling transparency, debugging, and audit trails for all automated actions.
6
+ *
7
+ * @module reasoning/tracker
8
+ */
9
+ import { EventEmitter } from 'events';
10
+ import type { Decision, DecisionOutcome, ReasoningChain, ReasoningChainStatus, ConfidenceLevel, DecisionType, CreateDecisionParams, ReasoningStats } from './types.js';
11
+ /**
12
+ * Events emitted by the DecisionTracker
13
+ */
14
+ export interface DecisionTrackerEvents {
15
+ chainStarted: (chain: ReasoningChain) => void;
16
+ chainEnded: (chain: ReasoningChain) => void;
17
+ decisionRecorded: (decision: Decision) => void;
18
+ outcomeRecorded: (decision: Decision) => void;
19
+ }
20
+ /**
21
+ * Decision Tracker for recording, explaining, and auditing AI decisions
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const tracker = createDecisionTracker();
26
+ *
27
+ * // Start a reasoning chain for a goal
28
+ * const chainId = tracker.startChain('Process user query about entities');
29
+ *
30
+ * // Record decisions as they're made
31
+ * const decision = tracker.recordDecision({
32
+ * action: 'Extract entities from query',
33
+ * reasoning: [
34
+ * 'Query contains multiple noun phrases',
35
+ * 'NLP analysis identified 3 potential entities',
36
+ * 'Confidence scores above threshold for all 3',
37
+ * ],
38
+ * confidence: 'high',
39
+ * context: {
40
+ * trigger: 'user_query',
41
+ * inputs: { query: 'Tell me about Apple and Microsoft' },
42
+ * constraints: ['max 10 entities', 'confidence > 0.7'],
43
+ * alternatives: [],
44
+ * },
45
+ * });
46
+ *
47
+ * // Record outcome after execution
48
+ * tracker.recordOutcome(decision.id, {
49
+ * success: true,
50
+ * result: { entities: ['Apple', 'Microsoft'] },
51
+ * duration: 150,
52
+ * sideEffects: [],
53
+ * });
54
+ *
55
+ * // Get explanation
56
+ * console.log(tracker.explainDecision(decision.id));
57
+ *
58
+ * // End the chain
59
+ * tracker.endChain(chainId);
60
+ * ```
61
+ */
62
+ export declare class DecisionTracker extends EventEmitter {
63
+ private decisions;
64
+ private chains;
65
+ private currentChain?;
66
+ private maxDecisions;
67
+ private maxChains;
68
+ constructor(options?: {
69
+ maxDecisions?: number;
70
+ maxChains?: number;
71
+ });
72
+ /**
73
+ * Start a new reasoning chain for a specific goal
74
+ *
75
+ * @param goal - The goal this reasoning chain is working toward
76
+ * @returns The chain ID
77
+ */
78
+ startChain(goal: string): string;
79
+ /**
80
+ * Record a decision made by the system
81
+ *
82
+ * @param params - Decision parameters
83
+ * @returns The recorded decision
84
+ */
85
+ recordDecision(params: CreateDecisionParams): Decision;
86
+ /**
87
+ * Record the outcome of a decision after execution
88
+ *
89
+ * @param decisionId - ID of the decision
90
+ * @param outcome - The outcome to record
91
+ */
92
+ recordOutcome(decisionId: string, outcome: DecisionOutcome): void;
93
+ /**
94
+ * End a reasoning chain
95
+ *
96
+ * @param chainId - ID of the chain to end
97
+ * @param status - Final status of the chain
98
+ */
99
+ endChain(chainId: string, status?: ReasoningChainStatus): void;
100
+ /**
101
+ * Get a decision by ID
102
+ *
103
+ * @param id - Decision ID
104
+ * @returns The decision or undefined
105
+ */
106
+ getDecision(id: string): Decision | undefined;
107
+ /**
108
+ * Get a reasoning chain by ID
109
+ *
110
+ * @param id - Chain ID
111
+ * @returns The chain or undefined
112
+ */
113
+ getChain(id: string): ReasoningChain | undefined;
114
+ /**
115
+ * Get the currently active reasoning chain
116
+ *
117
+ * @returns The current chain or undefined
118
+ */
119
+ getCurrentChain(): ReasoningChain | undefined;
120
+ /**
121
+ * Get recent decisions
122
+ *
123
+ * @param limit - Maximum number of decisions to return
124
+ * @returns Array of recent decisions, newest first
125
+ */
126
+ getRecentDecisions(limit?: number): Decision[];
127
+ /**
128
+ * Get all decisions in a chain
129
+ *
130
+ * @param chainId - Chain ID
131
+ * @returns Array of decisions in the chain
132
+ */
133
+ getChainDecisions(chainId: string): Decision[];
134
+ /**
135
+ * Generate a human-readable explanation of a decision
136
+ *
137
+ * @param decisionId - ID of the decision to explain
138
+ * @returns Formatted explanation string
139
+ */
140
+ explainDecision(decisionId: string): string;
141
+ /**
142
+ * Generate a summary of a reasoning chain
143
+ *
144
+ * @param chainId - ID of the chain to summarize
145
+ * @returns Formatted summary string
146
+ */
147
+ summarizeChain(chainId: string): string;
148
+ /**
149
+ * Export a chain as a structured object for persistence or analysis
150
+ *
151
+ * @param chainId - ID of the chain to export
152
+ * @returns Structured chain data with explanations
153
+ */
154
+ exportChain(chainId: string): object;
155
+ /**
156
+ * Get statistics about reasoning performance
157
+ *
158
+ * @returns Reasoning statistics
159
+ */
160
+ getStats(): ReasoningStats;
161
+ /**
162
+ * Find decisions by criteria
163
+ *
164
+ * @param criteria - Search criteria
165
+ * @returns Matching decisions
166
+ */
167
+ findDecisions(criteria: {
168
+ type?: DecisionType;
169
+ confidence?: ConfidenceLevel;
170
+ success?: boolean;
171
+ afterDate?: Date;
172
+ beforeDate?: Date;
173
+ actionContains?: string;
174
+ }): Decision[];
175
+ /**
176
+ * Clear all tracked decisions and chains
177
+ */
178
+ clear(): void;
179
+ /**
180
+ * Remove old decisions to stay within limits
181
+ */
182
+ private pruneOldDecisions;
183
+ /**
184
+ * Remove old chains to stay within limits
185
+ */
186
+ private pruneOldChains;
187
+ }
188
+ /**
189
+ * Create a new DecisionTracker instance
190
+ *
191
+ * @param options - Tracker options
192
+ * @returns New DecisionTracker instance
193
+ */
194
+ export declare function createDecisionTracker(options?: {
195
+ maxDecisions?: number;
196
+ maxChains?: number;
197
+ }): DecisionTracker;
198
+ /**
199
+ * Get the default singleton DecisionTracker instance
200
+ *
201
+ * @returns The default DecisionTracker
202
+ */
203
+ export declare function getDecisionTracker(): DecisionTracker;
204
+ /**
205
+ * Set the default singleton DecisionTracker instance
206
+ *
207
+ * @param tracker - The tracker to use as default
208
+ */
209
+ export declare function setDefaultDecisionTracker(tracker: DecisionTracker): void;
210
+ //# sourceMappingURL=tracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../src/reasoning/tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EACV,QAAQ,EAER,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACf,MAAM,YAAY,CAAC;AAIpB;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C,UAAU,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC5C,gBAAgB,EAAE,CAAC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AC,OAAO,EAAE,MAAM,GAAG,MAAM;IAwCvC;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAcpC;;;;OAIG;IACH,QAAQ,IAAI,cAAc;IAuD1B;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE;QACtB,IAAI,CAAC,EAAE,YAAY,CAAC;QACpB,UAAU,CAAC,EAAE,eAAe,CAAC;QAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,IAAI,CAAC;QACjB,UAAU,CAAC,EAAE,IAAI,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,QAAQ,EAAE;IAiBd;;OAEG;IACH,KAAK,IAAI,IAAI;IAOb;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,OAAO,CAAC,cAAc;CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,eAAe,CAElB;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAKpD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAExE"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Reasoning System Types
3
+ *
4
+ * Type definitions for the decision tracking and reasoning chain system.
5
+ * Enables transparent AI decision-making with full audit trails.
6
+ *
7
+ * @module reasoning/types
8
+ */
9
+ /**
10
+ * Type of decision made by the system
11
+ * - automatic: System made decision without human input
12
+ * - suggested: System suggests but awaits confirmation
13
+ * - manual: Human-made decision
14
+ * - override: Human override of system decision
15
+ */
16
+ export type DecisionType = 'automatic' | 'suggested' | 'manual' | 'override';
17
+ /**
18
+ * Confidence level in a decision
19
+ * - low: <50% confidence, should probably get human input
20
+ * - medium: 50-75% confidence, reasonable to proceed
21
+ * - high: 75-95% confidence, strong basis for decision
22
+ * - certain: >95% confidence, essentially deterministic
23
+ */
24
+ export type ConfidenceLevel = 'low' | 'medium' | 'high' | 'certain';
25
+ /**
26
+ * Represents a single decision made by the reasoning system
27
+ */
28
+ export interface Decision {
29
+ /** Unique identifier for this decision */
30
+ id: string;
31
+ /** How the decision was made */
32
+ type: DecisionType;
33
+ /** The action taken or to be taken */
34
+ action: string;
35
+ /** Step-by-step reasoning that led to this decision */
36
+ reasoning: string[];
37
+ /** Confidence level in this decision */
38
+ confidence: ConfidenceLevel;
39
+ /** Context in which the decision was made */
40
+ context: DecisionContext;
41
+ /** Outcome after execution (populated later) */
42
+ outcome?: DecisionOutcome;
43
+ /** When the decision was made */
44
+ timestamp: Date;
45
+ }
46
+ /**
47
+ * Context surrounding a decision
48
+ */
49
+ export interface DecisionContext {
50
+ /** What triggered the need for a decision */
51
+ trigger: string;
52
+ /** Input data used to make the decision */
53
+ inputs: Record<string, unknown>;
54
+ /** Constraints that bounded the decision space */
55
+ constraints: string[];
56
+ /** Other options that were considered */
57
+ alternatives: Alternative[];
58
+ }
59
+ /**
60
+ * An alternative option that was considered
61
+ */
62
+ export interface Alternative {
63
+ /** The alternative action */
64
+ action: string;
65
+ /** Advantages of this alternative */
66
+ pros: string[];
67
+ /** Disadvantages of this alternative */
68
+ cons: string[];
69
+ /** Confidence level if this alternative were chosen */
70
+ confidence: ConfidenceLevel;
71
+ /** Whether this alternative was rejected */
72
+ rejected: boolean;
73
+ /** Why this alternative was not chosen */
74
+ rejectionReason?: string;
75
+ }
76
+ /**
77
+ * Outcome of executing a decision
78
+ */
79
+ export interface DecisionOutcome {
80
+ /** Whether the action succeeded */
81
+ success: boolean;
82
+ /** Result data if successful */
83
+ result?: unknown;
84
+ /** Error message if failed */
85
+ error?: string;
86
+ /** How long execution took in milliseconds */
87
+ duration: number;
88
+ /** Unintended effects that occurred */
89
+ sideEffects: string[];
90
+ }
91
+ /**
92
+ * Status of a reasoning chain
93
+ */
94
+ export type ReasoningChainStatus = 'in_progress' | 'completed' | 'failed' | 'aborted';
95
+ /**
96
+ * A chain of related decisions working toward a goal
97
+ */
98
+ export interface ReasoningChain {
99
+ /** Unique identifier for this chain */
100
+ id: string;
101
+ /** Decisions made as part of this chain */
102
+ decisions: Decision[];
103
+ /** When the chain started */
104
+ startTime: Date;
105
+ /** When the chain ended (if finished) */
106
+ endTime?: Date;
107
+ /** The goal this chain is working toward */
108
+ goal: string;
109
+ /** Current status of the chain */
110
+ status: ReasoningChainStatus;
111
+ }
112
+ /**
113
+ * Parameters for creating a new decision
114
+ */
115
+ export interface CreateDecisionParams {
116
+ /** The action to take */
117
+ action: string;
118
+ /** Reasoning steps */
119
+ reasoning: string[];
120
+ /** Confidence in the decision */
121
+ confidence: ConfidenceLevel;
122
+ /** Decision context */
123
+ context: DecisionContext;
124
+ /** Optional decision type (defaults to 'automatic') */
125
+ type?: DecisionType;
126
+ }
127
+ /**
128
+ * Statistics about reasoning performance
129
+ */
130
+ export interface ReasoningStats {
131
+ /** Total decisions made */
132
+ totalDecisions: number;
133
+ /** Decisions by type */
134
+ byType: Record<DecisionType, number>;
135
+ /** Decisions by confidence level */
136
+ byConfidence: Record<ConfidenceLevel, number>;
137
+ /** Success rate of completed decisions */
138
+ successRate: number;
139
+ /** Average decision duration in ms */
140
+ averageDuration: number;
141
+ /** Total chains started */
142
+ totalChains: number;
143
+ /** Chains by status */
144
+ chainsByStatus: Record<ReasoningChainStatus, number>;
145
+ }
146
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reasoning/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QA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