@xopcai/xopc 0.0.178 → 0.0.179
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-A5FUMjeV.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzxntcaZ.js → agent-avatar-dicebear-NghNiDWx.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Baq8Shzy.js +2 -0
- package/dist/gateway/static/root/assets/{api-hi6f2Xtp.js → api-Bmzslx0Z.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-fTY1F7ac.js → app-management-settings-panel-DDWS_BBJ.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BZ-IxQfB.js → appearance-settings-C6znvVtX.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-d-Y0Jbe1.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-ZSLLG8wB.js → archive-plugin-fvTZhPUr.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D4YktqIF.js → attachment-load-BFEgvg-Q.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CFYOCBlQ.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BIkPxfxj.js → binary-plugins-CuI2bOc7.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Q3v_YQom.js → block-editor-Z_k8W0al.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-CGApoYPr.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-M5lTEW1I.js → browser-workflow-inputs-gs6b5e9-.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B3T1KYk4.js → browser-workflows-page-Cq5qXStp.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BC-8n4Hl.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DE09c0VB.js → capability-presets-api-BTKhPoDC.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D7WQ0oBN.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CFR5FBfS.js → channel-recipient-api-TwMak0SE.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DysELlO_.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-BAC-R8IK.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-B1mD-3pM.js → connector-logo-DBKotvNr.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-QH-0WnOo.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-Dwml8znf.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-CyIg2jJp.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BYQJ2XUS.js → directory-picker-path-field-B6fc_7SL.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BXcb8fwx.js → dreaming-settings-CUQxGnDf.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-O1Xu1r4Q.js → extension-debug-page-AbRNi2ON.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C2Jraq8l.js → extension-page-ClYfiLXC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DcXQDTpG.js → extension-settings-page-BGVP2hw1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DmPIZrvg.js → gateway-config-api-B7GqtklK.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BMeK8igT.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BZEkOdPm.js → gateway-startup-retry-CKKL96r_.js} +1 -1
- package/dist/gateway/static/root/assets/goals-settings-Dj0ao2qA.js +1 -0
- package/dist/gateway/static/root/assets/{heartbeat-settings-BtKu2NWT.js → heartbeat-settings-CTI2nPKa.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-05Gg8wsU.js → image-generation-api-BY3VQ5Mv.js} +1 -1
- package/dist/gateway/static/root/assets/index-B0Tdge_q.css +1 -0
- package/dist/gateway/static/root/assets/index-BDzspHrg.js +224 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CfmDR9Sc.js → keyboard-shortcuts-settings-CELtDFz3.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-m8CTSGix.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Df8BW1A_.js → local-apps-page-CF5uUd1n.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CTwSy7yW.js → locale-store-DIVc0AQs.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DmH7Tk4k.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-B3FvKbaP.js → markdown-split-CN85EdB8.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DsjrvvB6.js → media-plugins-CxYEc-b8.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DYqBwJAK.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-tuzIwy3c.js → notes-page-Goab4781.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-C4jDBVBN.js +4 -0
- package/dist/gateway/static/root/assets/outcome-detail-page-DNRfeLZp.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-ke9s4nYi.js → page-tabs-tQNQcAts.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cp1eI4S9.js → preview-open-alternatives-BSTlgsDB.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-iQ5gTCip.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-D7anK-eu.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BePESKWy.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CHrzBKIs.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Bl30zjHc.js → save-bar-controls-BsPf5Gkk.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DqhmXQKo.js → schedule-field-kAytH7mq.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DkUCy6vf.js → schema-form-Bbw8l2ri.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-He5YAczL.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-2eAC9GCP.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C6ZbNpdy.js → settings-form-section-BqbibcnJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bk58_cr7.js → settings-loading-skeleton-DNLNCEGT.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-k8iE_NdX.js → settings-page-BR6Ss0bK.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DgFSya2e.js → settings-page-layout-Cdb1e2Cz.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-B_KDlyZA.js → setup-status-panel-moT-D-ia.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CV7nL_J9.js → share-preview-page-CkrASny2.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-X49zY21H.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CjpnFfOH.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DEwfSOUE.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-kahBIHg0.js → skills-page.utils-BG5dGkyA.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-JV3-MG5F.js → system-settings-panel-XdY8eyYf.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DFLyzoLO.js → theme-store-DtwI_VLT.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-UghsQu_I.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-60Aqo-UJ.js → typed-models-lib-DOnpwsrE.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CnTkHDnw.js → use-channel-catalog-BWDtfNvQ.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BtNBEtKj.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CNa8qUgS.js → voice-api-key-field-DP80jW-W.js} +1 -1
- package/dist/gateway/static/root/assets/work-copy-hQmivDgT.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-CkDOVZBr.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CqvkcFcR.js +1 -0
- package/dist/gateway/static/root/assets/work-page-BL8TZW4Z.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-yV_x595t.js → workflow-run-setup-panel-BLlVqKdA.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BgsdRu3_.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/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/goals/post-turn.js +6 -5
- package/dist/src/agent/mcp/mcp-stdio-transport.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/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/process-direct-streaming.js +3 -1
- package/dist/src/agent/tools/factory.js +16 -1
- package/dist/src/agent/tools/goal-tool.js +5 -3
- 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/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/goal.js +6 -5
- package/dist/src/cli/commands/tunnel.js +3 -3
- 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/sdk/testing.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- 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/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +8 -3
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- 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/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/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 +12 -14
- 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 +1 -1
- 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 +139 -12
- 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/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/heartbeat/index.js +1 -1
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/notes/service.d.ts +1 -0
- package/dist/src/notes/service.js +9 -0
- 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/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/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.js +1 -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 +118 -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 +1 -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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Config } from '../config/schema.js';
|
|
2
|
+
import type { NotesService } from '../notes/service.js';
|
|
3
|
+
import type { ProjectService } from '../projects/project-service.js';
|
|
4
|
+
import { enrichLiveDiscussion } from './analyzer.js';
|
|
5
|
+
import type { DiscussionCapture } from './types.js';
|
|
6
|
+
export interface DiscussionLiveWorkerDeps {
|
|
7
|
+
notes: NotesService;
|
|
8
|
+
projects: ProjectService;
|
|
9
|
+
getConfig: () => Config;
|
|
10
|
+
transcribeSegment?: (buffer: Buffer, signal?: AbortSignal) => Promise<{
|
|
11
|
+
text: string;
|
|
12
|
+
provider: string;
|
|
13
|
+
}>;
|
|
14
|
+
enrichTranscript?: typeof enrichLiveDiscussion;
|
|
15
|
+
onTranscriptUpdated?: (discussionId: string, sequence: number) => void;
|
|
16
|
+
onDiscussionUpdated?: (capture: DiscussionCapture) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare class DiscussionLiveWorker {
|
|
19
|
+
private readonly deps;
|
|
20
|
+
private readonly intervalMs;
|
|
21
|
+
private readonly owner;
|
|
22
|
+
private readonly objectLinks;
|
|
23
|
+
private timer?;
|
|
24
|
+
private running;
|
|
25
|
+
private stoppedWaiters;
|
|
26
|
+
constructor(deps: DiscussionLiveWorkerDeps, intervalMs?: number);
|
|
27
|
+
start(): void;
|
|
28
|
+
stop(): Promise<void>;
|
|
29
|
+
tick(): Promise<void>;
|
|
30
|
+
private transcribeSegment;
|
|
31
|
+
private enrichOnce;
|
|
32
|
+
private linkProject;
|
|
33
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { ObjectLinkService } from "../activity/service.js";
|
|
4
|
+
import { transcribe } from "../voice/stt/transcribe-core.js";
|
|
5
|
+
import { isSTTAvailable } from "../voice/stt/availability.js";
|
|
6
|
+
import { mergeSttConfigFromAppConfig } from "../voice/stt/config.js";
|
|
7
|
+
import "../voice/stt/index.js";
|
|
8
|
+
import { enrichLiveDiscussion } from "./analyzer.js";
|
|
9
|
+
import { claimNextDiscussionTranscriptSegment, completeDiscussionTranscriptSegment, getDiscussionCapture, listDiscussionTranscriptSegments, retryOrFailDiscussionTranscriptSegment, updateDiscussionCapture } from "./repository.js";
|
|
10
|
+
import { assembleDiscussionTranscript } from "./transcript.js";
|
|
11
|
+
import { acceptRankedProject, findExactProjectMention } from "./project-inference.js";
|
|
12
|
+
import { randomUUID } from "node:crypto";
|
|
13
|
+
//#region src/discussions/live-worker.ts
|
|
14
|
+
init_logger();
|
|
15
|
+
const log = createLogger("DiscussionLiveWorker");
|
|
16
|
+
const MAX_ATTEMPTS = 3;
|
|
17
|
+
const MIN_ENRICHMENT_CHARS = 80;
|
|
18
|
+
var DiscussionLiveWorker = class {
|
|
19
|
+
owner = randomUUID();
|
|
20
|
+
objectLinks = new ObjectLinkService();
|
|
21
|
+
timer;
|
|
22
|
+
running = false;
|
|
23
|
+
stoppedWaiters = [];
|
|
24
|
+
constructor(deps, intervalMs = 1e3) {
|
|
25
|
+
this.deps = deps;
|
|
26
|
+
this.intervalMs = intervalMs;
|
|
27
|
+
}
|
|
28
|
+
start() {
|
|
29
|
+
if (this.timer) return;
|
|
30
|
+
this.timer = setInterval(() => void this.tick(), this.intervalMs);
|
|
31
|
+
this.timer.unref();
|
|
32
|
+
this.tick();
|
|
33
|
+
}
|
|
34
|
+
async stop() {
|
|
35
|
+
if (this.timer) clearInterval(this.timer);
|
|
36
|
+
this.timer = void 0;
|
|
37
|
+
if (!this.running) return;
|
|
38
|
+
await new Promise((resolve) => this.stoppedWaiters.push(resolve));
|
|
39
|
+
}
|
|
40
|
+
async tick() {
|
|
41
|
+
if (this.running) return;
|
|
42
|
+
this.running = true;
|
|
43
|
+
try {
|
|
44
|
+
const segment = claimNextDiscussionTranscriptSegment(this.owner);
|
|
45
|
+
if (!segment) return;
|
|
46
|
+
try {
|
|
47
|
+
const result = this.deps.transcribeSegment ? await this.deps.transcribeSegment(segment.audioBuffer) : await this.transcribeSegment(segment.audioBuffer);
|
|
48
|
+
if (!completeDiscussionTranscriptSegment(segment.discussionId, segment.sequence, this.owner, result.text.trim(), result.provider)) return;
|
|
49
|
+
this.deps.onTranscriptUpdated?.(segment.discussionId, segment.sequence);
|
|
50
|
+
await this.enrichOnce(segment.discussionId).catch((error) => {
|
|
51
|
+
log.warn({
|
|
52
|
+
err: error,
|
|
53
|
+
discussionId: segment.discussionId
|
|
54
|
+
}, "Live discussion enrichment failed");
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
const exhausted = segment.attemptCount >= MAX_ATTEMPTS;
|
|
58
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
59
|
+
retryOrFailDiscussionTranscriptSegment(segment.discussionId, segment.sequence, this.owner, message, exhausted);
|
|
60
|
+
this.deps.onTranscriptUpdated?.(segment.discussionId, segment.sequence);
|
|
61
|
+
log.warn({
|
|
62
|
+
err: error,
|
|
63
|
+
discussionId: segment.discussionId,
|
|
64
|
+
sequence: segment.sequence,
|
|
65
|
+
exhausted
|
|
66
|
+
}, `Live discussion transcription failed: ${message}`);
|
|
67
|
+
}
|
|
68
|
+
} finally {
|
|
69
|
+
this.running = false;
|
|
70
|
+
const waiters = this.stoppedWaiters.splice(0);
|
|
71
|
+
for (const resolve of waiters) resolve();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async transcribeSegment(buffer, signal) {
|
|
75
|
+
const config = this.deps.getConfig();
|
|
76
|
+
const sttConfig = mergeSttConfigFromAppConfig(config.tools?.media?.audio, config.tools?.media);
|
|
77
|
+
if (!isSTTAvailable(sttConfig)) throw new Error("STT is not configured");
|
|
78
|
+
return transcribe(buffer, sttConfig, {
|
|
79
|
+
mime: "audio/wav",
|
|
80
|
+
fileName: "discussion-segment.wav",
|
|
81
|
+
signal
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async enrichOnce(discussionId) {
|
|
85
|
+
const capture = getDiscussionCapture(discussionId);
|
|
86
|
+
if (!capture || capture.generatedTitle || capture.status === "cancelled" || capture.status === "completed") return;
|
|
87
|
+
const transcript = assembleDiscussionTranscript(listDiscussionTranscriptSegments(discussionId));
|
|
88
|
+
if (transcript.length < MIN_ENRICHMENT_CHARS) return;
|
|
89
|
+
const projects = this.deps.projects.list({
|
|
90
|
+
status: "active",
|
|
91
|
+
limit: 100
|
|
92
|
+
}).items;
|
|
93
|
+
const enrichment = await (this.deps.enrichTranscript ?? enrichLiveDiscussion)({
|
|
94
|
+
config: this.deps.getConfig(),
|
|
95
|
+
transcript,
|
|
96
|
+
projects: projects.map(({ id, name }) => ({
|
|
97
|
+
id,
|
|
98
|
+
name
|
|
99
|
+
}))
|
|
100
|
+
});
|
|
101
|
+
const exact = capture.projectId ? void 0 : findExactProjectMention(transcript, projects);
|
|
102
|
+
const ranked = capture.projectId ? void 0 : acceptRankedProject(enrichment, projects);
|
|
103
|
+
const inferred = exact ? {
|
|
104
|
+
id: exact.id,
|
|
105
|
+
score: 1,
|
|
106
|
+
source: "exact_name"
|
|
107
|
+
} : ranked ? {
|
|
108
|
+
...ranked,
|
|
109
|
+
source: "model"
|
|
110
|
+
} : void 0;
|
|
111
|
+
const note = await this.deps.notes.getNote(capture.noteId);
|
|
112
|
+
if (!note) throw new Error("Discussion note is missing");
|
|
113
|
+
if (note.title !== enrichment.title) {
|
|
114
|
+
if (!await this.deps.notes.updateNote(capture.noteId, { title: enrichment.title }, "ai_edit")) throw new Error("Discussion note disappeared while applying the live title");
|
|
115
|
+
}
|
|
116
|
+
const updated = updateDiscussionCapture(discussionId, {
|
|
117
|
+
generatedTitle: enrichment.title,
|
|
118
|
+
...inferred ? {
|
|
119
|
+
projectId: inferred.id,
|
|
120
|
+
projectInferenceScore: inferred.score,
|
|
121
|
+
projectInferenceSource: inferred.source
|
|
122
|
+
} : {}
|
|
123
|
+
}, [capture.status]);
|
|
124
|
+
if (!updated) return;
|
|
125
|
+
if (inferred) this.linkProject(updated, inferred.id);
|
|
126
|
+
this.deps.onDiscussionUpdated?.(updated);
|
|
127
|
+
}
|
|
128
|
+
linkProject(capture, projectId) {
|
|
129
|
+
const project = this.deps.projects.get(projectId);
|
|
130
|
+
if (!project) return;
|
|
131
|
+
this.objectLinks.create({
|
|
132
|
+
id: `discussion:${capture.id}:project`,
|
|
133
|
+
from: {
|
|
134
|
+
kind: "note",
|
|
135
|
+
id: capture.noteId
|
|
136
|
+
},
|
|
137
|
+
to: {
|
|
138
|
+
kind: "project",
|
|
139
|
+
id: project.id,
|
|
140
|
+
title: project.name
|
|
141
|
+
},
|
|
142
|
+
relation: "belongs_to",
|
|
143
|
+
source: "agent"
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
//#endregion
|
|
148
|
+
export { DiscussionLiveWorker };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Config } from '../config/schema.js';
|
|
2
|
+
import type { NotesService } from '../notes/service.js';
|
|
3
|
+
import type { ProjectService } from '../projects/project-service.js';
|
|
4
|
+
import type { DiscussionAnalysis, DiscussionCapture } from './types.js';
|
|
5
|
+
export interface DiscussionTranscriptionResult {
|
|
6
|
+
text: string;
|
|
7
|
+
provider: string;
|
|
8
|
+
language?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DiscussionPipelineDeps {
|
|
11
|
+
notes: NotesService;
|
|
12
|
+
projects: ProjectService;
|
|
13
|
+
getConfig: () => Config;
|
|
14
|
+
transcribeAudio?: (buffer: Buffer, capture: DiscussionCapture, signal?: AbortSignal) => Promise<DiscussionTranscriptionResult>;
|
|
15
|
+
analyzeTranscript?: (transcript: string, capture: DiscussionCapture, signal?: AbortSignal) => Promise<{
|
|
16
|
+
analysis: DiscussionAnalysis;
|
|
17
|
+
modelRef: string;
|
|
18
|
+
}>;
|
|
19
|
+
onUpdated?: (capture: DiscussionCapture) => void;
|
|
20
|
+
onCompleted?: (capture: DiscussionCapture, analysis: DiscussionAnalysis) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function mergeDiscussionAnalysisIntoMarkdown(markdown: string, transcript: string, analysis: DiscussionAnalysis, audioRef?: string): string;
|
|
23
|
+
export declare class DiscussionPipeline {
|
|
24
|
+
private readonly deps;
|
|
25
|
+
private readonly objectLinks;
|
|
26
|
+
constructor(deps: DiscussionPipelineDeps);
|
|
27
|
+
process(capture: DiscussionCapture, owner: string, signal?: AbortSignal): Promise<DiscussionCapture>;
|
|
28
|
+
private transcribe;
|
|
29
|
+
private analyze;
|
|
30
|
+
private writeNote;
|
|
31
|
+
private linkProject;
|
|
32
|
+
private defaultTranscribe;
|
|
33
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { buildNoteAttachmentRef } from "../notes/attachment-ref.js";
|
|
2
|
+
import { ObjectLinkService } from "../activity/service.js";
|
|
3
|
+
import { transcribe } from "../voice/stt/transcribe-core.js";
|
|
4
|
+
import { isSTTAvailable } from "../voice/stt/availability.js";
|
|
5
|
+
import { mergeSttConfigFromAppConfig } from "../voice/stt/config.js";
|
|
6
|
+
import "../voice/stt/index.js";
|
|
7
|
+
import { analyzeDiscussion } from "./analyzer.js";
|
|
8
|
+
import { deleteDiscussionSegmentAudio, updateDiscussionCapture } from "./repository.js";
|
|
9
|
+
import { acceptRankedProject, findExactProjectMention } from "./project-inference.js";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { readFile } from "node:fs/promises";
|
|
12
|
+
//#region src/discussions/pipeline.ts
|
|
13
|
+
const MANAGED_START = "<!-- xopc:discussion-analysis:start -->";
|
|
14
|
+
const MANAGED_END = "<!-- xopc:discussion-analysis:end -->";
|
|
15
|
+
function list(values) {
|
|
16
|
+
return values.length > 0 ? values.map((value) => `- ${value}`).join("\n") : "- None identified";
|
|
17
|
+
}
|
|
18
|
+
function renderManagedSection(transcript, analysis) {
|
|
19
|
+
const actions = analysis.actionItems.length > 0 ? analysis.actionItems.map((item) => {
|
|
20
|
+
const metadata = [item.owner ? `Owner: ${item.owner}` : "", item.dueDate ? `Due: ${item.dueDate}` : ""].filter(Boolean).join(" · ");
|
|
21
|
+
return `- [ ] ${item.title}${metadata ? ` — ${metadata}` : ""}`;
|
|
22
|
+
}).join("\n") : "- None identified";
|
|
23
|
+
return [
|
|
24
|
+
MANAGED_START,
|
|
25
|
+
"## Summary",
|
|
26
|
+
analysis.summary,
|
|
27
|
+
"",
|
|
28
|
+
"## Key points",
|
|
29
|
+
list(analysis.keyPoints),
|
|
30
|
+
"",
|
|
31
|
+
"## Decisions",
|
|
32
|
+
list(analysis.decisions),
|
|
33
|
+
"",
|
|
34
|
+
"## Action items",
|
|
35
|
+
actions,
|
|
36
|
+
"",
|
|
37
|
+
"## Risks",
|
|
38
|
+
list(analysis.risks),
|
|
39
|
+
"",
|
|
40
|
+
"## Open questions",
|
|
41
|
+
list(analysis.openQuestions),
|
|
42
|
+
"",
|
|
43
|
+
"## Transcript",
|
|
44
|
+
transcript.trim(),
|
|
45
|
+
MANAGED_END
|
|
46
|
+
].join("\n");
|
|
47
|
+
}
|
|
48
|
+
function mergeDiscussionAnalysisIntoMarkdown(markdown, transcript, analysis, audioRef) {
|
|
49
|
+
const managed = renderManagedSection(transcript, analysis);
|
|
50
|
+
const withoutPlaceholder = markdown.replace(/^> Recording in progress\. Live transcript will appear here\.\s*$/gm, "").replace(/^> Finalizing recording\.\.\.\s*$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
51
|
+
const start = withoutPlaceholder.indexOf(MANAGED_START);
|
|
52
|
+
const end = withoutPlaceholder.indexOf(MANAGED_END);
|
|
53
|
+
const base = start >= 0 && end >= start ? `${withoutPlaceholder.slice(0, start).trimEnd()}\n\n${managed}${withoutPlaceholder.slice(end + 37)}`.trim() : `${withoutPlaceholder}\n\n${managed}`.trim();
|
|
54
|
+
return audioRef && !base.includes(`](${audioRef})`) ? `${base}\n\n[Discussion audio](${audioRef})` : base;
|
|
55
|
+
}
|
|
56
|
+
var DiscussionPipeline = class {
|
|
57
|
+
objectLinks = new ObjectLinkService();
|
|
58
|
+
constructor(deps) {
|
|
59
|
+
this.deps = deps;
|
|
60
|
+
}
|
|
61
|
+
async process(capture, owner, signal) {
|
|
62
|
+
let current = capture;
|
|
63
|
+
if (!current.transcriptRaw) current = await this.transcribe(current, owner, signal);
|
|
64
|
+
if (!current.analysis) current = await this.analyze(current, owner, signal);
|
|
65
|
+
return this.writeNote(current);
|
|
66
|
+
}
|
|
67
|
+
async transcribe(capture, owner, signal) {
|
|
68
|
+
if (!capture.audioAttachmentId) throw new Error("Discussion audio attachment is missing");
|
|
69
|
+
const attachment = await this.deps.notes.getAttachmentPath(capture.noteId, capture.audioAttachmentId);
|
|
70
|
+
if (!attachment) throw new Error("Discussion audio file is missing");
|
|
71
|
+
const buffer = await readFile(attachment.filePath);
|
|
72
|
+
const result = this.deps.transcribeAudio ? await this.deps.transcribeAudio(buffer, capture, signal) : await this.defaultTranscribe(buffer, capture, attachment, signal);
|
|
73
|
+
const transcript = result.text.trim();
|
|
74
|
+
if (!transcript) throw new Error("Discussion transcription produced no text");
|
|
75
|
+
const updated = updateDiscussionCapture(capture.id, {
|
|
76
|
+
processingStage: "analysis",
|
|
77
|
+
transcriptRaw: transcript,
|
|
78
|
+
transcriptSha256: createHash("sha256").update(transcript).digest("hex"),
|
|
79
|
+
transcriptLanguage: result.language,
|
|
80
|
+
sttProvider: result.provider,
|
|
81
|
+
lastErrorCode: void 0,
|
|
82
|
+
lastErrorMessage: void 0,
|
|
83
|
+
leaseOwner: owner,
|
|
84
|
+
leaseExpiresAt: Date.now() + 5 * 6e4
|
|
85
|
+
}, ["finalizing"]);
|
|
86
|
+
if (!updated) throw new Error("Discussion changed while transcribing");
|
|
87
|
+
this.deps.onUpdated?.(updated);
|
|
88
|
+
return updated;
|
|
89
|
+
}
|
|
90
|
+
async analyze(capture, owner, signal) {
|
|
91
|
+
if (!capture.transcriptRaw) throw new Error("Discussion transcript is missing");
|
|
92
|
+
const projects = this.deps.projects.list({
|
|
93
|
+
status: "active",
|
|
94
|
+
limit: 100
|
|
95
|
+
}).items;
|
|
96
|
+
const result = this.deps.analyzeTranscript ? await this.deps.analyzeTranscript(capture.transcriptRaw, capture, signal) : await analyzeDiscussion({
|
|
97
|
+
config: this.deps.getConfig(),
|
|
98
|
+
transcript: capture.transcriptRaw,
|
|
99
|
+
projects: projects.map(({ id, name }) => ({
|
|
100
|
+
id,
|
|
101
|
+
name
|
|
102
|
+
})),
|
|
103
|
+
signal
|
|
104
|
+
});
|
|
105
|
+
const analysis = result.analysis;
|
|
106
|
+
let inferredProject;
|
|
107
|
+
if (!capture.projectId) {
|
|
108
|
+
const exact = findExactProjectMention(capture.transcriptRaw, projects);
|
|
109
|
+
const ranked = acceptRankedProject(analysis, projects);
|
|
110
|
+
if (exact) inferredProject = {
|
|
111
|
+
id: exact.id,
|
|
112
|
+
score: 1,
|
|
113
|
+
source: "exact_name"
|
|
114
|
+
};
|
|
115
|
+
else if (ranked) inferredProject = {
|
|
116
|
+
...ranked,
|
|
117
|
+
source: "model"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const updated = updateDiscussionCapture(capture.id, {
|
|
121
|
+
processingStage: "note_write",
|
|
122
|
+
analysis,
|
|
123
|
+
analysisInputHash: capture.transcriptSha256,
|
|
124
|
+
analyzerModelRef: result.modelRef,
|
|
125
|
+
generatedTitle: analysis.title,
|
|
126
|
+
...inferredProject ? {
|
|
127
|
+
projectId: inferredProject.id,
|
|
128
|
+
projectInferenceScore: inferredProject.score,
|
|
129
|
+
projectInferenceSource: inferredProject.source
|
|
130
|
+
} : {},
|
|
131
|
+
leaseOwner: owner,
|
|
132
|
+
leaseExpiresAt: Date.now() + 5 * 6e4
|
|
133
|
+
}, ["finalizing"]);
|
|
134
|
+
if (!updated) throw new Error("Discussion changed while analyzing");
|
|
135
|
+
if (inferredProject) this.linkProject(updated, inferredProject.id);
|
|
136
|
+
this.deps.onUpdated?.(updated);
|
|
137
|
+
return updated;
|
|
138
|
+
}
|
|
139
|
+
async writeNote(capture) {
|
|
140
|
+
if (!capture.transcriptRaw || !capture.analysis || !capture.audioAttachmentId) throw new Error("Discussion finalization data is incomplete");
|
|
141
|
+
const note = await this.deps.notes.getNote(capture.noteId);
|
|
142
|
+
if (!note) throw new Error("Discussion note is missing");
|
|
143
|
+
const title = capture.analysis.title.trim().slice(0, 200);
|
|
144
|
+
const audioRef = buildNoteAttachmentRef(capture.noteId, capture.audioAttachmentId);
|
|
145
|
+
const markdown = mergeDiscussionAnalysisIntoMarkdown(note.markdown, capture.transcriptRaw, capture.analysis, audioRef);
|
|
146
|
+
const attachments = (note.attachments ?? []).map((attachment) => attachment.id === capture.audioAttachmentId ? {
|
|
147
|
+
...attachment,
|
|
148
|
+
transcript: capture.transcriptRaw
|
|
149
|
+
} : attachment);
|
|
150
|
+
if (capture.projectId && capture.projectInferenceSource !== "context") this.linkProject(capture, capture.projectId);
|
|
151
|
+
if (note.title !== title || note.markdown !== markdown || note.status !== "processed") await this.deps.notes.updateNote(capture.noteId, {
|
|
152
|
+
title,
|
|
153
|
+
markdown,
|
|
154
|
+
attachments,
|
|
155
|
+
status: "processed"
|
|
156
|
+
}, "ai_edit");
|
|
157
|
+
const now = Date.now();
|
|
158
|
+
const updated = updateDiscussionCapture(capture.id, {
|
|
159
|
+
status: "completed",
|
|
160
|
+
processingStage: void 0,
|
|
161
|
+
finalizationRevision: capture.finalizationRevision + 1,
|
|
162
|
+
completedAt: now,
|
|
163
|
+
leaseOwner: void 0,
|
|
164
|
+
leaseExpiresAt: void 0,
|
|
165
|
+
nextAttemptAt: void 0,
|
|
166
|
+
lastErrorCode: void 0,
|
|
167
|
+
lastErrorMessage: void 0
|
|
168
|
+
}, ["finalizing"]);
|
|
169
|
+
if (!updated || updated.leaseOwner) throw new Error("Discussion changed while writing the note");
|
|
170
|
+
deleteDiscussionSegmentAudio(capture.id);
|
|
171
|
+
this.deps.onUpdated?.(updated);
|
|
172
|
+
this.deps.onCompleted?.(updated, capture.analysis);
|
|
173
|
+
return updated;
|
|
174
|
+
}
|
|
175
|
+
linkProject(capture, projectId) {
|
|
176
|
+
const project = this.deps.projects.get(projectId);
|
|
177
|
+
if (!project) return;
|
|
178
|
+
this.objectLinks.create({
|
|
179
|
+
id: `discussion:${capture.id}:project`,
|
|
180
|
+
from: {
|
|
181
|
+
kind: "note",
|
|
182
|
+
id: capture.noteId
|
|
183
|
+
},
|
|
184
|
+
to: {
|
|
185
|
+
kind: "project",
|
|
186
|
+
id: project.id,
|
|
187
|
+
title: project.name
|
|
188
|
+
},
|
|
189
|
+
relation: "belongs_to",
|
|
190
|
+
source: "agent"
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
async defaultTranscribe(buffer, capture, attachment, signal) {
|
|
194
|
+
const config = this.deps.getConfig();
|
|
195
|
+
const sttConfig = mergeSttConfigFromAppConfig(config.tools?.media?.audio, config.tools?.media);
|
|
196
|
+
if (!isSTTAvailable(sttConfig)) throw new Error("STT is not configured");
|
|
197
|
+
return transcribe(buffer, sttConfig, {
|
|
198
|
+
mime: attachment.mimeType || capture.mimeType,
|
|
199
|
+
fileName: attachment.fileName,
|
|
200
|
+
signal
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
//#endregion
|
|
205
|
+
export { DiscussionPipeline, mergeDiscussionAnalysisIntoMarkdown };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DiscussionProjectCandidate {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function findExactProjectMention(transcript: string, projects: DiscussionProjectCandidate[]): DiscussionProjectCandidate | undefined;
|
|
6
|
+
export declare function acceptRankedProject(input: {
|
|
7
|
+
projectCandidateId?: string;
|
|
8
|
+
projectConfidence?: number;
|
|
9
|
+
projectAlternativeConfidence?: number;
|
|
10
|
+
}, projects: DiscussionProjectCandidate[]): {
|
|
11
|
+
id: string;
|
|
12
|
+
score: number;
|
|
13
|
+
} | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/discussions/project-inference.ts
|
|
2
|
+
function findExactProjectMention(transcript, projects) {
|
|
3
|
+
const normalizedTranscript = normalize(transcript);
|
|
4
|
+
const matches = projects.filter((project) => normalizedTranscript.includes(normalize(project.name)));
|
|
5
|
+
return matches.length === 1 ? matches[0] : void 0;
|
|
6
|
+
}
|
|
7
|
+
function acceptRankedProject(input, projects) {
|
|
8
|
+
const score = input.projectConfidence ?? 0;
|
|
9
|
+
if (!input.projectCandidateId || !projects.some((project) => project.id === input.projectCandidateId) || score < .85 || score - (input.projectAlternativeConfidence ?? 0) < .15) return void 0;
|
|
10
|
+
return {
|
|
11
|
+
id: input.projectCandidateId,
|
|
12
|
+
score
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function normalize(value) {
|
|
16
|
+
return value.normalize("NFKC").toLocaleLowerCase().replace(/\s+/g, " ").trim();
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { acceptRankedProject, findExactProjectMention };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DiscussionCapture, DiscussionCaptureSettings, DiscussionListResult, DiscussionMetrics, DiscussionStatus, DiscussionTranscriptSegment, ListDiscussionsQuery } from './types.js';
|
|
2
|
+
export interface ClaimedDiscussionTranscriptSegment extends DiscussionTranscriptSegment {
|
|
3
|
+
audioBuffer: Buffer;
|
|
4
|
+
}
|
|
5
|
+
export declare function createDiscussionCapture(capture: DiscussionCapture): DiscussionCapture;
|
|
6
|
+
export declare function getDiscussionCapture(id: string): DiscussionCapture | null;
|
|
7
|
+
export declare function getDiscussionCaptureByClientRequestId(clientRequestId: string): DiscussionCapture | null;
|
|
8
|
+
export declare function getDiscussionCaptureByNoteId(noteId: string): DiscussionCapture | null;
|
|
9
|
+
export declare function listDiscussionCaptures(query?: ListDiscussionsQuery): DiscussionListResult;
|
|
10
|
+
export declare function getDiscussionMetrics(): DiscussionMetrics;
|
|
11
|
+
export declare function updateDiscussionCapture(id: string, patch: Partial<Omit<DiscussionCapture, 'id' | 'clientRequestId' | 'noteId' | 'createdAt'>>, expectedStatuses?: DiscussionStatus[]): DiscussionCapture | null;
|
|
12
|
+
export declare function claimNextDiscussionCapture(owner: string, now?: number, leaseMs?: number): DiscussionCapture | null;
|
|
13
|
+
export declare function createDiscussionTranscriptSegment(input: {
|
|
14
|
+
discussionId: string;
|
|
15
|
+
sequence: number;
|
|
16
|
+
audioSha256: string;
|
|
17
|
+
audioBuffer: Buffer;
|
|
18
|
+
startedAtMs: number;
|
|
19
|
+
endedAtMs: number;
|
|
20
|
+
now?: number;
|
|
21
|
+
}): DiscussionTranscriptSegment;
|
|
22
|
+
export declare function getDiscussionTranscriptSegment(discussionId: string, sequence: number): DiscussionTranscriptSegment | null;
|
|
23
|
+
export declare function listDiscussionTranscriptSegments(discussionId: string): DiscussionTranscriptSegment[];
|
|
24
|
+
export declare function claimNextDiscussionTranscriptSegment(owner: string, now?: number, leaseMs?: number): ClaimedDiscussionTranscriptSegment | null;
|
|
25
|
+
export declare function completeDiscussionTranscriptSegment(discussionId: string, sequence: number, owner: string, transcript: string, provider: string): DiscussionTranscriptSegment | null;
|
|
26
|
+
export declare function retryOrFailDiscussionTranscriptSegment(discussionId: string, sequence: number, owner: string, error: string, exhausted: boolean): DiscussionTranscriptSegment | null;
|
|
27
|
+
export declare function deleteDiscussionSegmentAudio(discussionId: string): void;
|
|
28
|
+
export declare function getDiscussionCaptureSettings(): DiscussionCaptureSettings;
|
|
29
|
+
export declare function acknowledgeDiscussionCaptureConsent(policyVersion: number): DiscussionCaptureSettings;
|