@xopcai/xopc 0.0.242 → 0.0.243
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-MU5XrVv8.js → activity-store-CAah-_8h.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B_Wc0wuL.js → agent-avatar-dicebear-DDH4HgP7.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BDCfJZhh.js +1 -0
- package/dist/gateway/static/root/assets/agents-B0ZWgf-U.js +1 -0
- package/dist/gateway/static/root/assets/{api-DLyc8BQp.js → api-B2tKxbcz.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-Blfwszzn.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-DB5gEQhN.js → appearance-settings-C3V7Na75.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BiEks0-F.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BOx0EJZs.js → archive-plugin-BmSx7wzY.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CYnYIyLr.js → attachment-load-BS-S4LJ9.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-ChTflpmA.js → automations-page-C7Y3L30D.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-A3zPkPuo.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BjbLfNwG.js → binary-plugins-BM9B5kcm.js} +1 -1
- package/dist/gateway/static/root/assets/block-editor-BbnpkYP9.js +185 -0
- package/dist/gateway/static/root/assets/browser-settings-page-Dk4FQ7fY.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DGQxD0vD.js → browser-workflow-inputs-CRnkgZHI.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B9gfdd7L.js → browser-workflows-page-B9qGL-it.js} +2 -2
- package/dist/gateway/static/root/assets/{button-CSEbl4zT.js → button-CtTvuElV.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel--tR_El9e.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-D347vl_J.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-TkU42f-W.js → channels-status-swr-DuY4MGxe.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CWMPcnoN.js → chat-terminal-dock-DABPvwBT.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-B-tvJkRJ.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-3h3rR0cf.js → cron-expression-D3bsKbNd.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Bz1sLBEx.js → date-picker-BsGM6Yty.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-p9DWR8uU.js → dependency-picker-Dj3g6YXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-D1TDB_gR.js → desktop-pet-C1QT0Sur.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DWPZpoB7.js → desktop-pet-settings-r6kAOnfY.js} +1 -1
- package/dist/gateway/static/root/assets/dist-CpzYSoz7.js +1 -0
- package/dist/gateway/static/root/assets/{dist-DaxPZj9e.js → dist-DBS3OB8K.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DLmwHyAh.js +1 -0
- package/dist/gateway/static/root/assets/es2015-BvLh9GaE.js +41 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BrRbK2rJ.js → extension-debug-page-DOkf7nh9.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CD65czfS.js → extension-page-Cq2IA4Ho.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BRDDKhpi.js → extension-settings-page-DQn4qjDZ.js} +1 -1
- package/dist/gateway/static/root/assets/{files-DQjhZjr2.js → files-D6vf3S30.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CjbBsr5M.js → gateway-config-api-DM3poL22.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-HT7sLeO9.js → gateway-config-swr-BC3pgb_P.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BQjmfYD4.js → gateway-settings-DPgH1hnh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-iBCtaAuT.js → gateway-startup-retry-uMcSfLru.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BzZxLgrw.js → heartbeat-settings-Bk80-E3b.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-DKo5JiMR.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-dj9TNEn2.js → image-generation-api-D1qlQA-A.js} +1 -1
- package/dist/gateway/static/root/assets/index-B0WJL9N1.js +71 -0
- package/dist/gateway/static/root/assets/index-Dbh5SXyV.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BEnuEPD3.js → keyboard-shortcuts-settings-BEwvd8ZU.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page--eJ5rmNj.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DXQtppWq.js → local-apps-page-CgkY9E-r.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DVzTJSj2.js → locale-store-CMZljTJx.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Z49Td0J9.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-DIpBMWrA.js → management-settings-Dv8NSJKt.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BFHyGwNF.js → markdown-split-Cm0RBB-t.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DR3yVwtV.js → markdown-view-PPCLt7fu.js} +3 -3
- package/dist/gateway/static/root/assets/{media-plugins-BjjMxC5_.js → media-plugins-Bcr5sU1f.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CTSgFlE4.js +3 -0
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-kKDiXofY.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-ZrbGRiGY.js +1 -0
- package/dist/gateway/static/root/assets/{notes-page-BbvtelJa.js → notes-page-CgsaRaGi.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-C1DEE09k.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-BB-VYJ5j.js → oauth-api-4VeMbkTJ.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-C-Hj-nXR.js +1 -0
- package/dist/gateway/static/root/assets/{product-delivery-dUJgmBQZ.js → product-delivery-CV4pDOtG.js} +1 -1
- package/dist/gateway/static/root/assets/product-open-page-BU0HiZtv.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-isRapnp5.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-zvsjg0mi.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DXsR8oGN.js → registry-api-CWOtPFrE.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C9TGZ9Hc.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DoEfLjPB.js → runtime-tools-settings-panel-2zm9edMA.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BsqpbBDv.js → schema-form-54A5gzkN.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-zIBW3wiV.js → schemas-BHS7bo06.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BP8RyiUn.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D4EMxWAZ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CE7ZcCTK.js → settings-page-DzDhoyxv.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CGlne9i0.js → setup-status-panel-uDicHU1w.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Bn0qMX8V.js → share-preview-page-lOmLCWFS.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-T4Yvouvv.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DVb7nrXz.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-dRkeYh5P.js → skills-page-CnyNH3To.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page.utils-CgDtf2qs.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-C0ZCuCM4.js → system-settings-panel-C8yWfwtR.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-Tzfjlbf3.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Cth-eChE.js → theme-store-uxUwr10D.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-Bvg679no.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-PSV89QuQ.js → use-autosave-D88VGoyG.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-RijPtyfO.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DXWdJ8cR.js → voice-api-key-field-CBHLsMcc.js} +1 -1
- package/dist/gateway/static/root/assets/voice-config-api-MqyI6cgq.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-overlay-GGe2TQ98.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-C0layUE9.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-DQXIzBAc.js +5 -0
- package/dist/gateway/static/root/index.html +21 -22
- package/dist/package.js +1 -1
- package/dist/packages/realtime-protocol/src/voice-audio.js +20 -0
- package/dist/packages/realtime-protocol/src/voice.js +208 -0
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +2 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
- package/dist/src/agent/prompt/voice-presentation.d.ts +2 -0
- package/dist/src/agent/prompt/voice-presentation.js +12 -0
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -0
- package/dist/src/agent/service/process-direct-streaming.d.ts +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +2 -1
- package/dist/src/agent/session/session-config-service.js +4 -2
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/config/models-json.d.ts +8 -8
- package/dist/src/config/schema.d.ts +60 -0
- package/dist/src/config/schema.js +31 -1
- package/dist/src/files/file-service.d.ts +1 -0
- package/dist/src/files/file-service.js +4 -0
- package/dist/src/gateway/chat-stream/thinking-delta-coalescer.js +8 -3
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -11
- package/dist/src/gateway/hono/lib/config-payload.js +2 -2
- package/dist/src/gateway/hono/lib/safe-voice-config.d.ts +14 -0
- package/dist/src/gateway/hono/lib/safe-voice-config.js +29 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/files.js +7 -0
- package/dist/src/gateway/hono/routes/lazy-fallback.js +18 -4
- package/dist/src/gateway/hono/routes/session-input-handler.js +14 -0
- package/dist/src/gateway/hono/routes/sessions.js +4 -1
- package/dist/src/gateway/hono/routes/voice.js +139 -2
- package/dist/src/gateway/server.js +1 -0
- package/dist/src/gateway/service/agent-runner.d.ts +1 -0
- package/dist/src/gateway/service/agent-runner.js +1 -6
- package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +19 -1
- package/dist/src/gateway/service.d.ts +2 -0
- package/dist/src/gateway/service.js +73 -0
- package/dist/src/media-understanding/types.d.ts +61 -0
- package/dist/src/session/client-history.js +12 -0
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/session-context-for-llm.js +8 -0
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +1 -0
- package/dist/src/session/stored-rows-to-file-entries.js +5 -1
- package/dist/src/session/voice-transcript.d.ts +9 -0
- package/dist/src/session/voice-transcript.js +45 -0
- package/dist/src/storage/sqlite/config-repository.js +9 -0
- package/dist/src/storage/sqlite/remote-context-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/remote-context-repository.js +40 -0
- package/dist/src/storage/sqlite/session-repository.js +13 -0
- package/dist/src/storage/sqlite/user-context-repository.d.ts +3 -1
- package/dist/src/storage/sqlite/user-context-repository.js +50 -4
- package/dist/src/tui/tui.js +2 -1
- package/dist/src/user-context/automatic-context.d.ts +17 -0
- package/dist/src/user-context/automatic-context.js +85 -0
- package/dist/src/user-context/changes.d.ts +7 -0
- package/dist/src/user-context/changes.js +28 -0
- package/dist/src/user-context/planner.js +1 -24
- package/dist/src/user-context/retriever.js +10 -11
- package/dist/src/user-context/selection-policy.d.ts +20 -0
- package/dist/src/user-context/selection-policy.js +33 -0
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +2 -1
- package/dist/src/user-context/sources/repository.js +26 -5
- package/dist/src/voice/dashscope/streaming-stt-session.d.ts +2 -0
- package/dist/src/voice/dashscope/streaming-stt-session.js +249 -0
- package/dist/src/voice/dashscope/streaming-tts-stream.d.ts +12 -0
- package/dist/src/voice/dashscope/streaming-tts-stream.js +153 -0
- package/dist/src/voice/realtime/agentEngine.d.ts +10 -0
- package/dist/src/voice/realtime/agentEngine.js +403 -0
- package/dist/src/voice/realtime/audio-playback-window.d.ts +9 -0
- package/dist/src/voice/realtime/audio-playback-window.js +49 -0
- package/dist/src/voice/realtime/conversation-context.d.ts +11 -0
- package/dist/src/voice/realtime/conversation-context.js +76 -0
- package/dist/src/voice/realtime/engine.d.ts +13 -0
- package/dist/src/voice/realtime/engine.js +1 -0
- package/dist/src/voice/realtime/memory-context.d.ts +17 -0
- package/dist/src/voice/realtime/memory-context.js +100 -0
- package/dist/src/voice/realtime/omniEngine.d.ts +18 -0
- package/dist/src/voice/realtime/omniEngine.js +443 -0
- package/dist/src/voice/realtime/omniRoute.d.ts +10 -0
- package/dist/src/voice/realtime/omniRoute.js +31 -0
- package/dist/src/voice/realtime/runtime.d.ts +99 -0
- package/dist/src/voice/realtime/runtime.js +622 -0
- package/dist/src/voice/realtime/speakable-segmenter.d.ts +10 -0
- package/dist/src/voice/realtime/speakable-segmenter.js +87 -0
- package/dist/src/voice/stt/list-providers.js +2 -1
- package/dist/src/voice/stt/providers/alibaba-transcription.js +13 -1
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +23 -0
- package/dist/src/voice/tts/factory.js +1 -0
- package/dist/src/voice/tts/openai-compatible-speech.js +3 -1
- package/dist/src/voice/tts/providers/alibaba-speech.d.ts +1 -5
- package/dist/src/voice/tts/providers/alibaba-speech.js +25 -8
- package/dist/src/voice/tts/providers/edge-speech.js +21 -22
- package/dist/src/voice/tts/providers/minimax-speech.js +6 -3
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +26 -1
- package/dist/src/voice/tts/speak-core.d.ts +6 -2
- package/dist/src/voice/tts/speak-core.js +46 -34
- package/dist/src/voice/tts/speech-provider-types.d.ts +1 -0
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/Combination-14nmIgxH.js +0 -41
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Cf7U2aUi.js +0 -1
- package/dist/gateway/static/root/assets/agents-Ce9oOnwE.js +0 -1
- package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-CACOOS-a.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BaTFOCmR.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-DK6EreCr.js +0 -6
- package/dist/gateway/static/root/assets/block-editor-DgAs5aJc.js +0 -184
- package/dist/gateway/static/root/assets/browser-settings-page-CHStw5UW.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-JGH6Kfkr.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-YkUaaWkY.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BI0FG3gA.js +0 -2
- package/dist/gateway/static/root/assets/dist-BPoKqzeH.js +0 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH.js +0 -1
- package/dist/gateway/static/root/assets/home-page--9fKq0mL.js +0 -1
- package/dist/gateway/static/root/assets/index-D499B1qS.css +0 -2
- package/dist/gateway/static/root/assets/index-J3FsIvTs.js +0 -70
- package/dist/gateway/static/root/assets/local-app-workbench-page-FqG00zS1.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-c6CfZ8PA.js +0 -2
- package/dist/gateway/static/root/assets/messages-_tYhRAHD.js +0 -3
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-CHnXZTwb.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-DiXjKuuY.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-DIR37b-K.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-DrILF6mR.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-CRm9Q66h.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DHiLTiRW.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-God7NCcI.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-YpF0-mx2.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CP8O1TxR.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DzdbK3j9.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-B7NeVl4g.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DDTmi4a7.js +0 -1
- package/dist/gateway/static/root/assets/skills-page.utils--q8p7MAn.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-yiMzii2b.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-CC3jOB4n.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Vtwg7fQc.js +0 -1
- package/dist/gateway/static/root/assets/voice-config-api-BDoeXgww.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-BV_Jj5iD.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DNHbWGPq.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BkFIbMrz.js +0 -5
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region packages/realtime-protocol/src/voice-audio.ts
|
|
2
|
+
const HEADER_BYTES = 12;
|
|
3
|
+
const MAGIC = 1481592882;
|
|
4
|
+
const MAX_FRAME_BYTES = 64 * 1024;
|
|
5
|
+
const encoder = new TextEncoder();
|
|
6
|
+
new TextDecoder("utf-8", { fatal: true });
|
|
7
|
+
function encodeVoiceAudioFrame(frame) {
|
|
8
|
+
const id = encoder.encode(frame.responseId);
|
|
9
|
+
if (!id.length || id.length > 160 || !Number.isInteger(frame.seq) || frame.seq < 1 || frame.seq > 4294967295 || !frame.audio.length || frame.audio.length % 2 || HEADER_BYTES + id.length + frame.audio.length > MAX_FRAME_BYTES) throw new Error("Invalid voice audio frame");
|
|
10
|
+
const bytes = new Uint8Array(HEADER_BYTES + id.length + frame.audio.length);
|
|
11
|
+
const header = new DataView(bytes.buffer);
|
|
12
|
+
header.setUint32(0, MAGIC);
|
|
13
|
+
header.setUint32(4, frame.seq);
|
|
14
|
+
header.setUint32(8, id.length);
|
|
15
|
+
bytes.set(id, HEADER_BYTES);
|
|
16
|
+
bytes.set(frame.audio, HEADER_BYTES + id.length);
|
|
17
|
+
return bytes;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { encodeVoiceAudioFrame };
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import "./voice-audio.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const VOICE_REALTIME_WS_PATH = "/api/voice/realtime/v2/ws";
|
|
4
|
+
const VOICE_REALTIME_MAX_BINARY_FRAME_BYTES = 64 * 1024;
|
|
5
|
+
const VOICE_REALTIME_START_TIMEOUT_MS = 1e4;
|
|
6
|
+
const VOICE_REALTIME_HEARTBEAT_INTERVAL_MS = 15e3;
|
|
7
|
+
const idSchema = z.uuid();
|
|
8
|
+
const timestampSchema = z.number().int().nonnegative();
|
|
9
|
+
const voicePurposeSchema = z.enum(["dictation", "conversation"]);
|
|
10
|
+
const voiceEngineSchema = z.enum(["agent", "omni"]);
|
|
11
|
+
const voiceInputModeSchema = z.literal("server_vad");
|
|
12
|
+
const voiceLanguageSchema = z.enum(["zh", "en"]);
|
|
13
|
+
const voicePcmFormatSchema = z.strictObject({
|
|
14
|
+
encoding: z.literal("pcm_s16le"),
|
|
15
|
+
sampleRate: z.union([z.literal(16e3), z.literal(24e3)]),
|
|
16
|
+
channels: z.literal(1)
|
|
17
|
+
});
|
|
18
|
+
const voiceProviderRouteSchema = z.strictObject({
|
|
19
|
+
provider: z.string().min(1).max(100),
|
|
20
|
+
model: z.string().min(1).max(200),
|
|
21
|
+
managed: z.boolean()
|
|
22
|
+
});
|
|
23
|
+
const voiceRouteSchema = z.discriminatedUnion("engine", [
|
|
24
|
+
z.strictObject({
|
|
25
|
+
engine: z.literal("dictation"),
|
|
26
|
+
stt: voiceProviderRouteSchema
|
|
27
|
+
}),
|
|
28
|
+
z.strictObject({
|
|
29
|
+
engine: z.literal("agent"),
|
|
30
|
+
stt: voiceProviderRouteSchema,
|
|
31
|
+
tts: voiceProviderRouteSchema
|
|
32
|
+
}),
|
|
33
|
+
z.strictObject({
|
|
34
|
+
engine: z.literal("omni"),
|
|
35
|
+
omni: voiceProviderRouteSchema
|
|
36
|
+
})
|
|
37
|
+
]);
|
|
38
|
+
const availabilitySchema = z.strictObject({
|
|
39
|
+
available: z.boolean(),
|
|
40
|
+
reasonCode: z.enum(["VOICE_DISABLED", "PROVIDER_UNAVAILABLE"]).optional()
|
|
41
|
+
});
|
|
42
|
+
z.object({
|
|
43
|
+
enabled: z.boolean(),
|
|
44
|
+
defaultEngine: voiceEngineSchema,
|
|
45
|
+
omni: voiceProviderRouteSchema.nullable(),
|
|
46
|
+
stt: voiceProviderRouteSchema.nullable(),
|
|
47
|
+
tts: voiceProviderRouteSchema.extend({ voice: z.string().optional() }).nullable(),
|
|
48
|
+
capabilities: z.strictObject({
|
|
49
|
+
dictation: availabilitySchema,
|
|
50
|
+
agent: availabilitySchema,
|
|
51
|
+
omni: availabilitySchema,
|
|
52
|
+
languages: z.array(voiceLanguageSchema),
|
|
53
|
+
bargeIn: z.boolean()
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
const createVoiceSessionRequestSchema = z.strictObject({
|
|
57
|
+
purpose: voicePurposeSchema,
|
|
58
|
+
engine: voiceEngineSchema.optional(),
|
|
59
|
+
sessionKey: z.string().min(1).max(512).optional(),
|
|
60
|
+
language: voiceLanguageSchema.optional()
|
|
61
|
+
}).superRefine((value, context) => {
|
|
62
|
+
if (value.purpose === "conversation" && !value.sessionKey) context.addIssue({
|
|
63
|
+
code: "custom",
|
|
64
|
+
path: ["sessionKey"],
|
|
65
|
+
message: "sessionKey is required for conversation"
|
|
66
|
+
});
|
|
67
|
+
if (value.purpose !== "conversation" && value.engine !== void 0) context.addIssue({
|
|
68
|
+
code: "custom",
|
|
69
|
+
path: ["engine"],
|
|
70
|
+
message: "engine is only supported for conversation"
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
z.strictObject({
|
|
74
|
+
sessionId: idSchema,
|
|
75
|
+
ticket: z.string().min(32).max(512),
|
|
76
|
+
ticketExpiresAt: z.iso.datetime(),
|
|
77
|
+
websocketPath: z.literal(VOICE_REALTIME_WS_PATH),
|
|
78
|
+
protocolVersion: z.literal(2),
|
|
79
|
+
purpose: voicePurposeSchema,
|
|
80
|
+
inputMode: voiceInputModeSchema,
|
|
81
|
+
bargeIn: z.boolean(),
|
|
82
|
+
inputFormat: voicePcmFormatSchema,
|
|
83
|
+
limits: z.strictObject({
|
|
84
|
+
maxBinaryFrameBytes: z.literal(VOICE_REALTIME_MAX_BINARY_FRAME_BYTES),
|
|
85
|
+
maxSessionMs: z.number().int().positive(),
|
|
86
|
+
idleTimeoutMs: z.number().int().positive()
|
|
87
|
+
}),
|
|
88
|
+
route: voiceRouteSchema
|
|
89
|
+
});
|
|
90
|
+
const clientEnvelope = (type, payload) => z.strictObject({
|
|
91
|
+
protocolVersion: z.literal(2),
|
|
92
|
+
messageId: idSchema,
|
|
93
|
+
type: z.literal(type),
|
|
94
|
+
sentAt: timestampSchema,
|
|
95
|
+
payload
|
|
96
|
+
});
|
|
97
|
+
const voiceClientMessageSchema = z.discriminatedUnion("type", [
|
|
98
|
+
clientEnvelope("session.start", z.strictObject({
|
|
99
|
+
sessionId: idSchema,
|
|
100
|
+
ticket: z.string().min(32).max(512)
|
|
101
|
+
})),
|
|
102
|
+
clientEnvelope("session.metric", z.strictObject({
|
|
103
|
+
responseId: z.string().min(1).max(160),
|
|
104
|
+
metric: z.enum(["speech_end_to_audio_received", "local_stop"]),
|
|
105
|
+
durationMs: z.number().finite().min(0).max(6e5)
|
|
106
|
+
})),
|
|
107
|
+
clientEnvelope("input.mute", z.strictObject({ muted: z.boolean() })),
|
|
108
|
+
clientEnvelope("input.commit", z.strictObject({})),
|
|
109
|
+
clientEnvelope("response.cancel", z.strictObject({ responseId: z.string().min(1).max(160) })),
|
|
110
|
+
clientEnvelope("response.audio.played", z.strictObject({
|
|
111
|
+
responseId: z.string().min(1).max(160),
|
|
112
|
+
playedBytes: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).multipleOf(2)
|
|
113
|
+
})),
|
|
114
|
+
clientEnvelope("session.stop", z.strictObject({ reason: z.enum([
|
|
115
|
+
"user_finished",
|
|
116
|
+
"surface_closed",
|
|
117
|
+
"replaced"
|
|
118
|
+
]) })),
|
|
119
|
+
clientEnvelope("session.ping", z.strictObject({}))
|
|
120
|
+
]);
|
|
121
|
+
const transcriptPayloadSchema = z.strictObject({
|
|
122
|
+
utteranceId: z.string().min(1).max(160),
|
|
123
|
+
revision: z.number().int().positive(),
|
|
124
|
+
text: z.string().max(32 * 1024),
|
|
125
|
+
language: voiceLanguageSchema.optional()
|
|
126
|
+
});
|
|
127
|
+
const serverEnvelope = (type, payload) => z.strictObject({
|
|
128
|
+
protocolVersion: z.literal(2),
|
|
129
|
+
eventId: idSchema,
|
|
130
|
+
seq: z.number().int().positive(),
|
|
131
|
+
type: z.literal(type),
|
|
132
|
+
sentAt: timestampSchema,
|
|
133
|
+
sessionId: idSchema,
|
|
134
|
+
payload
|
|
135
|
+
});
|
|
136
|
+
z.discriminatedUnion("type", [
|
|
137
|
+
serverEnvelope("session.ready", z.strictObject({
|
|
138
|
+
purpose: voicePurposeSchema,
|
|
139
|
+
inputMode: voiceInputModeSchema,
|
|
140
|
+
inputFormat: voicePcmFormatSchema,
|
|
141
|
+
route: voiceRouteSchema,
|
|
142
|
+
heartbeatIntervalMs: z.literal(VOICE_REALTIME_HEARTBEAT_INTERVAL_MS)
|
|
143
|
+
})),
|
|
144
|
+
serverEnvelope("input.speech_started", z.strictObject({ utteranceId: z.string().min(1).max(160) })),
|
|
145
|
+
serverEnvelope("input.speech_stopped", z.strictObject({ utteranceId: z.string().min(1).max(160) })),
|
|
146
|
+
serverEnvelope("input.transcript.delta", transcriptPayloadSchema),
|
|
147
|
+
serverEnvelope("input.transcript.final", transcriptPayloadSchema),
|
|
148
|
+
serverEnvelope("response.created", z.strictObject({ responseId: z.string().min(1).max(160) })),
|
|
149
|
+
serverEnvelope("response.activity", z.strictObject({
|
|
150
|
+
responseId: z.string().min(1).max(160),
|
|
151
|
+
toolCallId: z.string().min(1).max(160),
|
|
152
|
+
toolName: z.string().min(1).max(256),
|
|
153
|
+
status: z.enum([
|
|
154
|
+
"running",
|
|
155
|
+
"completed",
|
|
156
|
+
"failed"
|
|
157
|
+
])
|
|
158
|
+
})),
|
|
159
|
+
serverEnvelope("response.clarification", z.strictObject({
|
|
160
|
+
responseId: z.string().min(1).max(160),
|
|
161
|
+
requestId: z.string().min(1).max(160),
|
|
162
|
+
question: z.string().min(1).max(8e3),
|
|
163
|
+
choices: z.array(z.string().max(1e3)).max(20).optional()
|
|
164
|
+
})),
|
|
165
|
+
serverEnvelope("response.text.delta", z.strictObject({
|
|
166
|
+
responseId: z.string().min(1).max(160),
|
|
167
|
+
delta: z.string().max(32 * 1024)
|
|
168
|
+
})),
|
|
169
|
+
serverEnvelope("response.text.done", z.strictObject({ responseId: z.string().min(1).max(160) })),
|
|
170
|
+
serverEnvelope("response.audio.started", z.strictObject({
|
|
171
|
+
responseId: z.string().min(1).max(160),
|
|
172
|
+
format: voicePcmFormatSchema
|
|
173
|
+
})),
|
|
174
|
+
serverEnvelope("response.audio.done", z.strictObject({ responseId: z.string().min(1).max(160) })),
|
|
175
|
+
serverEnvelope("response.done", z.strictObject({
|
|
176
|
+
responseId: z.string().min(1).max(160),
|
|
177
|
+
finishReason: z.enum([
|
|
178
|
+
"completed",
|
|
179
|
+
"text_only",
|
|
180
|
+
"audio_partial"
|
|
181
|
+
]),
|
|
182
|
+
audio: z.boolean()
|
|
183
|
+
})),
|
|
184
|
+
serverEnvelope("response.cancelled", z.strictObject({
|
|
185
|
+
responseId: z.string().min(1).max(160),
|
|
186
|
+
reason: z.enum([
|
|
187
|
+
"barge_in",
|
|
188
|
+
"client_cancelled",
|
|
189
|
+
"session_closed"
|
|
190
|
+
])
|
|
191
|
+
})),
|
|
192
|
+
serverEnvelope("session.pong", z.strictObject({})),
|
|
193
|
+
serverEnvelope("session.error", z.strictObject({
|
|
194
|
+
code: z.string().min(1).max(80),
|
|
195
|
+
message: z.string().min(1).max(500),
|
|
196
|
+
recoverable: z.boolean()
|
|
197
|
+
})),
|
|
198
|
+
serverEnvelope("session.closed", z.strictObject({ reason: z.string().min(1).max(160) }))
|
|
199
|
+
]);
|
|
200
|
+
function parseVoiceClientMessage(value) {
|
|
201
|
+
return voiceClientMessageSchema.parse(value);
|
|
202
|
+
}
|
|
203
|
+
function parseVoiceClientJsonFrame(text) {
|
|
204
|
+
if (new TextEncoder().encode(text).byteLength > 16 * 1024) throw new Error("Voice control frame exceeds 16384 bytes");
|
|
205
|
+
return JSON.parse(text);
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { VOICE_REALTIME_HEARTBEAT_INTERVAL_MS, VOICE_REALTIME_MAX_BINARY_FRAME_BYTES, VOICE_REALTIME_START_TIMEOUT_MS, VOICE_REALTIME_WS_PATH, createVoiceSessionRequestSchema, parseVoiceClientJsonFrame, parseVoiceClientMessage };
|
|
@@ -13,6 +13,7 @@ export type RunEmbeddedForSessionParams = {
|
|
|
13
13
|
agentManager: AgentInstanceGateway;
|
|
14
14
|
modelManager: ModelManager;
|
|
15
15
|
thinkingOverride?: string | null;
|
|
16
|
+
presentation?: 'voice';
|
|
16
17
|
abortSignal?: AbortSignal;
|
|
17
18
|
/** Absolute parent deadline. The turn's own timeout is capped to the remaining budget. */
|
|
18
19
|
deadlineAtMs?: number;
|
|
@@ -9,6 +9,7 @@ import { evaluateContextBudget } from "../memory/context-budget.js";
|
|
|
9
9
|
import { resolveCompactionPolicy } from "../memory/compaction-policy.js";
|
|
10
10
|
import { projectTurnOutcome } from "../../session/turn-outcome-projector.js";
|
|
11
11
|
import { runXopcEmbeddedTurn } from "./run-turn.js";
|
|
12
|
+
import { voicePresentationPrompt } from "../prompt/voice-presentation.js";
|
|
12
13
|
import { applyStartupContextToUserMessage } from "../reply/apply-turn-user-enrichment.js";
|
|
13
14
|
import { AgentRunSupervisor } from "../orchestration/agent-run-supervisor.js";
|
|
14
15
|
import crypto from "node:crypto";
|
|
@@ -95,7 +96,7 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
95
96
|
agentManager.setModelForSession(sessionKey, modelRef);
|
|
96
97
|
const tools = agent.state.tools;
|
|
97
98
|
const turnPolicy = agentManager.createAgentTurnPolicy(sessionKey);
|
|
98
|
-
const systemPrompt = agent.state.systemPrompt ?? "";
|
|
99
|
+
const systemPrompt = [agent.state.systemPrompt ?? "", params.presentation === "voice" ? voicePresentationPrompt : ""].filter(Boolean).join("\n\n");
|
|
99
100
|
const thinkingLevel = params.thinkingOverride ?? agent.state.thinkingLevel;
|
|
100
101
|
const workspaceDir = agentManager.getResolvedWorkspaceForSession(sessionKey);
|
|
101
102
|
const promptCachePolicy = resolvePromptCachePolicy(config ? resolveEffectiveAgentProfileForSession(config, sessionKey).config.runtime.promptCache : void 0);
|
|
@@ -75,6 +75,7 @@ export declare class TurnDispatcher {
|
|
|
75
75
|
signal?: AbortSignal;
|
|
76
76
|
runId?: string;
|
|
77
77
|
sourceContexts?: AgentSourceContext[];
|
|
78
|
+
presentation?: 'voice';
|
|
78
79
|
}): AsyncGenerator<ProcessDirectStreamEvent, void, unknown>;
|
|
79
80
|
/** Push an out-of-band event into the live webchat stream for a session. */
|
|
80
81
|
enqueueWebchatStreamEvent(sessionKey: string, event: {
|
|
@@ -34,7 +34,8 @@ var TurnDispatcher = class {
|
|
|
34
34
|
thinking,
|
|
35
35
|
signal: options?.signal,
|
|
36
36
|
runId: options?.runId,
|
|
37
|
-
sourceContexts: options?.sourceContexts
|
|
37
|
+
sourceContexts: options?.sourceContexts,
|
|
38
|
+
presentation: options?.presentation
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
/** Push an out-of-band event into the live webchat stream for a session. */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Per-turn presentation only; never persisted as a user message or Agent identity. */
|
|
2
|
+
export declare const voicePresentationPrompt = "This turn is a live voice conversation in the same Chat.\nLead with the useful answer. Prefer one to three natural spoken sentences unless the user asks for detail.\nAllow silence. Do not repeatedly greet, recap unrelated old tasks, or end every reply with a question.\nFor work, briefly say what you are doing, use the available tools, then report the actual result.\nKeep code, long URLs, tables and detailed reference material in Chat; introduce them with a short spoken explanation.\nDo not imply a task continues in the background unless an existing task or workflow actually started it.\nUse the existing clarification and approval mechanisms. A background sound or ambiguous interjection is not permission for an action.\nStopping speech does not undo a completed tool action. State consequential results accurately.";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/agent/prompt/voice-presentation.ts
|
|
2
|
+
/** Per-turn presentation only; never persisted as a user message or Agent identity. */
|
|
3
|
+
const voicePresentationPrompt = `This turn is a live voice conversation in the same Chat.
|
|
4
|
+
Lead with the useful answer. Prefer one to three natural spoken sentences unless the user asks for detail.
|
|
5
|
+
Allow silence. Do not repeatedly greet, recap unrelated old tasks, or end every reply with a question.
|
|
6
|
+
For work, briefly say what you are doing, use the available tools, then report the actual result.
|
|
7
|
+
Keep code, long URLs, tables and detailed reference material in Chat; introduce them with a short spoken explanation.
|
|
8
|
+
Do not imply a task continues in the background unless an existing task or workflow actually started it.
|
|
9
|
+
Use the existing clarification and approval mechanisms. A background sound or ambiguous interjection is not permission for an action.
|
|
10
|
+
Stopping speech does not undo a completed tool action. State consequential results accurately.`;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { voicePresentationPrompt };
|
|
@@ -69,6 +69,7 @@ export interface RunDirectAgentTurnInput {
|
|
|
69
69
|
deadlineAtMs?: number;
|
|
70
70
|
sourceImages?: ImageContent[];
|
|
71
71
|
sourceContexts?: AgentSourceContext[];
|
|
72
|
+
presentation?: 'voice';
|
|
72
73
|
onEvent?: (event: EmbeddedStreamEvent) => void;
|
|
73
74
|
}
|
|
74
75
|
export interface RunDirectAgentTurnResult {
|
|
@@ -107,6 +107,7 @@ async function runDirectAgentTurn(deps, input) {
|
|
|
107
107
|
runId: turnId,
|
|
108
108
|
userMessage: userMessageForModel,
|
|
109
109
|
llmImages,
|
|
110
|
+
presentation: input.presentation,
|
|
110
111
|
sessionStore: deps.sessionStore,
|
|
111
112
|
agentManager: deps.agentManager,
|
|
112
113
|
modelManager: deps.modelManager,
|
|
@@ -298,6 +298,7 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
298
298
|
userMessage,
|
|
299
299
|
abortSignal: signal,
|
|
300
300
|
sourceContexts,
|
|
301
|
+
presentation: input.presentation,
|
|
301
302
|
runId: input.runId,
|
|
302
303
|
onEvent: (embeddedEvent) => {
|
|
303
304
|
const event = { ...embeddedEvent };
|
|
@@ -332,7 +333,7 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
332
333
|
sessionKey,
|
|
333
334
|
droppedEvents: queue.droppedCount
|
|
334
335
|
}, "Coalesced stream progress events because the consumer fell behind");
|
|
335
|
-
if (!userAborted && !streamOverflowed && channel === "webchat" && !explicitTtsEmitted) try {
|
|
336
|
+
if (!userAborted && !streamOverflowed && channel === "webchat" && !explicitTtsEmitted && input.presentation !== "voice") try {
|
|
336
337
|
const ttsAudioEvent = await deps.maybeEmitWebchatTts(sessionKey, inboundVoice);
|
|
337
338
|
if (ttsAudioEvent) queue.push(ttsAudioEvent);
|
|
338
339
|
} catch (ttsErr) {
|
|
@@ -76,8 +76,10 @@ var SessionConfigService = class {
|
|
|
76
76
|
});
|
|
77
77
|
this.opts.modelManager.restoreSessionModel(sessionKey, modelRef, updated.fixedModel === true);
|
|
78
78
|
try {
|
|
79
|
-
this.opts.agentManager.
|
|
80
|
-
|
|
79
|
+
if (this.opts.agentManager.getAgent(sessionKey)) {
|
|
80
|
+
this.opts.agentManager.setModelForSession(sessionKey, modelRef);
|
|
81
|
+
this.opts.agentManager.setThinkingLevel(sessionKey, thinkingLevel);
|
|
82
|
+
}
|
|
81
83
|
} catch (err) {
|
|
82
84
|
this.opts.agentManager.removeAgent(sessionKey);
|
|
83
85
|
log.warn({
|
|
@@ -2,8 +2,8 @@ import { createLogger } from "../../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { init_providers, resolveModel } from "../../providers/index.js";
|
|
4
4
|
import { completeWithResolvedCredentials } from "../../providers/model-call.js";
|
|
5
|
-
import { resolveDraftModelRef } from "../../workflows/draft/workflow-draft-service.js";
|
|
6
5
|
import { buildAutomationDraftPrompt, buildAutomationDraftRepairPrompt, buildAutomationRunRepairPrompt, buildAutomationRunRepairRetryPrompt } from "./automation-draft-prompt.js";
|
|
6
|
+
import { resolveDraftModelRef } from "../../workflows/draft/workflow-draft-service.js";
|
|
7
7
|
import { buildAutomationDraftResponse, parseGeneratedAutomationDraft, parseGeneratedAutomationRepairDraft } from "./automation-draft-validator.js";
|
|
8
8
|
//#region src/automations/draft/automation-draft-service.ts
|
|
9
9
|
init_providers();
|
|
@@ -29,11 +29,11 @@ export declare const OpenAICompletionsCompatSchema: z.ZodObject<{
|
|
|
29
29
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
30
30
|
requiresMistralToolIds: z.ZodOptional<z.ZodBoolean>;
|
|
31
31
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
32
|
-
zai: "zai";
|
|
33
32
|
"ant-ling": "ant-ling";
|
|
34
33
|
openai: "openai";
|
|
35
34
|
deepseek: "deepseek";
|
|
36
35
|
openrouter: "openrouter";
|
|
36
|
+
zai: "zai";
|
|
37
37
|
together: "together";
|
|
38
38
|
baseten: "baseten";
|
|
39
39
|
dashscope: "dashscope";
|
|
@@ -67,11 +67,11 @@ export declare const OpenAICompatSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
67
67
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
68
68
|
requiresMistralToolIds: z.ZodOptional<z.ZodBoolean>;
|
|
69
69
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
70
|
-
zai: "zai";
|
|
71
70
|
"ant-ling": "ant-ling";
|
|
72
71
|
openai: "openai";
|
|
73
72
|
deepseek: "deepseek";
|
|
74
73
|
openrouter: "openrouter";
|
|
74
|
+
zai: "zai";
|
|
75
75
|
together: "together";
|
|
76
76
|
baseten: "baseten";
|
|
77
77
|
dashscope: "dashscope";
|
|
@@ -312,11 +312,11 @@ export declare const CustomModelSchema: z.ZodObject<{
|
|
|
312
312
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
313
313
|
requiresMistralToolIds: z.ZodOptional<z.ZodBoolean>;
|
|
314
314
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
315
|
-
zai: "zai";
|
|
316
315
|
"ant-ling": "ant-ling";
|
|
317
316
|
openai: "openai";
|
|
318
317
|
deepseek: "deepseek";
|
|
319
318
|
openrouter: "openrouter";
|
|
319
|
+
zai: "zai";
|
|
320
320
|
together: "together";
|
|
321
321
|
baseten: "baseten";
|
|
322
322
|
dashscope: "dashscope";
|
|
@@ -375,11 +375,11 @@ export declare const ModelOverrideSchema: z.ZodObject<{
|
|
|
375
375
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
376
376
|
requiresMistralToolIds: z.ZodOptional<z.ZodBoolean>;
|
|
377
377
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
378
|
-
zai: "zai";
|
|
379
378
|
"ant-ling": "ant-ling";
|
|
380
379
|
openai: "openai";
|
|
381
380
|
deepseek: "deepseek";
|
|
382
381
|
openrouter: "openrouter";
|
|
382
|
+
zai: "zai";
|
|
383
383
|
together: "together";
|
|
384
384
|
baseten: "baseten";
|
|
385
385
|
dashscope: "dashscope";
|
|
@@ -466,11 +466,11 @@ export declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
466
466
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
467
467
|
requiresMistralToolIds: z.ZodOptional<z.ZodBoolean>;
|
|
468
468
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
469
|
-
zai: "zai";
|
|
470
469
|
"ant-ling": "ant-ling";
|
|
471
470
|
openai: "openai";
|
|
472
471
|
deepseek: "deepseek";
|
|
473
472
|
openrouter: "openrouter";
|
|
473
|
+
zai: "zai";
|
|
474
474
|
together: "together";
|
|
475
475
|
baseten: "baseten";
|
|
476
476
|
dashscope: "dashscope";
|
|
@@ -529,11 +529,11 @@ export declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
529
529
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
530
530
|
requiresMistralToolIds: z.ZodOptional<z.ZodBoolean>;
|
|
531
531
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
532
|
-
zai: "zai";
|
|
533
532
|
"ant-ling": "ant-ling";
|
|
534
533
|
openai: "openai";
|
|
535
534
|
deepseek: "deepseek";
|
|
536
535
|
openrouter: "openrouter";
|
|
536
|
+
zai: "zai";
|
|
537
537
|
together: "together";
|
|
538
538
|
baseten: "baseten";
|
|
539
539
|
dashscope: "dashscope";
|
|
@@ -701,11 +701,11 @@ export declare const ModelsJsonSchema: z.ZodObject<{
|
|
|
701
701
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
702
702
|
requiresMistralToolIds: z.ZodOptional<z.ZodBoolean>;
|
|
703
703
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
704
|
-
zai: "zai";
|
|
705
704
|
"ant-ling": "ant-ling";
|
|
706
705
|
openai: "openai";
|
|
707
706
|
deepseek: "deepseek";
|
|
708
707
|
openrouter: "openrouter";
|
|
708
|
+
zai: "zai";
|
|
709
709
|
together: "together";
|
|
710
710
|
baseten: "baseten";
|
|
711
711
|
dashscope: "dashscope";
|
|
@@ -764,11 +764,11 @@ export declare const ModelsJsonSchema: z.ZodObject<{
|
|
|
764
764
|
requiresThinkingAsText: z.ZodOptional<z.ZodBoolean>;
|
|
765
765
|
requiresMistralToolIds: z.ZodOptional<z.ZodBoolean>;
|
|
766
766
|
thinkingFormat: z.ZodOptional<z.ZodEnum<{
|
|
767
|
-
zai: "zai";
|
|
768
767
|
"ant-ling": "ant-ling";
|
|
769
768
|
openai: "openai";
|
|
770
769
|
deepseek: "deepseek";
|
|
771
770
|
openrouter: "openrouter";
|
|
771
|
+
zai: "zai";
|
|
772
772
|
together: "together";
|
|
773
773
|
baseten: "baseten";
|
|
774
774
|
dashscope: "dashscope";
|
|
@@ -1071,6 +1071,36 @@ export declare const VoiceConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
|
1071
1071
|
customInstruction: z.ZodOptional<z.ZodString>;
|
|
1072
1072
|
}, z.core.$strict>>;
|
|
1073
1073
|
}, z.core.$strict>>;
|
|
1074
|
+
realtime: z.ZodDefault<z.ZodObject<{
|
|
1075
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1076
|
+
defaultEngine: z.ZodDefault<z.ZodEnum<{
|
|
1077
|
+
agent: "agent";
|
|
1078
|
+
omni: "omni";
|
|
1079
|
+
}>>;
|
|
1080
|
+
silenceDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
1081
|
+
idleTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
1082
|
+
maxDictationMs: z.ZodDefault<z.ZodNumber>;
|
|
1083
|
+
maxConversationMs: z.ZodDefault<z.ZodNumber>;
|
|
1084
|
+
bargeIn: z.ZodDefault<z.ZodBoolean>;
|
|
1085
|
+
tts: z.ZodOptional<z.ZodObject<{
|
|
1086
|
+
provider: z.ZodEnum<{
|
|
1087
|
+
alibaba: "alibaba";
|
|
1088
|
+
"xopc-cloud": "xopc-cloud";
|
|
1089
|
+
}>;
|
|
1090
|
+
voice: z.ZodOptional<z.ZodString>;
|
|
1091
|
+
}, z.core.$strict>>;
|
|
1092
|
+
omni: z.ZodOptional<z.ZodObject<{
|
|
1093
|
+
provider: z.ZodEnum<{
|
|
1094
|
+
alibaba: "alibaba";
|
|
1095
|
+
"xopc-cloud": "xopc-cloud";
|
|
1096
|
+
}>;
|
|
1097
|
+
model: z.ZodString;
|
|
1098
|
+
voice: z.ZodString;
|
|
1099
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
1100
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
1101
|
+
instructions: z.ZodDefault<z.ZodString>;
|
|
1102
|
+
}, z.core.$strict>>;
|
|
1103
|
+
}, z.core.$strict>>;
|
|
1074
1104
|
}, z.core.$strict>>;
|
|
1075
1105
|
export declare const MessagesConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
1076
1106
|
tts: z.ZodOptional<z.ZodObject<{
|
|
@@ -2183,6 +2213,36 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
2183
2213
|
customInstruction: z.ZodOptional<z.ZodString>;
|
|
2184
2214
|
}, z.core.$strict>>;
|
|
2185
2215
|
}, z.core.$strict>>;
|
|
2216
|
+
realtime: z.ZodDefault<z.ZodObject<{
|
|
2217
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2218
|
+
defaultEngine: z.ZodDefault<z.ZodEnum<{
|
|
2219
|
+
agent: "agent";
|
|
2220
|
+
omni: "omni";
|
|
2221
|
+
}>>;
|
|
2222
|
+
silenceDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
2223
|
+
idleTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
2224
|
+
maxDictationMs: z.ZodDefault<z.ZodNumber>;
|
|
2225
|
+
maxConversationMs: z.ZodDefault<z.ZodNumber>;
|
|
2226
|
+
bargeIn: z.ZodDefault<z.ZodBoolean>;
|
|
2227
|
+
tts: z.ZodOptional<z.ZodObject<{
|
|
2228
|
+
provider: z.ZodEnum<{
|
|
2229
|
+
alibaba: "alibaba";
|
|
2230
|
+
"xopc-cloud": "xopc-cloud";
|
|
2231
|
+
}>;
|
|
2232
|
+
voice: z.ZodOptional<z.ZodString>;
|
|
2233
|
+
}, z.core.$strict>>;
|
|
2234
|
+
omni: z.ZodOptional<z.ZodObject<{
|
|
2235
|
+
provider: z.ZodEnum<{
|
|
2236
|
+
alibaba: "alibaba";
|
|
2237
|
+
"xopc-cloud": "xopc-cloud";
|
|
2238
|
+
}>;
|
|
2239
|
+
model: z.ZodString;
|
|
2240
|
+
voice: z.ZodString;
|
|
2241
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
2242
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
2243
|
+
instructions: z.ZodDefault<z.ZodString>;
|
|
2244
|
+
}, z.core.$strict>>;
|
|
2245
|
+
}, z.core.$strict>>;
|
|
2186
2246
|
}, z.core.$strict>>;
|
|
2187
2247
|
update: z.ZodOptional<z.ZodObject<{
|
|
2188
2248
|
checkOnStart: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -800,7 +800,37 @@ activityDetailDefault: z.enum([
|
|
|
800
800
|
VoiceConfigSchema = z.object({
|
|
801
801
|
languageMode: z.enum(["auto", "manual"]).optional(),
|
|
802
802
|
language: z.enum(["en", "zh"]).optional(),
|
|
803
|
-
input: z.object({ refinement: VoiceRefinementConfigSchema.optional() }).strict().optional()
|
|
803
|
+
input: z.object({ refinement: VoiceRefinementConfigSchema.optional() }).strict().optional(),
|
|
804
|
+
realtime: z.object({
|
|
805
|
+
enabled: z.boolean().default(false),
|
|
806
|
+
defaultEngine: z.enum(["agent", "omni"]).default("agent"),
|
|
807
|
+
silenceDurationMs: z.number().int().min(300).max(2e3).default(700),
|
|
808
|
+
idleTimeoutMs: z.number().int().min(1e4).max(3e5).default(6e4),
|
|
809
|
+
maxDictationMs: z.number().int().min(1e4).max(36e5).default(6e5),
|
|
810
|
+
maxConversationMs: z.number().int().min(1e4).max(72e5).default(36e5),
|
|
811
|
+
bargeIn: z.boolean().default(true),
|
|
812
|
+
/** Conversation output selection; credentials stay in the provider configuration. */
|
|
813
|
+
tts: z.object({
|
|
814
|
+
provider: z.enum(["alibaba", "xopc-cloud"]),
|
|
815
|
+
voice: z.string().trim().min(1).max(200).optional()
|
|
816
|
+
}).strict().optional(),
|
|
817
|
+
omni: z.object({
|
|
818
|
+
provider: z.enum(["alibaba", "xopc-cloud"]),
|
|
819
|
+
model: z.string().min(1).max(200),
|
|
820
|
+
voice: z.string().min(1).max(100),
|
|
821
|
+
baseUrl: z.string().url().optional(),
|
|
822
|
+
apiKey: z.string().min(1).optional(),
|
|
823
|
+
instructions: z.string().max(8e3).default("You are a friendly voice companion. Keep replies conversational and concise. You cannot execute tools or perform actions.")
|
|
824
|
+
}).strict().optional()
|
|
825
|
+
}).strict().default({
|
|
826
|
+
enabled: false,
|
|
827
|
+
defaultEngine: "agent",
|
|
828
|
+
silenceDurationMs: 700,
|
|
829
|
+
idleTimeoutMs: 6e4,
|
|
830
|
+
maxDictationMs: 6e5,
|
|
831
|
+
maxConversationMs: 36e5,
|
|
832
|
+
bargeIn: true
|
|
833
|
+
})
|
|
804
834
|
}).strict().optional();
|
|
805
835
|
MessagesConfigSchema = z.object({
|
|
806
836
|
/** Voice (text-to-speech) output configuration. */
|
|
@@ -289,6 +289,10 @@ var FileSpaceService = class {
|
|
|
289
289
|
absolutePath
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
|
+
async rootResource(spaceId) {
|
|
293
|
+
const space = await this.get(spaceId);
|
|
294
|
+
return fileResourceFromPath(space, await resolveFilePath(space.root, ""));
|
|
295
|
+
}
|
|
292
296
|
async children(spaceId, path = "") {
|
|
293
297
|
const space = await this.get(spaceId);
|
|
294
298
|
const directory = await resolveFilePath(space.root, path);
|
|
@@ -35,7 +35,12 @@ async function* coalesceThinkingDeltas(source, options = {}) {
|
|
|
35
35
|
if (!Number.isFinite(windowMs) || windowMs <= 0) throw new Error("thinking delta coalescer windowMs must be greater than zero");
|
|
36
36
|
if (!Number.isInteger(maxChars) || maxChars <= 0) throw new Error("thinking delta coalescer maxChars must be a positive integer");
|
|
37
37
|
const iterator = source[Symbol.asyncIterator]();
|
|
38
|
-
|
|
38
|
+
const readNext = () => {
|
|
39
|
+
const result = iterator.next();
|
|
40
|
+
result.catch(() => {});
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
let next = readNext();
|
|
39
44
|
let pending;
|
|
40
45
|
let deadlineAt = 0;
|
|
41
46
|
try {
|
|
@@ -43,7 +48,7 @@ async function* coalesceThinkingDeltas(source, options = {}) {
|
|
|
43
48
|
if (!pending) {
|
|
44
49
|
const result = await next;
|
|
45
50
|
if (result.done) break;
|
|
46
|
-
next =
|
|
51
|
+
next = readNext();
|
|
47
52
|
if (!isThinkingDelta(result.value)) {
|
|
48
53
|
yield result.value;
|
|
49
54
|
continue;
|
|
@@ -68,7 +73,7 @@ async function* coalesceThinkingDeltas(source, options = {}) {
|
|
|
68
73
|
pending = void 0;
|
|
69
74
|
break;
|
|
70
75
|
}
|
|
71
|
-
next =
|
|
76
|
+
next = readNext();
|
|
72
77
|
const event = result.value;
|
|
73
78
|
if (!isThinkingDelta(event) || !belongsToSameThinkingStream(pending, event)) {
|
|
74
79
|
yield pending;
|
|
@@ -274,17 +274,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
274
274
|
};
|
|
275
275
|
stt: unknown;
|
|
276
276
|
tts: unknown;
|
|
277
|
-
voice:
|
|
278
|
-
languageMode?: "manual" | "auto";
|
|
279
|
-
language?: "en" | "zh";
|
|
280
|
-
input?: {
|
|
281
|
-
refinement?: {
|
|
282
|
-
mode: "off" | "custom" | "punctuation" | "light";
|
|
283
|
-
model?: string;
|
|
284
|
-
customInstruction?: string;
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
};
|
|
277
|
+
voice: unknown;
|
|
288
278
|
tools: {
|
|
289
279
|
web: {
|
|
290
280
|
region: "cn" | "global" | null;
|