@xopcai/xopc 0.0.312 → 0.0.314
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-C3yV1y_l.js → auth-DKo-NMUY.js} +18 -1
- package/dist/browser-ext/dist/background.js +68 -2
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BVIJMP8w.js → agent-avatar-dicebear-BFkjfurL.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BdOZ6q8Z.js +1 -0
- package/dist/gateway/static/root/assets/{agents-D6g_SeWI.js → agents-CCcavsHq.js} +1 -1
- package/dist/gateway/static/root/assets/{api-_aHQA8bd.js → api-BYhRsTAc.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-CKueEVbT.js → app-link-nL8iPwEr.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CLg_aXYG.js → app-management-settings-panel-B4kihr-A.js} +1 -1
- package/dist/gateway/static/root/assets/appearance-settings-N9sYmNOx.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-BMcy10_s.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CHO3heHX.js → archive-plugin-k_SuYWyV.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BsmsBCI2.js → attachment-load-DRv5QWUK.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CftigJlf.js → automations-page-CkJV3DN0.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BEa2doeR.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CRCLWBo2.js → binary-plugins-Dg3h3TA7.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D0LDiOTT.js → block-editor-DVhdHntT.js} +29 -29
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C611KRBx.js → browser-automation-inputs-BMRYUW8_.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Djyv3vy-.js → browser-automations-page-Byv6-FY2.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DRCHGFpO.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-D0S3DuAD.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-mxRP0gl0.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DBt_6GsB.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CIsKqdET.js → chat-terminal-dock-D4AHa51o.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-C0YL9J7m.js → computer-settings-page-eXPe500D.js} +1 -1
- package/dist/gateway/static/root/assets/connector-service-page-BQTFlq_k.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BKeBWwcI.js +2 -0
- package/dist/gateway/static/root/assets/conversation-identity-Cw0n9uzK.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CDsfv8R0.js → date-picker-7MtovynY.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DvhPj3CZ.js → dependency-picker-Bj_xkXID.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Cyg8XMpL.js → desktop-pet-CTmba9zH.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DNM_BlWN.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-C2XE0QhT.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D-AVJU3q.js → extension-debug-page-J_olaL7e.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DrFoQ9xt.js → extension-page-pK5RvqN8.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DxWjESC1.js → extension-settings-page-BwroEN08.js} +1 -1
- package/dist/gateway/static/root/assets/files-BK6enEvD.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DUDX42qY.js → gateway-config-swr-FuJTIg_a.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CLLDp23J.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Cf8OxlvY.js → gateway-startup-retry-CKg_gu8_.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-B5Epb1PH.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-D2YorS--.js → image-generation-api-Bo6NZ7zb.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BKucJlXI.js → imports-page-C8-hX8gS.js} +1 -1
- package/dist/gateway/static/root/assets/index-14F1yGJI.js +89 -0
- package/dist/gateway/static/root/assets/index-cB7rWIDY.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BxLXD-yU.js → keyboard-shortcuts-settings-BkBEjUZD.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-6jC3vQpY.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BAsQJQKJ.js → local-apps-page-CrbKIixo.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DA0Z5jM_.js → locale-store-CvGwNbml.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DBHlZts9.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-DsUWLu5m.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DYGPxPee.js → markdown-view-nXo5nrsv.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CQtQzLyg.js → media-plugins-upxXJ-4l.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B_AwRroN.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-0Q9TOtJG.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-D0NmcwNw.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-DUyA-K4L.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-B6DjkyMM.js → page-tabs-Cl-NFPNr.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dn57uLhr.js → preview-open-alternatives-DX81PwJ3.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-chCjIpvu.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-H2YMk8TY.js → product-open-page-CrfIGwm8.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BVfVrYmn.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-nM9a9XNS.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-C0DCx3wv.js → registry-api-CHxgohY0.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C8b_k88G.js +1 -0
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-D3dLOW04.js +5 -0
- package/dist/gateway/static/root/assets/scenes-page-DEowreZV.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-CblI9WUA.js → schema-form-ZxuIvD2_.js} +1 -1
- package/dist/gateway/static/root/assets/schemas-88fK3zzl.js +64 -0
- package/dist/gateway/static/root/assets/sessions-page-B_nPhera.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BqhIOuus.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BAaVyxJH.js → settings-form-section-TZRfg4yo.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CKNPbm5q.js → settings-page-a8qcJpdZ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DqNCGKxQ.js → settings-page-layout-BfvlRT9q.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CRj5Ruqn.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BzMfp_HM.js → share-preview-page-DCt1pTWB.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BNbXPk--.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CNMCLbav.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DIht92q6.js → skills-page-BIOcg44X.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DLYRiEn3.js → skills-page.utils-CgZdzT4I.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-yYs4YgYk.js → system-settings-panel-_YaRncA6.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CAcfAG-c.js +1 -0
- package/dist/gateway/static/root/assets/tasks-CDR_RVbQ.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-BasDYxvx.js → tunnel-api-uOupJOoS.js} +1 -1
- package/dist/gateway/static/root/assets/turn-outcome-D0SnyZ3Z.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CWAUHhcb.js → use-autosave-BezzHBLE.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BFFeneDq.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-Kc4UlxZs.js → voice-api-key-field-BmYifdwL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DTyMdGOR.js → voice-config-api-D_5Q2_A3.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BPC_c9dO.js → work-discovery-overlay-4DmyEckJ.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DBTciOrq.js → workflow-run-setup-panel-DeZe8bTZ.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Sv4hEc6W.js +6 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +10 -1
- package/dist/packages/gateway-contract/src/app-context.js +55 -0
- package/dist/packages/gateway-contract/src/automations.js +16 -17
- package/dist/packages/gateway-contract/src/capabilities.js +1078 -0
- package/dist/packages/gateway-contract/src/extension-capabilities.js +26 -0
- package/dist/packages/gateway-contract/src/home.js +3 -3
- package/dist/packages/gateway-contract/src/index.js +8 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +19 -4
- package/dist/packages/gateway-contract/src/scenes.js +199 -0
- package/dist/packages/gateway-contract/src/task-runs.js +8 -4
- package/dist/packages/gateway-contract/src/tasks.js +5 -4
- package/dist/packages/realtime-client/src/index.js +17 -4
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/child-agent-factory.d.ts +2 -0
- package/dist/src/agent/child-agent-factory.js +5 -0
- package/dist/src/agent/commands/approved-verification.d.ts +14 -0
- package/dist/src/agent/commands/approved-verification.js +48 -0
- package/dist/src/agent/context/execution-scope.js +2 -1
- package/dist/src/agent/context/project-context.js +2 -1
- package/dist/src/agent/external-tools/cliProvider.js +123 -75
- package/dist/src/agent/external-tools/composio-provider.d.ts +1 -1
- package/dist/src/agent/external-tools/composio-provider.js +70 -12
- package/dist/src/agent/external-tools/endpoint-provider.js +14 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +2 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
- package/dist/src/agent/memory/compaction-chunks.d.ts +6 -1
- package/dist/src/agent/memory/compaction-chunks.js +16 -3
- package/dist/src/agent/memory/compaction-ledger.d.ts +3 -1
- package/dist/src/agent/memory/compaction-ledger.js +31 -18
- package/dist/src/agent/memory/compaction-request.d.ts +2 -0
- package/dist/src/agent/memory/compaction-request.js +6 -1
- package/dist/src/agent/memory/compaction.d.ts +19 -1
- package/dist/src/agent/memory/compaction.js +112 -30
- package/dist/src/agent/service/process-direct-streaming.d.ts +3 -0
- package/dist/src/agent/service/process-direct-streaming.js +19 -10
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/skills/config.js +2 -0
- package/dist/src/agent/skills/format-skills-prompt.js +14 -1
- package/dist/src/agent/skills/index.js +16 -8
- package/dist/src/agent/skills/types.d.ts +1 -1
- package/dist/src/agent/source-context/app-context.d.ts +4 -0
- package/dist/src/agent/source-context/app-context.js +36 -0
- package/dist/src/agent/source-context/injector.js +1 -0
- package/dist/src/agent/source-context/types.d.ts +5 -1
- package/dist/src/agent/tasks/task-judge-service.js +2 -1
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +1 -1
- package/dist/src/agent/tools/automation-tool.d.ts +12 -1
- package/dist/src/agent/tools/automation-tool.js +106 -32
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +6 -1
- package/dist/src/agent/tools/scoped-workspace-tools.d.ts +8 -0
- package/dist/src/agent/tools/scoped-workspace-tools.js +81 -0
- package/dist/src/agent/tools/xopc-use-tool.d.ts +6 -3
- package/dist/src/agent/tools/xopc-use-tool.js +997 -908
- package/dist/src/agent/workflow/subagent-runner.js +1 -0
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/schema.d.ts +5 -0
- package/dist/src/agent-config/schema.js +14 -10
- package/dist/src/automations/api/routes.js +244 -164
- package/dist/src/automations/capabilities/drafts.d.ts +4 -0
- package/dist/src/automations/capabilities/drafts.js +95 -0
- package/dist/src/automations/capabilities/read.d.ts +4 -0
- package/dist/src/automations/capabilities/read.js +119 -0
- package/dist/src/automations/capabilities/write.d.ts +349 -0
- package/dist/src/automations/capabilities/write.js +172 -0
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/validation.d.ts +77 -77
- package/dist/src/automations/domain/validation.js +9 -6
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
- package/dist/src/automations/index.js +6 -6
- package/dist/src/automations/service/automation-service.d.ts +31 -0
- package/dist/src/automations/service/automation-service.js +213 -75
- package/dist/src/automations/service/index.js +2 -2
- package/dist/src/automations/storage/automation-repository.d.ts +2 -0
- package/dist/src/automations/storage/automation-repository.js +9 -1
- package/dist/src/automations/storage/automation-run-repository.d.ts +4 -1
- package/dist/src/automations/storage/automation-run-repository.js +16 -3
- package/dist/src/automations/storage/index.js +3 -3
- package/dist/src/browser/automations/schema.d.ts +1 -1
- package/dist/src/browser/automations/service.d.ts +1 -1
- package/dist/src/browser/observation/format.js +4 -0
- package/dist/src/capabilities/adapters/http.d.ts +4 -0
- package/dist/src/capabilities/adapters/http.js +44 -0
- package/dist/src/capabilities/readiness/from-config.js +11 -7
- package/dist/src/capabilities/runtime/app-context.d.ts +3 -0
- package/dist/src/capabilities/runtime/app-context.js +72 -0
- package/dist/src/capabilities/runtime/atomic-operations.d.ts +11 -0
- package/dist/src/capabilities/runtime/atomic-operations.js +34 -0
- package/dist/src/capabilities/runtime/dispatcher.d.ts +67 -0
- package/dist/src/capabilities/runtime/dispatcher.js +170 -0
- package/dist/src/capabilities/runtime/errors.d.ts +6 -0
- package/dist/src/capabilities/runtime/errors.js +11 -0
- package/dist/src/capabilities/runtime/external-operations.d.ts +16 -0
- package/dist/src/capabilities/runtime/external-operations.js +92 -0
- package/dist/src/capabilities/runtime/product.d.ts +12 -0
- package/dist/src/capabilities/runtime/product.js +69 -0
- package/dist/src/capabilities/runtime/settings.d.ts +3 -0
- package/dist/src/capabilities/runtime/settings.js +27 -0
- package/dist/src/channels/index.js +2 -2
- package/dist/src/channels/manager.js +1 -1
- package/dist/src/cli/cli-log-level-preset.d.ts +2 -0
- package/dist/src/cli/cli-log-level-preset.js +4 -0
- package/dist/src/cli/command-catalog.js +4 -0
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/mcp.d.ts +1 -0
- package/dist/src/cli/commands/mcp.js +51 -0
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/computer/broker.d.ts +0 -1
- package/dist/src/computer/broker.js +4 -6
- package/dist/src/computer/evaluation-harness.d.ts +45 -0
- package/dist/src/computer/evaluation-harness.js +108 -0
- package/dist/src/computer/model-adapter.d.ts +37 -2
- package/dist/src/computer/model-adapter.js +333 -42
- package/dist/src/computer/model-policy.d.ts +4 -1
- package/dist/src/computer/model-policy.js +11 -3
- package/dist/src/computer/release-gate.d.ts +22 -0
- package/dist/src/computer/release-gate.js +19 -0
- package/dist/src/computer/runtime.js +14 -10
- package/dist/src/computer/task-state.d.ts +1 -0
- package/dist/src/computer/task-state.js +1 -0
- package/dist/src/config/models-json.d.ts +14 -8
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.js +3 -9
- package/dist/src/connectors/composio-sessions.d.ts +4 -2
- package/dist/src/connectors/composio-sessions.js +10 -9
- package/dist/src/connectors/composio.js +10 -8
- package/dist/src/discussions/action-tasks.js +2 -1
- package/dist/src/discussions/recording.js +1 -1
- package/dist/src/execution-environments/local-worktree-manager.d.ts +1 -0
- package/dist/src/execution-environments/local-worktree-manager.js +13 -2
- package/dist/src/extensions/activation-context.js +3 -3
- package/dist/src/extensions/api.js +1 -1
- package/dist/src/extensions/normalize-manifest.js +6 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/sdk/media.js +1 -1
- package/dist/src/extensions/types/manifest.d.ts +3 -0
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
- package/dist/src/gateway/hono/middleware/scopes.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +5 -2
- package/dist/src/gateway/hono/routes/capability-operations.d.ts +3 -0
- package/dist/src/gateway/hono/routes/capability-operations.js +52 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +16 -0
- package/dist/src/gateway/hono/routes/local-app-capabilities.d.ts +4 -0
- package/dist/src/gateway/hono/routes/local-app-capabilities.js +41 -0
- package/dist/src/gateway/hono/routes/local-apps.js +41 -9
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/notes.js +215 -146
- package/dist/src/gateway/hono/routes/projects.js +217 -374
- package/dist/src/gateway/hono/routes/scenes.js +188 -75
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +60 -16
- package/dist/src/gateway/hono/routes/session-input-handler.js +43 -1
- package/dist/src/gateway/hono/routes/sessions.js +17 -0
- package/dist/src/gateway/hono/routes/status.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +182 -326
- package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +4 -4
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/media-access.js +2 -1
- package/dist/src/gateway/mobile-privacy.js +2 -2
- package/dist/src/gateway/scenes/host.js +14 -3
- package/dist/src/gateway/scenes/mailContext.js +1 -1
- package/dist/src/gateway/scenes/slackThreadSource.d.ts +41 -0
- package/dist/src/gateway/scenes/slackThreadSource.js +168 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +5 -0
- package/dist/src/gateway/service/app-context-access.d.ts +11 -0
- package/dist/src/gateway/service/app-context-access.js +70 -0
- package/dist/src/gateway/service/run-gateway-agent.js +11 -2
- package/dist/src/gateway/service/session-input-coordinator.js +54 -15
- package/dist/src/gateway/service/sessions-api.d.ts +1 -0
- package/dist/src/gateway/service/sessions-api.js +3 -0
- package/dist/src/gateway/service/task-conversation-query-service.d.ts +3 -1
- package/dist/src/gateway/service/task-conversation-query-service.js +32 -3
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +69 -15
- package/dist/src/gateway/session-context-summary.js +2 -1
- package/dist/src/{tasks/task-outbox-dispatcher.d.ts → infra/domain-outbox-dispatcher.d.ts} +2 -2
- package/dist/src/{tasks/task-outbox-dispatcher.js → infra/domain-outbox-dispatcher.js} +10 -9
- package/dist/src/infra/operation-context.d.ts +2 -0
- package/dist/src/infra/operation-context.js +16 -0
- package/dist/src/local-apps/capabilities/contracts.d.ts +2 -0
- package/dist/src/local-apps/capabilities/contracts.js +32 -0
- package/dist/src/local-apps/capabilities/read.d.ts +3 -0
- package/dist/src/local-apps/capabilities/read.js +48 -0
- package/dist/src/local-apps/capabilities/runtime.d.ts +16 -0
- package/dist/src/local-apps/capabilities/runtime.js +66 -0
- package/dist/src/local-apps/capabilities/write.d.ts +3 -0
- package/dist/src/local-apps/capabilities/write.js +35 -0
- package/dist/src/local-apps/release-lock.d.ts +2 -0
- package/dist/src/local-apps/release-lock.js +20 -0
- package/dist/src/local-apps/runtime-entry.d.ts +0 -2
- package/dist/src/local-apps/runtime-entry.js +1 -14
- package/dist/src/local-apps/scaffold.js +4 -1
- package/dist/src/local-apps/service.d.ts +24 -1
- package/dist/src/local-apps/service.js +186 -43
- package/dist/src/local-apps/store.js +0 -2
- package/dist/src/mcp/capability-server.d.ts +4 -0
- package/dist/src/mcp/capability-server.js +96 -0
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/mcp/gateway-http-client.d.ts +7 -0
- package/dist/src/mcp/gateway-http-client.js +27 -5
- package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/notes/capabilities/read.d.ts +3 -0
- package/dist/src/notes/capabilities/read.js +96 -0
- package/dist/src/notes/capabilities/write.d.ts +7 -0
- package/dist/src/notes/capabilities/write.js +152 -0
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.d.ts +12 -4
- package/dist/src/notes/service.js +188 -175
- package/dist/src/notes/store.d.ts +14 -9
- package/dist/src/notes/store.js +81 -21
- package/dist/src/notifications/service.d.ts +1 -0
- package/dist/src/notifications/service.js +5 -0
- package/dist/src/platform/client.d.ts +1 -1
- package/dist/src/platform/contracts.d.ts +1 -1
- package/dist/src/projects/capabilities/read.d.ts +3 -0
- package/dist/src/projects/capabilities/read.js +81 -0
- package/dist/src/projects/capabilities/write.d.ts +9 -0
- package/dist/src/projects/capabilities/write.js +260 -0
- package/dist/src/projects/index.js +2 -2
- package/dist/src/projects/project-change-events.d.ts +2 -0
- package/dist/src/projects/project-change-events.js +18 -0
- package/dist/src/projects/project-service.d.ts +11 -0
- package/dist/src/projects/project-service.js +121 -42
- package/dist/src/projects/project-store.js +12 -2
- package/dist/src/projects/project-workspace-creation.d.ts +3 -0
- package/dist/src/projects/project-workspace-creation.js +45 -0
- package/dist/src/projects/workspace-project.js +6 -0
- package/dist/src/providers/model-catalog-types.d.ts +2 -1
- package/dist/src/providers/model-reference-auditor.js +4 -4
- package/dist/src/providers/model-supplements.js +13 -3
- package/dist/src/providers/presentation.js +3 -3
- package/dist/src/providers/xopc-cloud-model-source.js +4 -2
- package/dist/src/realtime/runtime.js +4 -0
- package/dist/src/scenes/capabilities/read.d.ts +3 -0
- package/dist/src/scenes/capabilities/read.js +187 -0
- package/dist/src/scenes/capabilities/write.d.ts +3 -0
- package/dist/src/scenes/capabilities/write.js +151 -0
- package/dist/src/scenes/contracts.d.ts +2 -105
- package/dist/src/scenes/contracts.js +3 -88
- package/dist/src/scenes/execution.d.ts +1 -1
- package/dist/src/scenes/httpServices.d.ts +2 -0
- package/dist/src/scenes/inbox.d.ts +1 -0
- package/dist/src/scenes/inbox.js +7 -7
- package/dist/src/scenes/preferences.d.ts +3 -24
- package/dist/src/scenes/preferences.js +8 -30
- package/dist/src/scenes/repository.d.ts +1 -0
- package/dist/src/scenes/repository.js +7 -3
- package/dist/src/scenes/resultNotifications.js +2 -2
- package/dist/src/scenes/schedule.d.ts +1 -8
- package/dist/src/scenes/schedule.js +3 -15
- package/dist/src/scenes/service.d.ts +6 -0
- package/dist/src/scenes/service.js +29 -25
- package/dist/src/scenes/taskFollowUp/agentExecutor.d.ts +36 -0
- package/dist/src/scenes/taskFollowUp/agentExecutor.js +149 -0
- package/dist/src/scenes/taskFollowUp/branchInventory.d.ts +38 -0
- package/dist/src/scenes/taskFollowUp/branchInventory.js +70 -0
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +91 -0
- package/dist/src/scenes/taskFollowUp/contracts.js +100 -0
- package/dist/src/scenes/taskFollowUp/resources.d.ts +19 -0
- package/dist/src/scenes/taskFollowUp/resources.js +97 -0
- package/dist/src/scenes/taskFollowUp/service.d.ts +810 -0
- package/dist/src/scenes/taskFollowUp/service.js +710 -0
- package/dist/src/scenes/taskFollowUp/workspaceFingerprint.d.ts +2 -0
- package/dist/src/scenes/taskFollowUp/workspaceFingerprint.js +46 -0
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/scenes/templates.js +1 -1
- package/dist/src/session/session-find.d.ts +17 -0
- package/dist/src/session/session-find.js +56 -0
- package/dist/src/session/store.d.ts +4 -0
- package/dist/src/session/store.js +43 -7
- package/dist/src/share/note-share-revocation.d.ts +3 -0
- package/dist/src/share/note-share-revocation.js +26 -0
- package/dist/src/storage/sqlite/migrations/190_scene_development.sql +37 -0
- package/dist/src/storage/sqlite/migrations/191_scene_task_follow_up.sql +27 -0
- package/dist/src/storage/sqlite/migrations/192_capability_operations.sql +20 -0
- package/dist/src/storage/sqlite/migrations/193_note_file_cleanup.sql +8 -0
- package/dist/src/storage/sqlite/migrations/194_capability_external_outcomes.sql +11 -0
- package/dist/src/storage/sqlite/migrations/195_automation_deleted_revisions.sql +4 -0
- package/dist/src/storage/sqlite/migrations/196_automation_run_requests.sql +23 -0
- package/dist/src/storage/sqlite/migrations/197_note_deletion_cleanup.sql +8 -0
- package/dist/src/storage/sqlite/migrations/198_project_workspace_creation.sql +7 -0
- package/dist/src/storage/sqlite/migrations/199_scene_resource_events.sql +488 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +6 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/transaction.d.ts +5 -0
- package/dist/src/storage/sqlite/transaction.js +34 -3
- package/dist/src/tasks/capabilities/management.d.ts +195 -0
- package/dist/src/tasks/capabilities/management.js +111 -0
- package/dist/src/tasks/capabilities/read.d.ts +2 -0
- package/dist/src/tasks/capabilities/read.js +141 -0
- package/dist/src/tasks/capabilities/relations.d.ts +204 -0
- package/dist/src/tasks/capabilities/relations.js +140 -0
- package/dist/src/tasks/capabilities/runs.d.ts +2 -0
- package/dist/src/tasks/capabilities/runs.js +89 -0
- package/dist/src/tasks/capabilities/write.d.ts +207 -0
- package/dist/src/tasks/capabilities/write.js +107 -0
- package/dist/src/tasks/home-query-service.js +3 -2
- package/dist/src/tasks/index.d.ts +0 -1
- package/dist/src/tasks/index.js +9 -9
- package/dist/src/tasks/project-operating-view-service.js +2 -1
- package/dist/src/tasks/task-application-service.d.ts +1 -0
- package/dist/src/tasks/task-application-service.js +3 -2
- package/dist/src/tasks/task-change-events.js +5 -3
- package/dist/src/tasks/task-context-assembler.js +2 -1
- package/dist/src/tasks/task-deletion-service.js +2 -1
- package/dist/src/tasks/task-dependency-service.js +2 -1
- package/dist/src/tasks/task-handoff-service.js +2 -1
- package/dist/src/tasks/task-read-model-projector.js +2 -1
- package/dist/src/tasks/task-repository.d.ts +12 -7
- package/dist/src/tasks/task-repository.js +175 -154
- package/dist/src/tasks/task-run-coordinator.js +2 -1
- package/dist/src/tasks/task-run-dispatcher.js +2 -1
- package/dist/src/tasks/task-run-repository.d.ts +1 -0
- package/dist/src/tasks/task-run-repository.js +29 -14
- package/dist/src/tasks/task-signal-service.js +2 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/user-context/config.d.ts +13 -0
- package/dist/src/user-context/config.js +2 -0
- package/dist/src/voice/platform-catalog.d.ts +1 -1
- package/dist/src/voice/realtime/runtime.js +3 -3
- package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
- package/dist/src/work-discovery/incremental-repository.js +1 -1
- package/dist/src/work-discovery/index.js +1 -1
- package/dist/src/work-discovery/repository.d.ts +1 -1
- package/dist/src/work-discovery/repository.js +3 -2
- package/dist/src/work-discovery/service.d.ts +4 -0
- package/dist/src/work-discovery/service.js +36 -11
- package/dist/src/workflows/context/workflow-context.js +3 -2
- package/dist/src/workflows/service/workflow-run-service.js +2 -1
- package/package.json +6 -2
- package/skills/THIRD_PARTY_NOTICES.md +2 -2
- package/skills/documents/xlsx/SKILL.md +5 -0
- package/skills/engineering/build-xopc-local-app/SKILL.md +2 -0
- package/skills/tools/find-skills/SKILL.md +3 -0
- package/dist/gateway/static/root/assets/activity-store-DVUTs1fk.js +0 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-K3hTmu9d.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-CU52MfIT.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-ZpA1-6ad.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-IEAxKRME.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-CU4VWsmX.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C9XQk3HL.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-Bqlhjooi.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-BmH17JnO.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-zkx8Q-e6.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-settings-CE4GOlMM.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CdKJqnnw.js +0 -1
- package/dist/gateway/static/root/assets/files-Be5viEFY.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-CGOW0-b4.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-D4um_sV7.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CgXp2zq4.js +0 -1
- package/dist/gateway/static/root/assets/home-page-D6Idk732.js +0 -1
- package/dist/gateway/static/root/assets/index-1wIKA-kM.css +0 -1
- package/dist/gateway/static/root/assets/index-PFQHPGgi.js +0 -79
- package/dist/gateway/static/root/assets/local-app-workbench-page-BmAqTRb4.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-ZjVYXXyM.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-CSTkYVOZ.js +0 -1
- package/dist/gateway/static/root/assets/messages-4BtQKYlM.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DuXCt-MM.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BjOgBVq5.js +0 -8
- package/dist/gateway/static/root/assets/product-delivery-CrAI8ZEa.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-0zi4-i9X.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B18OxmJj.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-z-DxbuaE.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DGsBTbo6.js +0 -5
- package/dist/gateway/static/root/assets/scenes-page-Bgba03B_.js +0 -1
- package/dist/gateway/static/root/assets/schemas-BaskVM5g.js +0 -64
- package/dist/gateway/static/root/assets/sessions-page-B1t3bMsm.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CBX0Ezhf.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Bw71C2X3.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BoVDQolc.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DtTptpAt.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-vgkiGo-D.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-CegIlB8d.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CAGafNfP.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CSxHVs1p.js +0 -6
- package/skills/creative/algorithmic-art/SKILL.md +0 -44
- package/skills/creative/algorithmic-art/templates/generator-template.js +0 -27
- package/skills/creative/algorithmic-art/templates/viewer.html +0 -27
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { ProductReadContracts } from "../../../packages/gateway-contract/src/capabilities.js";
|
|
2
|
+
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
4
|
+
import { defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
5
|
+
import { SceneNotFoundError } from "../repository.js";
|
|
6
|
+
//#region src/scenes/capabilities/read.ts
|
|
7
|
+
init_src();
|
|
8
|
+
function registerSceneReadCapabilities(dispatcher, getAccess) {
|
|
9
|
+
const policy = {
|
|
10
|
+
majorVersion: 1,
|
|
11
|
+
effect: "read",
|
|
12
|
+
surfaces: ["http", "agent"],
|
|
13
|
+
scopes: ["gateway.admin"]
|
|
14
|
+
};
|
|
15
|
+
const read = async (context, fn) => {
|
|
16
|
+
const access = getAccess(context);
|
|
17
|
+
if (!access) throw new CapabilityError("UNAVAILABLE", "Scene service is unavailable");
|
|
18
|
+
try {
|
|
19
|
+
return await fn(access);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
if (error instanceof SceneNotFoundError) throw new CapabilityError("NOT_FOUND", "Scene not found");
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
dispatcher.register(defineReadCapability({
|
|
26
|
+
...policy,
|
|
27
|
+
id: "xopc.scenes.mail_accounts",
|
|
28
|
+
description: "List eligible scene mail accounts under current account policy.",
|
|
29
|
+
...ProductReadContracts["xopc.scenes.mail_accounts"],
|
|
30
|
+
execute: (_input, context) => read(context, ({ services, principal }) => ({ accounts: services.mailDiscovery?.listAccounts(principal) ?? [] }))
|
|
31
|
+
}));
|
|
32
|
+
dispatcher.register(defineReadCapability({
|
|
33
|
+
...policy,
|
|
34
|
+
id: "xopc.scenes.mail_sources",
|
|
35
|
+
description: "List cached eligible mail source metadata without fetching message bodies.",
|
|
36
|
+
...ProductReadContracts["xopc.scenes.mail_sources"],
|
|
37
|
+
execute: ({ limit, afterId }, context) => read(context, ({ services, principal }) => {
|
|
38
|
+
const sources = services.mail.listSources(principal, limit, afterId);
|
|
39
|
+
return {
|
|
40
|
+
sources,
|
|
41
|
+
nextCursor: sources.length === limit ? sources.at(-1).id : null
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
}));
|
|
45
|
+
dispatcher.register(defineReadCapability({
|
|
46
|
+
...policy,
|
|
47
|
+
id: "xopc.scenes.results",
|
|
48
|
+
description: "List visible scene outcomes scoped to the trusted owner and workspace.",
|
|
49
|
+
...ProductReadContracts["xopc.scenes.results"],
|
|
50
|
+
execute: ({ limit, afterId, activationId }, context) => read(context, ({ services, principal }) => {
|
|
51
|
+
const outcomes = services.repository.listInbox(principal, limit, afterId, activationId ?? null);
|
|
52
|
+
return ProductReadContracts["xopc.scenes.results"].output.parse({
|
|
53
|
+
outcomes,
|
|
54
|
+
nextCursor: outcomes.length === limit ? outcomes.at(-1).id : null
|
|
55
|
+
});
|
|
56
|
+
})
|
|
57
|
+
}));
|
|
58
|
+
dispatcher.register(defineReadCapability({
|
|
59
|
+
...policy,
|
|
60
|
+
id: "xopc.scenes.get_presentation",
|
|
61
|
+
description: "Read one visible scene presentation.",
|
|
62
|
+
...ProductReadContracts["xopc.scenes.get_presentation"],
|
|
63
|
+
execute: ({ id }, context) => read(context, ({ services, principal }) => ProductReadContracts["xopc.scenes.get_presentation"].output.parse({ outcome: services.repository.getPresentation(principal, id) }))
|
|
64
|
+
}));
|
|
65
|
+
dispatcher.register(defineReadCapability({
|
|
66
|
+
...policy,
|
|
67
|
+
id: "xopc.scenes.get_feedback",
|
|
68
|
+
description: "Read feedback for an authorized scene presentation.",
|
|
69
|
+
...ProductReadContracts["xopc.scenes.get_feedback"],
|
|
70
|
+
execute: ({ id }, context) => read(context, ({ services, principal }) => ProductReadContracts["xopc.scenes.get_feedback"].output.parse({ feedback: services.inbox.getFeedback(principal, id) }))
|
|
71
|
+
}));
|
|
72
|
+
dispatcher.register(defineReadCapability({
|
|
73
|
+
...policy,
|
|
74
|
+
id: "xopc.scenes.digest_results",
|
|
75
|
+
description: "Read a page of authorized digest outcomes.",
|
|
76
|
+
...ProductReadContracts["xopc.scenes.digest_results"],
|
|
77
|
+
execute: ({ id, limit, afterId }, context) => read(context, ({ services, principal }) => ProductReadContracts["xopc.scenes.digest_results"].output.parse(services.repository.listDigestResults(principal, id, limit, afterId)))
|
|
78
|
+
}));
|
|
79
|
+
dispatcher.register(defineReadCapability({
|
|
80
|
+
...policy,
|
|
81
|
+
id: "xopc.scenes.metrics",
|
|
82
|
+
description: "Read owner-scoped scene usefulness metrics in an explicit time window.",
|
|
83
|
+
...ProductReadContracts["xopc.scenes.metrics"],
|
|
84
|
+
execute: ({ days }, context) => read(context, ({ services, principal }) => services.metrics.forUser(principal, days))
|
|
85
|
+
}));
|
|
86
|
+
dispatcher.register(defineReadCapability({
|
|
87
|
+
...policy,
|
|
88
|
+
id: "xopc.scenes.diagnostics",
|
|
89
|
+
description: "Read bounded scene queue and execution diagnostics.",
|
|
90
|
+
...ProductReadContracts["xopc.scenes.diagnostics"],
|
|
91
|
+
execute: (_input, context) => read(context, ({ services, principal }) => ProductReadContracts["xopc.scenes.diagnostics"].output.parse(services.metrics.diagnostics(principal)))
|
|
92
|
+
}));
|
|
93
|
+
dispatcher.register(defineReadCapability({
|
|
94
|
+
...policy,
|
|
95
|
+
id: "xopc.scenes.get_preferences",
|
|
96
|
+
description: "Read owner-scoped scene preferences without changing execution policy.",
|
|
97
|
+
...ProductReadContracts["xopc.scenes.get_preferences"],
|
|
98
|
+
execute: (_input, context) => read(context, ({ services, principal }) => services.preferences.get(principal))
|
|
99
|
+
}));
|
|
100
|
+
dispatcher.register(defineReadCapability({
|
|
101
|
+
...policy,
|
|
102
|
+
id: "xopc.scenes.preflight",
|
|
103
|
+
description: "Check scene setup and requested account/provider permissions without starting execution.",
|
|
104
|
+
...ProductReadContracts["xopc.scenes.preflight"],
|
|
105
|
+
execute: (input, context) => read(context, ({ services, principal }) => services.application.preflight(principal, input))
|
|
106
|
+
}));
|
|
107
|
+
dispatcher.register(defineReadCapability({
|
|
108
|
+
...policy,
|
|
109
|
+
id: "xopc.scenes.templates",
|
|
110
|
+
description: "List installed scene templates.",
|
|
111
|
+
...ProductReadContracts["xopc.scenes.templates"],
|
|
112
|
+
execute: (_input, context) => read(context, ({ services }) => ({ templates: services.repository.listTemplates() }))
|
|
113
|
+
}));
|
|
114
|
+
dispatcher.register(defineReadCapability({
|
|
115
|
+
...policy,
|
|
116
|
+
id: "xopc.scenes.get_template",
|
|
117
|
+
description: "Read an exact installed scene template version.",
|
|
118
|
+
...ProductReadContracts["xopc.scenes.get_template"],
|
|
119
|
+
execute: ({ key, version }, context) => read(context, ({ services }) => ({ template: services.repository.getTemplate(key, version) }))
|
|
120
|
+
}));
|
|
121
|
+
dispatcher.register(defineReadCapability({
|
|
122
|
+
...policy,
|
|
123
|
+
id: "xopc.scenes.list",
|
|
124
|
+
description: "List scenes within the trusted owner and workspace boundary.",
|
|
125
|
+
...ProductReadContracts["xopc.scenes.list"],
|
|
126
|
+
execute: ({ limit, afterId }, context) => read(context, ({ services, principal }) => {
|
|
127
|
+
const activations = services.repository.listActivations(principal, limit, afterId);
|
|
128
|
+
return {
|
|
129
|
+
activations,
|
|
130
|
+
nextCursor: activations.length === limit ? activations.at(-1).id : null
|
|
131
|
+
};
|
|
132
|
+
})
|
|
133
|
+
}));
|
|
134
|
+
dispatcher.register(defineReadCapability({
|
|
135
|
+
...policy,
|
|
136
|
+
id: "xopc.scenes.get",
|
|
137
|
+
description: "Read a scene and its runs and schedules under the same resource authorization.",
|
|
138
|
+
...ProductReadContracts["xopc.scenes.get"],
|
|
139
|
+
execute: ({ id }, context) => read(context, ({ services, principal }) => ProductReadContracts["xopc.scenes.get"].output.parse({
|
|
140
|
+
activation: services.repository.getActivation(principal, id),
|
|
141
|
+
runs: services.repository.listRuns(principal, id),
|
|
142
|
+
schedules: services.repository.listSchedules(principal, id)
|
|
143
|
+
}))
|
|
144
|
+
}));
|
|
145
|
+
dispatcher.register(defineReadCapability({
|
|
146
|
+
...policy,
|
|
147
|
+
id: "xopc.scenes.read_notes",
|
|
148
|
+
description: "Read scene notes at their stored revision.",
|
|
149
|
+
...ProductReadContracts["xopc.scenes.read_notes"],
|
|
150
|
+
execute: ({ id }, context) => read(context, ({ services, principal }) => ProductReadContracts["xopc.scenes.read_notes"].output.parse({ notes: services.repository.readNotes(principal, id) }))
|
|
151
|
+
}));
|
|
152
|
+
dispatcher.register(defineReadCapability({
|
|
153
|
+
...policy,
|
|
154
|
+
id: "xopc.scenes.list_runs",
|
|
155
|
+
description: "Page through runs belonging to an authorized scene.",
|
|
156
|
+
...ProductReadContracts["xopc.scenes.list_runs"],
|
|
157
|
+
execute: ({ id, limit, afterId }, context) => read(context, ({ services, principal }) => {
|
|
158
|
+
const runs = services.repository.listRuns(principal, id, limit, afterId);
|
|
159
|
+
return ProductReadContracts["xopc.scenes.list_runs"].output.parse({
|
|
160
|
+
runs,
|
|
161
|
+
nextCursor: runs.length === limit ? runs.at(-1).id : null
|
|
162
|
+
});
|
|
163
|
+
})
|
|
164
|
+
}));
|
|
165
|
+
dispatcher.register(defineReadCapability({
|
|
166
|
+
...policy,
|
|
167
|
+
id: "xopc.scenes.list_schedules",
|
|
168
|
+
description: "Read the schedules of an authorized scene.",
|
|
169
|
+
...ProductReadContracts["xopc.scenes.list_schedules"],
|
|
170
|
+
execute: ({ id }, context) => read(context, ({ services, principal }) => ProductReadContracts["xopc.scenes.list_schedules"].output.parse({ schedules: services.repository.listSchedules(principal, id) }))
|
|
171
|
+
}));
|
|
172
|
+
dispatcher.register(defineReadCapability({
|
|
173
|
+
...policy,
|
|
174
|
+
id: "xopc.scenes.list_work_items",
|
|
175
|
+
description: "Page through work items belonging to an authorized scene.",
|
|
176
|
+
...ProductReadContracts["xopc.scenes.list_work_items"],
|
|
177
|
+
execute: ({ id, limit, afterId }, context) => read(context, ({ services, principal }) => {
|
|
178
|
+
const workItems = services.repository.listWorkItems(principal, id, limit, afterId);
|
|
179
|
+
return ProductReadContracts["xopc.scenes.list_work_items"].output.parse({
|
|
180
|
+
workItems,
|
|
181
|
+
nextCursor: workItems.length === limit ? workItems.at(-1).id : null
|
|
182
|
+
});
|
|
183
|
+
})
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { registerSceneReadCapabilities };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type CapabilityContext, type CapabilityDispatcher } from '../../capabilities/runtime/dispatcher.js';
|
|
2
|
+
import type { SceneAccess } from '../httpServices.js';
|
|
3
|
+
export declare function registerSceneWriteCapabilities(dispatcher: CapabilityDispatcher, getAccess: (context: CapabilityContext) => SceneAccess | undefined): void;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
+
import { SceneWriteContracts } from "../../../packages/gateway-contract/src/capabilities.js";
|
|
3
|
+
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
4
|
+
import { CapabilityError } from "../../capabilities/runtime/errors.js";
|
|
5
|
+
import { defineAtomicCapability } from "../../capabilities/runtime/dispatcher.js";
|
|
6
|
+
import { SceneConflictError, SceneInputError, SceneNotFoundError } from "../repository.js";
|
|
7
|
+
import { SceneSetupError } from "../service.js";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
//#region src/scenes/capabilities/write.ts
|
|
10
|
+
init_src();
|
|
11
|
+
init_transaction();
|
|
12
|
+
function registerSceneWriteCapabilities(dispatcher, getAccess) {
|
|
13
|
+
const policy = {
|
|
14
|
+
majorVersion: 1,
|
|
15
|
+
effect: "local-write",
|
|
16
|
+
surfaces: ["http", "agent"],
|
|
17
|
+
scopes: ["gateway.admin"],
|
|
18
|
+
requestScope: (context) => {
|
|
19
|
+
const access = getAccess(context);
|
|
20
|
+
if (!access) throw new CapabilityError("UNAVAILABLE", "Scene service is unavailable");
|
|
21
|
+
return JSON.stringify([access.principal.ownerId, access.principal.workspaceId]);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const write = (context, fn) => {
|
|
25
|
+
const access = getAccess(context);
|
|
26
|
+
if (!access) throw new CapabilityError("UNAVAILABLE", "Scene service is unavailable");
|
|
27
|
+
if (access.services.application.database !== getSqliteDatabase()) throw new CapabilityError("UNAVAILABLE", "Scene writes require the operation database");
|
|
28
|
+
try {
|
|
29
|
+
return fn(access);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (error instanceof SceneNotFoundError) throw new CapabilityError("NOT_FOUND", "Scene not found");
|
|
32
|
+
if (error instanceof SceneConflictError) throw new CapabilityError("REVISION_CONFLICT", error.message);
|
|
33
|
+
if (error instanceof SceneInputError || error instanceof z.ZodError) throw new CapabilityError("INVALID_INPUT", error.message);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const prepare = async (context, fn) => {
|
|
38
|
+
const access = getAccess(context);
|
|
39
|
+
if (!access) throw new CapabilityError("UNAVAILABLE", "Scene service is unavailable");
|
|
40
|
+
try {
|
|
41
|
+
await fn(access);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (error instanceof SceneSetupError) {
|
|
44
|
+
const failure = new CapabilityError("INVALID_INPUT", error.message);
|
|
45
|
+
failure.cause = error;
|
|
46
|
+
throw failure;
|
|
47
|
+
}
|
|
48
|
+
if (error instanceof SceneNotFoundError) throw new CapabilityError("NOT_FOUND", "Scene not found");
|
|
49
|
+
if (error instanceof SceneConflictError) throw new CapabilityError("REVISION_CONFLICT", error.message);
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
dispatcher.register(defineAtomicCapability({
|
|
54
|
+
...policy,
|
|
55
|
+
id: "xopc.scenes.start",
|
|
56
|
+
description: "Start a scene after authorization and readiness checks, with an atomic durable receipt.",
|
|
57
|
+
...SceneWriteContracts["xopc.scenes.start"],
|
|
58
|
+
prepare: (input, context) => prepare(context, async ({ services, principal }) => {
|
|
59
|
+
const result = await services.application.preflight(principal, input);
|
|
60
|
+
if (!result.ready) throw new SceneSetupError(result.missing);
|
|
61
|
+
}),
|
|
62
|
+
execute: (input, context) => write(context, ({ services, principal }) => ({ activation: services.application.startAfterPreflight(principal, input, context.idempotencyKey) }))
|
|
63
|
+
}));
|
|
64
|
+
dispatcher.register(defineAtomicCapability({
|
|
65
|
+
...policy,
|
|
66
|
+
id: "xopc.scenes.transition",
|
|
67
|
+
description: "Transition a scene at its exact revision, checking readiness before activation.",
|
|
68
|
+
...SceneWriteContracts["xopc.scenes.transition"],
|
|
69
|
+
prepare: ({ id, ...input }, context) => prepare(context, ({ services, principal }) => services.application.prepareTransition(principal, id, input)),
|
|
70
|
+
execute: ({ id, ...input }, context) => write(context, ({ services, principal }) => ({ activation: services.application.transitionAfterPreflight(principal, id, input) }))
|
|
71
|
+
}));
|
|
72
|
+
dispatcher.register(defineAtomicCapability({
|
|
73
|
+
...policy,
|
|
74
|
+
id: "xopc.scenes.schedule",
|
|
75
|
+
description: "Update a scene schedule at its exact revision.",
|
|
76
|
+
...SceneWriteContracts["xopc.scenes.schedule"],
|
|
77
|
+
execute: ({ id, triggerKey, ...input }, context) => write(context, ({ services, principal }) => ({ revision: services.application.setSchedule(principal, id, triggerKey, input) }))
|
|
78
|
+
}));
|
|
79
|
+
dispatcher.register(defineAtomicCapability({
|
|
80
|
+
...policy,
|
|
81
|
+
id: "xopc.scenes.set_preferences",
|
|
82
|
+
description: "Update owner-scoped scene preferences at their exact revision.",
|
|
83
|
+
...SceneWriteContracts["xopc.scenes.set_preferences"],
|
|
84
|
+
execute: (input, context) => write(context, ({ services, principal }) => {
|
|
85
|
+
if (services.preferences.database !== getSqliteDatabase()) throw new CapabilityError("UNAVAILABLE", "Scene preferences require the operation database");
|
|
86
|
+
return services.preferences.update(principal, input);
|
|
87
|
+
})
|
|
88
|
+
}));
|
|
89
|
+
dispatcher.register(defineAtomicCapability({
|
|
90
|
+
...policy,
|
|
91
|
+
id: "xopc.scenes.feedback",
|
|
92
|
+
description: "Record an explicit user judgment at the exact feedback revision.",
|
|
93
|
+
...SceneWriteContracts["xopc.scenes.feedback"],
|
|
94
|
+
execute: ({ id, ...input }, context) => write(context, ({ services, principal }) => {
|
|
95
|
+
if (services.inbox.database !== getSqliteDatabase()) throw new CapabilityError("UNAVAILABLE", "Scene feedback requires the operation database");
|
|
96
|
+
return { revision: services.inbox.feedback(principal, id, input) };
|
|
97
|
+
})
|
|
98
|
+
}));
|
|
99
|
+
dispatcher.register(defineAtomicCapability({
|
|
100
|
+
...policy,
|
|
101
|
+
id: "xopc.scenes.mark_read",
|
|
102
|
+
description: "Set the read state of an actionable scene presentation once per request.",
|
|
103
|
+
...SceneWriteContracts["xopc.scenes.mark_read"],
|
|
104
|
+
execute: ({ id, read }, context) => write(context, ({ services, principal }) => {
|
|
105
|
+
if (services.inbox.database !== getSqliteDatabase()) throw new CapabilityError("UNAVAILABLE", "Scene presentation requires the operation database");
|
|
106
|
+
services.inbox.setRead(principal, id, read);
|
|
107
|
+
return {
|
|
108
|
+
ok: true,
|
|
109
|
+
presentationId: id,
|
|
110
|
+
read
|
|
111
|
+
};
|
|
112
|
+
})
|
|
113
|
+
}));
|
|
114
|
+
dispatcher.register(defineAtomicCapability({
|
|
115
|
+
...policy,
|
|
116
|
+
id: "xopc.scenes.configure",
|
|
117
|
+
description: "Configure a scene at an exact revision and invalidate prior pending work atomically.",
|
|
118
|
+
...SceneWriteContracts["xopc.scenes.configure"],
|
|
119
|
+
execute: ({ id, ...input }, context) => write(context, ({ services, principal }) => ({ activation: services.application.configure(principal, id, input) }))
|
|
120
|
+
}));
|
|
121
|
+
dispatcher.register(defineAtomicCapability({
|
|
122
|
+
...policy,
|
|
123
|
+
id: "xopc.scenes.check",
|
|
124
|
+
description: "Queue a scene check exactly once per request; this does not imply model execution completed.",
|
|
125
|
+
...SceneWriteContracts["xopc.scenes.check"],
|
|
126
|
+
execute: ({ id }, context) => write(context, ({ services, principal }) => ({ intentId: services.application.check(principal, id, context.idempotencyKey) }))
|
|
127
|
+
}));
|
|
128
|
+
dispatcher.register(defineAtomicCapability({
|
|
129
|
+
...policy,
|
|
130
|
+
id: "xopc.scenes.notes",
|
|
131
|
+
description: "Replace scene notes at an exact notes revision, canceling stale work in the same transaction.",
|
|
132
|
+
...SceneWriteContracts["xopc.scenes.notes"],
|
|
133
|
+
execute: ({ id, ...input }, context) => write(context, ({ services, principal }) => ({ revision: services.application.writeNotes(principal, id, input) }))
|
|
134
|
+
}));
|
|
135
|
+
dispatcher.register(defineAtomicCapability({
|
|
136
|
+
...policy,
|
|
137
|
+
id: "xopc.scenes.work_item",
|
|
138
|
+
description: "Create an authorized scene work item with a durable request receipt.",
|
|
139
|
+
...SceneWriteContracts["xopc.scenes.work_item"],
|
|
140
|
+
execute: ({ id, ...input }, context) => write(context, ({ services, principal }) => ({ workItem: services.application.createWorkItem(principal, id, input) }))
|
|
141
|
+
}));
|
|
142
|
+
dispatcher.register(defineAtomicCapability({
|
|
143
|
+
...policy,
|
|
144
|
+
id: "xopc.scenes.update_work_item",
|
|
145
|
+
description: "Edit an authorized scene work item at its exact revision.",
|
|
146
|
+
...SceneWriteContracts["xopc.scenes.update_work_item"],
|
|
147
|
+
execute: ({ id, ...input }, context) => write(context, ({ services, principal }) => ({ workItem: services.application.updateWorkItem(principal, id, input) }))
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
export { registerSceneWriteCapabilities };
|
|
@@ -1,108 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const activationStatuses: readonly ["needs_setup", "active", "paused", "completed", "archived"];
|
|
4
|
-
export type ActivationStatus = typeof activationStatuses[number];
|
|
5
|
-
export declare const sceneScopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
|
-
kind: z.ZodLiteral<"personal">;
|
|
7
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
8
|
-
kind: z.ZodLiteral<"project">;
|
|
9
|
-
id: z.ZodString;
|
|
10
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
11
|
-
kind: z.ZodLiteral<"conversation">;
|
|
12
|
-
id: z.ZodString;
|
|
13
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
14
|
-
kind: z.ZodLiteral<"objects">;
|
|
15
|
-
ids: z.ZodArray<z.ZodString>;
|
|
16
|
-
}, z.core.$strict>], "kind">;
|
|
17
|
-
export type SceneScope = z.infer<typeof sceneScopeSchema>;
|
|
18
|
-
export declare const sceneTemplateSchema: z.ZodObject<{
|
|
19
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
20
|
-
key: z.ZodString;
|
|
21
|
-
version: z.ZodString;
|
|
22
|
-
title: z.ZodString;
|
|
23
|
-
description: z.ZodString;
|
|
24
|
-
goalMode: z.ZodEnum<{
|
|
25
|
-
finite: "finite";
|
|
26
|
-
ongoing: "ongoing";
|
|
27
|
-
}>;
|
|
28
|
-
contextProviders: z.ZodArray<z.ZodString>;
|
|
29
|
-
triggers: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
30
|
-
id: z.ZodString;
|
|
31
|
-
type: z.ZodLiteral<"manual">;
|
|
32
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
-
id: z.ZodString;
|
|
34
|
-
type: z.ZodLiteral<"event">;
|
|
35
|
-
eventType: z.ZodString;
|
|
36
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
37
|
-
id: z.ZodString;
|
|
38
|
-
type: z.ZodLiteral<"schedule">;
|
|
39
|
-
}, z.core.$strict>], "type">>;
|
|
40
|
-
execution: z.ZodObject<{
|
|
41
|
-
kind: z.ZodLiteral<"agent">;
|
|
42
|
-
instruction: z.ZodString;
|
|
43
|
-
limits: z.ZodObject<{
|
|
44
|
-
timeoutSeconds: z.ZodNumber;
|
|
45
|
-
maxIterations: z.ZodNumber;
|
|
46
|
-
maxToolCalls: z.ZodNumber;
|
|
47
|
-
maxOutputTokens: z.ZodNumber;
|
|
48
|
-
}, z.core.$strict>;
|
|
49
|
-
}, z.core.$strict>;
|
|
50
|
-
allowedOutcomeKinds: z.ZodArray<z.ZodEnum<{
|
|
51
|
-
artifact: "artifact";
|
|
52
|
-
receipt: "receipt";
|
|
53
|
-
decision: "decision";
|
|
54
|
-
observation: "observation";
|
|
55
|
-
no_change: "no_change";
|
|
56
|
-
state_change: "state_change";
|
|
57
|
-
effect_proposal: "effect_proposal";
|
|
58
|
-
}>>;
|
|
59
|
-
allowedEffectHandlers: z.ZodArray<z.ZodString>;
|
|
60
|
-
}, z.core.$strict>;
|
|
61
|
-
export type SceneTemplate = z.infer<typeof sceneTemplateSchema>;
|
|
62
|
-
export interface ScenePrincipal {
|
|
63
|
-
ownerId: string;
|
|
64
|
-
workspaceId: string;
|
|
65
|
-
}
|
|
66
|
-
export declare const scenePermissionSchema: z.ZodObject<{
|
|
67
|
-
accountIds: z.ZodArray<z.ZodString>;
|
|
68
|
-
contextProviders: z.ZodArray<z.ZodString>;
|
|
69
|
-
effectHandlers: z.ZodArray<z.ZodString>;
|
|
70
|
-
}, z.core.$strict>;
|
|
71
|
-
export type ScenePermission = z.infer<typeof scenePermissionSchema>;
|
|
72
|
-
export declare const sceneNotesSchema: z.ZodObject<{
|
|
73
|
-
expectedRevision: z.ZodNumber;
|
|
74
|
-
content: z.ZodString;
|
|
75
|
-
validUntil: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
76
|
-
}, z.core.$strict>;
|
|
77
|
-
export declare const activationInputSchema: z.ZodObject<{
|
|
78
|
-
templateKey: z.ZodString;
|
|
79
|
-
templateVersion: z.ZodString;
|
|
80
|
-
goal: z.ZodString;
|
|
81
|
-
scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
82
|
-
kind: z.ZodLiteral<"personal">;
|
|
83
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
-
kind: z.ZodLiteral<"project">;
|
|
85
|
-
id: z.ZodString;
|
|
86
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
87
|
-
kind: z.ZodLiteral<"conversation">;
|
|
88
|
-
id: z.ZodString;
|
|
89
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
-
kind: z.ZodLiteral<"objects">;
|
|
91
|
-
ids: z.ZodArray<z.ZodString>;
|
|
92
|
-
}, z.core.$strict>], "kind">;
|
|
93
|
-
permissions: z.ZodObject<{
|
|
94
|
-
accountIds: z.ZodArray<z.ZodString>;
|
|
95
|
-
contextProviders: z.ZodArray<z.ZodString>;
|
|
96
|
-
effectHandlers: z.ZodArray<z.ZodString>;
|
|
97
|
-
}, z.core.$strict>;
|
|
98
|
-
}, z.core.$strict>;
|
|
99
|
-
export type ActivationInput = z.infer<typeof activationInputSchema>;
|
|
100
|
-
export interface SceneActivation extends ActivationInput, ScenePrincipal {
|
|
101
|
-
id: string;
|
|
102
|
-
status: ActivationStatus;
|
|
103
|
-
setupMissing?: string[];
|
|
104
|
-
revision: number;
|
|
105
|
-
}
|
|
1
|
+
export { sceneOutcomeKinds, activationStatuses, sceneScopeSchema, sceneTemplateSchema, scenePermissionSchema, sceneNotesSchema, activationInputSchema, type ActivationStatus, type SceneScope, type SceneTemplate, type ScenePrincipal, type ScenePermission, type ActivationInput, type SceneActivation, } from '@xopcai/gateway-contract';
|
|
2
|
+
import { type SceneTemplate, type ScenePermission, type ActivationStatus } from '@xopcai/gateway-contract';
|
|
106
3
|
/** Stable JSON hashing binds approvals and immutable versions to exact content. */
|
|
107
4
|
export declare function sceneContentHash(value: unknown): string;
|
|
108
5
|
export declare function validateTemplate(value: unknown, registered: Pick<ScenePermission, 'contextProviders' | 'effectHandlers'>): SceneTemplate;
|
|
@@ -1,93 +1,8 @@
|
|
|
1
|
+
import { activationInputSchema, activationStatuses, sceneNotesSchema, sceneOutcomeKinds, scenePermissionSchema, sceneScopeSchema, sceneTemplateSchema } from "../../packages/gateway-contract/src/scenes.js";
|
|
2
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
1
3
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { z } from "zod";
|
|
3
4
|
//#region src/scenes/contracts.ts
|
|
4
|
-
|
|
5
|
-
const uniqueIds = z.array(identifier).max(100).refine((items) => new Set(items).size === items.length, "Duplicate identifiers");
|
|
6
|
-
const sceneOutcomeKinds = [
|
|
7
|
-
"no_change",
|
|
8
|
-
"observation",
|
|
9
|
-
"artifact",
|
|
10
|
-
"decision",
|
|
11
|
-
"state_change",
|
|
12
|
-
"effect_proposal",
|
|
13
|
-
"receipt"
|
|
14
|
-
];
|
|
15
|
-
const activationStatuses = [
|
|
16
|
-
"needs_setup",
|
|
17
|
-
"active",
|
|
18
|
-
"paused",
|
|
19
|
-
"completed",
|
|
20
|
-
"archived"
|
|
21
|
-
];
|
|
22
|
-
const sceneScopeSchema = z.discriminatedUnion("kind", [
|
|
23
|
-
z.strictObject({ kind: z.literal("personal") }),
|
|
24
|
-
z.strictObject({
|
|
25
|
-
kind: z.literal("project"),
|
|
26
|
-
id: identifier
|
|
27
|
-
}),
|
|
28
|
-
z.strictObject({
|
|
29
|
-
kind: z.literal("conversation"),
|
|
30
|
-
id: identifier
|
|
31
|
-
}),
|
|
32
|
-
z.strictObject({
|
|
33
|
-
kind: z.literal("objects"),
|
|
34
|
-
ids: uniqueIds.refine((ids) => ids.length > 0)
|
|
35
|
-
})
|
|
36
|
-
]);
|
|
37
|
-
const limitsSchema = z.strictObject({
|
|
38
|
-
timeoutSeconds: z.number().int().min(1).max(600),
|
|
39
|
-
maxIterations: z.number().int().min(1).max(30),
|
|
40
|
-
maxToolCalls: z.number().int().min(0).max(100),
|
|
41
|
-
maxOutputTokens: z.number().int().min(1).max(32768)
|
|
42
|
-
});
|
|
43
|
-
const sceneTemplateSchema = z.strictObject({
|
|
44
|
-
schemaVersion: z.literal(1),
|
|
45
|
-
key: z.string().regex(/^[a-z][a-z0-9-]{0,79}$/),
|
|
46
|
-
version: z.string().regex(/^\d+\.\d+\.\d+$/),
|
|
47
|
-
title: z.string().trim().min(1).max(120),
|
|
48
|
-
description: z.string().trim().min(1).max(2e3),
|
|
49
|
-
goalMode: z.enum(["finite", "ongoing"]),
|
|
50
|
-
contextProviders: uniqueIds,
|
|
51
|
-
triggers: z.array(z.discriminatedUnion("type", [
|
|
52
|
-
z.strictObject({
|
|
53
|
-
id: identifier,
|
|
54
|
-
type: z.literal("manual")
|
|
55
|
-
}),
|
|
56
|
-
z.strictObject({
|
|
57
|
-
id: identifier,
|
|
58
|
-
type: z.literal("event"),
|
|
59
|
-
eventType: identifier
|
|
60
|
-
}),
|
|
61
|
-
z.strictObject({
|
|
62
|
-
id: identifier,
|
|
63
|
-
type: z.literal("schedule")
|
|
64
|
-
})
|
|
65
|
-
])).min(1).max(20).refine((items) => new Set(items.map((item) => item.id)).size === items.length, "Duplicate trigger IDs"),
|
|
66
|
-
execution: z.strictObject({
|
|
67
|
-
kind: z.literal("agent"),
|
|
68
|
-
instruction: z.string().trim().min(1).max(32e3),
|
|
69
|
-
limits: limitsSchema
|
|
70
|
-
}),
|
|
71
|
-
allowedOutcomeKinds: z.array(z.enum(sceneOutcomeKinds)).min(1),
|
|
72
|
-
allowedEffectHandlers: uniqueIds
|
|
73
|
-
});
|
|
74
|
-
const scenePermissionSchema = z.strictObject({
|
|
75
|
-
accountIds: uniqueIds,
|
|
76
|
-
contextProviders: uniqueIds,
|
|
77
|
-
effectHandlers: uniqueIds
|
|
78
|
-
});
|
|
79
|
-
const sceneNotesSchema = z.strictObject({
|
|
80
|
-
expectedRevision: z.number().int().nonnegative(),
|
|
81
|
-
content: z.string().trim().max(32e3),
|
|
82
|
-
validUntil: z.number().int().nonnegative().nullable().default(null)
|
|
83
|
-
});
|
|
84
|
-
const activationInputSchema = z.strictObject({
|
|
85
|
-
templateKey: identifier,
|
|
86
|
-
templateVersion: identifier,
|
|
87
|
-
goal: z.string().trim().min(1).max(12e3),
|
|
88
|
-
scope: sceneScopeSchema,
|
|
89
|
-
permissions: scenePermissionSchema
|
|
90
|
-
});
|
|
5
|
+
init_src();
|
|
91
6
|
/** Stable JSON hashing binds approvals and immutable versions to exact content. */
|
|
92
7
|
function sceneContentHash(value) {
|
|
93
8
|
const canonical = (item) => {
|
|
@@ -5,8 +5,8 @@ export declare const readOnlyResultSchema: z.ZodObject<{
|
|
|
5
5
|
kind: z.ZodEnum<{
|
|
6
6
|
artifact: "artifact";
|
|
7
7
|
decision: "decision";
|
|
8
|
-
observation: "observation";
|
|
9
8
|
no_change: "no_change";
|
|
9
|
+
observation: "observation";
|
|
10
10
|
}>;
|
|
11
11
|
summary: z.ZodString;
|
|
12
12
|
evidenceIds: z.ZodArray<z.ZodString>;
|
|
@@ -6,8 +6,10 @@ import type { SceneApplicationService } from './service.js';
|
|
|
6
6
|
import type { SceneMailContextProvider } from './mailContext.js';
|
|
7
7
|
import type { ScenePreferenceService } from './preferences.js';
|
|
8
8
|
import type { SceneMetrics } from './metrics.js';
|
|
9
|
+
import type { TaskFollowUpService } from './taskFollowUp/service.js';
|
|
9
10
|
/** An explicitly installed scene domain; never resolves to the old runtime. */
|
|
10
11
|
export interface SceneHttpServices {
|
|
12
|
+
followUps?: TaskFollowUpService;
|
|
11
13
|
repository: SceneRepository;
|
|
12
14
|
application: SceneApplicationService;
|
|
13
15
|
inbox: SceneInboxService;
|
|
@@ -5,6 +5,7 @@ export declare class SceneInboxService {
|
|
|
5
5
|
private readonly db;
|
|
6
6
|
private readonly clock;
|
|
7
7
|
constructor(db: DatabaseSync, clock?: () => number);
|
|
8
|
+
get database(): DatabaseSync;
|
|
8
9
|
setRead(principal: ScenePrincipal, id: string, read: boolean): void;
|
|
9
10
|
feedback(principal: ScenePrincipal, id: string, value: unknown): number;
|
|
10
11
|
getFeedback(principal: ScenePrincipal, id: string): {
|
package/dist/src/scenes/inbox.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import { SceneFeedbackSchema } from "../../packages/gateway-contract/src/scenes.js";
|
|
2
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
1
3
|
import { SceneConflictError, SceneNotFoundError } from "./repository.js";
|
|
2
4
|
import { randomUUID } from "node:crypto";
|
|
3
|
-
import { z } from "zod";
|
|
4
5
|
//#region src/scenes/inbox.ts
|
|
5
|
-
|
|
6
|
-
expectedRevision: z.number().int().nonnegative(),
|
|
7
|
-
rating: z.enum(["useful", "not_useful"]),
|
|
8
|
-
note: z.string().trim().max(2e3).optional()
|
|
9
|
-
});
|
|
6
|
+
init_src();
|
|
10
7
|
const actionable = `withdrawn_at IS NULL AND (expires_at IS NULL OR expires_at > ?)
|
|
11
8
|
AND (status IN ('unread', 'read') OR (status = 'snoozed' AND snoozed_until <= ?))`;
|
|
12
9
|
/** Feedback records a user's judgment, never an inferred successful action. */
|
|
@@ -15,6 +12,9 @@ var SceneInboxService = class {
|
|
|
15
12
|
this.db = db;
|
|
16
13
|
this.clock = clock;
|
|
17
14
|
}
|
|
15
|
+
get database() {
|
|
16
|
+
return this.db;
|
|
17
|
+
}
|
|
18
18
|
setRead(principal, id, read) {
|
|
19
19
|
if (typeof read !== "boolean") throw new Error("Read state must be a boolean");
|
|
20
20
|
this.assertVisible(principal, id);
|
|
@@ -22,7 +22,7 @@ var SceneInboxService = class {
|
|
|
22
22
|
if (this.db.prepare(`UPDATE scene_presentations SET status = ?, revision = revision + 1, updated_at = ? WHERE id = ? AND ${actionable}`).run(read ? "read" : "unread", now, id, now, now).changes !== 1) throw new SceneConflictError("Scene presentation was withdrawn");
|
|
23
23
|
}
|
|
24
24
|
feedback(principal, id, value) {
|
|
25
|
-
const input =
|
|
25
|
+
const input = SceneFeedbackSchema.parse(value);
|
|
26
26
|
this.assertVisible(principal, id);
|
|
27
27
|
this.db.exec("SAVEPOINT scene_feedback_write");
|
|
28
28
|
try {
|
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
-
import { z } from 'zod';
|
|
3
2
|
import type { ScenePrincipal } from './contracts.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
active: "active";
|
|
7
|
-
quiet: "quiet";
|
|
8
|
-
balanced: "balanced";
|
|
9
|
-
}>>;
|
|
10
|
-
timezone: z.ZodDefault<z.ZodString>;
|
|
11
|
-
quietStartHour: z.ZodDefault<z.ZodNumber>;
|
|
12
|
-
quietEndHour: z.ZodDefault<z.ZodNumber>;
|
|
13
|
-
dailyNotificationLimit: z.ZodDefault<z.ZodNumber>;
|
|
14
|
-
digestEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
-
digestHour: z.ZodDefault<z.ZodNumber>;
|
|
16
|
-
digestMinute: z.ZodDefault<z.ZodNumber>;
|
|
17
|
-
preferredChannel: z.ZodDefault<z.ZodEnum<{
|
|
18
|
-
browser: "browser";
|
|
19
|
-
in_app: "in_app";
|
|
20
|
-
}>>;
|
|
21
|
-
suppressWhileViewing: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
-
checksPaused: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
-
checksPausedUntil: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
24
|
-
notificationsMuted: z.ZodDefault<z.ZodBoolean>;
|
|
25
|
-
}, z.core.$strict>;
|
|
26
|
-
export type ScenePreferences = z.infer<typeof scenePreferencesSchema>;
|
|
3
|
+
import { type ScenePreferences } from '@xopcai/gateway-contract';
|
|
4
|
+
export { scenePreferencesSchema, type ScenePreferences } from '@xopcai/gateway-contract';
|
|
27
5
|
/** Owner-scoped choices. Muting presentation never changes check permissions or deletes work. */
|
|
28
6
|
export declare class ScenePreferenceService {
|
|
29
7
|
private readonly db;
|
|
30
8
|
constructor(db: DatabaseSync);
|
|
9
|
+
get database(): DatabaseSync;
|
|
31
10
|
get(principal: ScenePrincipal): ScenePreferences & {
|
|
32
11
|
revision: number;
|
|
33
12
|
};
|