@xopcai/xopc 0.0.161 → 0.0.162

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 (233) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-o7GRljfD.js → activity-store-hpcNv9MZ.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9R3szLMc.js → agent-avatar-dicebear-Zf9UQEmQ.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-DfVkZlHc.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-jSTqFMq9.js → api-Dnatri09.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-D81cyE76.js → app-management-settings-panel-BBTR9wJP.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-Ct6bZQCV.js → appearance-settings-C2zpLCHD.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-BMtAa4Ra.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-CfD7AZKn.js → archive-plugin-9eR_ODY1.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CP_Gaxt3.js → attachment-load-DPuWYUeX.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-BGKM_NDZ.js → automation-suggestion-card-Dw49OJRl.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-page-BiSAMYTr.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-IPr2EVnS.js → binary-plugins-BdkJpDFm.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-B6aHEGA6.js → block-editor-CAi7SXYU.js} +47 -47
  16. package/dist/gateway/static/root/assets/browser-settings-page-DHmaEJS2.js +8 -0
  17. package/dist/gateway/static/root/assets/browser-workflow-inputs-Dx6wkGz1.js +1 -0
  18. package/dist/gateway/static/root/assets/browser-workflows-page-Skertc-A.js +3 -0
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-B5wSgf4f.js +2 -0
  20. package/dist/gateway/static/root/assets/{capability-presets-api-CCX9-LjU.js → capability-presets-api-CNFl7dM3.js} +1 -1
  21. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DyvFZwBj.js +2 -0
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-MmLMLDWf.js → channel-recipient-api-DYQyGDw4.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-settings-BBKEqDZn.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-status-swr-Drk110ve.js +1 -0
  25. package/dist/gateway/static/root/assets/{connector-logo-BbjzIs87.js → connector-logo-Bng6kxYF.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-HpgaUDQ1.js +2 -0
  27. package/dist/gateway/static/root/assets/desktop-pet-Bpf6oegd.js +1 -0
  28. package/dist/gateway/static/root/assets/{desktop-pet-settings-DQLqGLc0.js → desktop-pet-settings-BVUyefSd.js} +1 -1
  29. package/dist/gateway/static/root/assets/{directory-picker-path-field-ClsiXhmz.js → directory-picker-path-field-DjSZAPz_.js} +1 -1
  30. package/dist/gateway/static/root/assets/{dreaming-settings-CjMPPdzg.js → dreaming-settings-CAZk2AM4.js} +3 -3
  31. package/dist/gateway/static/root/assets/{extension-debug-page-57eizjhB.js → extension-debug-page-C2F6vTTd.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-page-CsbSb3u1.js → extension-page-AnIt4bn4.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-settings-page-DKA9-lyP.js → extension-settings-page-CLSc6682.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-config-api-DIPJuzBZ.js → gateway-config-api-DLFyZv33.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-settings-CDLqAQY7.js → gateway-settings-DnQAA-qq.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-startup-retry-DrfSJtvT.js → gateway-startup-retry-DbzLyJ3R.js} +1 -1
  37. package/dist/gateway/static/root/assets/goal-create-dialog-DrnKFC6M.js +1 -0
  38. package/dist/gateway/static/root/assets/goal-detail-page-Cw1hpJkZ.js +4 -0
  39. package/dist/gateway/static/root/assets/{goals-config-api-lGC10UkU.js → goals-config-api-REmr3QCr.js} +1 -1
  40. package/dist/gateway/static/root/assets/goals-page-BDGkTVma.js +2 -0
  41. package/dist/gateway/static/root/assets/{goals-settings-BWq0pdrA.js → goals-settings-Dz0F3uRO.js} +1 -1
  42. package/dist/gateway/static/root/assets/{heartbeat-settings-D4o8BJVv.js → heartbeat-settings-CQFY5gYs.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-C8JkTS6d.js +199 -0
  44. package/dist/gateway/static/root/assets/index-hmrG55qg.css +1 -0
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6T2QYehS.js → keyboard-shortcuts-settings-BnOQXU5k.js} +1 -1
  46. package/dist/gateway/static/root/assets/local-app-workbench-page-Bdef1b7F.js +2 -0
  47. package/dist/gateway/static/root/assets/{local-apps-page-DCjg2K9f.js → local-apps-page-KsOtWOyM.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-Dar-xqQr.js → locale-store-0lpYdNDr.js} +1 -1
  49. package/dist/gateway/static/root/assets/{logs-page-CyYCBqym.js → logs-page-CwLPgrWh.js} +3 -3
  50. package/dist/gateway/static/root/assets/{markdown-split-rt1XO43g.js → markdown-split-D5GRg10r.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-Bwo8CJuh.js → media-plugins-C1ryULGs.js} +1 -1
  52. package/dist/gateway/static/root/assets/messages-BwQ3WssU.js +5 -0
  53. package/dist/gateway/static/root/assets/{notes-page-Dp-pkX7d.js → notes-page-CIeZ1_DT.js} +1 -1
  54. package/dist/gateway/static/root/assets/notes-workbench-Cf06q19x.js +4 -0
  55. package/dist/gateway/static/root/assets/{page-tabs-CzZ4iKOb.js → page-tabs-Caj1-E_X.js} +1 -1
  56. package/dist/gateway/static/root/assets/{preview-open-alternatives-3E_Qa-58.js → preview-open-alternatives-DKwEce-9.js} +1 -1
  57. package/dist/gateway/static/root/assets/{product-open-page-B2T48Sbt.js → product-open-page-B90ZskkN.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-SHTurM4t.js +1 -0
  59. package/dist/gateway/static/root/assets/projects-page-BcC2qUAw.js +1 -0
  60. package/dist/gateway/static/root/assets/remote-access-hub-6vGefBHv.js +1 -0
  61. package/dist/gateway/static/root/assets/save-bar-controls-BDYt53uQ.js +1 -0
  62. package/dist/gateway/static/root/assets/{schedule-field-TkqUL3wm.js → schedule-field-Bcdni4Pj.js} +1 -1
  63. package/dist/gateway/static/root/assets/{schema-form-DC-iU5IG.js → schema-form-D7oCARF7.js} +1 -1
  64. package/dist/gateway/static/root/assets/sessions-page-C5014a53.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-CDY3ZI1K.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-collapsible-section-Dpqth3oA.js → settings-collapsible-section-6eNF8Jey.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-form-section-CNqF6IwY.js → settings-form-section-CARTHCxH.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DkvwitK_.js → settings-loading-skeleton-DEwYqESe.js} +1 -1
  69. package/dist/gateway/static/root/assets/settings-page-B6vVdHeQ.js +1 -0
  70. package/dist/gateway/static/root/assets/{settings-page-layout-DWvNgISx.js → settings-page-layout-D3srt5Bi.js} +1 -1
  71. package/dist/gateway/static/root/assets/setup-status-panel-z-rF0Hdg.js +1 -0
  72. package/dist/gateway/static/root/assets/{share-preview-page-DGpSPW-n.js → share-preview-page-Ck9SxiXw.js} +1 -1
  73. package/dist/gateway/static/root/assets/shares-settings-CHZFXE_d.js +1 -0
  74. package/dist/gateway/static/root/assets/skill-reload-api-B7p2QNXt.js +1 -0
  75. package/dist/gateway/static/root/assets/skills-page-ncw3tX9P.js +2 -0
  76. package/dist/gateway/static/root/assets/{system-settings-panel-8TxxSbUw.js → system-settings-panel-DLBUQSk2.js} +1 -1
  77. package/dist/gateway/static/root/assets/{theme-store-B5FzMWOx.js → theme-store-C1oaqeD2.js} +1 -1
  78. package/dist/gateway/static/root/assets/{typed-models-lib-DEGtSA5h.js → typed-models-lib-Divbg_C4.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-channel-catalog-BDU6FneG.js → use-channel-catalog-CP9a_rAf.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-context-page-iYfeSLKI.js +1 -0
  81. package/dist/gateway/static/root/assets/voice-api-key-field-CrwkicvT.js +1 -0
  82. package/dist/gateway/static/root/assets/work-discovery-page-BQWxyPg8.js +1 -0
  83. package/dist/gateway/static/root/assets/work-item-detail-page-50ZzGay5.js +1 -0
  84. package/dist/gateway/static/root/assets/work-page-DPqEahx7.js +1 -0
  85. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cwi8Pz7n.js → workflow-run-setup-panel-DbDPYQwB.js} +2 -2
  86. package/dist/gateway/static/root/assets/workflows-page-C3eIC5HZ.js +11 -0
  87. package/dist/gateway/static/root/index.html +7 -7
  88. package/dist/package.js +1 -1
  89. package/dist/src/agent/agent-manager.d.ts +1 -0
  90. package/dist/src/agent/agent-manager.js +1 -0
  91. package/dist/src/agent/client-error-format.js +3 -3
  92. package/dist/src/agent/outcomes/task-evaluation.d.ts +20 -0
  93. package/dist/src/agent/outcomes/task-evaluation.js +48 -0
  94. package/dist/src/agent/outcomes/task-verifier.d.ts +29 -0
  95. package/dist/src/agent/outcomes/task-verifier.js +71 -0
  96. package/dist/src/agent/prompt/memory/index.js +1 -1
  97. package/dist/src/agent/prompt/service-prompt-builder.js +32 -1
  98. package/dist/src/agent/service.js +1 -0
  99. package/dist/src/agent/service.types.d.ts +1 -0
  100. package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +1 -7
  101. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +2 -73
  102. package/dist/src/agent/tools/browser/tool/schemas.d.ts +1 -13
  103. package/dist/src/agent/tools/browser/tool/schemas.js +1 -9
  104. package/dist/src/agent/tools/browser-recipe-tool.d.ts +12 -0
  105. package/dist/src/agent/tools/browser-recipe-tool.js +113 -0
  106. package/dist/src/agent/tools/factory.d.ts +2 -0
  107. package/dist/src/agent/tools/factory.js +2 -0
  108. package/dist/src/agent/tools/index.d.ts +1 -0
  109. package/dist/src/agent/tools/index.js +2 -1
  110. package/dist/src/automations/domain/types.d.ts +13 -0
  111. package/dist/src/automations/domain/validation.d.ts +44 -24
  112. package/dist/src/automations/domain/validation.js +27 -18
  113. package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -1
  114. package/dist/src/automations/draft/automation-draft-validator.js +1 -0
  115. package/dist/src/automations/service/action-executor.d.ts +1 -0
  116. package/dist/src/automations/service/action-executor.js +22 -0
  117. package/dist/src/browser/index.d.ts +0 -1
  118. package/dist/src/browser/index.js +1 -2
  119. package/dist/src/browser/pipeline/runner.d.ts +9 -2
  120. package/dist/src/browser/pipeline/runner.js +151 -105
  121. package/dist/src/browser/pipeline/schema.d.ts +21 -15
  122. package/dist/src/browser/pipeline/schema.js +93 -99
  123. package/dist/src/browser/recipes/index.d.ts +3 -0
  124. package/dist/src/browser/recipes/index.js +3 -0
  125. package/dist/src/browser/recipes/repository.d.ts +13 -0
  126. package/dist/src/browser/recipes/repository.js +81 -0
  127. package/dist/src/browser/recipes/runtime-service.d.ts +6 -0
  128. package/dist/src/browser/recipes/runtime-service.js +30 -0
  129. package/dist/src/browser/recipes/service.d.ts +36 -0
  130. package/dist/src/browser/recipes/service.js +186 -0
  131. package/dist/src/browser/recipes/types.d.ts +36 -0
  132. package/dist/src/browser/recipes/types.js +1 -0
  133. package/dist/src/cli/commands/browser-cli-helpers.js +6 -12
  134. package/dist/src/cli/commands/browser.js +4 -3
  135. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  136. package/dist/src/config/agent-profile.js +1 -1
  137. package/dist/src/config/schema.d.ts +3 -3
  138. package/dist/src/config/schema.js +21 -21
  139. package/dist/src/gateway/agents-admin.js +1 -1
  140. package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
  141. package/dist/src/gateway/hono/routes/browser-workflows.d.ts +3 -0
  142. package/dist/src/gateway/hono/routes/browser-workflows.js +78 -0
  143. package/dist/src/gateway/hono/routes/home.js +1 -0
  144. package/dist/src/gateway/hono/routes/index.js +4 -0
  145. package/dist/src/gateway/hono/routes/interaction-state.d.ts +3 -0
  146. package/dist/src/gateway/hono/routes/interaction-state.js +45 -0
  147. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  148. package/dist/src/gateway/hono/routes/memory.js +33 -4
  149. package/dist/src/gateway/hono/routes/task-outcomes.d.ts +3 -0
  150. package/dist/src/gateway/hono/routes/task-outcomes.js +109 -0
  151. package/dist/src/gateway/hono/routes/you.d.ts +10 -2
  152. package/dist/src/gateway/hono/routes/you.js +184 -28
  153. package/dist/src/gateway/service/run-gateway-agent.js +84 -0
  154. package/dist/src/gateway/service.d.ts +3 -0
  155. package/dist/src/gateway/service.js +14 -0
  156. package/dist/src/proactive/insight-repository.d.ts +2 -0
  157. package/dist/src/proactive/insight-repository.js +5 -2
  158. package/dist/src/proactive/run-processor.js +22 -1
  159. package/dist/src/proactive/types.d.ts +2 -0
  160. package/dist/src/proactive/value-score.d.ts +13 -0
  161. package/dist/src/proactive/value-score.js +30 -0
  162. package/dist/src/share/share-types.js +5 -5
  163. package/dist/src/share/site-share-types.d.ts +1 -1
  164. package/dist/src/share/site-share-types.js +5 -5
  165. package/dist/src/storage/sqlite/index.d.ts +3 -0
  166. package/dist/src/storage/sqlite/index.js +4 -1
  167. package/dist/src/storage/sqlite/interaction-state-repository.d.ts +17 -0
  168. package/dist/src/storage/sqlite/interaction-state-repository.js +60 -0
  169. package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
  170. package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +45 -0
  171. package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +24 -0
  172. package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +14 -0
  173. package/dist/src/storage/sqlite/migrations/056_task_verification.sql +6 -0
  174. package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +11 -0
  175. package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +3 -0
  176. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  177. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  178. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  179. package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +17 -0
  180. package/dist/src/storage/sqlite/relationship-settings-repository.js +64 -0
  181. package/dist/src/storage/sqlite/schema.js +1 -1
  182. package/dist/src/storage/sqlite/schema.sql +46 -0
  183. package/dist/src/storage/sqlite/task-outcome-repository.d.ts +90 -0
  184. package/dist/src/storage/sqlite/task-outcome-repository.js +138 -0
  185. package/dist/src/user-context/interaction-state.d.ts +13 -0
  186. package/dist/src/user-context/interaction-state.js +69 -0
  187. package/dist/src/user-context/memory-use-audit.d.ts +10 -0
  188. package/dist/src/user-context/memory-use-audit.js +25 -0
  189. package/dist/src/user-context/personal-playbook.d.ts +11 -0
  190. package/dist/src/user-context/personal-playbook.js +41 -0
  191. package/dist/src/user-context/projection.d.ts +4 -0
  192. package/dist/src/user-context/projection.js +5 -1
  193. package/dist/src/user-context/relationship-continuity.d.ts +14 -0
  194. package/dist/src/user-context/relationship-continuity.js +51 -0
  195. package/package.json +1 -1
  196. package/dist/gateway/static/root/assets/action-boundary-settings-panel-BIVBUiNT.js +0 -1
  197. package/dist/gateway/static/root/assets/agents-_qbUaYbs.js +0 -2
  198. package/dist/gateway/static/root/assets/apps-page-0sPqD0FK.js +0 -1
  199. package/dist/gateway/static/root/assets/automations-page-BxWBuBsE.js +0 -6
  200. package/dist/gateway/static/root/assets/browser-settings-page-C499b9AH.js +0 -8
  201. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dva9SiPK.js +0 -2
  202. package/dist/gateway/static/root/assets/channels-settings-DNAU7u9o.js +0 -1
  203. package/dist/gateway/static/root/assets/channels-status-swr-CIOH7tgn.js +0 -1
  204. package/dist/gateway/static/root/assets/connectors-page-TwiBp8vY.js +0 -2
  205. package/dist/gateway/static/root/assets/desktop-pet-CYH5ZSXy.js +0 -1
  206. package/dist/gateway/static/root/assets/goal-create-dialog-Q3B0E-0s.js +0 -1
  207. package/dist/gateway/static/root/assets/goal-detail-page-C5VAK04G.js +0 -4
  208. package/dist/gateway/static/root/assets/goals-page-BJb-5IYw.js +0 -2
  209. package/dist/gateway/static/root/assets/index-CkUHH170.css +0 -1
  210. package/dist/gateway/static/root/assets/index-vq_cJZJC.js +0 -199
  211. package/dist/gateway/static/root/assets/local-app-workbench-page-euH17Kvb.js +0 -2
  212. package/dist/gateway/static/root/assets/messages-CxySDn9d.js +0 -5
  213. package/dist/gateway/static/root/assets/models-hub-panel-DObxxjc9.js +0 -2
  214. package/dist/gateway/static/root/assets/notes-workbench-CCb4RXcZ.js +0 -4
  215. package/dist/gateway/static/root/assets/project-detail-page-BvEcriRC.js +0 -1
  216. package/dist/gateway/static/root/assets/projects-page-B_e79MRJ.js +0 -1
  217. package/dist/gateway/static/root/assets/remote-access-hub-DGcqnYfR.js +0 -1
  218. package/dist/gateway/static/root/assets/save-bar-controls-CkeKasGm.js +0 -1
  219. package/dist/gateway/static/root/assets/sessions-page-DQZhrDJ8.js +0 -1
  220. package/dist/gateway/static/root/assets/settings-advanced-gate-BkdeN99Y.js +0 -1
  221. package/dist/gateway/static/root/assets/settings-page-qPG7I2zd.js +0 -1
  222. package/dist/gateway/static/root/assets/setup-status-panel-lwRAh9aw.js +0 -1
  223. package/dist/gateway/static/root/assets/shares-settings-BGj9IVUr.js +0 -1
  224. package/dist/gateway/static/root/assets/skill-reload-api-B2UBAs5U.js +0 -1
  225. package/dist/gateway/static/root/assets/skills-page-DdjzFZ8I.js +0 -2
  226. package/dist/gateway/static/root/assets/user-context-page-BTTZpAGV.js +0 -1
  227. package/dist/gateway/static/root/assets/voice-api-key-field-DuDQd-WU.js +0 -1
  228. package/dist/gateway/static/root/assets/work-discovery-page-BUVkVCsW.js +0 -1
  229. package/dist/gateway/static/root/assets/work-item-detail-page-DeEPPu4n.js +0 -1
  230. package/dist/gateway/static/root/assets/work-page-DQNUyTUq.js +0 -1
  231. package/dist/gateway/static/root/assets/workflows-page-BIy4wrzO.js +0 -11
  232. package/dist/src/browser/pipeline/source.d.ts +0 -9
  233. package/dist/src/browser/pipeline/source.js +0 -77
@@ -0,0 +1,113 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ //#region src/agent/tools/browser-recipe-tool.ts
3
+ const BrowserRecipeToolSchema = Type.Object({
4
+ action: Type.Union([
5
+ Type.Literal("list"),
6
+ Type.Literal("get"),
7
+ Type.Literal("save"),
8
+ Type.Literal("enable"),
9
+ Type.Literal("disable"),
10
+ Type.Literal("delete"),
11
+ Type.Literal("run")
12
+ ]),
13
+ recipeId: Type.Optional(Type.String({ description: "Workflow id for get, enable, disable, delete, or run." })),
14
+ yaml: Type.Optional(Type.String({ description: "Canonical Browser Recipe v1 YAML generated internally when saving." })),
15
+ args: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: "Typed workflow inputs for a run." }))
16
+ });
17
+ function result(text, details) {
18
+ return {
19
+ content: [{
20
+ type: "text",
21
+ text
22
+ }],
23
+ details
24
+ };
25
+ }
26
+ function presentWorkflow(recipe) {
27
+ if (!recipe) return void 0;
28
+ return {
29
+ id: recipe.id,
30
+ name: recipe.name,
31
+ description: recipe.description,
32
+ enabled: recipe.status === "published",
33
+ risk: recipe.risk,
34
+ domains: recipe.domains
35
+ };
36
+ }
37
+ function createBrowserRecipeTool(deps) {
38
+ return {
39
+ name: "browser_recipe",
40
+ label: "Browser Automation",
41
+ description: "Create and manage reusable browser automations for the user. Use save after a successful browser_use sequence when the user asks to save or repeat it. The yaml field is an internal Browser Recipe document: apiVersion must be xopc.ai/browser-recipe/v1; include kebab-case id, user-facing name and description, risk, exact domains, typed args, and pipeline. Every pipeline step has exactly one action with an object value. Use ${{ args.name }} for variable inputs. New saves are enabled immediately. Only delete on an explicit user request. Users should never need to write or see this YAML.",
42
+ parameters: BrowserRecipeToolSchema,
43
+ async execute(_toolCallId, params, signal) {
44
+ const service = deps.getBrowserRecipeService();
45
+ if (!service) return result("Browser automation is not available.", { ok: false });
46
+ if (params.action === "list") {
47
+ const recipes = service.list();
48
+ return result(recipes.length === 0 ? "No browser automations." : recipes.map((recipe) => `- ${recipe.id}: ${recipe.name} (${recipe.status === "published" ? "enabled" : "paused"}, ${recipe.risk})`).join("\n"), { workflows: recipes.map(presentWorkflow) });
49
+ }
50
+ const recipeId = params.recipeId?.trim();
51
+ if (params.action === "save") {
52
+ if (!params.yaml?.trim()) return result("The internal definition is required to save a browser automation.", { ok: false });
53
+ try {
54
+ const recipe = service.save({ yaml: params.yaml });
55
+ return result(`Saved and enabled browser automation: ${recipe.name}`, {
56
+ ok: true,
57
+ workflow: presentWorkflow(recipe)
58
+ });
59
+ } catch (error) {
60
+ const message = error instanceof Error ? error.message : String(error);
61
+ return result(`Could not save browser automation: ${message}`, {
62
+ ok: false,
63
+ error: message
64
+ });
65
+ }
66
+ }
67
+ if (!recipeId) return result("recipeId is required.", { ok: false });
68
+ if (params.action === "get") {
69
+ const recipe = service.get(recipeId);
70
+ if (!recipe) return result(`Browser automation not found: ${recipeId}`, { ok: false });
71
+ return result(`${recipe.name}\nEnabled: ${recipe.status === "published" ? "yes" : "no"}\nRisk: ${recipe.risk}\nDomains: ${recipe.domains.join(", ")}`, { workflow: presentWorkflow(recipe) });
72
+ }
73
+ if (params.action === "enable" || params.action === "disable") {
74
+ const recipe = service.get(recipeId);
75
+ if (!recipe) return result(`Browser automation not found: ${recipeId}`, { ok: false });
76
+ const saved = service.save({
77
+ yaml: recipe.yaml,
78
+ status: params.action === "enable" ? "published" : "disabled",
79
+ expectedId: recipe.id
80
+ });
81
+ return result(`${saved.name} is now ${params.action === "enable" ? "enabled" : "disabled"}.`, {
82
+ ok: true,
83
+ workflow: presentWorkflow(saved)
84
+ });
85
+ }
86
+ if (params.action === "delete") try {
87
+ const removed = service.remove(recipeId);
88
+ return result(removed ? `Deleted browser automation: ${recipeId}` : `Browser automation not found: ${recipeId}`, { ok: removed });
89
+ } catch (error) {
90
+ const message = error instanceof Error ? error.message : String(error);
91
+ return result(`Could not delete browser automation: ${message}`, {
92
+ ok: false,
93
+ error: message
94
+ });
95
+ }
96
+ try {
97
+ const run = await service.runAndWait(recipeId, params.args ?? {}, signal);
98
+ return result(run.status === "succeeded" ? `Browser automation ${recipeId} completed.` : `Browser automation ${recipeId} ${run.status}: ${run.error ?? "No error details"}`, {
99
+ ok: run.status === "succeeded",
100
+ run
101
+ });
102
+ } catch (error) {
103
+ const message = error instanceof Error ? error.message : String(error);
104
+ return result(`Browser automation failed: ${message}`, {
105
+ ok: false,
106
+ error: message
107
+ });
108
+ }
109
+ }
110
+ };
111
+ }
112
+ //#endregion
113
+ export { createBrowserRecipeTool };
@@ -15,6 +15,7 @@ import type { MemoryManager } from '../memory/manager.js';
15
15
  import type { SessionStore } from '../../session/store.js';
16
16
  import type { GatewayClarifyRequestFn } from './clarify-tool.js';
17
17
  import type { AutomationService } from '../../automations/index.js';
18
+ import type { BrowserRecipeService } from '../../browser/recipes/index.js';
18
19
  import type { NotesService } from '../../notes/index.js';
19
20
  import type { ProjectService } from '../../projects/index.js';
20
21
  import type { WorkItemService } from '../../work-items/index.js';
@@ -48,6 +49,7 @@ export interface ToolFactoryDeps {
48
49
  };
49
50
  /** Gateway: enables the `automation` tool. */
50
51
  getAutomationService?: () => AutomationService | undefined;
52
+ getBrowserRecipeService?: () => BrowserRecipeService | undefined;
51
53
  /** Gateway: enables the `xopc_use` product-object tool. */
52
54
  getNotesService?: () => NotesService | undefined;
53
55
  getProjectService?: () => ProjectService | undefined;
@@ -32,6 +32,7 @@ import "./delegate-tool.js";
32
32
  import { createWorkflowTool } from "./workflow-tool.js";
33
33
  import "./execute-code-tool.js";
34
34
  import { createAutomationTool } from "./automation-tool.js";
35
+ import { createBrowserRecipeTool } from "./browser-recipe-tool.js";
35
36
  import { createGoalTool } from "./goal-tool.js";
36
37
  import { createXopcUseTool } from "./xopc-use-tool.js";
37
38
  import { createSkillViewTool, createSkillsListTool } from "./skills-tools.js";
@@ -284,6 +285,7 @@ var AgentToolsFactory = class {
284
285
  getCurrentSessionKey: () => this.deps.getCurrentContext()?.sessionKey
285
286
  })] : [],
286
287
  ...this.deps.getAutomationService ? [createAutomationTool({ getAutomationService: this.deps.getAutomationService })] : [],
288
+ ...browserEnabled && this.deps.getBrowserRecipeService ? [createBrowserRecipeTool({ getBrowserRecipeService: this.deps.getBrowserRecipeService })] : [],
287
289
  ...this.deps.getProjectService || this.deps.getNotesService || this.deps.getWorkItemService || this.deps.getLocalAppService ? [createXopcUseTool({
288
290
  getConfig: () => this.deps.getConfig?.(),
289
291
  getCurrentAgentId: () => options.agentId,
@@ -27,6 +27,7 @@ export { createDelegateTool, DEFAULT_DELEGATE_TOOLS, DELEGATE_BLOCKED_TOOLS, } f
27
27
  export { createWorkflowTool, type WorkflowToolDeps, type WorkflowToolInput } from './workflow-tool.js';
28
28
  export { createExecuteCodeTool, buildSandboxToolMap, SANDBOX_ALLOWED_TOOLS, } from './execute-code-tool.js';
29
29
  export { createAutomationTool, type AutomationToolDeps } from './automation-tool.js';
30
+ export { createBrowserRecipeTool } from './browser-recipe-tool.js';
30
31
  export { createGoalTool, type GoalToolOptions } from './goal-tool.js';
31
32
  export { createXopcUseTool, type XopcUseToolDeps, type XopcUseToolInput } from './xopc-use-tool.js';
32
33
  export { createSkillsListTool, createSkillViewTool, type SkillsToolsDeps } from './skills-tools.js';
@@ -31,6 +31,7 @@ import { DEFAULT_DELEGATE_TOOLS, DELEGATE_BLOCKED_TOOLS, createDelegateTool } fr
31
31
  import { createWorkflowTool } from "./workflow-tool.js";
32
32
  import { SANDBOX_ALLOWED_TOOLS, buildSandboxToolMap, createExecuteCodeTool } from "./execute-code-tool.js";
33
33
  import { createAutomationTool } from "./automation-tool.js";
34
+ import { createBrowserRecipeTool } from "./browser-recipe-tool.js";
34
35
  import { createGoalTool } from "./goal-tool.js";
35
36
  import { createXopcUseTool } from "./xopc-use-tool.js";
36
37
  import { createSkillViewTool, createSkillsListTool } from "./skills-tools.js";
@@ -42,4 +43,4 @@ import { createCodeIntelligenceTools } from "../code-intelligence/tools.js";
42
43
  import { resolveImageModelConfigForTool } from "../image/tool-model-config.js";
43
44
  import { createImageTool } from "./image-tool.js";
44
45
  import { createImageGenerateTool, resolveImageGenerationModelConfigForTool } from "./image-generate-tool.js";
45
- export { BrowserManager, DEFAULT_DELEGATE_TOOLS, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, DEFAULT_TOOL_METADATA, DEFAULT_WEB_EXTRACT_MAX_LENGTH, DELEGATE_BLOCKED_TOOLS, GREP_MAX_LINE_LENGTH, MAX_RAW_HTML_CHARS_FOR_WEB_EXTRACT, SANDBOX_ALLOWED_TOOLS, TodoStore, ToolConcurrencyController, assertBrowserUrlAllowed, buildSandboxToolMap, createApplyPatchTool, createAutomationTool, createClarifyTool, createCodeIntelligenceTools, createComposioTools, createCreateShareTool, createCuratedMemoryTool, createDelegateTool, createDesktopPetTool, createDreamingTool, createExecCommandTool, createExecuteCodeTool, createFindTool, createGoalTool, createGrepTool, createImageGenerateTool, createImageTool, createListDirTool, createMemoryGetTool, createMemorySearchTool, createMessageTool, createReadFileTool, createReadMediaTool, createSendMediaTool, createSessionSearchTool, createSessionStatusTool, createSkillInstallTool, createSkillManageTool, createSkillViewTool, createSkillsListTool, createTodoTool, createToolManualTool, createUpdatePlanTool, createWebExtractTool, createWebFetchTool, createWebSearchTool, createWorkflowTool, createWriteFileTool, createXopcUseTool, findTool, formatSize, fuzzyFindText, generateDiffString, getToolMetadata, grepTool, isShareToolAvailable, listDirTool, normalizeForFuzzyMatch, normalizeToLF, resolveImageGenerationModelConfigForTool, resolveImageModelConfigForTool, resolveToolLockMode, restoreLineEndings, stripBom, stripHtmlBoilerplate, truncateHead, truncateLine, truncateTail, writeFileTool };
46
+ export { BrowserManager, DEFAULT_DELEGATE_TOOLS, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, DEFAULT_TOOL_METADATA, DEFAULT_WEB_EXTRACT_MAX_LENGTH, DELEGATE_BLOCKED_TOOLS, GREP_MAX_LINE_LENGTH, MAX_RAW_HTML_CHARS_FOR_WEB_EXTRACT, SANDBOX_ALLOWED_TOOLS, TodoStore, ToolConcurrencyController, assertBrowserUrlAllowed, buildSandboxToolMap, createApplyPatchTool, createAutomationTool, createBrowserRecipeTool, createClarifyTool, createCodeIntelligenceTools, createComposioTools, createCreateShareTool, createCuratedMemoryTool, createDelegateTool, createDesktopPetTool, createDreamingTool, createExecCommandTool, createExecuteCodeTool, createFindTool, createGoalTool, createGrepTool, createImageGenerateTool, createImageTool, createListDirTool, createMemoryGetTool, createMemorySearchTool, createMessageTool, createReadFileTool, createReadMediaTool, createSendMediaTool, createSessionSearchTool, createSessionStatusTool, createSkillInstallTool, createSkillManageTool, createSkillViewTool, createSkillsListTool, createTodoTool, createToolManualTool, createUpdatePlanTool, createWebExtractTool, createWebFetchTool, createWebSearchTool, createWorkflowTool, createWriteFileTool, createXopcUseTool, findTool, formatSize, fuzzyFindText, generateDiffString, getToolMetadata, grepTool, isShareToolAvailable, listDirTool, normalizeForFuzzyMatch, normalizeToLF, resolveImageGenerationModelConfigForTool, resolveImageModelConfigForTool, resolveToolLockMode, restoreLineEndings, stripBom, stripHtmlBoilerplate, truncateHead, truncateLine, truncateTail, writeFileTool };
@@ -43,6 +43,11 @@ export type AutomationAction = {
43
43
  concurrency?: number;
44
44
  maxSubagents?: number;
45
45
  timeoutSeconds?: number;
46
+ } | {
47
+ kind: 'browser_recipe';
48
+ recipeId: string;
49
+ args?: Record<string, unknown>;
50
+ timeoutSeconds?: number;
46
51
  };
47
52
  export type AutomationAfterRun = {
48
53
  kind: 'none';
@@ -151,6 +156,14 @@ export interface AutomationDeps {
151
156
  workflowRunService?: {
152
157
  startWorkflowRun(params: StartWorkflowRunServiceParams): Promise<WorkflowRunServiceResult>;
153
158
  };
159
+ browserRecipeService?: {
160
+ runAndWait(recipeId: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<{
161
+ id: string;
162
+ status: 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
163
+ result?: unknown;
164
+ error?: string;
165
+ }>;
166
+ };
154
167
  onRunCompleted?: (run: AutomationRun) => void;
155
168
  }
156
169
  export interface AutomationActionOutcome {
@@ -58,6 +58,11 @@ export declare const AutomationActionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
58
58
  concurrency: z.ZodOptional<z.ZodNumber>;
59
59
  maxSubagents: z.ZodOptional<z.ZodNumber>;
60
60
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
61
+ }, z.core.$strict>, z.ZodObject<{
62
+ kind: z.ZodLiteral<"browser_recipe">;
63
+ recipeId: z.ZodString;
64
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
65
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
61
66
  }, z.core.$strict>], "kind">;
62
67
  export declare const AutomationAfterRunSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
68
  kind: z.ZodLiteral<"none">;
@@ -85,12 +90,12 @@ export declare const AutomationStateSchema: z.ZodObject<{
85
90
  runningRunId: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
86
91
  lastRunAtMs: z.ZodOptional<z.ZodNumber>;
87
92
  lastRunStatus: z.ZodOptional<z.ZodEnum<{
88
- queued: "queued";
89
- running: "running";
90
- succeeded: "succeeded";
91
93
  failed: "failed";
92
94
  cancelled: "cancelled";
93
95
  timeout: "timeout";
96
+ succeeded: "succeeded";
97
+ running: "running";
98
+ queued: "queued";
94
99
  }>>;
95
100
  lastError: z.ZodOptional<z.ZodString>;
96
101
  consecutiveFailures: z.ZodOptional<z.ZodNumber>;
@@ -148,6 +153,11 @@ export declare const AutomationSchema: z.ZodObject<{
148
153
  concurrency: z.ZodOptional<z.ZodNumber>;
149
154
  maxSubagents: z.ZodOptional<z.ZodNumber>;
150
155
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
156
+ }, z.core.$strict>, z.ZodObject<{
157
+ kind: z.ZodLiteral<"browser_recipe">;
158
+ recipeId: z.ZodString;
159
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
160
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
151
161
  }, z.core.$strict>], "kind">;
152
162
  safety: z.ZodOptional<z.ZodObject<{
153
163
  mode: z.ZodEnum<{
@@ -175,12 +185,12 @@ export declare const AutomationSchema: z.ZodObject<{
175
185
  runningRunId: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
176
186
  lastRunAtMs: z.ZodOptional<z.ZodNumber>;
177
187
  lastRunStatus: z.ZodOptional<z.ZodEnum<{
178
- queued: "queued";
179
- running: "running";
180
- succeeded: "succeeded";
181
188
  failed: "failed";
182
189
  cancelled: "cancelled";
183
190
  timeout: "timeout";
191
+ succeeded: "succeeded";
192
+ running: "running";
193
+ queued: "queued";
184
194
  }>>;
185
195
  lastError: z.ZodOptional<z.ZodString>;
186
196
  consecutiveFailures: z.ZodOptional<z.ZodNumber>;
@@ -213,6 +223,11 @@ export declare const CreateAutomationSchema: z.ZodObject<{
213
223
  concurrency: z.ZodOptional<z.ZodNumber>;
214
224
  maxSubagents: z.ZodOptional<z.ZodNumber>;
215
225
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
226
+ }, z.core.$strict>, z.ZodObject<{
227
+ kind: z.ZodLiteral<"browser_recipe">;
228
+ recipeId: z.ZodString;
229
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
230
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
216
231
  }, z.core.$strict>], "kind">;
217
232
  description: z.ZodOptional<z.ZodString>;
218
233
  trigger: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -268,12 +283,12 @@ export declare const CreateAutomationSchema: z.ZodObject<{
268
283
  runningRunId: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
269
284
  lastRunAtMs: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
270
285
  lastRunStatus: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
271
- queued: "queued";
272
- running: "running";
273
- succeeded: "succeeded";
274
286
  failed: "failed";
275
287
  cancelled: "cancelled";
276
288
  timeout: "timeout";
289
+ succeeded: "succeeded";
290
+ running: "running";
291
+ queued: "queued";
277
292
  }>>>;
278
293
  lastError: z.ZodOptional<z.ZodOptional<z.ZodString>>;
279
294
  consecutiveFailures: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
@@ -305,7 +320,27 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
305
320
  concurrency: z.ZodOptional<z.ZodNumber>;
306
321
  maxSubagents: z.ZodOptional<z.ZodNumber>;
307
322
  timeoutSeconds: z.ZodOptional<z.ZodNumber>;
323
+ }, z.core.$strict>, z.ZodObject<{
324
+ kind: z.ZodLiteral<"browser_recipe">;
325
+ recipeId: z.ZodString;
326
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
327
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
308
328
  }, z.core.$strict>], "kind">>;
329
+ state: z.ZodOptional<z.ZodDefault<z.ZodObject<{
330
+ nextRunAtMs: z.ZodOptional<z.ZodNumber>;
331
+ runningRunId: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
332
+ lastRunAtMs: z.ZodOptional<z.ZodNumber>;
333
+ lastRunStatus: z.ZodOptional<z.ZodEnum<{
334
+ failed: "failed";
335
+ cancelled: "cancelled";
336
+ timeout: "timeout";
337
+ succeeded: "succeeded";
338
+ running: "running";
339
+ queued: "queued";
340
+ }>>;
341
+ lastError: z.ZodOptional<z.ZodString>;
342
+ consecutiveFailures: z.ZodOptional<z.ZodNumber>;
343
+ }, z.core.$strict>>>;
309
344
  description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
310
345
  trigger: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
311
346
  kind: z.ZodLiteral<"manual">;
@@ -332,21 +367,6 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
332
367
  source: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
333
368
  payloadMatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
334
369
  }, z.core.$strict>], "kind">>;
335
- state: z.ZodOptional<z.ZodDefault<z.ZodObject<{
336
- nextRunAtMs: z.ZodOptional<z.ZodNumber>;
337
- runningRunId: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
338
- lastRunAtMs: z.ZodOptional<z.ZodNumber>;
339
- lastRunStatus: z.ZodOptional<z.ZodEnum<{
340
- queued: "queued";
341
- running: "running";
342
- succeeded: "succeeded";
343
- failed: "failed";
344
- cancelled: "cancelled";
345
- timeout: "timeout";
346
- }>>;
347
- lastError: z.ZodOptional<z.ZodString>;
348
- consecutiveFailures: z.ZodOptional<z.ZodNumber>;
349
- }, z.core.$strict>>>;
350
370
  safety: z.ZodOptional<z.ZodOptional<z.ZodObject<{
351
371
  mode: z.ZodEnum<{
352
372
  suggest_only: "suggest_only";
@@ -61,24 +61,33 @@ const WorkflowRunInputEnvelopeSchema = z.object({
61
61
  variables: z.record(z.string(), z.unknown()).optional(),
62
62
  context: z.record(z.string(), z.unknown()).optional()
63
63
  }).strict();
64
- const AutomationActionSchema = z.discriminatedUnion("kind", [z.object({
65
- kind: z.literal("agent"),
66
- agentId: optionalTrimmedString(64),
67
- instruction: nonEmptyString.max(5e4),
68
- workingDirectory: optionalTrimmedString(4096),
69
- model: optionalTrimmedString(100),
70
- timeoutSeconds: z.number().int().min(1).max(86400).optional()
71
- }).strict(), z.object({
72
- kind: z.literal("workflow"),
73
- workflowId: nonEmptyString.max(200),
74
- agentId: optionalTrimmedString(64),
75
- input: z.unknown().optional(),
76
- inputEnvelope: WorkflowRunInputEnvelopeSchema.optional(),
77
- goal: optionalTrimmedString(5e3),
78
- concurrency: z.number().int().min(1).max(50).optional(),
79
- maxSubagents: z.number().int().min(1).max(100).optional(),
80
- timeoutSeconds: z.number().int().min(1).max(86400).optional()
81
- }).strict()]);
64
+ const AutomationActionSchema = z.discriminatedUnion("kind", [
65
+ z.object({
66
+ kind: z.literal("agent"),
67
+ agentId: optionalTrimmedString(64),
68
+ instruction: nonEmptyString.max(5e4),
69
+ workingDirectory: optionalTrimmedString(4096),
70
+ model: optionalTrimmedString(100),
71
+ timeoutSeconds: z.number().int().min(1).max(86400).optional()
72
+ }).strict(),
73
+ z.object({
74
+ kind: z.literal("workflow"),
75
+ workflowId: nonEmptyString.max(200),
76
+ agentId: optionalTrimmedString(64),
77
+ input: z.unknown().optional(),
78
+ inputEnvelope: WorkflowRunInputEnvelopeSchema.optional(),
79
+ goal: optionalTrimmedString(5e3),
80
+ concurrency: z.number().int().min(1).max(50).optional(),
81
+ maxSubagents: z.number().int().min(1).max(100).optional(),
82
+ timeoutSeconds: z.number().int().min(1).max(86400).optional()
83
+ }).strict(),
84
+ z.object({
85
+ kind: z.literal("browser_recipe"),
86
+ recipeId: nonEmptyString.max(100),
87
+ args: z.record(z.string(), z.unknown()).optional(),
88
+ timeoutSeconds: z.number().int().min(1).max(86400).optional()
89
+ }).strict()
90
+ ]);
82
91
  const AutomationAfterRunSchema = z.discriminatedUnion("kind", [
83
92
  z.object({ kind: z.literal("none") }).strict(),
84
93
  z.object({ kind: z.literal("saveToSession") }).strict(),
@@ -34,6 +34,11 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
34
34
  concurrency?: number;
35
35
  maxSubagents?: number;
36
36
  timeoutSeconds?: number;
37
+ } | {
38
+ kind: "browser_recipe";
39
+ recipeId: string;
40
+ args?: Record<string, unknown>;
41
+ timeoutSeconds?: number;
37
42
  };
38
43
  description?: string;
39
44
  trigger?: {
@@ -84,7 +89,7 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
84
89
  nextRunAtMs?: number;
85
90
  runningRunId?: string;
86
91
  lastRunAtMs?: number;
87
- lastRunStatus?: "queued" | "running" | "succeeded" | "failed" | "cancelled" | "timeout";
92
+ lastRunStatus?: "failed" | "cancelled" | "timeout" | "succeeded" | "running" | "queued";
88
93
  lastError?: string;
89
94
  consecutiveFailures?: number;
90
95
  };
@@ -90,6 +90,7 @@ function summarizeTrigger(trigger) {
90
90
  }
91
91
  function summarizeAction(action) {
92
92
  if (action.kind === "workflow") return `Starts workflow ${action.workflowId}.`;
93
+ if (action.kind === "browser_recipe") return `Runs browser automation ${action.recipeId}.`;
93
94
  return action.agentId ? `Runs agent ${action.agentId}.` : "Runs the default agent.";
94
95
  }
95
96
  function repairPatchNeedsApproval(patch) {
@@ -4,6 +4,7 @@ export declare class AutomationActionExecutor {
4
4
  setDeps(deps: AutomationDeps): void;
5
5
  execute(automation: Automation, run: AutomationRun, signal: AbortSignal): Promise<AutomationActionOutcome>;
6
6
  private executeWithoutTimeout;
7
+ private executeBrowserRecipe;
7
8
  private executeAgent;
8
9
  private executeWorkflow;
9
10
  }
@@ -56,8 +56,30 @@ var AutomationActionExecutor = class {
56
56
  error: "Automation run was cancelled"
57
57
  };
58
58
  if (automation.action.kind === "workflow") return this.executeWorkflow(automation, automation.action, run);
59
+ if (automation.action.kind === "browser_recipe") return this.executeBrowserRecipe(automation, automation.action, signal);
59
60
  return this.executeAgent(automation, automation.action);
60
61
  }
62
+ async executeBrowserRecipe(automation, action, signal) {
63
+ const safetyMode = automation.safety?.mode ?? "auto_apply";
64
+ if (safetyMode !== "auto_apply") return {
65
+ status: "succeeded",
66
+ summary: `${safetyMode === "suggest_only" ? "Suggest only" : "Ask before applying"}: Browser automation ${action.recipeId} was not run.`
67
+ };
68
+ const service = this.deps.browserRecipeService;
69
+ if (!service) return {
70
+ status: "failed",
71
+ error: "Browser automation is not available"
72
+ };
73
+ const run = await service.runAndWait(action.recipeId, action.args ?? {}, signal);
74
+ if (run.status === "succeeded") return {
75
+ status: "succeeded",
76
+ summary: `Browser automation ${action.recipeId} completed: ${JSON.stringify(run.result ?? null).slice(0, 3500)}`
77
+ };
78
+ return {
79
+ status: run.status === "cancelled" ? "cancelled" : "failed",
80
+ error: run.error ?? `Browser automation ${action.recipeId} ${run.status}`
81
+ };
82
+ }
61
83
  async executeAgent(automation, action) {
62
84
  const agentService = this.deps.agentService;
63
85
  if (!agentService?.turnDispatcher?.processDirect) return {
@@ -13,5 +13,4 @@ export { createBrowserActionRegistry } from './actions/registry.js';
13
13
  export type { BrowserActionName, BrowserActionContext, BrowserActionHandler, BrowserActionRegistry as BrowserActionRegistryType, BrowserActionResult, BrowserArtifact, BrowserDiagnostics, } from './actions/types.js';
14
14
  export { parseBrowserPipeline, type PipelineDocument, type PipelineStep } from './pipeline/schema.js';
15
15
  export { runBrowserPipeline, validateBrowserPipeline } from './pipeline/runner.js';
16
- export { loadBrowserPipelineSource } from './pipeline/source.js';
17
16
  export { resolveTemplate, resolveTemplateDeep } from './pipeline/template.js';
@@ -12,6 +12,5 @@ import { WEBDRIVER_OVERRIDE_SCRIPT, buildLocalStealthArgs, buildStealthArgs, gen
12
12
  import { resolveTemplate, resolveTemplateDeep } from "./pipeline/template.js";
13
13
  import { createBrowserActionRegistry } from "./actions/registry.js";
14
14
  import { parseBrowserPipeline } from "./pipeline/schema.js";
15
- import { loadBrowserPipelineSource } from "./pipeline/source.js";
16
15
  import { runBrowserPipeline, validateBrowserPipeline } from "./pipeline/runner.js";
17
- export { BrowserBackSchema, BrowserCdpSchema, BrowserClickSchema, BrowserCloseSchema, BrowserConsoleSchema, BrowserDialogSchema, BrowserGetImagesSchema, BrowserManager, BrowserNavigateSchema, BrowserNotReadyError, BrowserPressSchema, BrowserScreenshotSchema, BrowserScrollSchema, BrowserSnapshotSchema, BrowserTypeSchema, BrowserVisionSchema, CdpSupervisor, WEBDRIVER_OVERRIDE_SCRIPT, assertBrowserUrlAllowed, buildBrowserSetupDeepLink, buildLocalStealthArgs, buildStealthArgs, checkBotDetection, checkBrowserReadiness, checkPostRedirectUrl, cleanupOrphanProcesses, containsApiKeyPattern, createBrowserActionRegistry, generateFingerprintSeed, generateMousePath, generateScrollPlan, generateTypingPlan, humanizedClick, humanizedFill, humanizedPress, humanizedScroll, isAlwaysBlockedUrl, loadBrowserPipelineSource, makeExecutable, parseBrowserPipeline, removeQuarantineAttr, resolveBrowserBackendFromConfig, resolveBrowserCommandTimeoutMs, resolveHumanConfig, resolveTemplate, resolveTemplateDeep, runBrowserPipeline, snapshotSummaryHeader, startTracing, stopTracing, truncateSnapshotAtBoundary, validateBrowserPipeline };
16
+ export { BrowserBackSchema, BrowserCdpSchema, BrowserClickSchema, BrowserCloseSchema, BrowserConsoleSchema, BrowserDialogSchema, BrowserGetImagesSchema, BrowserManager, BrowserNavigateSchema, BrowserNotReadyError, BrowserPressSchema, BrowserScreenshotSchema, BrowserScrollSchema, BrowserSnapshotSchema, BrowserTypeSchema, BrowserVisionSchema, CdpSupervisor, WEBDRIVER_OVERRIDE_SCRIPT, assertBrowserUrlAllowed, buildBrowserSetupDeepLink, buildLocalStealthArgs, buildStealthArgs, checkBotDetection, checkBrowserReadiness, checkPostRedirectUrl, cleanupOrphanProcesses, containsApiKeyPattern, createBrowserActionRegistry, generateFingerprintSeed, generateMousePath, generateScrollPlan, generateTypingPlan, humanizedClick, humanizedFill, humanizedPress, humanizedScroll, isAlwaysBlockedUrl, makeExecutable, parseBrowserPipeline, removeQuarantineAttr, resolveBrowserBackendFromConfig, resolveBrowserCommandTimeoutMs, resolveHumanConfig, resolveTemplate, resolveTemplateDeep, runBrowserPipeline, snapshotSummaryHeader, startTracing, stopTracing, truncateSnapshotAtBoundary, validateBrowserPipeline };
@@ -13,8 +13,15 @@ export interface ValidateResult {
13
13
  }
14
14
  export interface RunBrowserPipelineOptions {
15
15
  dryRun?: boolean;
16
- sourceLocation?: string;
16
+ onStep?: (event: BrowserRecipeStepEvent) => void;
17
+ }
18
+ export interface BrowserRecipeStepEvent {
19
+ index: number;
20
+ scope: string;
21
+ action: string;
22
+ status: 'started' | 'completed' | 'failed';
23
+ elapsedMs?: number;
24
+ error?: string;
17
25
  }
18
26
  export declare function validateBrowserPipeline(yamlSource: string, registry?: BrowserActionRegistry): ValidateResult;
19
- export declare function validateBrowserPipelineSource(yamlSource: string, registry?: BrowserActionRegistry, sourceLocation?: string): Promise<ValidateResult>;
20
27
  export declare function runBrowserPipeline(yamlSource: string, argOverrides: Record<string, unknown>, ctx: BrowserActionContext, registry: BrowserActionRegistry, options?: RunBrowserPipelineOptions): Promise<BrowserActionResult>;