@xopcai/xopc 0.0.241 → 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-CLnbVm9G.js → activity-store-CAah-_8h.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DuBewmbW.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-DjBZe303.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-B-iul0RG.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-Cfk1lwBo.js → attachment-load-BS-S4LJ9.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BTSGvaeS.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-ChZyZK45.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-jvfcgFG-.js → browser-workflow-inputs-CRnkgZHI.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DrHW7XNi.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-CC9MFway.js → channels-status-swr-DuY4MGxe.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DeeZrVbV.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-CiqQOeQ3.js → cron-expression-D3bsKbNd.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CGAMGPfU.js → date-picker-BsGM6Yty.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CxWeUTsc.js → dependency-picker-Dj3g6YXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-C3QmYO75.js → desktop-pet-C1QT0Sur.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CAADkWYy.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-FQXjDJ8P.js → extension-debug-page-DOkf7nh9.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BJE1D5Ji.js → extension-page-Cq2IA4Ho.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-5Ik2tNry.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-cTj71t2a.js → gateway-config-api-DM3poL22.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-Bxe_R-JH.js → gateway-config-swr-BC3pgb_P.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-KXBUjNcx.js → gateway-settings-DPgH1hnh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DJG-I0wW.js → gateway-startup-retry-uMcSfLru.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-C8cVzIcs.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-Dc_ojQuj.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-pOKl7blR.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-Bi6wwKgm.js → local-apps-page-CgkY9E-r.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-C5wr3_pc.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-DGlVizWi.js → management-settings-Dv8NSJKt.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-CXP5zBx_.js → markdown-split-Cm0RBB-t.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-D6LxlDxr.js → markdown-view-PPCLt7fu.js} +3 -3
- package/dist/gateway/static/root/assets/{media-plugins-BsENGLr2.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-Y7GUjxHx.js → models-hub-cache-ZrbGRiGY.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-D2EqpDyo.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-C5NVcsKE.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-FXdFaoWM.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-2zm9edMA.js +5 -0
- package/dist/gateway/static/root/assets/{schema-form-BUzdHWx6.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-C0OBLqpu.js → settings-page-DzDhoyxv.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-NpLQkFCh.js → setup-status-panel-uDicHU1w.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BtbPYaYC.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-CYk8pN97.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-DmCRSvtd.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-DUko1ZnE.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-W_P8Kiv4.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-BZD0j1jc.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/agent-manager.js +1 -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/agent/skills/installer.d.ts +1 -0
- package/dist/src/agent/skills/installer.js +9 -6
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +5 -1
- 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 +36 -4
- package/dist/src/extensions/install.js +1 -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/runtime-tools.js +7 -1
- 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 +140 -3
- 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/runtime-tools/archive.js +17 -3
- package/dist/src/runtime-tools/command.d.ts +1 -0
- package/dist/src/runtime-tools/command.js +29 -8
- package/dist/src/runtime-tools/environment.d.ts +1 -0
- package/dist/src/runtime-tools/environment.js +11 -16
- package/dist/src/runtime-tools/install-lock.d.ts +1 -1
- package/dist/src/runtime-tools/install-lock.js +34 -21
- package/dist/src/runtime-tools/manager.d.ts +1 -1
- package/dist/src/runtime-tools/manager.js +99 -64
- package/dist/src/runtime-tools/manifest-store.d.ts +2 -0
- package/dist/src/runtime-tools/manifest-store.js +29 -8
- package/dist/src/runtime-tools/paths.d.ts +2 -1
- package/dist/src/runtime-tools/paths.js +19 -8
- package/dist/src/runtime-tools/probe.d.ts +2 -0
- package/dist/src/runtime-tools/probe.js +13 -1
- package/dist/src/runtime-tools/prune.js +21 -7
- 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 +6 -6
- package/dist/gateway/static/root/assets/Combination-14nmIgxH.js +0 -41
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DbdgX6AA.js +0 -1
- package/dist/gateway/static/root/assets/agents-BX3uRVm4.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-D8evZyFQ.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-CoZd_cZu.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-C8RRKT-a.js +0 -6
- package/dist/gateway/static/root/assets/block-editor-DCH9b2Ht.js +0 -184
- package/dist/gateway/static/root/assets/browser-settings-page-D1GPwIfx.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CrXB1Q-l.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-DWMSYaNZ.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DXTl1fNB.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-NdWtBda5.js +0 -1
- package/dist/gateway/static/root/assets/index-7i2P3312.js +0 -70
- package/dist/gateway/static/root/assets/index-DTo3IcbW.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-C_j_od5f.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-D6PDZEVP.js +0 -2
- package/dist/gateway/static/root/assets/messages-_tYhRAHD.js +0 -3
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-DcEz7qcX.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-Bu0a83Oj.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-DrILF6mR.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-DMhf1rdz.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DDHi0Y4Q.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CVMFKpmu.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B74aErBY.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bv-akndY.js +0 -5
- package/dist/gateway/static/root/assets/sessions-page-D2wmGNZE.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CYCCUMEt.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-rf8f1OGq.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BkvclZ_o.js +0 -1
- package/dist/gateway/static/root/assets/skills-page.utils-DGjnz-NG.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-6a2RdDl2.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Chfiba_x.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-SeOHP6XO.js +0 -1
- package/dist/gateway/static/root/assets/voice-config-api-BO6A8V3Z.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-BfwEoOGL.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-X7Z5_lRX.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BklMzkg8.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 };
|
|
@@ -241,6 +241,7 @@ var AgentManager = class {
|
|
|
241
241
|
getConfig: () => this.mergedConfig(),
|
|
242
242
|
getPrimaryModel: () => this.resolveModelStringToModel(this.pickDefaultModelRef()),
|
|
243
243
|
getMemoryManager: () => this.getCurrentWorkspaceRuntime().memoryManager,
|
|
244
|
+
getSkillManager: () => this.getCurrentWorkspaceRuntime().skillManager,
|
|
244
245
|
getSessionStore: this.config.getSessionStore,
|
|
245
246
|
gatewayClarify: this.config.gatewayClarify,
|
|
246
247
|
getAutomationService: this.config.getAutomationService,
|
|
@@ -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({
|
|
@@ -13,6 +13,7 @@ export interface InstallContext {
|
|
|
13
13
|
installSpec: SkillInstallSpec;
|
|
14
14
|
timeoutMs: number;
|
|
15
15
|
}
|
|
16
|
+
export declare function skillEnvironmentId(skill: Pick<SkillEntry['skill'], 'name' | 'filePath'>, installSpec: SkillInstallSpec): string;
|
|
16
17
|
/**
|
|
17
18
|
* Check if a binary exists
|
|
18
19
|
*/
|
|
@@ -19,6 +19,13 @@ import { execFile } from "child_process";
|
|
|
19
19
|
init_logger();
|
|
20
20
|
const execFileAsync = promisify(execFile);
|
|
21
21
|
const log = createLogger("SkillInstaller");
|
|
22
|
+
function skillEnvironmentId(skill, installSpec) {
|
|
23
|
+
return createHash("sha256").update(JSON.stringify({
|
|
24
|
+
skill: skill.name,
|
|
25
|
+
path: skill.filePath,
|
|
26
|
+
installSpec
|
|
27
|
+
})).digest("hex").slice(0, 24);
|
|
28
|
+
}
|
|
22
29
|
/**
|
|
23
30
|
* Check if a binary exists
|
|
24
31
|
*/
|
|
@@ -202,11 +209,7 @@ async function installSkill(ctx) {
|
|
|
202
209
|
if (installSpec.kind === "go") {
|
|
203
210
|
if (!hasBinary("go")) return createInstallFailure({ message: "go not installed — install it explicitly from https://go.dev/doc/install" });
|
|
204
211
|
}
|
|
205
|
-
const environmentId =
|
|
206
|
-
skill: ctx.skillEntry.skill.name,
|
|
207
|
-
path: ctx.skillEntry.skill.filePath,
|
|
208
|
-
installSpec
|
|
209
|
-
})).digest("hex").slice(0, 24);
|
|
212
|
+
const environmentId = skillEnvironmentId(ctx.skillEntry.skill, installSpec);
|
|
210
213
|
const environmentDir = join(ctx.stateDir, "tools", "environments", "skills", environmentId);
|
|
211
214
|
await mkdir(environmentDir, { recursive: true });
|
|
212
215
|
if ([
|
|
@@ -285,4 +288,4 @@ async function installSkill(ctx) {
|
|
|
285
288
|
});
|
|
286
289
|
}
|
|
287
290
|
//#endregion
|
|
288
|
-
export { findInstallSpec, hasBinary, installSkill, resolveBrewExecutable };
|
|
291
|
+
export { findInstallSpec, hasBinary, installSkill, resolveBrewExecutable, skillEnvironmentId };
|
|
@@ -44,6 +44,8 @@ export interface ToolFactoryDeps {
|
|
|
44
44
|
getPrimaryModel?: () => Model<Api>;
|
|
45
45
|
/** Memory orchestration (prefetch/sync + external tools). */
|
|
46
46
|
getMemoryManager?: () => MemoryManager;
|
|
47
|
+
/** Skill runtime for the current workspace/session. */
|
|
48
|
+
getSkillManager?: () => SkillManager;
|
|
47
49
|
/** Session store for `session_search`. */
|
|
48
50
|
getSessionStore?: () => SessionStore;
|
|
49
51
|
/** When set (gateway webchat), enables the `clarify` tool. */
|
|
@@ -9,6 +9,7 @@ import { wrapToolsWithProtection } from "./executor.js";
|
|
|
9
9
|
import { buildRuntimeEnvironment } from "../../runtime-tools/environment.js";
|
|
10
10
|
import { createDefaultExternalToolGatewayTools } from "../external-tools/index.js";
|
|
11
11
|
import { createReadFileTool } from "./read.js";
|
|
12
|
+
import { skillEnvironmentId } from "../skills/installer.js";
|
|
12
13
|
import { createWriteFileTool } from "./write.js";
|
|
13
14
|
import { createListDirTool } from "./list-dir.js";
|
|
14
15
|
import { createPublishArtifactsTool } from "./publish-artifacts.js";
|
|
@@ -81,10 +82,13 @@ var AgentToolsFactory = class {
|
|
|
81
82
|
prepareRuntimeEnv = async (baseEnv) => {
|
|
82
83
|
const config = this.deps.getConfig?.();
|
|
83
84
|
if (!config) return baseEnv;
|
|
85
|
+
const indexing = this.deps.getSkillIndexingContext?.();
|
|
86
|
+
const skillEnvironmentIds = this.deps.getSkillManager?.()?.getEnabledSkillsForAgentSession(indexing).flatMap((skill) => (skill.metadata.install ?? []).map((installSpec) => skillEnvironmentId(skill, installSpec)));
|
|
84
87
|
return (await buildRuntimeEnvironment({
|
|
85
88
|
stateDir: resolveStateDir(),
|
|
86
89
|
config: config.runtimeTools,
|
|
87
|
-
baseEnv
|
|
90
|
+
baseEnv,
|
|
91
|
+
skillEnvironmentIds
|
|
88
92
|
})).env;
|
|
89
93
|
};
|
|
90
94
|
browserReadinessKey() {
|
|
@@ -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>;
|