@0xmaxma/claude-gateway 1.8.13 → 2.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 (594) hide show
  1. package/README.md +28 -1605
  2. package/config.template.json +7 -1
  3. package/dist/agent/runner.d.ts +394 -0
  4. package/dist/agent/runner.d.ts.map +1 -1
  5. package/dist/agent/runner.js +867 -38
  6. package/dist/agent/runner.js.map +1 -1
  7. package/dist/agent/skill-learning/index.d.ts +6 -4
  8. package/dist/agent/skill-learning/index.d.ts.map +1 -1
  9. package/dist/agent/skill-learning/index.js +3 -3
  10. package/dist/agent/skill-learning/index.js.map +1 -1
  11. package/dist/agent/skill-learning/notifier.d.ts +3 -4
  12. package/dist/agent/skill-learning/notifier.d.ts.map +1 -1
  13. package/dist/agent/skill-learning/notifier.js +15 -13
  14. package/dist/agent/skill-learning/notifier.js.map +1 -1
  15. package/dist/agent/skill-learning/reviewer.d.ts.map +1 -1
  16. package/dist/agent/skill-learning/reviewer.js +3 -1
  17. package/dist/agent/skill-learning/reviewer.js.map +1 -1
  18. package/dist/api/connectors-router.d.ts.map +1 -1
  19. package/dist/api/connectors-router.js +110 -4
  20. package/dist/api/connectors-router.js.map +1 -1
  21. package/dist/api/gateway-router.d.ts +1 -0
  22. package/dist/api/gateway-router.d.ts.map +1 -1
  23. package/dist/api/gateway-router.js +13 -1
  24. package/dist/api/gateway-router.js.map +1 -1
  25. package/dist/api/line-webhook-router.d.ts +2 -2
  26. package/dist/api/line-webhook-router.d.ts.map +1 -1
  27. package/dist/api/line-webhook-router.js +264 -230
  28. package/dist/api/line-webhook-router.js.map +1 -1
  29. package/dist/api/router.d.ts.map +1 -1
  30. package/dist/api/router.js +372 -11
  31. package/dist/api/router.js.map +1 -1
  32. package/dist/api/share-router.d.ts.map +1 -1
  33. package/dist/api/share-router.js +29 -10
  34. package/dist/api/share-router.js.map +1 -1
  35. package/dist/api/slack-client.d.ts +2 -0
  36. package/dist/api/slack-client.d.ts.map +1 -1
  37. package/dist/api/slack-client.js +6 -2
  38. package/dist/api/slack-client.js.map +1 -1
  39. package/dist/api/slack-webhook-router.d.ts +3 -0
  40. package/dist/api/slack-webhook-router.d.ts.map +1 -1
  41. package/dist/api/slack-webhook-router.js +226 -131
  42. package/dist/api/slack-webhook-router.js.map +1 -1
  43. package/dist/api/voice-router.d.ts +21 -0
  44. package/dist/api/voice-router.d.ts.map +1 -0
  45. package/dist/api/voice-router.js +372 -0
  46. package/dist/api/voice-router.js.map +1 -0
  47. package/dist/api/voice-settings-router.d.ts +5 -0
  48. package/dist/api/voice-settings-router.d.ts.map +1 -0
  49. package/dist/api/voice-settings-router.js +318 -0
  50. package/dist/api/voice-settings-router.js.map +1 -0
  51. package/dist/api/wechat-access.d.ts +45 -0
  52. package/dist/api/wechat-access.d.ts.map +1 -0
  53. package/dist/api/wechat-access.js +48 -0
  54. package/dist/api/wechat-access.js.map +1 -0
  55. package/dist/apps/agent-container-migration.d.ts +11 -0
  56. package/dist/apps/agent-container-migration.d.ts.map +1 -0
  57. package/dist/apps/agent-container-migration.js +85 -0
  58. package/dist/apps/agent-container-migration.js.map +1 -0
  59. package/dist/apps/installer.d.ts +1 -1
  60. package/dist/apps/installer.d.ts.map +1 -1
  61. package/dist/apps/installer.js +2 -1
  62. package/dist/apps/installer.js.map +1 -1
  63. package/dist/cli/commands/tasks.d.ts +5 -0
  64. package/dist/cli/commands/tasks.d.ts.map +1 -0
  65. package/dist/cli/commands/tasks.js +92 -0
  66. package/dist/cli/commands/tasks.js.map +1 -0
  67. package/dist/cli/http-client.d.ts +2 -0
  68. package/dist/cli/http-client.d.ts.map +1 -1
  69. package/dist/cli/http-client.js +8 -3
  70. package/dist/cli/http-client.js.map +1 -1
  71. package/dist/cli/index.d.ts.map +1 -1
  72. package/dist/cli/index.js +5 -1
  73. package/dist/cli/index.js.map +1 -1
  74. package/dist/config/config-write-lock.d.ts +2 -0
  75. package/dist/config/config-write-lock.d.ts.map +1 -1
  76. package/dist/config/config-write-lock.js +5 -0
  77. package/dist/config/config-write-lock.js.map +1 -1
  78. package/dist/config/loader.d.ts.map +1 -1
  79. package/dist/config/loader.js +87 -2
  80. package/dist/config/loader.js.map +1 -1
  81. package/dist/config/migrator.d.ts.map +1 -1
  82. package/dist/config/migrator.js +12 -1
  83. package/dist/config/migrator.js.map +1 -1
  84. package/dist/config/watcher.d.ts.map +1 -1
  85. package/dist/config/watcher.js +6 -0
  86. package/dist/config/watcher.js.map +1 -1
  87. package/dist/connectors/resolve.d.ts.map +1 -1
  88. package/dist/connectors/resolve.js +3 -1
  89. package/dist/connectors/resolve.js.map +1 -1
  90. package/dist/connectors/types.d.ts +8 -0
  91. package/dist/connectors/types.d.ts.map +1 -1
  92. package/dist/cron/manager.d.ts.map +1 -1
  93. package/dist/cron/manager.js +21 -2
  94. package/dist/cron/manager.js.map +1 -1
  95. package/dist/discord/receiver.d.ts +2 -1
  96. package/dist/discord/receiver.d.ts.map +1 -1
  97. package/dist/discord/receiver.js +5 -1
  98. package/dist/discord/receiver.js.map +1 -1
  99. package/dist/history/db.d.ts +3 -0
  100. package/dist/history/db.d.ts.map +1 -1
  101. package/dist/history/db.js +21 -1
  102. package/dist/history/db.js.map +1 -1
  103. package/dist/history/types.d.ts +12 -1
  104. package/dist/history/types.d.ts.map +1 -1
  105. package/dist/history/types.js +10 -1
  106. package/dist/history/types.js.map +1 -1
  107. package/dist/index.js +48 -9
  108. package/dist/index.js.map +1 -1
  109. package/dist/orchestration/bounded-queue.d.ts +15 -0
  110. package/dist/orchestration/bounded-queue.d.ts.map +1 -0
  111. package/dist/orchestration/bounded-queue.js +58 -0
  112. package/dist/orchestration/bounded-queue.js.map +1 -0
  113. package/dist/orchestration/bridge.d.ts +55 -0
  114. package/dist/orchestration/bridge.d.ts.map +1 -0
  115. package/dist/orchestration/bridge.js +234 -0
  116. package/dist/orchestration/bridge.js.map +1 -0
  117. package/dist/orchestration/browser-routing.d.ts +7 -0
  118. package/dist/orchestration/browser-routing.d.ts.map +1 -0
  119. package/dist/orchestration/browser-routing.js +22 -0
  120. package/dist/orchestration/browser-routing.js.map +1 -0
  121. package/dist/orchestration/capabilities.d.ts +49 -0
  122. package/dist/orchestration/capabilities.d.ts.map +1 -0
  123. package/dist/orchestration/capabilities.js +417 -0
  124. package/dist/orchestration/capabilities.js.map +1 -0
  125. package/dist/orchestration/capacity.d.ts +14 -0
  126. package/dist/orchestration/capacity.d.ts.map +1 -0
  127. package/dist/orchestration/capacity.js +52 -0
  128. package/dist/orchestration/capacity.js.map +1 -0
  129. package/dist/orchestration/channel-activity.d.ts +21 -0
  130. package/dist/orchestration/channel-activity.d.ts.map +1 -0
  131. package/dist/orchestration/channel-activity.js +72 -0
  132. package/dist/orchestration/channel-activity.js.map +1 -0
  133. package/dist/orchestration/channel-controls.d.ts +32 -0
  134. package/dist/orchestration/channel-controls.d.ts.map +1 -0
  135. package/dist/orchestration/channel-controls.js +105 -0
  136. package/dist/orchestration/channel-controls.js.map +1 -0
  137. package/dist/orchestration/channel-input-media.d.ts +11 -0
  138. package/dist/orchestration/channel-input-media.d.ts.map +1 -0
  139. package/dist/orchestration/channel-input-media.js +54 -0
  140. package/dist/orchestration/channel-input-media.js.map +1 -0
  141. package/dist/orchestration/channel-media.d.ts +4 -0
  142. package/dist/orchestration/channel-media.d.ts.map +1 -0
  143. package/dist/orchestration/channel-media.js +70 -0
  144. package/dist/orchestration/channel-media.js.map +1 -0
  145. package/dist/orchestration/channel-speech.d.ts +7 -0
  146. package/dist/orchestration/channel-speech.d.ts.map +1 -0
  147. package/dist/orchestration/channel-speech.js +65 -0
  148. package/dist/orchestration/channel-speech.js.map +1 -0
  149. package/dist/orchestration/cli-skills.d.ts +12 -0
  150. package/dist/orchestration/cli-skills.d.ts.map +1 -0
  151. package/dist/orchestration/cli-skills.js +132 -0
  152. package/dist/orchestration/cli-skills.js.map +1 -0
  153. package/dist/orchestration/config.d.ts +256 -0
  154. package/dist/orchestration/config.d.ts.map +1 -0
  155. package/dist/orchestration/config.js +110 -0
  156. package/dist/orchestration/config.js.map +1 -0
  157. package/dist/orchestration/container.d.ts +21 -0
  158. package/dist/orchestration/container.d.ts.map +1 -0
  159. package/dist/orchestration/container.js +195 -0
  160. package/dist/orchestration/container.js.map +1 -0
  161. package/dist/orchestration/control-delivery.d.ts +5 -0
  162. package/dist/orchestration/control-delivery.d.ts.map +1 -0
  163. package/dist/orchestration/control-delivery.js +50 -0
  164. package/dist/orchestration/control-delivery.js.map +1 -0
  165. package/dist/orchestration/conversation-intake.d.ts +32 -0
  166. package/dist/orchestration/conversation-intake.d.ts.map +1 -0
  167. package/dist/orchestration/conversation-intake.js +92 -0
  168. package/dist/orchestration/conversation-intake.js.map +1 -0
  169. package/dist/orchestration/decisions.d.ts +27 -0
  170. package/dist/orchestration/decisions.d.ts.map +1 -0
  171. package/dist/orchestration/decisions.js +148 -0
  172. package/dist/orchestration/decisions.js.map +1 -0
  173. package/dist/orchestration/delivery.d.ts +30 -0
  174. package/dist/orchestration/delivery.d.ts.map +1 -0
  175. package/dist/orchestration/delivery.js +219 -0
  176. package/dist/orchestration/delivery.js.map +1 -0
  177. package/dist/orchestration/display-stream.d.ts +4 -0
  178. package/dist/orchestration/display-stream.d.ts.map +1 -0
  179. package/dist/orchestration/display-stream.js +77 -0
  180. package/dist/orchestration/display-stream.js.map +1 -0
  181. package/dist/orchestration/events.d.ts +30 -0
  182. package/dist/orchestration/events.d.ts.map +1 -0
  183. package/dist/orchestration/events.js +65 -0
  184. package/dist/orchestration/events.js.map +1 -0
  185. package/dist/orchestration/execution-observation.d.ts +38 -0
  186. package/dist/orchestration/execution-observation.d.ts.map +1 -0
  187. package/dist/orchestration/execution-observation.js +25 -0
  188. package/dist/orchestration/execution-observation.js.map +1 -0
  189. package/dist/orchestration/file-delivery.d.ts +16 -0
  190. package/dist/orchestration/file-delivery.d.ts.map +1 -0
  191. package/dist/orchestration/file-delivery.js +139 -0
  192. package/dist/orchestration/file-delivery.js.map +1 -0
  193. package/dist/orchestration/gateway-config.d.ts +17 -0
  194. package/dist/orchestration/gateway-config.d.ts.map +1 -0
  195. package/dist/orchestration/gateway-config.js +128 -0
  196. package/dist/orchestration/gateway-config.js.map +1 -0
  197. package/dist/orchestration/history.d.ts +13 -0
  198. package/dist/orchestration/history.d.ts.map +1 -0
  199. package/dist/orchestration/history.js +48 -0
  200. package/dist/orchestration/history.js.map +1 -0
  201. package/dist/orchestration/identity.d.ts +6 -0
  202. package/dist/orchestration/identity.d.ts.map +1 -0
  203. package/dist/orchestration/identity.js +13 -0
  204. package/dist/orchestration/identity.js.map +1 -0
  205. package/dist/orchestration/inference-errors.d.ts +3 -0
  206. package/dist/orchestration/inference-errors.d.ts.map +1 -0
  207. package/dist/orchestration/inference-errors.js +16 -0
  208. package/dist/orchestration/inference-errors.js.map +1 -0
  209. package/dist/orchestration/input-images.d.ts +12 -0
  210. package/dist/orchestration/input-images.d.ts.map +1 -0
  211. package/dist/orchestration/input-images.js +66 -0
  212. package/dist/orchestration/input-images.js.map +1 -0
  213. package/dist/orchestration/instance-lock.d.ts +5 -0
  214. package/dist/orchestration/instance-lock.d.ts.map +1 -0
  215. package/dist/orchestration/instance-lock.js +33 -0
  216. package/dist/orchestration/instance-lock.js.map +1 -0
  217. package/dist/orchestration/line-loading.d.ts +21 -0
  218. package/dist/orchestration/line-loading.d.ts.map +1 -0
  219. package/dist/orchestration/line-loading.js +89 -0
  220. package/dist/orchestration/line-loading.js.map +1 -0
  221. package/dist/orchestration/media.d.ts +3 -0
  222. package/dist/orchestration/media.d.ts.map +1 -0
  223. package/dist/orchestration/media.js +46 -0
  224. package/dist/orchestration/media.js.map +1 -0
  225. package/dist/orchestration/migrations/schema.d.ts +3 -0
  226. package/dist/orchestration/migrations/schema.d.ts.map +1 -0
  227. package/dist/orchestration/migrations/schema.js +80 -0
  228. package/dist/orchestration/migrations/schema.js.map +1 -0
  229. package/dist/orchestration/notification-mailbox.d.ts +5 -0
  230. package/dist/orchestration/notification-mailbox.d.ts.map +1 -0
  231. package/dist/orchestration/notification-mailbox.js +29 -0
  232. package/dist/orchestration/notification-mailbox.js.map +1 -0
  233. package/dist/orchestration/process-activity.d.ts +23 -0
  234. package/dist/orchestration/process-activity.d.ts.map +1 -0
  235. package/dist/orchestration/process-activity.js +95 -0
  236. package/dist/orchestration/process-activity.js.map +1 -0
  237. package/dist/orchestration/process-supervisor.d.ts +15 -0
  238. package/dist/orchestration/process-supervisor.d.ts.map +1 -0
  239. package/dist/orchestration/process-supervisor.js +92 -0
  240. package/dist/orchestration/process-supervisor.js.map +1 -0
  241. package/dist/orchestration/process-turn.d.ts +35 -0
  242. package/dist/orchestration/process-turn.d.ts.map +1 -0
  243. package/dist/orchestration/process-turn.js +246 -0
  244. package/dist/orchestration/process-turn.js.map +1 -0
  245. package/dist/orchestration/progress-review.d.ts +28 -0
  246. package/dist/orchestration/progress-review.d.ts.map +1 -0
  247. package/dist/orchestration/progress-review.js +48 -0
  248. package/dist/orchestration/progress-review.js.map +1 -0
  249. package/dist/orchestration/recovery.d.ts +8 -0
  250. package/dist/orchestration/recovery.d.ts.map +1 -0
  251. package/dist/orchestration/recovery.js +35 -0
  252. package/dist/orchestration/recovery.js.map +1 -0
  253. package/dist/orchestration/reply-context.d.ts +7 -0
  254. package/dist/orchestration/reply-context.d.ts.map +1 -0
  255. package/dist/orchestration/reply-context.js +54 -0
  256. package/dist/orchestration/reply-context.js.map +1 -0
  257. package/dist/orchestration/runtime.d.ts +232 -0
  258. package/dist/orchestration/runtime.d.ts.map +1 -0
  259. package/dist/orchestration/runtime.js +962 -0
  260. package/dist/orchestration/runtime.js.map +1 -0
  261. package/dist/orchestration/skills.d.ts +17 -0
  262. package/dist/orchestration/skills.d.ts.map +1 -0
  263. package/dist/orchestration/skills.js +32 -0
  264. package/dist/orchestration/skills.js.map +1 -0
  265. package/dist/orchestration/source-policy.d.ts +6 -0
  266. package/dist/orchestration/source-policy.d.ts.map +1 -0
  267. package/dist/orchestration/source-policy.js +16 -0
  268. package/dist/orchestration/source-policy.js.map +1 -0
  269. package/dist/orchestration/speech.d.ts +24 -0
  270. package/dist/orchestration/speech.d.ts.map +1 -0
  271. package/dist/orchestration/speech.js +61 -0
  272. package/dist/orchestration/speech.js.map +1 -0
  273. package/dist/orchestration/stop-controls.d.ts +30 -0
  274. package/dist/orchestration/stop-controls.d.ts.map +1 -0
  275. package/dist/orchestration/stop-controls.js +79 -0
  276. package/dist/orchestration/stop-controls.js.map +1 -0
  277. package/dist/orchestration/store.d.ts +86 -0
  278. package/dist/orchestration/store.d.ts.map +1 -0
  279. package/dist/orchestration/store.js +275 -0
  280. package/dist/orchestration/store.js.map +1 -0
  281. package/dist/orchestration/task-controls.d.ts +130 -0
  282. package/dist/orchestration/task-controls.d.ts.map +1 -0
  283. package/dist/orchestration/task-controls.js +55 -0
  284. package/dist/orchestration/task-controls.js.map +1 -0
  285. package/dist/orchestration/task-files.d.ts +29 -0
  286. package/dist/orchestration/task-files.d.ts.map +1 -0
  287. package/dist/orchestration/task-files.js +200 -0
  288. package/dist/orchestration/task-files.js.map +1 -0
  289. package/dist/orchestration/task-report.d.ts +7 -0
  290. package/dist/orchestration/task-report.d.ts.map +1 -0
  291. package/dist/orchestration/task-report.js +33 -0
  292. package/dist/orchestration/task-report.js.map +1 -0
  293. package/dist/orchestration/tasks/checkpoint-hook.d.ts +19 -0
  294. package/dist/orchestration/tasks/checkpoint-hook.d.ts.map +1 -0
  295. package/dist/orchestration/tasks/checkpoint-hook.js +49 -0
  296. package/dist/orchestration/tasks/checkpoint-hook.js.map +1 -0
  297. package/dist/orchestration/tasks/cleanup.d.ts +18 -0
  298. package/dist/orchestration/tasks/cleanup.d.ts.map +1 -0
  299. package/dist/orchestration/tasks/cleanup.js +113 -0
  300. package/dist/orchestration/tasks/cleanup.js.map +1 -0
  301. package/dist/orchestration/tasks/driver.d.ts +23 -0
  302. package/dist/orchestration/tasks/driver.d.ts.map +1 -0
  303. package/dist/orchestration/tasks/driver.js +209 -0
  304. package/dist/orchestration/tasks/driver.js.map +1 -0
  305. package/dist/orchestration/tasks/failure.d.ts +5 -0
  306. package/dist/orchestration/tasks/failure.d.ts.map +1 -0
  307. package/dist/orchestration/tasks/failure.js +17 -0
  308. package/dist/orchestration/tasks/failure.js.map +1 -0
  309. package/dist/orchestration/tasks/pool.d.ts +18 -0
  310. package/dist/orchestration/tasks/pool.d.ts.map +1 -0
  311. package/dist/orchestration/tasks/pool.js +73 -0
  312. package/dist/orchestration/tasks/pool.js.map +1 -0
  313. package/dist/orchestration/tasks/scheduler.d.ts +38 -0
  314. package/dist/orchestration/tasks/scheduler.d.ts.map +1 -0
  315. package/dist/orchestration/tasks/scheduler.js +160 -0
  316. package/dist/orchestration/tasks/scheduler.js.map +1 -0
  317. package/dist/orchestration/tasks/service.d.ts +109 -0
  318. package/dist/orchestration/tasks/service.d.ts.map +1 -0
  319. package/dist/orchestration/tasks/service.js +697 -0
  320. package/dist/orchestration/tasks/service.js.map +1 -0
  321. package/dist/orchestration/tasks/shared-workspace.d.ts +25 -0
  322. package/dist/orchestration/tasks/shared-workspace.d.ts.map +1 -0
  323. package/dist/orchestration/tasks/shared-workspace.js +162 -0
  324. package/dist/orchestration/tasks/shared-workspace.js.map +1 -0
  325. package/dist/orchestration/tasks/task-directive.d.ts +6 -0
  326. package/dist/orchestration/tasks/task-directive.d.ts.map +1 -0
  327. package/dist/orchestration/tasks/task-directive.js +41 -0
  328. package/dist/orchestration/tasks/task-directive.js.map +1 -0
  329. package/dist/orchestration/tasks/timing.d.ts +15 -0
  330. package/dist/orchestration/tasks/timing.d.ts.map +1 -0
  331. package/dist/orchestration/tasks/timing.js +48 -0
  332. package/dist/orchestration/tasks/timing.js.map +1 -0
  333. package/dist/orchestration/tasks/tool-repetition.d.ts +3 -0
  334. package/dist/orchestration/tasks/tool-repetition.d.ts.map +1 -0
  335. package/dist/orchestration/tasks/tool-repetition.js +30 -0
  336. package/dist/orchestration/tasks/tool-repetition.js.map +1 -0
  337. package/dist/orchestration/tasks/workspace.d.ts +24 -0
  338. package/dist/orchestration/tasks/workspace.d.ts.map +1 -0
  339. package/dist/orchestration/tasks/workspace.js +147 -0
  340. package/dist/orchestration/tasks/workspace.js.map +1 -0
  341. package/dist/orchestration/telegram-speech.d.ts +17 -0
  342. package/dist/orchestration/telegram-speech.d.ts.map +1 -0
  343. package/dist/orchestration/telegram-speech.js +55 -0
  344. package/dist/orchestration/telegram-speech.js.map +1 -0
  345. package/dist/orchestration/telegram-tool-status.d.ts +23 -0
  346. package/dist/orchestration/telegram-tool-status.d.ts.map +1 -0
  347. package/dist/orchestration/telegram-tool-status.js +207 -0
  348. package/dist/orchestration/telegram-tool-status.js.map +1 -0
  349. package/dist/orchestration/telegram-voices.d.ts +42 -0
  350. package/dist/orchestration/telegram-voices.d.ts.map +1 -0
  351. package/dist/orchestration/telegram-voices.js +70 -0
  352. package/dist/orchestration/telegram-voices.js.map +1 -0
  353. package/dist/orchestration/tool-activity.d.ts +10 -0
  354. package/dist/orchestration/tool-activity.d.ts.map +1 -0
  355. package/dist/orchestration/tool-activity.js +38 -0
  356. package/dist/orchestration/tool-activity.js.map +1 -0
  357. package/dist/orchestration/types.d.ts +177 -0
  358. package/dist/orchestration/types.d.ts.map +1 -0
  359. package/dist/orchestration/types.js +13 -0
  360. package/dist/orchestration/types.js.map +1 -0
  361. package/dist/orchestration/voice-reply-policy.d.ts +8 -0
  362. package/dist/orchestration/voice-reply-policy.d.ts.map +1 -0
  363. package/dist/orchestration/voice-reply-policy.js +46 -0
  364. package/dist/orchestration/voice-reply-policy.js.map +1 -0
  365. package/dist/orchestration/worker-shares.d.ts +8 -0
  366. package/dist/orchestration/worker-shares.d.ts.map +1 -0
  367. package/dist/orchestration/worker-shares.js +59 -0
  368. package/dist/orchestration/worker-shares.js.map +1 -0
  369. package/dist/orchestration/workflow.d.ts +121 -0
  370. package/dist/orchestration/workflow.d.ts.map +1 -0
  371. package/dist/orchestration/workflow.js +69 -0
  372. package/dist/orchestration/workflow.js.map +1 -0
  373. package/dist/session/input-image.d.ts +10 -0
  374. package/dist/session/input-image.d.ts.map +1 -0
  375. package/dist/session/input-image.js +3 -0
  376. package/dist/session/input-image.js.map +1 -0
  377. package/dist/session/process.d.ts +15 -3
  378. package/dist/session/process.d.ts.map +1 -1
  379. package/dist/session/process.js +144 -35
  380. package/dist/session/process.js.map +1 -1
  381. package/dist/session/runtime-profile.d.ts +36 -0
  382. package/dist/session/runtime-profile.d.ts.map +1 -0
  383. package/dist/session/runtime-profile.js +63 -0
  384. package/dist/session/runtime-profile.js.map +1 -0
  385. package/dist/session/store.d.ts.map +1 -1
  386. package/dist/session/store.js +23 -1
  387. package/dist/session/store.js.map +1 -1
  388. package/dist/share/share-store.d.ts +3 -1
  389. package/dist/share/share-store.d.ts.map +1 -1
  390. package/dist/share/share-store.js +13 -2
  391. package/dist/share/share-store.js.map +1 -1
  392. package/dist/shared/line-request-order.d.ts +2 -0
  393. package/dist/shared/line-request-order.d.ts.map +1 -0
  394. package/dist/shared/line-request-order.js +16 -0
  395. package/dist/shared/line-request-order.js.map +1 -0
  396. package/dist/shared/task-elapsed.d.ts +3 -0
  397. package/dist/shared/task-elapsed.d.ts.map +1 -0
  398. package/dist/shared/task-elapsed.js +12 -0
  399. package/dist/shared/task-elapsed.js.map +1 -0
  400. package/dist/shared/task-updated-time.d.ts +3 -0
  401. package/dist/shared/task-updated-time.d.ts.map +1 -0
  402. package/dist/shared/task-updated-time.js +15 -0
  403. package/dist/shared/task-updated-time.js.map +1 -0
  404. package/dist/skills/loader.d.ts +2 -0
  405. package/dist/skills/loader.d.ts.map +1 -1
  406. package/dist/skills/loader.js.map +1 -1
  407. package/dist/telegram/chunks.d.ts +19 -0
  408. package/dist/telegram/chunks.d.ts.map +1 -0
  409. package/dist/telegram/chunks.js +129 -0
  410. package/dist/telegram/chunks.js.map +1 -0
  411. package/dist/telegram/markdown.d.ts.map +1 -1
  412. package/dist/telegram/markdown.js +18 -3
  413. package/dist/telegram/markdown.js.map +1 -1
  414. package/dist/telegram/receiver.d.ts +2 -1
  415. package/dist/telegram/receiver.d.ts.map +1 -1
  416. package/dist/telegram/receiver.js +6 -1
  417. package/dist/telegram/receiver.js.map +1 -1
  418. package/dist/types.d.ts +54 -0
  419. package/dist/types.d.ts.map +1 -1
  420. package/dist/ui/web-ui.d.ts.map +1 -1
  421. package/dist/ui/web-ui.js +31 -5
  422. package/dist/ui/web-ui.js.map +1 -1
  423. package/dist/voice/diagnostics.d.ts +29 -0
  424. package/dist/voice/diagnostics.d.ts.map +1 -0
  425. package/dist/voice/diagnostics.js +37 -0
  426. package/dist/voice/diagnostics.js.map +1 -0
  427. package/dist/voice/errors.d.ts +19 -0
  428. package/dist/voice/errors.d.ts.map +1 -0
  429. package/dist/voice/errors.js +133 -0
  430. package/dist/voice/errors.js.map +1 -0
  431. package/dist/voice/line-audio.d.ts +4 -0
  432. package/dist/voice/line-audio.d.ts.map +1 -0
  433. package/dist/voice/line-audio.js +27 -0
  434. package/dist/voice/line-audio.js.map +1 -0
  435. package/dist/voice/managed-quota.d.ts +5 -0
  436. package/dist/voice/managed-quota.d.ts.map +1 -0
  437. package/dist/voice/managed-quota.js +35 -0
  438. package/dist/voice/managed-quota.js.map +1 -0
  439. package/dist/voice/mp3.d.ts +3 -0
  440. package/dist/voice/mp3.d.ts.map +1 -0
  441. package/dist/voice/mp3.js +30 -0
  442. package/dist/voice/mp3.js.map +1 -0
  443. package/dist/voice/notes.d.ts +9 -0
  444. package/dist/voice/notes.d.ts.map +1 -0
  445. package/dist/voice/notes.js +68 -0
  446. package/dist/voice/notes.js.map +1 -0
  447. package/dist/voice/playback.d.ts +22 -0
  448. package/dist/voice/playback.d.ts.map +1 -0
  449. package/dist/voice/playback.js +52 -0
  450. package/dist/voice/playback.js.map +1 -0
  451. package/dist/voice/preview.d.ts +6 -0
  452. package/dist/voice/preview.d.ts.map +1 -0
  453. package/dist/voice/preview.js +44 -0
  454. package/dist/voice/preview.js.map +1 -0
  455. package/dist/voice/protocol.d.ts +10 -0
  456. package/dist/voice/protocol.d.ts.map +1 -0
  457. package/dist/voice/protocol.js +30 -0
  458. package/dist/voice/protocol.js.map +1 -0
  459. package/dist/voice/providers/cartesia-tts.d.ts +26 -0
  460. package/dist/voice/providers/cartesia-tts.d.ts.map +1 -0
  461. package/dist/voice/providers/cartesia-tts.js +95 -0
  462. package/dist/voice/providers/cartesia-tts.js.map +1 -0
  463. package/dist/voice/providers/deepgram-stt.d.ts +20 -0
  464. package/dist/voice/providers/deepgram-stt.d.ts.map +1 -0
  465. package/dist/voice/providers/deepgram-stt.js +66 -0
  466. package/dist/voice/providers/deepgram-stt.js.map +1 -0
  467. package/dist/voice/providers/elevenlabs-stt.d.ts +20 -0
  468. package/dist/voice/providers/elevenlabs-stt.d.ts.map +1 -0
  469. package/dist/voice/providers/elevenlabs-stt.js +92 -0
  470. package/dist/voice/providers/elevenlabs-stt.js.map +1 -0
  471. package/dist/voice/providers/elevenlabs-tts.d.ts +26 -0
  472. package/dist/voice/providers/elevenlabs-tts.d.ts.map +1 -0
  473. package/dist/voice/providers/elevenlabs-tts.js +82 -0
  474. package/dist/voice/providers/elevenlabs-tts.js.map +1 -0
  475. package/dist/voice/providers/encoded-audio-tts.d.ts +21 -0
  476. package/dist/voice/providers/encoded-audio-tts.d.ts.map +1 -0
  477. package/dist/voice/providers/encoded-audio-tts.js +175 -0
  478. package/dist/voice/providers/encoded-audio-tts.js.map +1 -0
  479. package/dist/voice/providers/fake.d.ts +39 -0
  480. package/dist/voice/providers/fake.d.ts.map +1 -0
  481. package/dist/voice/providers/fake.js +41 -0
  482. package/dist/voice/providers/fake.js.map +1 -0
  483. package/dist/voice/providers/gemini-live-stt.d.ts +21 -0
  484. package/dist/voice/providers/gemini-live-stt.d.ts.map +1 -0
  485. package/dist/voice/providers/gemini-live-stt.js +158 -0
  486. package/dist/voice/providers/gemini-live-stt.js.map +1 -0
  487. package/dist/voice/providers/gemini.d.ts +60 -0
  488. package/dist/voice/providers/gemini.d.ts.map +1 -0
  489. package/dist/voice/providers/gemini.js +124 -0
  490. package/dist/voice/providers/gemini.js.map +1 -0
  491. package/dist/voice/providers/model-ref.d.ts +9 -0
  492. package/dist/voice/providers/model-ref.d.ts.map +1 -0
  493. package/dist/voice/providers/model-ref.js +31 -0
  494. package/dist/voice/providers/model-ref.js.map +1 -0
  495. package/dist/voice/providers/openrouter.d.ts +39 -0
  496. package/dist/voice/providers/openrouter.d.ts.map +1 -0
  497. package/dist/voice/providers/openrouter.js +154 -0
  498. package/dist/voice/providers/openrouter.js.map +1 -0
  499. package/dist/voice/providers/paxalabs-stt.d.ts +12 -0
  500. package/dist/voice/providers/paxalabs-stt.d.ts.map +1 -0
  501. package/dist/voice/providers/paxalabs-stt.js +41 -0
  502. package/dist/voice/providers/paxalabs-stt.js.map +1 -0
  503. package/dist/voice/providers/paxalabs-tts.d.ts +23 -0
  504. package/dist/voice/providers/paxalabs-tts.d.ts.map +1 -0
  505. package/dist/voice/providers/paxalabs-tts.js +80 -0
  506. package/dist/voice/providers/paxalabs-tts.js.map +1 -0
  507. package/dist/voice/providers/recorded-stt.d.ts +34 -0
  508. package/dist/voice/providers/recorded-stt.d.ts.map +1 -0
  509. package/dist/voice/providers/recorded-stt.js +59 -0
  510. package/dist/voice/providers/recorded-stt.js.map +1 -0
  511. package/dist/voice/providers/registry.d.ts +10 -0
  512. package/dist/voice/providers/registry.d.ts.map +1 -0
  513. package/dist/voice/providers/registry.js +77 -0
  514. package/dist/voice/providers/registry.js.map +1 -0
  515. package/dist/voice/providers/socket.d.ts +10 -0
  516. package/dist/voice/providers/socket.d.ts.map +1 -0
  517. package/dist/voice/providers/socket.js +91 -0
  518. package/dist/voice/providers/socket.js.map +1 -0
  519. package/dist/voice/providers/upstream.d.ts +9 -0
  520. package/dist/voice/providers/upstream.d.ts.map +1 -0
  521. package/dist/voice/providers/upstream.js +51 -0
  522. package/dist/voice/providers/upstream.js.map +1 -0
  523. package/dist/voice/providers/voice-catalog.d.ts +17 -0
  524. package/dist/voice/providers/voice-catalog.d.ts.map +1 -0
  525. package/dist/voice/providers/voice-catalog.js +167 -0
  526. package/dist/voice/providers/voice-catalog.js.map +1 -0
  527. package/dist/voice/queue.d.ts +2 -0
  528. package/dist/voice/queue.d.ts.map +1 -0
  529. package/dist/voice/queue.js +6 -0
  530. package/dist/voice/queue.js.map +1 -0
  531. package/dist/voice/session.d.ts +86 -0
  532. package/dist/voice/session.d.ts.map +1 -0
  533. package/dist/voice/session.js +464 -0
  534. package/dist/voice/session.js.map +1 -0
  535. package/dist/voice/turn-manager.d.ts +27 -0
  536. package/dist/voice/turn-manager.d.ts.map +1 -0
  537. package/dist/voice/turn-manager.js +75 -0
  538. package/dist/voice/turn-manager.js.map +1 -0
  539. package/dist/voice/types.d.ts +78 -0
  540. package/dist/voice/types.d.ts.map +1 -0
  541. package/dist/voice/types.js +18 -0
  542. package/dist/voice/types.js.map +1 -0
  543. package/dist/voice/wav.d.ts +2 -0
  544. package/dist/voice/wav.d.ts.map +1 -0
  545. package/dist/voice/wav.js +21 -0
  546. package/dist/voice/wav.js.map +1 -0
  547. package/dist/wechat/ilink-client.d.ts +207 -0
  548. package/dist/wechat/ilink-client.d.ts.map +1 -0
  549. package/dist/wechat/ilink-client.js +660 -0
  550. package/dist/wechat/ilink-client.js.map +1 -0
  551. package/dist/wechat/manager.d.ts +93 -0
  552. package/dist/wechat/manager.d.ts.map +1 -0
  553. package/dist/wechat/manager.js +409 -0
  554. package/dist/wechat/manager.js.map +1 -0
  555. package/dist/whatsapp/manager.d.ts.map +1 -1
  556. package/dist/whatsapp/manager.js +51 -1
  557. package/dist/whatsapp/manager.js.map +1 -1
  558. package/mcp/capability-catalog.ts +206 -0
  559. package/mcp/modules.ts +56 -0
  560. package/mcp/server.ts +18 -35
  561. package/mcp/tools/browser/module.ts +1 -1
  562. package/mcp/tools/browser/skills/open-browser/SKILL.md +5 -3
  563. package/mcp/tools/discord/commands.ts +17 -1
  564. package/mcp/tools/discord/inbound.ts +11 -0
  565. package/mcp/tools/discord/module.ts +42 -2
  566. package/mcp/tools/discord/receiver-server.ts +10 -0
  567. package/mcp/tools/discord/types.ts +4 -1
  568. package/mcp/tools/image/module.ts +3 -1
  569. package/mcp/tools/receiver-spool.test.ts +28 -0
  570. package/mcp/tools/receiver-spool.ts +56 -0
  571. package/mcp/tools/share-file/module.ts +9 -1
  572. package/mcp/tools/shared/share-client.ts +19 -0
  573. package/mcp/tools/tasks/module.ts +35 -0
  574. package/mcp/tools/telegram/media-group.ts +21 -0
  575. package/mcp/tools/telegram/receiver-server.ts +232 -11
  576. package/mcp/tools/telegram/selection-confirmation.ts +20 -0
  577. package/mcp/tools/telegram/task-browser.ts +117 -0
  578. package/mcp/tools/telegram/task-detail.ts +36 -0
  579. package/mcp/tools/telegram/task-elapsed.ts +1 -0
  580. package/mcp/tools/telegram/typing.ts +6 -116
  581. package/mcp/tools/video/module.ts +1 -1
  582. package/mcp/tools/wechat/client.ts +49 -0
  583. package/mcp/tools/wechat/module.ts +88 -0
  584. package/mcp/types.ts +5 -0
  585. package/package.json +2 -1
  586. package/resource/claude_gateway.jpeg +0 -0
  587. package/scripts/orchestration/bench-store.cjs +30 -0
  588. package/scripts/orchestration/inspect.cjs +16 -0
  589. package/scripts/orchestration/probe-profile.cjs +67 -0
  590. package/scripts/orchestration/reconcile.cjs +21 -0
  591. package/scripts/orchestration/smoke-elevenlabs.cjs +90 -0
  592. package/scripts/orchestration/smoke-media.cjs +70 -0
  593. package/scripts/orchestration/smoke-text.cjs +101 -0
  594. package/scripts/orchestration/smoke-vision.cjs +49 -0
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TelegramVoices = void 0;
4
+ const model_ref_1 = require("../voice/providers/model-ref");
5
+ const crypto_1 = require("crypto");
6
+ const voice_catalog_1 = require("../voice/providers/voice-catalog");
7
+ class TelegramVoices {
8
+ constructor(store, config, catalog = voice_catalog_1.voiceChoices, pageSize = 10) {
9
+ this.store = store;
10
+ this.config = config;
11
+ this.catalog = catalog;
12
+ this.pageSize = pageSize;
13
+ this.menus = new Map();
14
+ }
15
+ settings(chatId) {
16
+ const config = this.config(), choice = this.store.get('SELECT provider,voice_id FROM telegram_tts_voices WHERE chat_id=?', chatId);
17
+ return { ...config, voiceId: choice ? (0, model_ref_1.canonicalVoiceProvider)(String(choice.provider)) === (0, model_ref_1.canonicalVoiceProvider)(config.provider) ? String(choice.voice_id) : config.voiceId : config.voiceId };
18
+ }
19
+ prune() { for (const [id, m] of this.menus)
20
+ if (m.until < Date.now())
21
+ this.menus.delete(id); }
22
+ async menu(chatId, page = 0, menuId, gender) {
23
+ this.prune();
24
+ const config = this.config();
25
+ if (!Number.isSafeInteger(page) || page < 0)
26
+ throw Error('INVALID_VOICE_PAGE');
27
+ if (!menuId) {
28
+ const voices = await this.catalog(config);
29
+ if (config.provider !== this.config().provider)
30
+ throw Error('VOICE_PROVIDER_CHANGED');
31
+ menuId = (0, crypto_1.randomUUID)();
32
+ if (this.menus.size >= 1000)
33
+ this.menus.delete(this.menus.keys().next().value);
34
+ this.menus.set(menuId, { chatId, provider: config.provider, until: Date.now() + 300000, voices });
35
+ }
36
+ const menu = this.menus.get(menuId);
37
+ if (!menu || menu.chatId !== chatId || menu.provider !== config.provider)
38
+ throw Error('VOICE_MENU_EXPIRED');
39
+ const groupOf = (v) => v.gender === 'male' || v.gender === 'female' || v.gender === 'neutral' ? v.gender : 'unspecified';
40
+ const selected = this.settings(chatId).voiceId;
41
+ const groups = ['male', 'female', 'neutral', 'unspecified'].filter(g => menu.voices.some(v => groupOf(v) === g));
42
+ if (gender !== undefined && !groups.includes(gender))
43
+ throw Error('INVALID_VOICE_GROUP');
44
+ const filtered = menu.voices.map((v, index) => ({ ...v, index, selected: v.id === selected })).filter(v => groupOf(v) === gender);
45
+ const pages = Math.max(1, Math.ceil(filtered.length / this.pageSize));
46
+ if (page >= pages)
47
+ throw Error('INVALID_VOICE_PAGE');
48
+ return { menuId, provider: config.provider, page, pages, gender, groups,
49
+ selected: menu.voices.find(v => v.id === selected)?.name ?? (selected ? 'Unavailable — choose a voice' : 'Auto'),
50
+ voices: filtered.slice(page * this.pageSize, page * this.pageSize + this.pageSize) };
51
+ }
52
+ async choose(chatId, menuId, index) {
53
+ this.prune();
54
+ const menu = this.menus.get(menuId), config = this.config();
55
+ if (!menu || menu.chatId !== chatId || menu.provider !== config.provider)
56
+ throw Error('VOICE_MENU_EXPIRED');
57
+ const voice = menu.voices[index];
58
+ if (!voice || !Number.isSafeInteger(index))
59
+ throw Error('INVALID_VOICE');
60
+ if (!(await this.catalog(config)).some(v => v.id === voice.id) || config.provider !== this.config().provider)
61
+ throw Error('VOICE_UNAVAILABLE');
62
+ this.store.run('INSERT INTO telegram_tts_voices VALUES(?,?,?) ON CONFLICT(chat_id) DO UPDATE SET provider=excluded.provider,voice_id=excluded.voice_id', chatId, config.provider, voice.id);
63
+ this.menus.delete(menuId);
64
+ return { voiceId: voice.id, name: voice.name, provider: config.provider };
65
+ }
66
+ dismiss(chatId, menuId) { if (this.menus.get(menuId)?.chatId === chatId)
67
+ this.menus.delete(menuId); }
68
+ }
69
+ exports.TelegramVoices = TelegramVoices;
70
+ //# sourceMappingURL=telegram-voices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telegram-voices.js","sourceRoot":"","sources":["../../src/orchestration/telegram-voices.ts"],"names":[],"mappings":";;;AAAA,4DAAsE;AACtE,mCAAoC;AAEpC,oEAA6E;AAG7E,MAAa,cAAc;IAEzB,YAAoB,KAAwB,EAAS,MAAoB,EAAS,UAAQ,4BAAY,EAAS,WAAS,EAAE;QAAtG,UAAK,GAAL,KAAK,CAAmB;QAAS,WAAM,GAAN,MAAM,CAAc;QAAS,YAAO,GAAP,OAAO,CAAa;QAAS,aAAQ,GAAR,QAAQ,CAAG;QADlH,UAAK,GAAC,IAAI,GAAG,EAA4E,CAAC;IAC0B,CAAC;IAC7H,QAAQ,CAAC,MAAa;Q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10 @@
1
+ /** Public tool activity excludes reasoning and bounds input previews. */
2
+ export interface ToolActivity {
3
+ type: 'tool_use' | 'tool_result';
4
+ id: string;
5
+ name: string;
6
+ input?: Record<string, unknown>;
7
+ is_error?: boolean;
8
+ }
9
+ export declare function toolActivity(publish: (event: ToolActivity) => void): (line: string) => void;
10
+ //# sourceMappingURL=tool-activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-activity.d.ts","sourceRoot":"","sources":["../../src/orchestration/tool-activity.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,WAAW,YAAY;IAAG,IAAI,EAAE,UAAU,GAAG,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAAE;AAClJ,wBAAgB,YAAY,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAuB3F"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toolActivity = toolActivity;
4
+ function toolActivity(publish) {
5
+ const calls = new Map();
6
+ const finished = new Set();
7
+ return line => {
8
+ let event;
9
+ try {
10
+ event = JSON.parse(line);
11
+ }
12
+ catch {
13
+ return;
14
+ }
15
+ if (!Array.isArray(event.message?.content))
16
+ return;
17
+ for (const block of event.message.content) {
18
+ if (block.type === 'tool_use' && typeof block.id === 'string' && typeof block.name === 'string' && !calls.has(block.id) && calls.size < 2000) {
19
+ calls.set(block.id, block.name);
20
+ const input = {};
21
+ for (const [key, value] of Object.entries(block.input ?? {}).slice(0, 16)) {
22
+ if (/token|secret|password|authorization|api.?key/i.test(key))
23
+ continue;
24
+ if (typeof value === 'string')
25
+ input[key] = value.slice(0, 2000);
26
+ else if (typeof value === 'number' || typeof value === 'boolean')
27
+ input[key] = value;
28
+ }
29
+ publish({ type: 'tool_use', id: block.id, name: block.name, input });
30
+ }
31
+ if (block.type === 'tool_result' && calls.has(block.tool_use_id) && !finished.has(block.tool_use_id)) {
32
+ finished.add(block.tool_use_id);
33
+ publish({ type: 'tool_result', id: block.tool_use_id, name: calls.get(block.tool_use_id), is_error: Boolean(block.is_error) });
34
+ }
35
+ }
36
+ };
37
+ }
38
+ //# sourceMappingURL=tool-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-activity.js","sourceRoot":"","sources":["../../src/orchestration/tool-activity.ts"],"names":[],"mappings":";;AAEA,oCAuBC;AAvBD,SAAgB,YAAY,CAAC,OAAsC;IACjE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,OAAO,IAAI,CAAC,EAAE;QACZ,IAAI,KAAU,CAAC;QAAC,IAAI,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO;QAAC,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC;YAAE,OAAO;QACnD,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,IAAI,EAAE,CAAC;gBAC7I,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,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{ ChatChannelOrApi } from '../history/types';
2
+ export type SessionRole = 'legacy' | 'agent' | 'worker';
3
+ export type InputModality = 'text' | 'voice_note' | 'live_voice';
4
+ export type TaskState = 'queued' | 'starting' | 'running' | 'waiting_input' | 'interrupting' | 'cancel_requested' | 'recovering' | 'needs_reconciliation' | 'completed' | 'failed' | 'cancelled';
5
+ export declare const TERMINAL_TASK_STATES: ReadonlySet<TaskState>;
6
+ export type ChangeMode = 'when_ready' | 'interrupt_and_resume';
7
+ /** Resolved by authenticated ingress, never copied from model arguments. */
8
+ export interface ConversationScope {
9
+ agentId: string;
10
+ agentSessionId: string;
11
+ source: ChatChannelOrApi;
12
+ accountId: string;
13
+ chatId: string;
14
+ threadKey: string;
15
+ principalId: string;
16
+ }
17
+ export interface ExecutionCapabilities {
18
+ execute: boolean;
19
+ writeMemory: boolean;
20
+ }
21
+ export interface CommandContext extends ExecutionCapabilities {
22
+ model?: string;
23
+ conversationId: string;
24
+ principalId: string;
25
+ inputId: string;
26
+ decisionId: string;
27
+ epoch: number;
28
+ actionId: string;
29
+ }
30
+ export interface TaskFailure {
31
+ code: string;
32
+ message: string;
33
+ observedAt: number;
34
+ }
35
+ export type WorkerOutcome = {
36
+ type: 'completed';
37
+ result: TaskResult;
38
+ } | {
39
+ type: 'stopped' | 'failed' | 'unknown';
40
+ failure?: TaskFailure;
41
+ };
42
+ export interface TaskResult {
43
+ summary: string;
44
+ artifactIds: string[];
45
+ diff?: {
46
+ text: string;
47
+ truncated: boolean;
48
+ };
49
+ }
50
+ export interface TaskSnapshot {
51
+ continueTaskId?: string;
52
+ continuationPolicy?: 'after_success' | 'after_terminal';
53
+ workstreamId?: string;
54
+ workerId?: string;
55
+ skill?: import('./skills').TaskSkill;
56
+ model?: string;
57
+ resourceProfile?: {
58
+ projectRoot: string;
59
+ mode: 'isolated-worktree' | 'shared-lock' | 'host' | 'container';
60
+ };
61
+ taskId: string;
62
+ conversationId: string;
63
+ agentId: string;
64
+ agentSessionId: string;
65
+ ownerPrincipalId: string;
66
+ initiatingInputId: string;
67
+ title: string;
68
+ targetProfile: string;
69
+ state: TaskState;
70
+ stateVersion: number;
71
+ revision: number;
72
+ appliedRevision: number;
73
+ activeAttemptId?: string;
74
+ replacedByTaskId?: string;
75
+ workspaceEvidence?: {
76
+ registered: Array<{
77
+ mode: string;
78
+ path: string;
79
+ lifecycleState: string;
80
+ }>;
81
+ observedFilePaths: string[];
82
+ currentFilesystemVerified: false;
83
+ };
84
+ supervision?: {
85
+ id: string;
86
+ reason: 'stale_progress' | 'repeated_tools';
87
+ observedAt: number;
88
+ message: string;
89
+ deliveredAt?: number;
90
+ };
91
+ /** Measured lifecycle categories, not CPU time or inferred CI progress. */
92
+ timing?: import('./tasks/timing').TaskTiming;
93
+ execution?: import('./execution-observation').ExecutionObservation;
94
+ recentTools?: Array<{
95
+ name: string;
96
+ description?: string;
97
+ type: string;
98
+ isError?: boolean;
99
+ occurredAt: number;
100
+ }>;
101
+ workflow?: import("./workflow").TaskWorkflow;
102
+ latestProgress?: {
103
+ text: string;
104
+ observedAt: number;
105
+ source: 'worker' | 'runtime';
106
+ };
107
+ cancellation?: {
108
+ requestedBy: 'user' | 'agent';
109
+ requestedAt: number;
110
+ };
111
+ pendingQuestion?: {
112
+ questionId: string;
113
+ text: string;
114
+ revision: number;
115
+ };
116
+ result?: TaskResult;
117
+ failure?: TaskFailure;
118
+ capabilities: ExecutionCapabilities;
119
+ createdAt: number;
120
+ updatedAt: number;
121
+ }
122
+ export interface TaskRevision {
123
+ /** Bounded supervision advice; never replaces user authorization or the assigned goal. */
124
+ guidance?: string;
125
+ guidanceBasis?: {
126
+ attemptId?: string;
127
+ workflowVersion: number;
128
+ progressAt: number;
129
+ };
130
+ answers?: Array<{
131
+ questionId: string;
132
+ text: string;
133
+ inputId: string;
134
+ }>;
135
+ taskId: string;
136
+ revision: number;
137
+ instructions: string;
138
+ contextRefs: string[];
139
+ mode: ChangeMode;
140
+ originatingInputId: string;
141
+ }
142
+ export interface TaskAttempt {
143
+ startedAt?: number;
144
+ workerId?: string;
145
+ resumeSession?: boolean;
146
+ attemptId: string;
147
+ taskId: string;
148
+ generation: number;
149
+ revision: number;
150
+ sessionId: string;
151
+ state: 'starting' | 'running' | 'ended' | 'unknown';
152
+ processIdentity?: {
153
+ pid: number;
154
+ startedAt: number;
155
+ instanceId: string;
156
+ bootId?: string;
157
+ startTicks?: string;
158
+ };
159
+ result?: TaskResult;
160
+ failure?: TaskFailure;
161
+ }
162
+ export interface OrchestrationEvent<T = unknown> {
163
+ schema_version: 1;
164
+ event_id: string;
165
+ conversation_id: string;
166
+ stream_id: string;
167
+ seq: number;
168
+ type: string;
169
+ occurred_at: number;
170
+ task_id?: string;
171
+ payload: T;
172
+ }
173
+ export declare class OrchestrationError extends Error {
174
+ readonly code: string;
175
+ constructor(code: string, message?: string);
176
+ }
177
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/orchestration/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AACjE,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,eAAe,GACzE,cAAc,GAAG,kBAAkB,GAAG,YAAY,GAAG,sBAAsB,GAC3E,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AACvC,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,SAAS,CAAiD,CAAC;AAC1G,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,sBAAsB,CAAC;AAE/D,4EAA4E;AAC5E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAA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"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrchestrationError = exports.TERMINAL_TASK_STATES = void 0;
4
+ exports.TERMINAL_TASK_STATES = new Set(['completed', 'failed', 'cancelled']);
5
+ class OrchestrationError extends Error {
6
+ constructor(code, message = code) {
7
+ super(message);
8
+ this.code = code;
9
+ this.name = 'OrchestrationError';
10
+ }
11
+ }
12
+ exports.OrchestrationError = OrchestrationError;
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/orchestration/types.ts"],"names":[],"mappings":";;;AAOa,QAAA,oBAAoB,GAA2B,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AA4G1G,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAAqB,IAAY,EAAE,OAAO,GAAG,IAAI;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QADI,SAAI,GAAJ,IAAI,CAAQ;QAE/B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AALD,gDAKC"}
@@ -0,0 +1,8 @@
1
+ import type { OrchestrationStore } from './store';
2
+ export type VoiceReplyMode = 'off' | 'auto' | 'on';
3
+ export declare const VOICE_REPLY_MODES: readonly VoiceReplyMode[];
4
+ export declare function voiceReplyAllowed(mode: VoiceReplyMode, voiceOrigin: boolean): boolean;
5
+ /** Derive provenance from persisted decision inputs/tasks, never model text or
6
+ * the latest message in the chat. A new user instruction resets continuation provenance. */
7
+ export declare function responseHasVoiceOrigin(store: OrchestrationStore, responseId: string): boolean;
8
+ //# sourceMappingURL=voice-reply-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-reply-policy.d.ts","sourceRoot":"","sources":["../../src/orchestration/voice-reply-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;AACnD,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAAwB,CAAC;AAChF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAErF;AACD;4FAC4F;AAC5F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CA8B7F"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VOICE_REPLY_MODES = void 0;
4
+ exports.voiceReplyAllowed = voiceReplyAllowed;
5
+ exports.responseHasVoiceOrigin = responseHasVoiceOrigin;
6
+ exports.VOICE_REPLY_MODES = ['off', 'auto', 'on'];
7
+ function voiceReplyAllowed(mode, voiceOrigin) {
8
+ return mode === 'on' || (mode === 'auto' && voiceOrigin);
9
+ }
10
+ /** Derive provenance from persisted decision inputs/tasks, never model text or
11
+ * the latest message in the chat. A new user instruction resets continuation provenance. */
12
+ function responseHasVoiceOrigin(store, responseId) {
13
+ const decision = store.get('SELECT d.* FROM conversation_decisions d JOIN assistant_responses r ON r.decision_id=d.id WHERE r.id=?', responseId);
14
+ if (!decision)
15
+ return false;
16
+ const input = (id) => store.get('SELECT modality,store_user_message FROM conversation_inputs WHERE id=? AND conversation_id=?', id, decision.conversation_id);
17
+ const isVoice = (row) => row?.modality === 'voice_note' || row?.modality === 'live_voice';
18
+ const userInputs = JSON.parse(String(decision.input_ids_json)).map(input)
19
+ .filter(row => row && row.store_user_message !== 0);
20
+ // A new user turn owns its reply policy, even when it consumes older task notifications.
21
+ if (userInputs.length)
22
+ return userInputs.some(isVoice);
23
+ for (const row of store.all('SELECT task_id FROM notifications WHERE decision_id=?', decision.id)) {
24
+ let task = store.task(String(row.task_id));
25
+ const visited = new Set();
26
+ while (task && task.conversationId === decision.conversation_id && !visited.has(task.taskId) && visited.size < 64) {
27
+ visited.add(task.taskId);
28
+ // Updates and answers keep the same task ID but have a new user origin.
29
+ // Prefer that revision's input; old snapshots without it retain fallback.
30
+ const revision = store.get('SELECT payload_json FROM task_revisions WHERE task_id=? AND revision=?', task.taskId, task.revision);
31
+ const originatingInputId = revision && JSON.parse(String(revision.payload_json)).originatingInputId;
32
+ const origin = input(originatingInputId || task.initiatingInputId);
33
+ if (origin && origin.store_user_message !== 0) {
34
+ if (isVoice(origin))
35
+ return true;
36
+ // Reusing a worker/task does not carry a previous voice turn into a new text request.
37
+ break;
38
+ }
39
+ if (!task.continueTaskId)
40
+ break;
41
+ task = store.task(task.continueTaskId);
42
+ }
43
+ }
44
+ return false;
45
+ }
46
+ //# sourceMappingURL=voice-reply-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-reply-policy.js","sourceRoot":"","sources":["../../src/orchestration/voice-reply-policy.ts"],"names":[],"mappings":";;;AAGA,8CAEC;AAGD,wDA8BC;AApCY,QAAA,iBAAiB,GAA8B,CAAC,KAAK,EAAC,MAAM,EAAC,IAAI,CAAC,CAAC;AAChF,SAAgB,iBAAiB,CAAC,IAAoB,EAAE,WAAoB;IAC1E,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,WAAW,CAAC,CAAC;AAC3D,CAAC;AACD;4FAC4F;AAC5F,SAAgB,sBAAsB,CAAC,KAAyB,EAAE,UAAkB;IAClF,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,wGAAwG,EAAE,UAAU,CAAC,CAAC;IACjJ,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CACrC,8FAA8F,EAAE,EAAE,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IAChI,MAAM,OAAO,GAAG,CAAC,GA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AAI,CAAC,iBAAiB,CAAC,CAAC;YACnE,IAAI,MAAM,IAAI,MAAM,CAAC,kBAAkB,KAAK,CAAC,EAAE,CAAC;gBAC9C,IAAI,OAAO,CAAC,MAAM,CAAC;oBAAE,OAAO,IAAI,CAAC;gBACjC,sFAAsF;gBACtF,MAAM;YACR,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,cAAc;gBAAE,MAAM;YAChC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { AgentConfig, GatewayConfig } from '../types';
2
+ import { TaskFiles } from './task-files';
3
+ /** Forward only media operations for the captured agent; keep API keys in the gateway. */
4
+ export declare function workerShares(files: TaskFiles, agent: AgentConfig, gateway: GatewayConfig, request?: typeof fetch): (attemptId: string, generation: number, args: Record<string, unknown>) => Promise<{
5
+ status: number;
6
+ json: Record<string, unknown>;
7
+ }>;
8
+ //# sourceMappingURL=worker-shares.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-shares.d.ts","sourceRoot":"","sources":["../../src/orchestration/worker-shares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAE,OAAO,KAAa,IAExG,WAAW,MAAM,EAAE,YAAY,MAAM,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;GAmCnF"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.workerShares = workerShares;
4
+ const types_1 = require("./types");
5
+ const media_1 = require("./media");
6
+ /** Forward only media operations for the captured agent; keep API keys in the gateway. */
7
+ function workerShares(files, agent, gateway, request = fetch) {
8
+ const minted = new Map();
9
+ return async (attemptId, generation, args) => {
10
+ const { task } = files.scope(attemptId, generation);
11
+ const method = args.method, pathname = args.pathname;
12
+ if (typeof pathname !== 'string' || pathname.length > 4096)
13
+ throw new types_1.OrchestrationError('SHARE_SCOPE_DENIED');
14
+ const key = gateway.gateway.api?.keys?.find(k => k.agents === '*' || k.admin || (Array.isArray(k.agents) && k.agents.includes(agent.id)))?.key;
15
+ if (!key)
16
+ throw new types_1.OrchestrationError('SHARE_NOT_CONFIGURED');
17
+ const body = { ...(args.body ?? {}), agent_id: agent.id, session_id: task.agentSessionId };
18
+ let target;
19
+ if (method === 'GET' && pathname.startsWith('/api/v1/image-catalog?')) {
20
+ target = `/api/v1/image-catalog?agent_id=${encodeURIComponent(agent.id)}&session_id=${encodeURIComponent(task.agentSessionId)}`;
21
+ }
22
+ else if (method === 'POST' && pathname === '/api/v1/shares') {
23
+ if (!Array.isArray(body.refs) || !body.refs.length || body.refs.length > 5)
24
+ throw new types_1.OrchestrationError('INVALID_INPUT');
25
+ body.refs = body.refs.map(ref => {
26
+ if (ref && typeof ref.artifact_id === 'string' && !ref.path)
27
+ return { artifact_id: ref.artifact_id };
28
+ if (!ref || ref.artifact_id)
29
+ throw new types_1.OrchestrationError('SHARE_SCOPE_DENIED');
30
+ return { path: (0, media_1.ingestOrchestrationMedia)(files.agentsRoot, agent.id, `api-${task.agentSessionId}`, files.allowedPath(attemptId, generation, ref.path)) };
31
+ });
32
+ target = pathname;
33
+ }
34
+ else if (method === 'POST' && pathname === '/api/v1/image-artifacts') {
35
+ if (!Array.isArray(body.files) || !body.files.length || body.files.length > 10)
36
+ throw new types_1.OrchestrationError('INVALID_INPUT');
37
+ body.files = body.files.map(path => (0, media_1.ingestOrchestrationMedia)(files.agentsRoot, agent.id, `api-${task.agentSessionId}`, files.allowedPath(attemptId, generation, path)));
38
+ target = pathname;
39
+ }
40
+ else if (method === 'DELETE' && /^\/api\/v1\/shares\/[A-Za-z0-9_-]+$/.test(pathname) && minted.get(pathname.split('/').at(-1)) === task.taskId)
41
+ target = pathname;
42
+ else
43
+ throw new types_1.OrchestrationError('SHARE_SCOPE_DENIED');
44
+ const base = (process.env.GATEWAY_API_URL ?? `http://127.0.0.1:${process.env.PORT ?? '10850'}`).replace(/\/+$/, '');
45
+ const response = await request(`${base}${target}`, { method: String(method), headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${key}` },
46
+ body: method === 'POST' ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(15000) });
47
+ const json = await response.json();
48
+ if (target === '/api/v1/shares' && response.status === 201 && Array.isArray(json.items))
49
+ for (const item of json.items) {
50
+ minted.set(item.share_id, task.taskId);
51
+ if (minted.size > 10000)
52
+ minted.delete(minted.keys().next().value);
53
+ }
54
+ if (method === 'DELETE' && response.ok)
55
+ minted.delete(target.split('/').at(-1));
56
+ return { status: response.status, json };
57
+ };
58
+ }
59
+ //# sourceMappingURL=worker-shares.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-shares.js","sourceRoot":"","sources":["../../src/orchestration/worker-shares.ts"],"names":[],"mappings":";;AAMA,oCAqCC;AA1CD,mCAA6C;AAE7C,mCAAmD;AAEnD,0FAA0F;AAC1F,SAAgB,YAAY,CAAC,KAAgB,EAAE,KAAkB,EAAE,OAAsB,EAAE,UAAwB,KAAK;IACtH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,OAAO,KAAK,EAAE,SAAiB,EAAE,UAAkB,EAAE,IAA6B,EAAE,EAAE;QACpF,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACrD,IAAI,OAAO,QAAQ,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AAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAM,CAAC,CAAC;YACtE,CAAC;QACD,IAAI,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,EAAE;YAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;QACjF,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,121 @@
1
+ export interface WorkflowCheckpoint {
2
+ phase: string;
3
+ evidenceVersion: string;
4
+ nextAction: string;
5
+ checks: Array<{
6
+ id: string;
7
+ outcome: string;
8
+ evidenceVersion: string;
9
+ }>;
10
+ findings: Array<{
11
+ id: string;
12
+ status: 'open' | 'resolved' | 'dismissed';
13
+ summary: string;
14
+ }>;
15
+ review?: {
16
+ id: string;
17
+ kind: 'full' | 'targeted';
18
+ reason?: string;
19
+ };
20
+ }
21
+ export interface TaskWorkflow {
22
+ version: number;
23
+ observedAt: number;
24
+ attemptId: string;
25
+ checkpoint: WorkflowCheckpoint;
26
+ reviews: Array<{
27
+ id: string;
28
+ evidenceVersion: string;
29
+ kind: string;
30
+ }>;
31
+ warning?: string;
32
+ }
33
+ export declare const WORKFLOW_SCHEMA: {
34
+ type: string;
35
+ additionalProperties: boolean;
36
+ properties: {
37
+ phase: {
38
+ type: string;
39
+ maxLength: number;
40
+ };
41
+ evidenceVersion: {
42
+ type: string;
43
+ maxLength: number;
44
+ };
45
+ nextAction: {
46
+ type: string;
47
+ maxLength: number;
48
+ };
49
+ checks: {
50
+ type: string;
51
+ maxItems: number;
52
+ items: {
53
+ type: string;
54
+ additionalProperties: boolean;
55
+ properties: {
56
+ id: {
57
+ type: string;
58
+ maxLength: number;
59
+ };
60
+ outcome: {
61
+ type: string;
62
+ maxLength: number;
63
+ };
64
+ evidenceVersion: {
65
+ type: string;
66
+ maxLength: number;
67
+ };
68
+ };
69
+ required: string[];
70
+ };
71
+ };
72
+ findings: {
73
+ type: string;
74
+ maxItems: number;
75
+ items: {
76
+ type: string;
77
+ additionalProperties: boolean;
78
+ properties: {
79
+ id: {
80
+ type: string;
81
+ maxLength: number;
82
+ };
83
+ status: {
84
+ type: string;
85
+ enum: string[];
86
+ };
87
+ summary: {
88
+ type: string;
89
+ maxLength: number;
90
+ };
91
+ };
92
+ required: string[];
93
+ };
94
+ };
95
+ review: {
96
+ type: string;
97
+ additionalProperties: boolean;
98
+ properties: {
99
+ id: {
100
+ type: string;
101
+ maxLength: number;
102
+ };
103
+ kind: {
104
+ type: string;
105
+ enum: string[];
106
+ };
107
+ reason: {
108
+ type: string;
109
+ maxLength: number;
110
+ };
111
+ };
112
+ required: string[];
113
+ };
114
+ };
115
+ required: string[];
116
+ };
117
+ export declare function parseWorkflow(value: unknown): WorkflowCheckpoint | undefined;
118
+ export declare function advanceWorkflow(previous: TaskWorkflow | undefined, checkpoint: WorkflowCheckpoint, attemptId: string): TaskWorkflow;
119
+ export declare const WORKER_WORKFLOW_RULES = "Work to a verifiable stopping condition, not repeated reassurance. Follow the requested skill's actual steps; do not add a second/native/full review merely because this is delegated work. Track completed verification against the evidence version (commit/tree/document revision), open findings by stable ID, and the next necessary action. Use task_report_progress with checkpoint at phase changes, after a review, after resolving findings, and before finalization; use ordinary text progress for short tasks. This is internal bookkeeping, not a request to message the user each time.\nFor a defect, trace the user's actual entry path and test the integration that fails before adding extra defensive layers. A missing helper/export is not proof of the original behavior regression. Check contradictory review findings against reachable code before changing anything. A completed full review is followed by fixes and targeted verification of affected behavior; another full review needs new substantial risk or an explicit user request, not just \"one final check\". Keep unresolved findings visible; do not suppress real defects to finish faster.\nChoose checks appropriate to the work and machine capacity. Reuse successful checks only for unchanged relevant evidence. Batch related fixes and formatting before commit/push to avoid repeated full-suite hooks. Never bypass required checks, security boundaries or user approvals. Once required work and verification are complete, return the result with evidence and remaining limitations; optional polish or an advisory checkpoint must not restart completed phases. Advisory guidance is fallible: prefer newer direct evidence over stale claims that an earlier fix was already proven. These rules apply equally to native subagents you delegate to.";
120
+ export declare const AGENT_WORKFLOW_RULES = "Preserve the user's requested workflow without adding review rounds or widening its scope. A requested skill owns its procedure; do not append a mandatory second/native review unless the user or the actual skill requires it. Supervise from the latest task_status checkpoint (phase, evidenceVersion, checks and findings), not old progress prose or tool names. Worker checkpoints are reports, not independently verified facts. If evidence is missing or superseded, ask for a fresh checkpoint rather than declaring an old fix correct or forbidding relevant investigation. Advice should name the changed evidence, unresolved finding or concrete next step; do not repeatedly say finish/open PR/run review when those steps are already complete. Do not mistake an idle tool sample for a stall or a browser command from an earlier phase for current work. Keep user updates separate from internal supervision.";
121
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/orchestration/workflow.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxE,QAAQ,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5F,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrE;AACD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;I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