@xopcai/xopc 0.0.142 → 0.0.144
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/README.md +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/workflow-progress.js +1 -1
- package/dist/gateway/static/root/assets/activity-center-store-jITiX2vJ.js +1 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BawPxiu5.js → agent-avatar-dicebear-EAVnrCAs.js} +1 -1
- package/dist/gateway/static/root/assets/agents-5rTuJOtT.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-81xd1p9R.js → app-management-settings-panel-Bu568NpC.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DYeQsYU8.js → appearance-settings-DSkm9bp_.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DWetalKp.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-D_oa7oti.js → archive-plugin-C99N0vV6.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Cd-bwI2N.js → attachment-load-CHTDqME5.js} +1 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-CBt6U3-S.js +1 -0
- package/dist/gateway/static/root/assets/automations-page-ICUfxeOz.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-O8svLKWw.js → binary-plugins-BRtxOLlM.js} +1 -1
- package/dist/gateway/static/root/assets/block-editor-CUlXfgXd.js +184 -0
- package/dist/gateway/static/root/assets/browser-settings-page-D7Bj4MKi.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-dJy1Eqgx.js → capability-presets-api-Bg1ntFSD.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-C-8I-Ktn.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-Bfuhp2ty.js → channel-recipient-api-DuulnhIj.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Dm5EqQyK.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-B5lVrUsN.js +1 -0
- package/dist/gateway/static/root/assets/check-BODqo66o.js +1 -0
- package/dist/gateway/static/root/assets/chunk-QUQL4437-DXsxWP7r.js +4 -0
- package/dist/gateway/static/root/assets/circle-alert-RzVebuX2.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BOzjh-OK.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DFMfIb5F.js → desktop-pet-C-Drhqyk.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CRGiolqF.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BrYt1gAr.js → directory-picker-path-field-Dw1L3M84.js} +1 -1
- package/dist/gateway/static/root/assets/dist-SwiI0Xu3.js +1 -0
- package/dist/gateway/static/root/assets/dreaming-settings-CF21cbjo.js +3 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Bh630pLD.js → extension-debug-page-Dcl8LJG_.js} +1 -1
- package/dist/gateway/static/root/assets/extension-page-i_BXmO_x.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-CWIi7xsn.js +1 -0
- package/dist/gateway/static/root/assets/{fetch-B1WtuprY.js → fetch-8QNN25Sh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-De2N821l.js → gateway-config-api-2sLP2kkA.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-DMHiZc-2.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-nEujFSDj.js → gateway-startup-retry-5YBnS9Fj.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-CAODVDiA.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-_d4DjmeX.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-DUy3eEse.js → goals-config-api-B4qeLKQS.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-lgsop664.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-Dx_1ZNgb.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-DeTseEk_.js +1 -0
- package/dist/gateway/static/root/assets/index-CphxClbs.css +1 -0
- package/dist/gateway/static/root/assets/index-VWvztcst.js +257 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CVIwwM15.js → keyboard-shortcuts-settings-BpwpMmlk.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-9_hbTg3j.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-B_6us9j7.js → markdown-split-BTRFTK0w.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D_fryIyj.js → media-plugins-BABfIZPU.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CzKxM6I4.js +5 -0
- package/dist/gateway/static/root/assets/models-hub-panel-B1CUvZxh.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-88QBHW9a.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-CerZOeLW.js +2 -0
- package/dist/gateway/static/root/assets/{page-tabs-D_8jGlqx.js → page-tabs-je95DZOf.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BBLMK8Mp.js → preview-open-alternatives-BJbwi7Rc.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BmrApldl.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-tTn-k76N.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DeA2-pOi.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-DVS3FR5r.js → save-bar-controls-qWMQ9mod.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-D6vKd6-T.js → schedule-field-kxd270Gs.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BPy4lbIh.js → schema-form-DLnD-MuD.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-D4kvvcL1.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CI1OG4gq.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-WzdikxPt.js → settings-collapsible-section-DQprvu5J.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CvfzhBV-.js → settings-form-section-Cqq7Y98y.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BxR-Ulhi.js → settings-loading-skeleton-b6rXULL5.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-BtBVz3cX.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-CKefvbYi.js → settings-page-layout-BNJbtklV.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-cmclUJzS.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page--zO-A1W1.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-DNJvqA67.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DWr_0Xgn.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DEGsTbJx.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BokgAgf7.js → system-settings-panel-Cq9J7i7v.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BwHlNL3L.js → typed-models-lib-CdSwi1gT.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-DR11ap3A.js → use-channel-catalog-COXIfXcl.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-C-V73ZaJ.js +1 -0
- package/dist/gateway/static/root/assets/user-profile-fields-editor-B1cxoGkh.js +1 -0
- package/dist/gateway/static/root/assets/user-profile-settings-panel-B8hlamVB.js +1 -0
- package/dist/gateway/static/root/assets/{utils-BKUWB-TT.js → utils-Dx01V8qF.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DGpIUelZ.js +1 -0
- package/dist/gateway/static/root/assets/with-selector-aYPsXwdl.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-fzWTxF26.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CL_rnAUB.js → workflow-run-setup-panel-Dt_x8LGg.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bg02zEUh.js +11 -0
- package/dist/gateway/static/root/assets/workflows-page-DLioOiRN.css +1 -0
- package/dist/gateway/static/root/connector-icons/README.md +11 -0
- package/dist/gateway/static/root/connector-icons/airtable.svg +13 -0
- package/dist/gateway/static/root/connector-icons/asana.svg +15 -0
- package/dist/gateway/static/root/connector-icons/brave-search.svg +1 -0
- package/dist/gateway/static/root/connector-icons/clickup.svg +19 -0
- package/dist/gateway/static/root/connector-icons/composio.svg +266 -0
- package/dist/gateway/static/root/connector-icons/discord.svg +15 -0
- package/dist/gateway/static/root/connector-icons/dropbox.svg +152 -0
- package/dist/gateway/static/root/connector-icons/excel.svg +56 -0
- package/dist/gateway/static/root/connector-icons/fetch.svg +6 -0
- package/dist/gateway/static/root/connector-icons/figma.svg +178 -0
- package/dist/gateway/static/root/connector-icons/filesystem.svg +6 -0
- package/dist/gateway/static/root/connector-icons/github.svg +10 -0
- package/dist/gateway/static/root/connector-icons/gmail.svg +3 -0
- package/dist/gateway/static/root/connector-icons/google-calendar.svg +3 -0
- package/dist/gateway/static/root/connector-icons/google-docs.svg +25 -0
- package/dist/gateway/static/root/connector-icons/google-drive.svg +25 -0
- package/dist/gateway/static/root/connector-icons/google-sheets.svg +1 -0
- package/dist/gateway/static/root/connector-icons/hubspot.svg +142 -0
- package/dist/gateway/static/root/connector-icons/jira.svg +15 -0
- package/dist/gateway/static/root/connector-icons/linear.svg +5 -0
- package/dist/gateway/static/root/connector-icons/memory.svg +5 -0
- package/dist/gateway/static/root/connector-icons/microsoft-teams.svg +33 -0
- package/dist/gateway/static/root/connector-icons/notion.svg +5 -0
- package/dist/gateway/static/root/connector-icons/one-drive.svg +13 -0
- package/dist/gateway/static/root/connector-icons/outlook.svg +76 -0
- package/dist/gateway/static/root/connector-icons/playwright.svg +9 -0
- package/dist/gateway/static/root/connector-icons/salesforce.svg +17 -0
- package/dist/gateway/static/root/connector-icons/sequential-thinking.svg +8 -0
- package/dist/gateway/static/root/connector-icons/shopify.svg +5 -0
- package/dist/gateway/static/root/connector-icons/slack.svg +9 -0
- package/dist/gateway/static/root/connector-icons/spotify.svg +43 -0
- package/dist/gateway/static/root/connector-icons/stripe.svg +11 -0
- package/dist/gateway/static/root/connector-icons/telegram.svg +130 -0
- package/dist/gateway/static/root/connector-icons/time.svg +6 -0
- package/dist/gateway/static/root/connector-icons/todoist.svg +277 -0
- package/dist/gateway/static/root/connector-icons/trello.svg +19 -0
- package/dist/gateway/static/root/connector-icons/twitter.svg +128 -0
- package/dist/gateway/static/root/connector-icons/whatsapp.svg +61 -0
- package/dist/gateway/static/root/connector-icons/youtube.svg +11 -0
- package/dist/gateway/static/root/index.html +10 -7
- package/dist/package.js +1 -1
- package/dist/src/activity/emitter.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +2 -0
- package/dist/src/agent/agent-manager.js +12 -4
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +3 -2
- package/dist/src/agent/background-review/prompts.js.map +1 -1
- package/dist/src/agent/code-intelligence/binary.js +1 -1
- package/dist/src/agent/context/project-context.js +2 -2
- package/dist/src/agent/context/workspace-seed.js +2 -2
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.js +1 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.d.ts +9 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +71 -3
- package/dist/src/agent/embedded/xopc-tools-bridge.js.map +1 -1
- package/dist/src/agent/goals/post-turn.js +7 -6
- package/dist/src/agent/goals/post-turn.js.map +1 -1
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +5 -2
- package/dist/src/agent/mcp/mcp-transport.js.map +1 -1
- package/dist/src/agent/memory/context/planner.d.ts +1 -0
- package/dist/src/agent/memory/context/planner.js +60 -14
- package/dist/src/agent/memory/context/planner.js.map +1 -1
- package/dist/src/agent/memory/context/types.d.ts +3 -1
- package/dist/src/agent/memory/lifecycle.d.ts +11 -0
- package/dist/src/agent/memory/lifecycle.js +50 -0
- package/dist/src/agent/memory/lifecycle.js.map +1 -0
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/memory/source-origin.d.ts +3 -0
- package/dist/src/agent/memory/source-origin.js +19 -0
- package/dist/src/agent/memory/source-origin.js.map +1 -0
- package/dist/src/agent/memory/understanding/service.js +5 -0
- package/dist/src/agent/memory/understanding/service.js.map +1 -1
- package/dist/src/agent/memory/user-context-coordinator.js +7 -2
- package/dist/src/agent/memory/user-context-coordinator.js.map +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/prompt/sections/behavior.d.ts +2 -0
- package/dist/src/agent/prompt/sections/behavior.js +30 -1
- package/dist/src/agent/prompt/sections/behavior.js.map +1 -1
- package/dist/src/agent/prompt/sections/tooling.js +1 -1
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +8 -1
- package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
- package/dist/src/agent/prompt/system-prompt.d.ts +2 -0
- package/dist/src/agent/prompt/system-prompt.js +6 -3
- package/dist/src/agent/prompt/system-prompt.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +22 -0
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service.d.ts +2 -0
- package/dist/src/agent/service.js +12 -6
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/session-inspector.js +2 -2
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/starter-agents.js +1 -1
- package/dist/src/agent/starter-agents.js.map +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js.map +1 -1
- package/dist/src/agent/tools/composio-tool.d.ts +18 -5
- package/dist/src/agent/tools/composio-tool.js +252 -35
- package/dist/src/agent/tools/composio-tool.js.map +1 -1
- package/dist/src/agent/tools/factory.js +7 -3
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/goal-tool.js +2 -2
- package/dist/src/agent/tools/index.d.ts +1 -1
- package/dist/src/agent/tools/index.js +2 -2
- package/dist/src/agent/tools/workflow-tool.d.ts +0 -1
- package/dist/src/agent/tools/workflow-tool.js +4 -17
- package/dist/src/agent/tools/workflow-tool.js.map +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +1 -1
- package/dist/src/agent/workflow/builtins/index.d.ts +2 -28
- package/dist/src/agent/workflow/builtins/index.js +226 -41
- package/dist/src/agent/workflow/builtins/index.js.map +1 -1
- package/dist/src/agent/workflow/catalog.d.ts +32 -34
- package/dist/src/agent/workflow/catalog.js +158 -154
- package/dist/src/agent/workflow/catalog.js.map +1 -1
- package/dist/src/agent/workflow/index.d.ts +4 -6
- package/dist/src/agent/workflow/index.js +2 -5
- package/dist/src/agent/workflow/snapshot.d.ts +2 -2
- package/dist/src/agent/workflow/snapshot.js +2 -2
- package/dist/src/agent/workflow/snapshot.js.map +1 -1
- package/dist/src/agent/workflow/structured-output-tool.d.ts +2 -2
- package/dist/src/agent/workflow/structured-output-tool.js +2 -2
- package/dist/src/agent/workflow/structured-output-tool.js.map +1 -1
- package/dist/src/agent/workflow/subagent-runner.js +1 -1
- package/dist/src/agent/workflow/types.d.ts +31 -26
- package/dist/src/agent/workspace-runtime/registry.js +2 -2
- package/dist/src/agent-manifest/index.d.ts +1 -0
- package/dist/src/agent-manifest/index.js +3 -1
- package/dist/src/agent-manifest/index.js.map +1 -1
- package/dist/src/agent-manifest/preset-chain.d.ts +10 -0
- package/dist/src/agent-manifest/preset-chain.js +32 -0
- package/dist/src/agent-manifest/preset-chain.js.map +1 -0
- package/dist/src/agent-manifest/resolver.js +3 -10
- package/dist/src/agent-manifest/resolver.js.map +1 -1
- package/dist/src/agent-manifest/schema.d.ts +4 -4
- package/dist/src/automations/api/routes.js +14 -2
- package/dist/src/automations/api/routes.js.map +1 -1
- package/dist/src/automations/domain/validation.d.ts +14 -14
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/browser/cdp-local-launcher.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.d.ts +11 -1
- package/dist/src/browser/providers/browser-ext-install.js +42 -17
- package/dist/src/browser/providers/browser-ext-install.js.map +1 -1
- package/dist/src/browser/providers/cloakbrowser.js +2 -2
- package/dist/src/browser/providers/playwright-doctor.js +1 -1
- package/dist/src/browser/stealth.js +1 -1
- package/dist/src/capabilities/store-connector.d.ts +0 -1
- package/dist/src/capabilities/store-connector.js +4 -6
- package/dist/src/capabilities/store-connector.js.map +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/chat-commands/builtins/goal.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +72 -73
- package/dist/src/chat-commands/builtins/review.js.map +1 -1
- package/dist/src/chat-commands/builtins/workflow.js +9 -54
- package/dist/src/chat-commands/builtins/workflow.js.map +1 -1
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +2 -2
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
- package/dist/src/cli/commands/extension-create.js +2 -2
- package/dist/src/cli/commands/extension-create.js.map +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +43 -37
- package/dist/src/cli/commands/extension-marketplace.js.map +1 -1
- package/dist/src/cli/commands/extension-pack.d.ts +6 -0
- package/dist/src/cli/commands/extension-pack.js +4 -3
- package/dist/src/cli/commands/extension-pack.js.map +1 -1
- package/dist/src/cli/commands/goal.js +2 -2
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/project.js +3 -3
- package/dist/src/commands/agents.config.d.ts +1 -0
- package/dist/src/commands/agents.config.js +1 -0
- package/dist/src/commands/agents.config.js.map +1 -1
- package/dist/src/config/gateway-bind.js +1 -1
- package/dist/src/config/index.js +1 -1
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +6 -6
- package/dist/src/config/schema.js +6 -22
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/config/web-patch.d.ts +1 -1
- package/dist/src/connectors/approval.d.ts +2 -0
- package/dist/src/connectors/approval.js +33 -0
- package/dist/src/connectors/approval.js.map +1 -0
- package/dist/src/connectors/auth-provider-registry.d.ts +9 -0
- package/dist/src/connectors/auth-provider-registry.js +17 -0
- package/dist/src/connectors/auth-provider-registry.js.map +1 -0
- package/dist/src/connectors/builtin-catalog.js +55 -116
- package/dist/src/connectors/builtin-catalog.js.map +1 -1
- package/dist/src/connectors/catalog.js +7 -2
- package/dist/src/connectors/catalog.js.map +1 -1
- package/dist/src/connectors/composio-catalog.d.ts +19 -0
- package/dist/src/connectors/composio-catalog.js +237 -0
- package/dist/src/connectors/composio-catalog.js.map +1 -0
- package/dist/src/connectors/composio-logo.d.ts +1 -0
- package/dist/src/connectors/composio-logo.js +51 -0
- package/dist/src/connectors/composio-logo.js.map +1 -0
- package/dist/src/connectors/composio-sessions.d.ts +116 -0
- package/dist/src/connectors/composio-sessions.js +296 -0
- package/dist/src/connectors/composio-sessions.js.map +1 -0
- package/dist/src/connectors/composio-triggers.d.ts +17 -0
- package/dist/src/connectors/composio-triggers.js +48 -5
- package/dist/src/connectors/composio-triggers.js.map +1 -1
- package/dist/src/connectors/composio.d.ts +31 -2
- package/dist/src/connectors/composio.js +374 -151
- package/dist/src/connectors/composio.js.map +1 -1
- package/dist/src/connectors/connector-memory-sync.d.ts +15 -0
- package/dist/src/connectors/connector-memory-sync.js +90 -0
- package/dist/src/connectors/connector-memory-sync.js.map +1 -0
- package/dist/src/connectors/install.js +35 -92
- package/dist/src/connectors/install.js.map +1 -1
- package/dist/src/connectors/instances.js +6 -2
- package/dist/src/connectors/instances.js.map +1 -1
- package/dist/src/connectors/integration-strategy.d.ts +3 -0
- package/dist/src/connectors/integration-strategy.js +29 -0
- package/dist/src/connectors/integration-strategy.js.map +1 -0
- package/dist/src/connectors/policy.d.ts +13 -0
- package/dist/src/connectors/policy.js +48 -0
- package/dist/src/connectors/policy.js.map +1 -0
- package/dist/src/connectors/providers.js +1 -1
- package/dist/src/connectors/runtime-adapter-registry.d.ts +25 -0
- package/dist/src/connectors/runtime-adapter-registry.js +154 -0
- package/dist/src/connectors/runtime-adapter-registry.js.map +1 -0
- package/dist/src/connectors/types.d.ts +113 -4
- package/dist/src/connectors/workflow-preflight.d.ts +20 -0
- package/dist/src/connectors/workflow-preflight.js +70 -0
- package/dist/src/connectors/workflow-preflight.js.map +1 -0
- package/dist/src/daemon/launchd.js +1 -1
- package/dist/src/daemon/systemd.js +1 -1
- package/dist/src/extensions/discover-extensions.js +1 -1
- package/dist/src/extensions/install-transaction.d.ts +16 -0
- package/dist/src/extensions/install-transaction.js +76 -0
- package/dist/src/extensions/install-transaction.js.map +1 -0
- package/dist/src/extensions/install.d.ts +2 -0
- package/dist/src/extensions/install.js +23 -1
- package/dist/src/extensions/install.js.map +1 -1
- package/dist/src/extensions/loader.js +2 -2
- package/dist/src/gateway/agents-admin.d.ts +2 -0
- package/dist/src/gateway/agents-admin.js +7 -0
- package/dist/src/gateway/agents-admin.js.map +1 -1
- package/dist/src/gateway/capability-presets-admin.d.ts +11 -0
- package/dist/src/gateway/capability-presets-admin.js +11 -4
- package/dist/src/gateway/capability-presets-admin.js.map +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +17 -0
- package/dist/src/gateway/chat-stream/mapper.js.map +1 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +18 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -3
- package/dist/src/gateway/hono/lib/static-ui.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +3 -0
- package/dist/src/gateway/hono/routes/agents.js.map +1 -1
- package/dist/src/gateway/hono/routes/capability-presets.js +19 -1
- package/dist/src/gateway/hono/routes/capability-presets.js.map +1 -1
- package/dist/src/gateway/hono/routes/connectors.js +188 -25
- package/dist/src/gateway/hono/routes/connectors.js.map +1 -1
- package/dist/src/gateway/hono/routes/goals.js +22 -3
- package/dist/src/gateway/hono/routes/goals.js.map +1 -1
- package/dist/src/gateway/hono/routes/home.d.ts +60 -1
- package/dist/src/gateway/hono/routes/home.js +244 -18
- package/dist/src/gateway/hono/routes/home.js.map +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
- package/dist/src/gateway/hono/routes/memory.js +17 -4
- package/dist/src/gateway/hono/routes/memory.js.map +1 -1
- package/dist/src/gateway/hono/routes/projects.js +106 -5
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +93 -0
- package/dist/src/gateway/hono/routes/public-gateway.js.map +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +137 -22
- package/dist/src/gateway/hono/routes/workflows.js.map +1 -1
- package/dist/src/gateway/hono/routes/you.d.ts +23 -0
- package/dist/src/gateway/hono/routes/you.js +538 -0
- package/dist/src/gateway/hono/routes/you.js.map +1 -0
- package/dist/src/gateway/hono/sse.d.ts +2 -1
- package/dist/src/gateway/hono/sse.js +2 -1
- package/dist/src/gateway/hono/sse.js.map +1 -1
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/ports.js +1 -1
- package/dist/src/gateway/service/marketplace-service.d.ts +13 -1
- package/dist/src/gateway/service/marketplace-service.js +96 -40
- package/dist/src/gateway/service/marketplace-service.js.map +1 -1
- package/dist/src/gateway/service.d.ts +2 -0
- package/dist/src/gateway/service.js +13 -7
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/goals/goal-service.d.ts +7 -5
- package/dist/src/goals/goal-service.js +25 -13
- package/dist/src/goals/goal-service.js.map +1 -1
- package/dist/src/goals/goal-store.js +46 -7
- package/dist/src/goals/goal-store.js.map +1 -1
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/goals/types.d.ts +24 -0
- package/dist/src/infra/ports.js +1 -1
- package/dist/src/infra/ssh-tunnel.js +1 -1
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/migrations/runner.js +1 -1
- package/dist/src/notes/service.js +3 -3
- package/dist/src/notes/store.js +1 -1
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/projects/workspace.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/resolve-tui-session-key.js +1 -1
- package/dist/src/session/init-session-turn.js +1 -1
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/session-title.js +2 -2
- package/dist/src/session/store.js +1 -1
- package/dist/src/storage/sqlite/connection.js +1 -1
- package/dist/src/storage/sqlite/connector-repository.d.ts +49 -0
- package/dist/src/storage/sqlite/connector-repository.js +385 -0
- package/dist/src/storage/sqlite/connector-repository.js.map +1 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/migrations/030_connectors.sql +94 -0
- package/dist/src/storage/sqlite/migrations/031_connector_approvals.sql +24 -0
- package/dist/src/storage/sqlite/migrations/032_connector_webhook_deliveries.sql +15 -0
- package/dist/src/storage/sqlite/migrations/033_user_trust_policies.sql +6 -0
- package/dist/src/storage/sqlite/migrations/034_allow_global_auto_trust.sql +14 -0
- package/dist/src/storage/sqlite/migrations/035_user_profile_prompt_state.sql +7 -0
- package/dist/src/storage/sqlite/migrations/036_goal_outcome_metric.sql +12 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/row-mappers.js +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/user-profile-setup-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/user-profile-setup-repository.js +34 -0
- package/dist/src/storage/sqlite/user-profile-setup-repository.js.map +1 -0
- package/dist/src/storage/sqlite/user-trust-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/user-trust-repository.js +34 -0
- package/dist/src/storage/sqlite/user-trust-repository.js.map +1 -0
- package/dist/src/tui/backends/embedded-backend.js +4 -4
- package/dist/src/tui/clipboard-image.js +1 -1
- package/dist/src/tui/components/assistant-message.js +15 -0
- package/dist/src/tui/components/assistant-message.js.map +1 -1
- package/dist/src/tui/tui-agent-events.js +85 -1
- package/dist/src/tui/tui-agent-events.js.map +1 -1
- package/dist/src/tui/tui-command-formatters.js +9 -9
- package/dist/src/tui/tui-command-formatters.js.map +1 -1
- package/dist/src/tui/tui-commands.js +4 -4
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/user-context/import.d.ts +12 -0
- package/dist/src/user-context/import.js +48 -0
- package/dist/src/user-context/import.js.map +1 -0
- package/dist/src/user-context/profile.d.ts +37 -0
- package/dist/src/user-context/profile.js +165 -0
- package/dist/src/user-context/profile.js.map +1 -0
- package/dist/src/user-context/projection.d.ts +54 -0
- package/dist/src/user-context/projection.js +121 -0
- package/dist/src/user-context/projection.js.map +1 -0
- package/dist/src/user-context/source-recommendations.d.ts +13 -0
- package/dist/src/user-context/source-recommendations.js +86 -0
- package/dist/src/user-context/source-recommendations.js.map +1 -0
- package/dist/src/user-context/trust-policy.d.ts +11 -0
- package/dist/src/user-context/trust-policy.js +31 -0
- package/dist/src/user-context/trust-policy.js.map +1 -0
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/logger/index.js +1 -1
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/work-items/work-item-service.js +1 -1
- package/dist/src/workflows/authoring/index.d.ts +1 -0
- package/dist/src/workflows/authoring/index.js +2 -0
- package/dist/src/workflows/authoring/workflow-draft-store.d.ts +33 -0
- package/dist/src/workflows/authoring/workflow-draft-store.js +74 -0
- package/dist/src/workflows/authoring/workflow-draft-store.js.map +1 -0
- package/dist/src/workflows/domain/definition-utils.d.ts +6 -4
- package/dist/src/workflows/domain/definition-utils.js +28 -26
- package/dist/src/workflows/domain/definition-utils.js.map +1 -1
- package/dist/src/workflows/domain/definition.d.ts +79 -6
- package/dist/src/workflows/domain/event.d.ts +18 -2
- package/dist/src/workflows/domain/index.js +3 -3
- package/dist/src/workflows/domain/run.d.ts +16 -2
- package/dist/src/workflows/domain/run.js.map +1 -1
- package/dist/src/workflows/domain/validation.d.ts +9 -5
- package/dist/src/workflows/domain/validation.js +183 -40
- package/dist/src/workflows/domain/validation.js.map +1 -1
- package/dist/src/workflows/draft/workflow-draft-prompt.d.ts +2 -3
- package/dist/src/workflows/draft/workflow-draft-prompt.js +31 -73
- package/dist/src/workflows/draft/workflow-draft-prompt.js.map +1 -1
- package/dist/src/workflows/draft/workflow-draft-service.js +5 -9
- package/dist/src/workflows/draft/workflow-draft-service.js.map +1 -1
- package/dist/src/workflows/draft/workflow-draft-validator.js +29 -37
- package/dist/src/workflows/draft/workflow-draft-validator.js.map +1 -1
- package/dist/src/workflows/draft/workflow-draft.types.d.ts +4 -4
- package/dist/src/workflows/engine/projector.js +43 -1
- package/dist/src/workflows/engine/projector.js.map +1 -1
- package/dist/src/workflows/engine/workflow-engine.d.ts +2 -3
- package/dist/src/workflows/engine/workflow-engine.js +24 -4
- package/dist/src/workflows/engine/workflow-engine.js.map +1 -1
- package/dist/src/workflows/index.js +4 -7
- package/dist/src/workflows/registry/catalog-workflow-definition-registry.js +1 -9
- package/dist/src/workflows/registry/catalog-workflow-definition-registry.js.map +1 -1
- package/dist/src/workflows/runtime/graph-workflow-runtime.d.ts +10 -0
- package/dist/src/workflows/runtime/graph-workflow-runtime.js +295 -0
- package/dist/src/workflows/runtime/graph-workflow-runtime.js.map +1 -0
- package/dist/src/workflows/runtime/index.d.ts +1 -2
- package/dist/src/workflows/runtime/index.js +2 -5
- package/dist/src/workflows/runtime/workflow-runtime-port.d.ts +5 -8
- package/dist/src/workflows/service/workflow-run-service.js +15 -1
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +2 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +3 -3
- package/package.json +5 -4
- package/dist/gateway/static/root/assets/agents-CyvCIHnB.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-DK_Vx6nl.js +0 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-B1LV3YYv.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-fzrovqhv.js +0 -4
- package/dist/gateway/static/root/assets/block-editor-Dhj5f4Bx.js +0 -184
- package/dist/gateway/static/root/assets/browser-settings-page-BDn-n-UB.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Co5ipo_Q.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-BWlpaxg9.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-D_jkIZLV.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BcekbW4q.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-settings-BJCUuL8Y.js +0 -1
- package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-BN1Z2mIo.js +0 -3
- package/dist/gateway/static/root/assets/extension-page-B-1KxvVy.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BF9NACI3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DN9sNREz.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BpoQW8cD.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CBRSPd0b.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BCcBi407.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-pkTXzXkh.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-ezsufgLQ.js +0 -1
- package/dist/gateway/static/root/assets/index-B8s8Pq5U.css +0 -1
- package/dist/gateway/static/root/assets/index-DcUaXYeb.js +0 -262
- package/dist/gateway/static/root/assets/logs-page-DQtTRXtj.js +0 -7
- package/dist/gateway/static/root/assets/messages-BXNELNBa.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-BP2M9n6Q.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-CspveYaO.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-BHwzJ0OC.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-Dy3rsobs.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CWKpPE0L.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CqNRyXEo.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-MEME7ivF.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-JVd0qaSF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-DYEbB1EV.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-dWN8BJ3z.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-D8foINzP.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Tgbv1s7G.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-D_YK0b_Z.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DGytfoZK.js +0 -2
- package/dist/gateway/static/root/assets/toast-z0toXu32.js +0 -1
- package/dist/gateway/static/root/assets/user-profile-settings-panel-8YtygcJp.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BVH71EFf.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-JeTE7XNM.js +0 -1
- package/dist/gateway/static/root/assets/workflow-start-dialog-_u8Uc1ze.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-ixgk_y1l.js +0 -18
- package/dist/src/agent/workflow/builtins/audit-repo.d.ts +0 -13
- package/dist/src/agent/workflow/builtins/audit-repo.js +0 -183
- package/dist/src/agent/workflow/builtins/audit-repo.js.map +0 -1
- package/dist/src/agent/workflow/builtins/client-proposal.d.ts +0 -12
- package/dist/src/agent/workflow/builtins/client-proposal.js +0 -164
- package/dist/src/agent/workflow/builtins/client-proposal.js.map +0 -1
- package/dist/src/agent/workflow/builtins/competitor-scan.d.ts +0 -12
- package/dist/src/agent/workflow/builtins/competitor-scan.js +0 -164
- package/dist/src/agent/workflow/builtins/competitor-scan.js.map +0 -1
- package/dist/src/agent/workflow/builtins/content-draft.d.ts +0 -13
- package/dist/src/agent/workflow/builtins/content-draft.js +0 -159
- package/dist/src/agent/workflow/builtins/content-draft.js.map +0 -1
- package/dist/src/agent/workflow/builtins/content-repurpose.d.ts +0 -11
- package/dist/src/agent/workflow/builtins/content-repurpose.js +0 -146
- package/dist/src/agent/workflow/builtins/content-repurpose.js.map +0 -1
- package/dist/src/agent/workflow/builtins/debug-incident.d.ts +0 -13
- package/dist/src/agent/workflow/builtins/debug-incident.js +0 -177
- package/dist/src/agent/workflow/builtins/debug-incident.js.map +0 -1
- package/dist/src/agent/workflow/builtins/decision-compare.d.ts +0 -13
- package/dist/src/agent/workflow/builtins/decision-compare.js +0 -187
- package/dist/src/agent/workflow/builtins/decision-compare.js.map +0 -1
- package/dist/src/agent/workflow/builtins/implementation-plan.d.ts +0 -12
- package/dist/src/agent/workflow/builtins/implementation-plan.js +0 -185
- package/dist/src/agent/workflow/builtins/implementation-plan.js.map +0 -1
- package/dist/src/agent/workflow/builtins/inbox-triage.d.ts +0 -11
- package/dist/src/agent/workflow/builtins/inbox-triage.js +0 -158
- package/dist/src/agent/workflow/builtins/inbox-triage.js.map +0 -1
- package/dist/src/agent/workflow/builtins/meeting-prep.d.ts +0 -12
- package/dist/src/agent/workflow/builtins/meeting-prep.js +0 -152
- package/dist/src/agent/workflow/builtins/meeting-prep.js.map +0 -1
- package/dist/src/agent/workflow/builtins/multi-perspective-review.d.ts +0 -14
- package/dist/src/agent/workflow/builtins/multi-perspective-review.js +0 -171
- package/dist/src/agent/workflow/builtins/multi-perspective-review.js.map +0 -1
- package/dist/src/agent/workflow/builtins/offer-design.d.ts +0 -12
- package/dist/src/agent/workflow/builtins/offer-design.js +0 -170
- package/dist/src/agent/workflow/builtins/offer-design.js.map +0 -1
- package/dist/src/agent/workflow/builtins/pr-review.d.ts +0 -12
- package/dist/src/agent/workflow/builtins/pr-review.js +0 -178
- package/dist/src/agent/workflow/builtins/pr-review.js.map +0 -1
- package/dist/src/agent/workflow/builtins/release-check.d.ts +0 -11
- package/dist/src/agent/workflow/builtins/release-check.js +0 -174
- package/dist/src/agent/workflow/builtins/release-check.js.map +0 -1
- package/dist/src/agent/workflow/builtins/research.d.ts +0 -13
- package/dist/src/agent/workflow/builtins/research.js +0 -188
- package/dist/src/agent/workflow/builtins/research.js.map +0 -1
- package/dist/src/agent/workflow/builtins/weekly-review.d.ts +0 -12
- package/dist/src/agent/workflow/builtins/weekly-review.js +0 -139
- package/dist/src/agent/workflow/builtins/weekly-review.js.map +0 -1
- package/dist/src/agent/workflow/last-run-memory.d.ts +0 -42
- package/dist/src/agent/workflow/last-run-memory.js +0 -60
- package/dist/src/agent/workflow/last-run-memory.js.map +0 -1
- package/dist/src/agent/workflow/lint.d.ts +0 -38
- package/dist/src/agent/workflow/lint.js +0 -74
- package/dist/src/agent/workflow/lint.js.map +0 -1
- package/dist/src/agent/workflow/meta-locale.d.ts +0 -12
- package/dist/src/agent/workflow/meta-locale.js +0 -62
- package/dist/src/agent/workflow/meta-locale.js.map +0 -1
- package/dist/src/agent/workflow/parser.d.ts +0 -20
- package/dist/src/agent/workflow/parser.js +0 -152
- package/dist/src/agent/workflow/parser.js.map +0 -1
- package/dist/src/agent/workflow/runtime.d.ts +0 -34
- package/dist/src/agent/workflow/runtime.js +0 -402
- package/dist/src/agent/workflow/runtime.js.map +0 -1
- package/dist/src/connectors/oauth.d.ts +0 -22
- package/dist/src/connectors/oauth.js +0 -99
- package/dist/src/connectors/oauth.js.map +0 -1
- package/dist/src/workflows/runtime/script-runtime.d.ts +0 -3
- package/dist/src/workflows/runtime/script-runtime.js +0 -3
- package/dist/src/workflows/runtime/script-workflow-runtime.d.ts +0 -5
- package/dist/src/workflows/runtime/script-workflow-runtime.js +0 -15
- package/dist/src/workflows/runtime/script-workflow-runtime.js.map +0 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { GoalService } from "../../../goals/goal-service.js";
|
|
2
|
+
import "../../../goals/index.js";
|
|
3
|
+
import { decideConnectorApproval, listConnectorApprovals } from "../../../storage/sqlite/connector-repository.js";
|
|
4
|
+
import "../../../storage/sqlite/index.js";
|
|
1
5
|
import { listGatewayAgents } from "../../agents-admin.js";
|
|
2
6
|
import { WorkItemService } from "../../../work-items/work-item-service.js";
|
|
3
7
|
import "../../../work-items/index.js";
|
|
@@ -5,12 +9,27 @@ import { getTunnelService } from "../../../tunnel/tunnel-service.js";
|
|
|
5
9
|
import "../../../tunnel/index.js";
|
|
6
10
|
//#region src/gateway/hono/routes/home.ts
|
|
7
11
|
function workItemAttentionRank(item, nowMs) {
|
|
8
|
-
if (item.status === "needs_input" || item.status === "blocked") return 0;
|
|
12
|
+
if (item.status === "needs_input" || item.status === "in_review" || item.status === "blocked") return 0;
|
|
9
13
|
if (item.dueAt != null && item.dueAt < nowMs) return 1;
|
|
10
14
|
if (item.dueAt != null && item.dueAt < nowMs + 1440 * 60 * 1e3) return 2;
|
|
11
15
|
if (item.priority === "urgent") return 3;
|
|
12
16
|
return 4;
|
|
13
17
|
}
|
|
18
|
+
function toHomeWorkItem(item, projectName) {
|
|
19
|
+
return {
|
|
20
|
+
id: item.id,
|
|
21
|
+
projectId: item.projectId,
|
|
22
|
+
projectName,
|
|
23
|
+
title: item.title,
|
|
24
|
+
status: item.status,
|
|
25
|
+
priority: item.priority,
|
|
26
|
+
nextAction: item.nextAction,
|
|
27
|
+
blockedReason: item.blockedReason,
|
|
28
|
+
dueAt: item.dueAt,
|
|
29
|
+
completedAt: item.completedAt,
|
|
30
|
+
updatedAt: item.updatedAt
|
|
31
|
+
};
|
|
32
|
+
}
|
|
14
33
|
function toHomeWorkflowRun(run) {
|
|
15
34
|
return {
|
|
16
35
|
id: run.id,
|
|
@@ -63,8 +82,64 @@ function toHomeAutomationRun(run) {
|
|
|
63
82
|
workflowRunId: run.workflowRunId
|
|
64
83
|
};
|
|
65
84
|
}
|
|
85
|
+
function decisionFromGoal(goal, projectName) {
|
|
86
|
+
if (goal.status !== "needs_input" && goal.status !== "blocked") return null;
|
|
87
|
+
return {
|
|
88
|
+
id: `goal:${goal.id}`,
|
|
89
|
+
kind: "goal",
|
|
90
|
+
title: goal.title,
|
|
91
|
+
detail: goal.blockedReason || goal.nextAction,
|
|
92
|
+
reason: goal.status,
|
|
93
|
+
urgency: "now",
|
|
94
|
+
href: `/goals/${encodeURIComponent(goal.id)}`,
|
|
95
|
+
projectId: goal.projectId,
|
|
96
|
+
projectName,
|
|
97
|
+
updatedAt: goal.updatedAt
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function decisionFromWorkItem(item, projectName, nowMs) {
|
|
101
|
+
let reason;
|
|
102
|
+
let urgency = "now";
|
|
103
|
+
if (item.status === "needs_input" || item.status === "in_review" || item.status === "blocked") reason = item.status;
|
|
104
|
+
else if (item.dueAt != null && item.dueAt < nowMs) reason = "overdue";
|
|
105
|
+
else if (item.dueAt != null && item.dueAt < nowMs + 1440 * 60 * 1e3) {
|
|
106
|
+
reason = "due_soon";
|
|
107
|
+
urgency = "soon";
|
|
108
|
+
}
|
|
109
|
+
if (!reason) return null;
|
|
110
|
+
return {
|
|
111
|
+
id: `work:${item.id}`,
|
|
112
|
+
kind: "work_item",
|
|
113
|
+
title: item.title,
|
|
114
|
+
detail: item.blockedReason || item.nextAction,
|
|
115
|
+
reason,
|
|
116
|
+
urgency,
|
|
117
|
+
href: `/work-items/${encodeURIComponent(item.id)}`,
|
|
118
|
+
projectId: item.projectId,
|
|
119
|
+
projectName,
|
|
120
|
+
updatedAt: item.updatedAt
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function buildHomeBriefing(input) {
|
|
124
|
+
const isChinese = input.locale?.toLowerCase().startsWith("zh") ?? false;
|
|
125
|
+
const movingCount = input.activeWorkCount + input.activeWorkflowCount + input.activeGoalCount;
|
|
126
|
+
const summary = input.decisions.length > 0 ? isChinese ? `有 ${input.decisions.length} 件事等你决定;我正在继续推进 ${movingCount} 件工作。` : `${input.decisions.length} ${input.decisions.length === 1 ? "item needs" : "items need"} your decision; I’m continuing ${movingCount} in the background.` : movingCount > 0 ? isChinese ? `目前没有事情需要你处理;我正在继续推进 ${movingCount} 件工作。` : `Nothing needs you right now; I’m continuing ${movingCount} ${movingCount === 1 ? "item" : "items"} in the background.` : isChinese ? "今天还没有正在推进的事项。把想要的结果交给我,我会从这里开始。" : "Nothing is moving yet today. Hand me an outcome and I’ll take it from here.";
|
|
127
|
+
return {
|
|
128
|
+
generatedAt: input.nowMs,
|
|
129
|
+
summary,
|
|
130
|
+
focus: input.decisions.slice(0, 3),
|
|
131
|
+
progress: {
|
|
132
|
+
activeWorkCount: input.activeWorkCount,
|
|
133
|
+
activeWorkflowCount: input.activeWorkflowCount,
|
|
134
|
+
activeGoalCount: input.activeGoalCount,
|
|
135
|
+
movingCount
|
|
136
|
+
},
|
|
137
|
+
wins: input.wins.slice(0, 5),
|
|
138
|
+
nextScheduled: input.nextScheduled
|
|
139
|
+
};
|
|
140
|
+
}
|
|
66
141
|
/**
|
|
67
|
-
* GET /api/home — Aggregated
|
|
142
|
+
* GET /api/home — Aggregated data for the user's cross-project work home.
|
|
68
143
|
*
|
|
69
144
|
* Returns:
|
|
70
145
|
* - recentlyOpened: notes sorted by lastOpenedAt (continue rail)
|
|
@@ -79,6 +154,7 @@ function toHomeAutomationRun(run) {
|
|
|
79
154
|
*/
|
|
80
155
|
function registerHomeRoutes(authenticated, deps) {
|
|
81
156
|
const { service } = deps;
|
|
157
|
+
const goals = new GoalService();
|
|
82
158
|
authenticated.get("/api/home", async (c) => {
|
|
83
159
|
const notes = service.notesServiceInstance;
|
|
84
160
|
const sessions = service.sessions;
|
|
@@ -89,7 +165,7 @@ function registerHomeRoutes(authenticated, deps) {
|
|
|
89
165
|
const health = service.getHealth();
|
|
90
166
|
const workItems = new WorkItemService();
|
|
91
167
|
const nowMs = Date.now();
|
|
92
|
-
const [recentlyOpened, inbox, pendingTasks, recentSessions, workflowRuns, automations, automationRuns, projects, allWorkItems] = await Promise.all([
|
|
168
|
+
const [recentlyOpened, inbox, pendingTasks, recentSessions, workflowRuns, automations, automationRuns, projects, allWorkItems, activeGoals, connectorApprovals] = await Promise.all([
|
|
93
169
|
notes.listNotes({
|
|
94
170
|
sortBy: "lastOpenedAt",
|
|
95
171
|
sortOrder: "desc",
|
|
@@ -114,28 +190,124 @@ function registerHomeRoutes(authenticated, deps) {
|
|
|
114
190
|
service.automationServiceInstance.list(),
|
|
115
191
|
service.automationServiceInstance.listRuns({ limit: 10 }),
|
|
116
192
|
service.projects.list({ limit: 500 }),
|
|
117
|
-
Promise.resolve(workItems.listWorkItems({ limit: 100 }))
|
|
193
|
+
Promise.resolve(workItems.listWorkItems({ limit: 100 })),
|
|
194
|
+
Promise.resolve(goals.list({
|
|
195
|
+
status: [
|
|
196
|
+
"active",
|
|
197
|
+
"blocked",
|
|
198
|
+
"needs_input",
|
|
199
|
+
"paused"
|
|
200
|
+
],
|
|
201
|
+
limit: 100
|
|
202
|
+
})),
|
|
203
|
+
Promise.resolve(listConnectorApprovals({
|
|
204
|
+
principalId: "local-owner",
|
|
205
|
+
status: "pending",
|
|
206
|
+
limit: 100
|
|
207
|
+
}))
|
|
118
208
|
]);
|
|
119
209
|
const projectsById = new Map(projects.items.map((project) => [project.id, project]));
|
|
120
210
|
const activeWorkItems = allWorkItems.items.filter((item) => item.status !== "done" && item.status !== "cancelled").sort((left, right) => {
|
|
121
211
|
return workItemAttentionRank(left, nowMs) - workItemAttentionRank(right, nowMs) || right.updatedAt - left.updatedAt;
|
|
122
212
|
});
|
|
123
|
-
const attentionWorkItems = activeWorkItems.slice(0,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
projectName: projectsById.get(item.projectId)?.name ?? "Project",
|
|
127
|
-
title: item.title,
|
|
128
|
-
status: item.status,
|
|
129
|
-
priority: item.priority,
|
|
130
|
-
nextAction: item.nextAction,
|
|
131
|
-
blockedReason: item.blockedReason,
|
|
132
|
-
dueAt: item.dueAt,
|
|
133
|
-
updatedAt: item.updatedAt
|
|
134
|
-
}));
|
|
213
|
+
const attentionWorkItems = activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 4).slice(0, 8).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
|
|
214
|
+
const currentWorkItems = activeWorkItems.slice(0, 30).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
|
|
215
|
+
const recentlyCompletedWorkItems = allWorkItems.items.filter((item) => item.status === "done").sort((left, right) => (right.completedAt ?? right.updatedAt) - (left.completedAt ?? left.updatedAt)).slice(0, 8).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
|
|
135
216
|
const activeWorkflowRuns = workflowRuns.filter((run) => run.status === "queued" || run.status === "running").slice(0, 5).map(toHomeWorkflowRun);
|
|
136
217
|
const attentionWorkflowRuns = workflowRuns.filter((run) => run.status === "failed" || run.status === "timeout").slice(0, 5).map(toHomeWorkflowRun);
|
|
137
218
|
const recentWorkflowRuns = workflowRuns.slice(0, 5).map(toHomeWorkflowRun);
|
|
138
219
|
const upcomingAutomations = automations.map(toHomeAutomation).filter((automation) => Boolean(automation)).sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt)).slice(0, 5);
|
|
220
|
+
const latestAutomationRuns = [...automationRuns].sort((left, right) => right.createdAtMs - left.createdAtMs).filter((run, index, all) => all.findIndex((candidate) => candidate.automationId === run.automationId) === index);
|
|
221
|
+
const decisions = [
|
|
222
|
+
...activeWorkItems.map((item) => decisionFromWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project", nowMs)).filter((item) => Boolean(item)),
|
|
223
|
+
...activeGoals.map((goal) => decisionFromGoal(goal, goal.projectId ? projectsById.get(goal.projectId)?.name : void 0)).filter((item) => Boolean(item)),
|
|
224
|
+
...attentionWorkflowRuns.map((run) => ({
|
|
225
|
+
id: `workflow:${run.id}`,
|
|
226
|
+
kind: "workflow_run",
|
|
227
|
+
title: run.title,
|
|
228
|
+
detail: run.status,
|
|
229
|
+
reason: "run_failed",
|
|
230
|
+
urgency: "now",
|
|
231
|
+
href: `/workflows?runId=${encodeURIComponent(run.id)}`,
|
|
232
|
+
updatedAt: run.completedAtMs ?? run.startedAtMs ?? run.createdAtMs
|
|
233
|
+
})),
|
|
234
|
+
...latestAutomationRuns.filter((run) => run.status === "failed" || run.status === "timeout").map((run) => ({
|
|
235
|
+
id: `automation:${run.id}`,
|
|
236
|
+
kind: "automation_run",
|
|
237
|
+
title: run.automationName || run.automationId,
|
|
238
|
+
detail: run.error || run.summary,
|
|
239
|
+
reason: "run_failed",
|
|
240
|
+
urgency: "now",
|
|
241
|
+
href: "/automations",
|
|
242
|
+
updatedAt: run.endedAtMs ?? run.startedAtMs ?? run.createdAtMs
|
|
243
|
+
})),
|
|
244
|
+
...connectorApprovals.filter((approval) => Date.parse(approval.expiresAt) > nowMs).map((approval) => ({
|
|
245
|
+
id: `connector-approval:${approval.id}`,
|
|
246
|
+
kind: "connector_approval",
|
|
247
|
+
title: approval.actionId,
|
|
248
|
+
detail: `${approval.connectorId} · ${approval.scope}`,
|
|
249
|
+
reason: "approval_required",
|
|
250
|
+
urgency: "now",
|
|
251
|
+
href: "/connectors",
|
|
252
|
+
updatedAt: Date.parse(approval.createdAt),
|
|
253
|
+
response: {
|
|
254
|
+
kind: "connector_approval",
|
|
255
|
+
approvalId: approval.id
|
|
256
|
+
}
|
|
257
|
+
})),
|
|
258
|
+
...activeGoals.flatMap((goal) => goal.evidenceRequirements.filter((requirement) => requirement.requiresHumanApproval && requirement.evidenceIds.length > 0 && (requirement.status === "pending" || requirement.status === "ai_verified")).map((requirement) => ({
|
|
259
|
+
id: `goal-evidence:${requirement.id}`,
|
|
260
|
+
kind: "goal_evidence",
|
|
261
|
+
title: goal.title,
|
|
262
|
+
detail: requirement.text,
|
|
263
|
+
reason: "approval_required",
|
|
264
|
+
urgency: "now",
|
|
265
|
+
href: `/goals/${encodeURIComponent(goal.id)}`,
|
|
266
|
+
projectId: goal.projectId,
|
|
267
|
+
projectName: goal.projectId ? projectsById.get(goal.projectId)?.name : void 0,
|
|
268
|
+
updatedAt: requirement.updatedAt,
|
|
269
|
+
response: {
|
|
270
|
+
kind: "goal_evidence",
|
|
271
|
+
goalId: goal.id,
|
|
272
|
+
requirementId: requirement.id
|
|
273
|
+
}
|
|
274
|
+
})))
|
|
275
|
+
].sort((left, right) => {
|
|
276
|
+
return (left.urgency === "now" ? 0 : 1) - (right.urgency === "now" ? 0 : 1) || right.updatedAt - left.updatedAt;
|
|
277
|
+
}).slice(0, 20);
|
|
278
|
+
const wins = [
|
|
279
|
+
...recentlyCompletedWorkItems.map((item) => ({
|
|
280
|
+
id: `work:${item.id}`,
|
|
281
|
+
kind: "work_item",
|
|
282
|
+
title: item.title,
|
|
283
|
+
href: `/work-items/${encodeURIComponent(item.id)}`,
|
|
284
|
+
completedAt: item.completedAt ?? item.updatedAt
|
|
285
|
+
})),
|
|
286
|
+
...workflowRuns.filter((run) => run.status === "succeeded").map((run) => ({
|
|
287
|
+
id: `workflow:${run.id}`,
|
|
288
|
+
kind: "workflow_run",
|
|
289
|
+
title: run.title,
|
|
290
|
+
href: `/workflows?runId=${encodeURIComponent(run.id)}`,
|
|
291
|
+
completedAt: run.completedAtMs ?? run.createdAtMs
|
|
292
|
+
})),
|
|
293
|
+
...latestAutomationRuns.filter((run) => run.status === "succeeded").map((run) => ({
|
|
294
|
+
id: `automation:${run.id}`,
|
|
295
|
+
kind: "automation_run",
|
|
296
|
+
title: run.automationName || run.automationId,
|
|
297
|
+
href: "/automations",
|
|
298
|
+
completedAt: run.endedAtMs ?? run.createdAtMs
|
|
299
|
+
}))
|
|
300
|
+
].sort((left, right) => right.completedAt - left.completedAt);
|
|
301
|
+
const briefing = buildHomeBriefing({
|
|
302
|
+
locale: c.req.query("locale"),
|
|
303
|
+
decisions,
|
|
304
|
+
activeWorkCount: activeWorkItems.filter((item) => item.status === "in_progress").length,
|
|
305
|
+
activeWorkflowCount: activeWorkflowRuns.length,
|
|
306
|
+
activeGoalCount: activeGoals.filter((goal) => goal.status === "active").length,
|
|
307
|
+
wins,
|
|
308
|
+
nextScheduled: upcomingAutomations[0],
|
|
309
|
+
nowMs
|
|
310
|
+
});
|
|
139
311
|
return c.json({
|
|
140
312
|
recentlyOpened: recentlyOpened.items.filter((n) => n.lastOpenedAt),
|
|
141
313
|
inboxCount: inbox.total,
|
|
@@ -164,18 +336,72 @@ function registerHomeRoutes(authenticated, deps) {
|
|
|
164
336
|
attention: attentionWorkflowRuns,
|
|
165
337
|
recent: recentWorkflowRuns
|
|
166
338
|
},
|
|
339
|
+
briefing,
|
|
340
|
+
decisions,
|
|
167
341
|
work: {
|
|
168
342
|
attentionCount: activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 3).length,
|
|
169
343
|
overdueCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt < nowMs).length,
|
|
170
344
|
todayCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt >= nowMs && item.dueAt < nowMs + 1440 * 60 * 1e3).length,
|
|
171
|
-
items: attentionWorkItems
|
|
345
|
+
items: attentionWorkItems,
|
|
346
|
+
current: currentWorkItems,
|
|
347
|
+
recentlyCompleted: recentlyCompletedWorkItems
|
|
172
348
|
},
|
|
173
349
|
upcomingAutomations,
|
|
174
350
|
recentAutomationRuns: automationRuns.slice(0, 5).map(toHomeAutomationRun)
|
|
175
351
|
});
|
|
176
352
|
});
|
|
353
|
+
authenticated.post("/api/home/decisions/respond", deps.strictRateLimitMiddleware, async (c) => {
|
|
354
|
+
const body = await c.req.json().catch(() => ({}));
|
|
355
|
+
const decision = body.decision === "approve" ? "approve" : body.decision === "deny" ? "deny" : void 0;
|
|
356
|
+
if (!decision) return c.json({
|
|
357
|
+
ok: false,
|
|
358
|
+
error: "Decision must be approve or deny"
|
|
359
|
+
}, 400);
|
|
360
|
+
if (body.kind === "connector_approval" && typeof body.approvalId === "string") {
|
|
361
|
+
const approval = decideConnectorApproval(body.approvalId, decision === "approve" ? "approved" : "denied");
|
|
362
|
+
if (!approval) return c.json({
|
|
363
|
+
ok: false,
|
|
364
|
+
error: "Approval not found"
|
|
365
|
+
}, 404);
|
|
366
|
+
if (approval.status !== (decision === "approve" ? "approved" : "denied")) return c.json({
|
|
367
|
+
ok: false,
|
|
368
|
+
error: `Approval is ${approval.status}`
|
|
369
|
+
}, 409);
|
|
370
|
+
return c.json({
|
|
371
|
+
ok: true,
|
|
372
|
+
status: approval.status
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
if (body.kind === "goal_evidence" && typeof body.goalId === "string" && typeof body.requirementId === "string") {
|
|
376
|
+
const goal = goals.get(body.goalId);
|
|
377
|
+
const requirement = goal?.evidenceRequirements.find((item) => item.id === body.requirementId);
|
|
378
|
+
if (!goal || !requirement) return c.json({
|
|
379
|
+
ok: false,
|
|
380
|
+
error: "Evidence approval not found"
|
|
381
|
+
}, 404);
|
|
382
|
+
if (requirement.evidenceIds.length === 0) return c.json({
|
|
383
|
+
ok: false,
|
|
384
|
+
error: "Evidence is missing"
|
|
385
|
+
}, 409);
|
|
386
|
+
const updated = goals.reviewEvidenceRequirement({
|
|
387
|
+
goalId: goal.id,
|
|
388
|
+
requirementId: requirement.id,
|
|
389
|
+
status: decision === "approve" ? "approved" : "rejected",
|
|
390
|
+
reason: decision === "approve" ? "Approved from the decision inbox." : "Rejected from the decision inbox.",
|
|
391
|
+
reviewedBy: "user"
|
|
392
|
+
});
|
|
393
|
+
return c.json({
|
|
394
|
+
ok: true,
|
|
395
|
+
status: updated?.status
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
return c.json({
|
|
399
|
+
ok: false,
|
|
400
|
+
error: "Unsupported decision kind"
|
|
401
|
+
}, 400);
|
|
402
|
+
});
|
|
177
403
|
}
|
|
178
404
|
//#endregion
|
|
179
|
-
export { registerHomeRoutes };
|
|
405
|
+
export { buildHomeBriefing, registerHomeRoutes };
|
|
180
406
|
|
|
181
407
|
//# sourceMappingURL=home.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"home.js","names":[],"sources":["../../../../../src/gateway/hono/routes/home.ts"],"sourcesContent":["import type { Hono } from 'hono';\n\nimport { listGatewayAgents } from '../../agents-admin.js';\nimport { getTunnelService } from '../../../tunnel/index.js';\nimport type { Automation, AutomationRun } from '../../../automations/index.js';\nimport type { WorkflowRunSummary } from '../../../workflows/domain/index.js';\nimport { WorkItemService } from '../../../work-items/index.js';\nimport type { AuthenticatedRouteDeps } from './deps.js';\n\ntype HomeWorkflowRun = {\n id: string;\n definitionId: string;\n title: string;\n status: WorkflowRunSummary['status'];\n sessionKey?: string;\n createdAtMs: number;\n startedAtMs?: number;\n completedAtMs?: number;\n metrics: WorkflowRunSummary['metrics'];\n};\n\ntype HomeAutomation = {\n id: string;\n name?: string;\n trigger: string;\n action: string;\n nextRunAt: string;\n};\n\ntype HomeAutomationRun = {\n id: string;\n automationId: string;\n automationName?: string;\n status: AutomationRun['status'];\n createdAtMs: number;\n startedAtMs?: number;\n endedAtMs?: number;\n error?: string;\n summary?: string;\n sessionKey?: string;\n workflowRunId?: string;\n};\n\nfunction workItemAttentionRank(item: { status: string; dueAt?: number; priority: string; updatedAt: number }, nowMs: number): number {\n if (item.status === 'needs_input' || item.status === 'blocked') return 0;\n if (item.dueAt != null && item.dueAt < nowMs) return 1;\n if (item.dueAt != null && item.dueAt < nowMs + 24 * 60 * 60 * 1000) return 2;\n if (item.priority === 'urgent') return 3;\n return 4;\n}\n\nfunction toHomeWorkflowRun(run: WorkflowRunSummary): HomeWorkflowRun {\n return {\n id: run.id,\n definitionId: run.definitionId,\n title: run.title,\n status: run.status,\n sessionKey: run.metadata?.sessionKey,\n createdAtMs: run.createdAtMs,\n startedAtMs: run.startedAtMs,\n completedAtMs: run.completedAtMs,\n metrics: run.metrics,\n };\n}\n\nfunction triggerLabel(automation: Automation): string {\n const trigger = automation.trigger;\n if (trigger.kind === 'manual') return 'manual';\n if (trigger.kind === 'webhook') return 'webhook';\n if (trigger.kind === 'event') return `event:${trigger.eventType}`;\n const schedule = trigger.schedule;\n if (schedule.kind === 'once') return schedule.at;\n if (schedule.kind === 'interval') return `every ${Math.round(schedule.everyMs / 60000)} minutes`;\n return schedule.expr;\n}\n\nfunction actionLabel(automation: Automation): string {\n if (automation.action.kind === 'workflow') return `workflow:${automation.action.workflowId}`;\n return automation.action.agentId ? `agent:${automation.action.agentId}` : 'agent';\n}\n\nfunction toHomeAutomation(automation: Automation): HomeAutomation | null {\n if (!automation.enabled || !automation.state.nextRunAtMs) return null;\n return {\n id: automation.id,\n name: automation.name,\n trigger: triggerLabel(automation),\n action: actionLabel(automation),\n nextRunAt: new Date(automation.state.nextRunAtMs).toISOString(),\n };\n}\n\nfunction toHomeAutomationRun(run: AutomationRun): HomeAutomationRun {\n return {\n id: run.id,\n automationId: run.automationId,\n automationName: run.automationName,\n status: run.status,\n createdAtMs: run.createdAtMs,\n startedAtMs: run.startedAtMs,\n endedAtMs: run.endedAtMs,\n error: run.error,\n summary: run.summary,\n sessionKey: run.sessionKey,\n workflowRunId: run.workflowRunId,\n };\n}\n\n/**\n * GET /api/home — Aggregated home screen data for the mobile app.\n *\n * Returns:\n * - recentlyOpened: notes sorted by lastOpenedAt (continue rail)\n * - inboxCount: number of notes with status === 'inbox'\n * - pendingTasks: task notes where done === false\n * - recentSessions: last 5 active AI sessions (threads)\n * - activeAgent: default agent identity for this gateway\n * - gateway: readiness + public tunnel status\n * - workflowRuns: active / attention / recent workflow runs\n * - upcomingAutomations: upcoming enabled automations\n * - recentAutomationRuns: latest automation executions\n */\nexport function registerHomeRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void {\n const { service } = deps;\n\n authenticated.get('/api/home', async (c) => {\n const notes = service.notesServiceInstance;\n const sessions = service.sessions;\n const agents = await listGatewayAgents(service.currentConfig);\n const defaultAgent = agents.agents.find((agent) => agent.id === agents.defaultId) ?? agents.agents[0];\n const workflowRunService = service.createWorkflowRunService();\n const workflowRunStore = workflowRunService.createRunStore(defaultAgent?.id ?? agents.defaultId);\n const tunnel = getTunnelService().getStatus();\n const health = service.getHealth();\n const workItems = new WorkItemService();\n const nowMs = Date.now();\n\n const [\n recentlyOpened,\n inbox,\n pendingTasks,\n recentSessions,\n workflowRuns,\n automations,\n automationRuns,\n projects,\n allWorkItems,\n ] = await Promise.all([\n notes.listNotes({ sortBy: 'lastOpenedAt', sortOrder: 'desc', limit: 10 }),\n notes.listNotes({ status: 'inbox', limit: 0 }),\n notes.listNotes({ pendingTasksOnly: true, sortBy: 'createdAt', sortOrder: 'desc', limit: 10 }),\n sessions.listSessions({ sortBy: 'updatedAt', sortOrder: 'desc', limit: 5 }),\n workflowRunStore.listRunSummaries(20),\n service.automationServiceInstance.list(),\n service.automationServiceInstance.listRuns({ limit: 10 }),\n service.projects.list({ limit: 500 }),\n Promise.resolve(workItems.listWorkItems({ limit: 100 })),\n ]);\n const projectsById = new Map(projects.items.map((project) => [project.id, project]));\n const activeWorkItems = allWorkItems.items\n .filter((item) => item.status !== 'done' && item.status !== 'cancelled')\n .sort((left, right) => {\n const rank = workItemAttentionRank(left, nowMs) - workItemAttentionRank(right, nowMs);\n return rank || right.updatedAt - left.updatedAt;\n });\n const attentionWorkItems = activeWorkItems.slice(0, 6).map((item) => ({\n id: item.id,\n projectId: item.projectId,\n projectName: projectsById.get(item.projectId)?.name ?? 'Project',\n title: item.title,\n status: item.status,\n priority: item.priority,\n nextAction: item.nextAction,\n blockedReason: item.blockedReason,\n dueAt: item.dueAt,\n updatedAt: item.updatedAt,\n }));\n\n const activeWorkflowRuns = workflowRuns\n .filter((run) => run.status === 'queued' || run.status === 'running')\n .slice(0, 5)\n .map(toHomeWorkflowRun);\n const attentionWorkflowRuns = workflowRuns\n .filter((run) => run.status === 'failed' || run.status === 'timeout')\n .slice(0, 5)\n .map(toHomeWorkflowRun);\n const recentWorkflowRuns = workflowRuns.slice(0, 5).map(toHomeWorkflowRun);\n const upcomingAutomations = automations\n .map(toHomeAutomation)\n .filter((automation): automation is HomeAutomation => Boolean(automation))\n .sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt))\n .slice(0, 5);\n\n return c.json({\n recentlyOpened: recentlyOpened.items.filter((n) => n.lastOpenedAt),\n inboxCount: inbox.total,\n pendingTasks: pendingTasks.items,\n pendingTaskCount: pendingTasks.total,\n recentSessions: recentSessions.items,\n activeAgent: defaultAgent\n ? {\n id: defaultAgent.id,\n name: defaultAgent.name,\n description: defaultAgent.description,\n }\n : { id: agents.defaultId },\n gateway: {\n status: health.status,\n ready: health.ready,\n httpListening: health.httpListening,\n version: health.version,\n uptime: health.uptime,\n tunnel: {\n state: tunnel.state,\n publicUrl: tunnel.publicUrl,\n connected: tunnel.state === 'connected',\n },\n },\n workflowRuns: {\n active: activeWorkflowRuns,\n attention: attentionWorkflowRuns,\n recent: recentWorkflowRuns,\n },\n work: {\n attentionCount: activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 3).length,\n overdueCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt < nowMs).length,\n todayCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt >= nowMs && item.dueAt < nowMs + 24 * 60 * 60 * 1000).length,\n items: attentionWorkItems,\n },\n upcomingAutomations,\n recentAutomationRuns: automationRuns.slice(0, 5).map(toHomeAutomationRun),\n });\n });\n}\n"],"mappings":";;;;;;AA2CA,SAAS,sBAAsB,MAA+E,OAAuB;AACnI,KAAI,KAAK,WAAW,iBAAiB,KAAK,WAAW,UAAW,QAAO;AACvE,KAAI,KAAK,SAAS,QAAQ,KAAK,QAAQ,MAAO,QAAO;AACrD,KAAI,KAAK,SAAS,QAAQ,KAAK,QAAQ,QAAQ,OAAU,KAAK,IAAM,QAAO;AAC3E,KAAI,KAAK,aAAa,SAAU,QAAO;AACvC,QAAO;;AAGT,SAAS,kBAAkB,KAA0C;AACnE,QAAO;EACL,IAAI,IAAI;EACR,cAAc,IAAI;EAClB,OAAO,IAAI;EACX,QAAQ,IAAI;EACZ,YAAY,IAAI,UAAU;EAC1B,aAAa,IAAI;EACjB,aAAa,IAAI;EACjB,eAAe,IAAI;EACnB,SAAS,IAAI;EACd;;AAGH,SAAS,aAAa,YAAgC;CACpD,MAAM,UAAU,WAAW;AAC3B,KAAI,QAAQ,SAAS,SAAU,QAAO;AACtC,KAAI,QAAQ,SAAS,UAAW,QAAO;AACvC,KAAI,QAAQ,SAAS,QAAS,QAAO,SAAS,QAAQ;CACtD,MAAM,WAAW,QAAQ;AACzB,KAAI,SAAS,SAAS,OAAQ,QAAO,SAAS;AAC9C,KAAI,SAAS,SAAS,WAAY,QAAO,SAAS,KAAK,MAAM,SAAS,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B;GAC1E,CAAC;GACF"}
|
|
1
|
+
{"version":3,"file":"home.js","names":[],"sources":["../../../../../src/gateway/hono/routes/home.ts"],"sourcesContent":["import type { Hono } from 'hono';\n\nimport { listGatewayAgents } from '../../agents-admin.js';\nimport { getTunnelService } from '../../../tunnel/index.js';\nimport type { Automation, AutomationRun } from '../../../automations/index.js';\nimport { GoalService, type GoalWithDetails } from '../../../goals/index.js';\nimport type { WorkflowRunSummary } from '../../../workflows/domain/index.js';\nimport { WorkItemService } from '../../../work-items/index.js';\nimport { decideConnectorApproval, listConnectorApprovals } from '../../../storage/sqlite/index.js';\nimport type { AuthenticatedRouteDeps } from './deps.js';\n\ntype HomeDecisionKind = 'work_item' | 'goal' | 'workflow_run' | 'automation_run' | 'connector_approval' | 'goal_evidence';\ntype HomeDecisionReason =\n | 'needs_input'\n | 'in_review'\n | 'blocked'\n | 'overdue'\n | 'due_soon'\n | 'run_failed'\n | 'approval_required';\n\ntype HomeDecision = {\n id: string;\n kind: HomeDecisionKind;\n title: string;\n detail?: string;\n reason: HomeDecisionReason;\n urgency: 'now' | 'soon';\n href: string;\n projectId?: string;\n projectName?: string;\n updatedAt: number;\n response?:\n | { kind: 'connector_approval'; approvalId: string }\n | { kind: 'goal_evidence'; goalId: string; requirementId: string };\n};\n\ntype HomeBriefingWin = {\n id: string;\n kind: 'work_item' | 'workflow_run' | 'automation_run';\n title: string;\n href: string;\n completedAt: number;\n};\n\ntype HomeWorkflowRun = {\n id: string;\n definitionId: string;\n title: string;\n status: WorkflowRunSummary['status'];\n sessionKey?: string;\n createdAtMs: number;\n startedAtMs?: number;\n completedAtMs?: number;\n metrics: WorkflowRunSummary['metrics'];\n};\n\ntype HomeAutomation = {\n id: string;\n name?: string;\n trigger: string;\n action: string;\n nextRunAt: string;\n};\n\ntype HomeAutomationRun = {\n id: string;\n automationId: string;\n automationName?: string;\n status: AutomationRun['status'];\n createdAtMs: number;\n startedAtMs?: number;\n endedAtMs?: number;\n error?: string;\n summary?: string;\n sessionKey?: string;\n workflowRunId?: string;\n};\n\nfunction workItemAttentionRank(item: { status: string; dueAt?: number; priority: string; updatedAt: number }, nowMs: number): number {\n if (item.status === 'needs_input' || item.status === 'in_review' || item.status === 'blocked') return 0;\n if (item.dueAt != null && item.dueAt < nowMs) return 1;\n if (item.dueAt != null && item.dueAt < nowMs + 24 * 60 * 60 * 1000) return 2;\n if (item.priority === 'urgent') return 3;\n return 4;\n}\n\nfunction toHomeWorkItem(\n item: {\n id: string;\n projectId: string;\n title: string;\n status: string;\n priority: string;\n nextAction?: string;\n blockedReason?: string;\n dueAt?: number;\n completedAt?: number;\n updatedAt: number;\n },\n projectName: string,\n) {\n return {\n id: item.id,\n projectId: item.projectId,\n projectName,\n title: item.title,\n status: item.status,\n priority: item.priority,\n nextAction: item.nextAction,\n blockedReason: item.blockedReason,\n dueAt: item.dueAt,\n completedAt: item.completedAt,\n updatedAt: item.updatedAt,\n };\n}\n\nfunction toHomeWorkflowRun(run: WorkflowRunSummary): HomeWorkflowRun {\n return {\n id: run.id,\n definitionId: run.definitionId,\n title: run.title,\n status: run.status,\n sessionKey: run.metadata?.sessionKey,\n createdAtMs: run.createdAtMs,\n startedAtMs: run.startedAtMs,\n completedAtMs: run.completedAtMs,\n metrics: run.metrics,\n };\n}\n\nfunction triggerLabel(automation: Automation): string {\n const trigger = automation.trigger;\n if (trigger.kind === 'manual') return 'manual';\n if (trigger.kind === 'webhook') return 'webhook';\n if (trigger.kind === 'event') return `event:${trigger.eventType}`;\n const schedule = trigger.schedule;\n if (schedule.kind === 'once') return schedule.at;\n if (schedule.kind === 'interval') return `every ${Math.round(schedule.everyMs / 60000)} minutes`;\n return schedule.expr;\n}\n\nfunction actionLabel(automation: Automation): string {\n if (automation.action.kind === 'workflow') return `workflow:${automation.action.workflowId}`;\n return automation.action.agentId ? `agent:${automation.action.agentId}` : 'agent';\n}\n\nfunction toHomeAutomation(automation: Automation): HomeAutomation | null {\n if (!automation.enabled || !automation.state.nextRunAtMs) return null;\n return {\n id: automation.id,\n name: automation.name,\n trigger: triggerLabel(automation),\n action: actionLabel(automation),\n nextRunAt: new Date(automation.state.nextRunAtMs).toISOString(),\n };\n}\n\nfunction toHomeAutomationRun(run: AutomationRun): HomeAutomationRun {\n return {\n id: run.id,\n automationId: run.automationId,\n automationName: run.automationName,\n status: run.status,\n createdAtMs: run.createdAtMs,\n startedAtMs: run.startedAtMs,\n endedAtMs: run.endedAtMs,\n error: run.error,\n summary: run.summary,\n sessionKey: run.sessionKey,\n workflowRunId: run.workflowRunId,\n };\n}\n\nfunction decisionFromGoal(goal: GoalWithDetails, projectName?: string): HomeDecision | null {\n if (goal.status !== 'needs_input' && goal.status !== 'blocked') return null;\n return {\n id: `goal:${goal.id}`,\n kind: 'goal',\n title: goal.title,\n detail: goal.blockedReason || goal.nextAction,\n reason: goal.status,\n urgency: 'now',\n href: `/goals/${encodeURIComponent(goal.id)}`,\n projectId: goal.projectId,\n projectName,\n updatedAt: goal.updatedAt,\n };\n}\n\nfunction decisionFromWorkItem(\n item: Parameters<typeof toHomeWorkItem>[0],\n projectName: string,\n nowMs: number,\n): HomeDecision | null {\n let reason: HomeDecisionReason | undefined;\n let urgency: HomeDecision['urgency'] = 'now';\n if (item.status === 'needs_input' || item.status === 'in_review' || item.status === 'blocked') {\n reason = item.status;\n } else if (item.dueAt != null && item.dueAt < nowMs) {\n reason = 'overdue';\n } else if (item.dueAt != null && item.dueAt < nowMs + 24 * 60 * 60 * 1000) {\n reason = 'due_soon';\n urgency = 'soon';\n }\n if (!reason) return null;\n return {\n id: `work:${item.id}`,\n kind: 'work_item',\n title: item.title,\n detail: item.blockedReason || item.nextAction,\n reason,\n urgency,\n href: `/work-items/${encodeURIComponent(item.id)}`,\n projectId: item.projectId,\n projectName,\n updatedAt: item.updatedAt,\n };\n}\n\nexport function buildHomeBriefing(input: {\n locale?: string;\n decisions: HomeDecision[];\n activeWorkCount: number;\n activeWorkflowCount: number;\n activeGoalCount: number;\n wins: HomeBriefingWin[];\n nextScheduled?: HomeAutomation;\n nowMs: number;\n}) {\n const isChinese = input.locale?.toLowerCase().startsWith('zh') ?? false;\n const movingCount = input.activeWorkCount + input.activeWorkflowCount + input.activeGoalCount;\n const summary = input.decisions.length > 0\n ? isChinese\n ? `有 ${input.decisions.length} 件事等你决定;我正在继续推进 ${movingCount} 件工作。`\n : `${input.decisions.length} ${input.decisions.length === 1 ? 'item needs' : 'items need'} your decision; I’m continuing ${movingCount} in the background.`\n : movingCount > 0\n ? isChinese\n ? `目前没有事情需要你处理;我正在继续推进 ${movingCount} 件工作。`\n : `Nothing needs you right now; I’m continuing ${movingCount} ${movingCount === 1 ? 'item' : 'items'} in the background.`\n : isChinese\n ? '今天还没有正在推进的事项。把想要的结果交给我,我会从这里开始。'\n : 'Nothing is moving yet today. Hand me an outcome and I’ll take it from here.';\n return {\n generatedAt: input.nowMs,\n summary,\n focus: input.decisions.slice(0, 3),\n progress: {\n activeWorkCount: input.activeWorkCount,\n activeWorkflowCount: input.activeWorkflowCount,\n activeGoalCount: input.activeGoalCount,\n movingCount,\n },\n wins: input.wins.slice(0, 5),\n nextScheduled: input.nextScheduled,\n };\n}\n\n/**\n * GET /api/home — Aggregated data for the user's cross-project work home.\n *\n * Returns:\n * - recentlyOpened: notes sorted by lastOpenedAt (continue rail)\n * - inboxCount: number of notes with status === 'inbox'\n * - pendingTasks: task notes where done === false\n * - recentSessions: last 5 active AI sessions (threads)\n * - activeAgent: default agent identity for this gateway\n * - gateway: readiness + public tunnel status\n * - workflowRuns: active / attention / recent workflow runs\n * - upcomingAutomations: upcoming enabled automations\n * - recentAutomationRuns: latest automation executions\n */\nexport function registerHomeRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void {\n const { service } = deps;\n const goals = new GoalService();\n\n authenticated.get('/api/home', async (c) => {\n const notes = service.notesServiceInstance;\n const sessions = service.sessions;\n const agents = await listGatewayAgents(service.currentConfig);\n const defaultAgent = agents.agents.find((agent) => agent.id === agents.defaultId) ?? agents.agents[0];\n const workflowRunService = service.createWorkflowRunService();\n const workflowRunStore = workflowRunService.createRunStore(defaultAgent?.id ?? agents.defaultId);\n const tunnel = getTunnelService().getStatus();\n const health = service.getHealth();\n const workItems = new WorkItemService();\n const nowMs = Date.now();\n\n const [\n recentlyOpened,\n inbox,\n pendingTasks,\n recentSessions,\n workflowRuns,\n automations,\n automationRuns,\n projects,\n allWorkItems,\n activeGoals,\n connectorApprovals,\n ] = await Promise.all([\n notes.listNotes({ sortBy: 'lastOpenedAt', sortOrder: 'desc', limit: 10 }),\n notes.listNotes({ status: 'inbox', limit: 0 }),\n notes.listNotes({ pendingTasksOnly: true, sortBy: 'createdAt', sortOrder: 'desc', limit: 10 }),\n sessions.listSessions({ sortBy: 'updatedAt', sortOrder: 'desc', limit: 5 }),\n workflowRunStore.listRunSummaries(20),\n service.automationServiceInstance.list(),\n service.automationServiceInstance.listRuns({ limit: 10 }),\n service.projects.list({ limit: 500 }),\n Promise.resolve(workItems.listWorkItems({ limit: 100 })),\n Promise.resolve(goals.list({ status: ['active', 'blocked', 'needs_input', 'paused'], limit: 100 })),\n Promise.resolve(listConnectorApprovals({ principalId: 'local-owner', status: 'pending', limit: 100 })),\n ]);\n const projectsById = new Map(projects.items.map((project) => [project.id, project]));\n const activeWorkItems = allWorkItems.items\n .filter((item) => item.status !== 'done' && item.status !== 'cancelled')\n .sort((left, right) => {\n const rank = workItemAttentionRank(left, nowMs) - workItemAttentionRank(right, nowMs);\n return rank || right.updatedAt - left.updatedAt;\n });\n const attentionWorkItems = activeWorkItems\n .filter((item) => workItemAttentionRank(item, nowMs) < 4)\n .slice(0, 8)\n .map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? 'Project'));\n const currentWorkItems = activeWorkItems\n .slice(0, 30)\n .map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? 'Project'));\n const recentlyCompletedWorkItems = allWorkItems.items\n .filter((item) => item.status === 'done')\n .sort((left, right) => (right.completedAt ?? right.updatedAt) - (left.completedAt ?? left.updatedAt))\n .slice(0, 8)\n .map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? 'Project'));\n\n const activeWorkflowRuns = workflowRuns\n .filter((run) => run.status === 'queued' || run.status === 'running')\n .slice(0, 5)\n .map(toHomeWorkflowRun);\n const attentionWorkflowRuns = workflowRuns\n .filter((run) => run.status === 'failed' || run.status === 'timeout')\n .slice(0, 5)\n .map(toHomeWorkflowRun);\n const recentWorkflowRuns = workflowRuns.slice(0, 5).map(toHomeWorkflowRun);\n const upcomingAutomations = automations\n .map(toHomeAutomation)\n .filter((automation): automation is HomeAutomation => Boolean(automation))\n .sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt))\n .slice(0, 5);\n const latestAutomationRuns = [...automationRuns]\n .sort((left, right) => right.createdAtMs - left.createdAtMs)\n .filter((run, index, all) => all.findIndex((candidate) => candidate.automationId === run.automationId) === index);\n const decisions: HomeDecision[] = [\n ...activeWorkItems\n .map((item) => decisionFromWorkItem(item, projectsById.get(item.projectId)?.name ?? 'Project', nowMs))\n .filter((item): item is HomeDecision => Boolean(item)),\n ...activeGoals\n .map((goal) => decisionFromGoal(goal, goal.projectId ? projectsById.get(goal.projectId)?.name : undefined))\n .filter((item): item is HomeDecision => Boolean(item)),\n ...attentionWorkflowRuns.map((run): HomeDecision => ({\n id: `workflow:${run.id}`,\n kind: 'workflow_run',\n title: run.title,\n detail: run.status,\n reason: 'run_failed',\n urgency: 'now',\n href: `/workflows?runId=${encodeURIComponent(run.id)}`,\n updatedAt: run.completedAtMs ?? run.startedAtMs ?? run.createdAtMs,\n })),\n ...latestAutomationRuns\n .filter((run) => run.status === 'failed' || run.status === 'timeout')\n .map((run): HomeDecision => ({\n id: `automation:${run.id}`,\n kind: 'automation_run',\n title: run.automationName || run.automationId,\n detail: run.error || run.summary,\n reason: 'run_failed',\n urgency: 'now',\n href: '/automations',\n updatedAt: run.endedAtMs ?? run.startedAtMs ?? run.createdAtMs,\n })),\n ...connectorApprovals\n .filter((approval) => Date.parse(approval.expiresAt) > nowMs)\n .map((approval): HomeDecision => ({\n id: `connector-approval:${approval.id}`,\n kind: 'connector_approval',\n title: approval.actionId,\n detail: `${approval.connectorId} · ${approval.scope}`,\n reason: 'approval_required',\n urgency: 'now',\n href: '/connectors',\n updatedAt: Date.parse(approval.createdAt),\n response: { kind: 'connector_approval', approvalId: approval.id },\n })),\n ...activeGoals.flatMap((goal) => goal.evidenceRequirements\n .filter((requirement) => requirement.requiresHumanApproval\n && requirement.evidenceIds.length > 0\n && (requirement.status === 'pending' || requirement.status === 'ai_verified'))\n .map((requirement): HomeDecision => ({\n id: `goal-evidence:${requirement.id}`,\n kind: 'goal_evidence',\n title: goal.title,\n detail: requirement.text,\n reason: 'approval_required',\n urgency: 'now',\n href: `/goals/${encodeURIComponent(goal.id)}`,\n projectId: goal.projectId,\n projectName: goal.projectId ? projectsById.get(goal.projectId)?.name : undefined,\n updatedAt: requirement.updatedAt,\n response: { kind: 'goal_evidence', goalId: goal.id, requirementId: requirement.id },\n }))),\n ]\n .sort((left, right) => {\n const urgency = (left.urgency === 'now' ? 0 : 1) - (right.urgency === 'now' ? 0 : 1);\n return urgency || right.updatedAt - left.updatedAt;\n })\n .slice(0, 20);\n const wins: HomeBriefingWin[] = [\n ...recentlyCompletedWorkItems.map((item): HomeBriefingWin => ({\n id: `work:${item.id}`,\n kind: 'work_item',\n title: item.title,\n href: `/work-items/${encodeURIComponent(item.id)}`,\n completedAt: item.completedAt ?? item.updatedAt,\n })),\n ...workflowRuns\n .filter((run) => run.status === 'succeeded')\n .map((run): HomeBriefingWin => ({\n id: `workflow:${run.id}`,\n kind: 'workflow_run',\n title: run.title,\n href: `/workflows?runId=${encodeURIComponent(run.id)}`,\n completedAt: run.completedAtMs ?? run.createdAtMs,\n })),\n ...latestAutomationRuns\n .filter((run) => run.status === 'succeeded')\n .map((run): HomeBriefingWin => ({\n id: `automation:${run.id}`,\n kind: 'automation_run',\n title: run.automationName || run.automationId,\n href: '/automations',\n completedAt: run.endedAtMs ?? run.createdAtMs,\n })),\n ].sort((left, right) => right.completedAt - left.completedAt);\n const briefing = buildHomeBriefing({\n locale: c.req.query('locale'),\n decisions,\n activeWorkCount: activeWorkItems.filter((item) => item.status === 'in_progress').length,\n activeWorkflowCount: activeWorkflowRuns.length,\n activeGoalCount: activeGoals.filter((goal) => goal.status === 'active').length,\n wins,\n nextScheduled: upcomingAutomations[0],\n nowMs,\n });\n\n return c.json({\n recentlyOpened: recentlyOpened.items.filter((n) => n.lastOpenedAt),\n inboxCount: inbox.total,\n pendingTasks: pendingTasks.items,\n pendingTaskCount: pendingTasks.total,\n recentSessions: recentSessions.items,\n activeAgent: defaultAgent\n ? {\n id: defaultAgent.id,\n name: defaultAgent.name,\n description: defaultAgent.description,\n }\n : { id: agents.defaultId },\n gateway: {\n status: health.status,\n ready: health.ready,\n httpListening: health.httpListening,\n version: health.version,\n uptime: health.uptime,\n tunnel: {\n state: tunnel.state,\n publicUrl: tunnel.publicUrl,\n connected: tunnel.state === 'connected',\n },\n },\n workflowRuns: {\n active: activeWorkflowRuns,\n attention: attentionWorkflowRuns,\n recent: recentWorkflowRuns,\n },\n briefing,\n decisions,\n work: {\n attentionCount: activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 3).length,\n overdueCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt < nowMs).length,\n todayCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt >= nowMs && item.dueAt < nowMs + 24 * 60 * 60 * 1000).length,\n items: attentionWorkItems,\n current: currentWorkItems,\n recentlyCompleted: recentlyCompletedWorkItems,\n },\n upcomingAutomations,\n recentAutomationRuns: automationRuns.slice(0, 5).map(toHomeAutomationRun),\n });\n });\n\n authenticated.post('/api/home/decisions/respond', deps.strictRateLimitMiddleware, async (c) => {\n const body = await c.req.json().catch(() => ({})) as Record<string, unknown>;\n const decision = body.decision === 'approve' ? 'approve' : body.decision === 'deny' ? 'deny' : undefined;\n if (!decision) return c.json({ ok: false, error: 'Decision must be approve or deny' }, 400);\n if (body.kind === 'connector_approval' && typeof body.approvalId === 'string') {\n const approval = decideConnectorApproval(body.approvalId, decision === 'approve' ? 'approved' : 'denied');\n if (!approval) return c.json({ ok: false, error: 'Approval not found' }, 404);\n if (approval.status !== (decision === 'approve' ? 'approved' : 'denied')) {\n return c.json({ ok: false, error: `Approval is ${approval.status}` }, 409);\n }\n return c.json({ ok: true, status: approval.status });\n }\n if (body.kind === 'goal_evidence' && typeof body.goalId === 'string' && typeof body.requirementId === 'string') {\n const goal = goals.get(body.goalId);\n const requirement = goal?.evidenceRequirements.find((item) => item.id === body.requirementId);\n if (!goal || !requirement) return c.json({ ok: false, error: 'Evidence approval not found' }, 404);\n if (requirement.evidenceIds.length === 0) return c.json({ ok: false, error: 'Evidence is missing' }, 409);\n const updated = goals.reviewEvidenceRequirement({\n goalId: goal.id,\n requirementId: requirement.id,\n status: decision === 'approve' ? 'approved' : 'rejected',\n reason: decision === 'approve' ? 'Approved from the decision inbox.' : 'Rejected from the decision inbox.',\n reviewedBy: 'user',\n });\n return c.json({ ok: true, status: updated?.status });\n }\n return c.json({ ok: false, error: 'Unsupported decision kind' }, 400);\n });\n}\n"],"mappings":";;;;;;;;;;AA+EA,SAAS,sBAAsB,MAA+E,OAAuB;AACnI,KAAI,KAAK,WAAW,iBAAiB,KAAK,WAAW,eAAe,KAAK,WAAW,UAAW,QAAO;AACtG,KAAI,KAAK,SAAS,QAAQ,KAAK,QAAQ,MAAO,QAAO;AACrD,KAAI,KAAK,SAAS,QAAQ,KAAK,QAAQ,QAAQ,OAAU,KAAK,IAAM,QAAO;AAC3E,KAAI,KAAK,aAAa,SAAU,QAAO;AACvC,QAAO;;AAGT,SAAS,eACP,MAYA,aACA;AACA,QAAO;EACL,IAAI,KAAK;EACT,WAAW,KAAK;EAChB;EACA,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,UAAU,KAAK;EACf,YAAY,KAAK;EACjB,eAAe,KAA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OAAO,KAAK,kBAAkB,UAAU;GAC9G,MAAM,OAAO,MAAM,IAAI,KAAK,OAAO;GACnC,MAAM,cAAc,MAAM,qBAAqB,MAAM,SAAS,KAAK,OAAO,KAAK,cAAc;AAC7F,OAAI,CAAC,QAAQ,CAAC,YAAa,QAAO,EAAE,KAAK;IAAE,IAAI;IAAO,OAAO;IAA+B,EAAE,IAAI;AAClG,OAAI,YAAY,YAAY,WAAW,EAAG,QAAO,EAAE,KAAK;IAAE,IAAI;IAAO,OAAO;IAAuB,EAAE,IAAI;GACzG,MAAM,UAAU,MAAM,0BAA0B;IAC9C,QAAQ,KAAK;IACb,eAAe,YAAY;IAC3B,QAAQ,aAAa,YAAY,aAAa;IAC9C,QAAQ,aAAa,YAAY,sCAAsC;IACvE,YAAY;IACb,CAAC;AACF,UAAO,EAAE,KAAK;IAAE,IAAI;IAAM,QAAQ,SAAS;IAAQ,CAAC;;AAEtD,SAAO,EAAE,KAAK;GAAE,IAAI;GAAO,OAAO;GAA6B,EAAE,IAAI;GACrE"}
|
|
@@ -261,6 +261,14 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
261
261
|
return { register: registerVoiceRoutes };
|
|
262
262
|
}
|
|
263
263
|
},
|
|
264
|
+
{
|
|
265
|
+
id: "you",
|
|
266
|
+
match: (path) => startsWithAny(path, ["/api/you"]),
|
|
267
|
+
load: async () => {
|
|
268
|
+
const { registerYouRoutes } = await import("./you.js");
|
|
269
|
+
return { register: registerYouRoutes };
|
|
270
|
+
}
|
|
271
|
+
},
|
|
264
272
|
{
|
|
265
273
|
id: "connectors",
|
|
266
274
|
match: (path) => startsWithAny(path, ["/api/connectors"]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-bundles.js","names":[],"sources":["../../../../../src/gateway/hono/routes/lazy-bundles.ts"],"sourcesContent":["import type { Hono } from 'hono';\n\nimport type { GatewayService } from '../../service.js';\nimport type { AuthenticatedRouteDeps } from './deps.js';\n\nexport type AuthenticatedLazyRouteBundle = {\n id: string;\n match: (path: string) => boolean;\n load: () => Promise<{ register: (authenticated: Hono, deps: AuthenticatedRouteDeps) => void }>;\n};\n\nexport type AppLazyRouteBundle = {\n id: string;\n prefixes: readonly string[];\n match: (path: string) => boolean;\n load: () => Promise<{\n registerOnApp: (app: Hono, service: GatewayService) => void;\n }>;\n};\n\nfunction startsWithAny(path: string, prefixes: readonly string[]): boolean {\n return prefixes.some((prefix) => path === prefix || path.startsWith(`${prefix}/`));\n}\n\nexport const AUTHENTICATED_LAZY_ROUTE_BUNDLES: readonly AuthenticatedLazyRouteBundle[] = [\n {\n id: 'media',\n match: (path) => startsWithAny(path, ['/api/media']),\n load: async () => {\n const { registerMediaRoutes } = await import('./media.js');\n return { register: registerMediaRoutes };\n },\n },\n {\n id: 'workspace',\n match: (path) => startsWithAny(path, ['/api/workspace']),\n load: async () => {\n const { registerWorkspaceRoutes } = await import('./workspace.js');\n return { register: registerWorkspaceRoutes };\n },\n },\n {\n id: 'host-fs',\n match: (path) => startsWithAny(path, ['/api/host/fs']),\n load: async () => {\n const { registerHostFsRoutes } = await import('./host-fs.js');\n return { register: registerHostFsRoutes };\n },\n },\n {\n id: 'channels',\n match: (path) => startsWithAny(path, ['/api/channels']),\n load: async () => {\n const { registerChannelRoutes } = await import('./channels.js');\n return { register: registerChannelRoutes };\n },\n },\n {\n id: 'browser-install',\n match: (path) =>\n path === '/api/browser/playwright/install/stream' ||\n path === '/api/browser/cloakbrowser/install/stream',\n load: async () => {\n const { registerBrowserInstallRoutes } = await import('./browser-install.js');\n return { register: registerBrowserInstallRoutes };\n },\n },\n {\n id: 'browser',\n // `browser-install` above already matched the SSE install streams; this\n // catches the remaining /api/browser/* handlers (extension, cdp,\n // cloakbrowser doctor/launch/install, playwright doctor/install, cloud).\n match: (path) => startsWithAny(path, ['/api/browser']),\n load: async () => {\n const { registerBrowserRoutes } = await import('./browser.js');\n return { register: registerBrowserRoutes };\n },\n },\n {\n id: 'config',\n match: (path) =>\n startsWithAny(path, [\n '/api/config',\n '/api/heartbeat/trigger',\n // Secret reveal handlers live in config routes but use /api/gateway and\n // /api/tools paths; without these prefixes the extension-gateway bundle\n // matches first and returns 404 (no handler for multi-segment paths).\n '/api/gateway/reveal-auth-secret',\n '/api/tools/web/reveal-search-api-key',\n ]),\n load: async () => {\n const { registerConfigRoutes } = await import('./config.js');\n return { register: registerConfigRoutes };\n },\n },\n {\n id: 'doctor',\n match: (path) => startsWithAny(path, ['/api/doctor', '/api/migrations']),\n load: async () => {\n const { registerDoctorRoutes } = await import('./doctor.js');\n const { registerMigrationRoutes } = await import('./migrations.js');\n return {\n register: (authenticated, deps) => {\n registerDoctorRoutes(authenticated, deps);\n registerMigrationRoutes(authenticated, deps);\n },\n };\n },\n },\n {\n id: 'dreaming',\n match: (path) => startsWithAny(path, ['/api/dreaming']),\n load: async () => {\n const { registerDreamingRoutes } = await import('./dreaming.js');\n return { register: registerDreamingRoutes };\n },\n },\n {\n id: 'agents',\n match: (path) => startsWithAny(path, ['/api/agents', '/api/user-profile', '/api/voice/models']),\n load: async () => {\n const { registerAgentsRoutes } = await import('./agents.js');\n return { register: registerAgentsRoutes };\n },\n },\n {\n id: 'capability-presets',\n match: (path) => startsWithAny(path, ['/api/capability-presets', '/api/global-defaults']),\n load: async () => {\n const { registerCapabilityPresetsRoutes } = await import('./capability-presets.js');\n const { registerGlobalDefaultsRoutes } = await import('./global-defaults.js');\n return {\n register: (authenticated, deps) => {\n registerCapabilityPresetsRoutes(authenticated, deps);\n registerGlobalDefaultsRoutes(authenticated, deps);\n },\n };\n },\n },\n {\n id: 'auth-registry-extensions',\n match: (path) =>\n startsWithAny(path, [\n '/api/auth',\n '/api/registry',\n '/api/extensions',\n '/api/context',\n '/api/marketplace',\n ]),\n load: async () => {\n const { registerAuthRegistryExtensionsRoutes } = await import('./auth-registry-extensions.js');\n return { register: registerAuthRegistryExtensionsRoutes };\n },\n },\n {\n id: 'models',\n match: (path) =>\n startsWithAny(path, ['/api/models', '/api/models-json', '/api/providers', '/api/image']),\n load: async () => {\n const { registerModelsRoutes } = await import('./models.js');\n return { register: registerModelsRoutes };\n },\n },\n {\n id: 'ai-assist',\n match: (path) => startsWithAny(path, ['/api/ai']),\n load: async () => {\n const { registerAiAssistRoutes } = await import('./ai-assist.js');\n return { register: registerAiAssistRoutes };\n },\n },\n {\n id: 'commands-skills',\n match: (path) =>\n startsWithAny(path, [\n '/api/commands',\n '/api/review',\n '/api/skills',\n '/api/chat/skills',\n '/api/chat/capabilities',\n ]),\n load: async () => {\n const { registerCommandsSkillsRoutes } = await import('./commands-skills.js');\n return { register: registerCommandsSkillsRoutes };\n },\n },\n {\n id: 'automations',\n match: (path) => startsWithAny(path, ['/api/automations', '/api/automation-runs']),\n load: async () => {\n const { registerAutomationRoutes } = await import('../../../automations/api/routes.js');\n return { register: registerAutomationRoutes };\n },\n },\n {\n id: 'goals',\n match: (path) => startsWithAny(path, ['/api/goals']),\n load: async () => {\n const { registerGoalsRoutes } = await import('./goals.js');\n return { register: registerGoalsRoutes };\n },\n },\n {\n id: 'notes',\n match: (path) => startsWithAny(path, ['/api/notes']),\n load: async () => {\n const { registerNotesRoutes } = await import('./notes.js');\n return { register: registerNotesRoutes };\n },\n },\n {\n id: 'home',\n match: (path) => startsWithAny(path, ['/api/home']),\n load: async () => {\n const { registerHomeRoutes } = await import('./home.js');\n return { register: registerHomeRoutes };\n },\n },\n {\n id: 'workflows',\n match: (path) => startsWithAny(path, ['/api/workflows']),\n load: async () => {\n const { registerWorkflowRoutes } = await import('./workflows.js');\n return { register: registerWorkflowRoutes };\n },\n },\n {\n id: 'logs',\n match: (path) => startsWithAny(path, ['/api/logs']),\n load: async () => {\n const { registerLogsRoutes } = await import('./logs.js');\n return { register: registerLogsRoutes };\n },\n },\n {\n id: 'shares',\n match: (path) => startsWithAny(path, ['/api/shares']),\n load: async () => {\n const { registerShareRoutes } = await import('./shares.js');\n return { register: registerShareRoutes };\n },\n },\n {\n id: 'site-shares',\n match: (path) => startsWithAny(path, ['/api/site-shares']),\n load: async () => {\n const { registerSiteShareRoutes } = await import('./site-shares.js');\n return { register: registerSiteShareRoutes };\n },\n },\n {\n id: 'tunnel',\n match: (path) => startsWithAny(path, ['/api/tunnel']),\n load: async () => {\n const { registerTunnelRoutes } = await import('./tunnel.js');\n return { register: registerTunnelRoutes };\n },\n },\n {\n id: 'exposure',\n match: (path) => startsWithAny(path, ['/api/exposure']),\n load: async () => {\n const { registerExposureRoutes } = await import('./exposure.js');\n return { register: registerExposureRoutes };\n },\n },\n {\n id: 'extension-gateway',\n match: (path) => startsWithAny(path, ['/api/gateway']),\n load: async () => {\n const { registerExtensionGatewayRoutes } = await import('./extension-gateway.js');\n return { register: registerExtensionGatewayRoutes };\n },\n },\n {\n id: 'update',\n match: (path) => startsWithAny(path, ['/api/update']),\n load: async () => {\n const { registerUpdateRoutes } = await import('./update.js');\n return { register: registerUpdateRoutes };\n },\n },\n {\n id: 'voice',\n match: (path) => startsWithAny(path, ['/api/voice']) && path !== '/api/voice/models',\n load: async () => {\n const { registerVoiceRoutes } = await import('./voice.js');\n return { register: registerVoiceRoutes };\n },\n },\n {\n id: 'connectors',\n match: (path) => startsWithAny(path, ['/api/connectors']),\n load: async () => {\n const { registerConnectorRoutes } = await import('./connectors.js');\n return { register: registerConnectorRoutes };\n },\n },\n {\n id: 'capabilities',\n match: (path) => startsWithAny(path, ['/api/capabilities']),\n load: async () => {\n const { registerCapabilityRoutes } = await import('./capabilities.js');\n return { register: registerCapabilityRoutes };\n },\n },\n {\n id: 'tui',\n match: (path) => startsWithAny(path, ['/api/tui']),\n load: async () => {\n const { registerTuiRoutes } = await import('./tui.js');\n return { register: registerTuiRoutes };\n },\n },\n {\n id: 'mcp',\n match: (path) => startsWithAny(path, ['/api/mcp']),\n load: async () => {\n const { registerMcpRoutes } = await import('./mcp.js');\n return { register: registerMcpRoutes };\n },\n },\n];\n\nexport const APP_LAZY_ROUTE_BUNDLES: readonly AppLazyRouteBundle[] = [\n {\n id: 'shares-public',\n prefixes: ['/s'],\n match: (path) => startsWithAny(path, ['/s']),\n load: async () => {\n const { registerSharePublicRoutes } = await import('./shares.js');\n return { registerOnApp: registerSharePublicRoutes };\n },\n },\n {\n id: 'tunnel-public',\n prefixes: [\n '/api/tunnel/pair/ping',\n '/api/tunnel/pair/validate-url',\n '/api/tunnel/exchange-token',\n ],\n match: (path) =>\n path === '/api/tunnel/exchange-token' ||\n path === '/api/tunnel/pair/ping' ||\n path === '/api/tunnel/pair/validate-url',\n load: async () => {\n const { registerTunnelPublicRoutes } = await import('./tunnel.js');\n return { registerOnApp: registerTunnelPublicRoutes };\n },\n },\n];\n\nexport function findAuthenticatedLazyRouteBundle(path: string): AuthenticatedLazyRouteBundle | undefined {\n return AUTHENTICATED_LAZY_ROUTE_BUNDLES.find((bundle) => bundle.match(path));\n}\n"],"mappings":";AAoBA,SAAS,cAAc,MAAc,UAAsC;AACzE,QAAO,SAAS,MAAM,WAAW,SAAS,UAAU,KAAK,WAAW,GAAG,OAAO,GAAG,CAAC;;AAGpF,MAAa,mCAA4E;CACvF;EACE,IAAI;EACJ,QAAQ,SAAS,cAAc,MAAM,CAAC,aAAa,CAAC;EACpD,MAAM,YAAY;GAChB,MAAM,EAAE,wBAAwB,MAAM,OAAO;AAC7C,UAAO,EAAE,UAAU,qBAAqB;;EAE3C;CACD;EACE,IAAI;EACJ,QAAQ,SAAS,cAAc,MAAM,CAAC,iBAAiB,CAAC;EACxD,MAAM,YAAY;GAChB,MAAM,EAAE,4BAA4B,MAAM,OAAO;AACjD,UAAO,EAAE,UAAU,yBAAyB;;EAE/C;CACD;EACE,IAAI;EACJ,QAAQ,SAAS,cAAc,MAAM,CAAC,eAAe,CAAC;EACtD,MAAM,YAAY;GAChB,MAAM,EAAE,yBAAyB,MAAM,OAAO;AAC9C,UAAO,EAAE,UAAU,sBAAsB;;EAE5C;CACD;EACE,IAAI;EACJ,QAAQ,SAAS,cAAc,MAAM,CAAC,gBAAgB,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MAAM,EAAE,sBAAsB,MAAM,OAAO;AAC3C,UAAO,EAAE,UAAU,mBAAmB;;EAEzC;CACF;AAED,MAAa,yBAAwD,CACnE;CACE,IAAI;CACJ,UAAU,CAAC,KAAK;CAChB,QAAQ,SAAS,cAAc,MAAM,CAAC,KAAK,CAAC;CAC5C,MAAM,YAAY;EAChB,MAAM,EAAE,8BAA8B,MAAM,OAAO;AACnD,SAAO,EAAE,eAAe,2BAA2B;;CAEtD,EACD;CACE,IAAI;CACJ,UAAU;EACR;EACA;EACA;EACD;CACD,QAAQ,SACN,SAAS,gCACT,SAAS,2BACT,SAAS;CACX,MAAM,YAAY;EAChB,MAAM,EAAE,+BAA+B,MAAM,OAAO;AACpD,SAAO,EAAE,eAAe,4BAA4B;;CAEvD,CACF;AAED,SAAgB,iCAAiC,MAAwD;AACvG,QAAO,iCAAiC,MAAM,WAAW,OAAO,MAAM,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"lazy-bundles.js","names":[],"sources":["../../../../../src/gateway/hono/routes/lazy-bundles.ts"],"sourcesContent":["import type { Hono } from 'hono';\n\nimport type { GatewayService } from '../../service.js';\nimport type { AuthenticatedRouteDeps } from './deps.js';\n\nexport type AuthenticatedLazyRouteBundle = {\n id: string;\n match: (path: string) => boolean;\n load: () => Promise<{ register: (authenticated: Hono, deps: AuthenticatedRouteDeps) => void }>;\n};\n\nexport type AppLazyRouteBundle = {\n id: string;\n prefixes: readonly string[];\n match: (path: string) => boolean;\n load: () => Promise<{\n registerOnApp: (app: Hono, service: GatewayService) => void;\n }>;\n};\n\nfunction startsWithAny(path: string, prefixes: readonly string[]): boolean {\n return prefixes.some((prefix) => path === prefix || path.startsWith(`${prefix}/`));\n}\n\nexport const AUTHENTICATED_LAZY_ROUTE_BUNDLES: readonly AuthenticatedLazyRouteBundle[] = [\n {\n id: 'media',\n match: (path) => startsWithAny(path, ['/api/media']),\n load: async () => {\n const { registerMediaRoutes } = await import('./media.js');\n return { register: registerMediaRoutes };\n },\n },\n {\n id: 'workspace',\n match: (path) => startsWithAny(path, ['/api/workspace']),\n load: async () => {\n const { registerWorkspaceRoutes } = await import('./workspace.js');\n return { register: registerWorkspaceRoutes };\n },\n },\n {\n id: 'host-fs',\n match: (path) => startsWithAny(path, ['/api/host/fs']),\n load: async () => {\n const { registerHostFsRoutes } = await import('./host-fs.js');\n return { register: registerHostFsRoutes };\n },\n },\n {\n id: 'channels',\n match: (path) => startsWithAny(path, ['/api/channels']),\n load: async () => {\n const { registerChannelRoutes } = await import('./channels.js');\n return { register: registerChannelRoutes };\n },\n },\n {\n id: 'browser-install',\n match: (path) =>\n path === '/api/browser/playwright/install/stream' ||\n path === '/api/browser/cloakbrowser/install/stream',\n load: async () => {\n const { registerBrowserInstallRoutes } = await import('./browser-install.js');\n return { register: registerBrowserInstallRoutes };\n },\n },\n {\n id: 'browser',\n // `browser-install` above already matched the SSE install streams; this\n // catches the remaining /api/browser/* handlers (extension, cdp,\n // cloakbrowser doctor/launch/install, playwright doctor/install, cloud).\n match: (path) => startsWithAny(path, ['/api/browser']),\n load: async () => {\n const { registerBrowserRoutes } = await import('./browser.js');\n return { register: registerBrowserRoutes };\n },\n },\n {\n id: 'config',\n match: (path) =>\n startsWithAny(path, [\n '/api/config',\n '/api/heartbeat/trigger',\n // Secret reveal handlers live in config routes but use /api/gateway and\n // /api/tools paths; without these prefixes the extension-gateway bundle\n // matches first and returns 404 (no handler for multi-segment paths).\n '/api/gateway/reveal-auth-secret',\n '/api/tools/web/reveal-search-api-key',\n ]),\n load: async () => {\n const { registerConfigRoutes } = await import('./config.js');\n return { register: registerConfigRoutes };\n },\n },\n {\n id: 'doctor',\n match: (path) => startsWithAny(path, ['/api/doctor', '/api/migrations']),\n load: async () => {\n const { registerDoctorRoutes } = await import('./doctor.js');\n const { registerMigrationRoutes } = await import('./migrations.js');\n return {\n register: (authenticated, deps) => {\n registerDoctorRoutes(authenticated, deps);\n registerMigrationRoutes(authenticated, deps);\n },\n };\n },\n },\n {\n id: 'dreaming',\n match: (path) => startsWithAny(path, ['/api/dreaming']),\n load: async () => {\n const { registerDreamingRoutes } = await import('./dreaming.js');\n return { register: registerDreamingRoutes };\n },\n },\n {\n id: 'agents',\n match: (path) => startsWithAny(path, ['/api/agents', '/api/user-profile', '/api/voice/models']),\n load: async () => {\n const { registerAgentsRoutes } = await import('./agents.js');\n return { register: registerAgentsRoutes };\n },\n },\n {\n id: 'capability-presets',\n match: (path) => startsWithAny(path, ['/api/capability-presets', '/api/global-defaults']),\n load: async () => {\n const { registerCapabilityPresetsRoutes } = await import('./capability-presets.js');\n const { registerGlobalDefaultsRoutes } = await import('./global-defaults.js');\n return {\n register: (authenticated, deps) => {\n registerCapabilityPresetsRoutes(authenticated, deps);\n registerGlobalDefaultsRoutes(authenticated, deps);\n },\n };\n },\n },\n {\n id: 'auth-registry-extensions',\n match: (path) =>\n startsWithAny(path, [\n '/api/auth',\n '/api/registry',\n '/api/extensions',\n '/api/context',\n '/api/marketplace',\n ]),\n load: async () => {\n const { registerAuthRegistryExtensionsRoutes } = await import('./auth-registry-extensions.js');\n return { register: registerAuthRegistryExtensionsRoutes };\n },\n },\n {\n id: 'models',\n match: (path) =>\n startsWithAny(path, ['/api/models', '/api/models-json', '/api/providers', '/api/image']),\n load: async () => {\n const { registerModelsRoutes } = await import('./models.js');\n return { register: registerModelsRoutes };\n },\n },\n {\n id: 'ai-assist',\n match: (path) => startsWithAny(path, ['/api/ai']),\n load: async () => {\n const { registerAiAssistRoutes } = await import('./ai-assist.js');\n return { register: registerAiAssistRoutes };\n },\n },\n {\n id: 'commands-skills',\n match: (path) =>\n startsWithAny(path, [\n '/api/commands',\n '/api/review',\n '/api/skills',\n '/api/chat/skills',\n '/api/chat/capabilities',\n ]),\n load: async () => {\n const { registerCommandsSkillsRoutes } = await import('./commands-skills.js');\n return { register: registerCommandsSkillsRoutes };\n },\n },\n {\n id: 'automations',\n match: (path) => startsWithAny(path, ['/api/automations', '/api/automation-runs']),\n load: async () => {\n const { registerAutomationRoutes } = await import('../../../automations/api/routes.js');\n return { register: registerAutomationRoutes };\n },\n },\n {\n id: 'goals',\n match: (path) => startsWithAny(path, ['/api/goals']),\n load: async () => {\n const { registerGoalsRoutes } = await import('./goals.js');\n return { register: registerGoalsRoutes };\n },\n },\n {\n id: 'notes',\n match: (path) => startsWithAny(path, ['/api/notes']),\n load: async () => {\n const { registerNotesRoutes } = await import('./notes.js');\n return { register: registerNotesRoutes };\n },\n },\n {\n id: 'home',\n match: (path) => startsWithAny(path, ['/api/home']),\n load: async () => {\n const { registerHomeRoutes } = await import('./home.js');\n return { register: registerHomeRoutes };\n },\n },\n {\n id: 'workflows',\n match: (path) => startsWithAny(path, ['/api/workflows']),\n load: async () => {\n const { registerWorkflowRoutes } = await import('./workflows.js');\n return { register: registerWorkflowRoutes };\n },\n },\n {\n id: 'logs',\n match: (path) => startsWithAny(path, ['/api/logs']),\n load: async () => {\n const { registerLogsRoutes } = await import('./logs.js');\n return { register: registerLogsRoutes };\n },\n },\n {\n id: 'shares',\n match: (path) => startsWithAny(path, ['/api/shares']),\n load: async () => {\n const { registerShareRoutes } = await import('./shares.js');\n return { register: registerShareRoutes };\n },\n },\n {\n id: 'site-shares',\n match: (path) => startsWithAny(path, ['/api/site-shares']),\n load: async () => {\n const { registerSiteShareRoutes } = await import('./site-shares.js');\n return { register: registerSiteShareRoutes };\n },\n },\n {\n id: 'tunnel',\n match: (path) => startsWithAny(path, ['/api/tunnel']),\n load: async () => {\n const { registerTunnelRoutes } = await import('./tunnel.js');\n return { register: registerTunnelRoutes };\n },\n },\n {\n id: 'exposure',\n match: (path) => startsWithAny(path, ['/api/exposure']),\n load: async () => {\n const { registerExposureRoutes } = await import('./exposure.js');\n return { register: registerExposureRoutes };\n },\n },\n {\n id: 'extension-gateway',\n match: (path) => startsWithAny(path, ['/api/gateway']),\n load: async () => {\n const { registerExtensionGatewayRoutes } = await import('./extension-gateway.js');\n return { register: registerExtensionGatewayRoutes };\n },\n },\n {\n id: 'update',\n match: (path) => startsWithAny(path, ['/api/update']),\n load: async () => {\n const { registerUpdateRoutes } = await import('./update.js');\n return { register: registerUpdateRoutes };\n },\n },\n {\n id: 'voice',\n match: (path) => startsWithAny(path, ['/api/voice']) && path !== '/api/voice/models',\n load: async () => {\n const { registerVoiceRoutes } = await import('./voice.js');\n return { register: registerVoiceRoutes };\n },\n },\n {\n id: 'you',\n match: (path) => startsWithAny(path, ['/api/you']),\n load: async () => {\n const { registerYouRoutes } = await import('./you.js');\n return { register: registerYouRoutes };\n },\n },\n {\n id: 'connectors',\n match: (path) => startsWithAny(path, ['/api/connectors']),\n load: async () => {\n const { registerConnectorRoutes } = await import('./connectors.js');\n return { register: registerConnectorRoutes };\n },\n },\n {\n id: 'capabilities',\n match: (path) => startsWithAny(path, ['/api/capabilities']),\n load: async () => {\n const { registerCapabilityRoutes } = await import('./capabilities.js');\n return { register: registerCapabilityRoutes };\n },\n },\n {\n id: 'tui',\n match: (path) => startsWithAny(path, ['/api/tui']),\n load: async () => {\n const { registerTuiRoutes } = await import('./tui.js');\n return { register: registerTuiRoutes };\n },\n },\n {\n id: 'mcp',\n match: (path) => startsWithAny(path, ['/api/mcp']),\n load: async () => {\n const { registerMcpRoutes } = await import('./mcp.js');\n return { register: registerMcpRoutes };\n },\n },\n];\n\nexport const APP_LAZY_ROUTE_BUNDLES: readonly AppLazyRouteBundle[] = [\n {\n id: 'shares-public',\n prefixes: ['/s'],\n match: (path) => startsWithAny(path, ['/s']),\n load: async () => {\n const { registerSharePublicRoutes } = await import('./shares.js');\n return { registerOnApp: registerSharePublicRoutes };\n },\n },\n {\n id: 'tunnel-public',\n prefixes: [\n '/api/tunnel/pair/ping',\n '/api/tunnel/pair/validate-url',\n '/api/tunnel/exchange-token',\n ],\n match: (path) =>\n path === '/api/tunnel/exchange-token' ||\n path === '/api/tunnel/pair/ping' ||\n path === '/api/tunnel/pair/validate-url',\n load: async () => {\n const { registerTunnelPublicRoutes } = await import('./tunnel.js');\n return { registerOnApp: registerTunnelPublicRoutes };\n },\n },\n];\n\nexport function findAuthenticatedLazyRouteBundle(path: string): AuthenticatedLazyRouteBundle | undefined {\n return AUTHENTICATED_LAZY_ROUTE_BUNDLES.find((bundle) => bundle.match(path));\n}\n"],"mappings":";AAoBA,SAAS,cAAc,MAAc,UAAsC;AACzE,QAAO,SAAS,MAAM,WAAW,SAAS,UAAU,KAAK,WAAW,GAAG,OAAO,GAAG,CAAC;;AAGpF,MAAa,mCAA4E;CACvF;EACE,IAAI;EACJ,QAAQ,SAAS,cAAc,MAAM,CAAC,aAAa,CAAC;EACpD,MAAM,YAAY;GAChB,MAAM,EAAE,wBAAwB,MAAM,OAAO;AAC7C,UAAO,EAAE,UAAU,qBAAqB;;EAE3C;CACD;EACE,IAAI;EACJ,QAAQ,SAAS,cAAc,MAAM,CAAC,iBAAiB,CAAC;EACxD,MAAM,YAAY;GAChB,MAAM,EAAE,4BAA4B,MAAM,OAAO;AACjD,UAAO,EAAE,UAAU,yBAAyB;;EAE/C;CACD;EACE,IAAI;EACJ,QAAQ,SAAS,cAAc,MAAM,CAAC,eAAe,CAAC;EACtD,MAAM,YAAY;GAChB,MAAM,EAAE,yBAAyB,MAAM,OAAO;AAC9C,UAAO,EAAE,UAAU,sBAAsB;;EAE5C;CACD;EACE,IAAI;EACJ,QAAQ,SAAS,cAAc,MAAM,CAAC,gBAAgB,CAAC;EACvD,MAAM,YAAY;GAChB,MAAM,EAAE,0BAA0B,MAAM,OAAO;AAC/C,UAAO,EAAE,UAAU,uBAAuB;;EAE7C;CACD;EACE,IAAI;EACJ,QAAQ,SACN,SAAS,4CACT,SAAS;EACX,MAAM,YAAY;GAChB,MAAM,EAAE,iCAAiC,MAAM,OAAO;AACtD,UAAO,EAAE,UAAU,8BAA8B;;EAEpD;CACD;EACE,IAAI;EAIJ,QAAQ,SAAS,cAAc,MAAM,CAAC,eAAe,CAAC;EACtD,MAAM,YAAY;GAChB,MAAM,EAAE,0BAA0B,MAAM,OAAO;AAC/C,UA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AAE,8BAA8B,MAAM,OAAO;AACnD,SAAO,EAAE,eAAe,2BAA2B;;CAEtD,EACD;CACE,IAAI;CACJ,UAAU;EACR;EACA;EACA;EACD;CACD,QAAQ,SACN,SAAS,gCACT,SAAS,2BACT,SAAS;CACX,MAAM,YAAY;EAChB,MAAM,EAAE,+BAA+B,MAAM,OAAO;AACpD,SAAO,EAAE,eAAe,4BAA4B;;CAEvD,CACF;AAED,SAAgB,iCAAiC,MAAwD;AACvG,QAAO,iCAAiC,MAAM,WAAW,OAAO,MAAM,KAAK,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { appendMemorySignal, appendMemoryTraceEvent, deleteMemoryRecord, findLatestMemoryInjectTrace, getMemoryRecord, listMemoryRecords, listMemorySignals, listMemoryTraceEvents, searchMemoryRecords, setLatestMemoryInjectFeedback, setMemoryTraceFeedback, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
|
|
2
|
-
import { listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
|
|
3
|
-
import "../../../storage/sqlite/index.js";
|
|
4
1
|
import { MemoryPolicySchema, init_schema } from "../../../agent-manifest/schema.js";
|
|
5
2
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
6
3
|
import { resolveEffectiveAgentManifestForAgent } from "../../../config/agent-profile.js";
|
|
4
|
+
import { appendMemorySignal, appendMemoryTraceEvent, deleteMemoryRecord, findLatestMemoryInjectTrace, getMemoryRecord, listMemoryRecords, listMemorySignals, listMemoryTraceEvents, searchMemoryRecords, setLatestMemoryInjectFeedback, setMemoryTraceFeedback, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
|
|
5
|
+
import { listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
|
|
6
|
+
import "../../../storage/sqlite/index.js";
|
|
7
7
|
import { resolveBuiltinMemoryStoreConfig } from "../../../agent/memory/memory-config.js";
|
|
8
8
|
import { BuiltinMemoryStore } from "../../../agent/memory/builtin-memory-store.js";
|
|
9
9
|
import { discoverMemoryPlugins } from "../../../agent/memory/plugin-discovery.js";
|
|
10
10
|
import { createMemoryManagerFromConfig } from "../../../agent/memory/create-memory-manager.js";
|
|
11
11
|
import { resolveAdaptiveUnderstandingCadence } from "../../../agent/memory/understanding/quality.js";
|
|
12
12
|
import { prepareUpdateAgent } from "../../agents-admin.js";
|
|
13
|
+
import { isUserContextRecord, projectUserContextRecord } from "../../../user-context/projection.js";
|
|
13
14
|
//#region src/gateway/hono/routes/memory.ts
|
|
14
15
|
init_schema();
|
|
15
16
|
init_agent_scope();
|
|
@@ -100,6 +101,15 @@ function parseSensitivity(raw) {
|
|
|
100
101
|
function parseEnum(raw, allowed) {
|
|
101
102
|
return typeof raw === "string" && allowed.has(raw) ? raw : void 0;
|
|
102
103
|
}
|
|
104
|
+
function personalContextForTrace(trace) {
|
|
105
|
+
return (trace?.selectedRecordIds ?? []).map((recordId) => getMemoryRecord(recordId)).filter((record) => Boolean(record) && isUserContextRecord(record)).filter((record) => record.sensitivity !== "secret" && record.sensitivity !== "regulated").filter((record) => record.disclosurePolicy !== "silent").map(projectUserContextRecord).map(({ id, statement, facet, origin, sourceName }) => ({
|
|
106
|
+
id,
|
|
107
|
+
statement,
|
|
108
|
+
facet,
|
|
109
|
+
origin,
|
|
110
|
+
sourceName
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
103
113
|
function registerMemoryRoutes(authenticated, deps) {
|
|
104
114
|
authenticated.get("/api/memory/providers", async (c) => {
|
|
105
115
|
const cfg = deps.service.currentConfig;
|
|
@@ -348,6 +358,7 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
348
358
|
const sessionKey = typeof body.sessionKey === "string" ? body.sessionKey.trim() : "";
|
|
349
359
|
const assistantTimestamp = typeof body.assistantTimestamp === "number" ? body.assistantTimestamp : NaN;
|
|
350
360
|
const outcome = body.outcome === "helpful" || body.outcome === "not_helpful" ? body.outcome : void 0;
|
|
361
|
+
const reason = typeof body.reason === "string" ? body.reason.trim().slice(0, 160) : "";
|
|
351
362
|
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0 || !outcome) return c.json({ error: "sessionKey, assistantTimestamp, and a valid outcome are required" }, 400);
|
|
352
363
|
const trace = setLatestMemoryInjectFeedback({
|
|
353
364
|
sessionKey,
|
|
@@ -355,12 +366,13 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
355
366
|
feedback: {
|
|
356
367
|
outcome,
|
|
357
368
|
source: "user",
|
|
358
|
-
reason: "assistant_response_feedback"
|
|
369
|
+
reason: reason || "assistant_response_feedback"
|
|
359
370
|
}
|
|
360
371
|
});
|
|
361
372
|
return c.json({
|
|
362
373
|
matched: Boolean(trace),
|
|
363
374
|
attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
|
|
375
|
+
personalContext: personalContextForTrace(trace),
|
|
364
376
|
feedback: trace?.feedback ?? null,
|
|
365
377
|
remediation: trace?.remediation ?? null
|
|
366
378
|
});
|
|
@@ -376,6 +388,7 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
376
388
|
return c.json({
|
|
377
389
|
matched: Boolean(trace),
|
|
378
390
|
attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
|
|
391
|
+
personalContext: personalContextForTrace(trace),
|
|
379
392
|
feedback: trace?.feedback ?? null
|
|
380
393
|
});
|
|
381
394
|
});
|