@xopcai/xopc 0.0.332 → 0.0.334
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/assets/{auth-DocRzRlS.js → auth-Cjj5SuoT.js} +49 -39
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +240 -36
- 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-B73q7mlz.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-B9L2YIXz.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BeNnu1Ts.js → agent-plugin-dialog-COOjsvea.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CCj1JnLu.js +70 -0
- package/dist/gateway/static/root/assets/agents-admin-api-Cuqi5xZn.js +2 -0
- package/dist/gateway/static/root/assets/{app-link-C6gA5Nck.js → app-link-DRL0YnPs.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-etFSkfzl.js → app-management-settings-panel-CckioKud.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DKmU2VAP.js → appearance-settings-DDiPIr_Q.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Azqy8vfo.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-D0z_Fr2G.js → archive-plugin-Dtyr0RhX.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-load-qjPpQzYY.js +1 -0
- package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +1 -0
- package/dist/gateway/static/root/assets/{automations-page-B7_C-p66.js → automations-page-g3SrFkTC.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-B0nW2nZD.js +7 -0
- package/dist/gateway/static/root/assets/binary-plugins-BwKQVxsU.js +2 -0
- package/dist/gateway/static/root/assets/{block-editor-ChWW8Z9L.js → block-editor-DD9d5pCt.js} +29 -29
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C5s1yHOu.js → browser-automation-inputs-D2gNdS3e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BV00BXRb.js → browser-automations-page-BKqqJR7P.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-xwTmuZjS.js → browser-settings-page-BZH9bZbk.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-CHk4RZl4.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-CfWaVH-6.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C5FcWsSe.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-Bd66yEOa.js +1 -0
- package/dist/gateway/static/root/assets/channels-DIU5Gq4o.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-C41mXCAi.js → chat-terminal-dock-B0nPDJyj.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-BJkqok2G.js → computer-settings-page-D7PxxaoG.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BKCZMmwm.js → connector-service-page-BZH4SeQg.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BC81R_fz.js +2 -0
- package/dist/gateway/static/root/assets/{turn-outcome-D0SnyZ3Z.js → constants-Co2_smKQ.js} +1 -1
- package/dist/gateway/static/root/assets/date-picker-CDEVYjXI.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-CqADAHZp.js → dependency-picker-AInmpSwC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bab-iWED.js → desktop-pet-Sjgnlq8M.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BqgzLOdi.js → desktop-pet-settings-BWn0rrhr.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-DFg7FDPf.js → device-pairing-wizard-BtW837_d.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-hqJ9sFCR.js → directory-picker-path-field-2CpmDx_D.js} +1 -1
- package/dist/gateway/static/root/assets/dist-CKkafhaS.js +1 -0
- package/dist/gateway/static/root/assets/dist-io9jFpN72.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DX3PFhRE.js → extension-debug-page-WWJFj9Z5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DkREdHLs.js → extension-page-DL00dFRr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-wF-HNTM-.js → extension-settings-page-CN-agjPk.js} +1 -1
- package/dist/gateway/static/root/assets/{files-BK6enEvD.js → files-Bw4SBGdM.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-realtime-Ciq4c7KT.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BHeHN26R.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-4oD6fhAm.js +1 -0
- 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-nEpyJUBY.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-BivdeiQ5.js} +1 -1
- package/dist/gateway/static/root/assets/index-BioG1pRD.js +106 -0
- package/dist/gateway/static/root/assets/index-DbLEkdNg.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BgoFaTwv.js → keyboard-shortcuts-settings-B_8AJTFr.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CRtZQrmz.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-HO6OQlQT.js → local-apps-page-DclxpoqR.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-Bpja8nC6.js → local-apps-yys1VChX.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DkolHmyp.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-wNXWkWu5.js → locale-store-BY30D6tg.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DX8TxkRl.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-5WFufZ4g.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DlT9KqwF.js → markdown-view-DYJnwlDr.js} +1 -1
- package/dist/gateway/static/root/assets/media-plugins-DlJDvwLK.js +1 -0
- package/dist/gateway/static/root/assets/messages-_6IXbP2u.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-GF5Q9Fqy.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-E8o4_Ty9.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-CiCmfRTw.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-vqI30Yrg.js → page-tabs-Cwp3fGVM.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-0p9PIHRy.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-B-mwPBJW.js → preview-open-alternatives-DJ5xqGeu.js} +1 -1
- package/dist/gateway/static/root/assets/{product-delivery-bv3z8Xkh.js → product-delivery-BAks11S4.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-D--sj_uN.js → product-open-page-CcGwNePw.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-6hhRBkmC.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DUOzRaFI.js +1 -0
- 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-BWpWUXiE.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CAnb0PNY.js → runtime-tools-settings-panel-C6eDCNHz.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-pF7Lmqnk.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-BKj6wIMb.js → schema-form-D8W8q_ez.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-88fK3zzl.js → schemas-CObaziC7.js} +3 -3
- package/dist/gateway/static/root/assets/session-api-BAyUr97V.js +1 -0
- package/dist/gateway/static/root/assets/session-manager-BAy2sR2Q.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-BDKDqqf9.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C9cJWlAq.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-78ycUHfv.js → settings-form-section-B0cAj0nq.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BOdxIVzo.js → settings-page-DZVVTFxs.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DZCPVx9c.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BkPNyV8c.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-Bqlv5JBi.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CiBGQ0Jg.js → skill-api-C0dufzQC.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-3JF2OTBz.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DB4lR4om.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CyJUeREH.js → system-settings-panel-xjrlhdUz.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CB6M7wSs.js +1 -0
- package/dist/gateway/static/root/assets/{tasks-CDR_RVbQ.js → tasks-QQJXsiER.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-Day9zhKi.js → tunnel-api--68MQEWM.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-OLZ00eqD.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Bj9hC6ML.js → use-autosave-DsnHYpTv.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CoePFpHD.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-fWRD6B8r.js → voice-api-key-field-CvIXutQp.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-By5_7MLR.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DlWNN1VA.js → workflow-run-setup-panel-HSMDxDXV.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DElQ47Da.js +6 -0
- package/dist/gateway/static/root/index.html +27 -21
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +44 -14
- package/dist/packages/gateway-contract/src/capabilities.js +120 -10
- package/dist/packages/gateway-contract/src/index.js +8 -2
- package/dist/packages/gateway-contract/src/scenes.js +7 -6
- package/dist/packages/gateway-contract/src/session-command-rejection.js +19 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +109 -0
- package/dist/packages/gateway-contract/src/sessions.js +2 -7
- package/dist/packages/gateway-contract/src/usage.js +6 -0
- package/dist/src/agent/agent-manager.js +15 -9
- package/dist/src/agent/background-review/run-background-review.js +8 -3
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +7 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/gateway-tools.d.ts +2 -1
- package/dist/src/agent/external-tools/gateway-tools.js +45 -11
- package/dist/src/agent/external-tools/index.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +2 -2
- 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/process-direct-streaming.js +4 -2
- package/dist/src/agent/service.js +5 -5
- package/dist/src/agent/session/session-inspector.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 +7 -3
- 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 +50 -9
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/ai-assist/text-assist.js +6 -2
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/api/routes.js +65 -0
- package/dist/src/automations/capabilities/drafts.js +1 -1
- 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/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/capabilities/store-connector.d.ts +17 -1
- package/dist/src/capabilities/store-connector.js +69 -3
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- 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/checks/provider-auth.js +2 -2
- 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/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/runtime.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +1 -1
- package/dist/src/connectors/approval-resume.js +1 -1
- package/dist/src/connectors/cli/authorization.d.ts +1 -1
- package/dist/src/connectors/cli/store.d.ts +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-candidates.js +53 -15
- package/dist/src/connectors/connection-capabilities.js +5 -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/execution-environments/local-worktree-manager.js +10 -1
- package/dist/src/execution-environments/session-environment-service.d.ts +3 -0
- package/dist/src/execution-environments/session-environment-service.js +28 -4
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/home-intelligence-automation-reconciler.js +4 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +6 -2
- package/dist/src/gateway/hono/routes/browser-session.js +4 -2
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +9 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connection-waits.js +3 -2
- package/dist/src/gateway/hono/routes/files.js +3 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +14 -1
- package/dist/src/gateway/hono/routes/models.js +17 -1
- package/dist/src/gateway/hono/routes/notes.js +2 -4
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- 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/session-command-handler.d.ts +5 -0
- package/dist/src/gateway/hono/routes/session-command-handler.js +189 -0
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +14 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
- package/dist/src/gateway/hono/routes/sessions.js +15 -168
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/tui.js +2 -1
- 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 +10 -1
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +5 -2
- package/dist/src/gateway/resolve-webchat-session-key.d.ts +1 -1
- package/dist/src/gateway/resolve-webchat-session-key.js +2 -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 +10 -2
- package/dist/src/gateway/service/session-command-service.d.ts +34 -0
- package/dist/src/gateway/service/session-command-service.js +81 -0
- package/dist/src/gateway/service/session-input-coordinator.d.ts +21 -0
- package/dist/src/gateway/service/session-input-coordinator.js +41 -0
- package/dist/src/gateway/service/session-preparation-worker.d.ts +15 -0
- package/dist/src/gateway/service/session-preparation-worker.js +125 -0
- 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 +30 -3
- package/dist/src/gateway/service.js +89 -79
- package/dist/src/gateway/side-chat/promotion-service.js +0 -1
- package/dist/src/gateway/side-chat/run-service.js +10 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/generator.js +5 -2
- 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 +2 -2
- package/dist/src/mcp/channel-bridge.js +12 -2
- package/dist/src/notes/capabilities/read.js +2 -2
- package/dist/src/notes/service.d.ts +4 -1
- package/dist/src/notes/service.js +13 -11
- package/dist/src/projects/project-service.js +1 -2
- package/dist/src/projects/project-skill-service.js +2 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.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/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- 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 -3
- 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/223_session_creation_receipts.sql +59 -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-creation-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/session-creation-repository.js +166 -0
- package/dist/src/storage/sqlite/session-input-repository.d.ts +12 -2
- package/dist/src/storage/sqlite/session-input-repository.js +25 -2
- 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/read.js +2 -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/tui/backends/embedded-backend.d.ts +5 -0
- package/dist/src/tui/backends/embedded-backend.js +266 -20
- package/dist/src/tui/backends/embedded-drafts.d.ts +22 -0
- package/dist/src/tui/backends/embedded-drafts.js +53 -0
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +10 -0
- package/dist/src/tui/backends/gateway-realtime-backend.js +214 -33
- package/dist/src/tui/tui-backend.d.ts +1 -1
- package/dist/src/tui/tui-chat-input-state.d.ts +1 -0
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-session-format.js +0 -1
- package/dist/src/tui/tui-startup-resources.d.ts +1 -0
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/tui/tui-types.d.ts +0 -1
- package/dist/src/tui/tui.js +69 -29
- 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/realtime/persona-context.js +1 -1
- 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/work-discovery/service.js +3 -6
- package/dist/src/workflows/service/workflow-run-service.js +16 -3
- 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/apps-page-DVNySL58.js +0 -1
- package/dist/gateway/static/root/assets/attachment-load-DNCDbeOX.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BMgJvdcv.js +0 -7
- package/dist/gateway/static/root/assets/binary-plugins-BYn2hScX.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-CHA-sTAZ.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-v0WkhV5o.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DefBGjhV.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-vmx35sbu.js +0 -1
- 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/conversation-identity-Cw0n9uzK.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-CrOV4Ynd.js +0 -1
- package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +0 -1
- package/dist/gateway/static/root/assets/dist-Che_jiQF.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Du-Dos9O.js +0 -1
- 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/logs-page-CjzR9Rpj.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-Dk_gTJb9.js +0 -1
- package/dist/gateway/static/root/assets/media-plugins-Dlj6TD3M.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/page-context-capture-button-BArPtqp5.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BFUdtWXF.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DBsBwAQ6.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BurdDY0m.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/setup-status-panel-CbKHBjrU.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-DyLfktib.js +0 -2
- 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/skills-page-C35VKjhb.js +0 -2
- 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
- package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -9
- package/dist/src/tui/tui-empty-session-cleanup.js +0 -19
- /package/dist/gateway/static/root/assets/{dist-CI_fqRk-.js → dist-CI_fqRk-2.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { normalizeAgentId, validateAgentIdForNewAgent } from "../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
|
|
3
3
|
import { init_agent_scope, listAgentEntries, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath } from "../agent/agent-scope.js";
|
|
4
|
-
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
5
4
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
6
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
7
|
-
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
8
6
|
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
7
|
+
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
8
|
+
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
9
9
|
import { GATEWAY_BUILTIN_TOOL_IDS } from "./agent-builtin-tools.js";
|
|
10
10
|
import { join, resolve } from "node:path";
|
|
11
11
|
import { mkdir, readFile, realpath, stat, unlink, writeFile } from "node:fs/promises";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
3
|
-
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
3
|
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
4
|
+
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
5
5
|
import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
|
|
6
6
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
7
|
import { basename, isAbsolute, resolve } from "node:path";
|
|
@@ -11,7 +11,10 @@ async function reconcileHomeIntelligenceAutomation(automationService) {
|
|
|
11
11
|
},
|
|
12
12
|
safety: { mode: "auto_apply" },
|
|
13
13
|
conversationMode: "new_session",
|
|
14
|
-
|
|
14
|
+
delivery: {
|
|
15
|
+
notificationPolicy: "none",
|
|
16
|
+
destinations: []
|
|
17
|
+
},
|
|
15
18
|
reliability: { disableAfterConsecutiveFailures: 3 },
|
|
16
19
|
management: {
|
|
17
20
|
owner: "home-intelligence",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { normalizeAgentId } from "../../../agent-catalog/id.js";
|
|
2
2
|
import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
|
|
3
|
-
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
4
3
|
import { init_agent_scope, listAgentEntries, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
5
4
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
5
|
+
import { ContextPlanningConfigSchema, KnowledgeMemoryConfigSchema, UserModelConfigSchema, init_config } from "../../../user-context/config.js";
|
|
6
6
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
7
7
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
8
8
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
@@ -2,7 +2,8 @@ import { parseUserTurnDocument, userTurnDocumentRefIds } from "../../../../packa
|
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
3
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
4
4
|
import { parseTurnContextRefs } from "../../../agent/source-context/types.js";
|
|
5
|
-
import { replaceLatestSessionTurn
|
|
5
|
+
import { replaceLatestSessionTurn } from "./session-input-handler.js";
|
|
6
|
+
import { handleSessionCommand, handleSessionInputReceipt, handleSessionPreparationRetry } from "./session-command-handler.js";
|
|
6
7
|
//#region src/gateway/hono/routes/agent-stream.ts
|
|
7
8
|
init_src();
|
|
8
9
|
function registerAgentStreamRoutes(authenticated, deps) {
|
|
@@ -38,8 +39,11 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
38
39
|
});
|
|
39
40
|
});
|
|
40
41
|
authenticated.post("/api/sessions/:conversationId/inputs", chatRateLimitMiddleware, async (c) => {
|
|
41
|
-
return
|
|
42
|
+
return handleSessionCommand(c, deps);
|
|
42
43
|
});
|
|
44
|
+
authenticated.post("/api/sessions/:conversationId/materialize", chatRateLimitMiddleware, (c) => handleSessionCommand(c, deps, true));
|
|
45
|
+
authenticated.get("/api/sessions/:conversationId/input-receipts/:clientMessageId", (c) => handleSessionInputReceipt(c, deps));
|
|
46
|
+
authenticated.post("/api/sessions/:conversationId/preparation/retry", chatRateLimitMiddleware, (c) => handleSessionPreparationRetry(c, deps));
|
|
43
47
|
authenticated.post("/api/sessions/:conversationId/turns/:turnId/replace", chatRateLimitMiddleware, async (c) => {
|
|
44
48
|
return replaceLatestSessionTurn(c, deps, (c.req.param("conversationId") ?? "").trim(), (c.req.param("turnId") ?? "").trim());
|
|
45
49
|
});
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { getOrCreateGatewayIdentity, init_gateway_identity_repository } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
1
2
|
import { BrowserSessionLimitError, createBrowserSession, deleteBrowserSession } from "../../../storage/sqlite/browser-session-repository.js";
|
|
2
3
|
import { browserCookieRequestAllowed, clearBrowserSessionCookie, writeBrowserSessionCookie } from "../../security/browser-session.js";
|
|
3
4
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
4
5
|
//#region src/gateway/hono/routes/browser-session.ts
|
|
6
|
+
init_gateway_identity_repository();
|
|
5
7
|
function registerBrowserSessionRoutes(app, deps) {
|
|
6
8
|
app.get("/api/browser-session", (c) => {
|
|
7
9
|
c.header("Cache-Control", "no-store");
|
|
8
10
|
const principal = getGatewayPrincipal(c);
|
|
9
|
-
return c.json({ conversationId: principal.principalId });
|
|
11
|
+
return c.json({ conversationId: `${getOrCreateGatewayIdentity().id}:${principal.principalId}` });
|
|
10
12
|
});
|
|
11
13
|
app.post("/api/browser-session", deps.strictRateLimitMiddleware, (c) => {
|
|
12
14
|
const principal = getGatewayPrincipal(c);
|
|
@@ -24,7 +26,7 @@ function registerBrowserSessionRoutes(app, deps) {
|
|
|
24
26
|
}
|
|
25
27
|
writeBrowserSessionCookie(c, session.token, session.expiresAt);
|
|
26
28
|
c.header("Cache-Control", "no-store");
|
|
27
|
-
return c.json({ conversationId:
|
|
29
|
+
return c.json({ conversationId: `${getOrCreateGatewayIdentity().id}:browser:${session.sessionId}` });
|
|
28
30
|
});
|
|
29
31
|
app.delete("/api/browser-session", (c) => {
|
|
30
32
|
if (!browserCookieRequestAllowed(c)) return c.json({ error: "Forbidden" }, 403);
|
|
@@ -55,7 +55,7 @@ function registerCapabilityRoutes(authenticated, deps) {
|
|
|
55
55
|
try {
|
|
56
56
|
const { instance, plan } = await persistConfigMutation({
|
|
57
57
|
config,
|
|
58
|
-
mutate: () => installStoreConnector(config, c.req.param("name"), input, optionalVersion(body)),
|
|
58
|
+
mutate: () => installStoreConnector(config, c.req.param("name"), input, optionalVersion(body), typeof body.reviewHash === "string" ? body.reviewHash : void 0),
|
|
59
59
|
save: () => service.saveConfig(config)
|
|
60
60
|
});
|
|
61
61
|
return c.json({
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
|
|
3
|
+
import { effectiveWorkspacePathForSession, projectWorkspacePath } from "../../../session/session-workspace.js";
|
|
3
4
|
import { getProjectForSession } from "../../../projects/workspace.js";
|
|
5
|
+
import { ProjectService } from "../../../projects/project-service.js";
|
|
4
6
|
import { isRegisteredProvider } from "../../../agent/skills/marketplace/registry.js";
|
|
5
7
|
import "../../../agent/skills/skills-marketplace.js";
|
|
8
|
+
import "../../../projects/index.js";
|
|
6
9
|
import { isSkillInstallTarget } from "../../../agent/skills/install-target.js";
|
|
7
10
|
import { commandRegistry } from "../../../chat-commands/registry.js";
|
|
8
11
|
import { buildReviewContext, resolveGitRoot } from "../../../review/review-git.js";
|
|
@@ -62,7 +65,11 @@ function registerCommandsSkillsRoutes(authenticated, deps) {
|
|
|
62
65
|
authenticated.get("/api/review/context", async (c) => {
|
|
63
66
|
const conversationId = c.req.query("conversationId")?.trim();
|
|
64
67
|
try {
|
|
65
|
-
const
|
|
68
|
+
const agentId = c.req.query("agentId")?.trim();
|
|
69
|
+
const projectId = c.req.query("projectId")?.trim();
|
|
70
|
+
const project = !conversationId && projectId ? new ProjectService().get(projectId) : null;
|
|
71
|
+
if (!conversationId && projectId && !project) throw new Error("Project not found");
|
|
72
|
+
const payload = await buildReviewContext(await resolveGitRoot(!conversationId && agentId ? projectWorkspacePath(project) ?? resolveEffectiveAgentProfile(agentId).resolvedWorkspacePath : effectiveWorkspacePathForSession(service.getConfig(), conversationId, null, getProjectForSession(conversationId))));
|
|
66
73
|
return c.json({
|
|
67
74
|
ok: true,
|
|
68
75
|
payload
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ComputerConfigSchema, init_config } from "../../../../computer/config.js";
|
|
2
1
|
import { BindingsSchema, init_binding_schema } from "../../../../routing/binding-schema.js";
|
|
2
|
+
import { AgentCatalogService } from "../../../../agent-catalog/service.js";
|
|
3
|
+
import { ComputerConfigSchema, init_config } from "../../../../computer/config.js";
|
|
3
4
|
import { ContextPlanningConfigSchema, HomeIntelligenceConfigSchema, KnowledgeMemoryConfigSchema, UserContextConfigSchema, UserModelConfigSchema, init_config as init_config$1 } from "../../../../user-context/config.js";
|
|
4
5
|
import { BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
|
|
5
6
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
6
7
|
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
7
|
-
import { AgentCatalogService } from "../../../../agent-catalog/service.js";
|
|
8
8
|
import { mergeGatewaySkillsMarketplacePatch, mergeSessionConfigPatch, mergeUpdateConfigPatch } from "../../../../config/web-patch.js";
|
|
9
9
|
import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../../../auth.js";
|
|
10
10
|
import { isMaskedSecretPatchValue } from "../../lib/mask-secret-length.js";
|
|
@@ -6,9 +6,9 @@ const actionSchema = z.object({
|
|
|
6
6
|
expectedVersion: z.number().int().positive(),
|
|
7
7
|
idempotencyKey: z.string().min(1).max(200),
|
|
8
8
|
action: z.enum([
|
|
9
|
+
"install_complete",
|
|
9
10
|
"connect",
|
|
10
11
|
"check",
|
|
11
|
-
"continue",
|
|
12
12
|
"skip",
|
|
13
13
|
"cancel",
|
|
14
14
|
"select_account",
|
|
@@ -19,7 +19,8 @@ const actionSchema = z.object({
|
|
|
19
19
|
candidateRef: z.string().optional(),
|
|
20
20
|
needKey: z.string().optional(),
|
|
21
21
|
accountId: z.string().optional(),
|
|
22
|
-
callbackUrl: z.string().max(16384).optional()
|
|
22
|
+
callbackUrl: z.string().max(16384).optional(),
|
|
23
|
+
instanceId: z.string().optional()
|
|
23
24
|
}).strict();
|
|
24
25
|
function registerConnectionWaitRoutes(app, { service, strictRateLimitMiddleware }) {
|
|
25
26
|
app.get("/api/sessions/:conversationId/connection-wait", (c) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileServiceError, fileResourceFromPath, parseFileResourceId, resolveFilePath } from "../../../files/file-service.js";
|
|
2
2
|
import { getGatewayFileSpaceService } from "../../file-space-service.js";
|
|
3
|
+
import { getSessionPreparation } from "../../../storage/sqlite/session-creation-repository.js";
|
|
3
4
|
import { fuzzySearchWorkspaceFiles, fuzzySubsequenceScore } from "../../workspace-file-search.js";
|
|
4
5
|
import { registerFileReferenceRoutes } from "./file-references.js";
|
|
5
6
|
import { basename, join } from "node:path";
|
|
@@ -55,6 +56,8 @@ function registerFilesRoutes(authenticated, deps) {
|
|
|
55
56
|
try {
|
|
56
57
|
const kind = c.req.param("kind");
|
|
57
58
|
if (kind !== "agent" && kind !== "project" && kind !== "session") throw new FileServiceError(400, "Invalid context kind");
|
|
59
|
+
const preparation = kind === "session" ? getSessionPreparation(c.req.param("id")) : void 0;
|
|
60
|
+
if (preparation && preparation.state !== "ready") throw new FileServiceError(409, "Session environment is not ready");
|
|
58
61
|
return c.json({ space: publicSpace(await files.forContext(kind, c.req.param("id"))) });
|
|
59
62
|
} catch (error) {
|
|
60
63
|
return errorResponse(c, error);
|
|
@@ -238,7 +238,12 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
238
238
|
},
|
|
239
239
|
{
|
|
240
240
|
id: "automations",
|
|
241
|
-
match: (path) => startsWithAny(path, [
|
|
241
|
+
match: (path) => startsWithAny(path, [
|
|
242
|
+
"/api/automations",
|
|
243
|
+
"/api/automation-runs",
|
|
244
|
+
"/api/automation-events",
|
|
245
|
+
"/api/automation-deliveries"
|
|
246
|
+
]),
|
|
242
247
|
load: async () => {
|
|
243
248
|
const { registerAutomationRoutes } = await import("../../../automations/api/routes.js");
|
|
244
249
|
return { register: registerAutomationRoutes };
|
|
@@ -284,6 +289,14 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
284
289
|
return { register: registerLogsRoutes };
|
|
285
290
|
}
|
|
286
291
|
},
|
|
292
|
+
{
|
|
293
|
+
id: "usage",
|
|
294
|
+
match: (path) => startsWithAny(path, ["/api/usage"]),
|
|
295
|
+
load: async () => {
|
|
296
|
+
const { registerUsageRoutes } = await import("./usage.js");
|
|
297
|
+
return { register: registerUsageRoutes };
|
|
298
|
+
}
|
|
299
|
+
},
|
|
287
300
|
{
|
|
288
301
|
id: "shares",
|
|
289
302
|
match: (path) => startsWithAny(path, ["/api/shares", "/api/hosted-publications"]) || /^\/api\/notes\/[^/]+\/hosted-publications(?:\/.*)?$/.test(path) || /^\/api\/sessions\/[^/]+\/(?:share-preview|shares|hosted-shares)(?:\/.*)?$/.test(path),
|
|
@@ -8,6 +8,7 @@ import { CredentialResolver, init_credentials } from "../../../auth/credentials.
|
|
|
8
8
|
import "../../../providers/constants.js";
|
|
9
9
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
10
10
|
import { PROVIDER_META, getAllModels, getAllProviders, getAvailableModels, getProviderAuthState, init_providers, isProviderConfigured, isProviderConfiguredSync } from "../../../providers/index.js";
|
|
11
|
+
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
11
12
|
import { buildCapabilityPlansForConfig } from "../../../capabilities/readiness/from-config.js";
|
|
12
13
|
import "../../../capabilities/readiness/index.js";
|
|
13
14
|
import { getImageGenerationProvider, reloadImageGenerationProviders, resolveImageGenerationCredentialMode } from "../../../agent/image/generation/provider-registry.js";
|
|
@@ -325,9 +326,24 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
325
326
|
if (a.provider !== b.provider) return a.provider.localeCompare(b.provider);
|
|
326
327
|
return a.name.localeCompare(b.name, void 0, { sensitivity: "base" });
|
|
327
328
|
});
|
|
329
|
+
const agentId = c.req.query("agentId")?.trim();
|
|
330
|
+
let defaultId;
|
|
331
|
+
if (agentId) try {
|
|
332
|
+
const configured = resolveEffectiveAgentConfigForAgent(agentId).config.models.chat.primary;
|
|
333
|
+
const matches = models.filter((model) => model.id === configured || model.id.endsWith(`/${configured}`));
|
|
334
|
+
defaultId = models.find((model) => model.id === configured)?.id ?? (matches.length === 1 ? matches[0].id : configured);
|
|
335
|
+
} catch (error) {
|
|
336
|
+
return c.json({
|
|
337
|
+
ok: false,
|
|
338
|
+
error: { message: error instanceof Error ? error.message : "Invalid agent" }
|
|
339
|
+
}, 400);
|
|
340
|
+
}
|
|
328
341
|
return c.json({
|
|
329
342
|
ok: true,
|
|
330
|
-
payload: {
|
|
343
|
+
payload: {
|
|
344
|
+
models,
|
|
345
|
+
...defaultId ? { defaultId } : {}
|
|
346
|
+
}
|
|
331
347
|
});
|
|
332
348
|
});
|
|
333
349
|
authenticated.get("/api/image-generation/catalog", (c) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { NoteDeleteOutputSchema, NoteGetOutputSchema, ProductReadContracts } from "../../../../packages/gateway-contract/src/capabilities.js";
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
|
-
import { init_session_key, resolveConversationId } from "../../../routing/session-key.js";
|
|
4
|
-
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
5
3
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
6
4
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
5
|
+
import { init_session_key, resolveConversationId } from "../../../routing/session-key.js";
|
|
6
|
+
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
7
7
|
import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
|
|
8
8
|
import { getShareStore } from "../../../share/share-store.js";
|
|
9
9
|
import { resolveShareUrl } from "../../../share/share-url.js";
|
|
@@ -269,7 +269,6 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
269
269
|
...projectId ? { projectId } : {},
|
|
270
270
|
customData: {
|
|
271
271
|
...meta?.customData ?? {},
|
|
272
|
-
genericNewChatShell: false,
|
|
273
272
|
sourceBinding
|
|
274
273
|
}
|
|
275
274
|
});
|
|
@@ -310,7 +309,6 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
310
309
|
tags: Array.from(new Set([...meta?.tags ?? [], "note"])),
|
|
311
310
|
customData: {
|
|
312
311
|
...meta?.customData ?? {},
|
|
313
|
-
genericNewChatShell: false,
|
|
314
312
|
sourceBinding
|
|
315
313
|
}
|
|
316
314
|
});
|
|
@@ -7,12 +7,12 @@ import { loadTranscriptRowsForSession } from "../../../storage/sqlite/transcript
|
|
|
7
7
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
8
8
|
import { ActivityService } from "../../../activity/service.js";
|
|
9
9
|
import "../../../activity/index.js";
|
|
10
|
+
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
11
|
+
import "../../../capabilities/runtime/dispatcher.js";
|
|
10
12
|
import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
|
|
11
13
|
import { TaskReadModelProjector } from "../../../tasks/task-read-model-projector.js";
|
|
12
14
|
import { listKnowledgeItems, writeKnowledgeItem } from "../../../knowledge-memory/repository.js";
|
|
13
15
|
import "../../../knowledge-memory/index.js";
|
|
14
|
-
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
15
|
-
import "../../../capabilities/runtime/dispatcher.js";
|
|
16
16
|
import { ProjectWorkspaceConflictError, ProjectWorkspaceMissingError } from "../../../projects/workspace-project.js";
|
|
17
17
|
import { inferProjectExecutionMode, inferProjectKind } from "../../../projects/project-kind.js";
|
|
18
18
|
import { ProjectDeletionBlockedError, ProjectWorkspaceInUseError } from "../../../projects/project-service.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { PACKAGE_VERSION, init_package_version } from "../../../package-version.js";
|
|
2
2
|
import { claimConnectorWebhookDelivery, completeConnectorWebhookDelivery, releaseConnectorWebhookDelivery } from "../../../storage/sqlite/connector-repository.js";
|
|
3
3
|
import { init_sqlite } from "../../../storage/sqlite/index.js";
|
|
4
|
+
import { resolveAutomationWebhookSecret } from "../../../automations/webhook-secrets.js";
|
|
4
5
|
import { composioLogoResponse } from "../../../connectors/composio-logo.js";
|
|
5
6
|
import { appendComposioTriggerEvent, applyComposioConnectionLifecycleEvent, normalizeComposioTriggerPayload, verifyComposioWebhook } from "../../../connectors/composio-triggers.js";
|
|
6
7
|
import { serveStaticFile } from "../lib/static-ui.js";
|
|
7
|
-
import { createHash } from "node:crypto";
|
|
8
|
+
import { createHash, timingSafeEqual } from "node:crypto";
|
|
8
9
|
//#region src/gateway/hono/routes/public-gateway.ts
|
|
9
10
|
init_package_version();
|
|
10
11
|
init_sqlite();
|
|
@@ -19,6 +20,9 @@ const PUBLIC_UI_ROOT_ASSETS = [
|
|
|
19
20
|
"pwa-512x512.png",
|
|
20
21
|
"site.webmanifest"
|
|
21
22
|
];
|
|
23
|
+
function secretsEqual(actual, expected) {
|
|
24
|
+
return timingSafeEqual(createHash("sha256").update(actual).digest(), createHash("sha256").update(expected).digest());
|
|
25
|
+
}
|
|
22
26
|
function registerPublicGatewayRoutes(app, service) {
|
|
23
27
|
app.get("/health", (c) => {
|
|
24
28
|
return c.json(service.getHealth());
|
|
@@ -84,9 +88,16 @@ function registerPublicGatewayRoutes(app, service) {
|
|
|
84
88
|
if (inactiveConnectionId) service.setConnectorLearningPaused(inactiveConnectionId, true);
|
|
85
89
|
const event = await appendComposioTriggerEvent(service.currentConfig, archivedPayload);
|
|
86
90
|
if (normalized.toolkit) service.requestConnectorLearningForToolkit(normalized.toolkit);
|
|
87
|
-
const
|
|
91
|
+
const ingested = service.ingestAutomationEvent({
|
|
92
|
+
id: `connector:composio:${webhookId}`,
|
|
88
93
|
type: `connector.${normalized.trigger ?? normalized.type}`,
|
|
89
94
|
source: normalized.toolkit ? `composio:${normalized.toolkit}` : "composio",
|
|
95
|
+
subject: {
|
|
96
|
+
kind: "connector_event",
|
|
97
|
+
id: webhookId
|
|
98
|
+
},
|
|
99
|
+
dedupeKey: webhookId,
|
|
100
|
+
trust: "connector",
|
|
90
101
|
payload: {
|
|
91
102
|
...normalized.data,
|
|
92
103
|
connectorId: normalized.toolkit ? `composio-${normalized.toolkit}` : "composio",
|
|
@@ -98,7 +109,7 @@ function registerPublicGatewayRoutes(app, service) {
|
|
|
98
109
|
ok: true,
|
|
99
110
|
payload: {
|
|
100
111
|
eventId: event.id,
|
|
101
|
-
|
|
112
|
+
automationDeliveries: ingested.deliveryCount
|
|
102
113
|
}
|
|
103
114
|
});
|
|
104
115
|
} catch (error) {
|
|
@@ -109,6 +120,85 @@ function registerPublicGatewayRoutes(app, service) {
|
|
|
109
120
|
}, 500);
|
|
110
121
|
}
|
|
111
122
|
});
|
|
123
|
+
app.post("/api/automation-hooks/:automationId", async (c) => {
|
|
124
|
+
const automationId = c.req.param("automationId");
|
|
125
|
+
const automation = await service.automationServiceInstance.get(automationId);
|
|
126
|
+
if (!automation || !automation.enabled || automation.trigger.kind !== "webhook") return c.json({
|
|
127
|
+
ok: false,
|
|
128
|
+
error: "Automation webhook not found."
|
|
129
|
+
}, 404);
|
|
130
|
+
const secretId = automation.trigger.secretId?.trim();
|
|
131
|
+
let expectedSecret;
|
|
132
|
+
try {
|
|
133
|
+
expectedSecret = secretId ? resolveAutomationWebhookSecret(secretId) : void 0;
|
|
134
|
+
} catch {
|
|
135
|
+
return c.json({
|
|
136
|
+
ok: false,
|
|
137
|
+
error: "Automation webhook secrets are misconfigured."
|
|
138
|
+
}, 503);
|
|
139
|
+
}
|
|
140
|
+
if (!expectedSecret) return c.json({
|
|
141
|
+
ok: false,
|
|
142
|
+
error: "Automation webhook secret is not configured."
|
|
143
|
+
}, 503);
|
|
144
|
+
const authorization = c.req.header("authorization")?.trim() ?? "";
|
|
145
|
+
const suppliedSecret = authorization.startsWith("Bearer ") ? authorization.slice(7).trim() : c.req.header("x-xopc-webhook-secret")?.trim() ?? "";
|
|
146
|
+
if (!suppliedSecret || !secretsEqual(suppliedSecret, expectedSecret)) return c.json({
|
|
147
|
+
ok: false,
|
|
148
|
+
error: "Invalid automation webhook secret."
|
|
149
|
+
}, 401);
|
|
150
|
+
const idempotencyKey = c.req.header("idempotency-key")?.trim();
|
|
151
|
+
if (!idempotencyKey || idempotencyKey.length > 200) return c.json({
|
|
152
|
+
ok: false,
|
|
153
|
+
error: "A valid Idempotency-Key header is required."
|
|
154
|
+
}, 400);
|
|
155
|
+
const declaredSize = Number(c.req.header("content-length") ?? 0);
|
|
156
|
+
if (Number.isFinite(declaredSize) && declaredSize > 256 * 1024) return c.json({
|
|
157
|
+
ok: false,
|
|
158
|
+
error: "Webhook payload is too large."
|
|
159
|
+
}, 413);
|
|
160
|
+
const rawBody = await c.req.text();
|
|
161
|
+
if (Buffer.byteLength(rawBody) > 256 * 1024) return c.json({
|
|
162
|
+
ok: false,
|
|
163
|
+
error: "Webhook payload is too large."
|
|
164
|
+
}, 413);
|
|
165
|
+
let payload;
|
|
166
|
+
try {
|
|
167
|
+
const parsed = rawBody ? JSON.parse(rawBody) : {};
|
|
168
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("invalid payload");
|
|
169
|
+
payload = parsed;
|
|
170
|
+
} catch {
|
|
171
|
+
return c.json({
|
|
172
|
+
ok: false,
|
|
173
|
+
error: "Webhook payload must be a JSON object."
|
|
174
|
+
}, 400);
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const result = service.ingestAutomationEvent({
|
|
178
|
+
id: `webhook:${automationId}:${idempotencyKey}`,
|
|
179
|
+
type: "automation.webhook.received",
|
|
180
|
+
source: `webhook:${automationId}`,
|
|
181
|
+
subject: {
|
|
182
|
+
kind: "automation",
|
|
183
|
+
id: automationId
|
|
184
|
+
},
|
|
185
|
+
correlationId: c.req.header("x-correlation-id")?.trim() || void 0,
|
|
186
|
+
dedupeKey: idempotencyKey,
|
|
187
|
+
trust: "untrusted_webhook",
|
|
188
|
+
payload
|
|
189
|
+
}, { targetAutomationIds: [automationId] });
|
|
190
|
+
return c.json({
|
|
191
|
+
ok: true,
|
|
192
|
+
eventId: result.event.id,
|
|
193
|
+
duplicate: !result.created
|
|
194
|
+
}, result.created ? 202 : 200);
|
|
195
|
+
} catch {
|
|
196
|
+
return c.json({
|
|
197
|
+
ok: false,
|
|
198
|
+
error: "Automation webhook ingestion failed."
|
|
199
|
+
}, 500);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
112
202
|
app.get("/api", (c) => {
|
|
113
203
|
return c.json({
|
|
114
204
|
service: "xopc-gateway",
|
|
@@ -66,14 +66,22 @@ function registerSceneRoutes(authenticated, deps) {
|
|
|
66
66
|
idempotencyKey: c.req.header("Idempotency-Key") ?? randomUUID()
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
const template = (key, version) => deps.scenes.repository.getTemplate(key, version);
|
|
70
|
+
const adapterTarget = (key, version) => {
|
|
71
|
+
const manifest = template(key, version);
|
|
72
|
+
return manifest.execution.kind === "agent" ? void 0 : {
|
|
73
|
+
manifest,
|
|
74
|
+
adapter: deps.scenes.activationAdapters.get(manifest.execution.kind)
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
app.get("/source-providers", (c) => c.json({ providers: deps.scenes.sourceProviders.providers() }));
|
|
78
|
+
app.get("/source-providers/:provider/accounts", (c) => c.json({ accounts: deps.scenes.sourceProviders.get(c.req.param("provider")).listAccounts?.(principal(c)) ?? [] }));
|
|
71
79
|
app.post("/source-providers/:provider/resolve-link", deps.strictRateLimitMiddleware, async (c) => {
|
|
72
80
|
const input = z.strictObject({
|
|
73
81
|
accountId: z.string().min(1).max(200),
|
|
74
82
|
url: z.string().url().max(2e3)
|
|
75
83
|
}).parse(await c.req.json());
|
|
76
|
-
const source = deps.scenes.
|
|
84
|
+
const source = deps.scenes.sourceProviders.get(c.req.param("provider"));
|
|
77
85
|
if (!source?.resolveLink) return c.json({ error: "source_resolution_unavailable" }, 422);
|
|
78
86
|
const reference = await source.resolveLink(principal(c), input.accountId, input.url, AbortSignal.any([c.req.raw.signal, AbortSignal.timeout(3e4)]));
|
|
79
87
|
return c.json({ source: {
|
|
@@ -81,48 +89,21 @@ function registerSceneRoutes(authenticated, deps) {
|
|
|
81
89
|
reference
|
|
82
90
|
} });
|
|
83
91
|
});
|
|
84
|
-
app.get("/
|
|
85
|
-
|
|
86
|
-
if (!
|
|
87
|
-
return c.json(await
|
|
92
|
+
app.get("/resources/projects/:projectId/branches", async (c) => {
|
|
93
|
+
const owner = deps.scenes.activationAdapters.list().find((item) => item.listProjectBranches);
|
|
94
|
+
if (!owner?.listProjectBranches) return c.json({ error: "branch_inventory_unavailable" }, 503);
|
|
95
|
+
return c.json(await owner.listProjectBranches(principal(c), c.req.param("projectId")));
|
|
88
96
|
});
|
|
89
|
-
app.post("/
|
|
97
|
+
app.post("/resources/branch-links", deps.strictRateLimitMiddleware, async (c) => {
|
|
90
98
|
const input = z.strictObject({
|
|
91
99
|
projectId: z.string().min(1).max(200),
|
|
92
100
|
taskId: z.string().uuid(),
|
|
93
101
|
branchRef: z.string().startsWith("refs/heads/").max(300),
|
|
94
102
|
expectedSha: z.string().regex(/^[a-f0-9]{40,64}$/)
|
|
95
103
|
}).parse(await c.req.json());
|
|
96
|
-
|
|
97
|
-
return c.json(
|
|
98
|
-
|
|
99
|
-
app.post("/task-follow-ups/preflight", deps.strictRateLimitMiddleware, async (c) => {
|
|
100
|
-
if (!deps.scenes.followUps) return c.json({ error: "task_follow_up_unavailable" }, 503);
|
|
101
|
-
return c.json(await deps.scenes.followUps.preflight(principal(c), await c.req.json()));
|
|
102
|
-
});
|
|
103
|
-
app.post("/task-follow-ups", deps.strictRateLimitMiddleware, async (c) => {
|
|
104
|
-
if (!deps.scenes.followUps) return c.json({ error: "task_follow_up_unavailable" }, 503);
|
|
105
|
-
return c.json(await deps.scenes.followUps.create(principal(c), await c.req.json()), 201);
|
|
106
|
-
});
|
|
107
|
-
app.get("/task-follow-ups/:id", (c) => {
|
|
108
|
-
if (!deps.scenes.followUps) return c.json({ error: "task_follow_up_unavailable" }, 503);
|
|
109
|
-
return c.json(deps.scenes.followUps.get(principal(c), c.req.param("id")));
|
|
110
|
-
});
|
|
111
|
-
app.patch("/task-follow-ups/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
112
|
-
const input = z.union([z.strictObject({
|
|
113
|
-
expectedRevision: z.number().int().positive(),
|
|
114
|
-
status: z.enum([
|
|
115
|
-
"active",
|
|
116
|
-
"paused",
|
|
117
|
-
"archived"
|
|
118
|
-
])
|
|
119
|
-
}), z.strictObject({
|
|
120
|
-
expectedRevision: z.number().int().positive(),
|
|
121
|
-
configuration: z.unknown()
|
|
122
|
-
})]).parse(await c.req.json());
|
|
123
|
-
if (!deps.scenes.followUps) return c.json({ error: "task_follow_up_unavailable" }, 503);
|
|
124
|
-
if ("configuration" in input) return c.json(await deps.scenes.followUps.configure(principal(c), c.req.param("id"), input.expectedRevision, input.configuration));
|
|
125
|
-
return c.json(await deps.scenes.followUps.transition(principal(c), c.req.param("id"), input.expectedRevision, input.status));
|
|
104
|
+
const owner = deps.scenes.activationAdapters.list().find((item) => item.associateBranch);
|
|
105
|
+
if (!owner?.associateBranch) return c.json({ error: "branch_inventory_unavailable" }, 503);
|
|
106
|
+
return c.json(await owner.associateBranch(principal(c), input));
|
|
126
107
|
});
|
|
127
108
|
app.post("/browser/prepare", deps.strictRateLimitMiddleware, (c) => c.json(deps.scenes.browser.prepare()));
|
|
128
109
|
app.post("/browser/subscriptions", deps.strictRateLimitMiddleware, async (c) => c.json(deps.scenes.browser.register(principal(c), await c.req.json()), 201));
|
|
@@ -160,7 +141,14 @@ function registerSceneRoutes(authenticated, deps) {
|
|
|
160
141
|
key: c.req.param("key"),
|
|
161
142
|
version: c.req.param("version")
|
|
162
143
|
})));
|
|
163
|
-
app.post("/preflight", deps.strictRateLimitMiddleware, async (c) =>
|
|
144
|
+
app.post("/preflight", deps.strictRateLimitMiddleware, async (c) => {
|
|
145
|
+
const body = await c.req.json();
|
|
146
|
+
if (typeof body.templateKey === "string" && typeof body.templateVersion === "string") {
|
|
147
|
+
const target = adapterTarget(body.templateKey, body.templateVersion);
|
|
148
|
+
if (target) return c.json(await target.adapter.preflight(principal(c), target.manifest, body.configuration));
|
|
149
|
+
}
|
|
150
|
+
return c.json(await read(c, "xopc.scenes.preflight", body));
|
|
151
|
+
});
|
|
164
152
|
app.get("/activations", async (c) => {
|
|
165
153
|
return c.json(await read(c, "xopc.scenes.list", {
|
|
166
154
|
...c.req.query(),
|
|
@@ -169,14 +157,42 @@ function registerSceneRoutes(authenticated, deps) {
|
|
|
169
157
|
});
|
|
170
158
|
app.post("/activations", deps.strictRateLimitMiddleware, async (c) => {
|
|
171
159
|
requestIdentity.parse(c.req.header("Idempotency-Key"));
|
|
172
|
-
|
|
160
|
+
const body = await c.req.json();
|
|
161
|
+
if (typeof body.templateKey === "string" && typeof body.templateVersion === "string") {
|
|
162
|
+
const target = adapterTarget(body.templateKey, body.templateVersion);
|
|
163
|
+
if (target) return c.json(await target.adapter.create(principal(c), target.manifest, body.configuration), 201);
|
|
164
|
+
}
|
|
165
|
+
return c.json(await write(c, "xopc.scenes.start", body), 201);
|
|
173
166
|
});
|
|
174
167
|
app.get("/activations/:id", async (c) => {
|
|
175
168
|
const { activation } = ProductReadContracts["xopc.scenes.get"].output.parse(await read(c, "xopc.scenes.get", { id: c.req.param("id") }));
|
|
176
|
-
|
|
169
|
+
const manifest = template(activation.templateKey, activation.templateVersion);
|
|
170
|
+
const activationAdapter = manifest.execution.kind === "agent" ? void 0 : deps.scenes.activationAdapters.get(manifest.execution.kind);
|
|
171
|
+
return c.json({
|
|
172
|
+
activation,
|
|
173
|
+
template: manifest,
|
|
174
|
+
...activationAdapter ? { details: activationAdapter.get(principal(c), activation.id) } : {}
|
|
175
|
+
});
|
|
177
176
|
});
|
|
178
177
|
app.patch("/activations/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
179
178
|
const body = await c.req.json();
|
|
179
|
+
const activation = deps.scenes.repository.getActivation(principal(c), c.req.param("id"));
|
|
180
|
+
const manifest = template(activation.templateKey, activation.templateVersion);
|
|
181
|
+
if (manifest.execution.kind !== "agent") {
|
|
182
|
+
const input = z.union([z.strictObject({
|
|
183
|
+
expectedRevision: z.number().int().positive(),
|
|
184
|
+
status: z.enum([
|
|
185
|
+
"active",
|
|
186
|
+
"paused",
|
|
187
|
+
"archived"
|
|
188
|
+
])
|
|
189
|
+
}), z.strictObject({
|
|
190
|
+
expectedRevision: z.number().int().positive(),
|
|
191
|
+
configuration: z.unknown()
|
|
192
|
+
})]).parse(body);
|
|
193
|
+
const execution = deps.scenes.activationAdapters.get(manifest.execution.kind);
|
|
194
|
+
return c.json("configuration" in input ? await execution.configure(principal(c), activation.id, input.expectedRevision, input.configuration) : await execution.transition(principal(c), activation.id, input.expectedRevision, input.status));
|
|
195
|
+
}
|
|
180
196
|
if (!(typeof body === "object" && body !== null && Object.hasOwn(body, "status"))) return c.json(await write(c, "xopc.scenes.configure", {
|
|
181
197
|
...body,
|
|
182
198
|
id: c.req.param("id")
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
3
|
+
export declare function handleSessionCommand(c: Context, deps: AuthenticatedRouteDeps, materialize?: boolean): Promise<Response>;
|
|
4
|
+
export declare function handleSessionInputReceipt(c: Context, deps: AuthenticatedRouteDeps): Promise<Response>;
|
|
5
|
+
export declare function handleSessionPreparationRetry(c: Context, deps: AuthenticatedRouteDeps): Promise<Response>;
|