kynjal-cli 3.1.3 → 4.0.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 (566) hide show
  1. package/.claude/agents/core/coder.md +1 -1
  2. package/.claude/agents/core/planner.md +2 -2
  3. package/.claude/agents/core/researcher.md +1 -1
  4. package/.claude/agents/core/reviewer.md +1 -1
  5. package/.claude/agents/core/tester.md +1 -1
  6. package/.claude/agents/data/data-ml-model.md +4 -4
  7. package/.claude/agents/development/dev-backend-api.md +4 -4
  8. package/.claude/agents/documentation/docs-api-openapi.md +4 -4
  9. package/.claude/agents/github/code-review-swarm.md +2 -2
  10. package/.claude/agents/github/issue-tracker.md +2 -2
  11. package/.claude/agents/github/pr-manager.md +2 -2
  12. package/.claude/agents/github/release-manager.md +2 -2
  13. package/.claude/agents/github/workflow-automation.md +2 -2
  14. package/.claude/agents/sparc/architecture.md +3 -3
  15. package/.claude/agents/sparc/pseudocode.md +2 -2
  16. package/.claude/agents/sparc/refinement.md +3 -3
  17. package/.claude/agents/sparc/specification.md +2 -2
  18. package/.claude/agents/swarm/adaptive-coordinator.md +1 -1
  19. package/.claude/agents/swarm/hierarchical-coordinator.md +1 -1
  20. package/.claude/agents/swarm/mesh-coordinator.md +1 -1
  21. package/.claude/agents/templates/base-template-generator.md +25 -4
  22. package/.claude/agents/templates/sparc-coordinator.md +3 -3
  23. package/.claude/helpers/auto-commit.sh +1 -1
  24. package/.claude/helpers/auto-memory-hook.mjs +27 -9
  25. package/.claude/helpers/hook-handler.cjs +58 -18
  26. package/.claude/helpers/statusline.cjs +14 -33
  27. package/.claude/helpers/statusline.js +3 -3
  28. package/.claude/settings.json +9 -9
  29. package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
  30. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  31. package/README.md +383 -170
  32. package/bin/cli.js +6 -6
  33. package/bin/mcp-server.js +1 -1
  34. package/bin/preinstall.cjs +2 -0
  35. package/dist/src/appliance/gguf-engine.js +664 -0
  36. package/dist/src/appliance/gguf-engine.js.map +1 -0
  37. package/dist/src/appliance/ruvllm-bridge.js +492 -0
  38. package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
  39. package/dist/src/appliance/rvfa-builder.js +383 -0
  40. package/dist/src/appliance/rvfa-builder.js.map +1 -0
  41. package/dist/src/appliance/rvfa-distribution.js +533 -0
  42. package/dist/src/appliance/rvfa-distribution.js.map +1 -0
  43. package/dist/src/appliance/rvfa-format.js +465 -0
  44. package/dist/src/appliance/rvfa-format.js.map +1 -0
  45. package/dist/src/appliance/rvfa-runner.js +373 -0
  46. package/dist/src/appliance/rvfa-runner.js.map +1 -0
  47. package/dist/src/appliance/rvfa-signing.js +469 -0
  48. package/dist/src/appliance/rvfa-signing.js.map +1 -0
  49. package/dist/src/benchmarks/pretrain/index.js +542 -331
  50. package/dist/src/benchmarks/pretrain/index.js.map +1 -1
  51. package/dist/src/commands/agent.d.ts.map +1 -1
  52. package/dist/src/commands/agent.js +725 -502
  53. package/dist/src/commands/agent.js.map +1 -1
  54. package/dist/src/commands/analyze.js +1548 -1218
  55. package/dist/src/commands/analyze.js.map +1 -1
  56. package/dist/src/commands/appliance-advanced.d.ts +9 -0
  57. package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
  58. package/dist/src/commands/appliance-advanced.js +324 -0
  59. package/dist/src/commands/appliance-advanced.js.map +1 -0
  60. package/dist/src/commands/appliance.d.ts +8 -0
  61. package/dist/src/commands/appliance.d.ts.map +1 -0
  62. package/dist/src/commands/appliance.js +581 -0
  63. package/dist/src/commands/appliance.js.map +1 -0
  64. package/dist/src/commands/benchmark.js +523 -372
  65. package/dist/src/commands/benchmark.js.map +1 -1
  66. package/dist/src/commands/claims.js +364 -274
  67. package/dist/src/commands/claims.js.map +1 -1
  68. package/dist/src/commands/cleanup.d.ts +13 -0
  69. package/dist/src/commands/cleanup.d.ts.map +1 -0
  70. package/dist/src/commands/cleanup.js +262 -0
  71. package/dist/src/commands/cleanup.js.map +1 -0
  72. package/dist/src/commands/completions.js +118 -477
  73. package/dist/src/commands/completions.js.map +1 -1
  74. package/dist/src/commands/config.js +303 -237
  75. package/dist/src/commands/config.js.map +1 -1
  76. package/dist/src/commands/daemon.d.ts.map +1 -1
  77. package/dist/src/commands/daemon.js +597 -425
  78. package/dist/src/commands/daemon.js.map +1 -1
  79. package/dist/src/commands/deployment.js +275 -194
  80. package/dist/src/commands/deployment.js.map +1 -1
  81. package/dist/src/commands/doctor.d.ts.map +1 -1
  82. package/dist/src/commands/doctor.js +690 -460
  83. package/dist/src/commands/doctor.js.map +1 -1
  84. package/dist/src/commands/embeddings.js +1543 -1293
  85. package/dist/src/commands/embeddings.js.map +1 -1
  86. package/dist/src/commands/guidance.js +596 -449
  87. package/dist/src/commands/guidance.js.map +1 -1
  88. package/dist/src/commands/hive-mind.js +938 -854
  89. package/dist/src/commands/hive-mind.js.map +1 -1
  90. package/dist/src/commands/hooks.d.ts.map +1 -1
  91. package/dist/src/commands/hooks.js +3677 -2570
  92. package/dist/src/commands/hooks.js.map +1 -1
  93. package/dist/src/commands/index.js +322 -122
  94. package/dist/src/commands/index.js.map +1 -1
  95. package/dist/src/commands/init.d.ts +1 -1
  96. package/dist/src/commands/init.d.ts.map +1 -1
  97. package/dist/src/commands/init.js +943 -787
  98. package/dist/src/commands/init.js.map +1 -1
  99. package/dist/src/commands/issues.js +558 -383
  100. package/dist/src/commands/issues.js.map +1 -1
  101. package/dist/src/commands/mcp.d.ts.map +1 -1
  102. package/dist/src/commands/mcp.js +605 -475
  103. package/dist/src/commands/mcp.js.map +1 -1
  104. package/dist/src/commands/memory.d.ts.map +1 -1
  105. package/dist/src/commands/memory.js +1031 -814
  106. package/dist/src/commands/memory.js.map +1 -1
  107. package/dist/src/commands/migrate.js +347 -282
  108. package/dist/src/commands/migrate.js.map +1 -1
  109. package/dist/src/commands/neural.d.ts.map +1 -1
  110. package/dist/src/commands/neural.js +1563 -1283
  111. package/dist/src/commands/neural.js.map +1 -1
  112. package/dist/src/commands/performance.js +643 -497
  113. package/dist/src/commands/performance.js.map +1 -1
  114. package/dist/src/commands/plugins.js +841 -668
  115. package/dist/src/commands/plugins.js.map +1 -1
  116. package/dist/src/commands/process.js +447 -392
  117. package/dist/src/commands/process.js.map +1 -1
  118. package/dist/src/commands/progress.js +256 -162
  119. package/dist/src/commands/progress.js.map +1 -1
  120. package/dist/src/commands/providers.js +220 -150
  121. package/dist/src/commands/providers.js.map +1 -1
  122. package/dist/src/commands/route.js +665 -520
  123. package/dist/src/commands/route.js.map +1 -1
  124. package/dist/src/commands/ruvector/backup.js +651 -505
  125. package/dist/src/commands/ruvector/backup.js.map +1 -1
  126. package/dist/src/commands/ruvector/benchmark.js +401 -349
  127. package/dist/src/commands/ruvector/benchmark.js.map +1 -1
  128. package/dist/src/commands/ruvector/import.js +267 -225
  129. package/dist/src/commands/ruvector/import.js.map +1 -1
  130. package/dist/src/commands/ruvector/index.js +75 -37
  131. package/dist/src/commands/ruvector/index.js.map +1 -1
  132. package/dist/src/commands/ruvector/init.js +359 -336
  133. package/dist/src/commands/ruvector/init.js.map +1 -1
  134. package/dist/src/commands/ruvector/migrate.js +322 -335
  135. package/dist/src/commands/ruvector/migrate.js.map +1 -1
  136. package/dist/src/commands/ruvector/optimize.js +431 -375
  137. package/dist/src/commands/ruvector/optimize.js.map +1 -1
  138. package/dist/src/commands/ruvector/setup.js +117 -703
  139. package/dist/src/commands/ruvector/setup.js.map +1 -1
  140. package/dist/src/commands/ruvector/status.js +419 -364
  141. package/dist/src/commands/ruvector/status.js.map +1 -1
  142. package/dist/src/commands/security.d.ts.map +1 -1
  143. package/dist/src/commands/security.js +610 -456
  144. package/dist/src/commands/security.js.map +1 -1
  145. package/dist/src/commands/session.d.ts +1 -1
  146. package/dist/src/commands/session.js +627 -505
  147. package/dist/src/commands/session.js.map +1 -1
  148. package/dist/src/commands/start.d.ts +1 -1
  149. package/dist/src/commands/start.js +368 -271
  150. package/dist/src/commands/start.js.map +1 -1
  151. package/dist/src/commands/status.d.ts +1 -1
  152. package/dist/src/commands/status.d.ts.map +1 -1
  153. package/dist/src/commands/status.js +492 -379
  154. package/dist/src/commands/status.js.map +1 -1
  155. package/dist/src/commands/swarm.js +488 -408
  156. package/dist/src/commands/swarm.js.map +1 -1
  157. package/dist/src/commands/task.d.ts +1 -1
  158. package/dist/src/commands/task.js +539 -424
  159. package/dist/src/commands/task.js.map +1 -1
  160. package/dist/src/commands/transfer-store.js +412 -322
  161. package/dist/src/commands/transfer-store.js.map +1 -1
  162. package/dist/src/commands/update.js +291 -196
  163. package/dist/src/commands/update.js.map +1 -1
  164. package/dist/src/commands/workflow.js +486 -386
  165. package/dist/src/commands/workflow.js.map +1 -1
  166. package/dist/src/config-adapter.js +40 -39
  167. package/dist/src/config-adapter.js.map +1 -1
  168. package/dist/src/index.js +416 -312
  169. package/dist/src/index.js.map +1 -1
  170. package/dist/src/infrastructure/in-memory-repositories.js +507 -246
  171. package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
  172. package/dist/src/init/claudemd-generator.js +78 -368
  173. package/dist/src/init/claudemd-generator.js.map +1 -1
  174. package/dist/src/init/executor.js +1019 -1345
  175. package/dist/src/init/executor.js.map +1 -1
  176. package/dist/src/init/helpers-generator.js +60 -635
  177. package/dist/src/init/helpers-generator.js.map +1 -1
  178. package/dist/src/init/index.d.ts +1 -1
  179. package/dist/src/init/index.d.ts.map +1 -1
  180. package/dist/src/init/index.js +1 -1
  181. package/dist/src/init/index.js.map +1 -1
  182. package/dist/src/init/mcp-generator.d.ts +0 -1
  183. package/dist/src/init/mcp-generator.d.ts.map +1 -1
  184. package/dist/src/init/mcp-generator.js +62 -42
  185. package/dist/src/init/mcp-generator.js.map +1 -1
  186. package/dist/src/init/settings-generator.d.ts.map +1 -1
  187. package/dist/src/init/settings-generator.js +167 -100
  188. package/dist/src/init/settings-generator.js.map +1 -1
  189. package/dist/src/init/statusline-generator.d.ts +16 -8
  190. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  191. package/dist/src/init/statusline-generator.js +20 -1300
  192. package/dist/src/init/statusline-generator.js.map +1 -1
  193. package/dist/src/init/types.d.ts +15 -5
  194. package/dist/src/init/types.d.ts.map +1 -1
  195. package/dist/src/init/types.js +66 -76
  196. package/dist/src/init/types.js.map +1 -1
  197. package/dist/src/mcp-client.js +130 -76
  198. package/dist/src/mcp-client.js.map +1 -1
  199. package/dist/src/mcp-server.js +758 -445
  200. package/dist/src/mcp-server.js.map +1 -1
  201. package/dist/src/mcp-tools/agent-tools.js +492 -391
  202. package/dist/src/mcp-tools/agent-tools.js.map +1 -1
  203. package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
  204. package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
  205. package/dist/src/mcp-tools/agentdb-tools.js +758 -0
  206. package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
  207. package/dist/src/mcp-tools/analyze-tools.js +236 -172
  208. package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
  209. package/dist/src/mcp-tools/auto-install.js +142 -80
  210. package/dist/src/mcp-tools/auto-install.js.map +1 -1
  211. package/dist/src/mcp-tools/browser-tools.js +375 -252
  212. package/dist/src/mcp-tools/browser-tools.js.map +1 -1
  213. package/dist/src/mcp-tools/claims-tools.js +565 -473
  214. package/dist/src/mcp-tools/claims-tools.js.map +1 -1
  215. package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
  216. package/dist/src/mcp-tools/config-tools.js +284 -190
  217. package/dist/src/mcp-tools/config-tools.js.map +1 -1
  218. package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
  219. package/dist/src/mcp-tools/coordination-tools.js +600 -349
  220. package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
  221. package/dist/src/mcp-tools/daa-tools.js +367 -289
  222. package/dist/src/mcp-tools/daa-tools.js.map +1 -1
  223. package/dist/src/mcp-tools/embeddings-tools.js +693 -582
  224. package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
  225. package/dist/src/mcp-tools/github-tools.js +312 -261
  226. package/dist/src/mcp-tools/github-tools.js.map +1 -1
  227. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  228. package/dist/src/mcp-tools/hive-mind-tools.js +718 -423
  229. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  230. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  231. package/dist/src/mcp-tools/hooks-tools.js +2726 -1978
  232. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  233. package/dist/src/mcp-tools/index.d.ts +2 -0
  234. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  235. package/dist/src/mcp-tools/index.js +2 -0
  236. package/dist/src/mcp-tools/index.js.map +1 -1
  237. package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
  238. package/dist/src/mcp-tools/memory-tools.js +514 -329
  239. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  240. package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
  241. package/dist/src/mcp-tools/neural-tools.js +428 -326
  242. package/dist/src/mcp-tools/neural-tools.js.map +1 -1
  243. package/dist/src/mcp-tools/performance-tools.js +480 -420
  244. package/dist/src/mcp-tools/performance-tools.js.map +1 -1
  245. package/dist/src/mcp-tools/progress-tools.js +278 -204
  246. package/dist/src/mcp-tools/progress-tools.js.map +1 -1
  247. package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
  248. package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
  249. package/dist/src/mcp-tools/ruvllm-tools.js +399 -0
  250. package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
  251. package/dist/src/mcp-tools/security-tools.js +429 -297
  252. package/dist/src/mcp-tools/security-tools.js.map +1 -1
  253. package/dist/src/mcp-tools/session-tools.js +234 -185
  254. package/dist/src/mcp-tools/session-tools.js.map +1 -1
  255. package/dist/src/mcp-tools/swarm-tools.d.ts +2 -1
  256. package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
  257. package/dist/src/mcp-tools/swarm-tools.js +303 -64
  258. package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
  259. package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
  260. package/dist/src/mcp-tools/system-tools.js +352 -200
  261. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  262. package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
  263. package/dist/src/mcp-tools/task-tools.js +357 -189
  264. package/dist/src/mcp-tools/task-tools.js.map +1 -1
  265. package/dist/src/mcp-tools/terminal-tools.js +196 -148
  266. package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
  267. package/dist/src/mcp-tools/transfer-tools.js +333 -186
  268. package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
  269. package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
  270. package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
  271. package/dist/src/mcp-tools/wasm-agent-tools.js +377 -0
  272. package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
  273. package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
  274. package/dist/src/mcp-tools/workflow-tools.js +471 -335
  275. package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
  276. package/dist/src/memory/ewc-consolidation.js +345 -173
  277. package/dist/src/memory/ewc-consolidation.js.map +1 -1
  278. package/dist/src/memory/intelligence.js +841 -359
  279. package/dist/src/memory/intelligence.js.map +1 -1
  280. package/dist/src/memory/memory-bridge.js +1964 -0
  281. package/dist/src/memory/memory-bridge.js.map +1 -0
  282. package/dist/src/memory/memory-initializer.js +1895 -1602
  283. package/dist/src/memory/memory-initializer.js.map +1 -1
  284. package/dist/src/memory/sona-optimizer.js +329 -199
  285. package/dist/src/memory/sona-optimizer.js.map +1 -1
  286. package/dist/src/output.d.ts +2 -2
  287. package/dist/src/output.d.ts.map +1 -1
  288. package/dist/src/output.js +273 -242
  289. package/dist/src/output.js.map +1 -1
  290. package/dist/src/parser.js +217 -124
  291. package/dist/src/parser.js.map +1 -1
  292. package/dist/src/plugins/manager.js +531 -278
  293. package/dist/src/plugins/manager.js.map +1 -1
  294. package/dist/src/plugins/store/discovery.js +362 -275
  295. package/dist/src/plugins/store/discovery.js.map +1 -1
  296. package/dist/src/plugins/store/index.js +105 -48
  297. package/dist/src/plugins/store/index.js.map +1 -1
  298. package/dist/src/plugins/store/search.js +107 -69
  299. package/dist/src/plugins/store/search.js.map +1 -1
  300. package/dist/src/plugins/tests/demo-plugin-store.js +160 -113
  301. package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
  302. package/dist/src/plugins/tests/standalone-test.js +223 -172
  303. package/dist/src/plugins/tests/standalone-test.js.map +1 -1
  304. package/dist/src/plugins/tests/test-plugin-store.js +228 -190
  305. package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
  306. package/dist/src/production/circuit-breaker.js +126 -62
  307. package/dist/src/production/circuit-breaker.js.map +1 -1
  308. package/dist/src/production/error-handler.js +156 -86
  309. package/dist/src/production/error-handler.js.map +1 -1
  310. package/dist/src/production/monitoring.js +220 -139
  311. package/dist/src/production/monitoring.js.map +1 -1
  312. package/dist/src/production/rate-limiter.js +93 -74
  313. package/dist/src/production/rate-limiter.js.map +1 -1
  314. package/dist/src/production/retry.js +167 -75
  315. package/dist/src/production/retry.js.map +1 -1
  316. package/dist/src/prompt.js +560 -436
  317. package/dist/src/prompt.js.map +1 -1
  318. package/dist/src/runtime/headless.js +289 -200
  319. package/dist/src/runtime/headless.js.map +1 -1
  320. package/dist/src/ruvector/agent-wasm.js +511 -0
  321. package/dist/src/ruvector/agent-wasm.js.map +1 -0
  322. package/dist/src/ruvector/ast-analyzer.js +232 -145
  323. package/dist/src/ruvector/ast-analyzer.js.map +1 -1
  324. package/dist/src/ruvector/coverage-router.js +419 -287
  325. package/dist/src/ruvector/coverage-router.js.map +1 -1
  326. package/dist/src/ruvector/coverage-tools.js +101 -56
  327. package/dist/src/ruvector/coverage-tools.js.map +1 -1
  328. package/dist/src/ruvector/diff-classifier.js +451 -324
  329. package/dist/src/ruvector/diff-classifier.js.map +1 -1
  330. package/dist/src/ruvector/enhanced-model-router.js +337 -251
  331. package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
  332. package/dist/src/ruvector/flash-attention.js +254 -223
  333. package/dist/src/ruvector/flash-attention.js.map +1 -1
  334. package/dist/src/ruvector/graph-analyzer.js +680 -486
  335. package/dist/src/ruvector/graph-analyzer.js.map +1 -1
  336. package/dist/src/ruvector/index.js +113 -27
  337. package/dist/src/ruvector/index.js.map +1 -1
  338. package/dist/src/ruvector/lora-adapter.js +248 -155
  339. package/dist/src/ruvector/lora-adapter.js.map +1 -1
  340. package/dist/src/ruvector/model-router.js +248 -175
  341. package/dist/src/ruvector/model-router.js.map +1 -1
  342. package/dist/src/ruvector/moe-router.js +286 -228
  343. package/dist/src/ruvector/moe-router.js.map +1 -1
  344. package/dist/src/ruvector/q-learning-router.js +338 -257
  345. package/dist/src/ruvector/q-learning-router.js.map +1 -1
  346. package/dist/src/ruvector/ruvllm-wasm.js +527 -0
  347. package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
  348. package/dist/src/ruvector/semantic-router.js +67 -60
  349. package/dist/src/ruvector/semantic-router.js.map +1 -1
  350. package/dist/src/ruvector/vector-db.js +205 -119
  351. package/dist/src/ruvector/vector-db.js.map +1 -1
  352. package/dist/src/services/agentic-flow-bridge.js +168 -0
  353. package/dist/src/services/agentic-flow-bridge.js.map +1 -0
  354. package/dist/src/services/claim-service.js +940 -615
  355. package/dist/src/services/claim-service.js.map +1 -1
  356. package/dist/src/services/container-worker-pool.js +669 -399
  357. package/dist/src/services/container-worker-pool.js.map +1 -1
  358. package/dist/src/services/headless-worker-executor.js +467 -441
  359. package/dist/src/services/headless-worker-executor.js.map +1 -1
  360. package/dist/src/services/index.d.ts +5 -5
  361. package/dist/src/services/index.d.ts.map +1 -1
  362. package/dist/src/services/index.js +4 -4
  363. package/dist/src/services/index.js.map +1 -1
  364. package/dist/src/services/registry-api.js +201 -93
  365. package/dist/src/services/registry-api.js.map +1 -1
  366. package/dist/src/services/ruvector-training.js +414 -144
  367. package/dist/src/services/ruvector-training.js.map +1 -1
  368. package/dist/src/services/worker-daemon.js +928 -531
  369. package/dist/src/services/worker-daemon.js.map +1 -1
  370. package/dist/src/services/worker-queue.js +550 -331
  371. package/dist/src/services/worker-queue.js.map +1 -1
  372. package/dist/src/suggest.js +55 -45
  373. package/dist/src/suggest.js.map +1 -1
  374. package/dist/src/transfer/anonymization/index.js +37 -29
  375. package/dist/src/transfer/anonymization/index.js.map +1 -1
  376. package/dist/src/transfer/deploy-seraphine.d.ts +1 -1
  377. package/dist/src/transfer/deploy-seraphine.js +156 -129
  378. package/dist/src/transfer/deploy-seraphine.js.map +1 -1
  379. package/dist/src/transfer/export.js +142 -84
  380. package/dist/src/transfer/export.js.map +1 -1
  381. package/dist/src/transfer/index.d.ts +1 -1
  382. package/dist/src/transfer/index.d.ts.map +1 -1
  383. package/dist/src/transfer/index.js +2 -0
  384. package/dist/src/transfer/index.js.map +1 -1
  385. package/dist/src/transfer/ipfs/client.js +337 -179
  386. package/dist/src/transfer/ipfs/client.js.map +1 -1
  387. package/dist/src/transfer/ipfs/upload.js +434 -290
  388. package/dist/src/transfer/ipfs/upload.js.map +1 -1
  389. package/dist/src/transfer/models/seraphine.js +58 -58
  390. package/dist/src/transfer/models/seraphine.js.map +1 -1
  391. package/dist/src/transfer/serialization/cfp.js +37 -33
  392. package/dist/src/transfer/serialization/cfp.js.map +1 -1
  393. package/dist/src/transfer/storage/gcs.js +248 -139
  394. package/dist/src/transfer/storage/gcs.js.map +1 -1
  395. package/dist/src/transfer/store/discovery.js +353 -243
  396. package/dist/src/transfer/store/discovery.js.map +1 -1
  397. package/dist/src/transfer/store/download.js +365 -243
  398. package/dist/src/transfer/store/download.js.map +1 -1
  399. package/dist/src/transfer/store/index.js +130 -63
  400. package/dist/src/transfer/store/index.js.map +1 -1
  401. package/dist/src/transfer/store/publish.js +258 -184
  402. package/dist/src/transfer/store/publish.js.map +1 -1
  403. package/dist/src/transfer/store/registry.js +73 -51
  404. package/dist/src/transfer/store/registry.js.map +1 -1
  405. package/dist/src/transfer/store/search.js +96 -64
  406. package/dist/src/transfer/store/search.js.map +1 -1
  407. package/dist/src/transfer/store/tests/standalone-test.js +231 -174
  408. package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
  409. package/dist/src/transfer/test-seraphine.js +130 -95
  410. package/dist/src/transfer/test-seraphine.js.map +1 -1
  411. package/dist/src/transfer/tests/test-store.js +239 -194
  412. package/dist/src/transfer/tests/test-store.js.map +1 -1
  413. package/dist/src/types.js +56 -27
  414. package/dist/src/types.js.map +1 -1
  415. package/dist/src/update/checker.js +183 -106
  416. package/dist/src/update/checker.js.map +1 -1
  417. package/dist/src/update/executor.js +198 -135
  418. package/dist/src/update/executor.js.map +1 -1
  419. package/dist/src/update/index.js +85 -38
  420. package/dist/src/update/index.js.map +1 -1
  421. package/dist/src/update/rate-limiter.js +31 -19
  422. package/dist/src/update/rate-limiter.js.map +1 -1
  423. package/dist/src/update/validator.js +64 -38
  424. package/dist/src/update/validator.js.map +1 -1
  425. package/dist/tsconfig.tsbuildinfo +1 -1
  426. package/package.json +13 -10
  427. package/.claude/agents/custom/accessibility-auditor.yaml +0 -56
  428. package/.claude/agents/custom/design-architect.yaml +0 -48
  429. package/.claude/agents/custom/ui-developer.yaml +0 -46
  430. package/.claude/agents/custom/ux-researcher.yaml +0 -60
  431. package/dist/src/benchmarks/pretrain/index.d.ts +0 -58
  432. package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
  433. package/dist/src/commands/index.d.ts +0 -108
  434. package/dist/src/commands/index.d.ts.map +0 -1
  435. package/dist/src/config-adapter.d.ts +0 -15
  436. package/dist/src/config-adapter.d.ts.map +0 -1
  437. package/dist/src/index.d.ts +0 -76
  438. package/dist/src/index.d.ts.map +0 -1
  439. package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
  440. package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
  441. package/dist/src/init/claudemd-generator.d.ts +0 -25
  442. package/dist/src/init/claudemd-generator.d.ts.map +0 -1
  443. package/dist/src/init/executor.d.ts +0 -41
  444. package/dist/src/init/executor.d.ts.map +0 -1
  445. package/dist/src/init/helpers-generator.d.ts +0 -60
  446. package/dist/src/init/helpers-generator.d.ts.map +0 -1
  447. package/dist/src/mcp-client.d.ts +0 -92
  448. package/dist/src/mcp-client.d.ts.map +0 -1
  449. package/dist/src/mcp-server.d.ts +0 -161
  450. package/dist/src/mcp-server.d.ts.map +0 -1
  451. package/dist/src/mcp-tools/auto-install.d.ts +0 -83
  452. package/dist/src/mcp-tools/auto-install.d.ts.map +0 -1
  453. package/dist/src/mcp-tools/types.d.ts +0 -31
  454. package/dist/src/mcp-tools/types.d.ts.map +0 -1
  455. package/dist/src/memory/ewc-consolidation.d.ts +0 -271
  456. package/dist/src/memory/ewc-consolidation.d.ts.map +0 -1
  457. package/dist/src/memory/intelligence.d.ts +0 -285
  458. package/dist/src/memory/intelligence.d.ts.map +0 -1
  459. package/dist/src/memory/memory-initializer.d.ts +0 -396
  460. package/dist/src/memory/memory-initializer.d.ts.map +0 -1
  461. package/dist/src/memory/sona-optimizer.d.ts +0 -227
  462. package/dist/src/memory/sona-optimizer.d.ts.map +0 -1
  463. package/dist/src/parser.d.ts +0 -41
  464. package/dist/src/parser.d.ts.map +0 -1
  465. package/dist/src/plugins/manager.d.ts +0 -133
  466. package/dist/src/plugins/manager.d.ts.map +0 -1
  467. package/dist/src/plugins/store/discovery.d.ts +0 -88
  468. package/dist/src/plugins/store/discovery.d.ts.map +0 -1
  469. package/dist/src/plugins/store/index.d.ts +0 -76
  470. package/dist/src/plugins/store/index.d.ts.map +0 -1
  471. package/dist/src/plugins/store/search.d.ts +0 -46
  472. package/dist/src/plugins/store/search.d.ts.map +0 -1
  473. package/dist/src/plugins/store/types.d.ts +0 -274
  474. package/dist/src/plugins/store/types.d.ts.map +0 -1
  475. package/dist/src/production/circuit-breaker.d.ts +0 -101
  476. package/dist/src/production/circuit-breaker.d.ts.map +0 -1
  477. package/dist/src/production/error-handler.d.ts +0 -92
  478. package/dist/src/production/error-handler.d.ts.map +0 -1
  479. package/dist/src/production/monitoring.d.ts +0 -161
  480. package/dist/src/production/monitoring.d.ts.map +0 -1
  481. package/dist/src/production/rate-limiter.d.ts +0 -80
  482. package/dist/src/production/rate-limiter.d.ts.map +0 -1
  483. package/dist/src/production/retry.d.ts +0 -48
  484. package/dist/src/production/retry.d.ts.map +0 -1
  485. package/dist/src/prompt.d.ts +0 -44
  486. package/dist/src/prompt.d.ts.map +0 -1
  487. package/dist/src/runtime/headless.d.ts +0 -60
  488. package/dist/src/runtime/headless.d.ts.map +0 -1
  489. package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
  490. package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
  491. package/dist/src/ruvector/coverage-router.d.ts +0 -160
  492. package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
  493. package/dist/src/ruvector/diff-classifier.d.ts +0 -175
  494. package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
  495. package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
  496. package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
  497. package/dist/src/ruvector/flash-attention.d.ts +0 -195
  498. package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
  499. package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
  500. package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
  501. package/dist/src/ruvector/index.d.ts +0 -34
  502. package/dist/src/ruvector/index.d.ts.map +0 -1
  503. package/dist/src/ruvector/lora-adapter.d.ts +0 -218
  504. package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
  505. package/dist/src/ruvector/model-router.d.ts +0 -220
  506. package/dist/src/ruvector/model-router.d.ts.map +0 -1
  507. package/dist/src/ruvector/moe-router.d.ts +0 -206
  508. package/dist/src/ruvector/moe-router.d.ts.map +0 -1
  509. package/dist/src/ruvector/q-learning-router.d.ts +0 -211
  510. package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
  511. package/dist/src/ruvector/semantic-router.d.ts +0 -77
  512. package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
  513. package/dist/src/ruvector/vector-db.d.ts +0 -69
  514. package/dist/src/ruvector/vector-db.d.ts.map +0 -1
  515. package/dist/src/services/claim-service.d.ts +0 -204
  516. package/dist/src/services/claim-service.d.ts.map +0 -1
  517. package/dist/src/services/container-worker-pool.d.ts +0 -197
  518. package/dist/src/services/container-worker-pool.d.ts.map +0 -1
  519. package/dist/src/services/headless-worker-executor.d.ts +0 -304
  520. package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
  521. package/dist/src/services/registry-api.d.ts +0 -58
  522. package/dist/src/services/registry-api.d.ts.map +0 -1
  523. package/dist/src/services/ruvector-training.d.ts +0 -213
  524. package/dist/src/services/ruvector-training.d.ts.map +0 -1
  525. package/dist/src/services/worker-daemon.d.ts +0 -203
  526. package/dist/src/services/worker-daemon.d.ts.map +0 -1
  527. package/dist/src/services/worker-queue.d.ts +0 -194
  528. package/dist/src/services/worker-queue.d.ts.map +0 -1
  529. package/dist/src/suggest.d.ts +0 -53
  530. package/dist/src/suggest.d.ts.map +0 -1
  531. package/dist/src/transfer/export.d.ts +0 -25
  532. package/dist/src/transfer/export.d.ts.map +0 -1
  533. package/dist/src/transfer/ipfs/client.d.ts +0 -109
  534. package/dist/src/transfer/ipfs/client.d.ts.map +0 -1
  535. package/dist/src/transfer/ipfs/upload.d.ts +0 -95
  536. package/dist/src/transfer/ipfs/upload.d.ts.map +0 -1
  537. package/dist/src/transfer/models/seraphine.d.ts +0 -72
  538. package/dist/src/transfer/models/seraphine.d.ts.map +0 -1
  539. package/dist/src/transfer/serialization/cfp.d.ts +0 -49
  540. package/dist/src/transfer/serialization/cfp.d.ts.map +0 -1
  541. package/dist/src/transfer/storage/gcs.d.ts +0 -82
  542. package/dist/src/transfer/storage/gcs.d.ts.map +0 -1
  543. package/dist/src/transfer/store/discovery.d.ts +0 -84
  544. package/dist/src/transfer/store/discovery.d.ts.map +0 -1
  545. package/dist/src/transfer/store/download.d.ts +0 -70
  546. package/dist/src/transfer/store/download.d.ts.map +0 -1
  547. package/dist/src/transfer/store/index.d.ts +0 -84
  548. package/dist/src/transfer/store/index.d.ts.map +0 -1
  549. package/dist/src/transfer/store/publish.d.ts +0 -76
  550. package/dist/src/transfer/store/publish.d.ts.map +0 -1
  551. package/dist/src/transfer/store/search.d.ts +0 -54
  552. package/dist/src/transfer/store/search.d.ts.map +0 -1
  553. package/dist/src/transfer/types.d.ts +0 -245
  554. package/dist/src/transfer/types.d.ts.map +0 -1
  555. package/dist/src/types.d.ts +0 -198
  556. package/dist/src/types.d.ts.map +0 -1
  557. package/dist/src/update/checker.d.ts +0 -34
  558. package/dist/src/update/checker.d.ts.map +0 -1
  559. package/dist/src/update/executor.d.ts +0 -32
  560. package/dist/src/update/executor.d.ts.map +0 -1
  561. package/dist/src/update/index.d.ts +0 -33
  562. package/dist/src/update/index.d.ts.map +0 -1
  563. package/dist/src/update/rate-limiter.d.ts +0 -20
  564. package/dist/src/update/rate-limiter.d.ts.map +0 -1
  565. package/dist/src/update/validator.d.ts +0 -17
  566. package/dist/src/update/validator.d.ts.map +0 -1
@@ -6,28 +6,75 @@
6
6
  *
7
7
  * @module @claude-flow/cli/mcp-tools/claims
8
8
  */
9
+ var __assign = (this && this.__assign) || function () {
10
+ __assign = Object.assign || function(t) {
11
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
12
+ s = arguments[i];
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
14
+ t[p] = s[p];
15
+ }
16
+ return t;
17
+ };
18
+ return __assign.apply(this, arguments);
19
+ };
20
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
21
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
22
+ return new (P || (P = Promise))(function (resolve, reject) {
23
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
24
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
26
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
27
+ });
28
+ };
29
+ var __generator = (this && this.__generator) || function (thisArg, body) {
30
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
31
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
32
+ function verb(n) { return function (v) { return step([n, v]); }; }
33
+ function step(op) {
34
+ if (f) throw new TypeError("Generator is already executing.");
35
+ while (_) try {
36
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
37
+ if (y = 0, t) op = [op[0] & 2, t.value];
38
+ switch (op[0]) {
39
+ case 0: case 1: t = op; break;
40
+ case 4: _.label++; return { value: op[1], done: false };
41
+ case 5: _.label++; y = op[1]; op = [0]; continue;
42
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
43
+ default:
44
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
45
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
46
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
47
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
48
+ if (t[2]) _.ops.pop();
49
+ _.trys.pop(); continue;
50
+ }
51
+ op = body.call(thisArg, _);
52
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
53
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
54
+ }
55
+ };
9
56
  // File-based persistence
10
57
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
11
58
  import { join, resolve } from 'path';
12
- const CLAIMS_DIR = '.claude-flow/claims';
13
- const CLAIMS_FILE = 'claims.json';
59
+ var CLAIMS_DIR = '.claude-flow/claims';
60
+ var CLAIMS_FILE = 'claims.json';
14
61
  function getClaimsPath() {
15
62
  return resolve(join(CLAIMS_DIR, CLAIMS_FILE));
16
63
  }
17
64
  function ensureClaimsDir() {
18
- const dir = resolve(CLAIMS_DIR);
65
+ var dir = resolve(CLAIMS_DIR);
19
66
  if (!existsSync(dir)) {
20
67
  mkdirSync(dir, { recursive: true });
21
68
  }
22
69
  }
23
70
  function loadClaims() {
24
71
  try {
25
- const path = getClaimsPath();
72
+ var path = getClaimsPath();
26
73
  if (existsSync(path)) {
27
74
  return JSON.parse(readFileSync(path, 'utf-8'));
28
75
  }
29
76
  }
30
- catch {
77
+ catch (_a) {
31
78
  // Return empty store on error
32
79
  }
33
80
  return { claims: {}, stealable: {}, contests: {} };
@@ -38,11 +85,11 @@ function saveClaims(store) {
38
85
  }
39
86
  function formatClaimant(claimant) {
40
87
  return claimant.type === 'human'
41
- ? `human:${claimant.userId}:${claimant.name}`
42
- : `agent:${claimant.agentId}:${claimant.agentType}`;
88
+ ? "human:" + claimant.userId + ":" + claimant.name
89
+ : "agent:" + claimant.agentId + ":" + claimant.agentType;
43
90
  }
44
91
  function parseClaimant(str) {
45
- const parts = str.split(':');
92
+ var parts = str.split(':');
46
93
  if (parts[0] === 'human' && parts.length >= 3) {
47
94
  return { type: 'human', userId: parts[1], name: parts.slice(2).join(':') };
48
95
  }
@@ -51,7 +98,7 @@ function parseClaimant(str) {
51
98
  }
52
99
  return null;
53
100
  }
54
- export const claimsTools = [
101
+ export var claimsTools = [
55
102
  {
56
103
  name: 'claims_claim',
57
104
  description: 'Claim an issue for work (human or agent)',
@@ -61,55 +108,58 @@ export const claimsTools = [
61
108
  properties: {
62
109
  issueId: {
63
110
  type: 'string',
64
- description: 'Issue ID or GitHub issue number',
111
+ description: 'Issue ID or GitHub issue number'
65
112
  },
66
113
  claimant: {
67
114
  type: 'string',
68
- description: 'Claimant identifier (e.g., "human:user-1:Alice" or "agent:coder-1:coder")',
115
+ description: 'Claimant identifier (e.g., "human:user-1:Alice" or "agent:coder-1:coder")'
69
116
  },
70
117
  context: {
71
118
  type: 'string',
72
- description: 'Optional context about the work approach',
73
- },
119
+ description: 'Optional context about the work approach'
120
+ }
74
121
  },
75
- required: ['issueId', 'claimant'],
122
+ required: ['issueId', 'claimant']
76
123
  },
77
- handler: async (input) => {
78
- const issueId = input.issueId;
79
- const claimantStr = input.claimant;
80
- const context = input.context;
81
- const claimant = parseClaimant(claimantStr);
82
- if (!claimant) {
83
- return { success: false, error: 'Invalid claimant format. Use "human:userId:name" or "agent:agentId:agentType"' };
84
- }
85
- const store = loadClaims();
86
- // Check if already claimed
87
- if (store.claims[issueId]) {
88
- const existing = store.claims[issueId];
89
- return {
90
- success: false,
91
- error: `Issue already claimed by ${formatClaimant(existing.claimant)}`,
92
- existingClaim: existing,
124
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
125
+ var issueId, claimantStr, context, claimant, store, existing, now, claim;
126
+ return __generator(this, function (_a) {
127
+ issueId = input.issueId;
128
+ claimantStr = input.claimant;
129
+ context = input.context;
130
+ claimant = parseClaimant(claimantStr);
131
+ if (!claimant) {
132
+ return [2 /*return*/, { success: false, error: 'Invalid claimant format. Use "human:userId:name" or "agent:agentId:agentType"' }];
133
+ }
134
+ store = loadClaims();
135
+ // Check if already claimed
136
+ if (store.claims[issueId]) {
137
+ existing = store.claims[issueId];
138
+ return [2 /*return*/, {
139
+ success: false,
140
+ error: "Issue already claimed by " + formatClaimant(existing.claimant),
141
+ existingClaim: existing
142
+ }];
143
+ }
144
+ now = new Date().toISOString();
145
+ claim = {
146
+ issueId: issueId,
147
+ claimant: claimant,
148
+ claimedAt: now,
149
+ status: 'active',
150
+ statusChangedAt: now,
151
+ progress: 0,
152
+ context: context
93
153
  };
94
- }
95
- const now = new Date().toISOString();
96
- const claim = {
97
- issueId,
98
- claimant,
99
- claimedAt: now,
100
- status: 'active',
101
- statusChangedAt: now,
102
- progress: 0,
103
- context,
104
- };
105
- store.claims[issueId] = claim;
106
- saveClaims(store);
107
- return {
108
- success: true,
109
- claim,
110
- message: `Issue ${issueId} claimed by ${formatClaimant(claimant)}`,
111
- };
112
- },
154
+ store.claims[issueId] = claim;
155
+ saveClaims(store);
156
+ return [2 /*return*/, {
157
+ success: true,
158
+ claim: claim,
159
+ message: "Issue " + issueId + " claimed by " + formatClaimant(claimant)
160
+ }];
161
+ });
162
+ }); }
113
163
  },
114
164
  {
115
165
  name: 'claims_release',
@@ -120,46 +170,49 @@ export const claimsTools = [
120
170
  properties: {
121
171
  issueId: {
122
172
  type: 'string',
123
- description: 'Issue ID to release',
173
+ description: 'Issue ID to release'
124
174
  },
125
175
  claimant: {
126
176
  type: 'string',
127
- description: 'Claimant identifier (must match current owner)',
177
+ description: 'Claimant identifier (must match current owner)'
128
178
  },
129
179
  reason: {
130
180
  type: 'string',
131
- description: 'Reason for releasing',
132
- },
181
+ description: 'Reason for releasing'
182
+ }
133
183
  },
134
- required: ['issueId', 'claimant'],
135
- },
136
- handler: async (input) => {
137
- const issueId = input.issueId;
138
- const claimantStr = input.claimant;
139
- const reason = input.reason;
140
- const claimant = parseClaimant(claimantStr);
141
- if (!claimant) {
142
- return { success: false, error: 'Invalid claimant format' };
143
- }
144
- const store = loadClaims();
145
- const claim = store.claims[issueId];
146
- if (!claim) {
147
- return { success: false, error: 'Issue is not claimed' };
148
- }
149
- // Verify ownership
150
- if (formatClaimant(claim.claimant) !== formatClaimant(claimant)) {
151
- return { success: false, error: 'Only the current claimant can release' };
152
- }
153
- delete store.claims[issueId];
154
- delete store.stealable[issueId];
155
- saveClaims(store);
156
- return {
157
- success: true,
158
- message: `Issue ${issueId} released`,
159
- reason,
160
- previousClaim: claim,
161
- };
184
+ required: ['issueId', 'claimant']
162
185
  },
186
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
187
+ var issueId, claimantStr, reason, claimant, store, claim;
188
+ return __generator(this, function (_a) {
189
+ issueId = input.issueId;
190
+ claimantStr = input.claimant;
191
+ reason = input.reason;
192
+ claimant = parseClaimant(claimantStr);
193
+ if (!claimant) {
194
+ return [2 /*return*/, { success: false, error: 'Invalid claimant format' }];
195
+ }
196
+ store = loadClaims();
197
+ claim = store.claims[issueId];
198
+ if (!claim) {
199
+ return [2 /*return*/, { success: false, error: 'Issue is not claimed' }];
200
+ }
201
+ // Verify ownership
202
+ if (formatClaimant(claim.claimant) !== formatClaimant(claimant)) {
203
+ return [2 /*return*/, { success: false, error: 'Only the current claimant can release' }];
204
+ }
205
+ delete store.claims[issueId];
206
+ delete store.stealable[issueId];
207
+ saveClaims(store);
208
+ return [2 /*return*/, {
209
+ success: true,
210
+ message: "Issue " + issueId + " released",
211
+ reason: reason,
212
+ previousClaim: claim
213
+ }];
214
+ });
215
+ }); }
163
216
  },
164
217
  {
165
218
  name: 'claims_handoff',
@@ -170,60 +223,63 @@ export const claimsTools = [
170
223
  properties: {
171
224
  issueId: {
172
225
  type: 'string',
173
- description: 'Issue ID to handoff',
226
+ description: 'Issue ID to handoff'
174
227
  },
175
228
  from: {
176
229
  type: 'string',
177
- description: 'Current claimant identifier',
230
+ description: 'Current claimant identifier'
178
231
  },
179
232
  to: {
180
233
  type: 'string',
181
- description: 'Target claimant identifier',
234
+ description: 'Target claimant identifier'
182
235
  },
183
236
  reason: {
184
237
  type: 'string',
185
- description: 'Reason for handoff',
238
+ description: 'Reason for handoff'
186
239
  },
187
240
  progress: {
188
241
  type: 'number',
189
- description: 'Current progress percentage (0-100)',
190
- },
242
+ description: 'Current progress percentage (0-100)'
243
+ }
191
244
  },
192
- required: ['issueId', 'from', 'to'],
193
- },
194
- handler: async (input) => {
195
- const issueId = input.issueId;
196
- const fromStr = input.from;
197
- const toStr = input.to;
198
- const reason = input.reason;
199
- const progress = input.progress || 0;
200
- const from = parseClaimant(fromStr);
201
- const to = parseClaimant(toStr);
202
- if (!from || !to) {
203
- return { success: false, error: 'Invalid claimant format' };
204
- }
205
- const store = loadClaims();
206
- const claim = store.claims[issueId];
207
- if (!claim) {
208
- return { success: false, error: 'Issue is not claimed' };
209
- }
210
- if (formatClaimant(claim.claimant) !== formatClaimant(from)) {
211
- return { success: false, error: 'Only the current claimant can request handoff' };
212
- }
213
- const now = new Date().toISOString();
214
- claim.status = 'handoff-pending';
215
- claim.statusChangedAt = now;
216
- claim.handoffTo = to;
217
- claim.handoffReason = reason;
218
- claim.progress = progress;
219
- store.claims[issueId] = claim;
220
- saveClaims(store);
221
- return {
222
- success: true,
223
- claim,
224
- message: `Handoff requested from ${formatClaimant(from)} to ${formatClaimant(to)}`,
225
- };
245
+ required: ['issueId', 'from', 'to']
226
246
  },
247
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
248
+ var issueId, fromStr, toStr, reason, progress, from, to, store, claim, now;
249
+ return __generator(this, function (_a) {
250
+ issueId = input.issueId;
251
+ fromStr = input.from;
252
+ toStr = input.to;
253
+ reason = input.reason;
254
+ progress = input.progress || 0;
255
+ from = parseClaimant(fromStr);
256
+ to = parseClaimant(toStr);
257
+ if (!from || !to) {
258
+ return [2 /*return*/, { success: false, error: 'Invalid claimant format' }];
259
+ }
260
+ store = loadClaims();
261
+ claim = store.claims[issueId];
262
+ if (!claim) {
263
+ return [2 /*return*/, { success: false, error: 'Issue is not claimed' }];
264
+ }
265
+ if (formatClaimant(claim.claimant) !== formatClaimant(from)) {
266
+ return [2 /*return*/, { success: false, error: 'Only the current claimant can request handoff' }];
267
+ }
268
+ now = new Date().toISOString();
269
+ claim.status = 'handoff-pending';
270
+ claim.statusChangedAt = now;
271
+ claim.handoffTo = to;
272
+ claim.handoffReason = reason;
273
+ claim.progress = progress;
274
+ store.claims[issueId] = claim;
275
+ saveClaims(store);
276
+ return [2 /*return*/, {
277
+ success: true,
278
+ claim: claim,
279
+ message: "Handoff requested from " + formatClaimant(from) + " to " + formatClaimant(to)
280
+ }];
281
+ });
282
+ }); }
227
283
  },
228
284
  {
229
285
  name: 'claims_accept-handoff',
@@ -234,49 +290,52 @@ export const claimsTools = [
234
290
  properties: {
235
291
  issueId: {
236
292
  type: 'string',
237
- description: 'Issue ID with pending handoff',
293
+ description: 'Issue ID with pending handoff'
238
294
  },
239
295
  claimant: {
240
296
  type: 'string',
241
- description: 'Claimant accepting the handoff',
242
- },
297
+ description: 'Claimant accepting the handoff'
298
+ }
243
299
  },
244
- required: ['issueId', 'claimant'],
245
- },
246
- handler: async (input) => {
247
- const issueId = input.issueId;
248
- const claimantStr = input.claimant;
249
- const claimant = parseClaimant(claimantStr);
250
- if (!claimant) {
251
- return { success: false, error: 'Invalid claimant format' };
252
- }
253
- const store = loadClaims();
254
- const claim = store.claims[issueId];
255
- if (!claim) {
256
- return { success: false, error: 'Issue is not claimed' };
257
- }
258
- if (claim.status !== 'handoff-pending') {
259
- return { success: false, error: 'No pending handoff for this issue' };
260
- }
261
- if (!claim.handoffTo || formatClaimant(claim.handoffTo) !== formatClaimant(claimant)) {
262
- return { success: false, error: 'You are not the target of this handoff' };
263
- }
264
- const previousOwner = claim.claimant;
265
- const now = new Date().toISOString();
266
- claim.claimant = claimant;
267
- claim.status = 'active';
268
- claim.statusChangedAt = now;
269
- claim.handoffTo = undefined;
270
- claim.handoffReason = undefined;
271
- store.claims[issueId] = claim;
272
- saveClaims(store);
273
- return {
274
- success: true,
275
- claim,
276
- previousOwner,
277
- message: `Handoff accepted. ${formatClaimant(claimant)} now owns issue ${issueId}`,
278
- };
300
+ required: ['issueId', 'claimant']
279
301
  },
302
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
303
+ var issueId, claimantStr, claimant, store, claim, previousOwner, now;
304
+ return __generator(this, function (_a) {
305
+ issueId = input.issueId;
306
+ claimantStr = input.claimant;
307
+ claimant = parseClaimant(claimantStr);
308
+ if (!claimant) {
309
+ return [2 /*return*/, { success: false, error: 'Invalid claimant format' }];
310
+ }
311
+ store = loadClaims();
312
+ claim = store.claims[issueId];
313
+ if (!claim) {
314
+ return [2 /*return*/, { success: false, error: 'Issue is not claimed' }];
315
+ }
316
+ if (claim.status !== 'handoff-pending') {
317
+ return [2 /*return*/, { success: false, error: 'No pending handoff for this issue' }];
318
+ }
319
+ if (!claim.handoffTo || formatClaimant(claim.handoffTo) !== formatClaimant(claimant)) {
320
+ return [2 /*return*/, { success: false, error: 'You are not the target of this handoff' }];
321
+ }
322
+ previousOwner = claim.claimant;
323
+ now = new Date().toISOString();
324
+ claim.claimant = claimant;
325
+ claim.status = 'active';
326
+ claim.statusChangedAt = now;
327
+ claim.handoffTo = undefined;
328
+ claim.handoffReason = undefined;
329
+ store.claims[issueId] = claim;
330
+ saveClaims(store);
331
+ return [2 /*return*/, {
332
+ success: true,
333
+ claim: claim,
334
+ previousOwner: previousOwner,
335
+ message: "Handoff accepted. " + formatClaimant(claimant) + " now owns issue " + issueId
336
+ }];
337
+ });
338
+ }); }
280
339
  },
281
340
  {
282
341
  name: 'claims_status',
@@ -287,51 +346,54 @@ export const claimsTools = [
287
346
  properties: {
288
347
  issueId: {
289
348
  type: 'string',
290
- description: 'Issue ID',
349
+ description: 'Issue ID'
291
350
  },
292
351
  status: {
293
352
  type: 'string',
294
353
  description: 'New status',
295
- enum: ['active', 'paused', 'blocked', 'review-requested', 'completed'],
354
+ "enum": ['active', 'paused', 'blocked', 'review-requested', 'completed']
296
355
  },
297
356
  note: {
298
357
  type: 'string',
299
- description: 'Status note or reason',
358
+ description: 'Status note or reason'
300
359
  },
301
360
  progress: {
302
361
  type: 'number',
303
- description: 'Current progress percentage',
304
- },
362
+ description: 'Current progress percentage'
363
+ }
305
364
  },
306
- required: ['issueId', 'status'],
307
- },
308
- handler: async (input) => {
309
- const issueId = input.issueId;
310
- const status = input.status;
311
- const note = input.note;
312
- const progress = input.progress;
313
- const store = loadClaims();
314
- const claim = store.claims[issueId];
315
- if (!claim) {
316
- return { success: false, error: 'Issue is not claimed' };
317
- }
318
- const now = new Date().toISOString();
319
- claim.status = status;
320
- claim.statusChangedAt = now;
321
- if (status === 'blocked') {
322
- claim.blockReason = note;
323
- }
324
- if (progress !== undefined) {
325
- claim.progress = Math.min(100, Math.max(0, progress));
326
- }
327
- store.claims[issueId] = claim;
328
- saveClaims(store);
329
- return {
330
- success: true,
331
- claim,
332
- message: `Issue ${issueId} status updated to ${status}`,
333
- };
365
+ required: ['issueId', 'status']
334
366
  },
367
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
368
+ var issueId, status, note, progress, store, claim, now;
369
+ return __generator(this, function (_a) {
370
+ issueId = input.issueId;
371
+ status = input.status;
372
+ note = input.note;
373
+ progress = input.progress;
374
+ store = loadClaims();
375
+ claim = store.claims[issueId];
376
+ if (!claim) {
377
+ return [2 /*return*/, { success: false, error: 'Issue is not claimed' }];
378
+ }
379
+ now = new Date().toISOString();
380
+ claim.status = status;
381
+ claim.statusChangedAt = now;
382
+ if (status === 'blocked') {
383
+ claim.blockReason = note;
384
+ }
385
+ if (progress !== undefined) {
386
+ claim.progress = Math.min(100, Math.max(0, progress));
387
+ }
388
+ store.claims[issueId] = claim;
389
+ saveClaims(store);
390
+ return [2 /*return*/, {
391
+ success: true,
392
+ claim: claim,
393
+ message: "Issue " + issueId + " status updated to " + status
394
+ }];
395
+ });
396
+ }); }
335
397
  },
336
398
  {
337
399
  name: 'claims_list',
@@ -343,40 +405,45 @@ export const claimsTools = [
343
405
  status: {
344
406
  type: 'string',
345
407
  description: 'Filter by status',
346
- enum: ['active', 'paused', 'blocked', 'stealable', 'completed', 'all'],
408
+ "enum": ['active', 'paused', 'blocked', 'stealable', 'completed', 'all']
347
409
  },
348
410
  claimant: {
349
411
  type: 'string',
350
- description: 'Filter by claimant',
412
+ description: 'Filter by claimant'
351
413
  },
352
414
  agentType: {
353
415
  type: 'string',
354
- description: 'Filter by agent type',
355
- },
356
- },
357
- },
358
- handler: async (input) => {
359
- const status = input.status;
360
- const claimantFilter = input.claimant;
361
- const agentType = input.agentType;
362
- const store = loadClaims();
363
- let claims = Object.values(store.claims);
364
- if (status && status !== 'all') {
365
- claims = claims.filter(c => c.status === status);
366
- }
367
- if (claimantFilter) {
368
- claims = claims.filter(c => formatClaimant(c.claimant).includes(claimantFilter));
369
- }
370
- if (agentType) {
371
- claims = claims.filter(c => c.claimant.type === 'agent' && c.claimant.agentType === agentType);
416
+ description: 'Filter by agent type'
417
+ }
372
418
  }
373
- return {
374
- success: true,
375
- claims,
376
- count: claims.length,
377
- stealableCount: Object.keys(store.stealable).length,
378
- };
379
419
  },
420
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
421
+ var status, claimantFilter, agentType, store, claims;
422
+ return __generator(this, function (_a) {
423
+ status = input.status;
424
+ claimantFilter = input.claimant;
425
+ agentType = input.agentType;
426
+ store = loadClaims();
427
+ claims = Object.values(store.claims);
428
+ if (status && status !== 'all') {
429
+ claims = claims.filter(function (c) { return c.status === status; });
430
+ }
431
+ if (claimantFilter) {
432
+ claims = claims.filter(function (c) { return formatClaimant(c.claimant).includes(claimantFilter); });
433
+ }
434
+ if (agentType) {
435
+ claims = claims.filter(function (c) {
436
+ return c.claimant.type === 'agent' && c.claimant.agentType === agentType;
437
+ });
438
+ }
439
+ return [2 /*return*/, {
440
+ success: true,
441
+ claims: claims,
442
+ count: claims.length,
443
+ stealableCount: Object.keys(store.stealable).length
444
+ }];
445
+ });
446
+ }); }
380
447
  },
381
448
  {
382
449
  name: 'claims_mark-stealable',
@@ -387,54 +454,57 @@ export const claimsTools = [
387
454
  properties: {
388
455
  issueId: {
389
456
  type: 'string',
390
- description: 'Issue ID to mark stealable',
457
+ description: 'Issue ID to mark stealable'
391
458
  },
392
459
  reason: {
393
460
  type: 'string',
394
461
  description: 'Reason for marking stealable',
395
- enum: ['overloaded', 'stale', 'blocked-timeout', 'voluntary'],
462
+ "enum": ['overloaded', 'stale', 'blocked-timeout', 'voluntary']
396
463
  },
397
464
  preferredTypes: {
398
465
  type: 'array',
399
466
  description: 'Preferred agent types to steal',
400
- items: { type: 'string' },
467
+ items: { type: 'string' }
401
468
  },
402
469
  context: {
403
470
  type: 'string',
404
- description: 'Handoff context for the stealer',
405
- },
471
+ description: 'Handoff context for the stealer'
472
+ }
406
473
  },
407
- required: ['issueId', 'reason'],
408
- },
409
- handler: async (input) => {
410
- const issueId = input.issueId;
411
- const reason = input.reason;
412
- const preferredTypes = input.preferredTypes;
413
- const context = input.context;
414
- const store = loadClaims();
415
- const claim = store.claims[issueId];
416
- if (!claim) {
417
- return { success: false, error: 'Issue is not claimed' };
418
- }
419
- const now = new Date().toISOString();
420
- claim.status = 'stealable';
421
- claim.statusChangedAt = now;
422
- store.stealable[issueId] = {
423
- reason,
424
- stealableAt: now,
425
- preferredTypes,
426
- progress: claim.progress,
427
- context,
428
- };
429
- store.claims[issueId] = claim;
430
- saveClaims(store);
431
- return {
432
- success: true,
433
- claim,
434
- stealableInfo: store.stealable[issueId],
435
- message: `Issue ${issueId} marked as stealable (${reason})`,
436
- };
474
+ required: ['issueId', 'reason']
437
475
  },
476
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
477
+ var issueId, reason, preferredTypes, context, store, claim, now;
478
+ return __generator(this, function (_a) {
479
+ issueId = input.issueId;
480
+ reason = input.reason;
481
+ preferredTypes = input.preferredTypes;
482
+ context = input.context;
483
+ store = loadClaims();
484
+ claim = store.claims[issueId];
485
+ if (!claim) {
486
+ return [2 /*return*/, { success: false, error: 'Issue is not claimed' }];
487
+ }
488
+ now = new Date().toISOString();
489
+ claim.status = 'stealable';
490
+ claim.statusChangedAt = now;
491
+ store.stealable[issueId] = {
492
+ reason: reason,
493
+ stealableAt: now,
494
+ preferredTypes: preferredTypes,
495
+ progress: claim.progress,
496
+ context: context
497
+ };
498
+ store.claims[issueId] = claim;
499
+ saveClaims(store);
500
+ return [2 /*return*/, {
501
+ success: true,
502
+ claim: claim,
503
+ stealableInfo: store.stealable[issueId],
504
+ message: "Issue " + issueId + " marked as stealable (" + reason + ")"
505
+ }];
506
+ });
507
+ }); }
438
508
  },
439
509
  {
440
510
  name: 'claims_steal',
@@ -445,57 +515,60 @@ export const claimsTools = [
445
515
  properties: {
446
516
  issueId: {
447
517
  type: 'string',
448
- description: 'Issue ID to steal',
518
+ description: 'Issue ID to steal'
449
519
  },
450
520
  stealer: {
451
521
  type: 'string',
452
- description: 'Claimant stealing the issue',
453
- },
522
+ description: 'Claimant stealing the issue'
523
+ }
454
524
  },
455
- required: ['issueId', 'stealer'],
525
+ required: ['issueId', 'stealer']
456
526
  },
457
- handler: async (input) => {
458
- const issueId = input.issueId;
459
- const stealerStr = input.stealer;
460
- const stealer = parseClaimant(stealerStr);
461
- if (!stealer) {
462
- return { success: false, error: 'Invalid claimant format' };
463
- }
464
- const store = loadClaims();
465
- const claim = store.claims[issueId];
466
- const stealableInfo = store.stealable[issueId];
467
- if (!claim) {
468
- return { success: false, error: 'Issue is not claimed' };
469
- }
470
- if (!stealableInfo) {
471
- return { success: false, error: 'Issue is not stealable' };
472
- }
473
- // Check preferred types
474
- if (stealableInfo.preferredTypes && stealableInfo.preferredTypes.length > 0) {
475
- if (stealer.type === 'agent' && !stealableInfo.preferredTypes.includes(stealer.agentType)) {
476
- return {
477
- success: false,
478
- error: `Issue prefers agent types: ${stealableInfo.preferredTypes.join(', ')}`,
479
- };
527
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
528
+ var issueId, stealerStr, stealer, store, claim, stealableInfo, previousOwner, now;
529
+ return __generator(this, function (_a) {
530
+ issueId = input.issueId;
531
+ stealerStr = input.stealer;
532
+ stealer = parseClaimant(stealerStr);
533
+ if (!stealer) {
534
+ return [2 /*return*/, { success: false, error: 'Invalid claimant format' }];
480
535
  }
481
- }
482
- const previousOwner = claim.claimant;
483
- const now = new Date().toISOString();
484
- claim.claimant = stealer;
485
- claim.status = 'active';
486
- claim.statusChangedAt = now;
487
- claim.context = stealableInfo.context;
488
- delete store.stealable[issueId];
489
- store.claims[issueId] = claim;
490
- saveClaims(store);
491
- return {
492
- success: true,
493
- claim,
494
- previousOwner,
495
- stealableInfo,
496
- message: `Issue ${issueId} stolen by ${formatClaimant(stealer)}`,
497
- };
498
- },
536
+ store = loadClaims();
537
+ claim = store.claims[issueId];
538
+ stealableInfo = store.stealable[issueId];
539
+ if (!claim) {
540
+ return [2 /*return*/, { success: false, error: 'Issue is not claimed' }];
541
+ }
542
+ if (!stealableInfo) {
543
+ return [2 /*return*/, { success: false, error: 'Issue is not stealable' }];
544
+ }
545
+ // Check preferred types
546
+ if (stealableInfo.preferredTypes && stealableInfo.preferredTypes.length > 0) {
547
+ if (stealer.type === 'agent' && !stealableInfo.preferredTypes.includes(stealer.agentType)) {
548
+ return [2 /*return*/, {
549
+ success: false,
550
+ error: "Issue prefers agent types: " + stealableInfo.preferredTypes.join(', ')
551
+ }];
552
+ }
553
+ }
554
+ previousOwner = claim.claimant;
555
+ now = new Date().toISOString();
556
+ claim.claimant = stealer;
557
+ claim.status = 'active';
558
+ claim.statusChangedAt = now;
559
+ claim.context = stealableInfo.context;
560
+ delete store.stealable[issueId];
561
+ store.claims[issueId] = claim;
562
+ saveClaims(store);
563
+ return [2 /*return*/, {
564
+ success: true,
565
+ claim: claim,
566
+ previousOwner: previousOwner,
567
+ stealableInfo: stealableInfo,
568
+ message: "Issue " + issueId + " stolen by " + formatClaimant(stealer)
569
+ }];
570
+ });
571
+ }); }
499
572
  },
500
573
  {
501
574
  name: 'claims_stealable',
@@ -506,27 +579,31 @@ export const claimsTools = [
506
579
  properties: {
507
580
  agentType: {
508
581
  type: 'string',
509
- description: 'Filter by preferred agent type',
510
- },
511
- },
512
- },
513
- handler: async (input) => {
514
- const agentType = input.agentType;
515
- const store = loadClaims();
516
- let stealableIssues = Object.entries(store.stealable).map(([issueId, info]) => ({
517
- issueId,
518
- ...info,
519
- claim: store.claims[issueId],
520
- }));
521
- if (agentType) {
522
- stealableIssues = stealableIssues.filter(s => !s.preferredTypes || s.preferredTypes.length === 0 || s.preferredTypes.includes(agentType));
582
+ description: 'Filter by preferred agent type'
583
+ }
523
584
  }
524
- return {
525
- success: true,
526
- stealable: stealableIssues,
527
- count: stealableIssues.length,
528
- };
529
585
  },
586
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
587
+ var agentType, store, stealableIssues;
588
+ return __generator(this, function (_a) {
589
+ agentType = input.agentType;
590
+ store = loadClaims();
591
+ stealableIssues = Object.entries(store.stealable).map(function (_a) {
592
+ var issueId = _a[0], info = _a[1];
593
+ return (__assign(__assign({ issueId: issueId }, info), { claim: store.claims[issueId] }));
594
+ });
595
+ if (agentType) {
596
+ stealableIssues = stealableIssues.filter(function (s) {
597
+ return !s.preferredTypes || s.preferredTypes.length === 0 || s.preferredTypes.includes(agentType);
598
+ });
599
+ }
600
+ return [2 /*return*/, {
601
+ success: true,
602
+ stealable: stealableIssues,
603
+ count: stealableIssues.length
604
+ }];
605
+ });
606
+ }); }
530
607
  },
531
608
  {
532
609
  name: 'claims_load',
@@ -537,69 +614,72 @@ export const claimsTools = [
537
614
  properties: {
538
615
  agentId: {
539
616
  type: 'string',
540
- description: 'Specific agent ID (optional)',
617
+ description: 'Specific agent ID (optional)'
541
618
  },
542
619
  agentType: {
543
620
  type: 'string',
544
- description: 'Filter by agent type',
545
- },
546
- },
547
- },
548
- handler: async (input) => {
549
- const agentId = input.agentId;
550
- const agentType = input.agentType;
551
- const store = loadClaims();
552
- const claims = Object.values(store.claims);
553
- // Group claims by agent
554
- const agentLoads = new Map();
555
- for (const claim of claims) {
556
- if (claim.claimant.type !== 'agent')
557
- continue;
558
- const key = claim.claimant.agentId;
559
- if (!agentLoads.has(key)) {
560
- agentLoads.set(key, {
561
- agentId: key,
562
- agentType: claim.claimant.agentType,
563
- claims: [],
564
- blockedCount: 0,
565
- });
566
- }
567
- const load = agentLoads.get(key);
568
- load.claims.push(claim);
569
- if (claim.status === 'blocked') {
570
- load.blockedCount++;
621
+ description: 'Filter by agent type'
571
622
  }
572
623
  }
573
- let loads = Array.from(agentLoads.values());
574
- if (agentId) {
575
- loads = loads.filter(l => l.agentId === agentId);
576
- }
577
- if (agentType) {
578
- loads = loads.filter(l => l.agentType === agentType);
579
- }
580
- const result = loads.map(l => ({
581
- agentId: l.agentId,
582
- agentType: l.agentType,
583
- claimCount: l.claims.length,
584
- maxClaims: 5, // Default max
585
- utilization: l.claims.length / 5,
586
- blockedCount: l.blockedCount,
587
- claims: l.claims.map(c => ({
588
- issueId: c.issueId,
589
- status: c.status,
590
- progress: c.progress,
591
- })),
592
- }));
593
- return {
594
- success: true,
595
- loads: result,
596
- totalAgents: result.length,
597
- totalClaims: claims.filter(c => c.claimant.type === 'agent').length,
598
- avgUtilization: result.length > 0
599
- ? result.reduce((sum, l) => sum + l.utilization, 0) / result.length
600
- : 0,
601
- };
602
624
  },
625
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
626
+ var agentId, agentType, store, claims, agentLoads, _i, claims_1, claim, key, load, loads, result;
627
+ return __generator(this, function (_a) {
628
+ agentId = input.agentId;
629
+ agentType = input.agentType;
630
+ store = loadClaims();
631
+ claims = Object.values(store.claims);
632
+ agentLoads = new Map();
633
+ for (_i = 0, claims_1 = claims; _i < claims_1.length; _i++) {
634
+ claim = claims_1[_i];
635
+ if (claim.claimant.type !== 'agent')
636
+ continue;
637
+ key = claim.claimant.agentId;
638
+ if (!agentLoads.has(key)) {
639
+ agentLoads.set(key, {
640
+ agentId: key,
641
+ agentType: claim.claimant.agentType,
642
+ claims: [],
643
+ blockedCount: 0
644
+ });
645
+ }
646
+ load = agentLoads.get(key);
647
+ load.claims.push(claim);
648
+ if (claim.status === 'blocked') {
649
+ load.blockedCount++;
650
+ }
651
+ }
652
+ loads = Array.from(agentLoads.values());
653
+ if (agentId) {
654
+ loads = loads.filter(function (l) { return l.agentId === agentId; });
655
+ }
656
+ if (agentType) {
657
+ loads = loads.filter(function (l) { return l.agentType === agentType; });
658
+ }
659
+ result = loads.map(function (l) { return ({
660
+ agentId: l.agentId,
661
+ agentType: l.agentType,
662
+ claimCount: l.claims.length,
663
+ maxClaims: 5,
664
+ utilization: l.claims.length / 5,
665
+ blockedCount: l.blockedCount,
666
+ claims: l.claims.map(function (c) { return ({
667
+ issueId: c.issueId,
668
+ status: c.status,
669
+ progress: c.progress
670
+ }); })
671
+ }); });
672
+ return [2 /*return*/, {
673
+ success: true,
674
+ loads: result,
675
+ totalAgents: result.length,
676
+ totalClaims: claims.filter(function (c) { return c.claimant.type === 'agent'; }).length,
677
+ avgUtilization: result.length > 0
678
+ ? result.reduce(function (sum, l) { return sum + l.utilization; }, 0) / result.length
679
+ : 0
680
+ }];
681
+ });
682
+ }); }
603
683
  },
604
684
  {
605
685
  name: 'claims_board',
@@ -607,48 +687,52 @@ export const claimsTools = [
607
687
  category: 'claims',
608
688
  inputSchema: {
609
689
  type: 'object',
610
- properties: {},
690
+ properties: {}
611
691
  },
612
- handler: async () => {
613
- const store = loadClaims();
614
- const claims = Object.values(store.claims);
615
- const byStatus = {
616
- active: [],
617
- paused: [],
618
- blocked: [],
619
- 'handoff-pending': [],
620
- 'review-requested': [],
621
- stealable: [],
622
- completed: [],
623
- };
624
- for (const claim of claims) {
625
- if (byStatus[claim.status]) {
626
- byStatus[claim.status].push(claim);
692
+ handler: function () { return __awaiter(void 0, void 0, void 0, function () {
693
+ var store, claims, byStatus, _i, claims_2, claim, humanClaims, agentClaims;
694
+ return __generator(this, function (_a) {
695
+ store = loadClaims();
696
+ claims = Object.values(store.claims);
697
+ byStatus = {
698
+ active: [],
699
+ paused: [],
700
+ blocked: [],
701
+ 'handoff-pending': [],
702
+ 'review-requested': [],
703
+ stealable: [],
704
+ completed: []
705
+ };
706
+ for (_i = 0, claims_2 = claims; _i < claims_2.length; _i++) {
707
+ claim = claims_2[_i];
708
+ if (byStatus[claim.status]) {
709
+ byStatus[claim.status].push(claim);
710
+ }
627
711
  }
628
- }
629
- const humanClaims = claims.filter(c => c.claimant.type === 'human');
630
- const agentClaims = claims.filter(c => c.claimant.type === 'agent');
631
- return {
632
- success: true,
633
- board: {
634
- active: byStatus.active.map(c => ({ issueId: c.issueId, claimant: formatClaimant(c.claimant), progress: c.progress })),
635
- paused: byStatus.paused.map(c => ({ issueId: c.issueId, claimant: formatClaimant(c.claimant) })),
636
- blocked: byStatus.blocked.map(c => ({ issueId: c.issueId, claimant: formatClaimant(c.claimant), reason: c.blockReason })),
637
- 'handoff-pending': byStatus['handoff-pending'].map(c => ({ issueId: c.issueId, from: formatClaimant(c.claimant), to: c.handoffTo ? formatClaimant(c.handoffTo) : null })),
638
- 'review-requested': byStatus['review-requested'].map(c => ({ issueId: c.issueId, claimant: formatClaimant(c.claimant) })),
639
- stealable: byStatus.stealable.map(c => ({ issueId: c.issueId, claimant: formatClaimant(c.claimant) })),
640
- completed: byStatus.completed.map(c => ({ issueId: c.issueId, claimant: formatClaimant(c.claimant) })),
641
- },
642
- summary: {
643
- total: claims.length,
644
- active: byStatus.active.length,
645
- blocked: byStatus.blocked.length,
646
- stealable: byStatus.stealable.length,
647
- humanClaims: humanClaims.length,
648
- agentClaims: agentClaims.length,
649
- },
650
- };
651
- },
712
+ humanClaims = claims.filter(function (c) { return c.claimant.type === 'human'; });
713
+ agentClaims = claims.filter(function (c) { return c.claimant.type === 'agent'; });
714
+ return [2 /*return*/, {
715
+ success: true,
716
+ board: {
717
+ active: byStatus.active.map(function (c) { return ({ issueId: c.issueId, claimant: formatClaimant(c.claimant), progress: c.progress }); }),
718
+ paused: byStatus.paused.map(function (c) { return ({ issueId: c.issueId, claimant: formatClaimant(c.claimant) }); }),
719
+ blocked: byStatus.blocked.map(function (c) { return ({ issueId: c.issueId, claimant: formatClaimant(c.claimant), reason: c.blockReason }); }),
720
+ 'handoff-pending': byStatus['handoff-pending'].map(function (c) { return ({ issueId: c.issueId, from: formatClaimant(c.claimant), to: c.handoffTo ? formatClaimant(c.handoffTo) : null }); }),
721
+ 'review-requested': byStatus['review-requested'].map(function (c) { return ({ issueId: c.issueId, claimant: formatClaimant(c.claimant) }); }),
722
+ stealable: byStatus.stealable.map(function (c) { return ({ issueId: c.issueId, claimant: formatClaimant(c.claimant) }); }),
723
+ completed: byStatus.completed.map(function (c) { return ({ issueId: c.issueId, claimant: formatClaimant(c.claimant) }); })
724
+ },
725
+ summary: {
726
+ total: claims.length,
727
+ active: byStatus.active.length,
728
+ blocked: byStatus.blocked.length,
729
+ stealable: byStatus.stealable.length,
730
+ humanClaims: humanClaims.length,
731
+ agentClaims: agentClaims.length
732
+ }
733
+ }];
734
+ });
735
+ }); }
652
736
  },
653
737
  {
654
738
  name: 'claims_rebalance',
@@ -660,72 +744,80 @@ export const claimsTools = [
660
744
  dryRun: {
661
745
  type: 'boolean',
662
746
  description: 'Preview rebalancing without applying',
663
- default: true,
747
+ "default": true
664
748
  },
665
749
  targetUtilization: {
666
750
  type: 'number',
667
751
  description: 'Target utilization (0-1)',
668
- default: 0.7,
669
- },
670
- },
671
- },
672
- handler: async (input) => {
673
- const dryRun = input.dryRun !== false;
674
- const targetUtilization = input.targetUtilization || 0.7;
675
- const store = loadClaims();
676
- const claims = Object.values(store.claims);
677
- // Group by agent
678
- const agentLoads = new Map();
679
- for (const claim of claims) {
680
- if (claim.claimant.type !== 'agent')
681
- continue;
682
- const key = claim.claimant.agentId;
683
- if (!agentLoads.has(key)) {
684
- agentLoads.set(key, { agentId: key, agentType: claim.claimant.agentType, claims: [] });
685
- }
686
- agentLoads.get(key).claims.push(claim);
687
- }
688
- const loads = Array.from(agentLoads.values());
689
- const maxClaims = 5;
690
- const avgLoad = loads.length > 0
691
- ? loads.reduce((sum, l) => sum + l.claims.length, 0) / loads.length
692
- : 0;
693
- const overloaded = loads.filter(l => l.claims.length > maxClaims * targetUtilization * 1.5);
694
- const underloaded = loads.filter(l => l.claims.length < maxClaims * targetUtilization * 0.5);
695
- const suggestions = [];
696
- for (const over of overloaded) {
697
- // Find low-progress claims to redistribute
698
- const movable = over.claims
699
- .filter(c => c.progress < 25 && c.status === 'active')
700
- .slice(0, over.claims.length - Math.ceil(maxClaims * targetUtilization));
701
- for (const claim of movable) {
702
- const target = underloaded.find(u => u.agentType === over.agentType && u.claims.length < maxClaims);
703
- if (target) {
704
- suggestions.push({
705
- issueId: claim.issueId,
706
- from: `agent:${over.agentId}:${over.agentType}`,
707
- to: `agent:${target.agentId}:${target.agentType}`,
708
- reason: 'Load balancing',
709
- });
710
- }
752
+ "default": 0.7
711
753
  }
712
754
  }
713
- return {
714
- success: true,
715
- dryRun,
716
- suggestions,
717
- metrics: {
718
- totalAgents: loads.length,
719
- avgLoad,
720
- overloadedCount: overloaded.length,
721
- underloadedCount: underloaded.length,
722
- targetUtilization,
723
- },
724
- message: dryRun
725
- ? `Found ${suggestions.length} rebalancing opportunities (dry run)`
726
- : `Applied ${suggestions.length} rebalancing moves`,
727
- };
728
755
  },
756
+ handler: function (input) { return __awaiter(void 0, void 0, void 0, function () {
757
+ var dryRun, targetUtilization, store, claims, agentLoads, _i, claims_3, claim, key, loads, maxClaims, avgLoad, overloaded, underloaded, suggestions, _loop_1, _a, overloaded_1, over;
758
+ return __generator(this, function (_b) {
759
+ dryRun = input.dryRun !== false;
760
+ targetUtilization = input.targetUtilization || 0.7;
761
+ store = loadClaims();
762
+ claims = Object.values(store.claims);
763
+ agentLoads = new Map();
764
+ for (_i = 0, claims_3 = claims; _i < claims_3.length; _i++) {
765
+ claim = claims_3[_i];
766
+ if (claim.claimant.type !== 'agent')
767
+ continue;
768
+ key = claim.claimant.agentId;
769
+ if (!agentLoads.has(key)) {
770
+ agentLoads.set(key, { agentId: key, agentType: claim.claimant.agentType, claims: [] });
771
+ }
772
+ agentLoads.get(key).claims.push(claim);
773
+ }
774
+ loads = Array.from(agentLoads.values());
775
+ maxClaims = 5;
776
+ avgLoad = loads.length > 0
777
+ ? loads.reduce(function (sum, l) { return sum + l.claims.length; }, 0) / loads.length
778
+ : 0;
779
+ overloaded = loads.filter(function (l) { return l.claims.length > maxClaims * targetUtilization * 1.5; });
780
+ underloaded = loads.filter(function (l) { return l.claims.length < maxClaims * targetUtilization * 0.5; });
781
+ suggestions = [];
782
+ _loop_1 = function (over) {
783
+ // Find low-progress claims to redistribute
784
+ var movable = over.claims
785
+ .filter(function (c) { return c.progress < 25 && c.status === 'active'; })
786
+ .slice(0, over.claims.length - Math.ceil(maxClaims * targetUtilization));
787
+ for (var _c = 0, movable_1 = movable; _c < movable_1.length; _c++) {
788
+ var claim = movable_1[_c];
789
+ var target = underloaded.find(function (u) { return u.agentType === over.agentType && u.claims.length < maxClaims; });
790
+ if (target) {
791
+ suggestions.push({
792
+ issueId: claim.issueId,
793
+ from: "agent:" + over.agentId + ":" + over.agentType,
794
+ to: "agent:" + target.agentId + ":" + target.agentType,
795
+ reason: 'Load balancing'
796
+ });
797
+ }
798
+ }
799
+ };
800
+ for (_a = 0, overloaded_1 = overloaded; _a < overloaded_1.length; _a++) {
801
+ over = overloaded_1[_a];
802
+ _loop_1(over);
803
+ }
804
+ return [2 /*return*/, {
805
+ success: true,
806
+ dryRun: dryRun,
807
+ suggestions: suggestions,
808
+ metrics: {
809
+ totalAgents: loads.length,
810
+ avgLoad: avgLoad,
811
+ overloadedCount: overloaded.length,
812
+ underloadedCount: underloaded.length,
813
+ targetUtilization: targetUtilization
814
+ },
815
+ message: dryRun
816
+ ? "Found " + suggestions.length + " rebalancing opportunities (dry run)"
817
+ : "Applied " + suggestions.length + " rebalancing moves"
818
+ }];
819
+ });
820
+ }); }
729
821
  },
730
822
  ];
731
823
  export default claimsTools;