@xopcai/xopc 0.0.178 → 0.0.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-BzGX__8I.js → activity-store-DFKtQDgE.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzxntcaZ.js → agent-avatar-dicebear-CcTvB_4W.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DgGj9bu6.js +2 -0
- package/dist/gateway/static/root/assets/{api-hi6f2Xtp.js → api-CUClAvuL.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-fTY1F7ac.js → app-management-settings-panel-Ib-cWKHM.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BZ-IxQfB.js → appearance-settings-CRSN8WuA.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-B5xahuT-.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-ZSLLG8wB.js → archive-plugin-BBF9zspN.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D4YktqIF.js → attachment-load-D3QQfA7w.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BUYrvMmD.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BIkPxfxj.js → binary-plugins-D78XOjJ3.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Q3v_YQom.js → block-editor-D_VVXlYX.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-Cjw07q9h.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-M5lTEW1I.js → browser-workflow-inputs-_gu08MA4.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B3T1KYk4.js → browser-workflows-page-58DBMXgG.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D_dfVxHY.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DE09c0VB.js → capability-presets-api-DhCn9rPv.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-LWWIYUT7.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CFR5FBfS.js → channel-recipient-api-DYtoNV5A.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Cyj5OunL.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-TEFnV0IG.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-B1mD-3pM.js → connector-logo-CxIXnifA.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-0TobCpBB.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-CwVSLL6N.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-BOIp4q0Z.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BYQJ2XUS.js → directory-picker-path-field-C8_lsW6S.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BXcb8fwx.js → dreaming-settings-Da9FeWQl.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-O1Xu1r4Q.js → extension-debug-page-CMNnSJP6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C2Jraq8l.js → extension-page-t0pJqLvM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DcXQDTpG.js → extension-settings-page-aiR-tKnW.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DmPIZrvg.js → gateway-config-api-CkyQBD6r.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BIZfAgfB.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BZEkOdPm.js → gateway-startup-retry-CSU7UvzG.js} +1 -1
- package/dist/gateway/static/root/assets/goals-settings-Dx9uTyWF.js +1 -0
- package/dist/gateway/static/root/assets/{heartbeat-settings-BtKu2NWT.js → heartbeat-settings-Cnr5ORXL.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-05Gg8wsU.js → image-generation-api-BR6Kb77X.js} +1 -1
- package/dist/gateway/static/root/assets/index-B0Tdge_q.css +1 -0
- package/dist/gateway/static/root/assets/index-BA56bQ68.js +224 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CfmDR9Sc.js → keyboard-shortcuts-settings-D76uYKeQ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DSUNtLHg.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Df8BW1A_.js → local-apps-page-BsLnojTh.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CTwSy7yW.js → locale-store-BNC8HUCI.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-yI8kpQtO.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-B3FvKbaP.js → markdown-split-D6smTQWD.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DsjrvvB6.js → media-plugins-D1TmMF0A.js} +1 -1
- package/dist/gateway/static/root/assets/messages-H_iJjnEM.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-tuzIwy3c.js → notes-page-Vt-diFf0.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-BD297EZt.js +4 -0
- package/dist/gateway/static/root/assets/outcome-detail-page-C5i_ZR9a.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-ke9s4nYi.js → page-tabs-BnSzIjH0.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cp1eI4S9.js → preview-open-alternatives-CF12Eqi4.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-BVG-eWQO.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-dXQCMAtH.js → product-open-page-Du0TE_CU.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-D1HGz7Dy.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-CqP2TnW-.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BXdVJLS3.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Bl30zjHc.js → save-bar-controls-B53UNtDM.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DqhmXQKo.js → schedule-field-C3dIMN5q.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DkUCy6vf.js → schema-form-BKvpxqof.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-DgQq6Z5S.js → schemas-C6onAggk.js} +2 -2
- package/dist/gateway/static/root/assets/sessions-page-CPAwDdl5.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C-jGsoft.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C6ZbNpdy.js → settings-form-section-kt6GIS32.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bk58_cr7.js → settings-loading-skeleton-85eUPcKz.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-k8iE_NdX.js → settings-page-Di5x6Xrc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DgFSya2e.js → settings-page-layout-CkkCee_x.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-B_KDlyZA.js → setup-status-panel-uxEE6gAB.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CV7nL_J9.js → share-preview-page-BtLEstaI.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-2mcsMWgn.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-ocDwsrEt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-9_jfsFU5.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-kahBIHg0.js → skills-page.utils-C2SHvq8V.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-JV3-MG5F.js → system-settings-panel-CIJ66cUy.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DFLyzoLO.js → theme-store-ClDa_Bci.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-D0zAsHOo.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-60Aqo-UJ.js → typed-models-lib-GsmwmB40.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CnTkHDnw.js → use-channel-catalog-BQz3K7xj.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Bn4BLg4W.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CNa8qUgS.js → voice-api-key-field-Blaxsbb3.js} +1 -1
- package/dist/gateway/static/root/assets/work-copy-Cwyan9Sn.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-iJ9RBSpu.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CqTH7PQX.js +1 -0
- package/dist/gateway/static/root/assets/work-page-H3m99ccS.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-yV_x595t.js → workflow-run-setup-panel-CTG4RpRE.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BxZSKMfv.js +11 -0
- package/dist/gateway/static/root/index.html +9 -10
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/outcomes.js +137 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +1 -0
- package/dist/packages/gateway-contract/src/work-intake.js +85 -0
- package/dist/src/activity/service.d.ts +1 -0
- package/dist/src/activity/service.js +4 -1
- package/dist/src/agent/agent-manager.d.ts +4 -1
- package/dist/src/agent/agent-manager.js +21 -7
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/code-intelligence/binary.js +1 -1
- package/dist/src/agent/context/execution-scope.d.ts +1 -1
- package/dist/src/agent/context/execution-scope.js +6 -4
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
- package/dist/src/agent/embedded/run-for-session.js +3 -1
- package/dist/src/agent/goals/post-turn.js +7 -6
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +6 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +5 -2
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +2 -0
- package/dist/src/agent/lifecycle/timeout-wrapper.js +39 -9
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +2 -2
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +6 -1
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +2 -0
- package/dist/src/agent/mcp/mcp-transport-config.js +10 -3
- package/dist/src/agent/mcp/mcp-transport.d.ts +1 -0
- package/dist/src/agent/mcp/mcp-transport.js +5 -2
- package/dist/src/agent/memory/dreaming/config.js +1 -1
- package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -0
- package/dist/src/agent/memory/user-context-coordinator.js +17 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +6 -2
- package/dist/src/agent/outcomes/{task-evaluation.d.ts → execution-evaluation.d.ts} +3 -3
- package/dist/src/agent/outcomes/{task-evaluation.js → execution-evaluation.js} +5 -5
- package/dist/src/agent/outcomes/execution-verifier.d.ts +29 -0
- package/dist/src/agent/outcomes/{task-verifier.js → execution-verifier.js} +4 -4
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -0
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -0
- package/dist/src/agent/service/process-direct-one-shot.js +4 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/config.js +6 -0
- package/dist/src/agent/skills/filesystem-watcher.d.ts +4 -0
- package/dist/src/agent/skills/filesystem-watcher.js +16 -7
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.d.ts +10 -7
- package/dist/src/agent/skills/index.js +56 -47
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.d.ts +5 -2
- package/dist/src/agent/skills/skill-manager.js +10 -5
- package/dist/src/agent/skills/skill-sources.d.ts +18 -0
- package/dist/src/agent/skills/skill-sources.js +143 -0
- package/dist/src/agent/skills/types.d.ts +25 -2
- package/dist/src/agent/tools/delegate-tool.js +2 -1
- package/dist/src/agent/tools/executor.d.ts +2 -0
- package/dist/src/agent/tools/executor.js +18 -11
- package/dist/src/agent/tools/factory.js +18 -1
- package/dist/src/agent/tools/goal-tool.js +5 -3
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/managed-job-tool.d.ts +2 -0
- package/dist/src/agent/tools/managed-job-tool.js +160 -0
- package/dist/src/agent/tools/todo-tool.d.ts +5 -0
- package/dist/src/agent/tools/todo-tool.js +16 -4
- package/dist/src/agent/tools/update-plan-tool.d.ts +1 -0
- package/dist/src/agent/tools/update-plan-tool.js +6 -0
- package/dist/src/agent/workspace-runtime/registry.d.ts +3 -0
- package/dist/src/agent/workspace-runtime/registry.js +3 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/auth/credentials.d.ts +9 -1
- package/dist/src/auth/credentials.js +112 -56
- package/dist/src/auth/model-credential-store.js +7 -22
- package/dist/src/auth/oauth-provider-lock.d.ts +5 -0
- package/dist/src/auth/oauth-provider-lock.js +91 -0
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/domain/defaults.d.ts +8 -1
- package/dist/src/automations/domain/defaults.js +9 -2
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +33 -7
- package/dist/src/automations/domain/validation.d.ts +8 -0
- package/dist/src/automations/domain/validation.js +2 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -1
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +144 -34
- package/dist/src/automations/service/automation-service.d.ts +4 -0
- package/dist/src/automations/service/automation-service.js +197 -18
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +37 -7
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/browser/providers/cloakbrowser.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.d.ts +0 -3
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -24
- package/dist/src/chat-commands/builtins/goal.js +5 -4
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/goal.js +6 -5
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -3
- package/dist/src/cli/utils/oauth-login.js +1 -7
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +3 -0
- package/dist/src/config/schema.js +2 -1
- package/dist/src/connectors/learning-coordinator.js +7 -1
- package/dist/src/connectors/source-change-publisher.d.ts +17 -0
- package/dist/src/connectors/source-change-publisher.js +148 -0
- package/dist/src/discussions/analyzer.d.ts +35 -0
- package/dist/src/discussions/analyzer.js +127 -0
- package/dist/src/discussions/index.d.ts +7 -0
- package/dist/src/discussions/index.js +7 -0
- package/dist/src/discussions/live-worker.d.ts +33 -0
- package/dist/src/discussions/live-worker.js +148 -0
- package/dist/src/discussions/pipeline.d.ts +33 -0
- package/dist/src/discussions/pipeline.js +205 -0
- package/dist/src/discussions/project-inference.d.ts +13 -0
- package/dist/src/discussions/project-inference.js +19 -0
- package/dist/src/discussions/repository.d.ts +29 -0
- package/dist/src/discussions/repository.js +255 -0
- package/dist/src/discussions/service.d.ts +51 -0
- package/dist/src/discussions/service.js +335 -0
- package/dist/src/discussions/transcript.d.ts +3 -0
- package/dist/src/discussions/transcript.js +15 -0
- package/dist/src/discussions/types.d.ts +116 -0
- package/dist/src/discussions/types.js +10 -0
- package/dist/src/discussions/worker.d.ts +18 -0
- package/dist/src/discussions/worker.js +74 -0
- package/dist/src/extensions/activation-context.js +2 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/testing.js +1 -1
- package/dist/src/gateway/agents-admin.js +3 -3
- package/dist/src/gateway/chat-stream/mapper.js +53 -3
- package/dist/src/gateway/chat-stream/protocol.d.ts +17 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/app.js +8 -3
- package/dist/src/gateway/hono/lib/config-payload.js +2 -2
- package/dist/src/gateway/hono/middleware/auth.js +2 -2
- package/dist/src/gateway/hono/middleware/logger.js +1 -1
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +1 -1
- package/dist/src/gateway/hono/oauth-async.js +1 -7
- package/dist/src/gateway/hono/oauth.js +1 -7
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +79 -0
- package/dist/src/gateway/hono/routes/discussions.d.ts +3 -0
- package/dist/src/gateway/hono/routes/discussions.js +177 -0
- package/dist/src/gateway/hono/routes/execution-receipts.d.ts +3 -0
- package/dist/src/gateway/hono/routes/execution-receipts.js +163 -0
- package/dist/src/gateway/hono/routes/exposure.js +1 -1
- package/dist/src/gateway/hono/routes/goals.js +3 -288
- package/dist/src/gateway/hono/routes/home.d.ts +2 -102
- package/dist/src/gateway/hono/routes/home.js +8 -424
- package/dist/src/gateway/hono/routes/index.js +6 -2
- package/dist/src/gateway/hono/routes/memory.js +7 -7
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +30 -0
- package/dist/src/gateway/hono/routes/projects.js +8 -152
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/status.js +2 -2
- package/dist/src/gateway/hono/routes/tunnel.js +3 -3
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/work.d.ts +3 -0
- package/dist/src/gateway/hono/routes/work.js +207 -0
- package/dist/src/gateway/hono/routes/you.js +13 -15
- package/dist/src/gateway/index.js +2 -2
- package/dist/src/gateway/runtime-config.js +2 -2
- package/dist/src/gateway/security/audit.js +2 -2
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +46 -51
- package/dist/src/gateway/service.d.ts +8 -1
- package/dist/src/gateway/service.js +142 -15
- package/dist/src/goals/goal-queue-store.d.ts +1 -0
- package/dist/src/goals/goal-queue-store.js +5 -1
- package/dist/src/goals/goal-queue-types.d.ts +11 -1
- package/dist/src/goals/goal-runner.js +10 -6
- package/dist/src/goals/goal-service.d.ts +2 -15
- package/dist/src/goals/goal-service.js +9 -42
- package/dist/src/goals/goal-store.d.ts +1 -18
- package/dist/src/goals/goal-store.js +25 -231
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/goals/index.d.ts +0 -4
- package/dist/src/goals/index.js +1 -3
- package/dist/src/goals/types.d.ts +4 -66
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/notes/service.d.ts +1 -0
- package/dist/src/notes/service.js +10 -1
- package/dist/src/notes/types.d.ts +1 -0
- package/dist/src/proactive/events/product-event-bridge.d.ts +7 -0
- package/dist/src/proactive/events/product-event-bridge.js +84 -0
- package/dist/src/proactive/execution/context.d.ts +27 -11
- package/dist/src/proactive/execution/context.js +259 -25
- package/dist/src/proactive/execution/repository.js +18 -5
- package/dist/src/proactive/execution/types.d.ts +7 -1
- package/dist/src/proactive/execution/worker.js +7 -6
- package/dist/src/proactive/inbox/repository.js +8 -2
- package/dist/src/proactive/index.d.ts +4 -2
- package/dist/src/proactive/index.js +5 -3
- package/dist/src/proactive/temporal/worker.d.ts +16 -0
- package/dist/src/proactive/temporal/worker.js +110 -0
- package/dist/src/projects/project-loop.js +3 -3
- package/dist/src/providers/auth-runtime/oauth.js +12 -0
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-proxy.js +1 -1
- package/dist/src/storage/sqlite/activity-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/activity-repository.js +4 -1
- package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +20 -0
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +50 -0
- package/dist/src/storage/sqlite/execution-receipt-repository.d.ts +146 -0
- package/dist/src/storage/sqlite/execution-receipt-repository.js +235 -0
- package/dist/src/storage/sqlite/index.d.ts +4 -2
- package/dist/src/storage/sqlite/index.js +6 -4
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +9 -1
- package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +13 -0
- package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +29 -0
- package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +4 -0
- package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +64 -0
- package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +29 -0
- package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +15 -0
- package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +10 -0
- package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +100 -0
- package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +9 -0
- package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +26 -0
- package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +19 -0
- package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +168 -0
- package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +21 -0
- package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +5 -0
- package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +8 -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.ts +1 -1
- package/dist/src/storage/sqlite/notes-repository.js +9 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +89 -44
- package/dist/src/storage/sqlite/session-repository.js +1 -1
- package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +20 -0
- package/dist/src/storage/sqlite/session-task-plan-repository.js +77 -0
- package/dist/src/tui/backends/embedded-backend.d.ts +2 -0
- package/dist/src/tui/backends/embedded-backend.js +12 -8
- package/dist/src/tui/tui-backend.d.ts +2 -0
- package/dist/src/tui/tui-oauth-login.js +1 -7
- package/dist/src/tui/tui-picker-overlay.js +1 -0
- package/dist/src/tui/tui-picker-services.d.ts +1 -0
- package/dist/src/tui/tui-skills-autocomplete.d.ts +6 -2
- package/dist/src/tui/tui-skills-autocomplete.js +10 -6
- package/dist/src/tui/tui-startup-resources.d.ts +3 -1
- package/dist/src/tui/tui-startup-resources.js +4 -3
- package/dist/src/tui/tui.js +4 -1
- package/dist/src/tunnel/frpc-binary.js +1 -1
- package/dist/src/tunnel/frpc-extract.js +1 -1
- package/dist/src/tunnel/index.js +2 -2
- package/dist/src/user-context/context-compiler.d.ts +31 -0
- package/dist/src/user-context/context-compiler.js +51 -0
- package/dist/src/voice/local/model-files.js +1 -1
- package/dist/src/voice/stt/config.d.ts +4 -0
- package/dist/src/voice/stt/config.js +26 -0
- package/dist/src/voice/stt/index.d.ts +1 -0
- package/dist/src/voice/stt/index.js +2 -1
- package/dist/src/voice/stt/list-providers.js +1 -1
- package/dist/src/work/attention-governor.d.ts +20 -0
- package/dist/src/work/attention-governor.js +46 -0
- package/dist/src/work/execution-context.d.ts +16 -0
- package/dist/src/work/execution-context.js +66 -0
- package/dist/src/work/home-query-service.d.ts +147 -0
- package/dist/src/work/home-query-service.js +389 -0
- package/dist/src/work/index.d.ts +14 -0
- package/dist/src/work/index.js +15 -0
- package/dist/src/work/outcome-contract-definition.d.ts +8 -0
- package/dist/src/work/outcome-contract-definition.js +15 -0
- package/dist/src/work/outcome-execution-service.d.ts +27 -0
- package/dist/src/work/outcome-execution-service.js +60 -0
- package/dist/src/work/outcome-projection-service.d.ts +7 -0
- package/dist/src/work/outcome-projection-service.js +51 -0
- package/dist/src/work/outcome-receipt-service.d.ts +13 -0
- package/dist/src/work/outcome-receipt-service.js +55 -0
- package/dist/src/work/outcome-repository.d.ts +50 -0
- package/dist/src/work/outcome-repository.js +112 -0
- package/dist/src/work/outcome-run-coordinator.d.ts +25 -0
- package/dist/src/work/outcome-run-coordinator.js +117 -0
- package/dist/src/work/project-monitoring-service.d.ts +21 -0
- package/dist/src/work/project-monitoring-service.js +76 -0
- package/dist/src/work/project-operating-view-service.d.ts +10 -0
- package/dist/src/work/project-operating-view-service.js +46 -0
- package/dist/src/work/work-intake-repository.d.ts +49 -0
- package/dist/src/work/work-intake-repository.js +97 -0
- package/dist/src/work/work-intake-service.d.ts +26 -0
- package/dist/src/work/work-intake-service.js +171 -0
- package/dist/src/work/work-value-metrics-service.d.ts +4 -0
- package/dist/src/work/work-value-metrics-service.js +88 -0
- package/dist/src/work-items/work-item-service.d.ts +0 -2
- package/dist/src/work-items/work-item-service.js +0 -28
- package/dist/src/workflows/service/workflow-run-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +3 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-DC9F12Kw.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-5bKr05Fa.js +0 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-B7mxFRtf.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Dg6dmt5g.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BHoo6Rpq.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BlsqN8Fu.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DJeT8_B4.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-C4VVjYEm.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DNcrDThX.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-B1urphOZ.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DTL6J3EP.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DmObBx9b.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BRhmmBe9.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C1k7_s_O.js +0 -4
- package/dist/gateway/static/root/assets/goals-config-api-Fwu1wjEP.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-hOu9uA3q.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-DY-JjvHz.js +0 -1
- package/dist/gateway/static/root/assets/index-C0CGebQ1.js +0 -212
- package/dist/gateway/static/root/assets/index-eqq25gvV.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-EjsNT7nJ.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Dswjlraa.js +0 -7
- package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-DSh3-hMY.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-D0QPRHR_.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CI5Vz62F.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-S1jpzBS5.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CTm66k7h.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DK6XK95e.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BGHvVbay.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-XwpxdZFr.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-DBCMk-Vn.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-C1UIdsCl.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +0 -1
- package/dist/gateway/static/root/assets/work-page-D5qYmCTq.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-yrK17ZZ5.js +0 -11
- package/dist/src/agent/outcomes/task-verifier.d.ts +0 -29
- package/dist/src/gateway/hono/routes/task-outcomes.d.ts +0 -3
- package/dist/src/gateway/hono/routes/task-outcomes.js +0 -109
- package/dist/src/goals/goal-contract-draft.d.ts +0 -15
- package/dist/src/goals/goal-contract-draft.js +0 -112
- package/dist/src/goals/goal-evidence-review.d.ts +0 -15
- package/dist/src/goals/goal-evidence-review.js +0 -89
- package/dist/src/storage/sqlite/task-outcome-repository.d.ts +0 -90
- package/dist/src/storage/sqlite/task-outcome-repository.js +0 -138
|
@@ -1,407 +1,14 @@
|
|
|
1
|
-
import { acknowledgeHomeAttention
|
|
2
|
-
import { decideConnectorApproval
|
|
1
|
+
import { acknowledgeHomeAttention } from "../../../storage/sqlite/home-attention-repository.js";
|
|
2
|
+
import { decideConnectorApproval } from "../../../storage/sqlite/connector-repository.js";
|
|
3
3
|
import "../../../storage/sqlite/index.js";
|
|
4
|
-
import { GoalService } from "../../../goals/goal-service.js";
|
|
5
|
-
import "../../../goals/index.js";
|
|
6
|
-
import "../../../automations/domain/defaults.js";
|
|
7
|
-
import "../../../automations/index.js";
|
|
8
4
|
import { listGatewayAgents } from "../../agents-admin.js";
|
|
9
|
-
import {
|
|
10
|
-
import "../../../work-items/index.js";
|
|
11
|
-
import { getTunnelService } from "../../../tunnel/tunnel-service.js";
|
|
12
|
-
import "../../../tunnel/index.js";
|
|
5
|
+
import { WorkHomeQueryService, buildHomeBriefing } from "../../../work/home-query-service.js";
|
|
13
6
|
//#region src/gateway/hono/routes/home.ts
|
|
14
|
-
|
|
15
|
-
if (item.status === "needs_input" || item.status === "in_review" || item.status === "blocked") return 0;
|
|
16
|
-
if (item.dueAt != null && item.dueAt < nowMs) return 1;
|
|
17
|
-
if (item.dueAt != null && item.dueAt < nowMs + 1440 * 60 * 1e3) return 2;
|
|
18
|
-
if (item.priority === "urgent") return 3;
|
|
19
|
-
return 4;
|
|
20
|
-
}
|
|
21
|
-
function toHomeWorkItem(item, projectName) {
|
|
22
|
-
return {
|
|
23
|
-
id: item.id,
|
|
24
|
-
projectId: item.projectId,
|
|
25
|
-
projectName,
|
|
26
|
-
title: item.title,
|
|
27
|
-
status: item.status,
|
|
28
|
-
priority: item.priority,
|
|
29
|
-
nextAction: item.nextAction,
|
|
30
|
-
blockedReason: item.blockedReason,
|
|
31
|
-
dueAt: item.dueAt,
|
|
32
|
-
completedAt: item.completedAt,
|
|
33
|
-
updatedAt: item.updatedAt
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function toHomeWorkflowRun(run) {
|
|
37
|
-
return {
|
|
38
|
-
id: run.id,
|
|
39
|
-
definitionId: run.definitionId,
|
|
40
|
-
title: run.title,
|
|
41
|
-
status: run.status,
|
|
42
|
-
sessionKey: run.metadata?.sessionKey,
|
|
43
|
-
createdAtMs: run.createdAtMs,
|
|
44
|
-
startedAtMs: run.startedAtMs,
|
|
45
|
-
completedAtMs: run.completedAtMs,
|
|
46
|
-
metrics: run.metrics
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function triggerLabel(automation) {
|
|
50
|
-
const trigger = automation.trigger;
|
|
51
|
-
if (trigger.kind === "manual") return "manual";
|
|
52
|
-
if (trigger.kind === "webhook") return "webhook";
|
|
53
|
-
if (trigger.kind === "event") return `event:${trigger.eventType}`;
|
|
54
|
-
const schedule = trigger.schedule;
|
|
55
|
-
if (schedule.kind === "once") return schedule.at;
|
|
56
|
-
if (schedule.kind === "interval") return `every ${Math.round(schedule.everyMs / 6e4)} minutes`;
|
|
57
|
-
return schedule.expr;
|
|
58
|
-
}
|
|
59
|
-
function actionLabel(automation) {
|
|
60
|
-
if (automation.action.kind === "workflow") return `workflow:${automation.action.workflowId}`;
|
|
61
|
-
if (automation.action.kind === "browser_recipe") return `browser-workflow:${automation.action.recipeId}`;
|
|
62
|
-
return automation.action.agentId ? `agent:${automation.action.agentId}` : "agent";
|
|
63
|
-
}
|
|
64
|
-
function toHomeAutomation(automation) {
|
|
65
|
-
if (!automation.enabled || !automation.state.nextRunAtMs) return null;
|
|
66
|
-
return {
|
|
67
|
-
id: automation.id,
|
|
68
|
-
name: automation.name,
|
|
69
|
-
trigger: triggerLabel(automation),
|
|
70
|
-
action: actionLabel(automation),
|
|
71
|
-
nextRunAt: new Date(automation.state.nextRunAtMs).toISOString()
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function toHomeAutomationRun(run) {
|
|
75
|
-
return {
|
|
76
|
-
id: run.id,
|
|
77
|
-
automationId: run.automationId,
|
|
78
|
-
automationName: run.automationName,
|
|
79
|
-
status: run.status,
|
|
80
|
-
createdAtMs: run.createdAtMs,
|
|
81
|
-
startedAtMs: run.startedAtMs,
|
|
82
|
-
endedAtMs: run.endedAtMs,
|
|
83
|
-
error: run.error,
|
|
84
|
-
summary: run.summary,
|
|
85
|
-
sessionKey: run.sessionKey,
|
|
86
|
-
workflowRunId: run.workflowRunId
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function effectiveAutomationTimeoutSeconds(run, automation) {
|
|
90
|
-
return run.actionSnapshot.timeoutSeconds ?? automation?.reliability?.timeoutSeconds ?? 300;
|
|
91
|
-
}
|
|
92
|
-
function attentionDetail(kind, status, locale, timeoutSeconds) {
|
|
93
|
-
const isChinese = locale?.toLowerCase().startsWith("zh") ?? false;
|
|
94
|
-
if (status === "timeout") {
|
|
95
|
-
const seconds = timeoutSeconds ?? 300;
|
|
96
|
-
const duration = seconds % 60 === 0 ? `${seconds / 60} ${isChinese ? "分钟" : seconds === 60 ? "minute" : "minutes"}` : `${seconds} ${isChinese ? "秒" : seconds === 1 ? "second" : "seconds"}`;
|
|
97
|
-
return isChinese ? `运行超过 ${duration},系统已停止本次执行。` : `The run exceeded ${duration} and was stopped.`;
|
|
98
|
-
}
|
|
99
|
-
if (isChinese) return kind === "automation_run" ? "自动化未能完成,请查看详情后重试。" : "工作流未能完成,请查看详情后重试。";
|
|
100
|
-
return kind === "automation_run" ? "The automation did not complete. Review the details and retry." : "The workflow did not complete. Review the details and retry.";
|
|
101
|
-
}
|
|
102
|
-
function decisionFromGoal(goal, projectName) {
|
|
103
|
-
if (goal.status !== "needs_input" && goal.status !== "blocked") return null;
|
|
104
|
-
return {
|
|
105
|
-
id: `goal:${goal.id}`,
|
|
106
|
-
kind: "goal",
|
|
107
|
-
title: goal.title,
|
|
108
|
-
detail: goal.blockedReason || goal.nextAction,
|
|
109
|
-
reason: goal.status,
|
|
110
|
-
urgency: "now",
|
|
111
|
-
href: `/goals/${encodeURIComponent(goal.id)}`,
|
|
112
|
-
projectId: goal.projectId,
|
|
113
|
-
projectName,
|
|
114
|
-
updatedAt: goal.updatedAt
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function decisionFromWorkItem(item, projectName, nowMs) {
|
|
118
|
-
let reason;
|
|
119
|
-
let urgency = "now";
|
|
120
|
-
if (item.status === "needs_input" || item.status === "in_review" || item.status === "blocked") reason = item.status;
|
|
121
|
-
else if (item.dueAt != null && item.dueAt < nowMs) reason = "overdue";
|
|
122
|
-
else if (item.dueAt != null && item.dueAt < nowMs + 1440 * 60 * 1e3) {
|
|
123
|
-
reason = "due_soon";
|
|
124
|
-
urgency = "soon";
|
|
125
|
-
}
|
|
126
|
-
if (!reason) return null;
|
|
127
|
-
return {
|
|
128
|
-
id: `work:${item.id}`,
|
|
129
|
-
kind: "work_item",
|
|
130
|
-
title: item.title,
|
|
131
|
-
detail: item.blockedReason || item.nextAction,
|
|
132
|
-
reason,
|
|
133
|
-
urgency,
|
|
134
|
-
href: `/work-items/${encodeURIComponent(item.id)}`,
|
|
135
|
-
projectId: item.projectId,
|
|
136
|
-
projectName,
|
|
137
|
-
updatedAt: item.updatedAt
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
function buildHomeBriefing(input) {
|
|
141
|
-
const isChinese = input.locale?.toLowerCase().startsWith("zh") ?? false;
|
|
142
|
-
const movingCount = input.activeWorkCount + input.activeWorkflowCount + input.activeGoalCount;
|
|
143
|
-
const attentionCount = input.decisions.length + input.attention.length;
|
|
144
|
-
const summary = attentionCount > 0 ? isChinese ? movingCount > 0 ? `有 ${attentionCount} 件事需要你处理;我正在继续推进 ${movingCount} 件工作。` : `有 ${attentionCount} 件事需要你处理。` : movingCount > 0 ? `${attentionCount} ${attentionCount === 1 ? "item needs" : "items need"} your attention; I’m continuing ${movingCount} in the background.` : `${attentionCount} ${attentionCount === 1 ? "item needs" : "items need"} your attention.` : 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.";
|
|
145
|
-
return {
|
|
146
|
-
generatedAt: input.nowMs,
|
|
147
|
-
summary,
|
|
148
|
-
focus: input.decisions.slice(0, 3),
|
|
149
|
-
progress: {
|
|
150
|
-
activeWorkCount: input.activeWorkCount,
|
|
151
|
-
activeWorkflowCount: input.activeWorkflowCount,
|
|
152
|
-
activeGoalCount: input.activeGoalCount,
|
|
153
|
-
movingCount
|
|
154
|
-
},
|
|
155
|
-
wins: input.wins.slice(0, 5),
|
|
156
|
-
nextScheduled: input.nextScheduled
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* GET /api/home — Aggregated data for the user's cross-project work home.
|
|
161
|
-
*
|
|
162
|
-
* Returns:
|
|
163
|
-
* - recentlyOpened: notes sorted by lastOpenedAt (continue rail)
|
|
164
|
-
* - inboxCount: number of notes with status === 'inbox'
|
|
165
|
-
* - pendingTasks: task notes where done === false
|
|
166
|
-
* - recentSessions: last 5 active AI sessions (threads)
|
|
167
|
-
* - activeAgent: default agent identity for this gateway
|
|
168
|
-
* - gateway: readiness + public tunnel status
|
|
169
|
-
* - workflowRuns: active and recent workflow runs
|
|
170
|
-
* - upcomingAutomations: upcoming enabled automations
|
|
171
|
-
* - recentAutomationRuns: latest automation executions
|
|
172
|
-
*/
|
|
7
|
+
/** Register the unified work-home read model and its decision actions. */
|
|
173
8
|
function registerHomeRoutes(authenticated, deps) {
|
|
174
9
|
const { service } = deps;
|
|
175
|
-
const
|
|
176
|
-
authenticated.get("/api/home", async (c) =>
|
|
177
|
-
const notes = service.notesServiceInstance;
|
|
178
|
-
const sessions = service.sessions;
|
|
179
|
-
const agents = await listGatewayAgents(service.currentConfig);
|
|
180
|
-
const defaultAgent = agents.agents.find((agent) => agent.id === agents.defaultId) ?? agents.agents[0];
|
|
181
|
-
const workflowRunStore = service.createWorkflowRunService().createRunStore(defaultAgent?.id ?? agents.defaultId);
|
|
182
|
-
const tunnel = getTunnelService().getStatus();
|
|
183
|
-
const health = service.getHealth();
|
|
184
|
-
const workItems = new WorkItemService();
|
|
185
|
-
const nowMs = Date.now();
|
|
186
|
-
const [recentlyOpened, inbox, pendingTasks, recentSessions, workflowRuns, automations, automationRuns, projects, allWorkItems, activeGoals, connectorApprovals] = await Promise.all([
|
|
187
|
-
notes.listNotes({
|
|
188
|
-
sortBy: "lastOpenedAt",
|
|
189
|
-
sortOrder: "desc",
|
|
190
|
-
limit: 10
|
|
191
|
-
}),
|
|
192
|
-
notes.listNotes({
|
|
193
|
-
status: "inbox",
|
|
194
|
-
limit: 0
|
|
195
|
-
}),
|
|
196
|
-
notes.listNotes({
|
|
197
|
-
pendingTasksOnly: true,
|
|
198
|
-
sortBy: "createdAt",
|
|
199
|
-
sortOrder: "desc",
|
|
200
|
-
limit: 10
|
|
201
|
-
}),
|
|
202
|
-
sessions.listSessions({
|
|
203
|
-
channel: "webchat",
|
|
204
|
-
sortBy: "updatedAt",
|
|
205
|
-
sortOrder: "desc",
|
|
206
|
-
limit: 50
|
|
207
|
-
}),
|
|
208
|
-
workflowRunStore.listRunSummaries(20),
|
|
209
|
-
service.automationServiceInstance.list(),
|
|
210
|
-
service.automationServiceInstance.listRuns({ limit: 10 }),
|
|
211
|
-
service.projects.list({ limit: 500 }),
|
|
212
|
-
Promise.resolve(workItems.listWorkItems({ limit: 100 })),
|
|
213
|
-
Promise.resolve(goals.list({
|
|
214
|
-
status: [
|
|
215
|
-
"active",
|
|
216
|
-
"blocked",
|
|
217
|
-
"needs_input",
|
|
218
|
-
"paused"
|
|
219
|
-
],
|
|
220
|
-
limit: 100
|
|
221
|
-
})),
|
|
222
|
-
Promise.resolve(listConnectorApprovals({
|
|
223
|
-
principalId: "local-owner",
|
|
224
|
-
status: "pending",
|
|
225
|
-
limit: 100
|
|
226
|
-
}))
|
|
227
|
-
]);
|
|
228
|
-
const projectsById = new Map(projects.items.map((project) => [project.id, project]));
|
|
229
|
-
const workChats = recentSessions.items.filter((session) => (session.messageCount ?? 0) > 0).map((session) => ({
|
|
230
|
-
key: session.key,
|
|
231
|
-
name: session.name || "Conversation",
|
|
232
|
-
updatedAt: session.updatedAt,
|
|
233
|
-
active: sessions.getActiveRun(session.key).active
|
|
234
|
-
}));
|
|
235
|
-
const activeWorkItems = allWorkItems.items.filter((item) => item.status !== "done" && item.status !== "cancelled").sort((left, right) => {
|
|
236
|
-
return workItemAttentionRank(left, nowMs) - workItemAttentionRank(right, nowMs) || right.updatedAt - left.updatedAt;
|
|
237
|
-
});
|
|
238
|
-
const attentionWorkItems = activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 4).slice(0, 8).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
|
|
239
|
-
const currentWorkItems = activeWorkItems.slice(0, 30).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
|
|
240
|
-
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"));
|
|
241
|
-
const activeWorkflowRuns = workflowRuns.filter((run) => run.status === "queued" || run.status === "running").slice(0, 5).map(toHomeWorkflowRun);
|
|
242
|
-
const failedWorkflowRuns = workflowRuns.filter((run) => run.status === "failed" || run.status === "timeout").slice(0, 5).map(toHomeWorkflowRun);
|
|
243
|
-
const recentWorkflowRuns = workflowRuns.slice(0, 5).map(toHomeWorkflowRun);
|
|
244
|
-
const upcomingAutomations = automations.map(toHomeAutomation).filter((automation) => Boolean(automation)).sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt)).slice(0, 5);
|
|
245
|
-
const latestAutomationRuns = [...automationRuns].sort((left, right) => right.createdAtMs - left.createdAtMs).filter((run, index, all) => all.findIndex((candidate) => candidate.automationId === run.automationId) === index);
|
|
246
|
-
const automationsById = new Map(automations.map((automation) => [automation.id, automation]));
|
|
247
|
-
const decisions = [
|
|
248
|
-
...service.proactiveInbox.list({ limit: 20 }).filter((item) => item.status === "unread" || item.status === "read").map((item) => ({
|
|
249
|
-
id: `agent-judgment:${item.id}`,
|
|
250
|
-
kind: "agent_judgment",
|
|
251
|
-
title: item.insight.title,
|
|
252
|
-
detail: item.insight.summary,
|
|
253
|
-
reason: "decision_needed",
|
|
254
|
-
urgency: item.insight.urgency === "critical" || item.insight.urgency === "high" ? "now" : "soon",
|
|
255
|
-
href: `/work?judgment=${encodeURIComponent(item.id)}`,
|
|
256
|
-
updatedAt: Date.parse(item.updatedAt),
|
|
257
|
-
judgment: {
|
|
258
|
-
inboxItemId: item.id,
|
|
259
|
-
whyNow: item.insight.whyNow,
|
|
260
|
-
impact: item.insight.impact,
|
|
261
|
-
workDone: item.insight.workDone,
|
|
262
|
-
recommendation: item.insight.recommendation,
|
|
263
|
-
confidence: item.insight.confidence,
|
|
264
|
-
...item.insight.decision ? { decision: item.insight.decision } : {}
|
|
265
|
-
}
|
|
266
|
-
})),
|
|
267
|
-
...activeWorkItems.map((item) => decisionFromWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project", nowMs)).filter((item) => Boolean(item)),
|
|
268
|
-
...activeGoals.map((goal) => decisionFromGoal(goal, goal.projectId ? projectsById.get(goal.projectId)?.name : void 0)).filter((item) => Boolean(item)),
|
|
269
|
-
...connectorApprovals.filter((approval) => Date.parse(approval.expiresAt) > nowMs).map((approval) => ({
|
|
270
|
-
id: `connector-approval:${approval.id}`,
|
|
271
|
-
kind: "connector_approval",
|
|
272
|
-
title: approval.actionId,
|
|
273
|
-
detail: `${approval.connectorId} · ${approval.scope}`,
|
|
274
|
-
reason: "approval_required",
|
|
275
|
-
urgency: "now",
|
|
276
|
-
href: "/connectors",
|
|
277
|
-
updatedAt: Date.parse(approval.createdAt),
|
|
278
|
-
response: {
|
|
279
|
-
kind: "connector_approval",
|
|
280
|
-
approvalId: approval.id
|
|
281
|
-
}
|
|
282
|
-
})),
|
|
283
|
-
...activeGoals.flatMap((goal) => goal.evidenceRequirements.filter((requirement) => requirement.requiresHumanApproval && requirement.evidenceIds.length > 0 && (requirement.status === "pending" || requirement.status === "ai_verified")).map((requirement) => ({
|
|
284
|
-
id: `goal-evidence:${requirement.id}`,
|
|
285
|
-
kind: "goal_evidence",
|
|
286
|
-
title: goal.title,
|
|
287
|
-
detail: requirement.text,
|
|
288
|
-
reason: "approval_required",
|
|
289
|
-
urgency: "now",
|
|
290
|
-
href: `/goals/${encodeURIComponent(goal.id)}`,
|
|
291
|
-
projectId: goal.projectId,
|
|
292
|
-
projectName: goal.projectId ? projectsById.get(goal.projectId)?.name : void 0,
|
|
293
|
-
updatedAt: requirement.updatedAt,
|
|
294
|
-
response: {
|
|
295
|
-
kind: "goal_evidence",
|
|
296
|
-
goalId: goal.id,
|
|
297
|
-
requirementId: requirement.id
|
|
298
|
-
}
|
|
299
|
-
})))
|
|
300
|
-
].sort((left, right) => {
|
|
301
|
-
return (left.urgency === "now" ? 0 : 1) - (right.urgency === "now" ? 0 : 1) || right.updatedAt - left.updatedAt;
|
|
302
|
-
}).slice(0, 20);
|
|
303
|
-
const locale = c.req.query("locale");
|
|
304
|
-
const attention = [...failedWorkflowRuns.filter((run) => !isHomeAttentionAcknowledged("workflow_run", run.id)).map((run) => ({
|
|
305
|
-
id: `workflow_run:${run.id}`,
|
|
306
|
-
kind: "workflow_run",
|
|
307
|
-
runId: run.id,
|
|
308
|
-
title: run.title,
|
|
309
|
-
detail: attentionDetail("workflow_run", run.status === "timeout" ? "timeout" : "failed", locale),
|
|
310
|
-
reason: run.status === "timeout" ? "run_timeout" : "run_failed",
|
|
311
|
-
href: `/workflows?runId=${encodeURIComponent(run.id)}`,
|
|
312
|
-
updatedAt: run.completedAtMs ?? run.startedAtMs ?? run.createdAtMs,
|
|
313
|
-
sessionKey: run.sessionKey
|
|
314
|
-
})), ...latestAutomationRuns.filter((run) => run.status === "failed" || run.status === "timeout").filter((run) => !isHomeAttentionAcknowledged("automation_run", run.id)).map((run) => ({
|
|
315
|
-
id: `automation_run:${run.id}`,
|
|
316
|
-
kind: "automation_run",
|
|
317
|
-
runId: run.id,
|
|
318
|
-
title: run.automationName || run.automationId,
|
|
319
|
-
detail: attentionDetail("automation_run", run.status === "timeout" ? "timeout" : "failed", locale, effectiveAutomationTimeoutSeconds(run, automationsById.get(run.automationId))),
|
|
320
|
-
reason: run.status === "timeout" ? "run_timeout" : "run_failed",
|
|
321
|
-
href: `/automations?run=${encodeURIComponent(run.id)}`,
|
|
322
|
-
updatedAt: run.endedAtMs ?? run.startedAtMs ?? run.createdAtMs,
|
|
323
|
-
sessionKey: run.sessionKey
|
|
324
|
-
}))].sort((left, right) => right.updatedAt - left.updatedAt).slice(0, 10);
|
|
325
|
-
const wins = [
|
|
326
|
-
...recentlyCompletedWorkItems.map((item) => ({
|
|
327
|
-
id: `work:${item.id}`,
|
|
328
|
-
kind: "work_item",
|
|
329
|
-
title: item.title,
|
|
330
|
-
href: `/work-items/${encodeURIComponent(item.id)}`,
|
|
331
|
-
completedAt: item.completedAt ?? item.updatedAt
|
|
332
|
-
})),
|
|
333
|
-
...workflowRuns.filter((run) => run.status === "succeeded").map((run) => ({
|
|
334
|
-
id: `workflow:${run.id}`,
|
|
335
|
-
kind: "workflow_run",
|
|
336
|
-
title: run.title,
|
|
337
|
-
href: `/workflows?runId=${encodeURIComponent(run.id)}`,
|
|
338
|
-
completedAt: run.completedAtMs ?? run.createdAtMs
|
|
339
|
-
})),
|
|
340
|
-
...latestAutomationRuns.filter((run) => run.status === "succeeded").map((run) => ({
|
|
341
|
-
id: `automation:${run.id}`,
|
|
342
|
-
kind: "automation_run",
|
|
343
|
-
title: run.automationName || run.automationId,
|
|
344
|
-
href: "/automations",
|
|
345
|
-
completedAt: run.endedAtMs ?? run.createdAtMs
|
|
346
|
-
}))
|
|
347
|
-
].sort((left, right) => right.completedAt - left.completedAt);
|
|
348
|
-
const briefing = buildHomeBriefing({
|
|
349
|
-
locale,
|
|
350
|
-
decisions,
|
|
351
|
-
attention,
|
|
352
|
-
activeWorkCount: activeWorkItems.filter((item) => item.status === "in_progress").length,
|
|
353
|
-
activeWorkflowCount: activeWorkflowRuns.length,
|
|
354
|
-
activeGoalCount: activeGoals.filter((goal) => goal.status === "active").length,
|
|
355
|
-
wins,
|
|
356
|
-
nextScheduled: upcomingAutomations[0],
|
|
357
|
-
nowMs
|
|
358
|
-
});
|
|
359
|
-
return c.json({
|
|
360
|
-
recentlyOpened: recentlyOpened.items.filter((n) => n.lastOpenedAt),
|
|
361
|
-
inboxCount: inbox.total,
|
|
362
|
-
pendingTasks: pendingTasks.items,
|
|
363
|
-
pendingTaskCount: pendingTasks.total,
|
|
364
|
-
recentSessions: recentSessions.items.slice(0, 5),
|
|
365
|
-
activeAgent: defaultAgent ? {
|
|
366
|
-
id: defaultAgent.id,
|
|
367
|
-
name: defaultAgent.name,
|
|
368
|
-
description: defaultAgent.description
|
|
369
|
-
} : { id: agents.defaultId },
|
|
370
|
-
gateway: {
|
|
371
|
-
status: health.status,
|
|
372
|
-
ready: health.ready,
|
|
373
|
-
httpListening: health.httpListening,
|
|
374
|
-
version: health.version,
|
|
375
|
-
uptime: health.uptime,
|
|
376
|
-
tunnel: {
|
|
377
|
-
state: tunnel.state,
|
|
378
|
-
publicUrl: tunnel.publicUrl,
|
|
379
|
-
connected: tunnel.state === "connected"
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
workflowRuns: {
|
|
383
|
-
active: activeWorkflowRuns,
|
|
384
|
-
recent: recentWorkflowRuns
|
|
385
|
-
},
|
|
386
|
-
briefing,
|
|
387
|
-
decisions,
|
|
388
|
-
attention,
|
|
389
|
-
chats: {
|
|
390
|
-
running: workChats.filter((chat) => chat.active),
|
|
391
|
-
recent: workChats.filter((chat) => !chat.active).slice(0, 8)
|
|
392
|
-
},
|
|
393
|
-
work: {
|
|
394
|
-
attentionCount: activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 3).length,
|
|
395
|
-
overdueCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt < nowMs).length,
|
|
396
|
-
todayCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt >= nowMs && item.dueAt < nowMs + 1440 * 60 * 1e3).length,
|
|
397
|
-
items: attentionWorkItems,
|
|
398
|
-
current: currentWorkItems,
|
|
399
|
-
recentlyCompleted: recentlyCompletedWorkItems
|
|
400
|
-
},
|
|
401
|
-
upcomingAutomations,
|
|
402
|
-
recentAutomationRuns: automationRuns.slice(0, 5).map(toHomeAutomationRun)
|
|
403
|
-
});
|
|
404
|
-
});
|
|
10
|
+
const home = new WorkHomeQueryService(service);
|
|
11
|
+
authenticated.get("/api/home", async (c) => c.json(await home.getSnapshot(c.req.query("locale"))));
|
|
405
12
|
authenticated.post("/api/home/decisions/respond", deps.strictRateLimitMiddleware, async (c) => {
|
|
406
13
|
const body = await c.req.json().catch(() => ({}));
|
|
407
14
|
const decision = body.decision === "approve" ? "approve" : body.decision === "deny" ? "deny" : void 0;
|
|
@@ -424,29 +31,6 @@ function registerHomeRoutes(authenticated, deps) {
|
|
|
424
31
|
status: approval.status
|
|
425
32
|
});
|
|
426
33
|
}
|
|
427
|
-
if (body.kind === "goal_evidence" && typeof body.goalId === "string" && typeof body.requirementId === "string") {
|
|
428
|
-
const goal = goals.get(body.goalId);
|
|
429
|
-
const requirement = goal?.evidenceRequirements.find((item) => item.id === body.requirementId);
|
|
430
|
-
if (!goal || !requirement) return c.json({
|
|
431
|
-
ok: false,
|
|
432
|
-
error: "Evidence approval not found"
|
|
433
|
-
}, 404);
|
|
434
|
-
if (requirement.evidenceIds.length === 0) return c.json({
|
|
435
|
-
ok: false,
|
|
436
|
-
error: "Evidence is missing"
|
|
437
|
-
}, 409);
|
|
438
|
-
const updated = goals.reviewEvidenceRequirement({
|
|
439
|
-
goalId: goal.id,
|
|
440
|
-
requirementId: requirement.id,
|
|
441
|
-
status: decision === "approve" ? "approved" : "rejected",
|
|
442
|
-
reason: decision === "approve" ? "Approved from the decision inbox." : "Rejected from the decision inbox.",
|
|
443
|
-
reviewedBy: "user"
|
|
444
|
-
});
|
|
445
|
-
return c.json({
|
|
446
|
-
ok: true,
|
|
447
|
-
status: updated?.status
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
34
|
return c.json({
|
|
451
35
|
ok: false,
|
|
452
36
|
error: "Unsupported decision kind"
|
|
@@ -487,9 +71,9 @@ function registerHomeRoutes(authenticated, deps) {
|
|
|
487
71
|
error: error instanceof Error ? error.message : "Failed to retry automation"
|
|
488
72
|
}, 400);
|
|
489
73
|
}
|
|
490
|
-
const
|
|
74
|
+
const agents = await listGatewayAgents(service.currentConfig);
|
|
491
75
|
const result = await service.createWorkflowRunService().retryWorkflowRun({
|
|
492
|
-
agentId,
|
|
76
|
+
agentId: agents.defaultId,
|
|
493
77
|
runId
|
|
494
78
|
});
|
|
495
79
|
if (result.ok === false) return c.json({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { registerActivityRoutes } from "./activity.js";
|
|
2
2
|
import { registerAgentStreamRoutes } from "./agent-stream.js";
|
|
3
|
+
import { registerDiscussionRoutes } from "./discussions.js";
|
|
3
4
|
import { registerSessionsRoutes } from "./sessions.js";
|
|
4
5
|
import { registerStatusRoutes } from "./status.js";
|
|
5
6
|
import { registerMemoryRoutes } from "./memory.js";
|
|
@@ -7,11 +8,12 @@ import { registerProjectsRoutes } from "./projects.js";
|
|
|
7
8
|
import { registerProjectSkillRoutes } from "./project-skills.js";
|
|
8
9
|
import { registerSearchRoutes } from "./search.js";
|
|
9
10
|
import { registerMobileRoutes } from "./mobile.js";
|
|
10
|
-
import {
|
|
11
|
+
import { registerExecutionReceiptRoutes } from "./execution-receipts.js";
|
|
11
12
|
import { registerInteractionStateRoutes } from "./interaction-state.js";
|
|
12
13
|
import { registerComposerHistoryRoutes } from "./composer-history.js";
|
|
13
14
|
import { registerLocalAppsRoutes } from "./local-apps.js";
|
|
14
15
|
import { registerWorkDiscoveryRoutes } from "./work-discovery.js";
|
|
16
|
+
import { registerWorkRoutes } from "./work.js";
|
|
15
17
|
import { registerProactiveRoutes } from "./proactive.js";
|
|
16
18
|
import { mountAppLazyRoutePrefixes, registerAuthenticatedLazyRouteFallback } from "./lazy-fallback.js";
|
|
17
19
|
//#region src/gateway/hono/routes/index.ts
|
|
@@ -21,14 +23,16 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
|
|
|
21
23
|
registerSessionsRoutes(authenticated, deps);
|
|
22
24
|
registerMemoryRoutes(authenticated, deps);
|
|
23
25
|
registerActivityRoutes(authenticated, deps);
|
|
26
|
+
registerDiscussionRoutes(authenticated, deps);
|
|
24
27
|
registerProjectsRoutes(authenticated, deps);
|
|
25
28
|
registerProjectSkillRoutes(authenticated, deps);
|
|
26
29
|
registerLocalAppsRoutes(authenticated, deps);
|
|
27
30
|
registerWorkDiscoveryRoutes(authenticated, deps);
|
|
31
|
+
registerWorkRoutes(authenticated, deps);
|
|
28
32
|
registerProactiveRoutes(authenticated, deps);
|
|
29
33
|
registerSearchRoutes(authenticated, deps);
|
|
30
34
|
registerMobileRoutes(authenticated, deps);
|
|
31
|
-
|
|
35
|
+
registerExecutionReceiptRoutes(authenticated, deps);
|
|
32
36
|
registerInteractionStateRoutes(authenticated, deps);
|
|
33
37
|
registerComposerHistoryRoutes(authenticated, deps);
|
|
34
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setInteractionState } from "../../../storage/sqlite/interaction-state-repository.js";
|
|
2
2
|
import { LOCAL_USER_ID } from "../../../user-context/owner.js";
|
|
3
|
-
import {
|
|
3
|
+
import { findExecutionReceiptForAssistant, setExecutionReceiptFeedback } from "../../../storage/sqlite/execution-receipt-repository.js";
|
|
4
4
|
import { appendMemorySignal, appendMemoryTraceEvent, deleteMemoryRecord, findLatestMemoryInjectTrace, getMemoryRecord, listMemoryRecords, listMemorySignals, listMemoryTraceEvents, searchMemoryRecords, setLatestMemoryInjectFeedback, setMemoryTraceFeedback, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
|
|
5
5
|
import { listKnowledgeSourceChanges, listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
|
|
6
6
|
import "../../../storage/sqlite/index.js";
|
|
@@ -363,7 +363,7 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
363
363
|
const outcome = body.outcome === "helpful" || body.outcome === "not_helpful" ? body.outcome : void 0;
|
|
364
364
|
const reason = typeof body.reason === "string" ? body.reason.trim().slice(0, 160) : "";
|
|
365
365
|
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0 || !outcome) return c.json({ error: "sessionKey, assistantTimestamp, and a valid outcome are required" }, 400);
|
|
366
|
-
const
|
|
366
|
+
const executionReceipt = setExecutionReceiptFeedback({
|
|
367
367
|
sessionKey,
|
|
368
368
|
assistantTimestamp,
|
|
369
369
|
outcome,
|
|
@@ -391,10 +391,10 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
return c.json({
|
|
394
|
-
matched: Boolean(
|
|
394
|
+
matched: Boolean(executionReceipt),
|
|
395
395
|
attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
|
|
396
396
|
personalContext: personalContextForTrace(trace),
|
|
397
|
-
feedback:
|
|
397
|
+
feedback: executionReceipt?.feedback ?? null,
|
|
398
398
|
remediation: trace?.remediation ?? null
|
|
399
399
|
});
|
|
400
400
|
});
|
|
@@ -402,16 +402,16 @@ function registerMemoryRoutes(authenticated, deps) {
|
|
|
402
402
|
const sessionKey = c.req.query("sessionKey")?.trim() ?? "";
|
|
403
403
|
const assistantTimestamp = Number(c.req.query("assistantTimestamp"));
|
|
404
404
|
if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0) return c.json({ error: "sessionKey and assistantTimestamp are required" }, 400);
|
|
405
|
-
const
|
|
405
|
+
const executionReceipt = findExecutionReceiptForAssistant(sessionKey, assistantTimestamp);
|
|
406
406
|
const trace = findLatestMemoryInjectTrace({
|
|
407
407
|
sessionKey,
|
|
408
408
|
beforeMs: assistantTimestamp
|
|
409
409
|
});
|
|
410
410
|
return c.json({
|
|
411
|
-
matched: Boolean(
|
|
411
|
+
matched: Boolean(executionReceipt),
|
|
412
412
|
attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
|
|
413
413
|
personalContext: personalContextForTrace(trace),
|
|
414
|
-
feedback:
|
|
414
|
+
feedback: executionReceipt?.feedback ?? null
|
|
415
415
|
});
|
|
416
416
|
});
|
|
417
417
|
authenticated.post("/api/user-context/signals", async (c) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
2
1
|
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
2
|
+
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
3
3
|
import { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
|
|
4
4
|
import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
|
|
5
5
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ObjectLinkService } from "../../../activity/service.js";
|
|
1
2
|
import { buildSessionKey, init_session_key } from "../../../routing/session-key.js";
|
|
2
3
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
3
4
|
import { createReadStream } from "node:fs";
|
|
@@ -61,6 +62,27 @@ function noteThreadName(note) {
|
|
|
61
62
|
}
|
|
62
63
|
function registerNotesRoutes(authenticated, deps) {
|
|
63
64
|
const { service } = deps;
|
|
65
|
+
const objectLinks = new ObjectLinkService();
|
|
66
|
+
const linkNoteToProject = (note, projectId) => {
|
|
67
|
+
if (!projectId) return;
|
|
68
|
+
const project = service.projects.get(projectId);
|
|
69
|
+
if (!project) return;
|
|
70
|
+
objectLinks.create({
|
|
71
|
+
id: `note:${note.id}:project:${project.id}`,
|
|
72
|
+
from: {
|
|
73
|
+
kind: "note",
|
|
74
|
+
id: note.id,
|
|
75
|
+
title: note.title
|
|
76
|
+
},
|
|
77
|
+
to: {
|
|
78
|
+
kind: "project",
|
|
79
|
+
id: project.id,
|
|
80
|
+
title: project.name
|
|
81
|
+
},
|
|
82
|
+
relation: "belongs_to",
|
|
83
|
+
source: "user"
|
|
84
|
+
});
|
|
85
|
+
};
|
|
64
86
|
authenticated.post("/api/notes/quick-capture", async (c) => {
|
|
65
87
|
const body = await c.req.json().catch(() => ({}));
|
|
66
88
|
const text = typeof body.text === "string" ? body.text.trim() : "";
|
|
@@ -75,6 +97,7 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
75
97
|
const status = c.req.query("status");
|
|
76
98
|
const kind = c.req.query("kind");
|
|
77
99
|
const tag = c.req.query("tag");
|
|
100
|
+
const projectId = c.req.query("projectId")?.trim();
|
|
78
101
|
const search = c.req.query("search");
|
|
79
102
|
const pinnedRaw = c.req.query("pinned");
|
|
80
103
|
const limitRaw = c.req.query("limit");
|
|
@@ -85,6 +108,7 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
85
108
|
status: status && VALID_STATUSES.has(status) ? status : void 0,
|
|
86
109
|
kind: kind && VALID_KINDS.has(kind) ? kind : void 0,
|
|
87
110
|
tag: tag || void 0,
|
|
111
|
+
projectId: projectId || void 0,
|
|
88
112
|
search: search || void 0,
|
|
89
113
|
pinned: pinnedRaw === "true" ? true : pinnedRaw === "false" ? false : void 0,
|
|
90
114
|
limit: limitRaw ? parseInt(limitRaw, 10) : void 0,
|
|
@@ -106,12 +130,15 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
106
130
|
const kindRaw = typeof body.kind === "string" ? body.kind : void 0;
|
|
107
131
|
const tagsRaw = typeof body.tags === "string" ? body.tags : void 0;
|
|
108
132
|
const source = parseCaptureSource(body);
|
|
133
|
+
const projectId = typeof body.projectId === "string" && body.projectId.trim() ? body.projectId.trim() : void 0;
|
|
134
|
+
if (projectId && !service.projects.get(projectId)) return c.json({ error: "Project not found" }, 400);
|
|
109
135
|
const note = await service.notesServiceInstance.createNote({
|
|
110
136
|
markdown,
|
|
111
137
|
kind: kindRaw && VALID_KINDS.has(kindRaw) ? kindRaw : void 0,
|
|
112
138
|
tags: tagsRaw ? tagsRaw.split(",").map((t) => t.trim()).filter(Boolean) : void 0,
|
|
113
139
|
capturedVia: source
|
|
114
140
|
});
|
|
141
|
+
linkNoteToProject(note, projectId);
|
|
115
142
|
const file = body.file;
|
|
116
143
|
if (file && typeof file === "object") {
|
|
117
144
|
let buf = null;
|
|
@@ -142,6 +169,8 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
142
169
|
const kindRaw = typeof body.kind === "string" ? body.kind : void 0;
|
|
143
170
|
const tagsRaw = Array.isArray(body.tags) ? body.tags.filter((t) => typeof t === "string") : void 0;
|
|
144
171
|
const source = parseCaptureSource(body);
|
|
172
|
+
const projectId = typeof body.projectId === "string" && body.projectId.trim() ? body.projectId.trim() : void 0;
|
|
173
|
+
if (projectId && !service.projects.get(projectId)) return c.json({ error: "Project not found" }, 400);
|
|
145
174
|
const note = await service.notesServiceInstance.createNote({
|
|
146
175
|
title,
|
|
147
176
|
markdown,
|
|
@@ -150,6 +179,7 @@ function registerNotesRoutes(authenticated, deps) {
|
|
|
150
179
|
capturedVia: source,
|
|
151
180
|
pinned: body.pinned === true
|
|
152
181
|
});
|
|
182
|
+
linkNoteToProject(note, projectId);
|
|
153
183
|
return c.json({ note }, 201);
|
|
154
184
|
});
|
|
155
185
|
authenticated.post("/api/notes/sync", async (c) => {
|