@xopcai/xopc 0.0.420 → 0.0.422
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.
- package/dist/browser-ext/dist/background.js +184 -2
- package/dist/browser-ext/dist/sidepanel.js +9 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DnqOM8GN.js → activity-store-CvJ9rdwP.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1UABT2KS.js → agent-avatar-dicebear-CFP6g4w7.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-display-BHBe88Gu.js +2 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DlGRuKMv.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-C_Dm-u6_.js +1 -0
- package/dist/gateway/static/root/assets/{agents-O7mago-m.js → agents-BdVJHOiK.js} +5 -5
- package/dist/gateway/static/root/assets/{agents-admin-api-CyjykMEh.js → agents-admin-api-Do1Pza0R.js} +1 -1
- package/dist/gateway/static/root/assets/{api-Ddrs70xV.js → api-BQv5dLcH.js} +1 -1
- package/dist/gateway/static/root/assets/{api-C1dxxDZx.js → api-ONg37_fH.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-1j40sJ-z.js +1 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-B4Wqhf4J.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-Dm1kRzKL.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-D1MMk1P7.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-n5lPr79c.js → archive-plugin-p_yLkyaC.js} +1 -1
- package/dist/gateway/static/root/assets/automation-api-DQaWBR03.js +1 -0
- package/dist/gateway/static/root/assets/automation-result-state-CO_243JM.js +1 -0
- package/dist/gateway/static/root/assets/automation-task-card-D2p9qlYE.js +3 -0
- package/dist/gateway/static/root/assets/{automations-page-oLsNzu_6.js → automations-page-Ba64H37d.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BkzC3oIM.js +9 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D9VW7dWP.js → binary-plugins-B-6kyqtt.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C477bTtO.js → block-editor-B5ysJ96n.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CCiYXxmh.js → browser-automation-inputs-C2A3NIt3.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CnbXFw1_.js +3 -0
- package/dist/gateway/static/root/assets/{browser-control-api-Y3fvmeBk.js → browser-control-api-Aj_seKE9.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DjkGahlz.js → browser-settings-page-C7fxPq_z.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-DAyA681v.js → capabilities-BgtCwC_E.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DRVXLssH.js → capabilities-DOTgaSgA.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-m3b9sLFG.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-pYWZtPeU.js +8 -0
- package/dist/gateway/static/root/assets/channels-DGpRM6pj.js +1 -0
- package/dist/gateway/static/root/assets/{chat-agents-api-D5nR_JVe.js → chat-agents-api-EvJ_Wvuc.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-K2t333qv.js → chat-chart-block-BQDbHLcw.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-GF9NIuZN.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CkFG6mA3.js → chat-terminal-dock-DHFTGoEp.js} +2 -2
- package/dist/gateway/static/root/assets/{list-filter-COkzTdOz.js → clipboard-copy-DuJk5WD6.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-Do_66X1B.js → command-palette-api-DPA_yEuy.js} +1 -1
- package/dist/gateway/static/root/assets/composer-payload-handoff-BTjauSNp.js +1 -0
- package/dist/gateway/static/root/assets/{computer-settings-page-DBxOcMko.js → computer-settings-page-BFSSQfcx.js} +1 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-DM2glQN3.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-rWpnchb3.js → connector-service-page-CFvg58qa.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-DIBG72k4.js → connectors-api-CbC6Yht5.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-D7pipFHA.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-Dd3MbG0x.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-7SpSfDSg.js → dependency-picker-DcsHg2ml.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-DldzQT2h.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-CYdI4KxB.js +1 -0
- package/dist/gateway/static/root/assets/{dev-view-store-57HgVuZ6.js → dev-view-store-JiJv585f.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-D8cLc41G.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-D4jMhpka.js → directory-picker-path-field-8WOXv8zw.js} +1 -1
- package/dist/gateway/static/root/assets/discussion-annotation-sync-B-grSe0w.js +1 -0
- package/dist/gateway/static/root/assets/{dist-DNCdG_qB.js → dist-D3lWNSe7.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BsK2LMXQ.js → extension-debug-page-EEQkTNEu.js} +1 -1
- package/dist/gateway/static/root/assets/extension-iframe-host-vlZVeMCY.js +1 -0
- package/dist/gateway/static/root/assets/{extension-marketplace-api-CVJPqJOB.js → extension-marketplace-api-_o2In_al.js} +1 -1
- package/dist/gateway/static/root/assets/extension-page-CPrT111s.js +1 -0
- package/dist/gateway/static/root/assets/{extension-provider-Byrd8Sor.js → extension-provider-B2Mf3FBu.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CznJEgWV.js +1 -0
- package/dist/gateway/static/root/assets/{file-preview-surface-BlprUrIs.js → file-preview-surface-7h8_fZul.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BAmUhiP1.js → gateway-config-swr-DbbNEOKj.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-CsykKL4l.js → gateway-realtime-D20ZrAuM.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-C6sMzYDT.js +1 -0
- package/dist/gateway/static/root/assets/gateway-restart-5ut-lhJm.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-BA5-Uuwx.js → gateway-settings-BCf_cibp.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CtUB3g6N.js → gateway-startup-retry-DlHL0DpH.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-CINf-C6a.js → global-defaults-api-CmODomcV.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-uz22TRB-.js +2 -0
- package/dist/gateway/static/root/assets/image-generation-api-dzPnpUFu.js +1 -0
- package/dist/gateway/static/root/assets/{imports-page-BWShtGRQ.js → imports-page-ChBoNMyE.js} +1 -1
- package/dist/gateway/static/root/assets/index-CSIg7V1A.js +11 -0
- package/dist/gateway/static/root/assets/index-Dv8mUlNN.css +1 -0
- package/dist/gateway/static/root/assets/install-connector-dialog-CNcdQDX0.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CdM4BQwp.js → keyboard-shortcuts-settings-CRbYq2_g.js} +1 -1
- package/dist/gateway/static/root/assets/list-filter-CIPvpfLA.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-04cX5TJu.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CxyRVfjD.js → local-apps-page-fWM0FEhN.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-B9ZPwotC.js → local-session-drafts-ClrSe5mH.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-lIXD1FMw.js → locale-store-VNjH18Dj.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-6GanGLrm.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-BxD_lc4E.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-CJt-i2Dp.js → markdown-view-DLCBYWtx.js} +4 -4
- package/dist/gateway/static/root/assets/{media-plugins-D_bR23mA.js → media-plugins-BvtNwKFb.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Btr7C0hF.js +3 -0
- package/dist/gateway/static/root/assets/model-selector-DYUnp917.js +1 -0
- package/dist/gateway/static/root/assets/{models-hub-cache-za2fWJLg.js → models-hub-cache-_qE7L-_H.js} +1 -1
- package/dist/gateway/static/root/assets/navigation-D62kPsA9.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-bjRZesmS.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D7Jqb75C.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-C_458rv5.js → notes-api-Bxa11X3a.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-D2QpJ3WZ.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-C3X9FLYw.js → oauth-api-DIE4UpP7.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-H81se_3n.js → oauth-provider-connect-B95tiddN.js} +1 -1
- package/dist/gateway/static/root/assets/open-capability-settings-Cvb65hQB.js +1 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-BkAlQ7cB.js → page-context-capture-button-C-QbbwmN.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-ClLgaOaD.js → page-context-draft-BHmOfksL.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-bPV8_tKL.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-BLtHt8fV.js → personal-avatar-nXrmMfrV.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-BCwlYT3F.js +1 -0
- package/dist/gateway/static/root/assets/personal-settings-panel-vkYmXK8h.js +1 -0
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DISHarj8.js → phone-dependencies-card-CZDAxTWv.js} +1 -1
- package/dist/gateway/static/root/assets/phone-model-picker-4Snfs8Hq.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-D8HperfA.js +1 -0
- package/dist/gateway/static/root/assets/{phone-workspace-store-fhnZrgy_.js → phone-workspace-store-Di9R9Ux5.js} +1 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-DJsDu-_8.js +1 -0
- package/dist/gateway/static/root/assets/popover-select-DD8fmrxH.js +1 -0
- package/dist/gateway/static/root/assets/preference-select-fields-C6abaM3k.js +1 -0
- package/dist/gateway/static/root/assets/product-automation-feedback-C74s9Mjz.js +7 -0
- package/dist/gateway/static/root/assets/product-delivery-DRyD9_Xq.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-xn9G4hSI.js → product-open-page-AbDP5w1c.js} +1 -1
- package/dist/gateway/static/root/assets/product-preview-content-CktjvFbc.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-modal-CzsqLwB4.js +2 -0
- package/dist/gateway/static/root/assets/project-detail-page-Cf3tggGP.js +7 -0
- package/dist/gateway/static/root/assets/project-understanding-jmhFbHch.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-jMgZiFnO.js +1 -0
- package/dist/gateway/static/root/assets/{providers-api-CzVkFKFg.js → providers-api-CJBYFKAK.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-0jxahBMo.js → recording-upload-Dl9a5yOV.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-n8TwtJ_j.js → registry-api-BwkbPUYu.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-cZpBi4Rk.js → remote-access-hub-CBQ_bOy9.js} +1 -1
- package/dist/gateway/static/root/assets/resource-unavailable-35wBZxmz.js +1 -0
- package/dist/gateway/static/root/assets/route-preload-BcA6SPeC.js +2 -0
- package/dist/gateway/static/root/assets/runtime-impact-DbySfhdp.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-D-8KjYK6.js → runtime-tools-api-BF28JDAO.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bq2xQ2qd.js +1 -0
- package/dist/gateway/static/root/assets/schema-form-BKeP5G7b.js +1 -0
- package/dist/gateway/static/root/assets/service-recommendation-list-CdaS4MPF.js +1 -0
- package/dist/gateway/static/root/assets/{session-api-CsCoI2im.js → session-api-zJXYlRPt.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-wWxpzSo0.js +23 -0
- package/dist/gateway/static/root/assets/sessions-page-BkjD_dUD.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BUMCEtA_.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-BqoVSko2.js → settings-advanced-section-C84IghdL.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-CBsJ-Qg2.js → settings-mode-store-CtQBJvbO.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DROUGyJl.js → settings-page-eEIz9InP.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-Bv-kQFTm.js → settings-page-header-CsPAYlqV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DHP6MrrL.js → settings-page-layout-lPLeJQoV.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BSU5WpaE.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-BJHRQVKC.js → share-link-dialog-NaM6jvIz.js} +1 -1
- package/dist/gateway/static/root/assets/share-preview-page-CHjZn27s.js +2 -0
- package/dist/gateway/static/root/assets/{shares-api-rtWVHA_d.js → shares-api-B9rVcV1y.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-5sB15V5v.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-D6zVfEuK.js +1 -0
- package/dist/gateway/static/root/assets/{skill-list-api-BzlKXPsE.js → skill-list-api-SLmTBYF5.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-Cff2GgZb.js → skill-reload-api-UQkq2orI.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-Ca0pYZ4i.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BeQeUUMH.js → system-settings-panel-BARWbjRN.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-roqAsGue.js +2 -0
- package/dist/gateway/static/root/assets/task-result-evidence-Bb1F7nAM.js +1 -0
- package/dist/gateway/static/root/assets/{terminal-panel-store-5Fzctajw.js → terminal-panel-store-DYDeXXAg.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DW45fWYQ.js → theme-store-DbStcH89.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-YfkNCxbP.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-BK_ivyIb.js +1 -0
- package/dist/gateway/static/root/assets/{understanding-activity-store-CTe6TFB0.js → understanding-activity-store-p7Z7oq8z.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-mE9OKG6q.js → understanding-refresh-store-D-U6rcwZ.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-URFSiswS.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Cs2Ga_Y_.js → use-autosave-B7cbumro.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-DAtiwLsE.js +2 -0
- package/dist/gateway/static/root/assets/use-file-preview-expanded-B8erpWsX.js +2 -0
- package/dist/gateway/static/root/assets/{use-personal-profile-BHL2AxWU.js → use-personal-profile-DDW29nm-.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-CnmPZrpx.js → use-workspace-tree-DCoTf22f.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DSV5NkNj.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-3gyc2UV3.js → voice-api-key-field-DzYdJZN4.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-Cda2uBIC.js → voice-config-api-wotvT6Hw.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-DtYHsPLF.js → voice-input-shortcut-events-BI6PuiIB.js} +1 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-DAK9eLRr.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Dqu5CQCS.js → work-discovery-overlay-BzmB9Rub.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CmGjxUIT.js +1 -0
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DHl2cZY1.js → working-directory-picker-modal-B-EHm52-.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-CtDbI6T7.js → workspace-api-uhiEMPpK.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-DrPVyikA.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-CTIbUfKb.js → workspace-file-preview-dialog-BDm06MZm.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-BwxouqdZ.js → workspace-open-location-menu-Bv83uoqu.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CFb-23rS.js → xopc-cloud-account-card-Cd5GdpGL.js} +1 -1
- package/dist/gateway/static/root/index.html +91 -86
- package/dist/gateway/static/root/notification-sw.js +21 -7
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-protocol/src/context.js +115 -0
- package/dist/packages/endpoint-tools-protocol/src/index.js +4 -0
- package/dist/packages/endpoint-tools-protocol/src/location-sharing.js +51 -0
- package/dist/packages/gateway-contract/src/gateway-scopes.js +5 -1
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/phone-workspace.js +6 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +9 -3
- package/dist/packages/gateway-contract/src/task-display.js +14 -0
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/context/execution-scope.js +10 -5
- package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +2 -2
- package/dist/src/agent/embedded/run-turn.js +72 -9
- package/dist/src/agent/embedded/session-runner.js +2 -1
- package/dist/src/agent/embedded/types.d.ts +1 -1
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/prompt/system-prompt.js +1 -0
- package/dist/src/agent/service/direct-turn-helpers.d.ts +0 -7
- package/dist/src/agent/service/direct-turn-helpers.js +3 -2
- package/dist/src/agent/service/process-direct-streaming.js +2 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/source-context/device-environment.d.ts +3 -0
- package/dist/src/agent/source-context/device-environment.js +38 -0
- package/dist/src/agent/source-context/injector.js +2 -1
- package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
- package/dist/src/agent/tool-manuals/phone.js +1 -1
- package/dist/src/agent/tools/automation-tool.d.ts +2 -1
- package/dist/src/agent/tools/automation-tool.js +13 -5
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent/tools/personal-read-tool.js +2 -2
- package/dist/src/agent/tools/personal-task-tool.js +2 -1
- package/dist/src/agent/tools/phone-use-tool.js +46 -2
- package/dist/src/agent/tools/xopc-use-tool.js +8 -5
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/repository.js +1 -1
- package/dist/src/automations/api/routes.js +38 -0
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.js +25 -9
- package/dist/src/automations/configuration-conversation.d.ts +16 -0
- package/dist/src/automations/configuration-conversation.js +120 -0
- package/dist/src/automations/delivery/delivery-router.d.ts +2 -0
- package/dist/src/automations/delivery/delivery-router.js +30 -9
- package/dist/src/automations/domain/types.d.ts +1 -0
- package/dist/src/automations/index.js +5 -5
- package/dist/src/automations/service/action-executor.js +41 -12
- package/dist/src/automations/service/automation-service.d.ts +6 -0
- package/dist/src/automations/service/automation-service.js +47 -12
- package/dist/src/automations/service/index.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/broker.js +16 -3
- package/dist/src/computer/diagnostics.js +1 -1
- package/dist/src/computer/errors.js +4 -0
- package/dist/src/computer/runtime.d.ts +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +1 -0
- package/dist/src/endpoint-tools/context-store.d.ts +29 -0
- package/dist/src/endpoint-tools/context-store.js +138 -0
- package/dist/src/endpoint-tools/location-sharing.d.ts +42 -0
- package/dist/src/endpoint-tools/location-sharing.js +203 -0
- package/dist/src/endpoint-tools/runtime.d.ts +4 -0
- package/dist/src/endpoint-tools/runtime.js +8 -0
- package/dist/src/endpoint-tools/turn-context.d.ts +2 -1
- package/dist/src/endpoint-tools/turn-context.js +4 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/automation-completion-delivery.d.ts +4 -0
- package/dist/src/gateway/automation-completion-delivery.js +14 -0
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/middleware/auth.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/devices.js +1 -0
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +4 -0
- package/dist/src/gateway/hono/routes/endpoint-environment.d.ts +3 -0
- package/dist/src/gateway/hono/routes/endpoint-environment.js +98 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +16 -0
- package/dist/src/gateway/hono/routes/location-sharing.d.ts +3 -0
- package/dist/src/gateway/hono/routes/location-sharing.js +164 -0
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
- package/dist/src/gateway/hono/routes/phone.js +246 -34
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +3 -2
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/tunnel.js +10 -0
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/respawn.js +2 -1
- package/dist/src/gateway/security/gateway-scopes.js +6 -0
- package/dist/src/gateway/security/phone-access.d.ts +4 -0
- package/dist/src/gateway/security/phone-access.js +20 -0
- package/dist/src/gateway/service/agent-runner.js +3 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +2 -1
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +50 -2
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +12 -4
- package/dist/src/gateway/session-reset-service.js +4 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/notifications/planner.js +6 -6
- package/dist/src/observability/store.d.ts +9 -0
- package/dist/src/observability/store.js +77 -32
- package/dist/src/personal-agent/communication.d.ts +1 -1
- package/dist/src/personal-agent/communication.js +3 -6
- package/dist/src/personal-agent/request-service.js +2 -1
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/phone/assistance-service.d.ts +6 -0
- package/dist/src/phone/assistance-service.js +32 -0
- package/dist/src/phone/assistance.d.ts +40 -0
- package/dist/src/phone/assistance.js +273 -0
- package/dist/src/phone/cloud-phones.d.ts +5 -0
- package/dist/src/phone/cloud-phones.js +14 -0
- package/dist/src/phone/contracts.d.ts +7 -1
- package/dist/src/phone/contracts.js +5 -0
- package/dist/src/phone/environment-adapter.d.ts +3 -0
- package/dist/src/phone/environment-adapter.js +11 -0
- package/dist/src/phone/location-baseline-store.d.ts +9 -0
- package/dist/src/phone/location-baseline-store.js +61 -0
- package/dist/src/phone/location-environment.d.ts +61 -0
- package/dist/src/phone/location-environment.js +157 -0
- package/dist/src/phone/model-adapter.js +16 -5
- package/dist/src/phone/runtime.d.ts +17 -2
- package/dist/src/phone/runtime.js +203 -20
- package/dist/src/phone/stream-gateway.d.ts +5 -0
- package/dist/src/phone/stream-gateway.js +85 -51
- package/dist/src/phone/wuying-location.d.ts +18 -0
- package/dist/src/phone/wuying-location.js +86 -0
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/storage/sqlite/device-access-repository.d.ts +4 -0
- package/dist/src/storage/sqlite/device-access-repository.js +18 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/task-contract-planner.js +2 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tunnel/broker-client.d.ts +8 -0
- package/dist/src/tunnel/broker-client.js +18 -1
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/runtime.js +1 -1
- package/package.json +4 -3
- package/dist/gateway/static/root/assets/agent-avatar-display-Cy50vjbq.js +0 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-V4NX_cWz.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CQ5LLDMO.js +0 -1
- package/dist/gateway/static/root/assets/app-link-CytZ5zkp.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-C1Zs-eha.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-lIfGokbz.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-CUvtsRYD.js +0 -1
- package/dist/gateway/static/root/assets/automation-api-Bld8blNl.js +0 -1
- package/dist/gateway/static/root/assets/automation-display-BcfZOQTC.js +0 -2
- package/dist/gateway/static/root/assets/automations-workspace-BgtYY2Mm.js +0 -8
- package/dist/gateway/static/root/assets/browser-automations-page-DIUNY94X.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-DFW4Y0x8.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-uOHSMQPZ.js +0 -8
- package/dist/gateway/static/root/assets/channels-D2a69dSt.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-CG38tCHE.js +0 -71
- package/dist/gateway/static/root/assets/composer-payload-handoff-BU3B-C26.js +0 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-Dmnu2zle.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DT_WrC1y.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-CE-cZFCU.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-lorocS9j.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CEcohlZq.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CLCPuf4R.js +0 -1
- package/dist/gateway/static/root/assets/discussion-annotation-sync-BKjf9gWe.js +0 -1
- package/dist/gateway/static/root/assets/extension-iframe-host-Dhkk5JV2.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-Brps2XDP.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CHY68DpG.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DQqMBruB.js +0 -1
- package/dist/gateway/static/root/assets/gateway-restart-Ch128Lrr.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DaMFBYo1.js +0 -2
- package/dist/gateway/static/root/assets/image-generation-api-I_JgLL_m.js +0 -1
- package/dist/gateway/static/root/assets/index-DY2Y83b9.css +0 -1
- package/dist/gateway/static/root/assets/index-UCOlAnf-.js +0 -11
- package/dist/gateway/static/root/assets/install-connector-dialog-DU1Tz7B3.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-qPflPuQD.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CbY1N-zi.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-Diy12JfQ.js +0 -1
- package/dist/gateway/static/root/assets/messages-DRR9N3HC.js +0 -3
- package/dist/gateway/static/root/assets/model-selector-DCYA_ntf.js +0 -1
- package/dist/gateway/static/root/assets/navigation-BkjnOw30.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DBs1yHLy.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-CivkB6LB.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DL3c-41a.js +0 -8
- package/dist/gateway/static/root/assets/page-header-store-DH8K0xii.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-B5DP3lO-.js +0 -1
- package/dist/gateway/static/root/assets/personal-settings-panel-DjDc5Kaz.js +0 -1
- package/dist/gateway/static/root/assets/phone-model-picker-u8YIQCgo.js +0 -1
- package/dist/gateway/static/root/assets/phone-settings-page-el3pT0PD.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-CTBs1Jde.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-DniHw2dy.js +0 -1
- package/dist/gateway/static/root/assets/preference-select-fields-D7oluyHN.js +0 -1
- package/dist/gateway/static/root/assets/product-automation-feedback-DsUSqCOX.js +0 -7
- package/dist/gateway/static/root/assets/product-delivery-BU_H84jL.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-content-DcoK-iZe.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-modal-Ruw9WSKK.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-BKvWLiMw.js +0 -7
- package/dist/gateway/static/root/assets/project-understanding-BCQr0AZ_.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D4g7bB7X.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-B5UiReO7.js +0 -2
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-MKlLFuow.js +0 -1
- package/dist/gateway/static/root/assets/schema-form-v4N4lawq.js +0 -1
- package/dist/gateway/static/root/assets/service-recommendation-list-B1xuVT3N.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-5l9q0cd5.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-DsLw2aMD.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B5lQeVNi.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-MJE3B_LX.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-Bsrv_zOQ.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-CfIRv4uX.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-B_W1K3sv.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DtBloYeU.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-Drrv-Hp0.js +0 -2
- package/dist/gateway/static/root/assets/task-result-evidence-D1Kyskm_.js +0 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-B12u5D9A.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-DGO56LQU.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-Ud2U9UG1.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-BCbMj-MN.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-DSpCRXUW.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-p5iPfnwl.js +0 -2
- package/dist/gateway/static/root/assets/voice-transcribe-api-TInEfIYo.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-p-8ciZ0i.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-B94Q2nN8.js +0 -1
|
@@ -2,7 +2,7 @@ import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
|
2
2
|
import type { AutomationService } from '../../automations/index.js';
|
|
3
3
|
import type { ProjectService } from '../../projects/project-service.js';
|
|
4
4
|
declare const AutomationToolSchema: import("@sinclair/typebox").TObject<{
|
|
5
|
-
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"list">, import("@sinclair/typebox").TLiteral<"create">, import("@sinclair/typebox").TLiteral<"update">, import("@sinclair/typebox").TLiteral<"delete">, import("@sinclair/typebox").TLiteral<"run">, import("@sinclair/typebox").TLiteral<"rerun">, import("@sinclair/typebox").TLiteral<"cancel">, import("@sinclair/typebox").TLiteral<"read">, import("@sinclair/typebox").TLiteral<"read_all">, import("@sinclair/typebox").TLiteral<"pause">, import("@sinclair/typebox").TLiteral<"resume">, import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"get_run">, import("@sinclair/typebox").TLiteral<"run_events">, import("@sinclair/typebox").TLiteral<"metrics">, import("@sinclair/typebox").TLiteral<"events">, import("@sinclair/typebox").TLiteral<"deliveries">, import("@sinclair/typebox").TLiteral<"product_events">, import("@sinclair/typebox").TLiteral<"replay_event">, import("@sinclair/typebox").TLiteral<"retry_delivery">]>;
|
|
5
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"list">, import("@sinclair/typebox").TLiteral<"get">, import("@sinclair/typebox").TLiteral<"create">, import("@sinclair/typebox").TLiteral<"update">, import("@sinclair/typebox").TLiteral<"delete">, import("@sinclair/typebox").TLiteral<"run">, import("@sinclair/typebox").TLiteral<"rerun">, import("@sinclair/typebox").TLiteral<"cancel">, import("@sinclair/typebox").TLiteral<"read">, import("@sinclair/typebox").TLiteral<"read_all">, import("@sinclair/typebox").TLiteral<"pause">, import("@sinclair/typebox").TLiteral<"resume">, import("@sinclair/typebox").TLiteral<"history">, import("@sinclair/typebox").TLiteral<"get_run">, import("@sinclair/typebox").TLiteral<"run_events">, import("@sinclair/typebox").TLiteral<"metrics">, import("@sinclair/typebox").TLiteral<"events">, import("@sinclair/typebox").TLiteral<"deliveries">, import("@sinclair/typebox").TLiteral<"product_events">, import("@sinclair/typebox").TLiteral<"replay_event">, import("@sinclair/typebox").TLiteral<"retry_delivery">]>;
|
|
6
6
|
automationId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
7
|
runId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
8
|
projectId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
@@ -21,6 +21,7 @@ declare const AutomationToolSchema: import("@sinclair/typebox").TObject<{
|
|
|
21
21
|
}>;
|
|
22
22
|
export interface AutomationToolDeps {
|
|
23
23
|
getAutomationService: () => AutomationService | undefined;
|
|
24
|
+
getCurrentConversationId?: () => string | undefined;
|
|
24
25
|
getCurrentAgentId?: () => string | undefined;
|
|
25
26
|
getProjectService?: () => ProjectService | undefined;
|
|
26
27
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { appendProductDeliveryText } from "../../../packages/gateway-contract/src/product-delivery.js";
|
|
2
2
|
import { AutomationCancelOutputSchema, AutomationDeleteOutputSchema, AutomationMutationOutputSchema, AutomationReadAllOutputSchema, AutomationReadOutputSchema, AutomationRecoveryOutputSchema, AutomationRunMutationOutputSchema, ProductReadContracts } from "../../../packages/gateway-contract/src/capabilities.js";
|
|
3
3
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
4
|
+
import { getAutomationSetup } from "../../automations/configuration-conversation.js";
|
|
4
5
|
import { createProductDispatcher } from "../../capabilities/runtime/product.js";
|
|
5
6
|
import { randomUUID } from "node:crypto";
|
|
6
7
|
import { Type } from "@sinclair/typebox";
|
|
@@ -9,6 +10,7 @@ init_src();
|
|
|
9
10
|
const AutomationToolSchema = Type.Object({
|
|
10
11
|
action: Type.Union([
|
|
11
12
|
Type.Literal("list"),
|
|
13
|
+
Type.Literal("get"),
|
|
12
14
|
Type.Literal("create"),
|
|
13
15
|
Type.Literal("update"),
|
|
14
16
|
Type.Literal("delete"),
|
|
@@ -64,13 +66,14 @@ function formatAutomation(item) {
|
|
|
64
66
|
const next = item.state.nextRunAtMs ? new Date(item.state.nextRunAtMs).toISOString() : "none";
|
|
65
67
|
return `- ${item.id} · ${item.name} · ${status} · trigger=${trigger} · next=${next}`;
|
|
66
68
|
}
|
|
67
|
-
function automationDelivery(automation, operation) {
|
|
69
|
+
function automationDelivery(automation, operation, runId) {
|
|
68
70
|
return {
|
|
69
71
|
version: 2,
|
|
70
72
|
operation,
|
|
71
73
|
primary: {
|
|
72
74
|
kind: "automation",
|
|
73
75
|
id: automation.id,
|
|
76
|
+
...runId ? { runId } : {},
|
|
74
77
|
title: automation.name,
|
|
75
78
|
summary: automation.description?.trim() || void 0,
|
|
76
79
|
status: automation.enabled ? "enabled" : "paused",
|
|
@@ -103,6 +106,7 @@ function createAutomationTool(deps) {
|
|
|
103
106
|
const caller = {
|
|
104
107
|
principalId: `agent:${deps.getCurrentAgentId?.() ?? "main"}`,
|
|
105
108
|
surface: "agent",
|
|
109
|
+
conversationId: deps.getCurrentConversationId?.(),
|
|
106
110
|
scopes: [scope],
|
|
107
111
|
authorize: () => true,
|
|
108
112
|
signal
|
|
@@ -114,6 +118,10 @@ function createAutomationTool(deps) {
|
|
|
114
118
|
};
|
|
115
119
|
const invoke = async (operation, input) => AutomationMutationOutputSchema.parse(await call(operation, input));
|
|
116
120
|
switch (params.action) {
|
|
121
|
+
case "get": {
|
|
122
|
+
const result = ProductReadContracts["xopc.automations.get"].output.parse(await call("xopc.automations.get", { id: params.automationId }, "automations.read"));
|
|
123
|
+
return textResult(JSON.stringify(result.automation), result);
|
|
124
|
+
}
|
|
117
125
|
case "list": {
|
|
118
126
|
const { items: automations } = ProductReadContracts["xopc.automations.list"].output.parse(await call("xopc.automations.list", { projectId: params.projectId }, "automations.read"));
|
|
119
127
|
return textResult(automations.length > 0 ? automations.map(formatAutomation).join("\n") : "No automations.", { automations });
|
|
@@ -130,7 +138,7 @@ function createAutomationTool(deps) {
|
|
|
130
138
|
const id = params.automationId?.trim();
|
|
131
139
|
if (!id) return textResult("automationId is required for update.", { ok: false });
|
|
132
140
|
if (!params.patch || typeof params.patch !== "object") return textResult("patch payload is required for update.", { ok: false });
|
|
133
|
-
if (params.idempotencyKey !== void 0 && params.expectedRevision === void 0) return textResult("Idempotent automation changes require expectedRevision from the original read.", { ok: false });
|
|
141
|
+
if ((params.idempotencyKey !== void 0 || getAutomationSetup(deps.getCurrentConversationId?.())?.automationId) && params.expectedRevision === void 0) return textResult("Idempotent automation changes require expectedRevision from the original read.", { ok: false });
|
|
134
142
|
const expectedRevision = params.expectedRevision !== void 0 ? params.expectedRevision : (await service.get(id))?.updatedAtMs;
|
|
135
143
|
if (expectedRevision === void 0) return textResult(`Automation not found: ${id}`, { ok: false });
|
|
136
144
|
const { automation } = await invoke("xopc.automations.update", {
|
|
@@ -146,7 +154,7 @@ function createAutomationTool(deps) {
|
|
|
146
154
|
case "delete": {
|
|
147
155
|
const id = params.automationId?.trim();
|
|
148
156
|
if (!id) return textResult("automationId is required for delete.", { ok: false });
|
|
149
|
-
if (params.idempotencyKey !== void 0 && params.expectedRevision === void 0) return textResult("Idempotent deletion requires the original expectedRevision.", { ok: false });
|
|
157
|
+
if ((params.idempotencyKey !== void 0 || getAutomationSetup(deps.getCurrentConversationId?.())?.automationId) && params.expectedRevision === void 0) return textResult("Idempotent deletion requires the original expectedRevision.", { ok: false });
|
|
150
158
|
const expectedRevision = params.expectedRevision !== void 0 ? params.expectedRevision : (await service.get(id))?.updatedAtMs ?? null;
|
|
151
159
|
const { removed } = AutomationDeleteOutputSchema.parse(await call("xopc.automations.delete", {
|
|
152
160
|
id,
|
|
@@ -192,14 +200,14 @@ function createAutomationTool(deps) {
|
|
|
192
200
|
const { automation, run } = AutomationRunMutationOutputSchema.parse(await call(`xopc.automations.${params.action}`, { id }));
|
|
193
201
|
return textResult(`Queued automation run ${run.id}.`, {
|
|
194
202
|
run,
|
|
195
|
-
...automation ? { delivery: automationDelivery(automation, "started") } : {}
|
|
203
|
+
...automation ? { delivery: automationDelivery(automation, "started", run.id) } : {}
|
|
196
204
|
});
|
|
197
205
|
}
|
|
198
206
|
case "pause":
|
|
199
207
|
case "resume": {
|
|
200
208
|
const id = params.automationId?.trim();
|
|
201
209
|
if (!id) return textResult(`automationId is required for ${params.action}.`, { ok: false });
|
|
202
|
-
if (params.idempotencyKey !== void 0 && params.expectedRevision === void 0) return textResult("Idempotent automation changes require expectedRevision from the original read.", { ok: false });
|
|
210
|
+
if ((params.idempotencyKey !== void 0 || getAutomationSetup(deps.getCurrentConversationId?.())?.automationId) && params.expectedRevision === void 0) return textResult("Idempotent automation changes require expectedRevision from the original read.", { ok: false });
|
|
203
211
|
const expectedRevision = params.expectedRevision !== void 0 ? params.expectedRevision : (await service.get(id))?.updatedAtMs;
|
|
204
212
|
if (expectedRevision === void 0) return textResult(`Automation not found: ${id}`, { ok: false });
|
|
205
213
|
const { automation } = await invoke("xopc.automations.set_enabled", {
|
|
@@ -15,13 +15,13 @@ import { PERSONAL_TOOL_DESCRIPTIONS } from "../../personal-agent/policy.js";
|
|
|
15
15
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
16
16
|
import { PERSONAL_REQUEST_TOOL_IDS, TASK_EXECUTION_TOOL_IDS, filterExecutionTools, resolveExecutionToolPolicy } from "../embedded/execution-tool-policy.js";
|
|
17
17
|
import { getPhoneRuntime, phoneExecutionContext } from "../../phone/runtime.js";
|
|
18
|
+
import { getEmbeddedExecutionRunId, getEmbeddedExecutionSession } from "../embedded/execution-context.js";
|
|
18
19
|
import { createPhoneUseTool } from "./phone-use-tool.js";
|
|
19
20
|
import { LOCAL_READ_MAX_CHARS } from "./local-read-budget.js";
|
|
20
21
|
import { createPersonalAttentionTool } from "./personal-attention-tool.js";
|
|
21
22
|
import { withCoreToolExposure } from "./toolExposure.js";
|
|
22
23
|
import { markCodemodeCoreRead } from "./codemode-permissions.js";
|
|
23
24
|
import "../../../packages/browser-control-contract/src/index.js";
|
|
24
|
-
import { getEmbeddedExecutionRunId, getEmbeddedExecutionSession } from "../embedded/execution-context.js";
|
|
25
25
|
import { wrapToolsWithProtection } from "./executor.js";
|
|
26
26
|
import { createDefaultExternalToolGatewayTools } from "../external-tools/index.js";
|
|
27
27
|
import { createReadFileTool } from "./read.js";
|
|
@@ -560,6 +560,7 @@ var AgentToolsFactory = class AgentToolsFactory {
|
|
|
560
560
|
canAccess: () => currentAccess().crossSessionHistory
|
|
561
561
|
})] : [],
|
|
562
562
|
...this.deps.getAutomationService ? [createAutomationTool({
|
|
563
|
+
getCurrentConversationId: () => this.deps.getCurrentContext()?.conversationId,
|
|
563
564
|
getAutomationService: this.deps.getAutomationService,
|
|
564
565
|
getCurrentAgentId: () => options.agentId,
|
|
565
566
|
getProjectService: this.deps.getProjectService
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CapabilityDispatcher } from "../../capabilities/runtime/dispatcher.js";
|
|
2
1
|
import { isPersonalConversation } from "../../personal-agent/repository.js";
|
|
3
|
-
import { LOCAL_READ_MAX_CHARS } from "./local-read-budget.js";
|
|
4
2
|
import { getEmbeddedExecutionSession } from "../embedded/execution-context.js";
|
|
3
|
+
import { LOCAL_READ_MAX_CHARS } from "./local-read-budget.js";
|
|
4
|
+
import { CapabilityDispatcher } from "../../capabilities/runtime/dispatcher.js";
|
|
5
5
|
import { registerNoteReadCapabilities } from "../../notes/capabilities/read.js";
|
|
6
6
|
import { registerProjectReadCapabilities } from "../../projects/capabilities/read.js";
|
|
7
7
|
import { registerAutomationReadCapabilities } from "../../automations/capabilities/read.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { normalizeSpecialistRequirements } from "../../../packages/gateway-contract/src/specialists.js";
|
|
2
2
|
import { appendProductDeliveryText } from "../../../packages/gateway-contract/src/product-delivery.js";
|
|
3
|
+
import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../../packages/gateway-contract/src/task-display.js";
|
|
3
4
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
4
5
|
import { getSessionInputById, getSessionInputState, init_session_input_repository } from "../../storage/sqlite/session-input-repository.js";
|
|
5
6
|
import { TaskRepository, init_task_repository } from "../../tasks/task-repository.js";
|
|
@@ -12,7 +13,7 @@ import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js
|
|
|
12
13
|
import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
|
|
13
14
|
import { boundedPersonalResult } from "./personal-result-budget.js";
|
|
14
15
|
import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
|
|
15
|
-
import
|
|
16
|
+
import "../../personal-agent/communication.js";
|
|
16
17
|
import { parseTaskHandoffReferences } from "../../tasks/task-handoff.js";
|
|
17
18
|
import { TaskApplicationService } from "../../tasks/task-application-service.js";
|
|
18
19
|
import { getAvailablePersonalAgentTools, personalAgentModelAvailability } from "../../personal-agent/specialist-capabilities.js";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PhoneError, PhoneInputSchema, init_contracts } from "../../phone/contracts.js";
|
|
2
|
+
import { cancelPhoneAssistance, phoneResumeForRun, requirePhoneAssistance } from "../../phone/assistance.js";
|
|
3
|
+
import { getEmbeddedExecutionRunId } from "../embedded/execution-context.js";
|
|
2
4
|
import { Type } from "@sinclair/typebox";
|
|
3
5
|
//#region src/agent/tools/phone-use-tool.ts
|
|
4
6
|
init_contracts();
|
|
@@ -12,10 +14,16 @@ const Schema = Type.Object({
|
|
|
12
14
|
"run",
|
|
13
15
|
"status",
|
|
14
16
|
"pause",
|
|
17
|
+
"request_user",
|
|
15
18
|
"resume",
|
|
16
19
|
"cancel",
|
|
17
20
|
"close"
|
|
18
21
|
].map((value) => Type.Literal(value))),
|
|
22
|
+
reason: Type.Optional(Type.String({
|
|
23
|
+
minLength: 1,
|
|
24
|
+
maxLength: 1e3,
|
|
25
|
+
description: "For request_user: explain the operation the user must complete on the phone. Saves the current task and ends this turn until explicit handback."
|
|
26
|
+
})),
|
|
19
27
|
budget: Type.Optional(Type.Object({
|
|
20
28
|
maxActions: Type.Optional(Type.Integer({
|
|
21
29
|
minimum: 1,
|
|
@@ -93,20 +101,52 @@ const Schema = Type.Object({
|
|
|
93
101
|
}))
|
|
94
102
|
}, { additionalProperties: false });
|
|
95
103
|
function createPhoneUseTool(deps) {
|
|
104
|
+
let restoredRunId;
|
|
96
105
|
return {
|
|
97
106
|
name: "phone_use",
|
|
98
107
|
label: "Phone",
|
|
99
108
|
parameters: Schema,
|
|
100
|
-
description: "Use an authorized Android phone via local ADB or a configured cloud connection. Load tool_manual for phone_use before first use. Discover registered devices, appAccess and allowedApps first. Use the defaultDeviceId returned by discover unless the user explicitly names a different phone. A phone-control conversation may bind its own defaultDeviceId. Match an explicitly named phone to its unique registered name and deviceId; ask when ambiguous and never silently switch phones; open with mode observe/control and optional authorized appPackage, observe native UI text, then discover the effective executionMode. In collaborative mode, plan with the main Agent and run one small goal at a time. In direct mode, delegate the full authorized phone goal to run and let the phone model plan locally. Keep the same taskId across fragments. Do not silently change mode or retry budget exhaustion. Inspect feedback.outcome, outputs and nextAction. Use set_mode only for an explicit user mode change; applyCurrent pauses and requires inspection/handback. Device and model configuration live in Phone Use settings. Connections originate from the Gateway host; cloud credentials are configured in phone management. Mock mode only supports the explicitly requested settings-about emulator test. Never silently switch phones, execute shell commands, bypass app restrictions, or repeat a dispatch with unknown outcome. Request user assistance for login, CAPTCHA or an effect not already authorized.
|
|
101
|
-
async execute(_id, raw, signal) {
|
|
109
|
+
description: "Use an authorized Android phone via local ADB or a configured cloud connection. Load tool_manual for phone_use before first use. Discover registered devices, appAccess and allowedApps first. Use the defaultDeviceId returned by discover unless the user explicitly names a different phone. A phone-control conversation may bind its own defaultDeviceId. Match an explicitly named phone to its unique registered name and deviceId; ask when ambiguous and never silently switch phones; open with mode observe/control and optional authorized appPackage, observe native UI text, then discover the effective executionMode. In collaborative mode, plan with the main Agent and run one small goal at a time. In direct mode, delegate the full authorized phone goal to run and let the phone model plan locally. Keep the same taskId across fragments. Do not silently change mode or retry budget exhaustion. Inspect feedback.outcome, outputs and nextAction. Use set_mode only for an explicit user mode change; applyCurrent pauses and requires inspection/handback. Device and model configuration live in Phone Use settings. Connections originate from the Gateway host; cloud credentials are configured in phone management. Mock mode only supports the explicitly requested settings-about emulator test. Never silently switch phones, execute shell commands, bypass app restrictions, or repeat a dispatch with unknown outcome. Request user assistance for login, CAPTCHA or an effect not already authorized. Use request_user with reason when manual assistance is needed; it saves the current task and ends this turn until explicit handback. A plain pause does not request assistance; resume re-observes. Inspect readings for information source and verification; screenshot readings are unverified observations, never proof of completion. Inspect verified, verificationLevel and stopReason before claiming success. Close finishes this task and releases operation control while keeping the phone connected. Do not close or disconnect a phone to resolve PHONE_DEVICE_BUSY; report executionStarted=false and the occupying conversation to the user, and wait for user action. Raw screenshots never enter the chat transcript.",
|
|
110
|
+
async execute(_id, raw, signal, onUpdate) {
|
|
102
111
|
const { owner, ...context } = deps.context();
|
|
112
|
+
const runId = getEmbeddedExecutionRunId();
|
|
113
|
+
if (runId) context.onNeedsUser = (checkpoint) => requirePhoneAssistance(owner, runId, _id, checkpoint).id;
|
|
103
114
|
const input = PhoneInputSchema.parse(raw);
|
|
115
|
+
const resume = runId ? phoneResumeForRun(owner, runId) : void 0;
|
|
116
|
+
if (resume && restoredRunId !== runId && (input.op === "run" || input.op === "step")) {
|
|
117
|
+
if (input.taskId && input.taskId !== resume.checkpoint.task.taskId) throw new PhoneError("PHONE_ASSISTANCE_CHANGED", "Continue the original phone task before starting another", 409);
|
|
118
|
+
Object.assign(input, resume.checkpoint.task, {
|
|
119
|
+
op: input.op,
|
|
120
|
+
taskId: resume.checkpoint.task.taskId
|
|
121
|
+
});
|
|
122
|
+
}
|
|
104
123
|
const setup = deps.getSetupService?.();
|
|
105
124
|
const setupContext = {
|
|
106
125
|
conversationId: owner,
|
|
107
126
|
agentId: context.agentId
|
|
108
127
|
};
|
|
109
128
|
const setupOwner = setup?.beforeInput(setupContext, input);
|
|
129
|
+
if (setupOwner) context.onNeedsUser = void 0;
|
|
130
|
+
let notifiedEpoch;
|
|
131
|
+
const unsubscribe = onUpdate ? deps.runtime.subscribe(setupOwner?.owner ?? owner, (report) => {
|
|
132
|
+
if (report.status !== "needs_user" || report.controlEpoch === notifiedEpoch) return;
|
|
133
|
+
notifiedEpoch = report.controlEpoch;
|
|
134
|
+
const progress = {
|
|
135
|
+
status: "needs_user",
|
|
136
|
+
sessionId: report.sessionId,
|
|
137
|
+
deviceId: report.deviceId,
|
|
138
|
+
reason: report.message,
|
|
139
|
+
nextAction: "user_takeover",
|
|
140
|
+
message: "请接管手机,完成登录、验证码等操作后点击“已完成,继续任务”,原任务会从当前页面继续。"
|
|
141
|
+
};
|
|
142
|
+
onUpdate({
|
|
143
|
+
content: [{
|
|
144
|
+
type: "text",
|
|
145
|
+
text: JSON.stringify(progress)
|
|
146
|
+
}],
|
|
147
|
+
details: progress
|
|
148
|
+
});
|
|
149
|
+
}) : void 0;
|
|
110
150
|
let result;
|
|
111
151
|
try {
|
|
112
152
|
result = setupOwner && input.op === "close" ? await deps.runtime.stop(setupOwner.owner, "close") : await deps.runtime.execute(setupOwner?.owner ?? owner, setupOwner?.input ?? input, context, signal);
|
|
@@ -128,7 +168,11 @@ function createPhoneUseTool(deps) {
|
|
|
128
168
|
}],
|
|
129
169
|
details: result
|
|
130
170
|
};
|
|
171
|
+
} finally {
|
|
172
|
+
unsubscribe?.();
|
|
131
173
|
}
|
|
174
|
+
if (resume && (input.op === "run" || input.op === "step")) restoredRunId = runId;
|
|
175
|
+
if (input.op === "cancel" || input.op === "close" && !resume) cancelPhoneAssistance(owner);
|
|
132
176
|
if (setupOwner) setup.afterInput(setupContext, setupOwner.owner, input.op);
|
|
133
177
|
return {
|
|
134
178
|
content: [{
|
|
@@ -11,14 +11,15 @@ import { TaskRunRepository } from "../../tasks/task-run-repository.js";
|
|
|
11
11
|
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
12
12
|
import "../../storage/sqlite/index.js";
|
|
13
13
|
import "../../activity/index.js";
|
|
14
|
-
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
15
|
-
import "../../capabilities/runtime/dispatcher.js";
|
|
16
14
|
import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
|
|
17
15
|
import { hasUnlocalizedTaskText, resolveTaskLocale } from "../../tasks/task-language.js";
|
|
18
16
|
import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
|
|
19
17
|
import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
|
|
20
18
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
19
|
+
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
20
|
+
import { getAutomationSetup } from "../../automations/configuration-conversation.js";
|
|
21
21
|
import { getEmbeddedExecutionRunId } from "../embedded/execution-context.js";
|
|
22
|
+
import "../../capabilities/runtime/dispatcher.js";
|
|
22
23
|
import { resolveProjectAgentId } from "../../projects/project-agent.js";
|
|
23
24
|
import "../../projects/index.js";
|
|
24
25
|
import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
|
|
@@ -260,6 +261,7 @@ function deliveryForXopcResult(mode, command, result, dryRun) {
|
|
|
260
261
|
kind: "automation",
|
|
261
262
|
id,
|
|
262
263
|
title: deliveryText(source?.name) ?? "Automation",
|
|
264
|
+
runId: deliveryText(record(resultRecord.run)?.id),
|
|
263
265
|
summary: deliverySummary(source?.description),
|
|
264
266
|
status: enabled ? "enabled" : "paused",
|
|
265
267
|
revision: deliveryRevision(source?.updatedAtMs),
|
|
@@ -751,6 +753,7 @@ async function handleAutomation(command, args, deps, dryRun, capabilities) {
|
|
|
751
753
|
const caller = {
|
|
752
754
|
principalId: `agent:${deps.getCurrentAgentId?.() ?? "main"}`,
|
|
753
755
|
surface: "agent",
|
|
756
|
+
conversationId: deps.getCurrentConversationId?.(),
|
|
754
757
|
scopes: ["automations.write"],
|
|
755
758
|
authorize: deps.authorizeCapability ?? (() => true)
|
|
756
759
|
};
|
|
@@ -885,7 +888,7 @@ async function handleAutomation(command, args, deps, dryRun, capabilities) {
|
|
|
885
888
|
automationId: id,
|
|
886
889
|
patch
|
|
887
890
|
};
|
|
888
|
-
if (args.idempotencyKey !== void 0 && args.expectedRevision === void 0) return {
|
|
891
|
+
if ((args.idempotencyKey !== void 0 || getAutomationSetup(deps.getCurrentConversationId?.())?.automationId) && args.expectedRevision === void 0) return {
|
|
889
892
|
ok: false,
|
|
890
893
|
error: "Idempotent automation changes require expectedRevision from the original read"
|
|
891
894
|
};
|
|
@@ -930,7 +933,7 @@ async function handleAutomation(command, args, deps, dryRun, capabilities) {
|
|
|
930
933
|
};
|
|
931
934
|
if (!dryRun && command === "run") return invoke("xopc.automations.run", { id });
|
|
932
935
|
if (!dryRun && command === "delete") {
|
|
933
|
-
if (args.idempotencyKey !== void 0 && args.expectedRevision === void 0) return {
|
|
936
|
+
if ((args.idempotencyKey !== void 0 || getAutomationSetup(deps.getCurrentConversationId?.())?.automationId) && args.expectedRevision === void 0) return {
|
|
934
937
|
ok: false,
|
|
935
938
|
error: "Idempotent deletion requires the original expectedRevision"
|
|
936
939
|
};
|
|
@@ -940,7 +943,7 @@ async function handleAutomation(command, args, deps, dryRun, capabilities) {
|
|
|
940
943
|
});
|
|
941
944
|
}
|
|
942
945
|
if (!dryRun && (command === "pause" || command === "resume")) {
|
|
943
|
-
if (args.idempotencyKey !== void 0 && args.expectedRevision === void 0) return {
|
|
946
|
+
if ((args.idempotencyKey !== void 0 || getAutomationSetup(deps.getCurrentConversationId?.())?.automationId) && args.expectedRevision === void 0) return {
|
|
944
947
|
ok: false,
|
|
945
948
|
error: "Idempotent automation changes require expectedRevision from the original read"
|
|
946
949
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AgentEntrySchema, AgentProfileSchema, EffectiveAgentConfigSchema } from "../agent-config/schema.js";
|
|
2
2
|
import { resolveEffectiveAgentConfig } from "../agent-config/resolver.js";
|
|
3
3
|
import { init_agent_config } from "../agent-config/index.js";
|
|
4
|
-
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
5
|
-
import { defineAtomicCapability, defineReadCapability } from "../capabilities/runtime/dispatcher.js";
|
|
6
4
|
import { AgentCatalogRepository, init_repository } from "./repository.js";
|
|
7
5
|
import { init_agent_scope, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
6
|
+
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
7
|
+
import { defineAtomicCapability, defineReadCapability } from "../capabilities/runtime/dispatcher.js";
|
|
8
8
|
import { AgentCatalogService } from "./service.js";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
//#region src/agent-catalog/capabilities.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
3
|
+
import { DEFAULT_AGENT_ID, init_id, normalizeAgentId } from "./id.js";
|
|
3
4
|
import { AgentDefaultsSchema, AgentEntrySchema, DEFAULT_AGENT_MODEL_REF, DEFAULT_SKILL_POLICY } from "../agent-config/schema.js";
|
|
4
5
|
import { init_agent_config } from "../agent-config/index.js";
|
|
5
|
-
import { DEFAULT_AGENT_ID, init_id, normalizeAgentId } from "./id.js";
|
|
6
6
|
import { BindingsSchema, init_binding_schema } from "../routing/binding-schema.js";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
8
|
//#region src/agent-catalog/repository.ts
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { AutomationCancelOutputSchema, AutomationDeleteOutputSchema, AutomationMutationOutputSchema, AutomationReadAllOutputSchema, AutomationReadOutputSchema, AutomationRunMutationOutputSchema, ProductReadContracts } from "../../../packages/gateway-contract/src/capabilities.js";
|
|
2
2
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
3
4
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
5
|
+
import { getAutomationSetup, openAutomationConfiguration } from "../configuration-conversation.js";
|
|
4
6
|
import "../../capabilities/runtime/dispatcher.js";
|
|
5
7
|
import { createProductDispatcher } from "../../capabilities/runtime/product.js";
|
|
6
8
|
import { capabilityHttpContext, capabilityHttpError } from "../../capabilities/adapters/http.js";
|
|
7
9
|
import { randomUUID } from "node:crypto";
|
|
8
10
|
//#region src/automations/api/routes.ts
|
|
9
11
|
init_src();
|
|
12
|
+
init_agent_scope();
|
|
10
13
|
function parseProjectId(raw) {
|
|
11
14
|
return raw?.trim() || void 0;
|
|
12
15
|
}
|
|
@@ -30,6 +33,41 @@ function registerAutomationRoutes(authenticated, deps) {
|
|
|
30
33
|
return capabilityHttpError(c, error);
|
|
31
34
|
}
|
|
32
35
|
};
|
|
36
|
+
authenticated.post("/api/automations/configuration-conversations", async (c) => {
|
|
37
|
+
try {
|
|
38
|
+
const body = await c.req.json().catch(() => {
|
|
39
|
+
throw new CapabilityError("INVALID_INPUT", "Invalid JSON body");
|
|
40
|
+
});
|
|
41
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || Object.keys(body).some((key) => ![
|
|
42
|
+
"automationId",
|
|
43
|
+
"projectId",
|
|
44
|
+
"runId"
|
|
45
|
+
].includes(key)) || body.automationId !== void 0 && typeof body.automationId !== "string" || body.projectId !== void 0 && typeof body.projectId !== "string" || body.runId !== void 0 && typeof body.runId !== "string") throw new CapabilityError("INVALID_INPUT", "Expected automationId or projectId");
|
|
46
|
+
if (body.projectId && !service.projects?.get(body.projectId)) throw new CapabilityError("NOT_FOUND", "Project not found");
|
|
47
|
+
const conversationId = openAutomationConfiguration({
|
|
48
|
+
agentId: resolveDefaultAgentId(),
|
|
49
|
+
automationId: body.automationId?.trim() || void 0,
|
|
50
|
+
projectId: body.projectId?.trim() || void 0,
|
|
51
|
+
runId: body.runId?.trim() || void 0
|
|
52
|
+
});
|
|
53
|
+
return c.json({ conversationId }, 200);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return capabilityHttpError(c, error);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
authenticated.get("/api/automations/configuration-conversations/:conversationId", async (c) => {
|
|
59
|
+
try {
|
|
60
|
+
const setup = getAutomationSetup(c.req.param("conversationId"));
|
|
61
|
+
if (!setup) throw new CapabilityError("NOT_FOUND", "Configuration conversation not found");
|
|
62
|
+
const automation = setup.automationId ? await service.automationServiceInstance.get(setup.automationId) : null;
|
|
63
|
+
return c.json({
|
|
64
|
+
automation,
|
|
65
|
+
deleted: Boolean(setup.automationId && !automation)
|
|
66
|
+
});
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return capabilityHttpError(c, error);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
33
71
|
authenticated.get("/api/automations", async (c) => {
|
|
34
72
|
try {
|
|
35
73
|
const { items } = ProductReadContracts["xopc.automations.list"].output.parse(await capabilities.call("xopc.automations.list", { projectId: parseProjectId(c.req.query("projectId")) }, capabilityHttpContext(c)));
|
|
@@ -3,10 +3,10 @@ import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
|
3
3
|
import { resolveAutomationSafetyForTrust } from "../../user-context/trust-policy.js";
|
|
4
4
|
import { getUserTrustPolicy } from "../../storage/sqlite/user-trust-repository.js";
|
|
5
5
|
import "../../storage/sqlite/index.js";
|
|
6
|
+
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
6
7
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
7
8
|
import { ExternalEffectNotAppliedError } from "../../capabilities/runtime/external-operations.js";
|
|
8
9
|
import { defineExternalCapability, defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
9
|
-
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
10
10
|
import { AutomationCreateCapabilityInputSchema } from "./write.js";
|
|
11
11
|
import { simulateAutomation } from "../draft/automation-draft-validator.js";
|
|
12
12
|
import { AutomationDraftService } from "../draft/automation-draft-service.js";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AutomationCancelOutputSchema, AutomationDeleteInputSchema, AutomationDeleteOutputSchema, AutomationMutationOutputSchema, AutomationReadAllInputSchema, AutomationReadAllOutputSchema, AutomationReadOutputSchema, AutomationRecoveryOutputSchema, AutomationReplayEventInputSchema, AutomationRetryDeliveryInputSchema, AutomationRunMutationOutputSchema, AutomationSetEnabledInputSchema, CapabilityResourceInputSchema } from "../../../packages/gateway-contract/src/capabilities.js";
|
|
2
2
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
3
3
|
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
4
|
-
import { defineAtomicCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
5
4
|
import { CreateAutomationSchema, UpdateAutomationSchema } from "../domain/validation.js";
|
|
6
5
|
import { getAutomation } from "../storage/automation-repository.js";
|
|
7
6
|
import { getAutomationRun, markAllAutomationRunsRead, markAutomationRunRead } from "../storage/automation-run-repository.js";
|
|
8
7
|
import "../storage/index.js";
|
|
9
8
|
import { getAutomationEventForRun } from "../events/event-repository.js";
|
|
10
9
|
import "../events/index.js";
|
|
11
|
-
import {
|
|
10
|
+
import { assertAutomationSetupTarget, bindAutomationSetup } from "../configuration-conversation.js";
|
|
11
|
+
import { defineAtomicCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
12
|
+
import { AutomationAlreadyExistsError, AutomationAlreadyRunningError, AutomationInvalidAgentError, AutomationInvalidScheduleError } from "../service/automation-service.js";
|
|
12
13
|
import { z } from "zod";
|
|
13
14
|
//#region src/automations/capabilities/write.ts
|
|
14
15
|
init_src();
|
|
@@ -34,6 +35,14 @@ function assertManagedOperation(automation, operation, patch) {
|
|
|
34
35
|
const forbidden = Object.entries(patch ?? {}).filter(([key, value]) => JSON.stringify(automation[key]) !== JSON.stringify(value)).map(([key]) => key).filter((field) => !management.editable.includes(field));
|
|
35
36
|
if (forbidden.length > 0) throw new CapabilityError("FORBIDDEN", `Managed fields cannot be changed: ${forbidden.join(", ")}`);
|
|
36
37
|
}
|
|
38
|
+
function validateSchedule(operation) {
|
|
39
|
+
try {
|
|
40
|
+
return operation();
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (error instanceof AutomationInvalidScheduleError || error instanceof AutomationInvalidAgentError) throw new CapabilityError("INVALID_INPUT", error.message);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
37
46
|
function registerAutomationWriteCapabilities(dispatcher, service, projects) {
|
|
38
47
|
const policy = {
|
|
39
48
|
majorVersion: 1,
|
|
@@ -165,7 +174,8 @@ function registerAutomationWriteCapabilities(dispatcher, service, projects) {
|
|
|
165
174
|
description: "Delete an automation at an exact revision and persist cancellation intent for its active run.",
|
|
166
175
|
input: AutomationDeleteInputSchema,
|
|
167
176
|
output: AutomationDeleteOutputSchema,
|
|
168
|
-
execute({ id, expectedRevision }) {
|
|
177
|
+
execute({ id, expectedRevision }, context) {
|
|
178
|
+
assertAutomationSetupTarget(context.conversationId, id);
|
|
169
179
|
const current = getAutomation(id);
|
|
170
180
|
if (current && current.updatedAtMs !== expectedRevision) throw new CapabilityError("REVISION_CONFLICT", "Automation changed");
|
|
171
181
|
if (current) assertManagedOperation(current, "delete");
|
|
@@ -183,12 +193,16 @@ function registerAutomationWriteCapabilities(dispatcher, service, projects) {
|
|
|
183
193
|
id: "xopc.automations.create",
|
|
184
194
|
description: "Create an automation without replacing an existing identity.",
|
|
185
195
|
input: AutomationCreateCapabilityInputSchema,
|
|
186
|
-
|
|
196
|
+
requestScope: (context) => context.conversationId ?? "",
|
|
197
|
+
execute(input, context) {
|
|
187
198
|
requireProject(input.projectId);
|
|
199
|
+
assertAutomationSetupTarget(context.conversationId);
|
|
188
200
|
try {
|
|
201
|
+
const automation = validateSchedule(() => service.createAtomically(input));
|
|
202
|
+
bindAutomationSetup(context.conversationId, automation.id);
|
|
189
203
|
return {
|
|
190
204
|
ok: true,
|
|
191
|
-
automation: { ...
|
|
205
|
+
automation: { ...automation }
|
|
192
206
|
};
|
|
193
207
|
} catch (error) {
|
|
194
208
|
if (error instanceof AutomationAlreadyExistsError) throw new CapabilityError("REVISION_CONFLICT", error.message);
|
|
@@ -205,7 +219,8 @@ function registerAutomationWriteCapabilities(dispatcher, service, projects) {
|
|
|
205
219
|
expectedRevision: z.number().int().nonnegative(),
|
|
206
220
|
patch: AutomationUpdatePatchSchema
|
|
207
221
|
}),
|
|
208
|
-
execute({ id, expectedRevision, patch }) {
|
|
222
|
+
execute({ id, expectedRevision, patch }, context) {
|
|
223
|
+
assertAutomationSetupTarget(context.conversationId, id);
|
|
209
224
|
const current = getAutomation(id);
|
|
210
225
|
if (!current) throw new CapabilityError("NOT_FOUND", "Automation not found");
|
|
211
226
|
if (current.updatedAtMs !== expectedRevision) throw new CapabilityError("REVISION_CONFLICT", "Automation changed");
|
|
@@ -213,7 +228,7 @@ function registerAutomationWriteCapabilities(dispatcher, service, projects) {
|
|
|
213
228
|
requireProject(patch.projectId);
|
|
214
229
|
return {
|
|
215
230
|
ok: true,
|
|
216
|
-
automation: { ...service.updateAtomically(id, patch) }
|
|
231
|
+
automation: { ...validateSchedule(() => service.updateAtomically(id, patch)) }
|
|
217
232
|
};
|
|
218
233
|
}
|
|
219
234
|
}));
|
|
@@ -226,12 +241,13 @@ function registerAutomationWriteCapabilities(dispatcher, service, projects) {
|
|
|
226
241
|
scopes: ["automations.write"],
|
|
227
242
|
input: AutomationSetEnabledInputSchema,
|
|
228
243
|
output: AutomationMutationOutputSchema,
|
|
229
|
-
execute({ id, enabled, expectedRevision }) {
|
|
244
|
+
execute({ id, enabled, expectedRevision }, context) {
|
|
245
|
+
assertAutomationSetupTarget(context.conversationId, id);
|
|
230
246
|
const current = getAutomation(id);
|
|
231
247
|
if (!current) throw new CapabilityError("NOT_FOUND", "Automation not found");
|
|
232
248
|
if (current.updatedAtMs !== expectedRevision) throw new CapabilityError("REVISION_CONFLICT", "Automation changed");
|
|
233
249
|
assertManagedOperation(current, "update", { enabled });
|
|
234
|
-
const automation = service.updateAtomically(id, { enabled });
|
|
250
|
+
const automation = validateSchedule(() => service.updateAtomically(id, { enabled }));
|
|
235
251
|
if (!automation) throw new CapabilityError("NOT_FOUND", "Automation not found");
|
|
236
252
|
return {
|
|
237
253
|
ok: true,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type AutomationSetup = {
|
|
2
|
+
automationId?: string;
|
|
3
|
+
focusedRunId?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function getAutomationSetup(conversationId?: string): AutomationSetup | null;
|
|
6
|
+
/** Called inside the capability transaction so creation and association commit together. */
|
|
7
|
+
export declare function bindAutomationSetup(conversationId: string | undefined, automationId: string): void;
|
|
8
|
+
export declare function assertAutomationSetupTarget(conversationId: string | undefined, automationId?: string): void;
|
|
9
|
+
/** Reuse the main configuration chat, including after a process restart. */
|
|
10
|
+
export declare function openAutomationConfiguration(input: {
|
|
11
|
+
agentId: string;
|
|
12
|
+
automationId?: string;
|
|
13
|
+
projectId?: string;
|
|
14
|
+
runId?: string;
|
|
15
|
+
}): string;
|
|
16
|
+
export declare function buildAutomationSetupContext(conversationId?: string): string;
|