@xopcai/xopc 0.0.332 → 0.0.333
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/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-C2wg3xC_.js → agent-avatar-dicebear-DiI2O7lC.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CVp3J969.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BeNnu1Ts.js → agent-plugin-dialog-CacyndrS.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DXYZSuUV.js +70 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-etFSkfzl.js → app-management-settings-panel-BcszTlqr.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DKmU2VAP.js → appearance-settings-B1XPe8qz.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DVNySL58.js → apps-page-ZqANbUZv.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D0z_Fr2G.js → archive-plugin-MjUsJcNb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DNCDbeOX.js → attachment-load-DHa-BI9a.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-B7_C-p66.js → automations-page-Dsjivdxs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B37vs5tk.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BYn2hScX.js → binary-plugins-DQYcuBHP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-ChWW8Z9L.js → block-editor-Bx0uXbJP.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C5s1yHOu.js → browser-automation-inputs-1ZIPGDeq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BV00BXRb.js → browser-automations-page-CCjYipHc.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CSv4rvmx.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-BnO9LV7U.js +1 -0
- package/dist/gateway/static/root/assets/{capabilities-page-v0WkhV5o.js → capabilities-page-BfvDvIY1.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CoW7-ESq.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-vmx35sbu.js → capability-header-actions-D_hbWRRF.js} +1 -1
- package/dist/gateway/static/root/assets/channels-BhMaRh1x.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-C41mXCAi.js → chat-terminal-dock-Fnum_IEm.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-BJkqok2G.js → computer-settings-page-DI1zfCTA.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BKCZMmwm.js → connector-service-page-CiGDAubm.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Ono0Pha1.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-CrOV4Ynd.js → date-picker-D-JhzZyW.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CqADAHZp.js → dependency-picker-DpD3xaEB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bab-iWED.js → desktop-pet-CCoDxKqh.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BqgzLOdi.js → desktop-pet-settings-GxndKfCx.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DFg7FDPf.js → device-pairing-wizard-B71w3ptm.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-hqJ9sFCR.js → directory-picker-path-field-CUzjJvjs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DX3PFhRE.js → extension-debug-page-BtDY8ntX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DkREdHLs.js → extension-page-D9_XF-XC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-wF-HNTM-.js → extension-settings-page-CjhUFAaC.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-cR-tz7-Q.js → gateway-config-swr-CgIjCxM8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Du-Dos9O.js → gateway-settings-BWaCnwT1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-6jLRcQsu.js → gateway-startup-retry-i-1lTrwY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BTjGLngn.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CSSkwsyC.js → image-generation-api-gilc-u7M.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-B80Cv043.js → imports-page-BEtq5BRU.js} +1 -1
- package/dist/gateway/static/root/assets/index-DHL16aYZ.js +121 -0
- package/dist/gateway/static/root/assets/index-N1e6PDwx.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BgoFaTwv.js → keyboard-shortcuts-settings-JUYY_18v.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-uI7mtoVz.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-HO6OQlQT.js → local-apps-page-BlYESNqz.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-wNXWkWu5.js → locale-store-BY30D6tg.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CjzR9Rpj.js → logs-page-BbLQreeN.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-c4krhYU7.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DlT9KqwF.js → markdown-view-BEeXMfDw.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dlj6TD3M.js → media-plugins-DEFN1I73.js} +1 -1
- package/dist/gateway/static/root/assets/messages-_6IXbP2u.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel--09xGxyE.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-DsxcVBXF.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-BArPtqp5.js → page-context-capture-button-D43aVpCj.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-vqI30Yrg.js → page-tabs-BhYBCqls.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-B-mwPBJW.js → preview-open-alternatives-CP8agNlc.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-D--sj_uN.js → product-open-page-CU7fRhfT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-U-EdDfAW.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-DBsBwAQ6.js → projects-page-DUOKZLt7.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-BIpltJ47.js → registry-api-BvVx0G1o.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BurdDY0m.js → remote-access-hub-fVPQe5YS.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CAnb0PNY.js → runtime-tools-settings-panel-Czvzsuj_.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-C0-WHOY3.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-BKj6wIMb.js → schema-form-B9Ni5O93.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DdXvW09N.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BtF83fBY.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-78ycUHfv.js → settings-form-section-jquf1P7n.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BOdxIVzo.js → settings-page-DPomsvba.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CbKHBjrU.js → setup-status-panel-BvVlqpHf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DyLfktib.js → share-preview-page-b9DI0N1J.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-R_qwc4DN.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CiBGQ0Jg.js → skill-api-Bu7-3w-L.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CNJAQ_e-.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C35VKjhb.js → skills-page-D7XPEQu_.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CyJUeREH.js → system-settings-panel-BwFR0Uci.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-PFjGW2g1.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-Day9zhKi.js → tunnel-api-PfucxMP3.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-t_zdQHcy.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Bj9hC6ML.js → use-autosave-DLyy2wHz.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-OyfPVfB9.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-fWRD6B8r.js → voice-api-key-field-CQDY5EBK.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-ujEySjyc.js → voice-config-api-Bwy3Al3J.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CnxdvIk8.js → work-discovery-overlay-CJzqJ47I.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DlWNN1VA.js → workflow-run-setup-panel-sCOk-esV.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DYBGjN7C.js +6 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +44 -14
- package/dist/packages/gateway-contract/src/capabilities.js +106 -8
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/scenes.js +7 -6
- package/dist/packages/gateway-contract/src/sessions.js +2 -1
- package/dist/packages/gateway-contract/src/usage.js +6 -0
- package/dist/src/agent/agent-manager.js +9 -3
- package/dist/src/agent/background-review/run-background-review.js +6 -1
- package/dist/src/agent/embedded/run-turn.js +7 -1
- package/dist/src/agent/external-tools/gateway-tools.d.ts +2 -1
- package/dist/src/agent/external-tools/gateway-tools.js +44 -11
- package/dist/src/agent/external-tools/index.js +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js +1 -1
- package/dist/src/agent/memory/compaction.js +4 -0
- package/dist/src/agent/service/btw-query.js +8 -2
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/skills/filesystem-watcher.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +4 -0
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +5 -4
- package/dist/src/agent/tools/automation-tool.d.ts +4 -1
- package/dist/src/agent/tools/automation-tool.js +42 -4
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/web-extract.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +49 -8
- package/dist/src/ai-assist/text-assist.js +5 -1
- package/dist/src/automations/api/routes.js +65 -0
- package/dist/src/automations/capabilities/read.js +24 -0
- package/dist/src/automations/capabilities/write.d.ts +52 -14
- package/dist/src/automations/capabilities/write.js +52 -3
- package/dist/src/automations/delivery/delivery-router.d.ts +50 -0
- package/dist/src/automations/delivery/delivery-router.js +318 -0
- package/dist/src/automations/delivery/index.d.ts +1 -0
- package/dist/src/automations/delivery/index.js +2 -0
- package/dist/src/automations/domain/defaults.d.ts +0 -1
- package/dist/src/automations/domain/defaults.js +1 -1
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +158 -7
- package/dist/src/automations/domain/validation.d.ts +104 -22
- package/dist/src/automations/domain/validation.js +66 -13
- package/dist/src/automations/draft/automation-draft-prompt.js +3 -4
- package/dist/src/automations/draft/automation-draft-service.js +6 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +22 -3
- package/dist/src/automations/draft/automation-draft-validator.js +4 -4
- package/dist/src/automations/events/event-catalog.d.ts +14 -0
- package/dist/src/automations/events/event-catalog.js +117 -0
- package/dist/src/automations/events/event-dispatcher.d.ts +27 -0
- package/dist/src/automations/events/event-dispatcher.js +140 -0
- package/dist/src/automations/events/event-repository.d.ts +59 -0
- package/dist/src/automations/events/event-repository.js +361 -0
- package/dist/src/automations/events/index.d.ts +3 -0
- package/dist/src/automations/events/index.js +4 -0
- package/dist/src/automations/index.d.ts +3 -1
- package/dist/src/automations/index.js +9 -3
- package/dist/src/automations/service/action-executor.d.ts +20 -1
- package/dist/src/automations/service/action-executor.js +80 -40
- package/dist/src/automations/service/automation-service.d.ts +21 -4
- package/dist/src/automations/service/automation-service.js +150 -100
- package/dist/src/automations/storage/automation-repository.js +4 -5
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +26 -1
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/automations/webhook-secrets.d.ts +1 -0
- package/dist/src/automations/webhook-secrets.js +16 -0
- package/dist/src/capabilities/store-connector.d.ts +17 -1
- package/dist/src/capabilities/store-connector.js +69 -3
- package/dist/src/cli/commands/connectors.js +4 -3
- package/dist/src/cli/commands/doctor/checks/automation-integrity.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/automation-integrity.js +55 -0
- package/dist/src/cli/commands/doctor/checks/database-relations.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/database-relations.js +81 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/flow.js +5 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/connectors/approval-resume.js +1 -1
- package/dist/src/connectors/cli/store.js +1 -1
- package/dist/src/connectors/composio-backends.js +14 -4
- package/dist/src/connectors/composio-managed-events.d.ts +5 -2
- package/dist/src/connectors/composio-managed-events.js +4 -1
- package/dist/src/connectors/connection-recovery-service.d.ts +2 -1
- package/dist/src/connectors/connection-recovery-service.js +89 -4
- package/dist/src/discussions/analyzer.js +4 -4
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/home-intelligence-automation-reconciler.js +4 -1
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/connection-waits.js +3 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +14 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +93 -3
- package/dist/src/gateway/hono/routes/scenes.js +57 -41
- package/dist/src/gateway/hono/routes/sessions.js +15 -0
- package/dist/src/gateway/hono/routes/usage.d.ts +3 -0
- package/dist/src/gateway/hono/routes/usage.js +61 -0
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +5 -2
- package/dist/src/gateway/scenes/host.js +27 -14
- package/dist/src/gateway/scenes/slackThreadSource.d.ts +2 -2
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/active-execution.d.ts +19 -0
- package/dist/src/gateway/service/active-execution.js +16 -0
- package/dist/src/gateway/service/agent-runner.d.ts +4 -0
- package/dist/src/gateway/service/agent-runner.js +19 -1
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
- package/dist/src/gateway/service/run-gateway-agent.js +9 -1
- package/dist/src/gateway/service/sessions-api.d.ts +13 -0
- package/dist/src/gateway/service/sessions-api.js +23 -0
- package/dist/src/gateway/service.d.ts +6 -3
- package/dist/src/gateway/service.js +82 -85
- package/dist/src/gateway/side-chat/run-service.js +10 -7
- package/dist/src/home-intelligence/generator.js +4 -1
- package/dist/src/home-intelligence/host.js +1 -1
- package/dist/src/infra/domain-outbox-dispatcher.d.ts +0 -3
- package/dist/src/infra/domain-outbox-dispatcher.js +15 -7
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/notes/service.js +2 -3
- package/dist/src/projects/project-service.js +1 -2
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/providers/model-call.d.ts +3 -2
- package/dist/src/providers/model-call.js +30 -5
- package/dist/src/scenes/activationAdapter.d.ts +19 -0
- package/dist/src/scenes/activationAdapter.js +1 -0
- package/dist/src/scenes/agentExecutor.js +3 -10
- package/dist/src/scenes/contracts.d.ts +3 -9
- package/dist/src/scenes/contracts.js +1 -0
- package/dist/src/scenes/execution.d.ts +9 -3
- package/dist/src/scenes/execution.js +12 -11
- package/dist/src/scenes/httpServices.d.ts +5 -2
- package/dist/src/scenes/mailContext.d.ts +4 -0
- package/dist/src/scenes/mailContext.js +9 -0
- package/dist/src/scenes/maintenance.js +1 -5
- package/dist/src/scenes/metrics.d.ts +0 -6
- package/dist/src/scenes/metrics.js +0 -11
- package/dist/src/scenes/registry.d.ts +11 -0
- package/dist/src/scenes/registry.js +28 -0
- package/dist/src/scenes/repository.d.ts +6 -3
- package/dist/src/scenes/repository.js +43 -5
- package/dist/src/scenes/service.d.ts +2 -1
- package/dist/src/scenes/service.js +9 -7
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +37 -7
- package/dist/src/scenes/taskFollowUp/contracts.js +36 -17
- package/dist/src/scenes/taskFollowUp/service.d.ts +35 -7
- package/dist/src/scenes/taskFollowUp/service.js +86 -28
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/scenes/userNotes.d.ts +3 -0
- package/dist/src/scenes/userNotes.js +6 -0
- package/dist/src/session/client-history.d.ts +3 -0
- package/dist/src/session/client-history.js +10 -5
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/resolve-session.js +4 -3
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +3 -2
- package/dist/src/storage/sqlite/ai-usage-repository.d.ts +137 -0
- package/dist/src/storage/sqlite/ai-usage-repository.js +175 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +7 -5
- package/dist/src/storage/sqlite/connector-repository.js +36 -34
- package/dist/src/storage/sqlite/index.d.ts +2 -2
- package/dist/src/storage/sqlite/index.js +3 -3
- package/dist/src/storage/sqlite/migrations/209_automation_event_hub.sql +48 -0
- package/dist/src/storage/sqlite/migrations/210_remove_legacy_automation_timeout.sql +14 -0
- package/dist/src/storage/sqlite/migrations/211_automation_result_deliveries.sql +16 -0
- package/dist/src/storage/sqlite/migrations/212_automation_delivery_policy.sql +30 -0
- package/dist/src/storage/sqlite/migrations/213_automation_reliability_contract.sql +188 -0
- package/dist/src/storage/sqlite/migrations/214_ai_usage_ledger.sql +41 -0
- package/dist/src/storage/sqlite/migrations/215_scene_execution_adapters.sql +6 -0
- package/dist/src/storage/sqlite/migrations/216_remove_scene_model_usage.sql +1 -0
- package/dist/src/storage/sqlite/migrations/217_remove_legacy_memory_tables.sql +4 -0
- package/dist/src/storage/sqlite/migrations/218_core_relation_indexes.sql +26 -0
- package/dist/src/storage/sqlite/migrations/219_json_contracts.sql +123 -0
- package/dist/src/storage/sqlite/migrations/220_normalize_timestamps.sql +339 -0
- package/dist/src/storage/sqlite/migrations/221_ai_usage_retention_index.sql +2 -0
- package/dist/src/storage/sqlite/migrations/222_session_config_authority.sql +13 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +4 -4
- package/dist/src/storage/sqlite/row-mappers.d.ts +3 -7
- package/dist/src/storage/sqlite/row-mappers.js +6 -6
- package/dist/src/storage/sqlite/scenes-schema.d.ts +1 -1
- package/dist/src/storage/sqlite/scenes-schema.js +0 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +0 -52
- package/dist/src/storage/sqlite/schemas/scenes.sql +0 -7
- package/dist/src/storage/sqlite/session-input-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-input-repository.js +18 -1
- package/dist/src/storage/sqlite/session-read-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-read-repository.js +0 -1
- package/dist/src/storage/sqlite/session-repository.d.ts +0 -4
- package/dist/src/storage/sqlite/session-repository.js +8 -18
- package/dist/src/storage/sqlite/timestamps.d.ts +4 -0
- package/dist/src/storage/sqlite/timestamps.js +20 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/transcript-repository.js +23 -15
- package/dist/src/storage/sqlite/user-trust-repository.js +4 -2
- package/dist/src/tasks/capabilities/write.d.ts +1 -1
- package/dist/src/tasks/home-query-service.js +3 -3
- package/dist/src/tasks/task-contract-planner.js +1 -1
- package/dist/src/usage/cost.d.ts +4 -0
- package/dist/src/usage/cost.js +28 -0
- package/dist/src/usage/recorder.d.ts +13 -0
- package/dist/src/usage/recorder.js +117 -0
- package/dist/src/usage/scenario-registry.d.ts +8 -0
- package/dist/src/usage/scenario-registry.js +117 -0
- package/dist/src/usage/types.d.ts +55 -0
- package/dist/src/usage/types.js +1 -0
- package/dist/src/voice/tts/summarize.js +1 -1
- package/dist/src/work-discovery/analyzer.js +2 -2
- package/dist/src/work-discovery/investigator.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +15 -2
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Se1Z72VG.js +0 -1
- package/dist/gateway/static/root/assets/agents-udIitwV8.js +0 -70
- package/dist/gateway/static/root/assets/automations-workspace-BMgJvdcv.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-xwTmuZjS.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-CHA-sTAZ.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DefBGjhV.js +0 -8
- package/dist/gateway/static/root/assets/channels-Eo4ONF5X.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DZYgogQw.js +0 -2
- package/dist/gateway/static/root/assets/home-page-D7YoMHq4.js +0 -1
- package/dist/gateway/static/root/assets/index-BEw0xrde.css +0 -1
- package/dist/gateway/static/root/assets/index-DalslRUx.js +0 -121
- package/dist/gateway/static/root/assets/local-app-workbench-page-BKL5UZAj.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-Dk_gTJb9.js +0 -1
- package/dist/gateway/static/root/assets/messages-fmf0dnr4.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-BebJPjjk.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-CmS_hvz8.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BFUdtWXF.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-Cj8xtr5t.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-BCsjgkCs.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BLL7csOJ.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BzvSNouj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BHnru0F5.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bd1_Fguk.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DuYzuR1T.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-B45YDiEw.js +0 -6
- package/dist/src/automations/product-events.d.ts +0 -5
- package/dist/src/automations/product-events.js +0 -19
|
@@ -67,15 +67,41 @@ export interface AutomationManagement {
|
|
|
67
67
|
}
|
|
68
68
|
export type AutomationConversationMode = 'new_session' | 'continuous';
|
|
69
69
|
export type AutomationNotificationPolicy = 'attention' | 'all' | 'none';
|
|
70
|
+
export type AutomationDeliveryDestination = {
|
|
71
|
+
key: string;
|
|
72
|
+
kind: 'gateway_event';
|
|
73
|
+
} | {
|
|
74
|
+
key: string;
|
|
75
|
+
kind: 'webhook';
|
|
76
|
+
endpoint: string;
|
|
77
|
+
secretId: string;
|
|
78
|
+
} | {
|
|
79
|
+
key: string;
|
|
80
|
+
kind: 'file';
|
|
81
|
+
targetId: string;
|
|
82
|
+
pathTemplate: string;
|
|
83
|
+
} | {
|
|
84
|
+
key: string;
|
|
85
|
+
kind: 'card';
|
|
86
|
+
channelId: string;
|
|
87
|
+
templateId: string;
|
|
88
|
+
};
|
|
89
|
+
export interface AutomationDeliveryPolicy {
|
|
90
|
+
notificationPolicy: AutomationNotificationPolicy;
|
|
91
|
+
destinations: AutomationDeliveryDestination[];
|
|
92
|
+
}
|
|
93
|
+
export interface AutomationRunDeliveryContext {
|
|
94
|
+
notificationPolicy: AutomationNotificationPolicy;
|
|
95
|
+
requiresAttention: boolean;
|
|
96
|
+
projectId?: string;
|
|
97
|
+
}
|
|
70
98
|
export interface AutomationReliability {
|
|
71
|
-
/** Overall run deadline. `timeoutSeconds` remains a read-only legacy fallback. */
|
|
72
99
|
executionTimeoutSeconds?: number;
|
|
73
|
-
timeoutSeconds?: number;
|
|
74
100
|
retryCount?: number;
|
|
75
101
|
maxConcurrentRuns?: number;
|
|
76
102
|
disableAfterConsecutiveFailures?: number;
|
|
77
103
|
}
|
|
78
|
-
export type AutomationRunPhase = 'queued' | 'action' | '
|
|
104
|
+
export type AutomationRunPhase = 'queued' | 'action' | 'cancelling' | 'completed';
|
|
79
105
|
export interface AutomationRunTermination {
|
|
80
106
|
reason: 'completed' | 'failed' | 'user_cancelled' | 'deadline_exceeded';
|
|
81
107
|
component?: 'automation' | 'agent_turn' | 'tool' | 'mcp' | 'process';
|
|
@@ -104,8 +130,7 @@ export interface Automation {
|
|
|
104
130
|
action: AutomationAction;
|
|
105
131
|
safety?: AutomationSafetyPolicy;
|
|
106
132
|
conversationMode: AutomationConversationMode;
|
|
107
|
-
|
|
108
|
-
completionWebhookUrl?: string;
|
|
133
|
+
delivery: AutomationDeliveryPolicy;
|
|
109
134
|
reliability?: AutomationReliability;
|
|
110
135
|
management?: AutomationManagement;
|
|
111
136
|
state: AutomationState;
|
|
@@ -142,7 +167,7 @@ export interface AutomationRun {
|
|
|
142
167
|
rootRunId?: string;
|
|
143
168
|
readAtMs?: number;
|
|
144
169
|
}
|
|
145
|
-
export type AutomationRunEventType = 'run.queued' | 'run.started' | 'run.deadline_resolved' | 'run.cancel_requested' | 'run.cancel_confirmed' | 'run.cancellation_unconfirmed' | 'run.recovered' | 'action.started' | 'action.retry_scheduled' | 'action.completed' | 'action.failed' | '
|
|
170
|
+
export type AutomationRunEventType = 'run.queued' | 'run.started' | 'run.deadline_resolved' | 'run.cancel_requested' | 'run.cancel_confirmed' | 'run.cancellation_unconfirmed' | 'run.recovered' | 'action.started' | 'action.retry_scheduled' | 'action.completed' | 'action.failed' | 'run.completed';
|
|
146
171
|
export interface AutomationRunEvent {
|
|
147
172
|
id: string;
|
|
148
173
|
runId: string;
|
|
@@ -157,10 +182,60 @@ export interface AutomationProductEventRun {
|
|
|
157
182
|
triggerEvent: AutomationRunEvent;
|
|
158
183
|
}
|
|
159
184
|
export interface AutomationEvent {
|
|
185
|
+
id?: string;
|
|
160
186
|
type: string;
|
|
161
187
|
source?: string;
|
|
188
|
+
schemaVersion?: number;
|
|
189
|
+
subject?: {
|
|
190
|
+
kind: string;
|
|
191
|
+
id: string;
|
|
192
|
+
};
|
|
162
193
|
payload?: Record<string, unknown>;
|
|
163
194
|
occurredAtMs?: number;
|
|
195
|
+
correlationId?: string;
|
|
196
|
+
causationId?: string;
|
|
197
|
+
rootEventId?: string;
|
|
198
|
+
chainDepth?: number;
|
|
199
|
+
dedupeKey?: string;
|
|
200
|
+
trust?: 'system' | 'user' | 'connector' | 'untrusted_webhook';
|
|
201
|
+
}
|
|
202
|
+
export interface AutomationEventEnvelope extends AutomationEvent {
|
|
203
|
+
id: string;
|
|
204
|
+
source: string;
|
|
205
|
+
schemaVersion: number;
|
|
206
|
+
occurredAtMs: number;
|
|
207
|
+
ingestedAtMs: number;
|
|
208
|
+
correlationId: string;
|
|
209
|
+
rootEventId: string;
|
|
210
|
+
chainDepth: number;
|
|
211
|
+
trust: 'system' | 'user' | 'connector' | 'untrusted_webhook';
|
|
212
|
+
payload: Record<string, unknown>;
|
|
213
|
+
}
|
|
214
|
+
export type AutomationEventProjectionStatus = 'pending' | 'projecting' | 'retrying' | 'projected' | 'dead_letter';
|
|
215
|
+
export type AutomationEventDeliveryStatus = 'pending' | 'retrying' | 'queued' | 'completed' | 'failed' | 'cancelled' | 'skipped' | 'dead_letter';
|
|
216
|
+
export interface AutomationEventRecord {
|
|
217
|
+
event: AutomationEventEnvelope;
|
|
218
|
+
projectionStatus: AutomationEventProjectionStatus;
|
|
219
|
+
projectionAttempts: number;
|
|
220
|
+
projectionError?: string;
|
|
221
|
+
deliveries: Array<{
|
|
222
|
+
automationId: string;
|
|
223
|
+
status: AutomationEventDeliveryStatus;
|
|
224
|
+
runId?: string;
|
|
225
|
+
attempts: number;
|
|
226
|
+
lastError?: string;
|
|
227
|
+
}>;
|
|
228
|
+
}
|
|
229
|
+
export interface AutomationResultDeliveryRecord {
|
|
230
|
+
runId: string;
|
|
231
|
+
destinationKey: string;
|
|
232
|
+
kind: string;
|
|
233
|
+
status: 'pending' | 'delivering' | 'retrying' | 'delivered' | 'dead_letter';
|
|
234
|
+
attempts: number;
|
|
235
|
+
nextAttemptAtMs: number;
|
|
236
|
+
lastError?: string;
|
|
237
|
+
createdAtMs: number;
|
|
238
|
+
updatedAtMs: number;
|
|
164
239
|
}
|
|
165
240
|
export interface AutomationMetrics {
|
|
166
241
|
totalAutomations: number;
|
|
@@ -172,7 +247,73 @@ export interface AutomationMetrics {
|
|
|
172
247
|
name: string;
|
|
173
248
|
runAtMs: number;
|
|
174
249
|
};
|
|
250
|
+
pendingEvents: number;
|
|
251
|
+
oldestPendingEventAgeMs: number;
|
|
252
|
+
projectionDeadLetters: number;
|
|
253
|
+
pendingRunDeliveries: number;
|
|
254
|
+
runDeliveryDeadLetters: number;
|
|
255
|
+
pendingResultDeliveries: number;
|
|
256
|
+
resultDeliveryDeadLetters: number;
|
|
257
|
+
activeExecutions: number;
|
|
258
|
+
activeDeliveryLeases: number;
|
|
259
|
+
}
|
|
260
|
+
export type AutomationArtifact = {
|
|
261
|
+
id: string;
|
|
262
|
+
kind: 'text';
|
|
263
|
+
text: string;
|
|
264
|
+
mediaType: 'text/plain' | 'text/markdown';
|
|
265
|
+
} | {
|
|
266
|
+
id: string;
|
|
267
|
+
kind: 'json';
|
|
268
|
+
schema: string;
|
|
269
|
+
data: Record<string, unknown>;
|
|
270
|
+
} | {
|
|
271
|
+
id: string;
|
|
272
|
+
kind: 'file';
|
|
273
|
+
uri: string;
|
|
274
|
+
name: string;
|
|
275
|
+
mediaType: string;
|
|
276
|
+
bytes?: number;
|
|
277
|
+
sha256?: string;
|
|
278
|
+
} | {
|
|
279
|
+
id: string;
|
|
280
|
+
kind: 'card';
|
|
281
|
+
schema: string;
|
|
282
|
+
data: Record<string, unknown>;
|
|
283
|
+
} | {
|
|
284
|
+
id: string;
|
|
285
|
+
kind: 'reference';
|
|
286
|
+
resourceType: string;
|
|
287
|
+
resourceId: string;
|
|
288
|
+
url?: string;
|
|
289
|
+
};
|
|
290
|
+
export interface AutomationResultEnvelope {
|
|
291
|
+
schemaVersion: 1;
|
|
292
|
+
resultId: string;
|
|
293
|
+
runId: string;
|
|
294
|
+
automationId: string;
|
|
295
|
+
status: Extract<AutomationRunStatus, 'succeeded' | 'failed' | 'cancelled' | 'timeout'>;
|
|
296
|
+
summary?: string;
|
|
297
|
+
error?: {
|
|
298
|
+
code: string;
|
|
299
|
+
message: string;
|
|
300
|
+
retryable: boolean;
|
|
301
|
+
};
|
|
302
|
+
artifacts: AutomationArtifact[];
|
|
303
|
+
correlationId: string;
|
|
304
|
+
rootEventId: string;
|
|
305
|
+
createdAtMs: number;
|
|
306
|
+
completedAtMs: number;
|
|
175
307
|
}
|
|
308
|
+
export type AutomationRetrySafety = {
|
|
309
|
+
mode: 'never';
|
|
310
|
+
} | {
|
|
311
|
+
mode: 'idempotent';
|
|
312
|
+
key: 'run_id';
|
|
313
|
+
} | {
|
|
314
|
+
mode: 'transient_only';
|
|
315
|
+
classify: (error: unknown) => boolean;
|
|
316
|
+
};
|
|
176
317
|
export interface PrepareAutomationAgentSessionInput {
|
|
177
318
|
automationName?: string;
|
|
178
319
|
conversationId: string;
|
|
@@ -210,7 +351,16 @@ export interface AutomationDeps {
|
|
|
210
351
|
error?: string;
|
|
211
352
|
}>;
|
|
212
353
|
};
|
|
213
|
-
onRunCompleted?: (run: AutomationRun) => void
|
|
354
|
+
onRunCompleted?: (run: AutomationRun, context: AutomationRunDeliveryContext) => void | Promise<void>;
|
|
355
|
+
onEvent?: (event: AutomationEventEnvelope, signal?: AbortSignal) => void | Promise<void>;
|
|
356
|
+
onReliabilityAttention?: (input: {
|
|
357
|
+
phase: 'event_projection' | 'event_delivery' | 'result_delivery';
|
|
358
|
+
eventId?: string;
|
|
359
|
+
automationId?: string;
|
|
360
|
+
runId?: string;
|
|
361
|
+
destinationKey?: string;
|
|
362
|
+
error: string;
|
|
363
|
+
}) => void;
|
|
214
364
|
executeTaskCommand?: (input: {
|
|
215
365
|
taskId: string;
|
|
216
366
|
idempotencyKey: string;
|
|
@@ -242,6 +392,7 @@ export interface AutomationActionTask {
|
|
|
242
392
|
model?: string;
|
|
243
393
|
deadlineAtMs?: number;
|
|
244
394
|
termination?: AutomationRunTermination;
|
|
395
|
+
artifacts?: AutomationArtifact[];
|
|
245
396
|
}
|
|
246
397
|
export interface AutomationActionExecutionHooks {
|
|
247
398
|
onRunPatch?: (patch: Partial<AutomationRun>) => void | Promise<void>;
|
|
@@ -171,7 +171,6 @@ export declare const AutomationManagementSchema: z.ZodObject<{
|
|
|
171
171
|
}, z.core.$strict>;
|
|
172
172
|
export declare const AutomationReliabilitySchema: z.ZodObject<{
|
|
173
173
|
executionTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
174
|
-
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
175
174
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
176
175
|
maxConcurrentRuns: z.ZodOptional<z.ZodNumber>;
|
|
177
176
|
disableAfterConsecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -183,6 +182,32 @@ export declare const AutomationSafetyPolicySchema: z.ZodObject<{
|
|
|
183
182
|
auto_apply: "auto_apply";
|
|
184
183
|
}>;
|
|
185
184
|
}, z.core.$strict>;
|
|
185
|
+
export declare const AutomationDeliveryPolicySchema: z.ZodObject<{
|
|
186
|
+
notificationPolicy: z.ZodDefault<z.ZodEnum<{
|
|
187
|
+
attention: "attention";
|
|
188
|
+
all: "all";
|
|
189
|
+
none: "none";
|
|
190
|
+
}>>;
|
|
191
|
+
destinations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
192
|
+
key: z.ZodString;
|
|
193
|
+
kind: z.ZodLiteral<"gateway_event">;
|
|
194
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
195
|
+
key: z.ZodString;
|
|
196
|
+
kind: z.ZodLiteral<"webhook">;
|
|
197
|
+
endpoint: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
198
|
+
secretId: z.ZodString;
|
|
199
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
200
|
+
key: z.ZodString;
|
|
201
|
+
kind: z.ZodLiteral<"file">;
|
|
202
|
+
targetId: z.ZodString;
|
|
203
|
+
pathTemplate: z.ZodString;
|
|
204
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
205
|
+
key: z.ZodString;
|
|
206
|
+
kind: z.ZodLiteral<"card">;
|
|
207
|
+
channelId: z.ZodString;
|
|
208
|
+
templateId: z.ZodString;
|
|
209
|
+
}, z.core.$strict>], "kind">>>;
|
|
210
|
+
}, z.core.$strict>;
|
|
186
211
|
export declare const AutomationStateSchema: z.ZodObject<{
|
|
187
212
|
nextRunAtMs: z.ZodOptional<z.ZodNumber>;
|
|
188
213
|
runningRunId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string>>;
|
|
@@ -365,15 +390,34 @@ export declare const AutomationSchema: z.ZodObject<{
|
|
|
365
390
|
new_session: "new_session";
|
|
366
391
|
continuous: "continuous";
|
|
367
392
|
}>>;
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
393
|
+
delivery: z.ZodDefault<z.ZodObject<{
|
|
394
|
+
notificationPolicy: z.ZodDefault<z.ZodEnum<{
|
|
395
|
+
attention: "attention";
|
|
396
|
+
all: "all";
|
|
397
|
+
none: "none";
|
|
398
|
+
}>>;
|
|
399
|
+
destinations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
400
|
+
key: z.ZodString;
|
|
401
|
+
kind: z.ZodLiteral<"gateway_event">;
|
|
402
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
403
|
+
key: z.ZodString;
|
|
404
|
+
kind: z.ZodLiteral<"webhook">;
|
|
405
|
+
endpoint: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
406
|
+
secretId: z.ZodString;
|
|
407
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
408
|
+
key: z.ZodString;
|
|
409
|
+
kind: z.ZodLiteral<"file">;
|
|
410
|
+
targetId: z.ZodString;
|
|
411
|
+
pathTemplate: z.ZodString;
|
|
412
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
413
|
+
key: z.ZodString;
|
|
414
|
+
kind: z.ZodLiteral<"card">;
|
|
415
|
+
channelId: z.ZodString;
|
|
416
|
+
templateId: z.ZodString;
|
|
417
|
+
}, z.core.$strict>], "kind">>>;
|
|
418
|
+
}, z.core.$strict>>;
|
|
374
419
|
reliability: z.ZodOptional<z.ZodObject<{
|
|
375
420
|
executionTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
376
|
-
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
377
421
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
378
422
|
maxConcurrentRuns: z.ZodOptional<z.ZodNumber>;
|
|
379
423
|
disableAfterConsecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -570,15 +614,34 @@ export declare const CreateAutomationSchema: z.ZodObject<{
|
|
|
570
614
|
new_session: "new_session";
|
|
571
615
|
continuous: "continuous";
|
|
572
616
|
}>>;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
617
|
+
delivery: z.ZodDefault<z.ZodObject<{
|
|
618
|
+
notificationPolicy: z.ZodDefault<z.ZodEnum<{
|
|
619
|
+
attention: "attention";
|
|
620
|
+
all: "all";
|
|
621
|
+
none: "none";
|
|
622
|
+
}>>;
|
|
623
|
+
destinations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
624
|
+
key: z.ZodString;
|
|
625
|
+
kind: z.ZodLiteral<"gateway_event">;
|
|
626
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
627
|
+
key: z.ZodString;
|
|
628
|
+
kind: z.ZodLiteral<"webhook">;
|
|
629
|
+
endpoint: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
630
|
+
secretId: z.ZodString;
|
|
631
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
632
|
+
key: z.ZodString;
|
|
633
|
+
kind: z.ZodLiteral<"file">;
|
|
634
|
+
targetId: z.ZodString;
|
|
635
|
+
pathTemplate: z.ZodString;
|
|
636
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
637
|
+
key: z.ZodString;
|
|
638
|
+
kind: z.ZodLiteral<"card">;
|
|
639
|
+
channelId: z.ZodString;
|
|
640
|
+
templateId: z.ZodString;
|
|
641
|
+
}, z.core.$strict>], "kind">>>;
|
|
642
|
+
}, z.core.$strict>>;
|
|
579
643
|
reliability: z.ZodOptional<z.ZodObject<{
|
|
580
644
|
executionTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
581
|
-
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
582
645
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
583
646
|
maxConcurrentRuns: z.ZodOptional<z.ZodNumber>;
|
|
584
647
|
disableAfterConsecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -772,10 +835,8 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
|
|
|
772
835
|
auto_apply: "auto_apply";
|
|
773
836
|
}>;
|
|
774
837
|
}, z.core.$strict>>>;
|
|
775
|
-
completionWebhookUrl: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string>>>;
|
|
776
838
|
reliability: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
777
839
|
executionTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
778
|
-
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
779
840
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
780
841
|
maxConcurrentRuns: z.ZodOptional<z.ZodNumber>;
|
|
781
842
|
disableAfterConsecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -793,11 +854,32 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
|
|
|
793
854
|
new_session: "new_session";
|
|
794
855
|
continuous: "continuous";
|
|
795
856
|
}>>;
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
857
|
+
delivery: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
858
|
+
notificationPolicy: z.ZodDefault<z.ZodEnum<{
|
|
859
|
+
attention: "attention";
|
|
860
|
+
all: "all";
|
|
861
|
+
none: "none";
|
|
862
|
+
}>>;
|
|
863
|
+
destinations: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
864
|
+
key: z.ZodString;
|
|
865
|
+
kind: z.ZodLiteral<"gateway_event">;
|
|
866
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
867
|
+
key: z.ZodString;
|
|
868
|
+
kind: z.ZodLiteral<"webhook">;
|
|
869
|
+
endpoint: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
870
|
+
secretId: z.ZodString;
|
|
871
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
872
|
+
key: z.ZodString;
|
|
873
|
+
kind: z.ZodLiteral<"file">;
|
|
874
|
+
targetId: z.ZodString;
|
|
875
|
+
pathTemplate: z.ZodString;
|
|
876
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
877
|
+
key: z.ZodString;
|
|
878
|
+
kind: z.ZodLiteral<"card">;
|
|
879
|
+
channelId: z.ZodString;
|
|
880
|
+
templateId: z.ZodString;
|
|
881
|
+
}, z.core.$strict>], "kind">>>;
|
|
882
|
+
}, z.core.$strict>>>;
|
|
801
883
|
state: z.ZodOptional<z.ZodObject<{
|
|
802
884
|
nextRunAtMs: z.ZodOptional<z.ZodNumber>;
|
|
803
885
|
runningRunId: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string, string>>;
|
|
@@ -6,6 +6,19 @@ import { CronExpressionParser } from "cron-parser";
|
|
|
6
6
|
init_src();
|
|
7
7
|
const nonEmptyString = z.string().trim().min(1);
|
|
8
8
|
const optionalTrimmedString = (max) => z.string().trim().max(max).nullish().transform((value) => value || void 0);
|
|
9
|
+
const httpsUrl = z.string().trim().min(1).max(2e3).transform((value, ctx) => {
|
|
10
|
+
try {
|
|
11
|
+
const parsed = new URL(value);
|
|
12
|
+
if (parsed.protocol !== "https:") throw new Error("unsupported protocol");
|
|
13
|
+
return parsed.toString();
|
|
14
|
+
} catch {
|
|
15
|
+
ctx.addIssue({
|
|
16
|
+
code: "custom",
|
|
17
|
+
message: "Webhook endpoint must be a valid HTTPS URL"
|
|
18
|
+
});
|
|
19
|
+
return z.NEVER;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
9
22
|
const AutomationScheduleSchema = z.discriminatedUnion("kind", [
|
|
10
23
|
z.object({
|
|
11
24
|
kind: z.literal("once"),
|
|
@@ -108,7 +121,6 @@ const AutomationManagementSchema = z.object({
|
|
|
108
121
|
}).strict();
|
|
109
122
|
const AutomationReliabilitySchema = z.object({
|
|
110
123
|
executionTimeoutSeconds: z.number().int().min(1).max(86400).optional(),
|
|
111
|
-
timeoutSeconds: z.number().int().min(1).max(86400).optional(),
|
|
112
124
|
retryCount: z.number().int().min(0).max(10).optional(),
|
|
113
125
|
maxConcurrentRuns: z.number().int().min(1).max(20).optional(),
|
|
114
126
|
disableAfterConsecutiveFailures: z.number().int().min(1).max(100).optional()
|
|
@@ -118,6 +130,50 @@ const AutomationSafetyPolicySchema = z.object({ mode: z.enum([
|
|
|
118
130
|
"ask_before_apply",
|
|
119
131
|
"auto_apply"
|
|
120
132
|
]) }).strict();
|
|
133
|
+
const AutomationDeliveryPolicySchema = z.object({
|
|
134
|
+
notificationPolicy: z.enum([
|
|
135
|
+
"attention",
|
|
136
|
+
"all",
|
|
137
|
+
"none"
|
|
138
|
+
]).default("attention"),
|
|
139
|
+
destinations: z.array(z.discriminatedUnion("kind", [
|
|
140
|
+
z.object({
|
|
141
|
+
key: nonEmptyString.max(100),
|
|
142
|
+
kind: z.literal("gateway_event")
|
|
143
|
+
}).strict(),
|
|
144
|
+
z.object({
|
|
145
|
+
key: nonEmptyString.max(100),
|
|
146
|
+
kind: z.literal("webhook"),
|
|
147
|
+
endpoint: httpsUrl,
|
|
148
|
+
secretId: nonEmptyString.max(200)
|
|
149
|
+
}).strict(),
|
|
150
|
+
z.object({
|
|
151
|
+
key: nonEmptyString.max(100),
|
|
152
|
+
kind: z.literal("file"),
|
|
153
|
+
targetId: nonEmptyString.max(200),
|
|
154
|
+
pathTemplate: nonEmptyString.max(2e3)
|
|
155
|
+
}).strict(),
|
|
156
|
+
z.object({
|
|
157
|
+
key: nonEmptyString.max(100),
|
|
158
|
+
kind: z.literal("card"),
|
|
159
|
+
channelId: nonEmptyString.max(200),
|
|
160
|
+
templateId: nonEmptyString.max(200)
|
|
161
|
+
}).strict()
|
|
162
|
+
])).max(20).superRefine((destinations, ctx) => {
|
|
163
|
+
const keys = /* @__PURE__ */ new Set();
|
|
164
|
+
destinations.forEach((destination, index) => {
|
|
165
|
+
if (keys.has(destination.key)) ctx.addIssue({
|
|
166
|
+
code: "custom",
|
|
167
|
+
path: [index, "key"],
|
|
168
|
+
message: `Duplicate destination key: ${destination.key}`
|
|
169
|
+
});
|
|
170
|
+
keys.add(destination.key);
|
|
171
|
+
});
|
|
172
|
+
}).default([{
|
|
173
|
+
key: "gateway_event",
|
|
174
|
+
kind: "gateway_event"
|
|
175
|
+
}])
|
|
176
|
+
}).strict();
|
|
121
177
|
const AutomationStateSchema = z.object({
|
|
122
178
|
nextRunAtMs: z.number().int().nonnegative().optional(),
|
|
123
179
|
runningRunId: optionalTrimmedString(100),
|
|
@@ -144,12 +200,13 @@ const AutomationSchema = z.object({
|
|
|
144
200
|
action: AutomationActionSchema,
|
|
145
201
|
safety: AutomationSafetyPolicySchema.optional(),
|
|
146
202
|
conversationMode: z.enum(["new_session", "continuous"]).default("new_session"),
|
|
147
|
-
|
|
148
|
-
"attention",
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
203
|
+
delivery: AutomationDeliveryPolicySchema.default({
|
|
204
|
+
notificationPolicy: "attention",
|
|
205
|
+
destinations: [{
|
|
206
|
+
key: "gateway_event",
|
|
207
|
+
kind: "gateway_event"
|
|
208
|
+
}]
|
|
209
|
+
}),
|
|
153
210
|
reliability: AutomationReliabilitySchema.optional(),
|
|
154
211
|
management: AutomationManagementSchema.optional(),
|
|
155
212
|
state: AutomationStateSchema.default({}),
|
|
@@ -173,12 +230,8 @@ const UpdateAutomationSchema = AutomationSchema.omit({
|
|
|
173
230
|
updatedAtMs: true
|
|
174
231
|
}).extend({
|
|
175
232
|
conversationMode: z.enum(["new_session", "continuous"]),
|
|
176
|
-
|
|
177
|
-
"attention",
|
|
178
|
-
"all",
|
|
179
|
-
"none"
|
|
180
|
-
]),
|
|
233
|
+
delivery: AutomationDeliveryPolicySchema.optional(),
|
|
181
234
|
state: AutomationStateSchema
|
|
182
235
|
}).partial().refine((data) => Object.keys(data).length > 0, { message: "At least one field must be provided" });
|
|
183
236
|
//#endregion
|
|
184
|
-
export { AutomationActionSchema, AutomationManagementSchema, AutomationReliabilitySchema, AutomationSafetyPolicySchema, AutomationScheduleSchema, AutomationSchema, AutomationStateSchema, AutomationTriggerSchema, CreateAutomationSchema, UpdateAutomationSchema };
|
|
237
|
+
export { AutomationActionSchema, AutomationDeliveryPolicySchema, AutomationManagementSchema, AutomationReliabilitySchema, AutomationSafetyPolicySchema, AutomationScheduleSchema, AutomationSchema, AutomationStateSchema, AutomationTriggerSchema, CreateAutomationSchema, UpdateAutomationSchema };
|
|
@@ -11,7 +11,7 @@ JSON shape:
|
|
|
11
11
|
"action": { "kind": "agent", "instruction": "clear instruction for the agent" },
|
|
12
12
|
"safety": { "mode": "suggest_only" },
|
|
13
13
|
"conversationMode": "new_session",
|
|
14
|
-
"notificationPolicy": "attention",
|
|
14
|
+
"delivery": { "notificationPolicy": "attention" },
|
|
15
15
|
"reliability": { "executionTimeoutSeconds": 300, "disableAfterConsecutiveFailures": 3 }
|
|
16
16
|
},
|
|
17
17
|
"explanation": "Short explanation",
|
|
@@ -52,7 +52,7 @@ Rules:
|
|
|
52
52
|
- Use cron for daily/weekly schedules. Use standard 5-field cron.
|
|
53
53
|
- Keep executionTimeoutSeconds between 60 and 1800.
|
|
54
54
|
- Use conversationMode "new_session" unless the user explicitly wants each run to continue the same conversation.
|
|
55
|
-
- Use notificationPolicy "attention" unless the user explicitly requests every-run notifications or no notifications.
|
|
55
|
+
- Use delivery.notificationPolicy "attention" unless the user explicitly requests every-run notifications or no notifications.
|
|
56
56
|
- Language for user-facing copy: ${params.language ?? "en"}.
|
|
57
57
|
|
|
58
58
|
User request:
|
|
@@ -85,8 +85,7 @@ JSON shape:
|
|
|
85
85
|
"action": "optional complete action object",
|
|
86
86
|
"safety": "optional complete safety object",
|
|
87
87
|
"conversationMode": "optional new_session or continuous",
|
|
88
|
-
"notificationPolicy": "optional attention, all, or none",
|
|
89
|
-
"completionWebhookUrl": "optional HTTPS URL",
|
|
88
|
+
"delivery": { "notificationPolicy": "optional attention, all, or none", "destinations": [{ "key": "stable key", "kind": "gateway_event or webhook", "endpoint": "HTTPS URL for webhook", "secretId": "outbound secret id for webhook" }] },
|
|
90
89
|
"reliability": "optional complete reliability object",
|
|
91
90
|
"enabled": true
|
|
92
91
|
},
|
|
@@ -37,6 +37,9 @@ var AutomationDraftService = class {
|
|
|
37
37
|
maxTokens: 2048,
|
|
38
38
|
temperature: attempt === 0 ? .2 : .1,
|
|
39
39
|
signal
|
|
40
|
+
}, void 0, {
|
|
41
|
+
operation: "automation.generate_draft",
|
|
42
|
+
trigger: attempt === 0 ? "user" : "retry"
|
|
40
43
|
}));
|
|
41
44
|
try {
|
|
42
45
|
return buildAutomationDraftResponse(parseGeneratedAutomationDraft(lastText), attempt);
|
|
@@ -90,6 +93,9 @@ var AutomationDraftService = class {
|
|
|
90
93
|
maxTokens: 2048,
|
|
91
94
|
temperature: attempt === 0 ? .15 : .05,
|
|
92
95
|
signal
|
|
96
|
+
}, void 0, {
|
|
97
|
+
operation: "automation.generate_draft",
|
|
98
|
+
trigger: attempt === 0 ? "user" : "retry"
|
|
93
99
|
}));
|
|
94
100
|
try {
|
|
95
101
|
return parseGeneratedAutomationRepairDraft(lastText, attempt);
|
|
@@ -12,7 +12,28 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
|
|
|
12
12
|
automation: {
|
|
13
13
|
name: string;
|
|
14
14
|
conversationMode: "new_session" | "continuous";
|
|
15
|
-
|
|
15
|
+
delivery: {
|
|
16
|
+
notificationPolicy: "attention" | "all" | "none";
|
|
17
|
+
destinations: ({
|
|
18
|
+
key: string;
|
|
19
|
+
kind: "gateway_event";
|
|
20
|
+
} | {
|
|
21
|
+
key: string;
|
|
22
|
+
kind: "webhook";
|
|
23
|
+
secretId: string;
|
|
24
|
+
endpoint?: string;
|
|
25
|
+
} | {
|
|
26
|
+
key: string;
|
|
27
|
+
kind: "file";
|
|
28
|
+
targetId: string;
|
|
29
|
+
pathTemplate: string;
|
|
30
|
+
} | {
|
|
31
|
+
key: string;
|
|
32
|
+
kind: "card";
|
|
33
|
+
channelId: string;
|
|
34
|
+
templateId: string;
|
|
35
|
+
})[];
|
|
36
|
+
};
|
|
16
37
|
projectId?: string;
|
|
17
38
|
action?: {
|
|
18
39
|
kind: "agent";
|
|
@@ -135,10 +156,8 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
|
|
|
135
156
|
safety?: {
|
|
136
157
|
mode: "suggest_only" | "ask_before_apply" | "auto_apply";
|
|
137
158
|
};
|
|
138
|
-
completionWebhookUrl?: string;
|
|
139
159
|
reliability?: {
|
|
140
160
|
executionTimeoutSeconds?: number;
|
|
141
|
-
timeoutSeconds?: number;
|
|
142
161
|
retryCount?: number;
|
|
143
162
|
maxConcurrentRuns?: number;
|
|
144
163
|
disableAfterConsecutiveFailures?: number;
|
|
@@ -54,9 +54,9 @@ function simulateAutomation(input) {
|
|
|
54
54
|
const triggerSummary = summarizeTrigger(automation.trigger);
|
|
55
55
|
const actionSummary = summarizeAction(automation.action);
|
|
56
56
|
if (automation.action.kind === "agent" && /delete|remove|send|post|publish|付款|删除|发送|发布/i.test(automation.action.instruction)) requiredConfirmations.push("Agent instruction may perform an external or destructive action.");
|
|
57
|
-
if (automation.
|
|
58
|
-
safetyNotes.push("The
|
|
59
|
-
requiredConfirmations.push("External
|
|
57
|
+
if (automation.delivery.destinations.some((destination) => destination.kind === "webhook")) {
|
|
58
|
+
safetyNotes.push("The result webhook will call an external URL after each run.");
|
|
59
|
+
requiredConfirmations.push("External result delivery should be reviewed before publishing.");
|
|
60
60
|
}
|
|
61
61
|
const safetyMode = automation.safety?.mode ?? "auto_apply";
|
|
62
62
|
if (safetyMode === "suggest_only") safetyNotes.push("Suggest-only safety mode will generate recommendations without applying changes.");
|
|
@@ -97,7 +97,7 @@ function summarizeAction(action) {
|
|
|
97
97
|
}
|
|
98
98
|
function repairPatchNeedsApproval(patch) {
|
|
99
99
|
if (patch.safety?.mode === "auto_apply") return true;
|
|
100
|
-
if (patch.
|
|
100
|
+
if (patch.delivery?.destinations.some((destination) => destination.kind === "webhook")) return true;
|
|
101
101
|
if (patch.trigger?.kind === "webhook") return true;
|
|
102
102
|
if (patch.action?.kind === "agent") return /delete|remove|send|post|publish|付款|删除|发送|发布/i.test(patch.action.instruction);
|
|
103
103
|
return false;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ZodType } from 'zod';
|
|
2
|
+
import type { AutomationEventEnvelope } from '../domain/types.js';
|
|
3
|
+
export interface BusinessEventDefinition<TPayload extends Record<string, unknown> = Record<string, unknown>> {
|
|
4
|
+
type: string;
|
|
5
|
+
source: string;
|
|
6
|
+
schemaVersion: number;
|
|
7
|
+
payloadSchema: ZodType<TPayload>;
|
|
8
|
+
defaultTrust: Extract<AutomationEventEnvelope['trust'], 'system' | 'user' | 'connector'>;
|
|
9
|
+
description: string;
|
|
10
|
+
subjectKind: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function registerBusinessEvent<TPayload extends Record<string, unknown>>(definition: BusinessEventDefinition<TPayload>): void;
|
|
13
|
+
export declare function validateCatalogedBusinessEvent(event: AutomationEventEnvelope): void;
|
|
14
|
+
export declare function listBusinessEventDefinitions(): BusinessEventDefinition[];
|