@xopcai/xopc 0.0.391 → 0.0.393
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/sidepanel.js +1 -1
- 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-CzS0TUv9.js → agent-avatar-dicebear-1AF2KGju.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPJr7NRR.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-cjJXJj_3.js +1 -0
- package/dist/gateway/static/root/assets/agents-DW3TlnIg.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-Bb3Kvz3X.js → agents-admin-api-B5aykqg_.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-BV_eGr7l.js +1 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-B_MFhXXU.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-TYGidVnd.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-DOkyvOF0.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DFnHPNie.js → archive-plugin-BrFfEp0u.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CnBLPVNh.js → automations-page-B7OofUPF.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DIod-bfm.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BQC0Tzoi.js → binary-plugins-BfAWnYG8.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DSh5019z.js → block-editor-_Y-QwZ-3.js} +5 -5
- package/dist/gateway/static/root/assets/browser-automation-inputs-DH9QHI9m.js +1 -0
- package/dist/gateway/static/root/assets/browser-automations-page-B_SnD9B0.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BPlqYpMM.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-page-BtzZvMIK.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-pt2M56-E.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-WzoG3oBb.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-CFVx3iaZ.js +1 -0
- package/dist/gateway/static/root/assets/channels-BXA55GY2.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-D3GuiG3N.js +36 -0
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE--EKdQGRF.js → chunk-KS7C4IRE-B2HK1psj.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-CIbHDlp8.js +1 -0
- package/dist/gateway/static/root/assets/connector-service-page-CDyCHkpK.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DA2b6cJu.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-C424c_g9.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-BVJh9sYc.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-Q52A8vjp.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-CZr1CXxu.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-Bd-aOI7N.js +30 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-BuB0g8zv.css +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-D_WWTsze.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-C6cUgrvg.js +1 -0
- package/dist/gateway/static/root/assets/echarts-runtime-tcHc9TOS.js +18 -0
- package/dist/gateway/static/root/assets/extension-debug-page-DyyfC4gA.js +1 -0
- package/dist/gateway/static/root/assets/extension-page-Dho9o3ZZ.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-CdnIGyCH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-Dv_A5FMu.js → gateway-config-swr-BEePO3Wl.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DghCGfY_.js → gateway-realtime-Dng_VOvI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DtlBf7oH.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D0KSQRNZ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CkTVSESs.js → gateway-startup-retry-CDCiy7Cd.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DV2wNqBn.js → highlighted-body-KQOG7T2V-BNpj_mIM.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CH_A0W29.js +2 -0
- package/dist/gateway/static/root/assets/image-generation-api-DwkO2y46.js +1 -0
- package/dist/gateway/static/root/assets/imports-page-BrYvomnU.js +1 -0
- package/dist/gateway/static/root/assets/index-CKdOZoVu.js +260 -0
- package/dist/gateway/static/root/assets/index-Rxjt-jc3.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BveDYfYk.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-CcIi1BhT.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-B1a69mlV.js +1 -0
- package/dist/gateway/static/root/assets/local-session-drafts-CYEDUPH7.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-BpK9AiDq.js → locale-store-CE7L6MlS.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Us1jv3C4.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-C9RAM7-s.js +1 -0
- package/dist/gateway/static/root/assets/markdown-view-PrKvVpRh.js +324 -0
- package/dist/gateway/static/root/assets/{media-plugins-oSChWbcP.js → media-plugins-CR1fp6IL.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DQdcaMiu.js +1 -0
- package/dist/gateway/static/root/assets/messages-CaeL_miw.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Q4yRx9iZ.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-C9qu16IN.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-Cn_WK68Y.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-DrP6hEcg.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-3NbiWGRG.js +1 -0
- package/dist/gateway/static/root/assets/product-delivery-DwmnNJvk.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-KKE5-V8k.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-content-BM0oqNxi.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-CPZrwf8n.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Besfx_07.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-Dsa2LvRt.js → registry-api-BO2Ck3aA.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CTDghL5L.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-C2Uw89eY.js → runtime-tools-api-B1sb8nlw.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-W0X_Fy7b.js +1 -0
- package/dist/gateway/static/root/assets/schema-form-DNM2Zdyr.js +1 -0
- package/dist/gateway/static/root/assets/{session-api-ga-SUOq_.js → session-api-CaAUJvu1.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-DoFTlgNz.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-Dxtablvd.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C7zklouD.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DCSHPFAN.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DPCgrICd.js → settings-page-B18UbbaJ.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-JoSfluza.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BLnS3hoH.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-DcIuPJK3.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-CcYGkRPL.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-PnUZjoPK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-D3JAw62U.js +2 -0
- package/dist/gateway/static/root/assets/style-BQqU-1pP.js +7 -0
- package/dist/gateway/static/root/assets/system-settings-panel-C974myUM.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input-CxtEp0aP.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-CiljFekC.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-DAZGz5YC.js → task-expandable-content-DTEVoNrM.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-DEE75MUn.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DWyI3uA3.js +1 -0
- package/dist/gateway/static/root/assets/usage-page-DJYvbxk7.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-CY0YuljR.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-eHZJD6Fw.js +2 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-BNG4ixJE.js +1 -0
- package/dist/gateway/static/root/assets/{voice-config-api-Dl39b27p.js → voice-config-api-D0Wscn9W.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-CohIoAre.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BXI8eyYh.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-CVti0u-l.js +6 -0
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-C_COnY_B.js +1 -0
- package/dist/gateway/static/root/index.html +22 -72
- package/dist/gateway/static/root/notification-sw.js +0 -15
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +8 -0
- package/dist/packages/gateway-contract/src/app-context.js +0 -1
- package/dist/packages/gateway-contract/src/capabilities.js +2 -249
- package/dist/packages/gateway-contract/src/home.js +0 -5
- package/dist/packages/gateway-contract/src/index.js +0 -4
- package/dist/packages/gateway-contract/src/notifications.js +0 -11
- package/dist/packages/gateway-contract/src/product-delivery.js +0 -2
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +1 -3
- package/dist/src/agent/agent-manager.js +8 -18
- package/dist/src/agent/child-agent-factory.d.ts +2 -1
- package/dist/src/agent/child-agent-factory.js +2 -1
- package/dist/src/agent/coding/projectEvidence.d.ts +9 -0
- package/dist/src/agent/coding/projectEvidence.js +177 -0
- package/dist/src/agent/coding/repository-instructions.d.ts +8 -1
- package/dist/src/agent/coding/repository-instructions.js +9 -4
- package/dist/src/agent/coding/run-verification.d.ts +17 -2
- package/dist/src/agent/coding/run-verification.js +82 -12
- package/dist/src/agent/coding/workspace-revision.js +1 -1
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/execution-context.d.ts +1 -0
- package/dist/src/agent/embedded/execution-context.js +4 -1
- package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-turn.js +41 -5
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.js +5 -0
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
- package/dist/src/agent/external-tools/extension-provider.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/memory-provider.js +1 -1
- package/dist/src/agent/independent-execution.d.ts +2 -0
- package/dist/src/agent/independent-execution.js +12 -0
- package/dist/src/agent/mcp/connection-drafts.js +15 -10
- package/dist/src/agent/memory/compaction.js +1 -1
- package/dist/src/agent/orchestration/delegation-scope.d.ts +1 -0
- package/dist/src/agent/orchestration/delegation-scope.js +4 -1
- package/dist/src/agent/orchestration/loop-guard.js +6 -2
- package/dist/src/agent/prompt/sections/agent-identity.js +3 -2
- package/dist/src/agent/prompt/sections/behavior.d.ts +3 -2
- package/dist/src/agent/prompt/sections/behavior.js +35 -25
- package/dist/src/agent/prompt/sections/memory-skills.d.ts +1 -1
- package/dist/src/agent/prompt/sections/memory-skills.js +10 -11
- package/dist/src/agent/prompt/sections/messaging-runtime.d.ts +3 -2
- package/dist/src/agent/prompt/sections/messaging-runtime.js +21 -24
- package/dist/src/agent/prompt/sections/response-language.js +7 -5
- package/dist/src/agent/prompt/sections/tooling.js +11 -10
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -1
- package/dist/src/agent/prompt/system-prompt-params.d.ts +2 -1
- package/dist/src/agent/prompt/system-prompt-params.js +2 -0
- package/dist/src/agent/prompt/system-prompt.d.ts +2 -1
- package/dist/src/agent/prompt/system-prompt.js +21 -18
- package/dist/src/agent/prompt/types.d.ts +2 -0
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/service.types.d.ts +0 -2
- package/dist/src/agent/skills/format-skills-prompt.js +5 -2
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +9 -1
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +6 -48
- package/dist/src/agent/tools/computer-use-tool.js +17 -3
- package/dist/src/agent/tools/dataBatch.d.ts +1 -0
- package/dist/src/agent/tools/dataBatch.js +4 -1
- package/dist/src/agent/tools/delegate-tool.d.ts +1 -0
- package/dist/src/agent/tools/delegate-tool.js +1 -0
- package/dist/src/agent/tools/error-tracker.js +4 -2
- package/dist/src/agent/tools/exec-command.js +4 -3
- package/dist/src/agent/tools/factory.d.ts +1 -2
- package/dist/src/agent/tools/factory.js +20 -22
- package/dist/src/agent/tools/{delegation-parent-policy.d.ts → noninteractive-tool-policy.d.ts} +1 -1
- package/dist/src/agent/tools/{delegation-parent-policy.js → noninteractive-tool-policy.js} +4 -4
- package/dist/src/agent/tools/personal-task-tool.js +1 -1
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/search/cache.d.ts +3 -1
- package/dist/src/agent/tools/search/cache.js +4 -1
- package/dist/src/agent/tools/search/providers/deepseek-protocol.d.ts +9 -0
- package/dist/src/agent/tools/search/providers/deepseek-protocol.js +84 -0
- package/dist/src/agent/tools/search/providers/deepseek.d.ts +9 -0
- package/dist/src/agent/tools/search/providers/deepseek.js +55 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +2 -1
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +36 -1
- package/dist/src/agent/tools/search/registry.d.ts +1 -0
- package/dist/src/agent/tools/search/registry.js +32 -6
- package/dist/src/agent/tools/search/request-gate.d.ts +13 -0
- package/dist/src/agent/tools/search/request-gate.js +41 -0
- package/dist/src/agent/tools/search/resolve-config.js +1 -1
- package/dist/src/agent/tools/search/search-info.d.ts +8 -0
- package/dist/src/agent/tools/search/search-info.js +34 -0
- package/dist/src/agent/tools/search/types.d.ts +19 -1
- package/dist/src/agent/tools/toolExposure.d.ts +3 -0
- package/dist/src/agent/tools/toolExposure.js +25 -0
- package/dist/src/agent/tools/web.js +8 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +2 -4
- package/dist/src/agent/tools/xopc-use-tool.js +11 -135
- package/dist/src/agent/workflow/builtins/index.js +98 -0
- package/dist/src/agent/workflow/subagent-runner.d.ts +1 -0
- package/dist/src/agent/workflow/subagent-runner.js +3 -3
- package/dist/src/agent/workflow/types.d.ts +3 -2
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +1 -2
- package/dist/src/automations/domain/validation.d.ts +8 -8
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/automations/events/event-catalog.js +0 -18
- package/dist/src/backup/archive.js +1 -2
- package/dist/src/capabilities/runtime/app-context.js +2 -6
- package/dist/src/capabilities/runtime/product.d.ts +1 -3
- package/dist/src/capabilities/runtime/product.js +0 -6
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/search.d.ts +2 -2
- package/dist/src/cli/commands/search.js +8 -6
- package/dist/src/computer/config.d.ts +1 -0
- package/dist/src/computer/config.js +1 -0
- package/dist/src/computer/diagnostics.d.ts +223 -0
- package/dist/src/computer/diagnostics.js +360 -0
- package/dist/src/computer/errors.d.ts +1 -1
- package/dist/src/computer/errors.js +8 -1
- package/dist/src/computer/evaluation-comparison.d.ts +125 -0
- package/dist/src/computer/evaluation-comparison.js +65 -0
- package/dist/src/computer/evaluation-harness.d.ts +2 -1
- package/dist/src/computer/evaluation-harness.js +59 -8
- package/dist/src/computer/evaluation.d.ts +102 -7
- package/dist/src/computer/evaluation.js +64 -15
- package/dist/src/computer/flows.d.ts +62 -0
- package/dist/src/computer/flows.js +158 -0
- package/dist/src/computer/model-adapter.d.ts +11 -0
- package/dist/src/computer/model-adapter.js +156 -11
- package/dist/src/computer/model-policy.d.ts +1 -1
- package/dist/src/computer/model-policy.js +13 -6
- package/dist/src/computer/release-gate.d.ts +11 -0
- package/dist/src/computer/runtime.d.ts +27 -2
- package/dist/src/computer/runtime.js +261 -44
- package/dist/src/computer/semantic-actions.d.ts +3 -0
- package/dist/src/computer/semantic-actions.js +29 -0
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/models-json.d.ts +14 -8
- package/dist/src/config/models-json.js +2 -0
- package/dist/src/config/outbound-proxy.d.ts +11 -0
- package/dist/src/config/outbound-proxy.js +30 -0
- package/dist/src/config/rules.js +5 -0
- package/dist/src/config/schema.d.ts +25 -10
- package/dist/src/config/schema.js +21 -10
- package/dist/src/connectors/cli/authorization.d.ts +1 -1
- package/dist/src/connectors/cli/store.d.ts +1 -1
- package/dist/src/endpoint-tools/invocation-service.js +5 -0
- package/dist/src/gateway/config-tools-web.js +15 -4
- package/dist/src/gateway/gateway-workflow-host.types.d.ts +3 -0
- package/dist/src/gateway/hono/app.d.ts +0 -2
- package/dist/src/gateway/hono/app.js +1 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +6 -3
- package/dist/src/gateway/hono/lib/config-payload.js +5 -1
- package/dist/src/gateway/hono/routes/capability-operations.js +0 -7
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +7 -0
- package/dist/src/gateway/hono/routes/deps.d.ts +0 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -8
- package/dist/src/gateway/hono/routes/models.js +5 -2
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
- package/dist/src/gateway/service/config-coordinator.d.ts +8 -5
- package/dist/src/gateway/service/session-input-coordinator.js +1 -1
- package/dist/src/gateway/service.d.ts +0 -3
- package/dist/src/gateway/service.js +10 -44
- package/dist/src/home-intelligence/generator.js +1 -1
- package/dist/src/home-intelligence/policy.js +0 -5
- package/dist/src/home-intelligence/repository.d.ts +1 -1
- package/dist/src/infra/domain-outbox-dispatcher.js +1 -1
- package/dist/src/infra/http-proxy-env.d.ts +3 -0
- package/dist/src/infra/http-proxy-env.js +22 -2
- package/dist/src/notifications/service.d.ts +2 -18
- package/dist/src/notifications/service.js +8 -39
- package/dist/src/notifications/store.d.ts +0 -1
- package/dist/src/notifications/store.js +1 -4
- package/dist/src/personal-agent/communication.d.ts +2 -1
- package/dist/src/personal-agent/communication.js +11 -2
- package/dist/src/personal-agent/persona.d.ts +2 -1
- package/dist/src/personal-agent/persona.js +3 -2
- package/dist/src/personal-agent/prompts.d.ts +2 -0
- package/dist/src/personal-agent/prompts.js +69 -7
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/personal-agent/reply-style.d.ts +4 -2
- package/dist/src/personal-agent/reply-style.js +19 -3
- package/dist/src/personal-agent/request-service.js +14 -9
- package/dist/src/pets/loopi-artwork.d.ts +2 -0
- package/dist/src/pets/loopi-artwork.js +36 -0
- package/dist/src/pets/pointer.d.ts +6 -0
- package/dist/src/pets/pointer.js +16 -0
- package/dist/src/platform/contracts.d.ts +3 -3
- package/dist/src/project-trust/trust-store.d.ts +5 -0
- package/dist/src/project-trust/trust-store.js +7 -1
- package/dist/src/providers/index.js +3 -3
- package/dist/src/providers/model-registry.js +2 -0
- package/dist/src/providers/model-supplements.d.ts +0 -2
- package/dist/src/providers/model-supplements.js +2 -18
- package/dist/src/providers/xopc-cloud-credit-budget.d.ts +1 -0
- package/dist/src/providers/xopc-cloud-credit-budget.js +4 -1
- package/dist/src/realtime/compact-run-event.js +17 -2
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/routing/agent-session-key.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/session-key.js +1 -1
- package/dist/src/session/compact-history.js +16 -6
- package/dist/src/storage/sqlite/connection.js +2 -2
- package/dist/src/storage/sqlite/conversation-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +0 -2
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +8 -18
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +28 -33
- package/dist/src/storage/sqlite/migrations/errors.js +1 -1
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +5 -40
- package/dist/src/storage/sqlite/migrations/types.d.ts +0 -2
- package/dist/src/storage/sqlite/schema.d.ts +1 -3
- package/dist/src/storage/sqlite/schema.js +4 -8
- package/dist/src/storage/sqlite/schema.sql +1356 -1282
- package/dist/src/tasks/capabilities/management.d.ts +2 -2
- package/dist/src/tasks/capabilities/relations.d.ts +4 -4
- package/dist/src/tasks/capabilities/write.d.ts +4 -4
- package/dist/src/tasks/task-allocation-service.js +51 -40
- package/dist/src/tasks/task-application-service.js +5 -1
- package/dist/src/tasks/task-contract-planner.js +21 -6
- package/dist/src/tasks/task-language.d.ts +2 -0
- package/dist/src/tasks/task-language.js +13 -2
- package/dist/src/tasks/task-research-result.d.ts +2 -2
- package/dist/src/tasks/task-run-coordinator.js +5 -1
- package/dist/src/tasks/task-run-dispatcher.js +2 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/usage/scenario-registry.js +0 -5
- package/dist/src/usage/types.d.ts +1 -1
- package/dist/src/work-discovery/probe.js +1 -1
- package/dist/src/workflows/domain/definition.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +2 -1
- package/package.json +10 -6
- package/skills/THIRD_PARTY_NOTICES.md +0 -6
- package/skills/creative/chat-charts/SKILL.md +26 -0
- package/skills/creative/chat-charts/references/bar-example.json +10 -0
- package/skills/creative/chat-charts/references/chart-spec.md +25 -0
- package/skills/creative/chat-charts/references/line-example.json +13 -0
- package/dist/gateway/static/root/assets/activity-YogQEteU.js +0 -1
- package/dist/gateway/static/root/assets/activity-store-DWQCDi8M.js +0 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DE910MyU.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-0SlvsYl7.js +0 -1
- package/dist/gateway/static/root/assets/agents-BZh28Qn1.js +0 -77
- package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +0 -1
- package/dist/gateway/static/root/assets/app-link-4gpFbdsr.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-9A7JN5V5.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-BPdLEo6L.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Cz7LypV9.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBjS-sk-.js +0 -6
- package/dist/gateway/static/root/assets/browser-automation-inputs-C5tIrIRL.js +0 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CFCMNfJN.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-C__tyPwu.js +0 -3
- package/dist/gateway/static/root/assets/button-aIC072nz.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-D6RJG4QY.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-DGEmBQnF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-B5AZa7ir.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dskz2_bh.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-xzjWZVbg.js +0 -1
- package/dist/gateway/static/root/assets/channels-DRse_dD3.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-CQF0M4kE.js +0 -36
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +0 -1
- package/dist/gateway/static/root/assets/chevron-right-BweFrslA.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
- package/dist/gateway/static/root/assets/circle-dashed-8qMD7gHf.js +0 -1
- package/dist/gateway/static/root/assets/circle-dot-BAseJTrF.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-ZfzCTS0N.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-CwAeWVLK.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CanakKaj.js +0 -1
- package/dist/gateway/static/root/assets/copy-text-row-C7egVuKr.js +0 -1
- package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-hmJlEAQZ.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-Us_Juz6I.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-CvOTI4uw.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DYg-Gb8t.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-sprite-BP6iMVw1.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-B1FbZ8C1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-DZN9EDvM.js +0 -1
- package/dist/gateway/static/root/assets/dist-C3DSFZCi.js +0 -1
- package/dist/gateway/static/root/assets/electron-env-Dit0bHgy.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-YIibp6Kk.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-DkcGyb28.js +0 -1
- package/dist/gateway/static/root/assets/extension-provider-B1PQGTtY.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C_rJiSKo.js +0 -1
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CMJVSnvi.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CjCWPHNJ.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/home-page-fAYsd7kG.js +0 -2
- package/dist/gateway/static/root/assets/image-generation-api-B98iXt6A.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DoBCBN8G.js +0 -1
- package/dist/gateway/static/root/assets/index-DFgXwLsv.js +0 -260
- package/dist/gateway/static/root/assets/index-a6ZvhclR.css +0 -1
- package/dist/gateway/static/root/assets/index.module-Cd9ENXfk.js +0 -1
- package/dist/gateway/static/root/assets/interaction-BdhHBbYa.js +0 -1
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-DXVu4lqV.js +0 -1
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B3fz6uRi.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-BC6xhmUh.js +0 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DFnZQu9A.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CSqSFDRU.js +0 -2
- package/dist/gateway/static/root/assets/loopi-C09I2mNj.css +0 -1
- package/dist/gateway/static/root/assets/loopi-Djb8XU3l.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-gq5L0THs.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-IsYTotu6.js +0 -324
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C_QKwqDN.js +0 -1
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-CKTo_sIF.js +0 -3
- package/dist/gateway/static/root/assets/mic-CuUb7zc-.js +0 -1
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-TjpL7hZ5.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CdpNXre-.js +0 -5
- package/dist/gateway/static/root/assets/notes-api-CBb944yw.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-EGvGw8MN.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-CoWb7BYP.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-HLrKIjXH.js +0 -1
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-DYzbNTyN.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-DHC7J4lG.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BJU2fmPn.js +0 -1
- package/dist/gateway/static/root/assets/product-delivery-BAks11S4.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-CTyy7H7-.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-content-D4xqTaEy.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DIVCw0QQ.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B4L9VnBN.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B8PvgLVz.js +0 -1
- package/dist/gateway/static/root/assets/rotate-ccw-JM1TBLpp.js +0 -1
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bqnp3tyt.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-D50g4GM2.js +0 -2
- package/dist/gateway/static/root/assets/schema-form-h_RCNfiO.js +0 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
- package/dist/gateway/static/root/assets/secret-input-BxWHx6J6.js +0 -1
- package/dist/gateway/static/root/assets/send-session-input-DypbVTT7.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-C_OiKblh.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-BsqDIbIr.js +0 -1
- package/dist/gateway/static/root/assets/settings-2-D-csvaET.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D3zJAW4p.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-num14vSv.js +0 -1
- package/dist/gateway/static/root/assets/settings-shell-dialog-layer-BU3UuiJr.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-jjSYJpDd.js +0 -1
- package/dist/gateway/static/root/assets/share-link-dialog-BGicglAS.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BORe9rLB.js +0 -2
- package/dist/gateway/static/root/assets/shares-api-Dbx3z6-1.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C13FgfWk.js +0 -1
- package/dist/gateway/static/root/assets/skeleton-BI5TyibZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-Cq6O1DZK.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-utils-C7V4JVXM.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Cq7QDjMA.js +0 -1
- package/dist/gateway/static/root/assets/skill-wire-pattern-BPpeIcCi.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BM1ShEjx.js +0 -2
- package/dist/gateway/static/root/assets/style-TIDOdKy0.js +0 -7
- package/dist/gateway/static/root/assets/system-settings-panel-BNCGFO1e.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-4VG82wcF.js +0 -2
- package/dist/gateway/static/root/assets/theme-store-Db7hDESt.js +0 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-C6p2Mu92.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Dw15EJp0.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-DDrIqgGe.js +0 -1
- package/dist/gateway/static/root/assets/use-async-resource-GrnWNwMZ.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DDjIdW4U.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-DNl7O3Vb.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-DMHehhwG.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-CaS9dOIr.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-ByAxHE4P.js +0 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-CVaU83Jc.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-BvVvPA1T.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BcFm9QcC.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DMec_XZB.js +0 -6
- package/dist/gateway/static/root/assets/workspace-api-BpfKsrtP.js +0 -2
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CU5lzzE9.js +0 -1
- package/dist/packages/gateway-contract/src/project-monitoring.js +0 -36
- package/dist/packages/gateway-contract/src/scenes.js +0 -200
- package/dist/src/agent/bootstrap/project-agents-context.d.ts +0 -2
- package/dist/src/agent/bootstrap/project-agents-context.js +0 -30
- package/dist/src/gateway/hono/routes/scenes.d.ts +0 -3
- package/dist/src/gateway/hono/routes/scenes.js +0 -271
- package/dist/src/gateway/scenes/browserNotifications.d.ts +0 -4
- package/dist/src/gateway/scenes/browserNotifications.js +0 -54
- package/dist/src/gateway/scenes/host.d.ts +0 -34
- package/dist/src/gateway/scenes/host.js +0 -154
- package/dist/src/gateway/scenes/mailContext.d.ts +0 -32
- package/dist/src/gateway/scenes/mailContext.js +0 -235
- package/dist/src/gateway/scenes/slackThreadSource.d.ts +0 -41
- package/dist/src/gateway/scenes/slackThreadSource.js +0 -168
- package/dist/src/notifications/browser-endpoint.d.ts +0 -2
- package/dist/src/notifications/browser-endpoint.js +0 -13
- package/dist/src/notifications/browserSubscriptions.d.ts +0 -20
- package/dist/src/notifications/browserSubscriptions.js +0 -59
- package/dist/src/notifications/browserTransport.d.ts +0 -9
- package/dist/src/notifications/browserTransport.js +0 -64
- package/dist/src/notifications/dispatch.d.ts +0 -46
- package/dist/src/notifications/dispatch.js +0 -109
- package/dist/src/notifications/domain-delivery.d.ts +0 -21
- package/dist/src/notifications/domain-delivery.js +0 -1
- package/dist/src/notifications/quietHours.d.ts +0 -6
- package/dist/src/notifications/quietHours.js +0 -23
- package/dist/src/notifications/resultOutbox.d.ts +0 -23
- package/dist/src/notifications/resultOutbox.js +0 -49
- package/dist/src/scenes/activationAdapter.d.ts +0 -19
- package/dist/src/scenes/activationAdapter.js +0 -1
- package/dist/src/scenes/agentExecutor.d.ts +0 -9
- package/dist/src/scenes/agentExecutor.js +0 -61
- package/dist/src/scenes/capabilities/read.d.ts +0 -3
- package/dist/src/scenes/capabilities/read.js +0 -187
- package/dist/src/scenes/capabilities/write.d.ts +0 -3
- package/dist/src/scenes/capabilities/write.js +0 -151
- package/dist/src/scenes/contracts.d.ts +0 -9
- package/dist/src/scenes/contracts.js +0 -61
- package/dist/src/scenes/execution.d.ts +0 -62
- package/dist/src/scenes/execution.js +0 -169
- package/dist/src/scenes/httpServices.d.ts +0 -39
- package/dist/src/scenes/httpServices.js +0 -1
- package/dist/src/scenes/inbox.d.ts +0 -17
- package/dist/src/scenes/inbox.js +0 -68
- package/dist/src/scenes/mailContext.d.ts +0 -24
- package/dist/src/scenes/mailContext.js +0 -115
- package/dist/src/scenes/mailObservations.d.ts +0 -20
- package/dist/src/scenes/mailObservations.js +0 -107
- package/dist/src/scenes/maintenance.d.ts +0 -3
- package/dist/src/scenes/maintenance.js +0 -20
- package/dist/src/scenes/metrics.d.ts +0 -31
- package/dist/src/scenes/metrics.js +0 -89
- package/dist/src/scenes/model.d.ts +0 -3
- package/dist/src/scenes/model.js +0 -10
- package/dist/src/scenes/notificationEligibility.d.ts +0 -17
- package/dist/src/scenes/notificationEligibility.js +0 -72
- package/dist/src/scenes/notificationPublication.d.ts +0 -7
- package/dist/src/scenes/notificationPublication.js +0 -43
- package/dist/src/scenes/preferences.d.ts +0 -19
- package/dist/src/scenes/preferences.js +0 -86
- package/dist/src/scenes/readiness.d.ts +0 -7
- package/dist/src/scenes/readiness.js +0 -20
- package/dist/src/scenes/registry.d.ts +0 -11
- package/dist/src/scenes/registry.js +0 -28
- package/dist/src/scenes/repository.d.ts +0 -178
- package/dist/src/scenes/repository.js +0 -782
- package/dist/src/scenes/resultNotifications.d.ts +0 -17
- package/dist/src/scenes/resultNotifications.js +0 -204
- package/dist/src/scenes/runtime.d.ts +0 -25
- package/dist/src/scenes/runtime.js +0 -101
- package/dist/src/scenes/schedule.d.ts +0 -2
- package/dist/src/scenes/schedule.js +0 -33
- package/dist/src/scenes/service.d.ts +0 -36
- package/dist/src/scenes/service.js +0 -122
- package/dist/src/scenes/taskFollowUp/agentExecutor.d.ts +0 -36
- package/dist/src/scenes/taskFollowUp/agentExecutor.js +0 -149
- package/dist/src/scenes/taskFollowUp/branchInventory.d.ts +0 -38
- package/dist/src/scenes/taskFollowUp/branchInventory.js +0 -70
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +0 -121
- package/dist/src/scenes/taskFollowUp/contracts.js +0 -119
- package/dist/src/scenes/taskFollowUp/resources.d.ts +0 -19
- package/dist/src/scenes/taskFollowUp/resources.js +0 -97
- package/dist/src/scenes/taskFollowUp/service.d.ts +0 -848
- package/dist/src/scenes/taskFollowUp/service.js +0 -770
- package/dist/src/scenes/taskFollowUp/workspaceFingerprint.d.ts +0 -2
- package/dist/src/scenes/taskFollowUp/workspaceFingerprint.js +0 -46
- package/dist/src/scenes/templates.d.ts +0 -64
- package/dist/src/scenes/templates.js +0 -76
- package/dist/src/scenes/userNotes.d.ts +0 -13
- package/dist/src/scenes/userNotes.js +0 -40
- package/dist/src/storage/sqlite/migrations/166_remove_proactive_previews.sql +0 -1
- package/dist/src/storage/sqlite/migrations/167_discussion_recording_chunks.sql +0 -7
- package/dist/src/storage/sqlite/migrations/168_discussion_evidence.sql +0 -16
- package/dist/src/storage/sqlite/migrations/169_discussion_action_tasks.sql +0 -8
- package/dist/src/storage/sqlite/migrations/170_discussion_edits.sql +0 -8
- package/dist/src/storage/sqlite/migrations/171_discussion_recording_jobs.sql +0 -14
- package/dist/src/storage/sqlite/migrations/172_project_understanding.sql +0 -3
- package/dist/src/storage/sqlite/migrations/173_mobile_discussion_source.sql +0 -5
- package/dist/src/storage/sqlite/migrations/174_capability_imports.sql +0 -11
- package/dist/src/storage/sqlite/migrations/175_import_selections.sql +0 -8
- package/dist/src/storage/sqlite/migrations/176_proactive_quality.sql +0 -5
- package/dist/src/storage/sqlite/migrations/177_proactive_check_controls.sql +0 -25
- package/dist/src/storage/sqlite/migrations/178_conversation_uuid.sql +0 -2
- package/dist/src/storage/sqlite/migrations/179_harmonyos_devices.sql +0 -41
- package/dist/src/storage/sqlite/migrations/180_execution_environment_ownership.sql +0 -7
- package/dist/src/storage/sqlite/migrations/181_knowledge_item_status_events.sql +0 -12
- package/dist/src/storage/sqlite/migrations/182_connector_account_policies.sql +0 -92
- package/dist/src/storage/sqlite/migrations/183_connector_backend_consistency.sql +0 -20
- package/dist/src/storage/sqlite/migrations/184_memory_suppressions.sql +0 -12
- package/dist/src/storage/sqlite/migrations/185_understanding_refresh_batches.sql +0 -6
- package/dist/src/storage/sqlite/migrations/186_sidebar_layout.sql +0 -16
- package/dist/src/storage/sqlite/migrations/187_cli_connectors.sql +0 -34
- package/dist/src/storage/sqlite/migrations/188_scene_storage.sql +0 -2
- package/dist/src/storage/sqlite/migrations/189_scene_source_health.sql +0 -8
- package/dist/src/storage/sqlite/migrations/190_scene_development.sql +0 -37
- package/dist/src/storage/sqlite/migrations/191_scene_task_follow_up.sql +0 -27
- package/dist/src/storage/sqlite/migrations/192_capability_operations.sql +0 -20
- package/dist/src/storage/sqlite/migrations/193_note_file_cleanup.sql +0 -8
- package/dist/src/storage/sqlite/migrations/194_capability_external_outcomes.sql +0 -11
- package/dist/src/storage/sqlite/migrations/195_automation_deleted_revisions.sql +0 -4
- package/dist/src/storage/sqlite/migrations/196_automation_run_requests.sql +0 -23
- package/dist/src/storage/sqlite/migrations/197_note_deletion_cleanup.sql +0 -8
- package/dist/src/storage/sqlite/migrations/198_project_workspace_creation.sql +0 -7
- package/dist/src/storage/sqlite/migrations/199_scene_resource_events.sql +0 -488
- package/dist/src/storage/sqlite/migrations/200_connected_work_threads.sql +0 -92
- package/dist/src/storage/sqlite/migrations/201_connector_extraction_audit.sql +0 -127
- package/dist/src/storage/sqlite/migrations/202_chat_previews.sql +0 -26
- package/dist/src/storage/sqlite/migrations/203_remove_retired_proactive_contracts.sql +0 -70
- package/dist/src/storage/sqlite/migrations/204_home_intelligence.sql +0 -78
- package/dist/src/storage/sqlite/migrations/205_agent_catalog.sql +0 -66
- package/dist/src/storage/sqlite/migrations/206_home_advice_strategy_version.sql +0 -3
- package/dist/src/storage/sqlite/migrations/207_user_model_policy_contract.sql +0 -121
- package/dist/src/storage/sqlite/migrations/208_automation_management.sql +0 -2
- package/dist/src/storage/sqlite/migrations/209_automation_event_hub.sql +0 -48
- package/dist/src/storage/sqlite/migrations/210_remove_legacy_automation_timeout.sql +0 -14
- package/dist/src/storage/sqlite/migrations/211_automation_result_deliveries.sql +0 -16
- package/dist/src/storage/sqlite/migrations/212_automation_delivery_policy.sql +0 -30
- package/dist/src/storage/sqlite/migrations/213_automation_reliability_contract.sql +0 -188
- package/dist/src/storage/sqlite/migrations/214_ai_usage_ledger.sql +0 -41
- package/dist/src/storage/sqlite/migrations/215_scene_execution_adapters.sql +0 -6
- package/dist/src/storage/sqlite/migrations/216_remove_scene_model_usage.sql +0 -1
- package/dist/src/storage/sqlite/migrations/217_remove_legacy_memory_tables.sql +0 -4
- package/dist/src/storage/sqlite/migrations/conversation-key-decoder.d.ts +0 -8
- package/dist/src/storage/sqlite/migrations/conversation-key-decoder.js +0 -87
- package/dist/src/storage/sqlite/migrations/conversation-uuid.d.ts +0 -8
- package/dist/src/storage/sqlite/migrations/conversation-uuid.js +0 -366
- package/dist/src/storage/sqlite/migrations/scene-reset.d.ts +0 -5
- package/dist/src/storage/sqlite/migrations/scene-reset.js +0 -40
- package/dist/src/storage/sqlite/scenes-schema.d.ts +0 -8
- package/dist/src/storage/sqlite/scenes-schema.js +0 -60
- package/dist/src/storage/sqlite/schemas/notifications.sql +0 -65
- package/dist/src/storage/sqlite/schemas/scenes.sql +0 -205
- package/skills/engineering/design-recurring-work/SKILL.md +0 -75
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { assertSceneStorageReady, init_scenes_schema } from "../../storage/sqlite/scenes-schema.js";
|
|
4
|
-
import { init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
|
|
5
|
-
import { SceneRepository } from "../../scenes/repository.js";
|
|
6
|
-
import { SceneApplicationService } from "../../scenes/service.js";
|
|
7
|
-
import { BrowserSubscriptionService } from "../../notifications/browserSubscriptions.js";
|
|
8
|
-
import { ScenePreferenceService } from "../../scenes/preferences.js";
|
|
9
|
-
import { SceneExecutionService } from "../../scenes/execution.js";
|
|
10
|
-
import { SceneAgentExecutor } from "../../scenes/agentExecutor.js";
|
|
11
|
-
import { SceneInboxService } from "../../scenes/inbox.js";
|
|
12
|
-
import { SceneMailObservationService } from "../../scenes/mailObservations.js";
|
|
13
|
-
import { maintainSceneStorage } from "../../scenes/maintenance.js";
|
|
14
|
-
import { SceneMetrics } from "../../scenes/metrics.js";
|
|
15
|
-
import { resolveSceneModelRef } from "../../scenes/model.js";
|
|
16
|
-
import { SceneCapabilityRegistry } from "../../scenes/registry.js";
|
|
17
|
-
import { SceneResultNotifications } from "../../scenes/resultNotifications.js";
|
|
18
|
-
import { SceneRuntime } from "../../scenes/runtime.js";
|
|
19
|
-
import { familyPlanTemplate, mailFollowUpTemplate } from "../../scenes/templates.js";
|
|
20
|
-
import { SceneUserNotesProvider } from "../../scenes/userNotes.js";
|
|
21
|
-
import { createSceneBrowserDispatcher } from "./browserNotifications.js";
|
|
22
|
-
import { GatewaySceneMailContext } from "./mailContext.js";
|
|
23
|
-
import { SlackThreadSource } from "./slackThreadSource.js";
|
|
24
|
-
import { SceneSourceRegistry, decisionLogTemplate, taskFollowUpTemplate } from "../../scenes/taskFollowUp/contracts.js";
|
|
25
|
-
import { SceneTaskExecutionService } from "../../scenes/taskFollowUp/service.js";
|
|
26
|
-
//#region src/gateway/scenes/host.ts
|
|
27
|
-
init_providers();
|
|
28
|
-
init_scenes_schema();
|
|
29
|
-
init_logger();
|
|
30
|
-
const log = createLogger("Gateway:Scenes");
|
|
31
|
-
/** Composition root for the initialized database. Never creates tables or starts an old worker. */
|
|
32
|
-
var GatewaySceneHost = class {
|
|
33
|
-
http;
|
|
34
|
-
runtime;
|
|
35
|
-
notifications;
|
|
36
|
-
browserDispatcher;
|
|
37
|
-
timer;
|
|
38
|
-
active;
|
|
39
|
-
stopped = false;
|
|
40
|
-
nextMaintenanceAt = 0;
|
|
41
|
-
clock;
|
|
42
|
-
constructor(db, input) {
|
|
43
|
-
this.db = db;
|
|
44
|
-
assertSceneStorageReady(db);
|
|
45
|
-
if (!input.principal.ownerId.trim() || !input.principal.workspaceId.trim()) throw new Error("Scene host principal is required");
|
|
46
|
-
const clock = input.clock ?? Date.now;
|
|
47
|
-
this.clock = clock;
|
|
48
|
-
const repository = new SceneRepository(db);
|
|
49
|
-
repository.installTemplate(mailFollowUpTemplate);
|
|
50
|
-
repository.installTemplate(familyPlanTemplate);
|
|
51
|
-
repository.installTemplate(taskFollowUpTemplate);
|
|
52
|
-
repository.installTemplate(decisionLogTemplate);
|
|
53
|
-
const mail = input.mail ?? new GatewaySceneMailContext(db, clock);
|
|
54
|
-
const providers = new SceneCapabilityRegistry([mail, new SceneUserNotesProvider(db, clock)]);
|
|
55
|
-
const authorize = (activation) => {
|
|
56
|
-
if (activation.ownerId !== input.principal.ownerId || activation.workspaceId !== input.principal.workspaceId) return {
|
|
57
|
-
accountIds: [],
|
|
58
|
-
contextProviders: [],
|
|
59
|
-
effectHandlers: []
|
|
60
|
-
};
|
|
61
|
-
const grants = providers.list().flatMap((provider) => {
|
|
62
|
-
const accountIds = provider.authorization?.(activation) ?? null;
|
|
63
|
-
return accountIds === null ? [] : [{
|
|
64
|
-
id: provider.id,
|
|
65
|
-
accountIds
|
|
66
|
-
}];
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
accountIds: [...new Set(grants.flatMap((grant) => grant.accountIds))],
|
|
70
|
-
contextProviders: grants.map((grant) => grant.id),
|
|
71
|
-
effectHandlers: []
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
const grant = async (activation) => authorize(activation);
|
|
75
|
-
const executor = input.executor ?? new SceneAgentExecutor(() => resolveModel(resolveSceneModelRef(input.config())));
|
|
76
|
-
const sourceProviders = new SceneSourceRegistry([new SlackThreadSource(db)]);
|
|
77
|
-
const activationAdapters = new SceneCapabilityRegistry([new SceneTaskExecutionService(db, {
|
|
78
|
-
config: input.config,
|
|
79
|
-
sources: sourceProviders
|
|
80
|
-
})]);
|
|
81
|
-
this.http = {
|
|
82
|
-
activationAdapters,
|
|
83
|
-
sourceProviders,
|
|
84
|
-
repository,
|
|
85
|
-
mail,
|
|
86
|
-
mailDiscovery: mail instanceof GatewaySceneMailContext ? mail : void 0,
|
|
87
|
-
application: new SceneApplicationService(repository, providers, grant, clock, () => {
|
|
88
|
-
if (input.executor) return [];
|
|
89
|
-
try {
|
|
90
|
-
return isProviderConfiguredSync(resolveModel(resolveSceneModelRef(input.config())).provider) ? [] : ["model_credentials"];
|
|
91
|
-
} catch {
|
|
92
|
-
return ["model_configuration"];
|
|
93
|
-
}
|
|
94
|
-
}),
|
|
95
|
-
inbox: new SceneInboxService(db, clock),
|
|
96
|
-
browser: new BrowserSubscriptionService(db, clock),
|
|
97
|
-
preferences: new ScenePreferenceService(db),
|
|
98
|
-
metrics: new SceneMetrics(db, clock, () => input.executor ? null : resolveSceneModelRef(input.config()))
|
|
99
|
-
};
|
|
100
|
-
this.runtime = new SceneRuntime(repository, new SceneExecutionService(repository, providers, executor, grant, clock), new SceneMailObservationService(repository, mail, grant, clock, 6e4), clock, input.intervalMs ?? 5e3);
|
|
101
|
-
this.notifications = new SceneResultNotifications(db, authorize, (event) => input.publish("notification.created", event), clock);
|
|
102
|
-
this.browserDispatcher = createSceneBrowserDispatcher(db, authorize, clock);
|
|
103
|
-
this.intervalMs = input.intervalMs ?? 5e3;
|
|
104
|
-
}
|
|
105
|
-
intervalMs;
|
|
106
|
-
start() {
|
|
107
|
-
if (this.stopped) throw new Error("Create a new scene host after shutdown");
|
|
108
|
-
if (this.timer) return;
|
|
109
|
-
assertSceneStorageReady(this.db);
|
|
110
|
-
this.runtime.start();
|
|
111
|
-
const poll = () => {
|
|
112
|
-
for (const adapter of this.http.activationAdapters.list()) adapter.tick().catch((err) => log.error({
|
|
113
|
-
err,
|
|
114
|
-
adapter: adapter.id
|
|
115
|
-
}, "Scene adapter check failed"));
|
|
116
|
-
try {
|
|
117
|
-
if (this.clock() >= this.nextMaintenanceAt) {
|
|
118
|
-
maintainSceneStorage(this.db, this.clock());
|
|
119
|
-
this.nextMaintenanceAt = this.clock() + 36e5;
|
|
120
|
-
}
|
|
121
|
-
this.notifications.drain();
|
|
122
|
-
this.browserDispatcher.drainOne().catch((err) => log.error({ err }, "Scene browser reminder failed"));
|
|
123
|
-
} catch (err) {
|
|
124
|
-
log.error({ err }, "Scene result publication failed");
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
this.timer = setInterval(poll, this.intervalMs);
|
|
128
|
-
this.timer.unref();
|
|
129
|
-
poll();
|
|
130
|
-
}
|
|
131
|
-
tick() {
|
|
132
|
-
if (this.stopped) return Promise.reject(/* @__PURE__ */ new Error("Scene host stopped"));
|
|
133
|
-
if (this.active) return this.active;
|
|
134
|
-
const work = Promise.all([this.runtime.tick(), ...this.http.activationAdapters.list().map((adapter) => adapter.tick())]).then(() => {
|
|
135
|
-
if (!this.stopped) this.notifications.drain();
|
|
136
|
-
});
|
|
137
|
-
this.active = work.finally(() => {
|
|
138
|
-
this.active = void 0;
|
|
139
|
-
});
|
|
140
|
-
return this.active;
|
|
141
|
-
}
|
|
142
|
-
/** Must finish before the Gateway closes SQLite or its realtime broker. */
|
|
143
|
-
async stop() {
|
|
144
|
-
this.stopped = true;
|
|
145
|
-
if (this.timer) clearInterval(this.timer);
|
|
146
|
-
this.timer = void 0;
|
|
147
|
-
await Promise.all(this.http.activationAdapters.list().map((adapter) => adapter.stop()));
|
|
148
|
-
await this.runtime.stop();
|
|
149
|
-
await this.browserDispatcher.stop();
|
|
150
|
-
await this.active?.catch(() => void 0);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
//#endregion
|
|
154
|
-
export { GatewaySceneHost };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import { ComposioSessionsAdapter } from '../../connectors/composio-sessions.js';
|
|
3
|
-
import { type SceneActivation, type ScenePrincipal } from '../../scenes/contracts.js';
|
|
4
|
-
import type { SceneContextProvider, SceneEvidence } from '../../scenes/execution.js';
|
|
5
|
-
import { SceneMailContextProvider } from '../../scenes/mailContext.js';
|
|
6
|
-
/** Reads only the delegated thread; never starts mailbox learning or persists raw mail. */
|
|
7
|
-
export declare class GatewaySceneMailContext extends SceneMailContextProvider {
|
|
8
|
-
private readonly connectionDb;
|
|
9
|
-
private readonly now;
|
|
10
|
-
private readonly adapter;
|
|
11
|
-
constructor(connectionDb: DatabaseSync, now?: () => number, adapter?: Pick<ComposioSessionsAdapter, 'executeWithPolicy'>);
|
|
12
|
-
private recordRequest;
|
|
13
|
-
listAccounts(principal: ScenePrincipal): Array<{
|
|
14
|
-
id: string;
|
|
15
|
-
label: string;
|
|
16
|
-
}>;
|
|
17
|
-
authorizedAccounts(activation: SceneActivation): string[];
|
|
18
|
-
listSources(principal: ScenePrincipal, limit?: number, afterId?: string): {
|
|
19
|
-
id: string;
|
|
20
|
-
accountId: string;
|
|
21
|
-
subject: string;
|
|
22
|
-
sender: string;
|
|
23
|
-
}[];
|
|
24
|
-
searchSources(principal: ScenePrincipal, value: unknown, signal: AbortSignal): Promise<{
|
|
25
|
-
id: string;
|
|
26
|
-
accountId: string;
|
|
27
|
-
subject: string;
|
|
28
|
-
sender: string;
|
|
29
|
-
}[]>;
|
|
30
|
-
private source;
|
|
31
|
-
read(input: Parameters<SceneContextProvider['read']>[0]): Promise<SceneEvidence[]>;
|
|
32
|
-
}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { getConnectorConnection, getConnectorInstallation, init_connector_repository } from "../../storage/sqlite/connector-repository.js";
|
|
2
|
-
import { ComposioSessionsAdapter } from "../../connectors/composio-sessions.js";
|
|
3
|
-
import { getConnectorDefinition } from "../../connectors/catalog.js";
|
|
4
|
-
import { sceneContentHash } from "../../scenes/contracts.js";
|
|
5
|
-
import { normalizeConnectedSourceResult } from "../../connectors/connected-source-normalizers.js";
|
|
6
|
-
import { sanitizeConnectedSourceValue } from "../../connectors/connected-source-sanitization.js";
|
|
7
|
-
import { SceneSourceNotReady, sceneSourceFailureReason } from "../../scenes/readiness.js";
|
|
8
|
-
import { SceneMailContextProvider } from "../../scenes/mailContext.js";
|
|
9
|
-
import { createHash } from "node:crypto";
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
//#region src/gateway/scenes/mailContext.ts
|
|
12
|
-
init_connector_repository();
|
|
13
|
-
const ACTION = "GMAIL_FETCH_MESSAGE_BY_THREAD_ID";
|
|
14
|
-
function record(value) {
|
|
15
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
16
|
-
}
|
|
17
|
-
/** Reads only the delegated thread; never starts mailbox learning or persists raw mail. */
|
|
18
|
-
var GatewaySceneMailContext = class extends SceneMailContextProvider {
|
|
19
|
-
constructor(connectionDb, now = Date.now, adapter = new ComposioSessionsAdapter()) {
|
|
20
|
-
super(connectionDb, now);
|
|
21
|
-
this.connectionDb = connectionDb;
|
|
22
|
-
this.now = now;
|
|
23
|
-
this.adapter = adapter;
|
|
24
|
-
}
|
|
25
|
-
recordRequest(principal, accountId) {
|
|
26
|
-
this.connectionDb.prepare(`INSERT INTO scene_connector_usage VALUES (?, ?, ?, ?, 1)
|
|
27
|
-
ON CONFLICT(owner_id, workspace_id, account_id, utc_day) DO UPDATE SET request_count = request_count + 1`).run(principal.ownerId, principal.workspaceId, accountId, Math.floor(this.now() / 864e5));
|
|
28
|
-
}
|
|
29
|
-
listAccounts(principal) {
|
|
30
|
-
return this.connectionDb.prepare(`SELECT a.id, a.label, a.identity_json, c.connector_id FROM connector_accounts a
|
|
31
|
-
JOIN connector_connections c ON c.id = a.current_connection_id AND c.account_id = a.id
|
|
32
|
-
AND c.principal_id = a.principal_id AND c.connector_id = a.connector_id
|
|
33
|
-
JOIN connector_installations i ON i.id = c.installation_id AND i.principal_id = a.principal_id AND i.connector_id = a.connector_id
|
|
34
|
-
WHERE a.principal_id = ? AND a.enabled = 1 AND c.status = 'active' AND c.provider = 'composio'
|
|
35
|
-
AND i.enabled = 1 AND i.confirmation_policy <> 'always'
|
|
36
|
-
AND json_array_length(i.allowed_agent_ids_json) = 0 AND a.allowed_agent_ids_json IS NULL
|
|
37
|
-
AND (i.selected_account_ids_json = 'null' OR EXISTS (SELECT 1 FROM json_each(i.selected_account_ids_json) WHERE value = a.id))
|
|
38
|
-
AND (c.expires_at IS NULL OR julianday(c.expires_at) > julianday(?, 'unixepoch')) ORDER BY a.id LIMIT 100`).all(principal.ownerId, this.now() / 1e3).filter((row) => {
|
|
39
|
-
const definition = getConnectorDefinition(String(row.connector_id));
|
|
40
|
-
return definition?.runtime.type === "composio" && definition.runtime.toolkit === "gmail";
|
|
41
|
-
}).map((row) => {
|
|
42
|
-
const identity = record(JSON.parse(String(row.identity_json)));
|
|
43
|
-
return {
|
|
44
|
-
id: String(row.id),
|
|
45
|
-
label: String(row.label || identity.email || identity.name || row.id).slice(0, 300)
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
authorizedAccounts(activation) {
|
|
50
|
-
if (activation.scope.kind !== "objects" || activation.scope.ids.length !== 1) return [];
|
|
51
|
-
const source = this.connectionDb.prepare("SELECT account_id FROM scene_mail_sources WHERE id = ? AND owner_id = ? AND workspace_id = ?").get(activation.scope.ids[0], activation.ownerId, activation.workspaceId);
|
|
52
|
-
return source && activation.permissions.accountIds.includes(String(source.account_id)) && this.listAccounts(activation).some((account) => account.id === source.account_id) ? [String(source.account_id)] : [];
|
|
53
|
-
}
|
|
54
|
-
listSources(principal, limit = 50, afterId = "") {
|
|
55
|
-
const accounts = new Set(this.listAccounts(principal).map((account) => account.id));
|
|
56
|
-
return this.connectionDb.prepare("SELECT id, account_id, subject, sender FROM scene_mail_sources WHERE owner_id = ? AND workspace_id = ? AND id > ? ORDER BY id LIMIT ?").all(principal.ownerId, principal.workspaceId, afterId, limit).filter((row) => accounts.has(String(row.account_id))).map((row) => ({
|
|
57
|
-
id: String(row.id),
|
|
58
|
-
accountId: String(row.account_id),
|
|
59
|
-
subject: String(row.subject),
|
|
60
|
-
sender: String(row.sender)
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
async searchSources(principal, value, signal) {
|
|
64
|
-
const { accountId, query } = z.strictObject({
|
|
65
|
-
accountId: z.string().min(1).max(200),
|
|
66
|
-
query: z.string().trim().min(1).max(500)
|
|
67
|
-
}).parse(value);
|
|
68
|
-
if (!this.listAccounts(principal).some((account) => account.id === accountId)) throw new Error("Mail account is not available for scene reads");
|
|
69
|
-
const account = this.connectionDb.prepare("SELECT current_connection_id FROM connector_accounts WHERE id = ?").get(accountId);
|
|
70
|
-
const connection = getConnectorConnection(String(account.current_connection_id));
|
|
71
|
-
const installation = getConnectorInstallation(connection.installationId);
|
|
72
|
-
signal.throwIfAborted();
|
|
73
|
-
this.recordRequest(principal, accountId);
|
|
74
|
-
const response = await this.adapter.executeWithPolicy({
|
|
75
|
-
context: {
|
|
76
|
-
principalId: principal.ownerId,
|
|
77
|
-
toolkits: ["gmail"]
|
|
78
|
-
},
|
|
79
|
-
connection,
|
|
80
|
-
installation,
|
|
81
|
-
signal,
|
|
82
|
-
action: {
|
|
83
|
-
connectorId: connection.connectorId,
|
|
84
|
-
toolkit: "gmail",
|
|
85
|
-
actionId: "GMAIL_FETCH_EMAILS",
|
|
86
|
-
scope: "read",
|
|
87
|
-
curated: true,
|
|
88
|
-
cachedAt: new Date(this.now()).toISOString()
|
|
89
|
-
},
|
|
90
|
-
args: {
|
|
91
|
-
query: `(${query}) -in:spam -in:trash -in:drafts`,
|
|
92
|
-
max_results: 30,
|
|
93
|
-
include_payload: true,
|
|
94
|
-
verbose: false
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
signal.throwIfAborted();
|
|
98
|
-
if (response.decision !== "allowed") throw new Error("Mail search permission is required");
|
|
99
|
-
const envelope = record(response.result);
|
|
100
|
-
if (envelope.successful === false || envelope.error || !Array.isArray(record(envelope.data).messages)) throw new SceneSourceNotReady();
|
|
101
|
-
if (!this.listAccounts(principal).some((account) => account.id === accountId) || this.connectionDb.prepare("SELECT current_connection_id FROM connector_accounts WHERE id = ?").get(accountId)?.current_connection_id !== connection.id) throw new Error("Mail authorization changed");
|
|
102
|
-
const normalized = normalizeConnectedSourceResult({
|
|
103
|
-
toolkit: "gmail",
|
|
104
|
-
actionId: "GMAIL_FETCH_EMAILS",
|
|
105
|
-
result: envelope.data
|
|
106
|
-
});
|
|
107
|
-
const sources = /* @__PURE__ */ new Map();
|
|
108
|
-
for (const mail of normalized.slice(0, 30)) {
|
|
109
|
-
const threadId = mail.value.threadId;
|
|
110
|
-
if (typeof threadId !== "string" || !threadId.trim() || threadId.length > 200) continue;
|
|
111
|
-
if (Array.isArray(mail.value.labels) && mail.value.labels.some((label) => [
|
|
112
|
-
"DRAFT",
|
|
113
|
-
"TRASH",
|
|
114
|
-
"SPAM"
|
|
115
|
-
].includes(String(label)))) continue;
|
|
116
|
-
const id = createHash("sha256").update(JSON.stringify([
|
|
117
|
-
principal.ownerId,
|
|
118
|
-
principal.workspaceId,
|
|
119
|
-
accountId,
|
|
120
|
-
threadId
|
|
121
|
-
])).digest("hex");
|
|
122
|
-
const subject = String(mail.value.subject ?? "").slice(0, 300);
|
|
123
|
-
const sender = String(mail.value.sender ?? "").slice(0, 300);
|
|
124
|
-
this.connectionDb.prepare(`INSERT INTO scene_mail_sources VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
125
|
-
ON CONFLICT(id) DO UPDATE SET subject = excluded.subject, sender = excluded.sender, selected_at = excluded.selected_at`).run(id, principal.ownerId, principal.workspaceId, accountId, threadId, subject, sender, this.now());
|
|
126
|
-
sources.set(id, {
|
|
127
|
-
id,
|
|
128
|
-
accountId,
|
|
129
|
-
subject,
|
|
130
|
-
sender
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return [...sources.values()];
|
|
134
|
-
}
|
|
135
|
-
source(subjectId) {
|
|
136
|
-
const row = this.connectionDb.prepare(`SELECT a.current_connection_id, s.thread_id FROM scene_mail_sources s
|
|
137
|
-
JOIN connector_accounts a ON a.id = s.account_id WHERE s.id = ?`).get(subjectId);
|
|
138
|
-
if (!row) throw new Error("Mail source unavailable");
|
|
139
|
-
return {
|
|
140
|
-
connectionId: String(row.current_connection_id),
|
|
141
|
-
threadId: String(row.thread_id)
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
async read(input) {
|
|
145
|
-
input.signal.throwIfAborted();
|
|
146
|
-
const accounts = this.authorizedAccounts(input.activation);
|
|
147
|
-
if (!input.permissions.contextProviders.includes("mail") || accounts.length !== 1 || !input.permissions.accountIds.includes(accounts[0]) || input.activation.scope.kind !== "objects" || input.activation.scope.ids[0] !== input.subjectId) throw new Error("Mail permission is required");
|
|
148
|
-
const origin = this.source(input.subjectId);
|
|
149
|
-
const startedAt = this.now();
|
|
150
|
-
if (input.notBefore !== void 0 && startedAt < input.notBefore) throw new SceneSourceNotReady();
|
|
151
|
-
const connection = getConnectorConnection(origin.connectionId);
|
|
152
|
-
const installation = getConnectorInstallation(connection.installationId);
|
|
153
|
-
const messages = [];
|
|
154
|
-
const tokens = /* @__PURE__ */ new Set();
|
|
155
|
-
let pageToken;
|
|
156
|
-
do {
|
|
157
|
-
input.signal.throwIfAborted();
|
|
158
|
-
if (!this.authorizedAccounts(input.activation).includes(accounts[0]) || sceneContentHash(this.source(input.subjectId)) !== sceneContentHash(origin)) throw new Error("Mail permission changed");
|
|
159
|
-
let response;
|
|
160
|
-
try {
|
|
161
|
-
this.recordRequest(input.activation, accounts[0]);
|
|
162
|
-
response = await this.adapter.executeWithPolicy({
|
|
163
|
-
context: {
|
|
164
|
-
principalId: input.activation.ownerId,
|
|
165
|
-
toolkits: ["gmail"]
|
|
166
|
-
},
|
|
167
|
-
connection,
|
|
168
|
-
installation,
|
|
169
|
-
signal: input.signal,
|
|
170
|
-
action: {
|
|
171
|
-
connectorId: connection.connectorId,
|
|
172
|
-
toolkit: "gmail",
|
|
173
|
-
actionId: ACTION,
|
|
174
|
-
scope: "read",
|
|
175
|
-
curated: true,
|
|
176
|
-
cachedAt: new Date(startedAt).toISOString()
|
|
177
|
-
},
|
|
178
|
-
args: {
|
|
179
|
-
user_id: "me",
|
|
180
|
-
thread_id: origin.threadId,
|
|
181
|
-
...pageToken ? { page_token: pageToken } : {}
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
} catch (error) {
|
|
185
|
-
input.signal.throwIfAborted();
|
|
186
|
-
throw new SceneSourceNotReady(sceneSourceFailureReason(error));
|
|
187
|
-
}
|
|
188
|
-
input.signal.throwIfAborted();
|
|
189
|
-
if (response.decision !== "allowed") throw new Error("Mail connector permission is required");
|
|
190
|
-
const envelope = record(response.result);
|
|
191
|
-
const data = record(envelope.data);
|
|
192
|
-
if (envelope.successful === false || envelope.error || !Array.isArray(data.messages) || data.messages.some((message) => !message || typeof message !== "object")) throw new SceneSourceNotReady(sceneSourceFailureReason(envelope.error));
|
|
193
|
-
messages.push(...data.messages.map(record));
|
|
194
|
-
if (messages.length > 30 || JSON.stringify(messages).length > 5e5) throw new Error("Mail thread exceeds its context budget");
|
|
195
|
-
if (data.nextPageToken != null && typeof data.nextPageToken !== "string") throw new SceneSourceNotReady();
|
|
196
|
-
pageToken = typeof data.nextPageToken === "string" && data.nextPageToken ? data.nextPageToken : void 0;
|
|
197
|
-
if (pageToken) {
|
|
198
|
-
if (!data.messages.length || tokens.has(pageToken) || tokens.size >= 29) throw new SceneSourceNotReady();
|
|
199
|
-
tokens.add(pageToken);
|
|
200
|
-
}
|
|
201
|
-
} while (pageToken);
|
|
202
|
-
if (!this.authorizedAccounts(input.activation).includes(accounts[0]) || sceneContentHash(this.source(input.subjectId)) !== sceneContentHash(origin)) throw new Error("Mail permission changed");
|
|
203
|
-
if (messages.some((message) => message.threadId !== origin.threadId || !Array.isArray(message.labelIds))) throw new SceneSourceNotReady();
|
|
204
|
-
const normalized = normalizeConnectedSourceResult({
|
|
205
|
-
toolkit: "gmail",
|
|
206
|
-
actionId: ACTION,
|
|
207
|
-
result: { messages }
|
|
208
|
-
});
|
|
209
|
-
if (normalized.length !== messages.length || new Set(normalized.map((message) => message.externalId)).size !== messages.length) throw new SceneSourceNotReady();
|
|
210
|
-
const active = normalized.filter((message) => !message.value.labels.some((label) => [
|
|
211
|
-
"DRAFT",
|
|
212
|
-
"TRASH",
|
|
213
|
-
"SPAM"
|
|
214
|
-
].includes(String(label))));
|
|
215
|
-
if (!active.length || active.some((message) => typeof message.value.content !== "string" || !message.value.content.trim())) throw new SceneSourceNotReady();
|
|
216
|
-
const evidence = active.map((message) => {
|
|
217
|
-
const content = JSON.stringify(sanitizeConnectedSourceValue(message.value));
|
|
218
|
-
return {
|
|
219
|
-
id: `mail:${accounts[0]}:${message.externalId}`,
|
|
220
|
-
subjectId: input.subjectId,
|
|
221
|
-
ownerId: input.activation.ownerId,
|
|
222
|
-
workspaceId: input.activation.workspaceId,
|
|
223
|
-
accountId: accounts[0],
|
|
224
|
-
content,
|
|
225
|
-
revision: sceneContentHash(content),
|
|
226
|
-
freshUntil: startedAt + 30 * 6e4,
|
|
227
|
-
...message.occurredAt ? { occurredAt: Date.parse(message.occurredAt) } : {}
|
|
228
|
-
};
|
|
229
|
-
});
|
|
230
|
-
if (evidence.reduce((size, message) => size + message.content.length, 0) > 12e4) throw new Error("Mail thread exceeds its context budget");
|
|
231
|
-
return evidence;
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
//#endregion
|
|
235
|
-
export { GatewaySceneMailContext };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { ComposioSessionsAdapter } from '../../connectors/composio-sessions.js';
|
|
4
|
-
import { type ScenePrincipal } from '../../scenes/contracts.js';
|
|
5
|
-
import type { SceneSourceAdapter, SourceSnapshot } from '../../scenes/taskFollowUp/contracts.js';
|
|
6
|
-
export declare const slackThreadSchema: z.ZodObject<{
|
|
7
|
-
accountId: z.ZodString;
|
|
8
|
-
teamId: z.ZodString;
|
|
9
|
-
channelId: z.ZodString;
|
|
10
|
-
threadTs: z.ZodString;
|
|
11
|
-
}, z.core.$strict>;
|
|
12
|
-
export type SlackThread = z.infer<typeof slackThreadSchema>;
|
|
13
|
-
/** Parse locally; never fetch a user-supplied URL. Reply links resolve to their root. */
|
|
14
|
-
export declare function parseSlackThreadUrl(value: string): {
|
|
15
|
-
channelId: string;
|
|
16
|
-
threadTs: string;
|
|
17
|
-
};
|
|
18
|
-
/** Read-only connector adapter. Account policy is rechecked before and after every page. */
|
|
19
|
-
export declare class SlackThreadSource implements SceneSourceAdapter {
|
|
20
|
-
private readonly db;
|
|
21
|
-
private readonly adapter;
|
|
22
|
-
readonly id = "slack_thread";
|
|
23
|
-
readonly label = "Slack thread";
|
|
24
|
-
normalize(reference: Record<string, string>): {
|
|
25
|
-
accountId: string;
|
|
26
|
-
teamId: string;
|
|
27
|
-
channelId: string;
|
|
28
|
-
threadTs: string;
|
|
29
|
-
};
|
|
30
|
-
accountIds(reference: Record<string, string>): string[];
|
|
31
|
-
authorized(principal: ScenePrincipal, reference: Record<string, string>): boolean;
|
|
32
|
-
constructor(db: DatabaseSync, adapter?: Pick<ComposioSessionsAdapter, 'executeWithPolicy'>);
|
|
33
|
-
listAccounts(principal: ScenePrincipal): Array<{
|
|
34
|
-
id: string;
|
|
35
|
-
label: string;
|
|
36
|
-
}>;
|
|
37
|
-
private connection;
|
|
38
|
-
private call;
|
|
39
|
-
resolveLink(principal: ScenePrincipal, accountId: string, url: string, signal: AbortSignal): Promise<SlackThread>;
|
|
40
|
-
read(principal: ScenePrincipal, reference: Record<string, string>, signal: AbortSignal): Promise<SourceSnapshot>;
|
|
41
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { getConnectorConnection, getConnectorInstallation, init_connector_repository } from "../../storage/sqlite/connector-repository.js";
|
|
2
|
-
import { ComposioSessionsAdapter } from "../../connectors/composio-sessions.js";
|
|
3
|
-
import { getConnectorDefinition } from "../../connectors/catalog.js";
|
|
4
|
-
import { sceneContentHash } from "../../scenes/contracts.js";
|
|
5
|
-
import { sanitizeConnectedSourceValue } from "../../connectors/connected-source-sanitization.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/gateway/scenes/slackThreadSource.ts
|
|
8
|
-
init_connector_repository();
|
|
9
|
-
const slackThreadSchema = z.strictObject({
|
|
10
|
-
accountId: z.string().min(1).max(200),
|
|
11
|
-
teamId: z.string().regex(/^T[A-Z0-9]+$/),
|
|
12
|
-
channelId: z.string().regex(/^[CDG][A-Z0-9]+$/),
|
|
13
|
-
threadTs: z.string().regex(/^\d{10,}\.\d{6}$/)
|
|
14
|
-
});
|
|
15
|
-
/** Parse locally; never fetch a user-supplied URL. Reply links resolve to their root. */
|
|
16
|
-
function parseSlackThreadUrl(value) {
|
|
17
|
-
const url = new URL(value);
|
|
18
|
-
if (url.protocol !== "https:" || !/^[a-z0-9-]+\.slack\.com$/.test(url.hostname) || url.username || url.password || url.port) throw new Error("Expected a Slack message link");
|
|
19
|
-
const match = /^\/archives\/([CDG][A-Z0-9]+)\/p(\d{16,})$/.exec(url.pathname);
|
|
20
|
-
if (!match) throw new Error("Expected a Slack message link");
|
|
21
|
-
const threadTs = url.searchParams.get("thread_ts") ?? `${match[2].slice(0, -6)}.${match[2].slice(-6)}`;
|
|
22
|
-
if (!/^\d{10,}\.\d{6}$/.test(threadTs)) throw new Error("Invalid Slack thread timestamp");
|
|
23
|
-
return {
|
|
24
|
-
channelId: match[1],
|
|
25
|
-
threadTs
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
const object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
29
|
-
/** Read-only connector adapter. Account policy is rechecked before and after every page. */
|
|
30
|
-
var SlackThreadSource = class {
|
|
31
|
-
id = "slack_thread";
|
|
32
|
-
label = "Slack thread";
|
|
33
|
-
normalize(reference) {
|
|
34
|
-
return slackThreadSchema.parse(reference);
|
|
35
|
-
}
|
|
36
|
-
accountIds(reference) {
|
|
37
|
-
return [this.normalize(reference).accountId];
|
|
38
|
-
}
|
|
39
|
-
authorized(principal, reference) {
|
|
40
|
-
return this.listAccounts(principal).some((account) => account.id === this.normalize(reference).accountId);
|
|
41
|
-
}
|
|
42
|
-
constructor(db, adapter = new ComposioSessionsAdapter()) {
|
|
43
|
-
this.db = db;
|
|
44
|
-
this.adapter = adapter;
|
|
45
|
-
}
|
|
46
|
-
listAccounts(principal) {
|
|
47
|
-
return this.db.prepare(`SELECT a.id, a.label, c.connector_id FROM connector_accounts a
|
|
48
|
-
JOIN connector_connections c ON c.id = a.current_connection_id AND c.account_id = a.id
|
|
49
|
-
AND c.principal_id = a.principal_id AND c.connector_id = a.connector_id
|
|
50
|
-
JOIN connector_installations i ON i.id = c.installation_id AND i.principal_id = a.principal_id AND i.connector_id = a.connector_id
|
|
51
|
-
WHERE a.principal_id = ? AND a.enabled = 1 AND c.status = 'active' AND c.provider = 'composio'
|
|
52
|
-
AND i.enabled = 1 AND i.confirmation_policy <> 'always'
|
|
53
|
-
AND json_array_length(i.allowed_agent_ids_json) = 0 AND a.allowed_agent_ids_json IS NULL
|
|
54
|
-
AND (i.selected_account_ids_json = 'null' OR EXISTS (SELECT 1 FROM json_each(i.selected_account_ids_json) WHERE value = a.id))
|
|
55
|
-
AND (c.expires_at IS NULL OR julianday(c.expires_at) > julianday('now')) ORDER BY a.id LIMIT 100`).all(principal.ownerId).filter((row) => {
|
|
56
|
-
const definition = getConnectorDefinition(String(row.connector_id));
|
|
57
|
-
return definition?.runtime.type === "composio" && definition.runtime.toolkit === "slack";
|
|
58
|
-
}).map((row) => ({
|
|
59
|
-
id: String(row.id),
|
|
60
|
-
label: String(row.label || row.id).slice(0, 300)
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
connection(principal, accountId) {
|
|
64
|
-
if (!this.listAccounts(principal).some((account) => account.id === accountId)) throw new Error("Slack account permission unavailable");
|
|
65
|
-
const row = this.db.prepare("SELECT current_connection_id FROM connector_accounts WHERE id = ?").get(accountId);
|
|
66
|
-
return getConnectorConnection(String(row.current_connection_id));
|
|
67
|
-
}
|
|
68
|
-
async call(principal, accountId, actionId, args, signal) {
|
|
69
|
-
signal.throwIfAborted();
|
|
70
|
-
const connection = this.connection(principal, accountId);
|
|
71
|
-
const installation = getConnectorInstallation(connection.installationId);
|
|
72
|
-
const day = Math.floor(Date.now() / 864e5);
|
|
73
|
-
const usage = this.db.prepare("SELECT request_count FROM scene_connector_usage WHERE owner_id = ? AND workspace_id = ? AND account_id = ? AND utc_day = ?").get(principal.ownerId, principal.workspaceId, accountId, day);
|
|
74
|
-
if (Number(usage?.request_count ?? 0) >= 3e3) throw new Error("Slack daily request budget exhausted");
|
|
75
|
-
this.db.prepare(`INSERT INTO scene_connector_usage VALUES (?, ?, ?, ?, 1)
|
|
76
|
-
ON CONFLICT(owner_id, workspace_id, account_id, utc_day) DO UPDATE SET request_count = request_count + 1`).run(principal.ownerId, principal.workspaceId, accountId, day);
|
|
77
|
-
const result = await this.adapter.executeWithPolicy({
|
|
78
|
-
context: {
|
|
79
|
-
principalId: principal.ownerId,
|
|
80
|
-
toolkits: ["slack"]
|
|
81
|
-
},
|
|
82
|
-
connection,
|
|
83
|
-
installation,
|
|
84
|
-
signal,
|
|
85
|
-
args,
|
|
86
|
-
action: {
|
|
87
|
-
connectorId: connection.connectorId,
|
|
88
|
-
toolkit: "slack",
|
|
89
|
-
actionId,
|
|
90
|
-
scope: "read",
|
|
91
|
-
curated: true,
|
|
92
|
-
cachedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
signal.throwIfAborted();
|
|
96
|
-
if (this.connection(principal, accountId).id !== connection.id) throw new Error("Slack connection changed");
|
|
97
|
-
if (result.decision !== "allowed") throw new Error("Slack read requires permission");
|
|
98
|
-
const envelope = object(result.result);
|
|
99
|
-
const data = object(envelope.data);
|
|
100
|
-
if (envelope.successful === false || envelope.error || data.ok === false || data.error || !Object.keys(data).length) throw new Error("Slack source unavailable; check connection permissions or rate limit");
|
|
101
|
-
return data;
|
|
102
|
-
}
|
|
103
|
-
async resolveLink(principal, accountId, url, signal) {
|
|
104
|
-
const parsed = parseSlackThreadUrl(url);
|
|
105
|
-
const auth = await this.call(principal, accountId, "SLACK_TEST_AUTH", {}, signal);
|
|
106
|
-
if (typeof auth.team_id !== "string" || !/^T[A-Z0-9]+$/.test(auth.team_id)) throw new Error("Slack workspace identity unavailable");
|
|
107
|
-
return {
|
|
108
|
-
accountId,
|
|
109
|
-
teamId: auth.team_id,
|
|
110
|
-
...parsed
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
async read(principal, reference, signal) {
|
|
114
|
-
const thread = this.normalize(reference);
|
|
115
|
-
if ((await this.call(principal, thread.accountId, "SLACK_TEST_AUTH", {}, signal)).team_id !== thread.teamId) throw new Error("Slack workspace identity changed");
|
|
116
|
-
const messages = /* @__PURE__ */ new Map();
|
|
117
|
-
const cursors = /* @__PURE__ */ new Set();
|
|
118
|
-
let cursor;
|
|
119
|
-
do {
|
|
120
|
-
const data = await this.call(principal, thread.accountId, "SLACK_FETCH_MESSAGE_THREAD_FROM_A_CONVERSATION", {
|
|
121
|
-
channel: thread.channelId,
|
|
122
|
-
ts: thread.threadTs,
|
|
123
|
-
limit: 100,
|
|
124
|
-
...cursor ? { cursor } : {}
|
|
125
|
-
}, signal);
|
|
126
|
-
if (!Array.isArray(data.messages) || !data.messages.length) throw new Error("Slack thread is missing or incomplete");
|
|
127
|
-
for (const item of data.messages) {
|
|
128
|
-
const message = object(item);
|
|
129
|
-
if (typeof message.ts !== "string" || typeof message.text !== "string" || message.ts !== thread.threadTs && message.thread_ts !== thread.threadTs) throw new Error("Unexpected Slack thread response");
|
|
130
|
-
messages.set(message.ts, {
|
|
131
|
-
ts: message.ts,
|
|
132
|
-
user: String(message.user ?? message.bot_id ?? "unknown"),
|
|
133
|
-
text: String(sanitizeConnectedSourceValue(message.text)),
|
|
134
|
-
...Array.isArray(message.files) && message.files.length || Array.isArray(message.attachments) && message.attachments.length ? { unreadAttachments: sanitizeConnectedSourceValue({
|
|
135
|
-
files: Array.isArray(message.files) ? message.files.slice(0, 20).map((value) => {
|
|
136
|
-
const file = object(value);
|
|
137
|
-
return {
|
|
138
|
-
id: file.id,
|
|
139
|
-
name: file.name,
|
|
140
|
-
mimetype: file.mimetype
|
|
141
|
-
};
|
|
142
|
-
}) : [],
|
|
143
|
-
richMessageCount: Array.isArray(message.attachments) ? message.attachments.length : 0,
|
|
144
|
-
contentFetched: false
|
|
145
|
-
}) } : {}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
if (messages.size > 200) throw new Error("Slack thread exceeds the 200-message context budget");
|
|
149
|
-
const next = object(data.response_metadata).next_cursor;
|
|
150
|
-
if (next != null && typeof next !== "string") throw new Error("Invalid Slack pagination");
|
|
151
|
-
cursor = typeof next === "string" && next.trim() ? next.trim() : void 0;
|
|
152
|
-
if (data.has_more === true && !cursor) throw new Error("Slack thread pagination is incomplete");
|
|
153
|
-
if (cursor && (cursors.has(cursor) || cursors.size >= 9)) throw new Error("Slack pagination budget exceeded");
|
|
154
|
-
if (cursor) cursors.add(cursor);
|
|
155
|
-
} while (cursor);
|
|
156
|
-
if (!messages.has(thread.threadTs)) throw new Error("Select the root of the Slack thread");
|
|
157
|
-
const ordered = [...messages.values()].sort((a, b) => a.ts.localeCompare(b.ts));
|
|
158
|
-
const text = JSON.stringify(ordered);
|
|
159
|
-
if (text.length > 32e3) throw new Error("Slack thread exceeds the 32,000-character context budget");
|
|
160
|
-
return {
|
|
161
|
-
revision: sceneContentHash(ordered),
|
|
162
|
-
text,
|
|
163
|
-
observedAt: Date.now()
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
//#endregion
|
|
168
|
-
export { SlackThreadSource, parseSlackThreadUrl, slackThreadSchema };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//#region src/notifications/browser-endpoint.ts
|
|
2
|
-
/** Only supported public browser-push providers may receive subscription requests. */
|
|
3
|
-
function allowedPushEndpoint(value) {
|
|
4
|
-
try {
|
|
5
|
-
const url = new URL(value);
|
|
6
|
-
const host = url.hostname;
|
|
7
|
-
return url.protocol === "https:" && !url.username && !url.password && (!url.port || url.port === "443") && (host === "fcm.googleapis.com" || host === "updates.push.services.mozilla.com" || host.endsWith(".push.services.mozilla.com") || host === "web.push.apple.com" || host.endsWith(".notify.windows.com"));
|
|
8
|
-
} catch {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { allowedPushEndpoint };
|