@0xmaxma/claude-gateway 2.0.9 → 2.0.11

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 (404) hide show
  1. package/README.md +16 -1
  2. package/config.template.json +6 -4
  3. package/dist/agent/runner.d.ts +126 -11
  4. package/dist/agent/runner.d.ts.map +1 -1
  5. package/dist/agent/runner.js +102 -10
  6. package/dist/agent/runner.js.map +1 -1
  7. package/dist/agent/skill-learning/reviewer.d.ts.map +1 -1
  8. package/dist/agent/skill-learning/reviewer.js +1 -2
  9. package/dist/agent/skill-learning/reviewer.js.map +1 -1
  10. package/dist/api/browser-bindings-router.d.ts +6 -0
  11. package/dist/api/browser-bindings-router.d.ts.map +1 -0
  12. package/dist/api/browser-bindings-router.js +150 -0
  13. package/dist/api/browser-bindings-router.js.map +1 -0
  14. package/dist/api/capabilities.d.ts +53 -0
  15. package/dist/api/capabilities.d.ts.map +1 -0
  16. package/dist/api/capabilities.js +66 -0
  17. package/dist/api/capabilities.js.map +1 -0
  18. package/dist/api/connectors-router.js +1 -1
  19. package/dist/api/connectors-router.js.map +1 -1
  20. package/dist/api/gateway-router.d.ts.map +1 -1
  21. package/dist/api/gateway-router.js +38 -14
  22. package/dist/api/gateway-router.js.map +1 -1
  23. package/dist/api/gateway-version.d.ts +9 -0
  24. package/dist/api/gateway-version.d.ts.map +1 -0
  25. package/dist/api/gateway-version.js +57 -0
  26. package/dist/api/gateway-version.js.map +1 -0
  27. package/dist/api/jev-router.d.ts +8 -0
  28. package/dist/api/jev-router.d.ts.map +1 -0
  29. package/dist/api/jev-router.js +128 -0
  30. package/dist/api/jev-router.js.map +1 -0
  31. package/dist/api/router.d.ts.map +1 -1
  32. package/dist/api/router.js +53 -6
  33. package/dist/api/router.js.map +1 -1
  34. package/dist/api/voice-router.d.ts.map +1 -1
  35. package/dist/api/voice-router.js +42 -3
  36. package/dist/api/voice-router.js.map +1 -1
  37. package/dist/automation/browser-command.d.ts +79 -0
  38. package/dist/automation/browser-command.d.ts.map +1 -0
  39. package/dist/automation/browser-command.js +118 -0
  40. package/dist/automation/browser-command.js.map +1 -0
  41. package/dist/automation/browser-outcome.d.ts +3 -0
  42. package/dist/automation/browser-outcome.d.ts.map +1 -0
  43. package/dist/automation/browser-outcome.js +78 -0
  44. package/dist/automation/browser-outcome.js.map +1 -0
  45. package/dist/automation/browser-steps.d.ts +33 -0
  46. package/dist/automation/browser-steps.d.ts.map +1 -0
  47. package/dist/automation/browser-steps.js +293 -0
  48. package/dist/automation/browser-steps.js.map +1 -0
  49. package/dist/automation/browser-trace.d.ts +60 -0
  50. package/dist/automation/browser-trace.d.ts.map +1 -0
  51. package/dist/automation/browser-trace.js +24 -0
  52. package/dist/automation/browser-trace.js.map +1 -0
  53. package/dist/automation/browser-use.d.ts +210 -0
  54. package/dist/automation/browser-use.d.ts.map +1 -0
  55. package/dist/automation/browser-use.js +1271 -0
  56. package/dist/automation/browser-use.js.map +1 -0
  57. package/dist/automation/command-speech.d.ts +33 -0
  58. package/dist/automation/command-speech.d.ts.map +1 -0
  59. package/dist/automation/command-speech.js +117 -0
  60. package/dist/automation/command-speech.js.map +1 -0
  61. package/dist/automation/command-steps.d.ts +35 -0
  62. package/dist/automation/command-steps.d.ts.map +1 -0
  63. package/dist/automation/command-steps.js +155 -0
  64. package/dist/automation/command-steps.js.map +1 -0
  65. package/dist/automation/computer-choice-ids.d.ts +7 -0
  66. package/dist/automation/computer-choice-ids.d.ts.map +1 -0
  67. package/dist/automation/computer-choice-ids.js +24 -0
  68. package/dist/automation/computer-choice-ids.js.map +1 -0
  69. package/dist/automation/computer-command.d.ts +126 -0
  70. package/dist/automation/computer-command.d.ts.map +1 -0
  71. package/dist/automation/computer-command.js +313 -0
  72. package/dist/automation/computer-command.js.map +1 -0
  73. package/dist/automation/computer-outcome.d.ts +8 -0
  74. package/dist/automation/computer-outcome.d.ts.map +1 -0
  75. package/dist/automation/computer-outcome.js +82 -0
  76. package/dist/automation/computer-outcome.js.map +1 -0
  77. package/dist/automation/computer-policy.d.ts +84 -0
  78. package/dist/automation/computer-policy.d.ts.map +1 -0
  79. package/dist/automation/computer-policy.js +56 -0
  80. package/dist/automation/computer-policy.js.map +1 -0
  81. package/dist/automation/computer-safety.d.ts +27 -0
  82. package/dist/automation/computer-safety.d.ts.map +1 -0
  83. package/dist/automation/computer-safety.js +47 -0
  84. package/dist/automation/computer-safety.js.map +1 -0
  85. package/dist/automation/computer-steps.d.ts +20 -0
  86. package/dist/automation/computer-steps.d.ts.map +1 -0
  87. package/dist/automation/computer-steps.js +251 -0
  88. package/dist/automation/computer-steps.js.map +1 -0
  89. package/dist/automation/computer-use.d.ts +315 -0
  90. package/dist/automation/computer-use.d.ts.map +1 -0
  91. package/dist/automation/computer-use.js +864 -0
  92. package/dist/automation/computer-use.js.map +1 -0
  93. package/dist/automation/direct-command.d.ts +51 -0
  94. package/dist/automation/direct-command.d.ts.map +1 -0
  95. package/dist/automation/direct-command.js +152 -0
  96. package/dist/automation/direct-command.js.map +1 -0
  97. package/dist/automation/interrupt.d.ts +4 -0
  98. package/dist/automation/interrupt.d.ts.map +1 -0
  99. package/dist/automation/interrupt.js +26 -0
  100. package/dist/automation/interrupt.js.map +1 -0
  101. package/dist/build-provenance.json +4 -4
  102. package/dist/child-env-exclusions.d.ts +4 -0
  103. package/dist/child-env-exclusions.d.ts.map +1 -0
  104. package/dist/child-env-exclusions.js +23 -0
  105. package/dist/child-env-exclusions.js.map +1 -0
  106. package/dist/cli/startup-diagnostics.d.ts.map +1 -1
  107. package/dist/cli/startup-diagnostics.js +19 -0
  108. package/dist/cli/startup-diagnostics.js.map +1 -1
  109. package/dist/config/loader.d.ts.map +1 -1
  110. package/dist/config/loader.js +4 -0
  111. package/dist/config/loader.js.map +1 -1
  112. package/dist/config/reload-policy.d.ts.map +1 -1
  113. package/dist/config/reload-policy.js +2 -1
  114. package/dist/config/reload-policy.js.map +1 -1
  115. package/dist/jev/automatic-browser-bindings.d.ts +15 -0
  116. package/dist/jev/automatic-browser-bindings.d.ts.map +1 -0
  117. package/dist/jev/automatic-browser-bindings.js +115 -0
  118. package/dist/jev/automatic-browser-bindings.js.map +1 -0
  119. package/dist/jev/browser-connector.d.ts +29 -0
  120. package/dist/jev/browser-connector.d.ts.map +1 -0
  121. package/dist/jev/browser-connector.js +347 -0
  122. package/dist/jev/browser-connector.js.map +1 -0
  123. package/dist/jev/browser-consent.d.ts +6 -0
  124. package/dist/jev/browser-consent.d.ts.map +1 -0
  125. package/dist/jev/browser-consent.js +50 -0
  126. package/dist/jev/browser-consent.js.map +1 -0
  127. package/dist/jev/browser-contract.d.ts +215 -0
  128. package/dist/jev/browser-contract.d.ts.map +1 -0
  129. package/dist/jev/browser-contract.js +10 -0
  130. package/dist/jev/browser-contract.js.map +1 -0
  131. package/dist/jev/browser-evidence-summary.d.ts +73 -0
  132. package/dist/jev/browser-evidence-summary.d.ts.map +1 -0
  133. package/dist/jev/browser-evidence-summary.js +22 -0
  134. package/dist/jev/browser-evidence-summary.js.map +1 -0
  135. package/dist/jev/browser-module-import.d.ts +3 -0
  136. package/dist/jev/browser-module-import.d.ts.map +1 -0
  137. package/dist/jev/browser-module-import.js +6 -0
  138. package/dist/jev/browser-module-import.js.map +1 -0
  139. package/dist/jev/child-env.d.ts +11 -0
  140. package/dist/jev/child-env.d.ts.map +1 -0
  141. package/dist/jev/child-env.js +60 -0
  142. package/dist/jev/child-env.js.map +1 -0
  143. package/dist/jev/computer-connector.d.ts +34 -0
  144. package/dist/jev/computer-connector.d.ts.map +1 -0
  145. package/dist/jev/computer-connector.js +82 -0
  146. package/dist/jev/computer-connector.js.map +1 -0
  147. package/dist/jev/computer-inputs.d.ts +41 -0
  148. package/dist/jev/computer-inputs.d.ts.map +1 -0
  149. package/dist/jev/computer-inputs.js +7 -0
  150. package/dist/jev/computer-inputs.js.map +1 -0
  151. package/dist/jev/index.d.ts +6 -0
  152. package/dist/jev/index.d.ts.map +1 -0
  153. package/dist/jev/index.js +25 -0
  154. package/dist/jev/index.js.map +1 -0
  155. package/dist/jev/relay-grants.d.ts +9 -0
  156. package/dist/jev/relay-grants.d.ts.map +1 -0
  157. package/dist/jev/relay-grants.js +49 -0
  158. package/dist/jev/relay-grants.js.map +1 -0
  159. package/dist/jev/service.d.ts +27 -0
  160. package/dist/jev/service.d.ts.map +1 -0
  161. package/dist/jev/service.js +264 -0
  162. package/dist/jev/service.js.map +1 -0
  163. package/dist/jev/thinking-provider.d.ts +7 -0
  164. package/dist/jev/thinking-provider.d.ts.map +1 -0
  165. package/dist/jev/thinking-provider.js +25 -0
  166. package/dist/jev/thinking-provider.js.map +1 -0
  167. package/dist/jev/types.d.ts +124 -0
  168. package/dist/jev/types.d.ts.map +1 -0
  169. package/dist/jev/types.js +13 -0
  170. package/dist/jev/types.js.map +1 -0
  171. package/dist/jev/validation.d.ts +45 -0
  172. package/dist/jev/validation.d.ts.map +1 -0
  173. package/dist/jev/validation.js +179 -0
  174. package/dist/jev/validation.js.map +1 -0
  175. package/dist/load-dotenv.d.ts.map +1 -1
  176. package/dist/load-dotenv.js +5 -1
  177. package/dist/load-dotenv.js.map +1 -1
  178. package/dist/orchestration/agent-tool-schemas.d.ts.map +1 -1
  179. package/dist/orchestration/agent-tool-schemas.js +12 -7
  180. package/dist/orchestration/agent-tool-schemas.js.map +1 -1
  181. package/dist/orchestration/background-work.d.ts +1 -0
  182. package/dist/orchestration/background-work.d.ts.map +1 -1
  183. package/dist/orchestration/background-work.js +1 -0
  184. package/dist/orchestration/background-work.js.map +1 -1
  185. package/dist/orchestration/bridge.d.ts +4 -0
  186. package/dist/orchestration/bridge.d.ts.map +1 -1
  187. package/dist/orchestration/bridge.js +227 -41
  188. package/dist/orchestration/bridge.js.map +1 -1
  189. package/dist/orchestration/browser-fields.d.ts +25 -0
  190. package/dist/orchestration/browser-fields.d.ts.map +1 -0
  191. package/dist/orchestration/browser-fields.js +23 -0
  192. package/dist/orchestration/browser-fields.js.map +1 -0
  193. package/dist/orchestration/browser-routing.d.ts +1 -1
  194. package/dist/orchestration/browser-routing.d.ts.map +1 -1
  195. package/dist/orchestration/browser-routing.js +7 -3
  196. package/dist/orchestration/browser-routing.js.map +1 -1
  197. package/dist/orchestration/capabilities.d.ts +5 -2
  198. package/dist/orchestration/capabilities.d.ts.map +1 -1
  199. package/dist/orchestration/capabilities.js +24 -24
  200. package/dist/orchestration/capabilities.js.map +1 -1
  201. package/dist/orchestration/channel-controls.js +1 -1
  202. package/dist/orchestration/channel-controls.js.map +1 -1
  203. package/dist/orchestration/cli-skills.d.ts +1 -1
  204. package/dist/orchestration/cli-skills.d.ts.map +1 -1
  205. package/dist/orchestration/cli-skills.js +16 -10
  206. package/dist/orchestration/cli-skills.js.map +1 -1
  207. package/dist/orchestration/computer-end-screenshot.d.ts +11 -0
  208. package/dist/orchestration/computer-end-screenshot.d.ts.map +1 -0
  209. package/dist/orchestration/computer-end-screenshot.js +37 -0
  210. package/dist/orchestration/computer-end-screenshot.js.map +1 -0
  211. package/dist/orchestration/computer-prompt.d.ts +6 -0
  212. package/dist/orchestration/computer-prompt.d.ts.map +1 -0
  213. package/dist/orchestration/computer-prompt.js +24 -0
  214. package/dist/orchestration/computer-prompt.js.map +1 -0
  215. package/dist/orchestration/config.d.ts +17 -0
  216. package/dist/orchestration/config.d.ts.map +1 -1
  217. package/dist/orchestration/config.js +10 -4
  218. package/dist/orchestration/config.js.map +1 -1
  219. package/dist/orchestration/container-tool-schemas.d.ts +47 -3
  220. package/dist/orchestration/container-tool-schemas.d.ts.map +1 -1
  221. package/dist/orchestration/container-tool-schemas.js +41 -6
  222. package/dist/orchestration/container-tool-schemas.js.map +1 -1
  223. package/dist/orchestration/container.d.ts +4 -1
  224. package/dist/orchestration/container.d.ts.map +1 -1
  225. package/dist/orchestration/container.js +48 -29
  226. package/dist/orchestration/container.js.map +1 -1
  227. package/dist/orchestration/context-footprint.d.ts +1 -1
  228. package/dist/orchestration/context-footprint.d.ts.map +1 -1
  229. package/dist/orchestration/context-footprint.js +5 -5
  230. package/dist/orchestration/context-footprint.js.map +1 -1
  231. package/dist/orchestration/control-notification.d.ts +6 -0
  232. package/dist/orchestration/control-notification.d.ts.map +1 -0
  233. package/dist/orchestration/control-notification.js +23 -0
  234. package/dist/orchestration/control-notification.js.map +1 -0
  235. package/dist/orchestration/dashboard-reader-worker.js +2 -2
  236. package/dist/orchestration/dashboard-reader-worker.js.map +1 -1
  237. package/dist/orchestration/execution-observation.d.ts +3 -0
  238. package/dist/orchestration/execution-observation.d.ts.map +1 -1
  239. package/dist/orchestration/execution-observation.js.map +1 -1
  240. package/dist/orchestration/gateway-tasks/browser.d.ts +59 -0
  241. package/dist/orchestration/gateway-tasks/browser.d.ts.map +1 -0
  242. package/dist/orchestration/gateway-tasks/browser.js +426 -0
  243. package/dist/orchestration/gateway-tasks/browser.js.map +1 -0
  244. package/dist/orchestration/gateway-tasks/computer-context.d.ts +6 -0
  245. package/dist/orchestration/gateway-tasks/computer-context.d.ts.map +1 -0
  246. package/dist/orchestration/gateway-tasks/computer-context.js +19 -0
  247. package/dist/orchestration/gateway-tasks/computer-context.js.map +1 -0
  248. package/dist/orchestration/gateway-tasks/computer.d.ts +123 -0
  249. package/dist/orchestration/gateway-tasks/computer.d.ts.map +1 -0
  250. package/dist/orchestration/gateway-tasks/computer.js +519 -0
  251. package/dist/orchestration/gateway-tasks/computer.js.map +1 -0
  252. package/dist/orchestration/gateway-tasks/controller.d.ts +40 -6
  253. package/dist/orchestration/gateway-tasks/controller.d.ts.map +1 -1
  254. package/dist/orchestration/gateway-tasks/controller.js +118 -12
  255. package/dist/orchestration/gateway-tasks/controller.js.map +1 -1
  256. package/dist/orchestration/gateway-tasks/safemode.d.ts.map +1 -1
  257. package/dist/orchestration/gateway-tasks/safemode.js +2 -1
  258. package/dist/orchestration/gateway-tasks/safemode.js.map +1 -1
  259. package/dist/orchestration/jev-gateway.d.ts +25 -0
  260. package/dist/orchestration/jev-gateway.d.ts.map +1 -0
  261. package/dist/orchestration/jev-gateway.js +103 -0
  262. package/dist/orchestration/jev-gateway.js.map +1 -0
  263. package/dist/orchestration/jev-tool.d.ts +45 -0
  264. package/dist/orchestration/jev-tool.d.ts.map +1 -0
  265. package/dist/orchestration/jev-tool.js +10 -0
  266. package/dist/orchestration/jev-tool.js.map +1 -0
  267. package/dist/orchestration/live-execution-input.d.ts +26 -0
  268. package/dist/orchestration/live-execution-input.d.ts.map +1 -0
  269. package/dist/orchestration/live-execution-input.js +70 -0
  270. package/dist/orchestration/live-execution-input.js.map +1 -0
  271. package/dist/orchestration/notification-mailbox.d.ts.map +1 -1
  272. package/dist/orchestration/notification-mailbox.js +5 -2
  273. package/dist/orchestration/notification-mailbox.js.map +1 -1
  274. package/dist/orchestration/process-activity.d.ts +4 -2
  275. package/dist/orchestration/process-activity.d.ts.map +1 -1
  276. package/dist/orchestration/process-activity.js +31 -42
  277. package/dist/orchestration/process-activity.js.map +1 -1
  278. package/dist/orchestration/process-platform.d.ts +72 -0
  279. package/dist/orchestration/process-platform.d.ts.map +1 -0
  280. package/dist/orchestration/process-platform.js +396 -0
  281. package/dist/orchestration/process-platform.js.map +1 -0
  282. package/dist/orchestration/process-supervisor.d.ts +31 -7
  283. package/dist/orchestration/process-supervisor.d.ts.map +1 -1
  284. package/dist/orchestration/process-supervisor.js +89 -61
  285. package/dist/orchestration/process-supervisor.js.map +1 -1
  286. package/dist/orchestration/process-turn.d.ts +8 -0
  287. package/dist/orchestration/process-turn.d.ts.map +1 -1
  288. package/dist/orchestration/process-turn.js +97 -13
  289. package/dist/orchestration/process-turn.js.map +1 -1
  290. package/dist/orchestration/progress-review.d.ts +1 -1
  291. package/dist/orchestration/progress-review.d.ts.map +1 -1
  292. package/dist/orchestration/progress-review.js +5 -1
  293. package/dist/orchestration/progress-review.js.map +1 -1
  294. package/dist/orchestration/report-fidelity.d.ts +31 -0
  295. package/dist/orchestration/report-fidelity.d.ts.map +1 -0
  296. package/dist/orchestration/report-fidelity.js +34 -0
  297. package/dist/orchestration/report-fidelity.js.map +1 -0
  298. package/dist/orchestration/response-errors.d.ts.map +1 -1
  299. package/dist/orchestration/response-errors.js +1 -0
  300. package/dist/orchestration/response-errors.js.map +1 -1
  301. package/dist/orchestration/runtime.d.ts +51 -1
  302. package/dist/orchestration/runtime.d.ts.map +1 -1
  303. package/dist/orchestration/runtime.js +404 -33
  304. package/dist/orchestration/runtime.js.map +1 -1
  305. package/dist/orchestration/skill-catalog-budget.d.ts +6 -0
  306. package/dist/orchestration/skill-catalog-budget.d.ts.map +1 -0
  307. package/dist/orchestration/skill-catalog-budget.js +9 -0
  308. package/dist/orchestration/skill-catalog-budget.js.map +1 -0
  309. package/dist/orchestration/skills.d.ts +4 -2
  310. package/dist/orchestration/skills.d.ts.map +1 -1
  311. package/dist/orchestration/skills.js +44 -3
  312. package/dist/orchestration/skills.js.map +1 -1
  313. package/dist/orchestration/speech.d.ts +1 -1
  314. package/dist/orchestration/speech.d.ts.map +1 -1
  315. package/dist/orchestration/speech.js +1 -1
  316. package/dist/orchestration/store.d.ts +1 -0
  317. package/dist/orchestration/store.d.ts.map +1 -1
  318. package/dist/orchestration/store.js +2 -0
  319. package/dist/orchestration/store.js.map +1 -1
  320. package/dist/orchestration/task-controls.d.ts +78 -8
  321. package/dist/orchestration/task-controls.d.ts.map +1 -1
  322. package/dist/orchestration/task-controls.js +6 -1
  323. package/dist/orchestration/task-controls.js.map +1 -1
  324. package/dist/orchestration/task-questions.js +2 -2
  325. package/dist/orchestration/task-questions.js.map +1 -1
  326. package/dist/orchestration/tasks/automation-session.d.ts +25 -0
  327. package/dist/orchestration/tasks/automation-session.d.ts.map +1 -0
  328. package/dist/orchestration/tasks/automation-session.js +68 -0
  329. package/dist/orchestration/tasks/automation-session.js.map +1 -0
  330. package/dist/orchestration/tasks/driver.d.ts.map +1 -1
  331. package/dist/orchestration/tasks/driver.js +7 -5
  332. package/dist/orchestration/tasks/driver.js.map +1 -1
  333. package/dist/orchestration/tasks/failure.d.ts +6 -0
  334. package/dist/orchestration/tasks/failure.d.ts.map +1 -1
  335. package/dist/orchestration/tasks/failure.js +26 -2
  336. package/dist/orchestration/tasks/failure.js.map +1 -1
  337. package/dist/orchestration/tasks/scheduler.d.ts +1 -1
  338. package/dist/orchestration/tasks/scheduler.d.ts.map +1 -1
  339. package/dist/orchestration/tasks/scheduler.js +3 -1
  340. package/dist/orchestration/tasks/scheduler.js.map +1 -1
  341. package/dist/orchestration/tasks/service.d.ts +68 -7
  342. package/dist/orchestration/tasks/service.d.ts.map +1 -1
  343. package/dist/orchestration/tasks/service.js +647 -45
  344. package/dist/orchestration/tasks/service.js.map +1 -1
  345. package/dist/orchestration/types.d.ts +90 -3
  346. package/dist/orchestration/types.d.ts.map +1 -1
  347. package/dist/orchestration/types.js.map +1 -1
  348. package/dist/safemode/native.d.ts.map +1 -1
  349. package/dist/safemode/native.js +8 -3
  350. package/dist/safemode/native.js.map +1 -1
  351. package/dist/session/claude-bin.d.ts +29 -0
  352. package/dist/session/claude-bin.d.ts.map +1 -1
  353. package/dist/session/claude-bin.js +63 -12
  354. package/dist/session/claude-bin.js.map +1 -1
  355. package/dist/session/codex-extension-discovery.d.ts.map +1 -1
  356. package/dist/session/codex-extension-discovery.js +4 -2
  357. package/dist/session/codex-extension-discovery.js.map +1 -1
  358. package/dist/session/codex-native-mcp-client.d.ts.map +1 -1
  359. package/dist/session/codex-native-mcp-client.js +2 -1
  360. package/dist/session/codex-native-mcp-client.js.map +1 -1
  361. package/dist/session/codex-process.d.ts +4 -0
  362. package/dist/session/codex-process.d.ts.map +1 -1
  363. package/dist/session/codex-process.js +16 -6
  364. package/dist/session/codex-process.js.map +1 -1
  365. package/dist/session/compactor.d.ts.map +1 -1
  366. package/dist/session/compactor.js +1 -2
  367. package/dist/session/compactor.js.map +1 -1
  368. package/dist/session/process.d.ts +18 -0
  369. package/dist/session/process.d.ts.map +1 -1
  370. package/dist/session/process.js +175 -67
  371. package/dist/session/process.js.map +1 -1
  372. package/dist/session/runtime-profile.d.ts +18 -0
  373. package/dist/session/runtime-profile.d.ts.map +1 -1
  374. package/dist/session/runtime-profile.js +23 -0
  375. package/dist/session/runtime-profile.js.map +1 -1
  376. package/dist/session/worker-extensions.d.ts.map +1 -1
  377. package/dist/session/worker-extensions.js +4 -3
  378. package/dist/session/worker-extensions.js.map +1 -1
  379. package/dist/shell/claude-pty-shell.js +5 -4
  380. package/dist/shell/claude-pty-shell.js.map +1 -1
  381. package/dist/types.d.ts +5 -0
  382. package/dist/types.d.ts.map +1 -1
  383. package/dist/ui/dashboard-client.d.ts.map +1 -1
  384. package/dist/ui/dashboard-client.js +33 -3
  385. package/dist/ui/dashboard-client.js.map +1 -1
  386. package/dist/ui/web-ui.js +1 -1
  387. package/dist/utils/paths.d.ts +8 -0
  388. package/dist/utils/paths.d.ts.map +1 -1
  389. package/dist/utils/paths.js +11 -0
  390. package/dist/utils/paths.js.map +1 -1
  391. package/lib/automation/browser-thinking.cjs +9 -0
  392. package/lib/automation/browser-thinking.d.cts +2 -0
  393. package/lib/automation/computer-thinking.cjs +10 -0
  394. package/lib/automation/computer-thinking.d.cts +2 -0
  395. package/lib/automation/index.cjs +47 -0
  396. package/lib/automation/index.d.cts +3 -0
  397. package/lib/automation/reasoning-instructions.cjs +5 -0
  398. package/lib/automation/thinking.cjs +35 -0
  399. package/lib/automation/thinking.d.cts +2 -0
  400. package/mcp/capability-catalog.ts +2 -2
  401. package/mcp/server.ts +1 -1
  402. package/mcp/tools/tasks/module.ts +9 -0
  403. package/mcp/tools/telegram/receiver-server.ts +4 -2
  404. package/package.json +6 -4
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.JEV_EVALUATE_PATH = void 0;
37
+ exports.jsonExceptJevEvaluate = jsonExceptJevEvaluate;
38
+ exports.createJevRouter = createJevRouter;
39
+ const express_1 = __importStar(require("express"));
40
+ const crypto_1 = require("crypto");
41
+ const auth_1 = require("./auth");
42
+ const jev_gateway_1 = require("../orchestration/jev-gateway");
43
+ const types_1 = require("../jev/types");
44
+ exports.JEV_EVALUATE_PATH = '/api/v1/jev/evaluate';
45
+ // The global JSON parser stops at 100kB; maxInputBytes may be configured up to
46
+ // 1 MiB, plus room for agentId/requestId and JSON framing.
47
+ const JEV_BODY_LIMIT = 1048576 + 8192;
48
+ const jevJson = express_1.default.json({ limit: JEV_BODY_LIMIT });
49
+ /** Parses the evaluation body after authentication; parse failures keep the Jev error shape. */
50
+ function jevBody(req, res, next) {
51
+ jevJson(req, res, (error) => {
52
+ if (!error) {
53
+ next();
54
+ return;
55
+ }
56
+ const tooLarge = error.type === 'entity.too.large';
57
+ res.status(tooLarge ? 413 : 400).json({ error: { code: 'JEV_INVALID_REQUEST', message: tooLarge ? 'Jev request body exceeds the gateway limit.' : 'Jev request body is not valid JSON.' } });
58
+ });
59
+ }
60
+ /** The gateway-wide JSON parser, leaving the Jev evaluation body to jevBody. */
61
+ function jsonExceptJevEvaluate() {
62
+ const json = express_1.default.json();
63
+ return (req, res, next) => req.method === 'POST' && req.path === exports.JEV_EVALUATE_PATH ? next() : json(req, res, next);
64
+ }
65
+ /** Evaluation is a paid action. An API key must have write access to its agent. */
66
+ function createJevRouter(config, agents) {
67
+ const router = (0, express_1.Router)();
68
+ router.use('/v1/jev', (req, res, next) => (0, auth_1.createApiAuthMiddleware)(config.gateway.api?.keys ?? [])(req, res, next));
69
+ const allowed = (req, agentId, write) => {
70
+ const key = req.apiKey;
71
+ const current = key && config.gateway.api?.keys.find(k => k.key === key.key);
72
+ return Boolean(current && (write ? (0, auth_1.canWriteAgent)(current, agentId) : (0, auth_1.canAccessAgent)(current, agentId)));
73
+ };
74
+ router.post('/v1/jev/evaluate', jevBody, async (req, res) => {
75
+ const body = req.body;
76
+ const agent = typeof body?.agentId === 'string' ? agents.get(body.agentId) : undefined;
77
+ if (!agent || !allowed(req, agent.id, true)) {
78
+ res.status(403).json({ error: 'ACCESS_DENIED' });
79
+ return;
80
+ }
81
+ if (!body || Object.keys(body).some(key => !['agentId', 'state', 'questions', 'requestId'].includes(key))) {
82
+ res.status(400).json({ error: 'INVALID_REQUEST' });
83
+ return;
84
+ }
85
+ const controller = new AbortController();
86
+ const onClose = () => { if (!res.writableFinished)
87
+ controller.abort(); };
88
+ res.once('close', onClose);
89
+ try {
90
+ const principalId = (0, crypto_1.createHash)('sha256').update(req.apiKey.key).digest('hex');
91
+ // Validate the caller's own ID before deriving the internal one from it.
92
+ if (body.requestId !== undefined && (typeof body.requestId !== 'string' || !/^[\x21-\x7e]{1,256}$/.test(body.requestId)))
93
+ throw new types_1.JevError('INVALID_REQUEST', 'Invalid request ID.');
94
+ const requestId = typeof body.requestId === 'string' ? (0, crypto_1.createHash)('sha256').update(JSON.stringify([principalId, agent.id, body.requestId])).digest('hex') : undefined;
95
+ const result = await (0, jev_gateway_1.gatewayJev)(config).service.evaluate({ state: body.state, questions: body.questions, ...(requestId ? { requestId } : {}) }, {
96
+ principalId, agentId: agent.id, consumer: 'api', signal: controller.signal,
97
+ authorize: () => allowed(req, agent.id, true) && agents.has(agent.id) && (0, jev_gateway_1.jevAllowed)(config, agents.get(agent.id))
98
+ });
99
+ if (!controller.signal.aborted)
100
+ res.json(result);
101
+ }
102
+ catch (error) {
103
+ if (controller.signal.aborted)
104
+ return;
105
+ const e = error instanceof types_1.JevError ? error : new types_1.JevError('PROVIDER_UNAVAILABLE', 'Jev evaluation unavailable.');
106
+ res.status(e.code === 'ACCESS_DENIED' ? 403 : e.code === 'AUTHENTICATION_FAILED' ? 502 : e.code === 'INVALID_REQUEST' ? 400 : e.code === 'REQUEST_CONFLICT' ? 409 : e.code === 'QUOTA_EXCEEDED' ? 402 : e.code === 'RATE_LIMITED' || e.code === 'QUEUE_FULL' ? 429 : e.code === 'DEADLINE_EXCEEDED' ? 504 : 503).json({ error: { code: `JEV_${e.code}`, message: e.message, ...e.metadata } });
107
+ }
108
+ finally {
109
+ res.off('close', onClose);
110
+ }
111
+ });
112
+ router.get('/v1/jev/usage', (req, res) => {
113
+ const agentId = typeof req.query.agentId === 'string' ? req.query.agentId : '';
114
+ if (!agents.has(agentId) || !allowed(req, agentId, false)) {
115
+ res.status(403).json({ error: 'ACCESS_DENIED' });
116
+ return;
117
+ }
118
+ const limit = req.query.limit === undefined ? 50 : Number(req.query.limit), offset = req.query.offset === undefined ? 0 : Number(req.query.offset);
119
+ if (!Number.isInteger(limit) || limit < 1 || limit > 100 || !Number.isSafeInteger(offset) || offset < 0) {
120
+ res.status(400).json({ error: 'INVALID_PAGE' });
121
+ return;
122
+ }
123
+ res.setHeader('Cache-Control', 'no-store');
124
+ res.json((0, jev_gateway_1.gatewayJev)(config).history(agentId, limit, offset));
125
+ });
126
+ return router;
127
+ }
128
+ //# sourceMappingURL=jev-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jev-router.js","sourceRoot":"","sources":["../../src/api/jev-router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,sDAGC;AAED,0CAuCC;AAjED,mDAA2F;AAC3F,mCAAoC;AAEpC,iCAAgF;AAChF,8DAAsE;AACtE,wCAAoD;AAEvC,QAAA,iBAAiB,GAAC,sBAAsB,CAAC;AACtD,+EAA+E;AAC/E,2DAA2D;AAC3D,MAAM,cAAc,GAAC,OAAO,GAAC,IAAI,CAAC;AAClC,MAAM,OAAO,GAAC,iBAAO,CAAC,IAAI,CAAC,EAAC,KAAK,EAAC,cAAc,EAAC,CAAC,CAAC;AACnD,gGAAgG;AAChG,SAAS,OAAO,CAAC,GAAW,EAAC,GAAY,EAAC,IAAiB;IACzD,OAAO,CAAC,GAAG,EAAC,GAAG,EAAC,CAAC,KAAc,EAAC,EAAE;QAChC,IAAG,CAAC,KAAK,EAAC,CAAC;YAAA,IAAI,EAAE,CAAC;YAAA,OAAO;QAAA,CAAC;QAC1B,MAAM,QAAQ,GAAE,KAAwB,CAAC,IAAI,KAAG,kBAAkB,CAAC;QACnE,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAA,CAAC,CAAA,GAAG,CAAA,CAAC,CAAA,GAAG,CAAC,CAAC,IAAI,CAAC,EAAC,KAAK,EAAC,EAAC,IAAI,EAAC,qBAAqB,EAAC,OAAO,EAAC,QAAQ,CAAA,CAAC,CAAA,6CAA6C,CAAA,CAAC,CAAA,qCAAqC,EAAC,EAAC,CAAC,CAAC;IAC/K,CAAC,CAAC,CAAC;AACL,CAAC;AACD,gFAAgF;AAChF,SAAgB,qBAAqB;IACnC,MAAM,IAAI,GAAC,iBAAO,CAAC,IAAI,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,EAAC,GAAG,EAAC,IAA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;AAmUD,wBAAgB,eAAe,CAC7B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACtC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACtC,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,WAAW,EAAE,GAAG,SAAS,CAAC,GACzD,MAAM,CAs5IR"}
@@ -42,6 +42,7 @@ const response_errors_1 = require("../orchestration/response-errors");
42
42
  const voice_settings_router_1 = require("./voice-settings-router");
43
43
  const express_1 = require("express");
44
44
  const identity_1 = require("../orchestration/identity");
45
+ const types_1 = require("../orchestration/types");
45
46
  const crypto_1 = require("crypto");
46
47
  const fs = __importStar(require("fs"));
47
48
  const fsp = __importStar(require("fs/promises"));
@@ -56,7 +57,7 @@ const config_write_lock_1 = require("../config/config-write-lock");
56
57
  const auth_1 = require("./auth");
57
58
  const media_store_1 = require("../history/media-store");
58
59
  const db_1 = require("../history/db");
59
- const types_1 = require("../history/types");
60
+ const types_2 = require("../history/types");
60
61
  const wizard_state_1 = require("./wizard-state");
61
62
  const pending_senders_1 = require("./pending-senders");
62
63
  const create_agent_prompts_1 = require("../agent/create-agent-prompts");
@@ -117,6 +118,12 @@ const SAFE_FILENAME_RE = /^[a-zA-Z0-9._\-() ]+$/;
117
118
  // escape the agent's directory. Clients may pass custom (non-UUID) session ids, so
118
119
  // this preserves that while blocking path traversal.
119
120
  const SESSION_ID_RE = /^[a-zA-Z0-9_-]{1,64}$/;
121
+ // Task and command ids are server/client-generated UUIDs; controlByUser rejects anything else.
122
+ const TASK_CONTROL_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
123
+ const TASK_CONTROL_ERROR_STATUS = {
124
+ INVALID_INPUT: 400, EXECUTION_DENIED: 403, AUTOMATION_SESSION_CLOSED: 410, COMMAND_QUEUE_FULL: 429,
125
+ REVISION_CONFLICT: 409, STATE_CONFLICT: 409, NOTHING_TO_RESUME: 409, IDEMPOTENCY_CONFLICT: 409, ORCHESTRATION_DISABLED: 409,
126
+ };
120
127
  function isValidSessionId(v) {
121
128
  return typeof v === 'string' && SESSION_ID_RE.test(v);
122
129
  }
@@ -623,6 +630,11 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
623
630
  return;
624
631
  }
625
632
  const clientMessageId = client_message_id;
633
+ if (body.execution_task_id !== undefined && !isValidSessionId(body.execution_task_id)) {
634
+ res.status(400).json({ error: 'Invalid execution task' });
635
+ return;
636
+ }
637
+ const executionTaskId = body.execution_task_id;
626
638
  if (message !== undefined && typeof message !== 'string') {
627
639
  res.status(400).json({ error: 'message must be a string if provided' });
628
640
  return;
@@ -811,7 +823,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
811
823
  const inputId = await runner.acceptApiMessage(sessionId, chatIdStr, trimmedMessage, {
812
824
  timeoutMs, allowTools: agentConfigs.get(agentId)?.allow_tools ?? !!apiKey.allow_tools, mediaFiles: validatedMediaFiles, model: modelStr,
813
825
  imageParams: validatedImageParams, videoParams: validatedVideoParams,
814
- requestId, principalId: (0, identity_1.apiPrincipal)(apiKey), clientMessageId,
826
+ requestId, principalId: (0, identity_1.apiPrincipal)(apiKey), clientMessageId, executionTaskId,
815
827
  });
816
828
  res.status(202).json({ status: 'accepted', input_id: inputId, session_id: sessionId, client_message_id: clientMessageId });
817
829
  }
@@ -849,7 +861,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
849
861
  openSseStream(res);
850
862
  const agentCfg = agentConfigs.get(agentId);
851
863
  const allowTools = agentCfg.allow_tools ?? !!apiKey.allow_tools;
852
- onClientDisconnect = await runner.sendApiMessageStream(sessionId, chatIdStr, trimmedMessage, sseCallbacks, { timeoutMs, allowTools, mediaFiles: validatedMediaFiles, model: modelStr, skipUserMessage, imageParams: validatedImageParams, videoParams: validatedVideoParams, requestId, principalId: (0, identity_1.apiPrincipal)(apiKey), clientMessageId });
864
+ onClientDisconnect = await runner.sendApiMessageStream(sessionId, chatIdStr, trimmedMessage, sseCallbacks, { timeoutMs, allowTools, mediaFiles: validatedMediaFiles, model: modelStr, skipUserMessage, imageParams: validatedImageParams, videoParams: validatedVideoParams, requestId, principalId: (0, identity_1.apiPrincipal)(apiKey), clientMessageId, executionTaskId });
853
865
  // Client disconnect — detaches this connection's sink. The turn keeps
854
866
  // running and keeps buffering, so the client can resume it on a new
855
867
  // connection via GET …/sessions/:sessionId/stream?after_seq= (#421).
@@ -896,7 +908,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
896
908
  videoParams: validatedVideoParams,
897
909
  requestId,
898
910
  principalId: (0, identity_1.apiPrincipal)(apiKey),
899
- clientMessageId,
911
+ clientMessageId, executionTaskId,
900
912
  }));
901
913
  }
902
914
  const syncResult = {
@@ -4153,7 +4165,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
4153
4165
  return;
4154
4166
  }
4155
4167
  const { source, rawChatId } = parseHistoryChatId(chatId);
4156
- if (!(0, types_1.isChatChannel)(source)) {
4168
+ if (!(0, types_2.isChatChannel)(source)) {
4157
4169
  res.status(400).json({ error: 'Sessions endpoint only supports telegram/discord/line/slack/whatsapp/whatsapp_cloud chats' });
4158
4170
  return;
4159
4171
  }
@@ -4339,7 +4351,7 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
4339
4351
  return;
4340
4352
  }
4341
4353
  const { source, rawChatId } = parseHistoryChatId(chatId);
4342
- if (!(0, types_1.isChatChannel)(source)) {
4354
+ if (!(0, types_2.isChatChannel)(source)) {
4343
4355
  res.status(400).json({ error: 'Cross-channel messaging only supported for telegram/discord/line/slack/whatsapp/whatsapp_cloud chats' });
4344
4356
  return;
4345
4357
  }
@@ -5188,6 +5200,41 @@ function createApiRouter(agentRunners, agentConfigs, apiKeys, configPath, models
5188
5200
  res.status(403).json({ error: 'Question unavailable for this principal or already answered' });
5189
5201
  }
5190
5202
  });
5203
+ router.post('/v1/agents/:agentId/sessions/:sessionId/tasks/:taskId/control', auth, async (req, res) => {
5204
+ const { agentId, sessionId, taskId } = req.params;
5205
+ const key = req.apiKey, runner = agentRunners.get(agentId);
5206
+ if (!(0, auth_1.canAccessAgent)(key, agentId) || !runner) {
5207
+ res.status(403).json({ error: 'ACCESS_DENIED' });
5208
+ return;
5209
+ }
5210
+ if (!isValidSessionId(sessionId) || !TASK_CONTROL_UUID_RE.test(taskId)) {
5211
+ res.status(400).json({ error: 'INVALID_INPUT' });
5212
+ return;
5213
+ }
5214
+ if (!(runner.getAgentConfig().allow_tools ?? Boolean(key.allow_tools))) {
5215
+ res.status(403).json({ error: 'EXECUTION_DENIED' });
5216
+ return;
5217
+ }
5218
+ const b = req.body;
5219
+ if (!b || Object.keys(b).some(k => !['id', 'action', 'expectedRevision', 'text'].includes(k)) || typeof b.id !== 'string' || !TASK_CONTROL_UUID_RE.test(b.id) || !['pause', 'revise', 'resume', 'agent', 'user'].includes(b.action) || !Number.isSafeInteger(b.expectedRevision) || b.expectedRevision < 1 || (b.action === 'revise' ? (typeof b.text !== 'string' || !b.text.trim() || b.text.length > 4000) : b.text !== undefined)) {
5220
+ res.status(400).json({ error: 'INVALID_INPUT' });
5221
+ return;
5222
+ }
5223
+ try {
5224
+ res.status(202).json({ task: await runner.controlApiTask(sessionId, (0, identity_1.apiPrincipal)(key), taskId, b) });
5225
+ }
5226
+ catch (e) {
5227
+ // Map by code: OrchestrationError messages may carry human-readable detail.
5228
+ const code = e instanceof types_1.OrchestrationError ? e.code : e instanceof Error ? e.message : '';
5229
+ const status = TASK_CONTROL_ERROR_STATUS[code];
5230
+ if (status) {
5231
+ res.status(status).json({ error: code });
5232
+ return;
5233
+ }
5234
+ // Unknown codes (e.g. TASK_NOT_FOUND) stay ACCESS_DENIED so task existence is not revealed.
5235
+ res.status(403).json({ error: 'ACCESS_DENIED' });
5236
+ }
5237
+ });
5191
5238
  router.post('/v1/agents/:agentId/sessions/:sessionId/tasks/:taskId/cancel', auth, async (req, res) => {
5192
5239
  const { agentId, sessionId, taskId } = req.params;
5193
5240
  const key = req.apiKey, runner = agentRunners.get(agentId);