@weavelogic/knowledge-graph-agent 0.2.0 → 0.4.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 (711) hide show
  1. package/README.md +972 -303
  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/audit/config.d.ts +150 -0
  181. package/dist/audit/config.d.ts.map +1 -0
  182. package/dist/audit/config.js +111 -0
  183. package/dist/audit/config.js.map +1 -0
  184. package/dist/audit/index.d.ts +38 -0
  185. package/dist/audit/index.d.ts.map +1 -0
  186. package/dist/audit/services/audit-chain.d.ts +276 -0
  187. package/dist/audit/services/audit-chain.d.ts.map +1 -0
  188. package/dist/audit/services/audit-chain.js +502 -0
  189. package/dist/audit/services/audit-chain.js.map +1 -0
  190. package/dist/audit/services/index.d.ts +11 -0
  191. package/dist/audit/services/index.d.ts.map +1 -0
  192. package/dist/audit/services/syndication.d.ts +334 -0
  193. package/dist/audit/services/syndication.d.ts.map +1 -0
  194. package/dist/audit/services/syndication.js +589 -0
  195. package/dist/audit/services/syndication.js.map +1 -0
  196. package/dist/audit/types.d.ts +453 -0
  197. package/dist/audit/types.d.ts.map +1 -0
  198. package/dist/caching/index.d.ts +55 -0
  199. package/dist/caching/index.d.ts.map +1 -0
  200. package/dist/caching/index.js +206 -0
  201. package/dist/caching/index.js.map +1 -0
  202. package/dist/caching/lru-cache.d.ts +254 -0
  203. package/dist/caching/lru-cache.d.ts.map +1 -0
  204. package/dist/caching/types.d.ts +95 -0
  205. package/dist/caching/types.d.ts.map +1 -0
  206. package/dist/chunking/chunker.d.ts +94 -0
  207. package/dist/chunking/chunker.d.ts.map +1 -0
  208. package/dist/chunking/index.d.ts +125 -0
  209. package/dist/chunking/index.d.ts.map +1 -0
  210. package/dist/chunking/index.js +283 -0
  211. package/dist/chunking/index.js.map +1 -0
  212. package/dist/chunking/types.d.ts +92 -0
  213. package/dist/chunking/types.d.ts.map +1 -0
  214. package/dist/cli/commands/audit.d.ts +21 -0
  215. package/dist/cli/commands/audit.d.ts.map +1 -0
  216. package/dist/cli/commands/audit.js +621 -0
  217. package/dist/cli/commands/audit.js.map +1 -0
  218. package/dist/cli/commands/commit.d.ts +11 -0
  219. package/dist/cli/commands/commit.d.ts.map +1 -0
  220. package/dist/cli/commands/commit.js +379 -0
  221. package/dist/cli/commands/commit.js.map +1 -0
  222. package/dist/cli/commands/config.d.ts +8 -0
  223. package/dist/cli/commands/config.d.ts.map +1 -0
  224. package/dist/cli/commands/config.js +107 -0
  225. package/dist/cli/commands/config.js.map +1 -0
  226. package/dist/cli/commands/cultivate.d.ts +16 -0
  227. package/dist/cli/commands/cultivate.d.ts.map +1 -0
  228. package/dist/cli/commands/cultivate.js +254 -0
  229. package/dist/cli/commands/cultivate.js.map +1 -0
  230. package/dist/cli/commands/diagnostics.d.ts +8 -0
  231. package/dist/cli/commands/diagnostics.d.ts.map +1 -0
  232. package/dist/cli/commands/diagnostics.js +140 -0
  233. package/dist/cli/commands/diagnostics.js.map +1 -0
  234. package/dist/cli/commands/generate.d.ts +13 -0
  235. package/dist/cli/commands/generate.d.ts.map +1 -0
  236. package/dist/cli/commands/init-primitives.d.ts +19 -0
  237. package/dist/cli/commands/init-primitives.d.ts.map +1 -0
  238. package/dist/cli/commands/init-primitives.js +208 -0
  239. package/dist/cli/commands/init-primitives.js.map +1 -0
  240. package/dist/cli/commands/sop.d.ts +14 -0
  241. package/dist/cli/commands/sop.d.ts.map +1 -0
  242. package/dist/cli/commands/sop.js +598 -0
  243. package/dist/cli/commands/sop.js.map +1 -0
  244. package/dist/cli/commands/vector.d.ts +14 -0
  245. package/dist/cli/commands/vector.d.ts.map +1 -0
  246. package/dist/cli/commands/vector.js +429 -0
  247. package/dist/cli/commands/vector.js.map +1 -0
  248. package/dist/cli/commands/workflow.d.ts +12 -0
  249. package/dist/cli/commands/workflow.d.ts.map +1 -0
  250. package/dist/cli/commands/workflow.js +471 -0
  251. package/dist/cli/commands/workflow.js.map +1 -0
  252. package/dist/cli/index.d.ts.map +1 -1
  253. package/dist/cli/index.js +66 -1
  254. package/dist/cli/index.js.map +1 -1
  255. package/dist/config/index.d.ts +153 -0
  256. package/dist/config/index.d.ts.map +1 -0
  257. package/dist/config/index.js +141 -0
  258. package/dist/config/index.js.map +1 -0
  259. package/dist/config/manager.d.ts +136 -0
  260. package/dist/config/manager.d.ts.map +1 -0
  261. package/dist/config/types.d.ts +127 -0
  262. package/dist/config/types.d.ts.map +1 -0
  263. package/dist/core/cache.d.ts +185 -0
  264. package/dist/core/cache.d.ts.map +1 -0
  265. package/dist/core/cache.js +435 -0
  266. package/dist/core/cache.js.map +1 -0
  267. package/dist/cultivation/deep-analyzer.d.ts +129 -0
  268. package/dist/cultivation/deep-analyzer.d.ts.map +1 -0
  269. package/dist/cultivation/deep-analyzer.js +322 -0
  270. package/dist/cultivation/deep-analyzer.js.map +1 -0
  271. package/dist/cultivation/index.d.ts +13 -0
  272. package/dist/cultivation/index.d.ts.map +1 -0
  273. package/dist/cultivation/seed-generator.d.ts +92 -0
  274. package/dist/cultivation/seed-generator.d.ts.map +1 -0
  275. package/dist/cultivation/seed-generator.js +1033 -0
  276. package/dist/cultivation/seed-generator.js.map +1 -0
  277. package/dist/cultivation/types.d.ts +230 -0
  278. package/dist/cultivation/types.d.ts.map +1 -0
  279. package/dist/database/schemas/index.d.ts +85 -0
  280. package/dist/database/schemas/index.d.ts.map +1 -0
  281. package/dist/generators/claude-md.d.ts +7 -0
  282. package/dist/generators/claude-md.d.ts.map +1 -1
  283. package/dist/generators/claude-md.js.map +1 -1
  284. package/dist/generators/docs-init.d.ts +6 -0
  285. package/dist/generators/docs-init.d.ts.map +1 -1
  286. package/dist/generators/docs-init.js.map +1 -1
  287. package/dist/health/checks.d.ts +135 -0
  288. package/dist/health/checks.d.ts.map +1 -0
  289. package/dist/health/index.d.ts +119 -0
  290. package/dist/health/index.d.ts.map +1 -0
  291. package/dist/health/index.js +191 -0
  292. package/dist/health/index.js.map +1 -0
  293. package/dist/health/monitor.d.ts +146 -0
  294. package/dist/health/monitor.d.ts.map +1 -0
  295. package/dist/health/types.d.ts +135 -0
  296. package/dist/health/types.d.ts.map +1 -0
  297. package/dist/index.d.ts +32 -0
  298. package/dist/index.d.ts.map +1 -1
  299. package/dist/index.js +182 -1
  300. package/dist/index.js.map +1 -1
  301. package/dist/integrations/auto-commit.d.ts +175 -0
  302. package/dist/integrations/auto-commit.d.ts.map +1 -0
  303. package/dist/integrations/auto-commit.js +399 -0
  304. package/dist/integrations/auto-commit.js.map +1 -0
  305. package/dist/integrations/git.d.ts +299 -0
  306. package/dist/integrations/git.d.ts.map +1 -0
  307. package/dist/integrations/git.js +465 -0
  308. package/dist/integrations/git.js.map +1 -0
  309. package/dist/mcp-server/bin.d.ts +11 -0
  310. package/dist/mcp-server/bin.d.ts.map +1 -0
  311. package/dist/mcp-server/handlers/index.d.ts +57 -0
  312. package/dist/mcp-server/handlers/index.d.ts.map +1 -0
  313. package/dist/mcp-server/handlers/index.js +235 -0
  314. package/dist/mcp-server/handlers/index.js.map +1 -0
  315. package/dist/mcp-server/index.d.ts +28 -0
  316. package/dist/mcp-server/index.d.ts.map +1 -0
  317. package/dist/mcp-server/server.d.ts +133 -0
  318. package/dist/mcp-server/server.d.ts.map +1 -0
  319. package/dist/mcp-server/server.js +280 -0
  320. package/dist/mcp-server/server.js.map +1 -0
  321. package/dist/mcp-server/tools/agents/index.d.ts +10 -0
  322. package/dist/mcp-server/tools/agents/index.d.ts.map +1 -0
  323. package/dist/mcp-server/tools/agents/list.d.ts +19 -0
  324. package/dist/mcp-server/tools/agents/list.d.ts.map +1 -0
  325. package/dist/mcp-server/tools/agents/spawn.d.ts +19 -0
  326. package/dist/mcp-server/tools/agents/spawn.d.ts.map +1 -0
  327. package/dist/mcp-server/tools/audit/checkpoint.d.ts +58 -0
  328. package/dist/mcp-server/tools/audit/checkpoint.d.ts.map +1 -0
  329. package/dist/mcp-server/tools/audit/checkpoint.js +73 -0
  330. package/dist/mcp-server/tools/audit/checkpoint.js.map +1 -0
  331. package/dist/mcp-server/tools/audit/index.d.ts +53 -0
  332. package/dist/mcp-server/tools/audit/index.d.ts.map +1 -0
  333. package/dist/mcp-server/tools/audit/index.js +12 -0
  334. package/dist/mcp-server/tools/audit/index.js.map +1 -0
  335. package/dist/mcp-server/tools/audit/query.d.ts +58 -0
  336. package/dist/mcp-server/tools/audit/query.d.ts.map +1 -0
  337. package/dist/mcp-server/tools/audit/query.js +125 -0
  338. package/dist/mcp-server/tools/audit/query.js.map +1 -0
  339. package/dist/mcp-server/tools/audit/sync.d.ts +58 -0
  340. package/dist/mcp-server/tools/audit/sync.d.ts.map +1 -0
  341. package/dist/mcp-server/tools/audit/sync.js +126 -0
  342. package/dist/mcp-server/tools/audit/sync.js.map +1 -0
  343. package/dist/mcp-server/tools/graph/generate.d.ts +21 -0
  344. package/dist/mcp-server/tools/graph/generate.d.ts.map +1 -0
  345. package/dist/mcp-server/tools/graph/index.d.ts +11 -0
  346. package/dist/mcp-server/tools/graph/index.d.ts.map +1 -0
  347. package/dist/mcp-server/tools/graph/query.d.ts +22 -0
  348. package/dist/mcp-server/tools/graph/query.d.ts.map +1 -0
  349. package/dist/mcp-server/tools/graph/stats.d.ts +22 -0
  350. package/dist/mcp-server/tools/graph/stats.d.ts.map +1 -0
  351. package/dist/mcp-server/tools/health.d.ts +21 -0
  352. package/dist/mcp-server/tools/health.d.ts.map +1 -0
  353. package/dist/mcp-server/tools/index.d.ts +16 -0
  354. package/dist/mcp-server/tools/index.d.ts.map +1 -0
  355. package/dist/mcp-server/tools/registry.d.ts +90 -0
  356. package/dist/mcp-server/tools/registry.d.ts.map +1 -0
  357. package/dist/mcp-server/tools/registry.js +753 -0
  358. package/dist/mcp-server/tools/registry.js.map +1 -0
  359. package/dist/mcp-server/tools/search/index.d.ts +10 -0
  360. package/dist/mcp-server/tools/search/index.d.ts.map +1 -0
  361. package/dist/mcp-server/tools/search/nodes.d.ts +22 -0
  362. package/dist/mcp-server/tools/search/nodes.d.ts.map +1 -0
  363. package/dist/mcp-server/tools/search/tags.d.ts +22 -0
  364. package/dist/mcp-server/tools/search/tags.d.ts.map +1 -0
  365. package/dist/mcp-server/tools/vector/index.d.ts +12 -0
  366. package/dist/mcp-server/tools/vector/index.d.ts.map +1 -0
  367. package/dist/mcp-server/tools/vector/index.js +12 -0
  368. package/dist/mcp-server/tools/vector/index.js.map +1 -0
  369. package/dist/mcp-server/tools/vector/search.d.ts +41 -0
  370. package/dist/mcp-server/tools/vector/search.d.ts.map +1 -0
  371. package/dist/mcp-server/tools/vector/search.js +224 -0
  372. package/dist/mcp-server/tools/vector/search.js.map +1 -0
  373. package/dist/mcp-server/tools/vector/trajectory.d.ts +39 -0
  374. package/dist/mcp-server/tools/vector/trajectory.d.ts.map +1 -0
  375. package/dist/mcp-server/tools/vector/trajectory.js +170 -0
  376. package/dist/mcp-server/tools/vector/trajectory.js.map +1 -0
  377. package/dist/mcp-server/tools/vector/upsert.d.ts +44 -0
  378. package/dist/mcp-server/tools/vector/upsert.d.ts.map +1 -0
  379. package/dist/mcp-server/tools/vector/upsert.js +175 -0
  380. package/dist/mcp-server/tools/vector/upsert.js.map +1 -0
  381. package/dist/mcp-server/tools/workflow/index.d.ts +29 -0
  382. package/dist/mcp-server/tools/workflow/index.d.ts.map +1 -0
  383. package/dist/mcp-server/tools/workflow/index.js +12 -0
  384. package/dist/mcp-server/tools/workflow/index.js.map +1 -0
  385. package/dist/mcp-server/tools/workflow/list.d.ts +41 -0
  386. package/dist/mcp-server/tools/workflow/list.d.ts.map +1 -0
  387. package/dist/mcp-server/tools/workflow/list.js +195 -0
  388. package/dist/mcp-server/tools/workflow/list.js.map +1 -0
  389. package/dist/mcp-server/tools/workflow/start.d.ts +40 -0
  390. package/dist/mcp-server/tools/workflow/start.d.ts.map +1 -0
  391. package/dist/mcp-server/tools/workflow/start.js +165 -0
  392. package/dist/mcp-server/tools/workflow/start.js.map +1 -0
  393. package/dist/mcp-server/tools/workflow/status.d.ts +38 -0
  394. package/dist/mcp-server/tools/workflow/status.d.ts.map +1 -0
  395. package/dist/mcp-server/tools/workflow/status.js +97 -0
  396. package/dist/mcp-server/tools/workflow/status.js.map +1 -0
  397. package/dist/mcp-server/types/index.d.ts +286 -0
  398. package/dist/mcp-server/types/index.d.ts.map +1 -0
  399. package/dist/memory/index.d.ts +10 -0
  400. package/dist/memory/index.d.ts.map +1 -0
  401. package/dist/memory/vault-sync.d.ts +212 -0
  402. package/dist/memory/vault-sync.d.ts.map +1 -0
  403. package/dist/memory/vault-sync.js +463 -0
  404. package/dist/memory/vault-sync.js.map +1 -0
  405. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +296 -0
  406. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
  407. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +71 -0
  408. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
  409. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +26 -0
  410. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  411. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +407 -0
  412. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
  413. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1332 -0
  414. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
  415. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +71 -0
  416. package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
  417. package/dist/node_modules/ajv/dist/ajv.js +84 -0
  418. package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
  419. package/dist/node_modules/ajv/dist/compile/codegen/code.js +160 -0
  420. package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
  421. package/dist/node_modules/ajv/dist/compile/codegen/index.js +728 -0
  422. package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
  423. package/dist/node_modules/ajv/dist/compile/codegen/scope.js +152 -0
  424. package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
  425. package/dist/node_modules/ajv/dist/compile/errors.js +131 -0
  426. package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
  427. package/dist/node_modules/ajv/dist/compile/index.js +234 -0
  428. package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
  429. package/dist/node_modules/ajv/dist/compile/names.js +44 -0
  430. package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
  431. package/dist/node_modules/ajv/dist/compile/ref_error.js +22 -0
  432. package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
  433. package/dist/node_modules/ajv/dist/compile/resolve.js +163 -0
  434. package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
  435. package/dist/node_modules/ajv/dist/compile/rules.js +35 -0
  436. package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
  437. package/dist/node_modules/ajv/dist/compile/util.js +173 -0
  438. package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
  439. package/dist/node_modules/ajv/dist/compile/validate/applicability.js +27 -0
  440. package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
  441. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +58 -0
  442. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
  443. package/dist/node_modules/ajv/dist/compile/validate/dataType.js +193 -0
  444. package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
  445. package/dist/node_modules/ajv/dist/compile/validate/defaults.js +43 -0
  446. package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
  447. package/dist/node_modules/ajv/dist/compile/validate/index.js +522 -0
  448. package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
  449. package/dist/node_modules/ajv/dist/compile/validate/keyword.js +126 -0
  450. package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
  451. package/dist/node_modules/ajv/dist/compile/validate/subschema.js +89 -0
  452. package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
  453. package/dist/node_modules/ajv/dist/core.js +628 -0
  454. package/dist/node_modules/ajv/dist/core.js.map +1 -0
  455. package/dist/node_modules/ajv/dist/refs/data.json.js +24 -0
  456. package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
  457. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +25 -0
  458. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
  459. package/dist/node_modules/ajv/dist/runtime/equal.js +16 -0
  460. package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
  461. package/dist/node_modules/ajv/dist/runtime/ucs2length.js +30 -0
  462. package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
  463. package/dist/node_modules/ajv/dist/runtime/uri.js +16 -0
  464. package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  465. package/dist/node_modules/ajv/dist/runtime/validation_error.js +20 -0
  466. package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
  467. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +59 -0
  468. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
  469. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +114 -0
  470. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
  471. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +32 -0
  472. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
  473. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +22 -0
  474. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
  475. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +100 -0
  476. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
  477. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +103 -0
  478. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
  479. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +75 -0
  480. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
  481. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +68 -0
  482. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
  483. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +64 -0
  484. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
  485. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +43 -0
  486. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
  487. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +36 -0
  488. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
  489. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
  490. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
  491. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +81 -0
  492. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
  493. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +22 -0
  494. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
  495. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +66 -0
  496. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
  497. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +49 -0
  498. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
  499. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +23 -0
  500. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
  501. package/dist/node_modules/ajv/dist/vocabularies/code.js +140 -0
  502. package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
  503. package/dist/node_modules/ajv/dist/vocabularies/core/id.js +19 -0
  504. package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
  505. package/dist/node_modules/ajv/dist/vocabularies/core/index.js +27 -0
  506. package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
  507. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +132 -0
  508. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
  509. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +114 -0
  510. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
  511. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +18 -0
  512. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
  513. package/dist/node_modules/ajv/dist/vocabularies/draft7.js +31 -0
  514. package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
  515. package/dist/node_modules/ajv/dist/vocabularies/format/format.js +95 -0
  516. package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
  517. package/dist/node_modules/ajv/dist/vocabularies/format/index.js +16 -0
  518. package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
  519. package/dist/node_modules/ajv/dist/vocabularies/metadata.js +27 -0
  520. package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
  521. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +36 -0
  522. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
  523. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +56 -0
  524. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
  525. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +52 -0
  526. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
  527. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +34 -0
  528. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
  529. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +39 -0
  530. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
  531. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +37 -0
  532. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
  533. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +34 -0
  534. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
  535. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +33 -0
  536. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
  537. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +34 -0
  538. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
  539. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +89 -0
  540. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
  541. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +75 -0
  542. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
  543. package/dist/node_modules/ajv-formats/dist/formats.js +209 -0
  544. package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
  545. package/dist/node_modules/ajv-formats/dist/index.js +51 -0
  546. package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
  547. package/dist/node_modules/ajv-formats/dist/limit.js +80 -0
  548. package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
  549. package/dist/node_modules/fast-deep-equal/index.js +39 -0
  550. package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
  551. package/dist/node_modules/fast-uri/index.js +261 -0
  552. package/dist/node_modules/fast-uri/index.js.map +1 -0
  553. package/dist/node_modules/fast-uri/lib/schemes.js +215 -0
  554. package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
  555. package/dist/node_modules/fast-uri/lib/utils.js +261 -0
  556. package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
  557. package/dist/node_modules/json-schema-traverse/index.js +92 -0
  558. package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
  559. package/dist/node_modules/zod/v4/classic/errors.js +37 -0
  560. package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
  561. package/dist/node_modules/zod/v4/classic/iso.js +43 -0
  562. package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
  563. package/dist/node_modules/zod/v4/classic/parse.js +13 -0
  564. package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
  565. package/dist/node_modules/zod/v4/classic/schemas.js +688 -0
  566. package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
  567. package/dist/node_modules/zod/v4/core/api.js +492 -0
  568. package/dist/node_modules/zod/v4/core/api.js.map +1 -0
  569. package/dist/node_modules/zod/v4/core/checks.js +405 -0
  570. package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
  571. package/dist/node_modules/zod/v4/core/core.js +58 -0
  572. package/dist/node_modules/zod/v4/core/core.js.map +1 -0
  573. package/dist/node_modules/zod/v4/core/doc.js +38 -0
  574. package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
  575. package/dist/node_modules/zod/v4/core/errors.js +82 -0
  576. package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
  577. package/dist/node_modules/zod/v4/core/parse.js +60 -0
  578. package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
  579. package/dist/node_modules/zod/v4/core/regexes.js +87 -0
  580. package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
  581. package/dist/node_modules/zod/v4/core/registries.js +52 -0
  582. package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
  583. package/dist/node_modules/zod/v4/core/schemas.js +1283 -0
  584. package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
  585. package/dist/node_modules/zod/v4/core/util.js +341 -0
  586. package/dist/node_modules/zod/v4/core/util.js.map +1 -0
  587. package/dist/node_modules/zod/v4/core/versions.js +9 -0
  588. package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
  589. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +2 -0
  590. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
  591. package/dist/reasoning/index.d.ts +74 -0
  592. package/dist/reasoning/index.d.ts.map +1 -0
  593. package/dist/reasoning/index.js +124 -0
  594. package/dist/reasoning/index.js.map +1 -0
  595. package/dist/reasoning/tracker.d.ts +210 -0
  596. package/dist/reasoning/tracker.d.ts.map +1 -0
  597. package/dist/reasoning/types.d.ts +146 -0
  598. package/dist/reasoning/types.d.ts.map +1 -0
  599. package/dist/recovery/backup.d.ts +110 -0
  600. package/dist/recovery/backup.d.ts.map +1 -0
  601. package/dist/recovery/index.d.ts +70 -0
  602. package/dist/recovery/index.d.ts.map +1 -0
  603. package/dist/recovery/index.js +186 -0
  604. package/dist/recovery/index.js.map +1 -0
  605. package/dist/recovery/integrity.d.ts +74 -0
  606. package/dist/recovery/integrity.d.ts.map +1 -0
  607. package/dist/recovery/types.d.ts +94 -0
  608. package/dist/recovery/types.d.ts.map +1 -0
  609. package/dist/services/index.d.ts +130 -0
  610. package/dist/services/index.d.ts.map +1 -0
  611. package/dist/services/index.js +134 -0
  612. package/dist/services/index.js.map +1 -0
  613. package/dist/services/manager.d.ts +140 -0
  614. package/dist/services/manager.d.ts.map +1 -0
  615. package/dist/services/types.d.ts +106 -0
  616. package/dist/services/types.d.ts.map +1 -0
  617. package/dist/services/watchers.d.ts +95 -0
  618. package/dist/services/watchers.d.ts.map +1 -0
  619. package/dist/sops/compliance-checker.d.ts +83 -0
  620. package/dist/sops/compliance-checker.d.ts.map +1 -0
  621. package/dist/sops/compliance-checker.js +399 -0
  622. package/dist/sops/compliance-checker.js.map +1 -0
  623. package/dist/sops/gap-analyzer.d.ts +124 -0
  624. package/dist/sops/gap-analyzer.d.ts.map +1 -0
  625. package/dist/sops/gap-analyzer.js +313 -0
  626. package/dist/sops/gap-analyzer.js.map +1 -0
  627. package/dist/sops/index.d.ts +14 -0
  628. package/dist/sops/index.d.ts.map +1 -0
  629. package/dist/sops/overlay-manager.d.ts +115 -0
  630. package/dist/sops/overlay-manager.d.ts.map +1 -0
  631. package/dist/sops/overlay-manager.js +394 -0
  632. package/dist/sops/overlay-manager.js.map +1 -0
  633. package/dist/sops/registry.d.ts +73 -0
  634. package/dist/sops/registry.d.ts.map +1 -0
  635. package/dist/sops/registry.js +919 -0
  636. package/dist/sops/registry.js.map +1 -0
  637. package/dist/sops/types.d.ts +377 -0
  638. package/dist/sops/types.d.ts.map +1 -0
  639. package/dist/sops/types.js +46 -0
  640. package/dist/sops/types.js.map +1 -0
  641. package/dist/utils/error-recovery.d.ts +230 -0
  642. package/dist/utils/error-recovery.d.ts.map +1 -0
  643. package/dist/utils/error-recovery.js +228 -0
  644. package/dist/utils/error-recovery.js.map +1 -0
  645. package/dist/utils/error-taxonomy.d.ts +149 -0
  646. package/dist/utils/error-taxonomy.d.ts.map +1 -0
  647. package/dist/utils/error-taxonomy.js +260 -0
  648. package/dist/utils/error-taxonomy.js.map +1 -0
  649. package/dist/utils/index.d.ts +11 -0
  650. package/dist/utils/index.d.ts.map +1 -0
  651. package/dist/utils/logger.d.ts +139 -0
  652. package/dist/utils/logger.d.ts.map +1 -0
  653. package/dist/utils/logger.js +311 -0
  654. package/dist/utils/logger.js.map +1 -0
  655. package/dist/vector/config.d.ts +300 -0
  656. package/dist/vector/config.d.ts.map +1 -0
  657. package/dist/vector/config.js +124 -0
  658. package/dist/vector/config.js.map +1 -0
  659. package/dist/vector/index.d.ts +50 -0
  660. package/dist/vector/index.d.ts.map +1 -0
  661. package/dist/vector/services/index.d.ts +13 -0
  662. package/dist/vector/services/index.d.ts.map +1 -0
  663. package/dist/vector/services/trajectory-tracker.d.ts +405 -0
  664. package/dist/vector/services/trajectory-tracker.d.ts.map +1 -0
  665. package/dist/vector/services/trajectory-tracker.js +445 -0
  666. package/dist/vector/services/trajectory-tracker.js.map +1 -0
  667. package/dist/vector/services/vector-store.d.ts +339 -0
  668. package/dist/vector/services/vector-store.d.ts.map +1 -0
  669. package/dist/vector/services/vector-store.js +748 -0
  670. package/dist/vector/services/vector-store.js.map +1 -0
  671. package/dist/vector/types.d.ts +677 -0
  672. package/dist/vector/types.d.ts.map +1 -0
  673. package/dist/workflow/adapters/goap-adapter.d.ts +196 -0
  674. package/dist/workflow/adapters/goap-adapter.d.ts.map +1 -0
  675. package/dist/workflow/adapters/goap-adapter.js +706 -0
  676. package/dist/workflow/adapters/goap-adapter.js.map +1 -0
  677. package/dist/workflow/adapters/index.d.ts +10 -0
  678. package/dist/workflow/adapters/index.d.ts.map +1 -0
  679. package/dist/workflow/config.d.ts +135 -0
  680. package/dist/workflow/config.d.ts.map +1 -0
  681. package/dist/workflow/config.js +92 -0
  682. package/dist/workflow/config.js.map +1 -0
  683. package/dist/workflow/handlers/index.d.ts +9 -0
  684. package/dist/workflow/handlers/index.d.ts.map +1 -0
  685. package/dist/workflow/handlers/webhook-handlers.d.ts +397 -0
  686. package/dist/workflow/handlers/webhook-handlers.d.ts.map +1 -0
  687. package/dist/workflow/handlers/webhook-handlers.js +454 -0
  688. package/dist/workflow/handlers/webhook-handlers.js.map +1 -0
  689. package/dist/workflow/index.d.ts +42 -0
  690. package/dist/workflow/index.d.ts.map +1 -0
  691. package/dist/workflow/services/index.d.ts +9 -0
  692. package/dist/workflow/services/index.d.ts.map +1 -0
  693. package/dist/workflow/services/workflow-service.d.ts +318 -0
  694. package/dist/workflow/services/workflow-service.d.ts.map +1 -0
  695. package/dist/workflow/services/workflow-service.js +577 -0
  696. package/dist/workflow/services/workflow-service.js.map +1 -0
  697. package/dist/workflow/types.d.ts +470 -0
  698. package/dist/workflow/types.d.ts.map +1 -0
  699. package/dist/workflow/workflows/realtime-collab.d.ts +245 -0
  700. package/dist/workflow/workflows/realtime-collab.d.ts.map +1 -0
  701. package/dist/workflows/index.d.ts +11 -0
  702. package/dist/workflows/index.d.ts.map +1 -0
  703. package/dist/workflows/registry.d.ts +118 -0
  704. package/dist/workflows/registry.d.ts.map +1 -0
  705. package/dist/workflows/registry.js +575 -0
  706. package/dist/workflows/registry.js.map +1 -0
  707. package/dist/workflows/types.d.ts +322 -0
  708. package/dist/workflows/types.d.ts.map +1 -0
  709. package/dist/workflows/types.js +16 -0
  710. package/dist/workflows/types.js.map +1 -0
  711. package/package.json +1 -1
@@ -0,0 +1,728 @@
1
+ import { __exports as codegen } from "../../../../../_virtual/index3.js";
2
+ import { __require as requireCode } from "./code.js";
3
+ import { __require as requireScope } from "./scope.js";
4
+ var hasRequiredCodegen;
5
+ function requireCodegen() {
6
+ if (hasRequiredCodegen) return codegen;
7
+ hasRequiredCodegen = 1;
8
+ (function(exports$1) {
9
+ Object.defineProperty(exports$1, "__esModule", { value: true });
10
+ exports$1.or = exports$1.and = exports$1.not = exports$1.CodeGen = exports$1.operators = exports$1.varKinds = exports$1.ValueScopeName = exports$1.ValueScope = exports$1.Scope = exports$1.Name = exports$1.regexpCode = exports$1.stringify = exports$1.getProperty = exports$1.nil = exports$1.strConcat = exports$1.str = exports$1._ = void 0;
11
+ const code_1 = requireCode();
12
+ const scope_1 = requireScope();
13
+ var code_2 = requireCode();
14
+ Object.defineProperty(exports$1, "_", { enumerable: true, get: function() {
15
+ return code_2._;
16
+ } });
17
+ Object.defineProperty(exports$1, "str", { enumerable: true, get: function() {
18
+ return code_2.str;
19
+ } });
20
+ Object.defineProperty(exports$1, "strConcat", { enumerable: true, get: function() {
21
+ return code_2.strConcat;
22
+ } });
23
+ Object.defineProperty(exports$1, "nil", { enumerable: true, get: function() {
24
+ return code_2.nil;
25
+ } });
26
+ Object.defineProperty(exports$1, "getProperty", { enumerable: true, get: function() {
27
+ return code_2.getProperty;
28
+ } });
29
+ Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function() {
30
+ return code_2.stringify;
31
+ } });
32
+ Object.defineProperty(exports$1, "regexpCode", { enumerable: true, get: function() {
33
+ return code_2.regexpCode;
34
+ } });
35
+ Object.defineProperty(exports$1, "Name", { enumerable: true, get: function() {
36
+ return code_2.Name;
37
+ } });
38
+ var scope_2 = requireScope();
39
+ Object.defineProperty(exports$1, "Scope", { enumerable: true, get: function() {
40
+ return scope_2.Scope;
41
+ } });
42
+ Object.defineProperty(exports$1, "ValueScope", { enumerable: true, get: function() {
43
+ return scope_2.ValueScope;
44
+ } });
45
+ Object.defineProperty(exports$1, "ValueScopeName", { enumerable: true, get: function() {
46
+ return scope_2.ValueScopeName;
47
+ } });
48
+ Object.defineProperty(exports$1, "varKinds", { enumerable: true, get: function() {
49
+ return scope_2.varKinds;
50
+ } });
51
+ exports$1.operators = {
52
+ GT: new code_1._Code(">"),
53
+ GTE: new code_1._Code(">="),
54
+ LT: new code_1._Code("<"),
55
+ LTE: new code_1._Code("<="),
56
+ EQ: new code_1._Code("==="),
57
+ NEQ: new code_1._Code("!=="),
58
+ NOT: new code_1._Code("!"),
59
+ OR: new code_1._Code("||"),
60
+ AND: new code_1._Code("&&"),
61
+ ADD: new code_1._Code("+")
62
+ };
63
+ class Node {
64
+ optimizeNodes() {
65
+ return this;
66
+ }
67
+ optimizeNames(_names, _constants) {
68
+ return this;
69
+ }
70
+ }
71
+ class Def extends Node {
72
+ constructor(varKind, name, rhs) {
73
+ super();
74
+ this.varKind = varKind;
75
+ this.name = name;
76
+ this.rhs = rhs;
77
+ }
78
+ render({ es5, _n }) {
79
+ const varKind = es5 ? scope_1.varKinds.var : this.varKind;
80
+ const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
81
+ return `${varKind} ${this.name}${rhs};` + _n;
82
+ }
83
+ optimizeNames(names, constants) {
84
+ if (!names[this.name.str])
85
+ return;
86
+ if (this.rhs)
87
+ this.rhs = optimizeExpr(this.rhs, names, constants);
88
+ return this;
89
+ }
90
+ get names() {
91
+ return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {};
92
+ }
93
+ }
94
+ class Assign extends Node {
95
+ constructor(lhs, rhs, sideEffects) {
96
+ super();
97
+ this.lhs = lhs;
98
+ this.rhs = rhs;
99
+ this.sideEffects = sideEffects;
100
+ }
101
+ render({ _n }) {
102
+ return `${this.lhs} = ${this.rhs};` + _n;
103
+ }
104
+ optimizeNames(names, constants) {
105
+ if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
106
+ return;
107
+ this.rhs = optimizeExpr(this.rhs, names, constants);
108
+ return this;
109
+ }
110
+ get names() {
111
+ const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };
112
+ return addExprNames(names, this.rhs);
113
+ }
114
+ }
115
+ class AssignOp extends Assign {
116
+ constructor(lhs, op, rhs, sideEffects) {
117
+ super(lhs, rhs, sideEffects);
118
+ this.op = op;
119
+ }
120
+ render({ _n }) {
121
+ return `${this.lhs} ${this.op}= ${this.rhs};` + _n;
122
+ }
123
+ }
124
+ class Label extends Node {
125
+ constructor(label) {
126
+ super();
127
+ this.label = label;
128
+ this.names = {};
129
+ }
130
+ render({ _n }) {
131
+ return `${this.label}:` + _n;
132
+ }
133
+ }
134
+ class Break extends Node {
135
+ constructor(label) {
136
+ super();
137
+ this.label = label;
138
+ this.names = {};
139
+ }
140
+ render({ _n }) {
141
+ const label = this.label ? ` ${this.label}` : "";
142
+ return `break${label};` + _n;
143
+ }
144
+ }
145
+ class Throw extends Node {
146
+ constructor(error) {
147
+ super();
148
+ this.error = error;
149
+ }
150
+ render({ _n }) {
151
+ return `throw ${this.error};` + _n;
152
+ }
153
+ get names() {
154
+ return this.error.names;
155
+ }
156
+ }
157
+ class AnyCode extends Node {
158
+ constructor(code) {
159
+ super();
160
+ this.code = code;
161
+ }
162
+ render({ _n }) {
163
+ return `${this.code};` + _n;
164
+ }
165
+ optimizeNodes() {
166
+ return `${this.code}` ? this : void 0;
167
+ }
168
+ optimizeNames(names, constants) {
169
+ this.code = optimizeExpr(this.code, names, constants);
170
+ return this;
171
+ }
172
+ get names() {
173
+ return this.code instanceof code_1._CodeOrName ? this.code.names : {};
174
+ }
175
+ }
176
+ class ParentNode extends Node {
177
+ constructor(nodes = []) {
178
+ super();
179
+ this.nodes = nodes;
180
+ }
181
+ render(opts) {
182
+ return this.nodes.reduce((code, n) => code + n.render(opts), "");
183
+ }
184
+ optimizeNodes() {
185
+ const { nodes } = this;
186
+ let i = nodes.length;
187
+ while (i--) {
188
+ const n = nodes[i].optimizeNodes();
189
+ if (Array.isArray(n))
190
+ nodes.splice(i, 1, ...n);
191
+ else if (n)
192
+ nodes[i] = n;
193
+ else
194
+ nodes.splice(i, 1);
195
+ }
196
+ return nodes.length > 0 ? this : void 0;
197
+ }
198
+ optimizeNames(names, constants) {
199
+ const { nodes } = this;
200
+ let i = nodes.length;
201
+ while (i--) {
202
+ const n = nodes[i];
203
+ if (n.optimizeNames(names, constants))
204
+ continue;
205
+ subtractNames(names, n.names);
206
+ nodes.splice(i, 1);
207
+ }
208
+ return nodes.length > 0 ? this : void 0;
209
+ }
210
+ get names() {
211
+ return this.nodes.reduce((names, n) => addNames(names, n.names), {});
212
+ }
213
+ }
214
+ class BlockNode extends ParentNode {
215
+ render(opts) {
216
+ return "{" + opts._n + super.render(opts) + "}" + opts._n;
217
+ }
218
+ }
219
+ class Root extends ParentNode {
220
+ }
221
+ class Else extends BlockNode {
222
+ }
223
+ Else.kind = "else";
224
+ class If extends BlockNode {
225
+ constructor(condition, nodes) {
226
+ super(nodes);
227
+ this.condition = condition;
228
+ }
229
+ render(opts) {
230
+ let code = `if(${this.condition})` + super.render(opts);
231
+ if (this.else)
232
+ code += "else " + this.else.render(opts);
233
+ return code;
234
+ }
235
+ optimizeNodes() {
236
+ super.optimizeNodes();
237
+ const cond = this.condition;
238
+ if (cond === true)
239
+ return this.nodes;
240
+ let e = this.else;
241
+ if (e) {
242
+ const ns = e.optimizeNodes();
243
+ e = this.else = Array.isArray(ns) ? new Else(ns) : ns;
244
+ }
245
+ if (e) {
246
+ if (cond === false)
247
+ return e instanceof If ? e : e.nodes;
248
+ if (this.nodes.length)
249
+ return this;
250
+ return new If(not(cond), e instanceof If ? [e] : e.nodes);
251
+ }
252
+ if (cond === false || !this.nodes.length)
253
+ return void 0;
254
+ return this;
255
+ }
256
+ optimizeNames(names, constants) {
257
+ var _a;
258
+ this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
259
+ if (!(super.optimizeNames(names, constants) || this.else))
260
+ return;
261
+ this.condition = optimizeExpr(this.condition, names, constants);
262
+ return this;
263
+ }
264
+ get names() {
265
+ const names = super.names;
266
+ addExprNames(names, this.condition);
267
+ if (this.else)
268
+ addNames(names, this.else.names);
269
+ return names;
270
+ }
271
+ }
272
+ If.kind = "if";
273
+ class For extends BlockNode {
274
+ }
275
+ For.kind = "for";
276
+ class ForLoop extends For {
277
+ constructor(iteration) {
278
+ super();
279
+ this.iteration = iteration;
280
+ }
281
+ render(opts) {
282
+ return `for(${this.iteration})` + super.render(opts);
283
+ }
284
+ optimizeNames(names, constants) {
285
+ if (!super.optimizeNames(names, constants))
286
+ return;
287
+ this.iteration = optimizeExpr(this.iteration, names, constants);
288
+ return this;
289
+ }
290
+ get names() {
291
+ return addNames(super.names, this.iteration.names);
292
+ }
293
+ }
294
+ class ForRange extends For {
295
+ constructor(varKind, name, from, to) {
296
+ super();
297
+ this.varKind = varKind;
298
+ this.name = name;
299
+ this.from = from;
300
+ this.to = to;
301
+ }
302
+ render(opts) {
303
+ const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
304
+ const { name, from, to } = this;
305
+ return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);
306
+ }
307
+ get names() {
308
+ const names = addExprNames(super.names, this.from);
309
+ return addExprNames(names, this.to);
310
+ }
311
+ }
312
+ class ForIter extends For {
313
+ constructor(loop, varKind, name, iterable) {
314
+ super();
315
+ this.loop = loop;
316
+ this.varKind = varKind;
317
+ this.name = name;
318
+ this.iterable = iterable;
319
+ }
320
+ render(opts) {
321
+ return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
322
+ }
323
+ optimizeNames(names, constants) {
324
+ if (!super.optimizeNames(names, constants))
325
+ return;
326
+ this.iterable = optimizeExpr(this.iterable, names, constants);
327
+ return this;
328
+ }
329
+ get names() {
330
+ return addNames(super.names, this.iterable.names);
331
+ }
332
+ }
333
+ class Func extends BlockNode {
334
+ constructor(name, args, async) {
335
+ super();
336
+ this.name = name;
337
+ this.args = args;
338
+ this.async = async;
339
+ }
340
+ render(opts) {
341
+ const _async = this.async ? "async " : "";
342
+ return `${_async}function ${this.name}(${this.args})` + super.render(opts);
343
+ }
344
+ }
345
+ Func.kind = "func";
346
+ class Return extends ParentNode {
347
+ render(opts) {
348
+ return "return " + super.render(opts);
349
+ }
350
+ }
351
+ Return.kind = "return";
352
+ class Try extends BlockNode {
353
+ render(opts) {
354
+ let code = "try" + super.render(opts);
355
+ if (this.catch)
356
+ code += this.catch.render(opts);
357
+ if (this.finally)
358
+ code += this.finally.render(opts);
359
+ return code;
360
+ }
361
+ optimizeNodes() {
362
+ var _a, _b;
363
+ super.optimizeNodes();
364
+ (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
365
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
366
+ return this;
367
+ }
368
+ optimizeNames(names, constants) {
369
+ var _a, _b;
370
+ super.optimizeNames(names, constants);
371
+ (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
372
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
373
+ return this;
374
+ }
375
+ get names() {
376
+ const names = super.names;
377
+ if (this.catch)
378
+ addNames(names, this.catch.names);
379
+ if (this.finally)
380
+ addNames(names, this.finally.names);
381
+ return names;
382
+ }
383
+ }
384
+ class Catch extends BlockNode {
385
+ constructor(error) {
386
+ super();
387
+ this.error = error;
388
+ }
389
+ render(opts) {
390
+ return `catch(${this.error})` + super.render(opts);
391
+ }
392
+ }
393
+ Catch.kind = "catch";
394
+ class Finally extends BlockNode {
395
+ render(opts) {
396
+ return "finally" + super.render(opts);
397
+ }
398
+ }
399
+ Finally.kind = "finally";
400
+ class CodeGen {
401
+ constructor(extScope, opts = {}) {
402
+ this._values = {};
403
+ this._blockStarts = [];
404
+ this._constants = {};
405
+ this.opts = { ...opts, _n: opts.lines ? "\n" : "" };
406
+ this._extScope = extScope;
407
+ this._scope = new scope_1.Scope({ parent: extScope });
408
+ this._nodes = [new Root()];
409
+ }
410
+ toString() {
411
+ return this._root.render(this.opts);
412
+ }
413
+ // returns unique name in the internal scope
414
+ name(prefix) {
415
+ return this._scope.name(prefix);
416
+ }
417
+ // reserves unique name in the external scope
418
+ scopeName(prefix) {
419
+ return this._extScope.name(prefix);
420
+ }
421
+ // reserves unique name in the external scope and assigns value to it
422
+ scopeValue(prefixOrName, value) {
423
+ const name = this._extScope.value(prefixOrName, value);
424
+ const vs = this._values[name.prefix] || (this._values[name.prefix] = /* @__PURE__ */ new Set());
425
+ vs.add(name);
426
+ return name;
427
+ }
428
+ getScopeValue(prefix, keyOrRef) {
429
+ return this._extScope.getValue(prefix, keyOrRef);
430
+ }
431
+ // return code that assigns values in the external scope to the names that are used internally
432
+ // (same names that were returned by gen.scopeName or gen.scopeValue)
433
+ scopeRefs(scopeName) {
434
+ return this._extScope.scopeRefs(scopeName, this._values);
435
+ }
436
+ scopeCode() {
437
+ return this._extScope.scopeCode(this._values);
438
+ }
439
+ _def(varKind, nameOrPrefix, rhs, constant) {
440
+ const name = this._scope.toName(nameOrPrefix);
441
+ if (rhs !== void 0 && constant)
442
+ this._constants[name.str] = rhs;
443
+ this._leafNode(new Def(varKind, name, rhs));
444
+ return name;
445
+ }
446
+ // `const` declaration (`var` in es5 mode)
447
+ const(nameOrPrefix, rhs, _constant) {
448
+ return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant);
449
+ }
450
+ // `let` declaration with optional assignment (`var` in es5 mode)
451
+ let(nameOrPrefix, rhs, _constant) {
452
+ return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant);
453
+ }
454
+ // `var` declaration with optional assignment
455
+ var(nameOrPrefix, rhs, _constant) {
456
+ return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant);
457
+ }
458
+ // assignment code
459
+ assign(lhs, rhs, sideEffects) {
460
+ return this._leafNode(new Assign(lhs, rhs, sideEffects));
461
+ }
462
+ // `+=` code
463
+ add(lhs, rhs) {
464
+ return this._leafNode(new AssignOp(lhs, exports$1.operators.ADD, rhs));
465
+ }
466
+ // appends passed SafeExpr to code or executes Block
467
+ code(c) {
468
+ if (typeof c == "function")
469
+ c();
470
+ else if (c !== code_1.nil)
471
+ this._leafNode(new AnyCode(c));
472
+ return this;
473
+ }
474
+ // returns code for object literal for the passed argument list of key-value pairs
475
+ object(...keyValues) {
476
+ const code = ["{"];
477
+ for (const [key, value] of keyValues) {
478
+ if (code.length > 1)
479
+ code.push(",");
480
+ code.push(key);
481
+ if (key !== value || this.opts.es5) {
482
+ code.push(":");
483
+ (0, code_1.addCodeArg)(code, value);
484
+ }
485
+ }
486
+ code.push("}");
487
+ return new code_1._Code(code);
488
+ }
489
+ // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
490
+ if(condition, thenBody, elseBody) {
491
+ this._blockNode(new If(condition));
492
+ if (thenBody && elseBody) {
493
+ this.code(thenBody).else().code(elseBody).endIf();
494
+ } else if (thenBody) {
495
+ this.code(thenBody).endIf();
496
+ } else if (elseBody) {
497
+ throw new Error('CodeGen: "else" body without "then" body');
498
+ }
499
+ return this;
500
+ }
501
+ // `else if` clause - invalid without `if` or after `else` clauses
502
+ elseIf(condition) {
503
+ return this._elseNode(new If(condition));
504
+ }
505
+ // `else` clause - only valid after `if` or `else if` clauses
506
+ else() {
507
+ return this._elseNode(new Else());
508
+ }
509
+ // end `if` statement (needed if gen.if was used only with condition)
510
+ endIf() {
511
+ return this._endBlockNode(If, Else);
512
+ }
513
+ _for(node, forBody) {
514
+ this._blockNode(node);
515
+ if (forBody)
516
+ this.code(forBody).endFor();
517
+ return this;
518
+ }
519
+ // a generic `for` clause (or statement if `forBody` is passed)
520
+ for(iteration, forBody) {
521
+ return this._for(new ForLoop(iteration), forBody);
522
+ }
523
+ // `for` statement for a range of values
524
+ forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
525
+ const name = this._scope.toName(nameOrPrefix);
526
+ return this._for(new ForRange(varKind, name, from, to), () => forBody(name));
527
+ }
528
+ // `for-of` statement (in es5 mode replace with a normal for loop)
529
+ forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
530
+ const name = this._scope.toName(nameOrPrefix);
531
+ if (this.opts.es5) {
532
+ const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
533
+ return this.forRange("_i", 0, (0, code_1._)`${arr}.length`, (i) => {
534
+ this.var(name, (0, code_1._)`${arr}[${i}]`);
535
+ forBody(name);
536
+ });
537
+ }
538
+ return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
539
+ }
540
+ // `for-in` statement.
541
+ // With option `ownProperties` replaced with a `for-of` loop for object keys
542
+ forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
543
+ if (this.opts.ownProperties) {
544
+ return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj})`, forBody);
545
+ }
546
+ const name = this._scope.toName(nameOrPrefix);
547
+ return this._for(new ForIter("in", varKind, name, obj), () => forBody(name));
548
+ }
549
+ // end `for` loop
550
+ endFor() {
551
+ return this._endBlockNode(For);
552
+ }
553
+ // `label` statement
554
+ label(label) {
555
+ return this._leafNode(new Label(label));
556
+ }
557
+ // `break` statement
558
+ break(label) {
559
+ return this._leafNode(new Break(label));
560
+ }
561
+ // `return` statement
562
+ return(value) {
563
+ const node = new Return();
564
+ this._blockNode(node);
565
+ this.code(value);
566
+ if (node.nodes.length !== 1)
567
+ throw new Error('CodeGen: "return" should have one node');
568
+ return this._endBlockNode(Return);
569
+ }
570
+ // `try` statement
571
+ try(tryBody, catchCode, finallyCode) {
572
+ if (!catchCode && !finallyCode)
573
+ throw new Error('CodeGen: "try" without "catch" and "finally"');
574
+ const node = new Try();
575
+ this._blockNode(node);
576
+ this.code(tryBody);
577
+ if (catchCode) {
578
+ const error = this.name("e");
579
+ this._currNode = node.catch = new Catch(error);
580
+ catchCode(error);
581
+ }
582
+ if (finallyCode) {
583
+ this._currNode = node.finally = new Finally();
584
+ this.code(finallyCode);
585
+ }
586
+ return this._endBlockNode(Catch, Finally);
587
+ }
588
+ // `throw` statement
589
+ throw(error) {
590
+ return this._leafNode(new Throw(error));
591
+ }
592
+ // start self-balancing block
593
+ block(body, nodeCount) {
594
+ this._blockStarts.push(this._nodes.length);
595
+ if (body)
596
+ this.code(body).endBlock(nodeCount);
597
+ return this;
598
+ }
599
+ // end the current self-balancing block
600
+ endBlock(nodeCount) {
601
+ const len = this._blockStarts.pop();
602
+ if (len === void 0)
603
+ throw new Error("CodeGen: not in self-balancing block");
604
+ const toClose = this._nodes.length - len;
605
+ if (toClose < 0 || nodeCount !== void 0 && toClose !== nodeCount) {
606
+ throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`);
607
+ }
608
+ this._nodes.length = len;
609
+ return this;
610
+ }
611
+ // `function` heading (or definition if funcBody is passed)
612
+ func(name, args = code_1.nil, async, funcBody) {
613
+ this._blockNode(new Func(name, args, async));
614
+ if (funcBody)
615
+ this.code(funcBody).endFunc();
616
+ return this;
617
+ }
618
+ // end function definition
619
+ endFunc() {
620
+ return this._endBlockNode(Func);
621
+ }
622
+ optimize(n = 1) {
623
+ while (n-- > 0) {
624
+ this._root.optimizeNodes();
625
+ this._root.optimizeNames(this._root.names, this._constants);
626
+ }
627
+ }
628
+ _leafNode(node) {
629
+ this._currNode.nodes.push(node);
630
+ return this;
631
+ }
632
+ _blockNode(node) {
633
+ this._currNode.nodes.push(node);
634
+ this._nodes.push(node);
635
+ }
636
+ _endBlockNode(N1, N2) {
637
+ const n = this._currNode;
638
+ if (n instanceof N1 || N2 && n instanceof N2) {
639
+ this._nodes.pop();
640
+ return this;
641
+ }
642
+ throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
643
+ }
644
+ _elseNode(node) {
645
+ const n = this._currNode;
646
+ if (!(n instanceof If)) {
647
+ throw new Error('CodeGen: "else" without "if"');
648
+ }
649
+ this._currNode = n.else = node;
650
+ return this;
651
+ }
652
+ get _root() {
653
+ return this._nodes[0];
654
+ }
655
+ get _currNode() {
656
+ const ns = this._nodes;
657
+ return ns[ns.length - 1];
658
+ }
659
+ set _currNode(node) {
660
+ const ns = this._nodes;
661
+ ns[ns.length - 1] = node;
662
+ }
663
+ }
664
+ exports$1.CodeGen = CodeGen;
665
+ function addNames(names, from) {
666
+ for (const n in from)
667
+ names[n] = (names[n] || 0) + (from[n] || 0);
668
+ return names;
669
+ }
670
+ function addExprNames(names, from) {
671
+ return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
672
+ }
673
+ function optimizeExpr(expr, names, constants) {
674
+ if (expr instanceof code_1.Name)
675
+ return replaceName(expr);
676
+ if (!canOptimize(expr))
677
+ return expr;
678
+ return new code_1._Code(expr._items.reduce((items, c) => {
679
+ if (c instanceof code_1.Name)
680
+ c = replaceName(c);
681
+ if (c instanceof code_1._Code)
682
+ items.push(...c._items);
683
+ else
684
+ items.push(c);
685
+ return items;
686
+ }, []));
687
+ function replaceName(n) {
688
+ const c = constants[n.str];
689
+ if (c === void 0 || names[n.str] !== 1)
690
+ return n;
691
+ delete names[n.str];
692
+ return c;
693
+ }
694
+ function canOptimize(e) {
695
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== void 0);
696
+ }
697
+ }
698
+ function subtractNames(names, from) {
699
+ for (const n in from)
700
+ names[n] = (names[n] || 0) - (from[n] || 0);
701
+ }
702
+ function not(x) {
703
+ return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
704
+ }
705
+ exports$1.not = not;
706
+ const andCode = mappend(exports$1.operators.AND);
707
+ function and(...args) {
708
+ return args.reduce(andCode);
709
+ }
710
+ exports$1.and = and;
711
+ const orCode = mappend(exports$1.operators.OR);
712
+ function or(...args) {
713
+ return args.reduce(orCode);
714
+ }
715
+ exports$1.or = or;
716
+ function mappend(op) {
717
+ return (x, y) => x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._)`${par(x)} ${op} ${par(y)}`;
718
+ }
719
+ function par(x) {
720
+ return x instanceof code_1.Name ? x : (0, code_1._)`(${x})`;
721
+ }
722
+ })(codegen);
723
+ return codegen;
724
+ }
725
+ export {
726
+ requireCodegen as __require
727
+ };
728
+ //# sourceMappingURL=index.js.map