@recombine-ai/platform 0.8.0 → 0.9.0
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/build/agent/index.d.ts +2 -2
- package/build/agent/index.d.ts.map +1 -1
- package/build/agent/index.js +1 -1
- package/build/agent/voice-route.d.ts +18 -0
- package/build/agent/voice-route.d.ts.map +1 -0
- package/build/agent/voice-route.js +3 -0
- package/build/bosun/interfaces/agent.d.ts +0 -1
- package/build/bosun/interfaces/agent.d.ts.map +1 -1
- package/build/bosun/interfaces/project.d.ts +0 -5
- package/build/bosun/interfaces/project.d.ts.map +1 -1
- package/build/bosun/std-mocks/call-control.d.ts.map +1 -1
- package/build/bosun/std-mocks/call-control.js +3 -0
- package/build/bosun-app/backend/server.js +60 -252
- package/build/bosun-app/backend/server.js.map +2 -2
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{B1MxGo6p.js → BBk8_Xpk.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BBk8_Xpk.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BBk8_Xpk.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{D9YsE4-8.js → BEdAvgYp.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BEdAvgYp.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BEdAvgYp.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{O3fJLrRA.js → BbnpkYg9.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BbnpkYg9.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BbnpkYg9.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BhGaCDSN.js +3 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BhGaCDSN.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BhGaCDSN.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{CQvDMTjY.js → BzG6zrxM.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BzG6zrxM.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BzG6zrxM.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{CVZT6n14.js → C0rPkxmP.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/C0rPkxmP.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/C0rPkxmP.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{CuwQtXBl.js → C3cROXCy.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/C3cROXCy.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/C3cROXCy.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{AmpxVxY6.js → CR5IRTqC.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CR5IRTqC.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CR5IRTqC.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{dL_jwANm.js → DJnDF3d9.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DJnDF3d9.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DJnDF3d9.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{DK7_9Rr4.js → D_OSpxGM.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/D_OSpxGM.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/D_OSpxGM.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{B-5g3xS8.js → DjDpMqch.js} +20 -20
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DjDpMqch.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DjDpMqch.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{CWPN78Jk.js → b3NfDBVj.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/b3NfDBVj.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/b3NfDBVj.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{BqH4VDQz.js → joiJcRPz.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/joiJcRPz.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/joiJcRPz.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{CkstLsmI.js → ouMvMh56.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/ouMvMh56.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/ouMvMh56.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/{app.Bq7QRKSZ.js → app.DCvmoAje.js} +2 -2
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.DCvmoAje.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.DCvmoAje.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CfoUTQFa.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CfoUTQFa.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CfoUTQFa.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{0.CIBqOQKB.js → 0.J4Bzxkhp.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.J4Bzxkhp.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.J4Bzxkhp.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{1.Dv78wD0F.js → 1.UwitO70F.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.UwitO70F.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.UwitO70F.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.DmzuP5st.js +35 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.DmzuP5st.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.DmzuP5st.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{17.DmVfus5a.js → 17.CaGXYrxA.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.CaGXYrxA.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.CaGXYrxA.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.DEbOZr2f.js +11 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.DEbOZr2f.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.DEbOZr2f.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.DUSmCJUZ.js +35 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.DUSmCJUZ.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.DUSmCJUZ.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DfcyceoS.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DfcyceoS.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DfcyceoS.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{4.DKTRRObl.js → 4.CAmNzRCC.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.CAmNzRCC.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.CAmNzRCC.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{5.D9SClLPX.js → 5.DltknJpg.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.DltknJpg.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.DltknJpg.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{6.DdAs7BvU.js → 6.D-SspZqn.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.D-SspZqn.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.D-SspZqn.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{8.DNEyJy0a.js → 8.DuysCD9o.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.DuysCD9o.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.DuysCD9o.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DxKtZZ8S.js +2 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DxKtZZ8S.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DxKtZZ8S.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/version.json +1 -1
- package/build/bosun-app/frontend/client/_app/version.json.br +0 -0
- package/build/bosun-app/frontend/client/_app/version.json.gz +0 -0
- package/build/bosun-app/frontend/handler.js +4 -4
- package/build/bosun-app/frontend/index.js +4 -4
- package/build/bosun-app/frontend/server/chunks/chunks/{ChatStepTrace.js-BY0y3Vbb.js → ChatStepTrace.js-VTtwaKGp.js} +1 -3
- package/build/bosun-app/frontend/server/chunks/chunks/ChatStepTrace.js-VTtwaKGp.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/chunks/{internal.js-CTNBeiir.js → internal.js-4IhKdDhB.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/chunks/{internal.js-CTNBeiir.js.map → internal.js-4IhKdDhB.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/chunks/{source-selection.js-DFpObbhz.js → source-selection.js-D5B8gfq2.js} +1 -3
- package/build/bosun-app/frontend/server/chunks/chunks/source-selection.js-D5B8gfq2.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/{_layout.svelte.js-b9Q5TFEZ.js → _layout.svelte.js-B2wHKJV7.js} +24 -134
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/_layout.svelte.js-B2wHKJV7.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/{_page.svelte.js-Chv8ybaj.js → _page.svelte.js-DDcIjgZD.js} +4 -10
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/_page.svelte.js-DDcIjgZD.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/tests/{_page.svelte.js-Dkst1C_3.js → _page.svelte.js-UVUg89-t.js} +1 -3
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/tests/_page.svelte.js-UVUg89-t.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/traces/conversations/_conversationId_/latency/{_page.svelte.js-DFZznMhQ.js → _page.svelte.js-SjAtxtA0.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/entries/pages/traces/conversations/_conversationId_/latency/{_page.svelte.js-DFZznMhQ.js.map → _page.svelte.js-SjAtxtA0.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/traces/conversations/_conversationId_/traces/{_page.svelte.js-Bxdn8vG5.js → _page.svelte.js-DiZKDT2v.js} +3 -7
- package/build/bosun-app/frontend/server/chunks/entries/pages/traces/conversations/_conversationId_/traces/_page.svelte.js-DiZKDT2v.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/traces/conversations/{_layout.svelte.js-DhdYiNVL.js → _layout.svelte.js-CfkCQ2Th.js} +9 -61
- package/build/bosun-app/frontend/server/chunks/entries/pages/traces/conversations/_layout.svelte.js-CfkCQ2Th.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/{handler-kZm9DU-v.js → handler-vU_wg2RN.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/{handler-kZm9DU-v.js.map → handler-vU_wg2RN.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/{index.js-BYV_PeV-.js → index.js-D91naZf_.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/{index.js-BYV_PeV-.js.map → index.js-D91naZf_.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/{manifest.js-DknJwtFc.js → manifest.js-Dw16h2s5.js} +14 -14
- package/build/bosun-app/frontend/server/chunks/{manifest.js-DknJwtFc.js.map → manifest.js-Dw16h2s5.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{0.js-B947oA7Q.js → 0.js-D9NktewH.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{0.js-B947oA7Q.js.map → 0.js-D9NktewH.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{1.js-D-bO8SBw.js → 1.js-Dn35b_EZ.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{1.js-D-bO8SBw.js.map → 1.js-Dn35b_EZ.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{10.js-BPINRsAS.js → 10.js-Cr4o1Rxo.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{10.js-BPINRsAS.js.map → 10.js-Cr4o1Rxo.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{17.js-BvBqWcLx.js → 17.js-DL3CxSUd.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{17.js-BvBqWcLx.js.map → 17.js-DL3CxSUd.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{18.js-BEfVGplP.js → 18.js-BjTzy2DF.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{18.js-BEfVGplP.js.map → 18.js-BjTzy2DF.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{2.js-XaMsKwVG.js → 2.js-CdG6tTvY.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{2.js-XaMsKwVG.js.map → 2.js-CdG6tTvY.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{3.js-9Rmo9ovG.js → 3.js-BpPY5Gti.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{3.js-9Rmo9ovG.js.map → 3.js-BpPY5Gti.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{4.js-DHzNp2kw.js → 4.js-DaZDXx0f.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{4.js-DHzNp2kw.js.map → 4.js-DaZDXx0f.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{5.js-BtTetd8U.js → 5.js-53PYUp9D.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{5.js-BtTetd8U.js.map → 5.js-53PYUp9D.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{6.js-dyYItn4O.js → 6.js-DPd17ch2.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{6.js-dyYItn4O.js.map → 6.js-DPd17ch2.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{8.js-D5qfNA9r.js → 8.js-CW5dHpUd.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{8.js-D5qfNA9r.js.map → 8.js-CW5dHpUd.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{9.js-CxI4tPnx.js → 9.js-DcEXjOky.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{9.js-CxI4tPnx.js.map → 9.js-DcEXjOky.js.map} +1 -1
- package/build/call-control/call-control.d.ts +3 -1
- package/build/call-control/call-control.d.ts.map +1 -1
- package/build/call-control/call-control.js +8 -2
- package/build/call-control/index.d.ts +1 -1
- package/build/call-control/index.d.ts.map +1 -1
- package/build/call-control/port.d.ts +2 -1
- package/build/call-control/port.d.ts.map +1 -1
- package/build/call-control/sip.d.ts +1 -0
- package/build/call-control/sip.d.ts.map +1 -1
- package/build/call-control/sip.js +19 -18
- package/build/call-control/types.d.ts +8 -8
- package/build/call-control/types.d.ts.map +1 -1
- package/build/engine/interfaces/other.d.ts +1 -1
- package/build/engine/interfaces/other.d.ts.map +1 -1
- package/build/telescope/api.d.ts.map +1 -1
- package/build/telescope/api.js +1 -2
- package/build/telescope/interfaces/conversation.d.ts +0 -2
- package/build/telescope/interfaces/conversation.d.ts.map +1 -1
- package/build/telescope/interfaces/event-tracer.d.ts +0 -8
- package/build/telescope/interfaces/event-tracer.d.ts.map +1 -1
- package/build/telescope/interfaces/telescope.d.ts +0 -1
- package/build/telescope/interfaces/telescope.d.ts.map +1 -1
- package/build/telescope/tracers/event-tracer.d.ts.map +1 -1
- package/build/telescope/tracers/event-tracer.js +0 -5
- package/build/text-agent-handlers/incoming-message.js +1 -1
- package/build/text-agent-handlers/index.d.ts +0 -1
- package/build/text-agent-handlers/index.d.ts.map +1 -1
- package/build/text-agent-handlers/index.js +0 -1
- package/build/text-agent-handlers/instrument.d.ts +0 -1
- package/build/text-agent-handlers/instrument.d.ts.map +1 -1
- package/build/text-agent-handlers/instrument.js +2 -6
- package/build/text-agent-handlers/jobs-handler.js +1 -1
- package/build/text-agent-handlers/jobs.d.ts +0 -1
- package/build/text-agent-handlers/jobs.d.ts.map +1 -1
- package/build/text-agent-handlers/message-acceptor.d.ts +0 -4
- package/build/text-agent-handlers/message-acceptor.d.ts.map +1 -1
- package/build/text-agent-handlers/message-acceptor.js +2 -11
- package/build/text-agent-handlers/ports.d.ts +1 -2
- package/build/text-agent-handlers/ports.d.ts.map +1 -1
- package/build/text-agent-handlers/ports.js +5 -6
- package/build/voice-agent-api/index.d.ts +3 -3
- package/build/voice-agent-api/index.d.ts.map +1 -1
- package/build/voice-agent-api/index.js +1 -1
- package/build/voice-agent-api/voice-http.d.ts +11 -14
- package/build/voice-agent-api/voice-http.d.ts.map +1 -1
- package/build/voice-agent-api/voice-http.js +61 -39
- package/build/voice-agent-api/voice-router.d.ts +21 -0
- package/build/voice-agent-api/voice-router.d.ts.map +1 -0
- package/build/voice-agent-api/voice-router.js +100 -0
- package/package.json +1 -1
- package/build/agent/experiment.d.ts +0 -21
- package/build/agent/experiment.d.ts.map +0 -1
- package/build/agent/experiment.js +0 -29
- package/build/bosun-app/frontend/client/_app/immutable/chunks/AmpxVxY6.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/AmpxVxY6.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/B-5g3xS8.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/B-5g3xS8.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/B1MxGo6p.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/B1MxGo6p.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BqH4VDQz.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BqH4VDQz.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CQvDMTjY.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CQvDMTjY.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CVZT6n14.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CVZT6n14.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CWPN78Jk.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CWPN78Jk.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CkstLsmI.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CkstLsmI.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CuwQtXBl.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CuwQtXBl.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/D9YsE4-8.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/D9YsE4-8.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DK7_9Rr4.js.br +0 -3
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DK7_9Rr4.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/O3fJLrRA.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/O3fJLrRA.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/dL_jwANm.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/dL_jwANm.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/w7_NKWP1.js +0 -3
- package/build/bosun-app/frontend/client/_app/immutable/chunks/w7_NKWP1.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/w7_NKWP1.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.Bq7QRKSZ.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.Bq7QRKSZ.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.Ct26YHfm.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.Ct26YHfm.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.Ct26YHfm.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.CIBqOQKB.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.CIBqOQKB.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.Dv78wD0F.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.Dv78wD0F.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.Htrpia-u.js +0 -35
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.Htrpia-u.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.Htrpia-u.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.DmVfus5a.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.DmVfus5a.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.DvJVYeXp.js +0 -11
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.DvJVYeXp.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.DvJVYeXp.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.tyuQRxDb.js +0 -35
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.tyuQRxDb.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.tyuQRxDb.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.B0NtJamE.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.B0NtJamE.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.B0NtJamE.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.DKTRRObl.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.DKTRRObl.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.D9SClLPX.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.D9SClLPX.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.DdAs7BvU.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.DdAs7BvU.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.DNEyJy0a.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.DNEyJy0a.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DcyIUk-F.js +0 -2
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DcyIUk-F.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DcyIUk-F.js.gz +0 -0
- package/build/bosun-app/frontend/server/chunks/chunks/ChatStepTrace.js-BY0y3Vbb.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/chunks/source-selection.js-DFpObbhz.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/_layout.svelte.js-b9Q5TFEZ.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/_page.svelte.js-Chv8ybaj.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/tests/_page.svelte.js-Dkst1C_3.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/traces/conversations/_conversationId_/traces/_page.svelte.js-Bxdn8vG5.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/traces/conversations/_layout.svelte.js-DhdYiNVL.js.map +0 -1
- package/build/text-agent-handlers/variant-scheduler.d.ts +0 -3
- package/build/text-agent-handlers/variant-scheduler.d.ts.map +0 -1
- package/build/text-agent-handlers/variant-scheduler.js +0 -9
- package/build/voice-agent-api/route-resolver.d.ts +0 -19
- package/build/voice-agent-api/route-resolver.d.ts.map +0 -1
- package/build/voice-agent-api/route-resolver.js +0 -57
|
@@ -4,7 +4,6 @@ import type { JobInput } from './jobs.js';
|
|
|
4
4
|
export interface AgentRecord {
|
|
5
5
|
conversationId: string;
|
|
6
6
|
agentId: string;
|
|
7
|
-
variantId?: string;
|
|
8
7
|
}
|
|
9
8
|
export interface AgentRegistry {
|
|
10
9
|
getAgent(conversationId: string): Promise<AgentRecord | null>;
|
|
@@ -26,7 +25,7 @@ export interface ChatLockStore {
|
|
|
26
25
|
export interface JobRunner extends Scheduler {
|
|
27
26
|
runJob(input: JobInput): Promise<unknown>;
|
|
28
27
|
}
|
|
29
|
-
export type GetTextAgent<TMeta> = (agentId: string
|
|
28
|
+
export type GetTextAgent<TMeta> = (agentId: string) => Promise<TextAgent<TMeta>>;
|
|
30
29
|
export declare function cacheTextAgents<TMeta>(getTextAgent: GetTextAgent<TMeta>): GetTextAgent<TMeta>;
|
|
31
30
|
export type HandlerResponse = {
|
|
32
31
|
statusCode: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/text-agent-handlers/ports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGzC,MAAM,WAAW,WAAW;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/text-agent-handlers/ports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAGzC,MAAM,WAAW,WAAW;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAClB;AAGD,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC7D,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtE;AAGD,MAAM,WAAW,QAAQ;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;CAClB;AAED,MAAM,WAAW,aAAa;IAC1B,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IAE7D,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAE1C,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACjE,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/E,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACxD;AAGD,MAAM,WAAW,SAAU,SAAQ,SAAS;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC5C;AAGD,MAAM,MAAM,YAAY,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;AAGhF,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAW7F;AAGD,MAAM,MAAM,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAElE,wBAAgB,eAAe,CAC3B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,eAAe,CAEjB"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export function cacheTextAgents(getTextAgent) {
|
|
2
2
|
const agents = new Map();
|
|
3
|
-
return (agentId
|
|
4
|
-
|
|
5
|
-
let agent = agents.get(key);
|
|
3
|
+
return (agentId) => {
|
|
4
|
+
let agent = agents.get(agentId);
|
|
6
5
|
if (!agent) {
|
|
7
|
-
agent = getTextAgent(agentId
|
|
8
|
-
agents.set(
|
|
9
|
-
agent.catch(() => agents.delete(
|
|
6
|
+
agent = getTextAgent(agentId);
|
|
7
|
+
agents.set(agentId, agent);
|
|
8
|
+
agent.catch(() => agents.delete(agentId));
|
|
10
9
|
}
|
|
11
10
|
return agent;
|
|
12
11
|
};
|
|
@@ -2,7 +2,7 @@ export { extractMessageContent, fail, isRecoverableError, mapFromOpenAiMessages,
|
|
|
2
2
|
export type { ErrorCodes } from './http-helpers.js';
|
|
3
3
|
export { llmCompletionHandler } from './llm-completion-handler.js';
|
|
4
4
|
export { voiceHttpConnect } from './voice-http.js';
|
|
5
|
-
export type { VoiceHttpBindings } from './voice-http.js';
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
5
|
+
export type { ConversationMeta, VoiceHttpBindings } from './voice-http.js';
|
|
6
|
+
export { createVoiceRouter } from './voice-router.js';
|
|
7
|
+
export type { VoiceRouter, VoiceRouterOptions } from './voice-router.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/voice-agent-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,IAAI,EACJ,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,GACf,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/voice-agent-api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,IAAI,EACJ,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,GACf,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { extractMessageContent, fail, isRecoverableError, mapFromOpenAiMessages, roleToSender, } from './http-helpers.js';
|
|
2
2
|
export { llmCompletionHandler } from './llm-completion-handler.js';
|
|
3
3
|
export { voiceHttpConnect } from './voice-http.js';
|
|
4
|
-
export {
|
|
4
|
+
export { createVoiceRouter } from './voice-router.js';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FastifyRequest } from 'fastify';
|
|
2
|
-
import { VoiceRoute } from '../agent/index.js';
|
|
3
2
|
import type CallControl from '../call-control/index.js';
|
|
4
|
-
import type { ContextCache } from '../context-cache/index.js';
|
|
5
3
|
import type { NotificationRouter } from '../notifications/index.js';
|
|
6
4
|
import type { ITelescope } from '../telescope/index.js';
|
|
5
|
+
import { type VoiceRouter } from './voice-router.js';
|
|
7
6
|
declare module 'fastify' {
|
|
8
7
|
interface FastifyRequest {
|
|
9
8
|
callId: string;
|
|
@@ -13,25 +12,23 @@ declare module 'fastify' {
|
|
|
13
12
|
phoneNumber?: string;
|
|
14
13
|
}
|
|
15
14
|
}
|
|
15
|
+
export interface ConversationMeta<TMeta> {
|
|
16
|
+
meta: TMeta;
|
|
17
|
+
region?: string;
|
|
18
|
+
phoneNumber?: string;
|
|
19
|
+
externalConversationId?: string;
|
|
20
|
+
}
|
|
16
21
|
export interface VoiceHttpBindings<TMeta> {
|
|
17
|
-
|
|
18
|
-
allocations?: ContextCache<{
|
|
19
|
-
variantId: string | null;
|
|
20
|
-
}>;
|
|
22
|
+
router: VoiceRouter<TMeta>;
|
|
21
23
|
telescope: ITelescope;
|
|
24
|
+
callControl: CallControl;
|
|
22
25
|
onStart: () => Promise<void>;
|
|
23
26
|
hostsToPrewarm: string[];
|
|
24
|
-
|
|
25
|
-
getConversationMeta: (headers: FastifyRequest['headers']) => {
|
|
26
|
-
region?: string;
|
|
27
|
-
phoneNumber?: string;
|
|
28
|
-
};
|
|
29
|
-
callControl: CallControl;
|
|
27
|
+
getConversationMeta: (headers: FastifyRequest['headers']) => ConversationMeta<TMeta>;
|
|
30
28
|
notificationRouter?: NotificationRouter;
|
|
31
|
-
getExternalConversationId?: (headers: FastifyRequest['headers']) => string | undefined;
|
|
32
29
|
stickyCookieName?: string;
|
|
33
30
|
}
|
|
34
|
-
export declare function voiceHttpConnect<TMeta>({
|
|
31
|
+
export declare function voiceHttpConnect<TMeta>({ router, telescope, callControl, onStart, hostsToPrewarm, getConversationMeta, notificationRouter, stickyCookieName, }: VoiceHttpBindings<TMeta>): {
|
|
35
32
|
start: () => Promise<void>;
|
|
36
33
|
};
|
|
37
34
|
//# sourceMappingURL=voice-http.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-http.d.ts","sourceRoot":"","sources":["../../src/voice-agent-api/voice-http.ts"],"names":[],"mappings":"AAGA,OAAgB,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"voice-http.d.ts","sourceRoot":"","sources":["../../src/voice-agent-api/voice-http.ts"],"names":[],"mappings":"AAGA,OAAgB,EAAgB,cAAc,EAAE,MAAM,SAAS,CAAA;AAK/D,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAA;AAEvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,KAAK,EAAE,UAAU,EAAyB,MAAM,uBAAuB,CAAA;AAS9E,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG5E,OAAO,QAAQ,SAAS,CAAC;IACrB,UAAU,cAAc;QACpB,MAAM,EAAE,MAAM,CAAA;QACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC3B,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,MAAM,CAAA;QACjB,WAAW,CAAC,EAAE,MAAM,CAAA;KACvB;CACJ;AAED,MAAM,WAAW,gBAAgB,CAAC,KAAK;IAEnC,IAAI,EAAE,KAAK,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,MAAM,WAAW,iBAAiB,CAAC,KAAK;IAEpC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IAC1B,SAAS,EAAE,UAAU,CAAA;IAErB,WAAW,EAAE,WAAW,CAAA;IAExB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAA;IAExB,mBAAmB,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,KAAK,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACpF,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IAEvC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,EACpC,MAAM,EACN,SAAS,EACT,WAAW,EACX,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACnB,EAAE,iBAAiB,CAAC,KAAK,CAAC;;EAuc1B"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as dns from 'node:dns';
|
|
2
2
|
import { promisify } from 'node:util';
|
|
3
3
|
import Fastify from 'fastify';
|
|
4
|
+
import { isRandomizedVoiceRoute } from '../agent/index.js';
|
|
4
5
|
import { loggerContext } from '../dockyard/index.js';
|
|
5
6
|
import { LATENCY_EVENT_SCHEMA, LATENCY_EVENT_TYPES, } from '../telescope/index.js';
|
|
6
7
|
import { fail, isRecoverableError, mapFromOpenAiMessages } from './http-helpers.js';
|
|
7
8
|
import { llmCompletionHandler } from './llm-completion-handler.js';
|
|
8
9
|
import { logger } from './logger.js';
|
|
9
|
-
import {
|
|
10
|
-
export function voiceHttpConnect({
|
|
10
|
+
import { UnknownVoiceRouteError } from './voice-router.js';
|
|
11
|
+
export function voiceHttpConnect({ router, telescope, callControl, onStart, hostsToPrewarm, getConversationMeta, notificationRouter, stickyCookieName, }) {
|
|
11
12
|
const activeRequests = new Set();
|
|
12
13
|
let started = false;
|
|
13
14
|
const app = Fastify({
|
|
@@ -41,11 +42,11 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
41
42
|
if (!(error instanceof Error)) {
|
|
42
43
|
throw new Error(String(error));
|
|
43
44
|
}
|
|
44
|
-
const
|
|
45
|
+
const agent = await getAgent(request);
|
|
45
46
|
if (!isRecoverableError(error)) {
|
|
46
47
|
await agent.onFatalError(reqToCallInfo(request), error.message);
|
|
47
48
|
}
|
|
48
|
-
await createTelescopeConversation(request,
|
|
49
|
+
await createTelescopeConversation(request, agent.name);
|
|
49
50
|
fail(reply, 500, error.message, error);
|
|
50
51
|
});
|
|
51
52
|
app.addHook('onRequest', async (req, res) => {
|
|
@@ -86,19 +87,25 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
86
87
|
if (!req.agentName) {
|
|
87
88
|
return fail(res, 400, 'Cannot start call without agent name');
|
|
88
89
|
}
|
|
89
|
-
|
|
90
|
+
let agent;
|
|
91
|
+
try {
|
|
92
|
+
agent = await getAgent(req);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return failToResolve(res, err);
|
|
96
|
+
}
|
|
90
97
|
await telescope.runObservation(async () => {
|
|
91
98
|
const response = await agent.onCallStart(reqToCallInfo(req));
|
|
92
99
|
res.status(200);
|
|
93
100
|
res.send(response);
|
|
94
|
-
}, { conversationId: req.callId, agentId: agent.name
|
|
101
|
+
}, { conversationId: req.callId, agentId: agent.name });
|
|
95
102
|
});
|
|
96
103
|
app.all('/on-call-ready', async (req, res) => {
|
|
97
104
|
logger.setGlobalId(req.callId);
|
|
98
|
-
const
|
|
105
|
+
const agent = await getAgent(req);
|
|
99
106
|
notificationRouter?.register({
|
|
100
107
|
conversationId: req.callId,
|
|
101
|
-
externalConversationId:
|
|
108
|
+
externalConversationId: getConversationMeta(req.headers).externalConversationId,
|
|
102
109
|
}, agent);
|
|
103
110
|
const { region, phoneNumber } = getConversationMeta(req.headers);
|
|
104
111
|
telescope.getEventTracer().emit({
|
|
@@ -106,76 +113,70 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
106
113
|
attributes: {
|
|
107
114
|
callId: req.callId,
|
|
108
115
|
agentId: agent.name,
|
|
109
|
-
variantId,
|
|
110
116
|
phoneNumber: phoneNumber ?? req.phoneNumber,
|
|
111
117
|
region,
|
|
112
118
|
},
|
|
113
119
|
});
|
|
114
120
|
await telescope.runObservation(async () => {
|
|
115
121
|
await agent.onCallReady(reqToCallInfo(req));
|
|
116
|
-
}, { conversationId: req.callId, agentId: agent.name
|
|
122
|
+
}, { conversationId: req.callId, agentId: agent.name });
|
|
117
123
|
});
|
|
118
124
|
app.all('/on-call-end', async (req, res) => {
|
|
119
125
|
logger.setGlobalId(req.callId);
|
|
120
126
|
logger.debug('agent-service, on-call-end');
|
|
121
|
-
let
|
|
127
|
+
let agent;
|
|
122
128
|
try {
|
|
123
|
-
|
|
129
|
+
agent = await getAgent(req);
|
|
124
130
|
}
|
|
125
|
-
catch (
|
|
126
|
-
return
|
|
131
|
+
catch (err) {
|
|
132
|
+
return failToResolve(res, err);
|
|
127
133
|
}
|
|
128
|
-
const { agent, variantId } = resolved;
|
|
129
134
|
notificationRouter?.unregister(req.callId);
|
|
130
135
|
await telescope.runObservation(async () => {
|
|
131
136
|
await agent.onCallEnd(reqToCallInfo(req));
|
|
132
|
-
await createTelescopeConversation(req,
|
|
133
|
-
await
|
|
137
|
+
await createTelescopeConversation(req, agent.name);
|
|
138
|
+
await router.release(req.callId);
|
|
134
139
|
res.status(200);
|
|
135
|
-
}, { conversationId: req.callId, agentId: agent.name
|
|
140
|
+
}, { conversationId: req.callId, agentId: agent.name });
|
|
136
141
|
});
|
|
137
142
|
app.post('/on-fatal-error', async (req, res) => {
|
|
138
143
|
logger.setGlobalId(req.callId);
|
|
139
144
|
logger.debug('agent-service, on-fatal-error');
|
|
140
|
-
let
|
|
145
|
+
let agent;
|
|
141
146
|
try {
|
|
142
|
-
|
|
147
|
+
agent = await getAgent(req);
|
|
143
148
|
}
|
|
144
|
-
catch (
|
|
145
|
-
return
|
|
149
|
+
catch (err) {
|
|
150
|
+
return failToResolve(res, err);
|
|
146
151
|
}
|
|
147
|
-
const { agent, variantId } = resolved;
|
|
148
152
|
await telescope.runObservation(async () => {
|
|
149
153
|
await agent.onFatalError(reqToCallInfo(req), req.body?.error ?? 'Fatal error');
|
|
150
154
|
res.status(200);
|
|
151
|
-
}, { conversationId: req.callId, agentId: agent.name
|
|
155
|
+
}, { conversationId: req.callId, agentId: agent.name });
|
|
152
156
|
});
|
|
153
157
|
app.all('/chat/completions', async (req, res) => {
|
|
154
158
|
logger.setGlobalId(req.callId);
|
|
155
159
|
logger.debug('agent-service, /chat/completions');
|
|
156
|
-
let
|
|
160
|
+
let agent;
|
|
157
161
|
try {
|
|
158
|
-
|
|
162
|
+
agent = await getAgent(req);
|
|
159
163
|
}
|
|
160
164
|
catch (err) {
|
|
161
|
-
return
|
|
165
|
+
return failToResolve(res, err);
|
|
162
166
|
}
|
|
163
|
-
|
|
164
|
-
return telescope.runObservation(async () => llmCompletionHandler(agent, telescope.getConversationalTracer(), headersToMeta, req, res), {
|
|
167
|
+
return telescope.runObservation(async () => llmCompletionHandler(agent, telescope.getConversationalTracer(), (headers) => getConversationMeta(headers).meta, req, res), {
|
|
165
168
|
conversationId: req.callId,
|
|
166
169
|
agentId: agent.name,
|
|
167
|
-
variantId,
|
|
168
170
|
});
|
|
169
171
|
});
|
|
170
172
|
app.post('/on-agent-speech-done', async (req, res) => {
|
|
171
173
|
logger.setGlobalId(req.callId);
|
|
172
|
-
const
|
|
174
|
+
const agent = await getAgent(req);
|
|
173
175
|
return telescope.runObservation(async () => {
|
|
174
176
|
await agent.onAgentSpeechDone(mapFromOpenAiMessages(req.body.messages), reqToCallInfo(req));
|
|
175
177
|
}, {
|
|
176
178
|
conversationId: req.callId,
|
|
177
179
|
agentId: agent.name,
|
|
178
|
-
variantId,
|
|
179
180
|
});
|
|
180
181
|
});
|
|
181
182
|
app.post('/latency-event', async (req, res) => {
|
|
@@ -250,7 +251,7 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
250
251
|
const requests = [...activeRequests];
|
|
251
252
|
activeRequests.clear();
|
|
252
253
|
const notify = Promise.allSettled(requests.map(async (res) => {
|
|
253
|
-
const
|
|
254
|
+
const agent = await getAgent(res.request);
|
|
254
255
|
await agent.onFatalError(reqToCallInfo(res.request), message);
|
|
255
256
|
fail(res, 500, `${label}: ${message}`);
|
|
256
257
|
}));
|
|
@@ -286,12 +287,22 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
289
|
await onStart();
|
|
290
|
+
const routes = await router.start();
|
|
291
|
+
for (const route of routes) {
|
|
292
|
+
await callControl.setUpInboundSip(route.name, route.inbound);
|
|
293
|
+
}
|
|
294
|
+
for (const agent of agentsOf(routes)) {
|
|
295
|
+
await agent.onServiceStartup();
|
|
296
|
+
}
|
|
289
297
|
started = true;
|
|
290
298
|
await prewarmDNS();
|
|
291
299
|
}
|
|
292
|
-
const resolver = createVoiceRouteResolver({ getVoiceAgent, allocations, logger });
|
|
293
300
|
function getAgent(req) {
|
|
294
|
-
return
|
|
301
|
+
return router.resolve(req.agentName, req.callId);
|
|
302
|
+
}
|
|
303
|
+
function failToResolve(res, err) {
|
|
304
|
+
const status = err instanceof UnknownVoiceRouteError ? 404 : 400;
|
|
305
|
+
return fail(res, status, String(err), err);
|
|
295
306
|
}
|
|
296
307
|
async function prewarmDNS() {
|
|
297
308
|
const dnsLookup = promisify(dns.lookup);
|
|
@@ -305,7 +316,7 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
305
316
|
}
|
|
306
317
|
}
|
|
307
318
|
}
|
|
308
|
-
async function createTelescopeConversation(req,
|
|
319
|
+
async function createTelescopeConversation(req, agentId) {
|
|
309
320
|
const conversationId = req.callId;
|
|
310
321
|
if (!conversationId) {
|
|
311
322
|
logger.error('No call ID provided, cannot create Telescope conversation');
|
|
@@ -316,8 +327,7 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
316
327
|
const conversation = {
|
|
317
328
|
conversationId,
|
|
318
329
|
medium: 'phone',
|
|
319
|
-
agentId
|
|
320
|
-
variantId,
|
|
330
|
+
agentId,
|
|
321
331
|
region,
|
|
322
332
|
phoneNumber: phoneNumber ?? req.phoneNumber,
|
|
323
333
|
createdAt: Date.now(),
|
|
@@ -337,7 +347,7 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
337
347
|
return {
|
|
338
348
|
callId: req.callId,
|
|
339
349
|
phoneNumber: req.phoneNumber,
|
|
340
|
-
meta:
|
|
350
|
+
meta: getConversationMeta(req.headers).meta,
|
|
341
351
|
};
|
|
342
352
|
}
|
|
343
353
|
return {
|
|
@@ -345,6 +355,18 @@ export function voiceHttpConnect({ getVoiceAgent, allocations, telescope, onStar
|
|
|
345
355
|
};
|
|
346
356
|
}
|
|
347
357
|
const LATENCY_EVENT_TYPES_SET = new Set(LATENCY_EVENT_TYPES);
|
|
358
|
+
function agentsOf(routes) {
|
|
359
|
+
const agents = new Set();
|
|
360
|
+
for (const route of routes) {
|
|
361
|
+
if (isRandomizedVoiceRoute(route)) {
|
|
362
|
+
route.agents.forEach(({ agent }) => agents.add(agent));
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
agents.add(route.agent);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return [...agents];
|
|
369
|
+
}
|
|
348
370
|
function isObject(value) {
|
|
349
371
|
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
350
372
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { VoiceAgent, VoiceRoute } from '../agent/index.js';
|
|
2
|
+
import type { ContextCache } from '../context-cache/index.js';
|
|
3
|
+
import type { Logger } from '../dockyard/index.js';
|
|
4
|
+
export interface VoiceRouterOptions<TMeta> {
|
|
5
|
+
getRoutes: () => Promise<readonly VoiceRoute<TMeta>[]>;
|
|
6
|
+
calls?: ContextCache<{
|
|
7
|
+
agentName: string;
|
|
8
|
+
}>;
|
|
9
|
+
logger: Logger;
|
|
10
|
+
random?: () => number;
|
|
11
|
+
}
|
|
12
|
+
export interface VoiceRouter<TMeta> {
|
|
13
|
+
start(): Promise<readonly VoiceRoute<TMeta>[]>;
|
|
14
|
+
resolve(routeName: string, callId: string): Promise<VoiceAgent<TMeta>>;
|
|
15
|
+
release(callId: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare class UnknownVoiceRouteError extends Error {
|
|
18
|
+
constructor(routeName: string);
|
|
19
|
+
}
|
|
20
|
+
export declare function createVoiceRouter<TMeta>({ getRoutes, calls, logger, random, }: VoiceRouterOptions<TMeta>): VoiceRouter<TMeta>;
|
|
21
|
+
//# sourceMappingURL=voice-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-router.d.ts","sourceRoot":"","sources":["../../src/voice-agent-api/voice-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,MAAM,WAAW,kBAAkB,CAAC,KAAK;IAErC,SAAS,EAAE,MAAM,OAAO,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAKtD,KAAK,CAAC,EAAE,YAAY,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC3C,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,WAAW,CAAC,KAAK;IAE9B,KAAK,IAAI,OAAO,CAAC,SAAS,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAE9C,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IAEtE,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACzC;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACjC,SAAS,EAAE,MAAM;CAIhC;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,EACrC,SAAS,EACT,KAA6B,EAC7B,MAAM,EACN,MAAoB,GACvB,EAAE,kBAAkB,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAwFhD"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { isRandomizedVoiceRoute } from '../agent/index.js';
|
|
2
|
+
import { createInMemoryCache } from '../context-cache/index.js';
|
|
3
|
+
export class UnknownVoiceRouteError extends Error {
|
|
4
|
+
constructor(routeName) {
|
|
5
|
+
super(`Unknown voice route: ${routeName}`);
|
|
6
|
+
this.name = 'UnknownVoiceRouteError';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function createVoiceRouter({ getRoutes, calls = createInMemoryCache(), logger, random = Math.random, }) {
|
|
10
|
+
let byName;
|
|
11
|
+
let starting;
|
|
12
|
+
const picking = new Map();
|
|
13
|
+
function start() {
|
|
14
|
+
if (!starting) {
|
|
15
|
+
starting = build();
|
|
16
|
+
starting.catch(() => (starting = undefined));
|
|
17
|
+
}
|
|
18
|
+
return starting;
|
|
19
|
+
}
|
|
20
|
+
async function build() {
|
|
21
|
+
const routes = await getRoutes();
|
|
22
|
+
const index = new Map();
|
|
23
|
+
for (const route of routes) {
|
|
24
|
+
if (index.has(route.name)) {
|
|
25
|
+
throw new Error(`Duplicate voice route: ${route.name}`);
|
|
26
|
+
}
|
|
27
|
+
if (isRandomizedVoiceRoute(route)) {
|
|
28
|
+
validateRandomizedRoute(route);
|
|
29
|
+
}
|
|
30
|
+
index.set(route.name, route);
|
|
31
|
+
}
|
|
32
|
+
byName = index;
|
|
33
|
+
return routes;
|
|
34
|
+
}
|
|
35
|
+
async function resolve(routeName, callId) {
|
|
36
|
+
if (!byName) {
|
|
37
|
+
throw new Error('The voice router is not started');
|
|
38
|
+
}
|
|
39
|
+
const route = byName.get(routeName);
|
|
40
|
+
if (!route) {
|
|
41
|
+
throw new UnknownVoiceRouteError(routeName);
|
|
42
|
+
}
|
|
43
|
+
if (!isRandomizedVoiceRoute(route)) {
|
|
44
|
+
return route.agent;
|
|
45
|
+
}
|
|
46
|
+
let pending = picking.get(callId);
|
|
47
|
+
if (!pending) {
|
|
48
|
+
pending = keepOrPick(route, callId);
|
|
49
|
+
picking.set(callId, pending);
|
|
50
|
+
const done = () => picking.delete(callId);
|
|
51
|
+
pending.then(done, done);
|
|
52
|
+
}
|
|
53
|
+
return pending;
|
|
54
|
+
}
|
|
55
|
+
async function keepOrPick(route, callId) {
|
|
56
|
+
const kept = await calls.getContext(callId);
|
|
57
|
+
const keptAgent = kept && route.agents.find(({ agent }) => agent.name === kept.agentName);
|
|
58
|
+
if (keptAgent) {
|
|
59
|
+
return keptAgent.agent;
|
|
60
|
+
}
|
|
61
|
+
const agent = pick(route);
|
|
62
|
+
await calls.setContext(callId, { agentName: agent.name });
|
|
63
|
+
logger.log('Picked the agent of the call', {
|
|
64
|
+
routeName: route.name,
|
|
65
|
+
callId,
|
|
66
|
+
agentName: agent.name,
|
|
67
|
+
});
|
|
68
|
+
return agent;
|
|
69
|
+
}
|
|
70
|
+
function pick(route) {
|
|
71
|
+
const total = route.agents.reduce((sum, { weight }) => sum + weight, 0);
|
|
72
|
+
let selected = random() * total;
|
|
73
|
+
for (const { agent, weight } of route.agents) {
|
|
74
|
+
if (weight > 0 && selected < weight) {
|
|
75
|
+
return agent;
|
|
76
|
+
}
|
|
77
|
+
selected -= weight;
|
|
78
|
+
}
|
|
79
|
+
return route.agents.filter(({ weight }) => weight > 0).at(-1).agent;
|
|
80
|
+
}
|
|
81
|
+
function release(callId) {
|
|
82
|
+
return calls.clearContext(callId);
|
|
83
|
+
}
|
|
84
|
+
return { start, resolve, release };
|
|
85
|
+
}
|
|
86
|
+
function validateRandomizedRoute(route) {
|
|
87
|
+
const names = new Set();
|
|
88
|
+
for (const { agent, weight } of route.agents) {
|
|
89
|
+
if (!(weight >= 0)) {
|
|
90
|
+
throw new Error(`Route ${route.name}: the weight of ${agent.name} must be 0 or more`);
|
|
91
|
+
}
|
|
92
|
+
if (names.has(agent.name)) {
|
|
93
|
+
throw new Error(`Route ${route.name}: two agents are named ${agent.name}`);
|
|
94
|
+
}
|
|
95
|
+
names.add(agent.name);
|
|
96
|
+
}
|
|
97
|
+
if (!route.agents.some(({ weight }) => weight > 0)) {
|
|
98
|
+
throw new Error(`Route ${route.name}: no agent has a weight above 0`);
|
|
99
|
+
}
|
|
100
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recombine-ai/platform",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"description": "The Recombine platform: engine, telescope, dockyard, call control, the voice agent API, and the Bosun bindings in one package",
|
|
6
6
|
"license": "EULA",
|
|
7
7
|
"author": "recombine.ai",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { VoiceAgent } from './voice-agent.js';
|
|
2
|
-
export interface Experiment<TArm extends {
|
|
3
|
-
weight: number;
|
|
4
|
-
}> {
|
|
5
|
-
default?: TArm;
|
|
6
|
-
variants: Readonly<Record<string, TArm>>;
|
|
7
|
-
}
|
|
8
|
-
export declare function allocateVariant<TArm extends {
|
|
9
|
-
weight: number;
|
|
10
|
-
}>(experiment: Experiment<TArm>, random?: () => number): string | null;
|
|
11
|
-
export interface VoiceAgentArm<TMeta> {
|
|
12
|
-
agent: VoiceAgent<TMeta>;
|
|
13
|
-
weight: number;
|
|
14
|
-
}
|
|
15
|
-
export interface VoiceAgentExperiment<TMeta> extends Experiment<VoiceAgentArm<TMeta>> {
|
|
16
|
-
name: string;
|
|
17
|
-
onServiceStartup: () => Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
export type VoiceRoute<TMeta> = VoiceAgent<TMeta> | VoiceAgentExperiment<TMeta>;
|
|
20
|
-
export declare function isVoiceAgentExperiment<TMeta>(route: VoiceRoute<TMeta>): route is VoiceAgentExperiment<TMeta>;
|
|
21
|
-
//# sourceMappingURL=experiment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"experiment.d.ts","sourceRoot":"","sources":["../../src/agent/experiment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,WAAW,UAAU,CAAC,IAAI,SAAS;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;IAEvD,OAAO,CAAC,EAAE,IAAI,CAAA;IAEd,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;CAC3C;AAMD,wBAAgB,eAAe,CAAC,IAAI,SAAS;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAC3D,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,EAC5B,MAAM,GAAE,MAAM,MAAoB,GACnC,MAAM,GAAG,IAAI,CA0Bf;AAED,MAAM,WAAW,aAAa,CAAC,KAAK;IAChC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;CACjB;AAGD,MAAM,WAAW,oBAAoB,CAAC,KAAK,CAAE,SAAQ,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjF,IAAI,EAAE,MAAM,CAAA;IAEZ,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACxC;AAED,MAAM,MAAM,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAA;AAE/E,wBAAgB,sBAAsB,CAAC,KAAK,EACxC,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,GACzB,KAAK,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAEtC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export function allocateVariant(experiment, random = Math.random) {
|
|
2
|
-
const arms = Object.entries(experiment.variants).map(([id, arm]) => [
|
|
3
|
-
id,
|
|
4
|
-
arm.weight,
|
|
5
|
-
]);
|
|
6
|
-
if (experiment.default) {
|
|
7
|
-
arms.unshift([null, experiment.default.weight]);
|
|
8
|
-
}
|
|
9
|
-
for (const [id, weight] of arms) {
|
|
10
|
-
if (!(weight >= 0)) {
|
|
11
|
-
throw new Error(`The weight of the arm ${id ?? 'default'} must be 0 or more`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const total = arms.reduce((sum, [, weight]) => sum + weight, 0);
|
|
15
|
-
if (total <= 0) {
|
|
16
|
-
throw new Error('No experiment arm can win: the weights add up to 0');
|
|
17
|
-
}
|
|
18
|
-
let selected = random() * total;
|
|
19
|
-
for (const [id, weight] of arms) {
|
|
20
|
-
if (weight > 0 && selected < weight) {
|
|
21
|
-
return id;
|
|
22
|
-
}
|
|
23
|
-
selected -= weight;
|
|
24
|
-
}
|
|
25
|
-
throw new Error('No experiment arm can win');
|
|
26
|
-
}
|
|
27
|
-
export function isVoiceAgentExperiment(route) {
|
|
28
|
-
return 'variants' in route;
|
|
29
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|