@xopcai/xopc 0.0.389 → 0.0.391
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-dvik6t7Z.js → activity-store-DWQCDi8M.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-bWMd5TDC.js → agent-avatar-dicebear-CzS0TUv9.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DE910MyU.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-UunIxc1q.js → agent-plugin-dialog-0SlvsYl7.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BZh28Qn1.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-BlNGyXpm.js → agents-admin-api-Bb3Kvz3X.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-9A7JN5V5.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-CUAdx44v.js → appearance-settings-BPdLEo6L.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-D5zDB6gp.js → apps-page-Cz7LypV9.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Du6dJNcl.js → archive-plugin-DFnHPNie.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BO8Ig5Z4.js → automations-page-CnBLPVNh.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBjS-sk-.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D7VJjwnr.js → binary-plugins-BQC0Tzoi.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CaJlWTAn.js → block-editor-DSh5019z.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-automation-inputs-iyMBJmQX.js → browser-automation-inputs-C5tIrIRL.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CFCMNfJN.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-C__tyPwu.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-CEH1AnXc.js → capabilities-D6RJG4QY.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-MCKRMZDK.js → capabilities-DGEmBQnF.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-B5AZa7ir.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dskz2_bh.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-BIA0Lwt5.js → capability-header-actions-xzjWZVbg.js} +1 -1
- package/dist/gateway/static/root/assets/channels-DRse_dD3.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-CQF0M4kE.js +36 -0
- package/dist/gateway/static/root/assets/{computer-settings-page-DvY3zgyY.js → computer-settings-page-ZfzCTS0N.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-St2-Fj3y.js → connector-service-page-CwAeWVLK.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CanakKaj.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-C0-D80ny.js → date-picker-hmJlEAQZ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CNd7mwMU.js → dependency-picker-Us_Juz6I.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-C-2wDANn.js → desktop-pet-CvOTI4uw.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DyhxLrdJ.js → desktop-pet-settings-DYg-Gb8t.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-B1FbZ8C1.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CNivVIPT.js → directory-picker-path-field-DZN9EDvM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CGYO3JPw.js → extension-debug-page-YIibp6Kk.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Dc51ALAg.js → extension-page-DkcGyb28.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BXPILdlw.js → extension-provider-B1PQGTtY.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C_rJiSKo.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-Bc2MytsF.js → gateway-config-swr-Dv_A5FMu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BFK-vlME.js → gateway-realtime-DghCGfY_.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CMJVSnvi.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CjCWPHNJ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BDPMttPx.js → gateway-startup-retry-CkTVSESs.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DAlRGMge.js → highlighted-body-KQOG7T2V-DV2wNqBn.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-fAYsd7kG.js +2 -0
- package/dist/gateway/static/root/assets/image-generation-api-B98iXt6A.js +1 -0
- package/dist/gateway/static/root/assets/imports-page-DoBCBN8G.js +1 -0
- package/dist/gateway/static/root/assets/index-DFgXwLsv.js +260 -0
- package/dist/gateway/static/root/assets/index-a6ZvhclR.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BYYC9Qmw.js → keyboard-shortcuts-settings-DXVu4lqV.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B3fz6uRi.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BU8pUsVM.js → local-apps-page-BC6xhmUh.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-kFc_MAA9.js → local-session-drafts-DFnZQu9A.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dr43FCty.js → locale-store-BpK9AiDq.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CSqSFDRU.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-gq5L0THs.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-CdKlPjJM.js → markdown-view-IsYTotu6.js} +18 -18
- package/dist/gateway/static/root/assets/{media-plugins-DE9zt88i.js → media-plugins-oSChWbcP.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C_QKwqDN.js +1 -0
- package/dist/gateway/static/root/assets/messages-CKTo_sIF.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-cache-TjpL7hZ5.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CdpNXre-.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-BHouNL6-.js → notes-api-CBb944yw.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-EGvGw8MN.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-TQr8NnSc.js → page-context-capture-button-CoWb7BYP.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-DYzbNTyN.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BEl6syFp.js → product-open-page-CTyy7H7-.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-BxSHnbqz.js → product-preview-content-D4xqTaEy.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DIVCw0QQ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-B4L9VnBN.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BD5IgDOA.js → registry-api-Dsa2LvRt.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B8PvgLVz.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-CjTRoQWT.js → runtime-tools-api-C2Uw89eY.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bqnp3tyt.js +1 -0
- package/dist/gateway/static/root/assets/scenes-page-D50g4GM2.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-ByG-R6N2.js → schema-form-h_RCNfiO.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-UAVStisp.js → send-session-input-DypbVTT7.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DvgEiNRS.js → session-api-ga-SUOq_.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-BOb1tC_Z.js → session-manager-C_OiKblh.js} +8 -8
- package/dist/gateway/static/root/assets/sessions-page-BsqDIbIr.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D3zJAW4p.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C1e9m23j.js → settings-page-DPCgrICd.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-jjSYJpDd.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-kE_6v5Dp.js → share-link-dialog-BGicglAS.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BT-_yR1h.js → share-preview-page-BORe9rLB.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-Dg_SqHQE.js → shares-api-Dbx3z6-1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-C13FgfWk.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BslUYMnX.js → skill-api-Cq6O1DZK.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BQ2rTOP1.js → skill-reload-api-Cq7QDjMA.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-BM1ShEjx.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-GpbPfWwo.js → system-settings-panel-BNCGFO1e.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-4VG82wcF.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-DJrrEBB4.js → task-expandable-content-DAZGz5YC.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BKpYnggg.js → theme-store-Db7hDESt.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-D71w7dwV.js → tracing-settings-page-C6p2Mu92.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BV46CvS8.js → tunnel-api-Dw15EJp0.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-DDrIqgGe.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CzyqRffr.js → use-autosave-DDjIdW4U.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Dviq-1f6.js → use-composer-attachments-DNl7O3Vb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-D5Kk7Hon.js → use-file-preview-expanded-DMHehhwG.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-CaS9dOIr.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DWtbmacd.js → voice-api-key-field-ByAxHE4P.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DnIjZm_9.js → voice-config-api-Dl39b27p.js} +1 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-CVaU83Jc.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-ChEG71hz.js → work-discovery-overlay-BvVvPA1T.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BcFm9QcC.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-DMec_XZB.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-CZDvu7uA.js → workspace-api-BpfKsrtP.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CbUgg1SK.js → xopc-cloud-account-card-CU5lzzE9.js} +1 -1
- package/dist/gateway/static/root/index.html +28 -35
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/discussions.js +3 -2
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/provider-setup.js +6 -0
- package/dist/packages/gateway-contract/src/recording-outcome.js +6 -0
- package/dist/packages/image-providers/src/catalog.js +10 -0
- package/dist/packages/image-providers/src/execute.js +5 -1
- package/dist/packages/image-providers/src/validation.js +19 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +4 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +0 -1
- package/dist/src/agent/background-review/run-background-review.js +10 -2
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +2 -0
- package/dist/src/agent/embedded/execution-tool-policy.js +8 -3
- package/dist/src/agent/embedded/run-for-session.js +26 -3
- package/dist/src/agent/embedded/run-turn.js +14 -1
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +3 -0
- package/dist/src/agent/image/generation/runtime.js +12 -14
- package/dist/src/agent/image/understanding/runtime.js +5 -0
- package/dist/src/agent/inbound/inbound-loop.d.ts +1 -15
- package/dist/src/agent/inbound/inbound-loop.js +5 -0
- package/dist/src/agent/mcp/connection-errors.d.ts +3 -0
- package/dist/src/agent/mcp/connection-errors.js +32 -0
- package/dist/src/agent/mcp/connection-setup.d.ts +2 -0
- package/dist/src/agent/mcp/connection-setup.js +38 -18
- package/dist/src/agent/memory/compaction.js +5 -1
- package/dist/src/agent/memory/idle-compaction-scheduler.js +3 -1
- package/dist/src/agent/models/manager.d.ts +1 -0
- package/dist/src/agent/models/manager.js +4 -2
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +1 -6
- package/dist/src/agent/orchestration/agent-orchestrator.js +5 -0
- package/dist/src/agent/service/process-direct-one-shot.js +5 -0
- package/dist/src/agent/service/process-direct-streaming.d.ts +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +17 -1
- package/dist/src/agent/tools/factory.js +14 -12
- package/dist/src/agent/tools/image-generate-tool.js +5 -1
- package/dist/src/agent/tools/personal-read-tool.js +4 -0
- package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
- package/dist/src/agent-config/resolver.js +5 -0
- package/dist/src/agent-config/schema.d.ts +26 -6
- package/dist/src/agent-config/schema.js +2 -0
- package/dist/src/ai-assist/text-assist.js +5 -16
- package/dist/src/automations/service/action-executor.js +3 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-model-intents.js +4 -1
- package/dist/src/config/schema.d.ts +11 -5
- package/dist/src/config/schema.js +11 -3
- package/dist/src/discussions/analyzer.d.ts +2 -0
- package/dist/src/discussions/analyzer.js +38 -9
- package/dist/src/discussions/audio-clip.d.ts +3 -0
- package/dist/src/discussions/audio-clip.js +72 -0
- package/dist/src/discussions/live-worker.js +3 -1
- package/dist/src/discussions/long-review.d.ts +17 -0
- package/dist/src/discussions/long-review.js +278 -0
- package/dist/src/discussions/media-timeline.d.ts +21 -0
- package/dist/src/discussions/media-timeline.js +134 -0
- package/dist/src/discussions/organizer-worker.d.ts +4 -1
- package/dist/src/discussions/organizer-worker.js +17 -12
- package/dist/src/discussions/organizer.js +2 -0
- package/dist/src/discussions/processing.d.ts +43 -0
- package/dist/src/discussions/processing.js +125 -0
- package/dist/src/discussions/recording.js +202 -42
- package/dist/src/discussions/recordingJobs.js +2 -0
- package/dist/src/discussions/repository.js +4 -2
- package/dist/src/discussions/review.d.ts +8 -0
- package/dist/src/discussions/review.js +183 -0
- package/dist/src/discussions/sealer.d.ts +7 -1
- package/dist/src/discussions/sealer.js +163 -87
- package/dist/src/discussions/service.d.ts +7 -1
- package/dist/src/discussions/service.js +51 -15
- package/dist/src/discussions/types.d.ts +2 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/global-defaults-admin.d.ts +3 -1
- package/dist/src/gateway/global-defaults-admin.js +14 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +11 -2
- package/dist/src/gateway/hono/lib/config-payload.js +2 -0
- package/dist/src/gateway/hono/lib/voice-settings-revisions.d.ts +5 -0
- package/dist/src/gateway/hono/lib/voice-settings-revisions.js +24 -0
- package/dist/src/gateway/hono/routes/commands-skills.js +15 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.js +8 -1
- package/dist/src/gateway/hono/routes/config.js +12 -0
- package/dist/src/gateway/hono/routes/discussions.js +63 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +8 -1
- package/dist/src/gateway/hono/routes/models.js +12 -4
- package/dist/src/gateway/hono/routes/provider-setup.d.ts +3 -0
- package/dist/src/gateway/hono/routes/provider-setup.js +106 -0
- package/dist/src/gateway/hono/routes/status.js +2 -0
- package/dist/src/gateway/hono/routes/voice.js +23 -10
- package/dist/src/gateway/provider-model-setup.d.ts +4 -0
- package/dist/src/gateway/provider-model-setup.js +56 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
- package/dist/src/gateway/service.js +2 -0
- package/dist/src/media-shared/http/provider-http.d.ts +0 -6
- package/dist/src/media-shared/http/provider-http.js +5 -4
- package/dist/src/media-understanding/runner.d.ts +0 -28
- package/dist/src/media-understanding/runner.js +4 -0
- package/dist/src/platform/client.d.ts +1 -1
- package/dist/src/platform/contracts.d.ts +1 -1
- package/dist/src/providers/env-keys.js +3 -0
- package/dist/src/providers/extension-stream-bridge.js +3 -0
- package/dist/src/providers/index.js +15 -0
- package/dist/src/providers/model-call.d.ts +5 -2
- package/dist/src/providers/model-call.js +13 -2
- package/dist/src/providers/model-reference-auditor.js +1 -0
- package/dist/src/providers/model-response.js +1 -1
- package/dist/src/providers/model-usage.d.ts +15 -0
- package/dist/src/providers/model-usage.js +50 -0
- package/dist/src/providers/presentation.js +8 -0
- package/dist/src/providers/setup/engine.d.ts +37 -0
- package/dist/src/providers/setup/engine.js +177 -0
- package/dist/src/providers/setup/profiles.d.ts +4 -0
- package/dist/src/providers/setup/profiles.js +78 -0
- package/dist/src/providers/setup/voice.d.ts +23 -0
- package/dist/src/providers/setup/voice.js +234 -0
- package/dist/src/scenes/agentExecutor.d.ts +1 -0
- package/dist/src/scenes/agentExecutor.js +5 -0
- package/dist/src/storage/sqlite/migrations/253_discussion_processing_recovery.sql +20 -0
- package/dist/src/storage/sqlite/migrations/254_discussion_annotations.sql +17 -0
- package/dist/src/storage/sqlite/migrations/255_discussion_chapter_progress.sql +10 -0
- package/dist/src/storage/sqlite/migrations/256_task_main_update_retries.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/schema.js +1 -1
- package/dist/src/tasks/task-collaboration-repository.d.ts +2 -0
- package/dist/src/tasks/task-collaboration-repository.js +7 -1
- package/dist/src/tasks/task-main-update-delivery.js +11 -4
- package/dist/src/tasks/task-main-update-input.js +2 -1
- package/dist/src/tasks/task-main-update-retry.d.ts +5 -0
- package/dist/src/tasks/task-main-update-retry.js +15 -0
- package/dist/src/usage/recorder.js +2 -1
- package/dist/src/usage/scenario-registry.js +128 -123
- package/dist/src/voice/dashscope/streaming-stt-session.js +3 -0
- package/dist/src/voice/dashscope/streaming-tts-stream.js +3 -0
- package/dist/src/voice/dictation.d.ts +12 -0
- package/dist/src/voice/dictation.js +22 -0
- package/dist/src/voice/metadata/builtin.js +54 -0
- package/dist/src/voice/platform-streams.js +3 -0
- package/dist/src/voice/realtime/omniEngine.js +3 -0
- package/dist/src/voice/realtime/omniRoute.js +3 -2
- package/dist/src/voice/realtime/runtime.js +4 -2
- package/dist/src/voice/stt/factory.js +9 -3
- package/dist/src/voice/stt/providers/bailian-plan-transcription.d.ts +2 -0
- package/dist/src/voice/stt/providers/bailian-plan-transcription.js +32 -0
- package/dist/src/voice/stt/providers/index.d.ts +1 -0
- package/dist/src/voice/stt/providers/index.js +2 -1
- package/dist/src/voice/token-plan.d.ts +8 -0
- package/dist/src/voice/token-plan.js +11 -0
- package/dist/src/voice/tts/factory.js +4 -1
- package/dist/src/voice/tts/providers/bailian-plan-speech.d.ts +2 -0
- package/dist/src/voice/tts/providers/bailian-plan-speech.js +84 -0
- package/dist/src/voice/tts/providers/index.d.ts +1 -0
- package/dist/src/voice/tts/providers/index.js +2 -1
- package/dist/src/voice/tts/speak-core.js +10 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Ds0Ue2FB.js +0 -1
- package/dist/gateway/static/root/assets/agents-BLRM4o-U.js +0 -77
- package/dist/gateway/static/root/assets/app-management-settings-panel-Dmy828Pe.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-UcCneEs3.js +0 -6
- package/dist/gateway/static/root/assets/bot-DjLkhyZL.js +0 -1
- package/dist/gateway/static/root/assets/browser-automations-page-BjvQnYfO.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-D5ZghI28.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-MC8qIrXo.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Blz3hEzp.js +0 -8
- package/dist/gateway/static/root/assets/channels-DSg_iCVC.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-C97SJEwd.js +0 -36
- package/dist/gateway/static/root/assets/circle-pause-CN9jYH2s.js +0 -1
- package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DXk-GAsd.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-BeSuq__I.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-jYu6qpY2.js +0 -1
- package/dist/gateway/static/root/assets/fallback-models-CoyzvDo7.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-C3vH-Iup.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-JlT1dlSj.js +0 -1
- package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DOVl8s-1.js +0 -2
- package/dist/gateway/static/root/assets/image-generation-api-BZBiYDmV.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DgdBTp_0.js +0 -1
- package/dist/gateway/static/root/assets/index-CmC8JkSM.js +0 -260
- package/dist/gateway/static/root/assets/index-Dgzc0oBu.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BKZfn-MS.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BSepiACn.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-dE_ykPNY.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-65SE6j-_.js +0 -1
- package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +0 -1
- package/dist/gateway/static/root/assets/messages-DlTNQI92.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-C7FAsEe_.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-D9oqhdyk.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-Bd4_7ph8.js +0 -8
- package/dist/gateway/static/root/assets/pause-DuPxgSxk.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-BvWzq4Wp.js +0 -1
- package/dist/gateway/static/root/assets/play-kxZvpBg8.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-D-qkIXVT.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BQtw1Dfn.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CYFNz0Jc.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Qq_NyYx_.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-hGr-ppYk.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-CpX1Rluw.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D2s_MlxR.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-BTqvr_Fw.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BiHRYDHq.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DfcAu08T.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CvKc5nBN.js +0 -2
- package/dist/gateway/static/root/assets/sparkles-DHlfQFAF.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-5B5ZVAu0.js +0 -2
- package/dist/gateway/static/root/assets/usage-page-rMuwNpJi.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Dhqw3v_u.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-pdiRKLxP.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-D9LMxINt.js +0 -6
|
@@ -8,6 +8,10 @@ import { DiscussionServiceError } from "./errors.js";
|
|
|
8
8
|
import { acknowledgeDiscussionCaptureConsent, correctDiscussionTranscriptSegment, createDiscussionCapture, createDiscussionTranscriptSegment, deleteDiscussionSegmentAudio, getDiscussionCapture, getDiscussionCaptureByClientRequestId, getDiscussionCaptureByNoteId, getDiscussionCaptureSettings, getDiscussionMetrics, getDiscussionTranscriptSegment, getLatestDiscussionOrganization, listDiscussionCaptures, listDiscussionTranscriptSegments, updateDiscussionCapture } from "./repository.js";
|
|
9
9
|
import { assembleDiscussionTranscript } from "./transcript.js";
|
|
10
10
|
import { readTranscriptRevision, refreshCanonicalTranscript, saveTranscriptRevision } from "./revisions.js";
|
|
11
|
+
import { createProcessingRun, processingProgress, resetProcessingRetry } from "./processing.js";
|
|
12
|
+
import { evidenceFor, putAnnotation, resolvedAnnotations } from "./review.js";
|
|
13
|
+
import { longRecordingReview } from "./long-review.js";
|
|
14
|
+
import { discussionAudioClip } from "./audio-clip.js";
|
|
11
15
|
import { editMeeting } from "./edits.js";
|
|
12
16
|
import { completeRecording, listRecordingChunks, removeRecordingChunks, saveRecordingChunk, validateRecordingManifest } from "./recording.js";
|
|
13
17
|
import { cancelRecordingJob, claimRecordingJob, finishRecordingJob, getRecordingJob, getRecordingJobInput, renewRecordingJob, submitRecordingJob } from "./recordingJobs.js";
|
|
@@ -31,6 +35,18 @@ var DiscussionService = class {
|
|
|
31
35
|
this.projects = projects;
|
|
32
36
|
this.emit = emit;
|
|
33
37
|
}
|
|
38
|
+
audioClip(id, start, end, signal) {
|
|
39
|
+
return discussionAudioClip(id, start, end, this.notes, signal);
|
|
40
|
+
}
|
|
41
|
+
annotations(id) {
|
|
42
|
+
return resolvedAnnotations(id, this.notes);
|
|
43
|
+
}
|
|
44
|
+
saveAnnotation(id, input) {
|
|
45
|
+
return putAnnotation(id, input);
|
|
46
|
+
}
|
|
47
|
+
evidence(id, revision, ids) {
|
|
48
|
+
return evidenceFor(id, revision, ids, this.notes);
|
|
49
|
+
}
|
|
34
50
|
settings() {
|
|
35
51
|
return getDiscussionCaptureSettings();
|
|
36
52
|
}
|
|
@@ -238,6 +254,7 @@ var DiscussionService = class {
|
|
|
238
254
|
const capture = getDiscussionCapture(id);
|
|
239
255
|
if (!capture) throw new DiscussionServiceError("not_found", "Discussion not found");
|
|
240
256
|
if (!["completed", "needs_attention"].includes(capture.status) || !capture.canonicalTranscript) throw new DiscussionServiceError("conflict", "Transcript is not ready");
|
|
257
|
+
resetProcessingRetry(id);
|
|
241
258
|
const updated = updateDiscussionCapture(id, {
|
|
242
259
|
status: "organizing",
|
|
243
260
|
template,
|
|
@@ -338,24 +355,37 @@ var DiscussionService = class {
|
|
|
338
355
|
}
|
|
339
356
|
});
|
|
340
357
|
}
|
|
341
|
-
async retry(id) {
|
|
342
|
-
|
|
343
|
-
if (
|
|
344
|
-
if (capture.status !== "needs_attention") throw new DiscussionServiceError("conflict", "Only discussions needing attention can be retried");
|
|
345
|
-
if (getRecordingJob(id)?.state === "failed") {
|
|
358
|
+
async retry(id, mode = "resume") {
|
|
359
|
+
if (mode !== "resume" && mode !== "from_audio") throw new DiscussionServiceError("invalid_input", "Invalid retry mode");
|
|
360
|
+
if (mode === "resume" && getRecordingJob(id)?.state === "failed") {
|
|
346
361
|
await this.sealRecording(id, getRecordingJobInput(id));
|
|
347
362
|
return this.get(id);
|
|
348
363
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
364
|
+
return this.enqueueMutation(id, async () => {
|
|
365
|
+
const capture = getDiscussionCapture(id);
|
|
366
|
+
if (!capture) return null;
|
|
367
|
+
if (mode === "from_audio") {
|
|
368
|
+
if (!["completed", "needs_attention"].includes(capture.status)) throw new DiscussionServiceError("conflict", "Wait for current processing to finish");
|
|
369
|
+
if (!capture.audioAttachmentId || capture.audioDeletedAt || !await this.notes.getAttachmentPath(capture.noteId, capture.audioAttachmentId)) throw new DiscussionServiceError("conflict", "Saved original audio is unavailable");
|
|
370
|
+
} else if (capture.status !== "needs_attention") throw new DiscussionServiceError("conflict", "Only discussions needing attention can be retried");
|
|
371
|
+
const updated = runSqliteWriteTransaction(() => {
|
|
372
|
+
if (mode === "from_audio") {
|
|
373
|
+
saveTranscriptRevision(id);
|
|
374
|
+
createProcessingRun(capture, true);
|
|
375
|
+
} else resetProcessingRetry(id);
|
|
376
|
+
const status = mode === "from_audio" || capture.failureStage === "transcript_sealing" ? "sealing" : capture.canonicalTranscript ? "organizing" : "stopping";
|
|
377
|
+
return updateDiscussionCapture(id, {
|
|
378
|
+
status,
|
|
379
|
+
...status === "stopping" ? { recordingStoppedAt: Date.now() } : {},
|
|
380
|
+
failureStage: void 0,
|
|
381
|
+
failureCode: void 0,
|
|
382
|
+
failureMessage: void 0
|
|
383
|
+
}, [capture.status]);
|
|
384
|
+
});
|
|
385
|
+
if (!updated) throw new DiscussionServiceError("conflict", "Discussion changed while retrying");
|
|
386
|
+
this.emit?.("discussion.updated", updated);
|
|
387
|
+
return this.detail(updated);
|
|
388
|
+
});
|
|
359
389
|
}
|
|
360
390
|
async cancel(id) {
|
|
361
391
|
const active = getDiscussionCapture(id);
|
|
@@ -389,6 +419,8 @@ var DiscussionService = class {
|
|
|
389
419
|
await removeRecordingChunks(capture);
|
|
390
420
|
cancelRecordingJob(id);
|
|
391
421
|
if (capture.audioAttachmentId) await this.notes.removeAttachment(capture.noteId, capture.audioAttachmentId);
|
|
422
|
+
const sourceNote = await this.notes.getNote(capture.noteId);
|
|
423
|
+
for (const attachment of sourceNote?.attachments ?? []) if (attachment.retainWithoutReference && (attachment.fileName.startsWith(`recording-part-${capture.id}-`) || attachment.fileName === `recording-sources-${capture.id}.json` || attachment.fileName === `recording-events-${capture.id}.json`)) await this.notes.removeAttachment(capture.noteId, attachment.id);
|
|
392
424
|
deleteDiscussionSegmentAudio(id);
|
|
393
425
|
const updated = updateDiscussionCapture(id, {
|
|
394
426
|
audioAttachmentId: void 0,
|
|
@@ -413,12 +445,16 @@ var DiscussionService = class {
|
|
|
413
445
|
this.emit?.("discussion.updated", updated);
|
|
414
446
|
return this.detail(updated);
|
|
415
447
|
}
|
|
448
|
+
review(id, options = {}) {
|
|
449
|
+
return longRecordingReview(id, this.notes, options);
|
|
450
|
+
}
|
|
416
451
|
async detail(capture) {
|
|
417
452
|
const note = await this.notes.getNote(capture.noteId);
|
|
418
453
|
if (!note) throw new DiscussionServiceError("not_found", "Discussion note not found");
|
|
419
454
|
const recordingJob = getRecordingJob(capture.id);
|
|
420
455
|
return {
|
|
421
456
|
discussion: capture,
|
|
457
|
+
processing: processingProgress(capture.id),
|
|
422
458
|
note,
|
|
423
459
|
transcript: this.transcript(capture.id),
|
|
424
460
|
...recordingJob ? { recordingJob } : {},
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { DISCUSSION_STATUSES } from '@xopcai/gateway-contract';
|
|
2
|
-
export type { DiscussionStatus, DiscussionSource, DiscussionProjectInferenceSource, DiscussionFailureStage, DiscussionFact, DiscussionChapter, DiscussionTemplate, DiscussionActionItem, DiscussionOrganization, DiscussionCapture, DiscussionTranscriptSegmentStatus, DiscussionTranscriptSegment, DiscussionTranscriptStats, DiscussionTranscript, DiscussionOrganizationRecord, DiscussionCaptureSettings, CreateDiscussionInput, ListDiscussionsQuery, DiscussionListResult, DiscussionMetrics, } from '@xopcai/gateway-contract';
|
|
2
|
+
export type { DiscussionStatus, DiscussionSource, DiscussionProjectInferenceSource, DiscussionFailureStage, DiscussionFact, DiscussionChapter, DiscussionTemplate, DiscussionActionItem, DiscussionOrganization, DiscussionCapture, DiscussionTranscriptSegmentStatus, DiscussionTranscriptSegment, DiscussionTranscriptStats, DiscussionTranscript, DiscussionOrganizationRecord, DiscussionCaptureSettings, CreateDiscussionInput, ListDiscussionsQuery, DiscussionListResult, DiscussionMetrics, DiscussionProcessingProgress, DiscussionRetryMode, } from '@xopcai/gateway-contract';
|
|
3
3
|
import type { DiscussionCapture, DiscussionTranscript, DiscussionOrganizationRecord } from '@xopcai/gateway-contract';
|
|
4
4
|
export interface DiscussionDetail {
|
|
5
5
|
discussion: DiscussionCapture;
|
|
6
6
|
note: import('../notes/types.js').Note;
|
|
7
7
|
transcript: DiscussionTranscript;
|
|
8
8
|
organization?: DiscussionOrganizationRecord;
|
|
9
|
+
processing?: import('@xopcai/gateway-contract').DiscussionProcessingProgress;
|
|
9
10
|
recordingJob?: import('@xopcai/gateway-contract').DiscussionRecordingJob;
|
|
10
11
|
}
|
|
@@ -277,4 +277,4 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
|
|
|
277
277
|
readonly zh: "使用已验证的参数执行选定的外部工具。";
|
|
278
278
|
};
|
|
279
279
|
}];
|
|
280
|
-
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "user_context_search" | "user_context_get" | "user_context_update" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "
|
|
280
|
+
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "user_context_search" | "user_context_get" | "user_context_update" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "web_extract" | "clarify" | "xopc_tool_execute" | "tool_manual" | "session_status" | "read_media" | "xopc_tool_search" | "xopc_tool_describe" | "image_generate" | "skills_list" | "skill_view" | "skill_manage" | "skills_marketplace_search" | "computer_use" | "send_message" | "text_to_speech" | "execute_code" | "send_media" | "create_share" | "memory_maintenance" | "delegate_task" | "skill_install" | "create_desktop_pet")[];
|
|
@@ -6,6 +6,8 @@ export type GlobalDefaultsPayload = {
|
|
|
6
6
|
};
|
|
7
7
|
export type UpdateGlobalDefaultsBody = {
|
|
8
8
|
defaults: AgentDefaults;
|
|
9
|
+
scope?: 'models' | 'agent';
|
|
10
|
+
expectedModels?: AgentDefaults['models'];
|
|
9
11
|
};
|
|
10
12
|
export type GlobalDefaultsAdminResult<T> = {
|
|
11
13
|
ok: true;
|
|
@@ -13,7 +15,7 @@ export type GlobalDefaultsAdminResult<T> = {
|
|
|
13
15
|
} | {
|
|
14
16
|
ok: false;
|
|
15
17
|
error: string;
|
|
16
|
-
status?: 400 | 404 | 500;
|
|
18
|
+
status?: 400 | 404 | 409 | 500;
|
|
17
19
|
};
|
|
18
20
|
export declare function listGlobalDefaults(): GlobalDefaultsPayload;
|
|
19
21
|
export declare function prepareUpdateGlobalDefaults(body: UpdateGlobalDefaultsBody): GlobalDefaultsAdminResult<{
|
|
@@ -18,13 +18,25 @@ function listGlobalDefaults() {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function prepareUpdateGlobalDefaults(body) {
|
|
21
|
-
const
|
|
21
|
+
const current = new AgentCatalogRepository().getSettings().defaults;
|
|
22
|
+
if (body.expectedModels && !isDeepStrictEqual(current.models, body.expectedModels)) return {
|
|
23
|
+
ok: false,
|
|
24
|
+
error: "Model settings changed. Refresh before retrying.",
|
|
25
|
+
status: 409
|
|
26
|
+
};
|
|
27
|
+
const requested = body.scope === "models" ? {
|
|
28
|
+
...current,
|
|
29
|
+
models: body.defaults.models
|
|
30
|
+
} : body.scope === "agent" ? {
|
|
31
|
+
...body.defaults,
|
|
32
|
+
models: current.models
|
|
33
|
+
} : body.defaults;
|
|
34
|
+
const parsed = AgentDefaultsSchema.safeParse(requested);
|
|
22
35
|
if (!parsed.success) return {
|
|
23
36
|
ok: false,
|
|
24
37
|
error: `defaults ${parsed.error.issues[0]?.message ?? "is invalid"}`,
|
|
25
38
|
status: 400
|
|
26
39
|
};
|
|
27
|
-
const current = new AgentCatalogRepository().getSettings().defaults;
|
|
28
40
|
try {
|
|
29
41
|
validateComputerModelChange(parsed.data.models.computerUse, current.models.computerUse);
|
|
30
42
|
} catch (error) {
|
|
@@ -27,7 +27,11 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
27
27
|
primary: string;
|
|
28
28
|
fallbacks: string[];
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
background?: {
|
|
31
|
+
primary: string;
|
|
32
|
+
fallbacks: string[];
|
|
33
|
+
};
|
|
34
|
+
intents?: Partial<Record<"review" | "coding" | "vision" | "fast" | "reasoning" | "understanding", {
|
|
31
35
|
primary: string;
|
|
32
36
|
fallbacks: string[];
|
|
33
37
|
}>>;
|
|
@@ -71,10 +75,14 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
71
75
|
primary: string;
|
|
72
76
|
fallbacks: string[];
|
|
73
77
|
};
|
|
74
|
-
intents: Partial<Record<"review" | "coding" | "
|
|
78
|
+
intents: Partial<Record<"review" | "coding" | "vision" | "fast" | "reasoning" | "understanding", {
|
|
75
79
|
primary: string;
|
|
76
80
|
fallbacks: string[];
|
|
77
81
|
}>>;
|
|
82
|
+
background?: {
|
|
83
|
+
primary: string;
|
|
84
|
+
fallbacks: string[];
|
|
85
|
+
};
|
|
78
86
|
imageUnderstanding?: {
|
|
79
87
|
primary: string;
|
|
80
88
|
fallbacks: string[];
|
|
@@ -320,6 +328,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
320
328
|
betaCheckIntervalHours: number;
|
|
321
329
|
};
|
|
322
330
|
};
|
|
331
|
+
voiceSettingsRevisions: Record<"conversation" | "transcription" | "speech", string>;
|
|
323
332
|
stt: unknown;
|
|
324
333
|
tts: unknown;
|
|
325
334
|
voice: unknown;
|
|
@@ -14,6 +14,7 @@ import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChann
|
|
|
14
14
|
import { resolveSessionConfigForWeb, resolveUpdateConfigForWeb } from "../../../config/web-patch.js";
|
|
15
15
|
import { GENERIC_MASKED_SECRET, maskSecretLength } from "./mask-secret-length.js";
|
|
16
16
|
import { safeToolsWebForGet } from "../../config-tools-web.js";
|
|
17
|
+
import { voiceSettingsRevisions } from "./voice-settings-revisions.js";
|
|
17
18
|
import { buildSafeProvidersConfigForWeb } from "./safe-providers-config.js";
|
|
18
19
|
import { maskRealtimeVoiceConfigForWeb, maskSttConfigForWeb, maskTtsConfigForWeb } from "./safe-voice-config.js";
|
|
19
20
|
//#region src/gateway/hono/lib/config-payload.ts
|
|
@@ -155,6 +156,7 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
155
156
|
transport: { tls: "broker_terminated" }
|
|
156
157
|
},
|
|
157
158
|
update: { ...resolveUpdateConfigForWeb(config) },
|
|
159
|
+
voiceSettingsRevisions: voiceSettingsRevisions(config),
|
|
158
160
|
stt: maskSttConfigForWeb(config.tools?.media?.audio),
|
|
159
161
|
tts: maskTtsConfigForWeb(config.messages?.tts),
|
|
160
162
|
voice: maskRealtimeVoiceConfigForWeb(config.voice),
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Config } from '../../../config/schema.js';
|
|
2
|
+
export declare const VOICE_SETTING_SCOPES: readonly ["transcription", "speech", "conversation"];
|
|
3
|
+
export type VoiceSettingScope = typeof VOICE_SETTING_SCOPES[number];
|
|
4
|
+
/** Opaque per-capability versions; credentials never appear in the public snapshot. */
|
|
5
|
+
export declare function voiceSettingsRevisions(config: Config): Record<VoiceSettingScope, string>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createHmac, randomBytes } from "node:crypto";
|
|
2
|
+
//#region src/gateway/hono/lib/voice-settings-revisions.ts
|
|
3
|
+
const revisionKey = randomBytes(32);
|
|
4
|
+
const VOICE_SETTING_SCOPES = [
|
|
5
|
+
"transcription",
|
|
6
|
+
"speech",
|
|
7
|
+
"conversation"
|
|
8
|
+
];
|
|
9
|
+
/** Opaque per-capability versions; credentials never appear in the public snapshot. */
|
|
10
|
+
function voiceSettingsRevisions(config) {
|
|
11
|
+
const values = {
|
|
12
|
+
transcription: {
|
|
13
|
+
stt: config.tools?.media?.audio,
|
|
14
|
+
language: config.voice?.language,
|
|
15
|
+
languageMode: config.voice?.languageMode,
|
|
16
|
+
input: config.voice?.input
|
|
17
|
+
},
|
|
18
|
+
speech: config.messages?.tts,
|
|
19
|
+
conversation: config.voice?.realtime
|
|
20
|
+
};
|
|
21
|
+
return Object.fromEntries(VOICE_SETTING_SCOPES.map((scope) => [scope, createHmac("sha256", revisionKey).update(JSON.stringify(values[scope]) ?? "null").digest("hex")]));
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { VOICE_SETTING_SCOPES, voiceSettingsRevisions };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getSessionMetadata } from "../../../storage/sqlite/session-read-repository.js";
|
|
2
|
+
import { init_session_repository } from "../../../storage/sqlite/session-repository.js";
|
|
1
3
|
import { init_agent_scope, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
2
4
|
import { resolveEffectiveAgentProfile } from "../../../config/agent-profile.js";
|
|
3
5
|
import { effectiveWorkspacePathForSession, projectWorkspacePath } from "../../../session/session-workspace.js";
|
|
@@ -12,6 +14,7 @@ import { buildReviewContext, resolveGitRoot } from "../../../review/review-git.j
|
|
|
12
14
|
import "../../../chat-commands/index.js";
|
|
13
15
|
//#region src/gateway/hono/routes/commands-skills.ts
|
|
14
16
|
init_agent_scope();
|
|
17
|
+
init_session_repository();
|
|
15
18
|
function parseMarketplaceProviderQuery(raw) {
|
|
16
19
|
const v = raw?.trim().toLowerCase();
|
|
17
20
|
if (v && isRegisteredProvider(v)) return v;
|
|
@@ -86,6 +89,10 @@ function registerCommandsSkillsRoutes(authenticated, deps) {
|
|
|
86
89
|
});
|
|
87
90
|
authenticated.get("/api/chat/skills", async (c) => {
|
|
88
91
|
const conversationId = c.req.query("conversationId")?.trim();
|
|
92
|
+
if (conversationId && !getSessionMetadata(conversationId)) return c.json({
|
|
93
|
+
ok: false,
|
|
94
|
+
error: "Conversation not found"
|
|
95
|
+
}, 404);
|
|
89
96
|
const agentId = c.req.query("agentId")?.trim() || resolveDefaultAgentId();
|
|
90
97
|
const payload = conversationId ? await service.marketplace.getSessionSkillsApi(conversationId) : service.marketplace.getAgentSkillsApi(agentId);
|
|
91
98
|
return c.json({
|
|
@@ -99,6 +106,10 @@ function registerCommandsSkillsRoutes(authenticated, deps) {
|
|
|
99
106
|
ok: false,
|
|
100
107
|
error: "Missing conversationId"
|
|
101
108
|
}, 400);
|
|
109
|
+
if (!getSessionMetadata(conversationId)) return c.json({
|
|
110
|
+
ok: false,
|
|
111
|
+
error: "Conversation not found"
|
|
112
|
+
}, 404);
|
|
102
113
|
const payload = await service.marketplace.getSessionWorkspaceTrustApi(conversationId);
|
|
103
114
|
return c.json({
|
|
104
115
|
ok: true,
|
|
@@ -120,6 +131,10 @@ function registerCommandsSkillsRoutes(authenticated, deps) {
|
|
|
120
131
|
ok: false,
|
|
121
132
|
error: "Expected { conversationId: string, trusted: boolean }"
|
|
122
133
|
}, 400);
|
|
134
|
+
if (!getSessionMetadata(conversationId)) return c.json({
|
|
135
|
+
ok: false,
|
|
136
|
+
error: "Conversation not found"
|
|
137
|
+
}, 404);
|
|
123
138
|
const payload = await service.marketplace.setSessionWorkspaceTrustApi(conversationId, body.trusted);
|
|
124
139
|
return c.json({
|
|
125
140
|
ok: true,
|
|
@@ -216,7 +216,14 @@ async function applyMiscPatch(config, body) {
|
|
|
216
216
|
config.messages.tts = mergeTtsConfigPatch(config.messages.tts, body.tts);
|
|
217
217
|
}
|
|
218
218
|
if (body.voice !== void 0) {
|
|
219
|
-
|
|
219
|
+
if (!body.voice || typeof body.voice !== "object" || Array.isArray(body.voice)) return patchError("voice must be an object");
|
|
220
|
+
if (body.voice.realtime !== void 0 && (!body.voice.realtime || typeof body.voice.realtime !== "object" || Array.isArray(body.voice.realtime))) return patchError("voice.realtime must be an object");
|
|
221
|
+
if (body.voicePatchMode !== void 0 && body.voicePatchMode !== "merge") return patchError("Invalid voice patch mode");
|
|
222
|
+
const voicePatch = body.voicePatchMode === "merge" ? {
|
|
223
|
+
...config.voice,
|
|
224
|
+
...body.voice
|
|
225
|
+
} : body.voice;
|
|
226
|
+
const parsed = VoiceConfigSchema.safeParse(mergeRealtimeVoiceConfigPatch(config.voice, voicePatch));
|
|
220
227
|
if (!parsed.success) return patchError(parsed.error.issues.map((i) => i.message).join("; "));
|
|
221
228
|
config.voice = parsed.data;
|
|
222
229
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { enumerateLanGatewayCandidates, init_host } from "../../host.js";
|
|
2
2
|
import { getTunnelService } from "../../../tunnel/tunnel-service.js";
|
|
3
|
+
import { VOICE_SETTING_SCOPES, voiceSettingsRevisions } from "../lib/voice-settings-revisions.js";
|
|
3
4
|
import { buildSafeWebConfigPayload } from "../lib/config-payload.js";
|
|
4
5
|
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
5
6
|
import { applyChannelsPatch } from "./config-patch/channels.js";
|
|
@@ -39,6 +40,17 @@ function registerConfigRoutes(authenticated, deps) {
|
|
|
39
40
|
const body = await c.req.json();
|
|
40
41
|
const expectedConfig = structuredClone(service.currentConfig);
|
|
41
42
|
const config = structuredClone(expectedConfig);
|
|
43
|
+
if (body.expectedVoiceRevision !== void 0) {
|
|
44
|
+
const guard = body.expectedVoiceRevision;
|
|
45
|
+
if (!guard || typeof guard !== "object" || !VOICE_SETTING_SCOPES.includes(guard.capability) || typeof guard.revision !== "string" || !/^[a-f0-9]{64}$/.test(guard.revision)) return c.json({
|
|
46
|
+
ok: false,
|
|
47
|
+
error: "Invalid voice settings revision"
|
|
48
|
+
}, 400);
|
|
49
|
+
if (voiceSettingsRevisions(expectedConfig)[guard.capability] !== guard.revision) return c.json({
|
|
50
|
+
ok: false,
|
|
51
|
+
error: "Voice settings changed. Reload before saving to preserve the current model."
|
|
52
|
+
}, 409);
|
|
53
|
+
}
|
|
42
54
|
applyChannelsPatch(config, body);
|
|
43
55
|
const gatewayResult = applyGatewayPatch(config, body);
|
|
44
56
|
if (gatewayResult.ok === false) return c.json({
|
|
@@ -79,10 +79,67 @@ function registerDiscussionRoutes(authenticated, deps) {
|
|
|
79
79
|
const detail = await service.discussions.getByNoteId(c.req.param("noteId"));
|
|
80
80
|
return detail ? c.json(detail) : c.json({ error: "Discussion not found" }, 404);
|
|
81
81
|
});
|
|
82
|
+
authenticated.get("/api/discussions/:id/review", async (c) => {
|
|
83
|
+
try {
|
|
84
|
+
return c.json(await service.discussions.review(c.req.param("id"), {
|
|
85
|
+
query: c.req.query("q"),
|
|
86
|
+
offset: Number(c.req.query("offset") ?? 0),
|
|
87
|
+
limit: Number(c.req.query("limit") ?? 20),
|
|
88
|
+
version: c.req.query("version")
|
|
89
|
+
}));
|
|
90
|
+
} catch (error) {
|
|
91
|
+
const response = errorResponse(error);
|
|
92
|
+
if (response) return c.json(response.body, response.status);
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
82
96
|
authenticated.get("/api/discussions/:id", async (c) => {
|
|
83
97
|
const detail = await service.discussions.get(c.req.param("id"));
|
|
84
98
|
return detail ? c.json(detail) : c.json({ error: "Discussion not found" }, 404);
|
|
85
99
|
});
|
|
100
|
+
authenticated.get("/api/discussions/:id/audio-clip", mediaRateLimitMiddleware, async (c) => {
|
|
101
|
+
try {
|
|
102
|
+
const bytes = await service.discussions.audioClip(c.req.param("id"), Number(c.req.query("startMs")), Number(c.req.query("endMs")), c.req.raw.signal);
|
|
103
|
+
c.header("Cache-Control", "no-store");
|
|
104
|
+
c.header("Content-Type", "audio/wav");
|
|
105
|
+
return c.body(new Uint8Array(bytes));
|
|
106
|
+
} catch (error) {
|
|
107
|
+
const response = errorResponse(error);
|
|
108
|
+
if (response) return c.json(response.body, response.status);
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
authenticated.get("/api/discussions/:id/annotations", async (c) => {
|
|
113
|
+
try {
|
|
114
|
+
return c.json(await service.discussions.annotations(c.req.param("id")));
|
|
115
|
+
} catch (error) {
|
|
116
|
+
const response = errorResponse(error);
|
|
117
|
+
if (response) return c.json(response.body, response.status);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
authenticated.put("/api/discussions/:id/annotations/:annotationId", strictRateLimitMiddleware, async (c) => {
|
|
122
|
+
const body = await c.req.json().catch(() => ({}));
|
|
123
|
+
try {
|
|
124
|
+
return c.json(service.discussions.saveAnnotation(c.req.param("id"), {
|
|
125
|
+
...body,
|
|
126
|
+
id: c.req.param("annotationId")
|
|
127
|
+
}));
|
|
128
|
+
} catch (error) {
|
|
129
|
+
const response = errorResponse(error);
|
|
130
|
+
if (response) return c.json(response.body, response.status);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
authenticated.get("/api/discussions/:id/evidence", async (c) => {
|
|
135
|
+
try {
|
|
136
|
+
return c.json(await service.discussions.evidence(c.req.param("id"), Number(c.req.query("revision")), (c.req.query("segments") ?? "").split(",").filter(Boolean).map(Number)));
|
|
137
|
+
} catch (error) {
|
|
138
|
+
const response = errorResponse(error);
|
|
139
|
+
if (response) return c.json(response.body, response.status);
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
86
143
|
authenticated.get("/api/discussions/:id/transcript", (c) => {
|
|
87
144
|
const transcript = service.discussions.transcript(c.req.param("id"), c.req.query("revision") === void 0 ? void 0 : Number(c.req.query("revision")));
|
|
88
145
|
return transcript ? c.json(transcript) : c.json({ error: "Discussion not found" }, 404);
|
|
@@ -243,6 +300,8 @@ function registerDiscussionRoutes(authenticated, deps) {
|
|
|
243
300
|
chunkCount: Number(body.chunkCount),
|
|
244
301
|
mimeType: typeof body.mimeType === "string" ? body.mimeType : "",
|
|
245
302
|
fileName: typeof body.fileName === "string" ? body.fileName : "",
|
|
303
|
+
...body.events !== void 0 ? { events: body.events } : {},
|
|
304
|
+
...body.epochs !== void 0 ? { epochs: body.epochs } : {},
|
|
246
305
|
...body.containerMode === "independent_wav" ? { containerMode: "independent_wav" } : {}
|
|
247
306
|
}), 202);
|
|
248
307
|
} catch (error) {
|
|
@@ -252,8 +311,11 @@ function registerDiscussionRoutes(authenticated, deps) {
|
|
|
252
311
|
}
|
|
253
312
|
});
|
|
254
313
|
authenticated.post("/api/discussions/:id/retry", strictRateLimitMiddleware, async (c) => {
|
|
314
|
+
const body = await c.req.json().catch(() => ({}));
|
|
315
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return c.json({ error: "Invalid retry request" }, 400);
|
|
316
|
+
if (body.mode !== void 0 && body.mode !== "resume" && body.mode !== "from_audio") return c.json({ error: "Invalid retry mode" }, 400);
|
|
255
317
|
try {
|
|
256
|
-
const detail = await service.discussions.retry(c.req.param("id"));
|
|
318
|
+
const detail = await service.discussions.retry(c.req.param("id"), body.mode === "from_audio" ? "from_audio" : "resume");
|
|
257
319
|
return detail ? c.json(detail) : c.json({ error: "Discussion not found" }, 404);
|
|
258
320
|
} catch (error) {
|
|
259
321
|
const response = errorResponse(error);
|
|
@@ -6,8 +6,15 @@ init_agent_config();
|
|
|
6
6
|
function parsePatchBody(raw) {
|
|
7
7
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return { error: "body must be an object" };
|
|
8
8
|
const body = raw;
|
|
9
|
+
if (body.scope !== void 0 && body.scope !== "models" && body.scope !== "agent") return { error: "scope must be models or agent" };
|
|
10
|
+
const expected = body.expectedModels === void 0 ? void 0 : AgentDefaultsSchema.shape.models.safeParse(body.expectedModels);
|
|
11
|
+
if (expected && !expected.success) return { error: "expectedModels is invalid" };
|
|
9
12
|
const parsed = AgentDefaultsSchema.safeParse(body.defaults);
|
|
10
|
-
return parsed.success ? {
|
|
13
|
+
return parsed.success ? {
|
|
14
|
+
defaults: parsed.data,
|
|
15
|
+
...body.scope ? { scope: body.scope } : {},
|
|
16
|
+
...expected?.success ? { expectedModels: expected.data } : {}
|
|
17
|
+
} : { error: `defaults ${parsed.error.issues[0]?.message ?? "is invalid"}` };
|
|
11
18
|
}
|
|
12
19
|
function isParseError(value) {
|
|
13
20
|
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "string";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getProviderSetupProfile, init_profiles } from "../../../providers/setup/profiles.js";
|
|
2
|
+
import { init_model_usage, withModelUsageOrigin } from "../../../providers/model-usage.js";
|
|
1
3
|
import { resolveEffectiveAgentConfigForAgent } from "../../../config/agent-profile.js";
|
|
2
4
|
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
3
5
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
@@ -20,11 +22,14 @@ import { applyImageGenerationCatalogUpdate, getAgentImageGenerationConfig, getDe
|
|
|
20
22
|
import { discoverProviderModels, isProviderApiDiscoverable } from "../../../providers/model-discovery.js";
|
|
21
23
|
import { getXopcCloudCatalogCoordinator } from "../../../providers/xopc-cloud-catalog-coordinator.js";
|
|
22
24
|
import { respondStartupUnavailable } from "../lib/startup-unavailable.js";
|
|
23
|
-
import { dismissXopcCloudOnboarding, getXopcCloudOnboardingStatus } from "../../xopc-cloud-onboarding.js";
|
|
24
25
|
import { getDomesticProviderPreset, getDomesticProviderPresetIds } from "../../../providers/domestic-presets.js";
|
|
25
|
-
import { auditModelReferences } from "../../../providers/model-reference-auditor.js";
|
|
26
26
|
import { getOnboardingFeaturedProviders, getProviderHint, getRecommendedModelsForProvider, isRecommendedModel, sortModelsForPicker, sortProvidersForPicker } from "../../../providers/presentation.js";
|
|
27
|
+
import { dismissXopcCloudOnboarding, getXopcCloudOnboardingStatus } from "../../xopc-cloud-onboarding.js";
|
|
28
|
+
import { auditModelReferences } from "../../../providers/model-reference-auditor.js";
|
|
29
|
+
import { registerProviderSetupRoutes } from "./provider-setup.js";
|
|
27
30
|
//#region src/gateway/hono/routes/models.ts
|
|
31
|
+
init_model_usage();
|
|
32
|
+
init_profiles();
|
|
28
33
|
init_model_policy();
|
|
29
34
|
init_models_json();
|
|
30
35
|
init_resolve_config_value();
|
|
@@ -83,6 +88,7 @@ function mapPluginModel(providerId, model, available) {
|
|
|
83
88
|
};
|
|
84
89
|
}
|
|
85
90
|
function registerModelsRoutes(authenticated, deps) {
|
|
91
|
+
registerProviderSetupRoutes(authenticated, deps);
|
|
86
92
|
const { service, strictRateLimitMiddleware } = deps;
|
|
87
93
|
const catalogSync = service.getModelCatalogSync();
|
|
88
94
|
const xopcCloudAccount = new XopcCloudAccountService();
|
|
@@ -518,14 +524,14 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
518
524
|
}, 400);
|
|
519
525
|
const prompt = typeof body.prompt === "string" && body.prompt.trim() ? body.prompt.trim() : "A simple blue circle centered on a white background.";
|
|
520
526
|
try {
|
|
521
|
-
const result = await provider.generateImage({
|
|
527
|
+
const result = await withModelUsageOrigin("interactive", () => provider.generateImage({
|
|
522
528
|
provider: providerId,
|
|
523
529
|
model: modelId,
|
|
524
530
|
prompt,
|
|
525
531
|
count: 1,
|
|
526
532
|
cfg: service.currentConfig,
|
|
527
533
|
timeoutMs: 12e4
|
|
528
|
-
});
|
|
534
|
+
}));
|
|
529
535
|
return c.json({
|
|
530
536
|
ok: true,
|
|
531
537
|
payload: {
|
|
@@ -744,6 +750,7 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
744
750
|
const registryModelCount = getAllModels().filter((m) => m.provider === provider).length;
|
|
745
751
|
return {
|
|
746
752
|
id: provider,
|
|
753
|
+
setupProfile: getProviderSetupProfile(provider, PROVIDER_META[provider]?.name ?? domesticPreset?.displayName ?? provider, PROVIDER_META[provider]?.supportsOAuth, resolveProviderApiBaseUrl(provider)),
|
|
747
754
|
name: plugin?.name ?? domesticPreset?.displayName ?? PROVIDER_META[provider]?.name ?? provider,
|
|
748
755
|
category: plugin ? "extension" : PROVIDER_META[provider]?.category || (domesticPreset ? "domestic" : "specialty"),
|
|
749
756
|
supportsOAuth: plugin ? false : PROVIDER_META[provider]?.supportsOAuth ?? false,
|
|
@@ -766,6 +773,7 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
766
773
|
const extensionId = resolveExtensionIdForProvider(service, plugin.id);
|
|
767
774
|
meta.push({
|
|
768
775
|
id: plugin.id,
|
|
776
|
+
setupProfile: getProviderSetupProfile(plugin.id, plugin.name),
|
|
769
777
|
name: plugin.name,
|
|
770
778
|
category: "extension",
|
|
771
779
|
supportsOAuth: false,
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { listGlobalDefaults, prepareUpdateGlobalDefaults, updateGlobalDefaults } from "../../global-defaults-admin.js";
|
|
2
|
+
import { applySetupVoice } from "../../../providers/setup/voice.js";
|
|
3
|
+
import { loadProviderSetupSnapshot } from "../../provider-model-setup.js";
|
|
4
|
+
import { SetupConflictError, applyProviderSetup, previewProviderSetup } from "../../../providers/setup/engine.js";
|
|
5
|
+
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
6
|
+
import { isDeepStrictEqual } from "node:util";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
//#region src/gateway/hono/routes/provider-setup.ts
|
|
9
|
+
const use = z.enum([
|
|
10
|
+
"chat",
|
|
11
|
+
"vision",
|
|
12
|
+
"image",
|
|
13
|
+
"background",
|
|
14
|
+
"speech",
|
|
15
|
+
"transcription",
|
|
16
|
+
"conversation"
|
|
17
|
+
]);
|
|
18
|
+
const requestSchema = z.object({
|
|
19
|
+
mode: z.enum(["fill", "replace"]).optional(),
|
|
20
|
+
selected: z.array(use).max(7).optional(),
|
|
21
|
+
overrides: z.partialRecord(use, z.string().min(1).max(512)).optional(),
|
|
22
|
+
modelIds: z.array(z.string().min(1).max(512)).max(500).optional()
|
|
23
|
+
}).strict();
|
|
24
|
+
const applySchema = requestSchema.extend({ revision: z.string().regex(/^[a-f0-9]{64}$/) });
|
|
25
|
+
function registerProviderSetupRoutes(app, deps) {
|
|
26
|
+
app.get("/api/models/setup/:providerId", async (c) => {
|
|
27
|
+
try {
|
|
28
|
+
return c.json({
|
|
29
|
+
ok: true,
|
|
30
|
+
payload: previewProviderSetup(await loadProviderSetupSnapshot(c.req.param("providerId"), deps.service.currentConfig))
|
|
31
|
+
});
|
|
32
|
+
} catch (error) {
|
|
33
|
+
return c.json({
|
|
34
|
+
ok: false,
|
|
35
|
+
error: { message: error instanceof Error ? error.message : String(error) }
|
|
36
|
+
}, 400);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
app.post("/api/models/setup/:providerId/preview", deps.strictRateLimitMiddleware, async (c) => {
|
|
40
|
+
const parsed = requestSchema.safeParse(await c.req.json().catch(() => null));
|
|
41
|
+
if (!parsed.success) return c.json({
|
|
42
|
+
ok: false,
|
|
43
|
+
error: { message: "Invalid setup preview request" }
|
|
44
|
+
}, 400);
|
|
45
|
+
try {
|
|
46
|
+
return c.json({
|
|
47
|
+
ok: true,
|
|
48
|
+
payload: previewProviderSetup(await loadProviderSetupSnapshot(c.req.param("providerId"), deps.service.currentConfig), parsed.data)
|
|
49
|
+
});
|
|
50
|
+
} catch (error) {
|
|
51
|
+
return c.json({
|
|
52
|
+
ok: false,
|
|
53
|
+
error: { message: error instanceof Error ? error.message : String(error) }
|
|
54
|
+
}, 400);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
app.post("/api/models/setup/:providerId/apply", deps.strictRateLimitMiddleware, async (c) => withGatewayConfigWriteLock(deps.service, async () => {
|
|
58
|
+
const parsed = applySchema.safeParse(await c.req.json().catch(() => null));
|
|
59
|
+
if (!parsed.success) return c.json({
|
|
60
|
+
ok: false,
|
|
61
|
+
error: { message: "Invalid setup apply request" }
|
|
62
|
+
}, 400);
|
|
63
|
+
let voiceSaved = false;
|
|
64
|
+
try {
|
|
65
|
+
const expectedConfig = structuredClone(deps.service.currentConfig);
|
|
66
|
+
const snapshot = await loadProviderSetupSnapshot(c.req.param("providerId"), expectedConfig);
|
|
67
|
+
if (!isDeepStrictEqual(deps.service.currentConfig, expectedConfig)) throw new SetupConflictError("Configuration changed while preparing setup. Review and retry.");
|
|
68
|
+
const applied = applyProviderSetup(snapshot, parsed.data, parsed.data.revision);
|
|
69
|
+
const prepared = prepareUpdateGlobalDefaults({ defaults: applied.defaults });
|
|
70
|
+
if (prepared.ok === false) return c.json({
|
|
71
|
+
ok: false,
|
|
72
|
+
error: { message: prepared.error }
|
|
73
|
+
}, prepared.status ?? 400);
|
|
74
|
+
if (applied.voiceAssignments.length) {
|
|
75
|
+
const next = applySetupVoice(expectedConfig, applied.voiceAssignments);
|
|
76
|
+
const saved = await deps.service.saveConfig(next, expectedConfig);
|
|
77
|
+
if (!saved.saved) return c.json({
|
|
78
|
+
ok: false,
|
|
79
|
+
error: { message: `${saved.persisted ? "Voice settings persisted but runtime reload failed" : "Voice settings were not saved"}: ${saved.error ?? "Configuration write failed"}` }
|
|
80
|
+
}, saved.conflict ? 409 : 500);
|
|
81
|
+
voiceSaved = true;
|
|
82
|
+
if (!isDeepStrictEqual(listGlobalDefaults().defaults, snapshot.defaults)) return c.json({
|
|
83
|
+
ok: false,
|
|
84
|
+
error: { message: "Voice settings saved; model defaults changed concurrently. Review the refreshed configuration before applying model uses." }
|
|
85
|
+
}, 409);
|
|
86
|
+
}
|
|
87
|
+
const result = updateGlobalDefaults({ defaults: applied.defaults });
|
|
88
|
+
if (result.ok === false) return c.json({
|
|
89
|
+
ok: false,
|
|
90
|
+
error: { message: result.error }
|
|
91
|
+
}, result.status ?? 400);
|
|
92
|
+
if (result.data.changed) deps.service.refreshAgentCatalog();
|
|
93
|
+
return c.json({
|
|
94
|
+
ok: true,
|
|
95
|
+
payload: applied.preview
|
|
96
|
+
});
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return c.json({
|
|
99
|
+
ok: false,
|
|
100
|
+
error: { message: (voiceSaved ? "Voice settings saved; model setup incomplete. " : "") + (error instanceof Error ? error.message : String(error)) }
|
|
101
|
+
}, error instanceof SetupConflictError ? 409 : 400);
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { registerProviderSetupRoutes };
|