@recombine-ai/platform 0.9.1-test.1 → 0.9.1-test.2

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.
Files changed (150) hide show
  1. package/build/bosun-app/frontend/client/_app/immutable/chunks/{BP8LHuYi.js → B3sRmUmR.js} +1 -1
  2. package/build/bosun-app/frontend/client/_app/immutable/chunks/B3sRmUmR.js.br +0 -0
  3. package/build/bosun-app/frontend/client/_app/immutable/chunks/B3sRmUmR.js.gz +0 -0
  4. package/build/bosun-app/frontend/client/_app/immutable/chunks/{CeiDiTKi.js → BIYJrTTr.js} +1 -1
  5. package/build/bosun-app/frontend/client/_app/immutable/chunks/BIYJrTTr.js.br +0 -0
  6. package/build/bosun-app/frontend/client/_app/immutable/chunks/BIYJrTTr.js.gz +0 -0
  7. package/build/bosun-app/frontend/client/_app/immutable/chunks/{DdbOX2wg.js → COI2cH3y.js} +1 -1
  8. package/build/bosun-app/frontend/client/_app/immutable/chunks/COI2cH3y.js.br +3 -0
  9. package/build/bosun-app/frontend/client/_app/immutable/chunks/COI2cH3y.js.gz +0 -0
  10. package/build/bosun-app/frontend/client/_app/immutable/chunks/{Bgf7U1Tc.js → CdiiHmb_.js} +1 -1
  11. package/build/bosun-app/frontend/client/_app/immutable/chunks/CdiiHmb_.js.br +0 -0
  12. package/build/bosun-app/frontend/client/_app/immutable/chunks/CdiiHmb_.js.gz +0 -0
  13. package/build/bosun-app/frontend/client/_app/immutable/chunks/{D7a3sSg2.js → YRWW-SW8.js} +1 -1
  14. package/build/bosun-app/frontend/client/_app/immutable/chunks/YRWW-SW8.js.br +0 -0
  15. package/build/bosun-app/frontend/client/_app/immutable/chunks/YRWW-SW8.js.gz +0 -0
  16. package/build/bosun-app/frontend/client/_app/immutable/entry/{app.D20SOteC.js → app.0r1adPhk.js} +2 -2
  17. package/build/bosun-app/frontend/client/_app/immutable/entry/app.0r1adPhk.js.br +0 -0
  18. package/build/bosun-app/frontend/client/_app/immutable/entry/app.0r1adPhk.js.gz +0 -0
  19. package/build/bosun-app/frontend/client/_app/immutable/entry/start.BNSaABB8.js +1 -0
  20. package/build/bosun-app/frontend/client/_app/immutable/entry/start.BNSaABB8.js.br +0 -0
  21. package/build/bosun-app/frontend/client/_app/immutable/entry/start.BNSaABB8.js.gz +0 -0
  22. package/build/bosun-app/frontend/client/_app/immutable/nodes/{0.T9WgLrTj.js → 0.BCslgDHp.js} +1 -1
  23. package/build/bosun-app/frontend/client/_app/immutable/nodes/0.BCslgDHp.js.br +0 -0
  24. package/build/bosun-app/frontend/client/_app/immutable/nodes/0.BCslgDHp.js.gz +0 -0
  25. package/build/bosun-app/frontend/client/_app/immutable/nodes/{1.3cRzg0A0.js → 1.DfDHVqM0.js} +1 -1
  26. package/build/bosun-app/frontend/client/_app/immutable/nodes/1.DfDHVqM0.js.br +0 -0
  27. package/build/bosun-app/frontend/client/_app/immutable/nodes/1.DfDHVqM0.js.gz +0 -0
  28. package/build/bosun-app/frontend/client/_app/immutable/nodes/{10.28fogxMw.js → 10.BXbQQ1q5.js} +1 -1
  29. package/build/bosun-app/frontend/client/_app/immutable/nodes/10.BXbQQ1q5.js.br +0 -0
  30. package/build/bosun-app/frontend/client/_app/immutable/nodes/10.BXbQQ1q5.js.gz +0 -0
  31. package/build/bosun-app/frontend/client/_app/immutable/nodes/{17.CZ8fUbCu.js → 17.DSps31HJ.js} +1 -1
  32. package/build/bosun-app/frontend/client/_app/immutable/nodes/17.DSps31HJ.js.br +0 -0
  33. package/build/bosun-app/frontend/client/_app/immutable/nodes/17.DSps31HJ.js.gz +0 -0
  34. package/build/bosun-app/frontend/client/_app/immutable/nodes/{18.CLTXnmXM.js → 18.8hAfbPPt.js} +1 -1
  35. package/build/bosun-app/frontend/client/_app/immutable/nodes/18.8hAfbPPt.js.br +0 -0
  36. package/build/bosun-app/frontend/client/_app/immutable/nodes/18.8hAfbPPt.js.gz +0 -0
  37. package/build/bosun-app/frontend/client/_app/immutable/nodes/{2.BVj8fduB.js → 2.DLZcnXo3.js} +1 -1
  38. package/build/bosun-app/frontend/client/_app/immutable/nodes/2.DLZcnXo3.js.br +0 -0
  39. package/build/bosun-app/frontend/client/_app/immutable/nodes/2.DLZcnXo3.js.gz +0 -0
  40. package/build/bosun-app/frontend/client/_app/immutable/nodes/{3.D1hXqvoR.js → 3.Dzl7FcjU.js} +1 -1
  41. package/build/bosun-app/frontend/client/_app/immutable/nodes/3.Dzl7FcjU.js.br +0 -0
  42. package/build/bosun-app/frontend/client/_app/immutable/nodes/3.Dzl7FcjU.js.gz +0 -0
  43. package/build/bosun-app/frontend/client/_app/immutable/nodes/{4.Q-efp8BE.js → 4.BlHeYRVW.js} +1 -1
  44. package/build/bosun-app/frontend/client/_app/immutable/nodes/4.BlHeYRVW.js.br +0 -0
  45. package/build/bosun-app/frontend/client/_app/immutable/nodes/4.BlHeYRVW.js.gz +0 -0
  46. package/build/bosun-app/frontend/client/_app/immutable/nodes/{5.BlBkWeY0.js → 5.DE3muGEs.js} +1 -1
  47. package/build/bosun-app/frontend/client/_app/immutable/nodes/5.DE3muGEs.js.br +0 -0
  48. package/build/bosun-app/frontend/client/_app/immutable/nodes/5.DE3muGEs.js.gz +0 -0
  49. package/build/bosun-app/frontend/client/_app/immutable/nodes/{6.CQPXvkij.js → 6.DauPUI6w.js} +1 -1
  50. package/build/bosun-app/frontend/client/_app/immutable/nodes/6.DauPUI6w.js.br +0 -0
  51. package/build/bosun-app/frontend/client/_app/immutable/nodes/6.DauPUI6w.js.gz +0 -0
  52. package/build/bosun-app/frontend/client/_app/immutable/nodes/{8.Bcw_NHql.js → 8.DIwMEVk7.js} +1 -1
  53. package/build/bosun-app/frontend/client/_app/immutable/nodes/8.DIwMEVk7.js.br +0 -0
  54. package/build/bosun-app/frontend/client/_app/immutable/nodes/8.DIwMEVk7.js.gz +0 -0
  55. package/build/bosun-app/frontend/client/_app/immutable/nodes/{9.iQdTFqAn.js → 9.BoyHpLCi.js} +1 -1
  56. package/build/bosun-app/frontend/client/_app/immutable/nodes/9.BoyHpLCi.js.br +0 -0
  57. package/build/bosun-app/frontend/client/_app/immutable/nodes/9.BoyHpLCi.js.gz +0 -0
  58. package/build/bosun-app/frontend/client/_app/version.json +1 -1
  59. package/build/bosun-app/frontend/client/_app/version.json.br +0 -0
  60. package/build/bosun-app/frontend/client/_app/version.json.gz +0 -0
  61. package/build/bosun-app/frontend/handler.js +4 -4
  62. package/build/bosun-app/frontend/index.js +4 -4
  63. package/build/bosun-app/frontend/server/chunks/chunks/{internal.js-BzxoI2ap.js → internal.js-Cr3b1H4k.js} +2 -2
  64. package/build/bosun-app/frontend/server/chunks/chunks/{internal.js-BzxoI2ap.js.map → internal.js-Cr3b1H4k.js.map} +1 -1
  65. package/build/bosun-app/frontend/server/chunks/{handler-DxgO6iGt.js → handler-DqsNau3u.js} +3 -3
  66. package/build/bosun-app/frontend/server/chunks/{handler-DxgO6iGt.js.map → handler-DqsNau3u.js.map} +1 -1
  67. package/build/bosun-app/frontend/server/chunks/{index.js-DBoPzuHL.js → index.js-DZUC5rml.js} +2 -2
  68. package/build/bosun-app/frontend/server/chunks/{index.js-DBoPzuHL.js.map → index.js-DZUC5rml.js.map} +1 -1
  69. package/build/bosun-app/frontend/server/chunks/{manifest.js-BZqGcn9f.js → manifest.js-Ba8Iww95.js} +14 -14
  70. package/build/bosun-app/frontend/server/chunks/{manifest.js-BZqGcn9f.js.map → manifest.js-Ba8Iww95.js.map} +1 -1
  71. package/build/bosun-app/frontend/server/chunks/nodes/{0.js-CPauJheb.js → 0.js-ErWLOg9o.js} +2 -2
  72. package/build/bosun-app/frontend/server/chunks/nodes/{0.js-CPauJheb.js.map → 0.js-ErWLOg9o.js.map} +1 -1
  73. package/build/bosun-app/frontend/server/chunks/nodes/{1.js-BdQRe_JA.js → 1.js-BucIct8J.js} +2 -2
  74. package/build/bosun-app/frontend/server/chunks/nodes/{1.js-BdQRe_JA.js.map → 1.js-BucIct8J.js.map} +1 -1
  75. package/build/bosun-app/frontend/server/chunks/nodes/{10.js-BQ80fBM8.js → 10.js-CmuGuxqs.js} +2 -2
  76. package/build/bosun-app/frontend/server/chunks/nodes/{10.js-BQ80fBM8.js.map → 10.js-CmuGuxqs.js.map} +1 -1
  77. package/build/bosun-app/frontend/server/chunks/nodes/{17.js-C1ScVFoO.js → 17.js-R-YLRxxY.js} +2 -2
  78. package/build/bosun-app/frontend/server/chunks/nodes/{17.js-C1ScVFoO.js.map → 17.js-R-YLRxxY.js.map} +1 -1
  79. package/build/bosun-app/frontend/server/chunks/nodes/{18.js-BErYMv7b.js → 18.js-Bwqlseie.js} +2 -2
  80. package/build/bosun-app/frontend/server/chunks/nodes/{18.js-BErYMv7b.js.map → 18.js-Bwqlseie.js.map} +1 -1
  81. package/build/bosun-app/frontend/server/chunks/nodes/{2.js-yX-cUBDA.js → 2.js-DWsjBpYQ.js} +2 -2
  82. package/build/bosun-app/frontend/server/chunks/nodes/{2.js-yX-cUBDA.js.map → 2.js-DWsjBpYQ.js.map} +1 -1
  83. package/build/bosun-app/frontend/server/chunks/nodes/{3.js-2Vh4A63Y.js → 3.js-Bw_XtVfk.js} +2 -2
  84. package/build/bosun-app/frontend/server/chunks/nodes/{3.js-2Vh4A63Y.js.map → 3.js-Bw_XtVfk.js.map} +1 -1
  85. package/build/bosun-app/frontend/server/chunks/nodes/{4.js-D_hzQEmf.js → 4.js-ZjhIMlzQ.js} +2 -2
  86. package/build/bosun-app/frontend/server/chunks/nodes/{4.js-D_hzQEmf.js.map → 4.js-ZjhIMlzQ.js.map} +1 -1
  87. package/build/bosun-app/frontend/server/chunks/nodes/{5.js-Bksbf9B2.js → 5.js-1hrIQeCi.js} +2 -2
  88. package/build/bosun-app/frontend/server/chunks/nodes/{5.js-Bksbf9B2.js.map → 5.js-1hrIQeCi.js.map} +1 -1
  89. package/build/bosun-app/frontend/server/chunks/nodes/{6.js-CBJdIQil.js → 6.js-DqwEZ7GV.js} +2 -2
  90. package/build/bosun-app/frontend/server/chunks/nodes/{6.js-CBJdIQil.js.map → 6.js-DqwEZ7GV.js.map} +1 -1
  91. package/build/bosun-app/frontend/server/chunks/nodes/{8.js-BESSf_tJ.js → 8.js-DN3WDIfO.js} +2 -2
  92. package/build/bosun-app/frontend/server/chunks/nodes/{8.js-BESSf_tJ.js.map → 8.js-DN3WDIfO.js.map} +1 -1
  93. package/build/bosun-app/frontend/server/chunks/nodes/{9.js-CAwt5c8Z.js → 9.js-C_SjLW8b.js} +2 -2
  94. package/build/bosun-app/frontend/server/chunks/nodes/{9.js-CAwt5c8Z.js.map → 9.js-C_SjLW8b.js.map} +1 -1
  95. package/build/engine/index.d.ts +3 -2
  96. package/build/engine/index.d.ts.map +1 -1
  97. package/build/engine/index.js +1 -1
  98. package/build/engine/interfaces/stream.d.ts +24 -1
  99. package/build/engine/interfaces/stream.d.ts.map +1 -1
  100. package/build/engine/stream/index.d.ts +3 -1
  101. package/build/engine/stream/index.d.ts.map +1 -1
  102. package/build/engine/stream/index.js +1 -0
  103. package/build/engine/stream/jev-prediction-chooser.d.ts +11 -0
  104. package/build/engine/stream/jev-prediction-chooser.d.ts.map +1 -0
  105. package/build/engine/stream/jev-prediction-chooser.js +101 -0
  106. package/build/engine/stream/predictive-prompts.d.ts +1 -1
  107. package/build/engine/stream/predictive-prompts.d.ts.map +1 -1
  108. package/build/engine/stream/predictive-prompts.js +7 -28
  109. package/build/engine/stream/predictive-workflow.d.ts.map +1 -1
  110. package/build/engine/stream/predictive-workflow.js +28 -25
  111. package/package.json +2 -1
  112. package/build/bosun-app/frontend/client/_app/immutable/chunks/BP8LHuYi.js.br +0 -0
  113. package/build/bosun-app/frontend/client/_app/immutable/chunks/BP8LHuYi.js.gz +0 -0
  114. package/build/bosun-app/frontend/client/_app/immutable/chunks/Bgf7U1Tc.js.br +0 -0
  115. package/build/bosun-app/frontend/client/_app/immutable/chunks/Bgf7U1Tc.js.gz +0 -0
  116. package/build/bosun-app/frontend/client/_app/immutable/chunks/CeiDiTKi.js.br +0 -0
  117. package/build/bosun-app/frontend/client/_app/immutable/chunks/CeiDiTKi.js.gz +0 -0
  118. package/build/bosun-app/frontend/client/_app/immutable/chunks/D7a3sSg2.js.br +0 -0
  119. package/build/bosun-app/frontend/client/_app/immutable/chunks/D7a3sSg2.js.gz +0 -0
  120. package/build/bosun-app/frontend/client/_app/immutable/chunks/DdbOX2wg.js.br +0 -0
  121. package/build/bosun-app/frontend/client/_app/immutable/chunks/DdbOX2wg.js.gz +0 -0
  122. package/build/bosun-app/frontend/client/_app/immutable/entry/app.D20SOteC.js.br +0 -0
  123. package/build/bosun-app/frontend/client/_app/immutable/entry/app.D20SOteC.js.gz +0 -0
  124. package/build/bosun-app/frontend/client/_app/immutable/entry/start.BqFNrTS7.js +0 -1
  125. package/build/bosun-app/frontend/client/_app/immutable/entry/start.BqFNrTS7.js.br +0 -0
  126. package/build/bosun-app/frontend/client/_app/immutable/entry/start.BqFNrTS7.js.gz +0 -0
  127. package/build/bosun-app/frontend/client/_app/immutable/nodes/0.T9WgLrTj.js.br +0 -0
  128. package/build/bosun-app/frontend/client/_app/immutable/nodes/0.T9WgLrTj.js.gz +0 -0
  129. package/build/bosun-app/frontend/client/_app/immutable/nodes/1.3cRzg0A0.js.br +0 -0
  130. package/build/bosun-app/frontend/client/_app/immutable/nodes/1.3cRzg0A0.js.gz +0 -0
  131. package/build/bosun-app/frontend/client/_app/immutable/nodes/10.28fogxMw.js.br +0 -0
  132. package/build/bosun-app/frontend/client/_app/immutable/nodes/10.28fogxMw.js.gz +0 -0
  133. package/build/bosun-app/frontend/client/_app/immutable/nodes/17.CZ8fUbCu.js.br +0 -0
  134. package/build/bosun-app/frontend/client/_app/immutable/nodes/17.CZ8fUbCu.js.gz +0 -0
  135. package/build/bosun-app/frontend/client/_app/immutable/nodes/18.CLTXnmXM.js.br +0 -0
  136. package/build/bosun-app/frontend/client/_app/immutable/nodes/18.CLTXnmXM.js.gz +0 -0
  137. package/build/bosun-app/frontend/client/_app/immutable/nodes/2.BVj8fduB.js.br +0 -0
  138. package/build/bosun-app/frontend/client/_app/immutable/nodes/2.BVj8fduB.js.gz +0 -0
  139. package/build/bosun-app/frontend/client/_app/immutable/nodes/3.D1hXqvoR.js.br +0 -0
  140. package/build/bosun-app/frontend/client/_app/immutable/nodes/3.D1hXqvoR.js.gz +0 -0
  141. package/build/bosun-app/frontend/client/_app/immutable/nodes/4.Q-efp8BE.js.br +0 -0
  142. package/build/bosun-app/frontend/client/_app/immutable/nodes/4.Q-efp8BE.js.gz +0 -0
  143. package/build/bosun-app/frontend/client/_app/immutable/nodes/5.BlBkWeY0.js.br +0 -0
  144. package/build/bosun-app/frontend/client/_app/immutable/nodes/5.BlBkWeY0.js.gz +0 -0
  145. package/build/bosun-app/frontend/client/_app/immutable/nodes/6.CQPXvkij.js.br +0 -0
  146. package/build/bosun-app/frontend/client/_app/immutable/nodes/6.CQPXvkij.js.gz +0 -0
  147. package/build/bosun-app/frontend/client/_app/immutable/nodes/8.Bcw_NHql.js.br +0 -0
  148. package/build/bosun-app/frontend/client/_app/immutable/nodes/8.Bcw_NHql.js.gz +0 -0
  149. package/build/bosun-app/frontend/client/_app/immutable/nodes/9.iQdTFqAn.js.br +0 -0
  150. package/build/bosun-app/frontend/client/_app/immutable/nodes/9.iQdTFqAn.js.gz +0 -0
@@ -1,6 +1,7 @@
1
- export type { AIEngine, AIStreamEngine, BasicStep, BeforeEachStep, Conversation, EngineConfig, JsonLlmStep, LlmStep, LlmAdapter, LlmProviderInfo, LlmStreamAdapter, Logger, Message, PredictiveStreamingWorkflow, PredictiveWorkflowConfig, ProgrammaticStep, ResponseChunk, ScheduleAction, Scheduler, StepBuilder, StreamWorkflowConfig, StreamingEngineConfig, SupplementalPrediction, StringLlmStep, Transcript, Workflow, WorkflowConfig, WorkflowControls, WorkflowStep, } from './interfaces/index.js';
1
+ export type { AIEngine, AIStreamEngine, BasicStep, BeforeEachStep, Conversation, EngineConfig, JsonLlmStep, LlmStep, LlmAdapter, LlmProviderInfo, LlmStreamAdapter, Logger, Message, PredictionCandidate, PredictionChooser, PredictionChooserInput, PredictionChooserResult, PredictiveStreamingWorkflow, PredictiveWorkflowConfig, ProgrammaticStep, ResponseChunk, ScheduleAction, Scheduler, StepBuilder, StreamWorkflowConfig, StreamingEngineConfig, SupplementalPrediction, StringLlmStep, Transcript, Workflow, WorkflowConfig, WorkflowControls, WorkflowStep, } from './interfaces/index.js';
2
2
  export { createAIEngine, createConversation, getStepBuilder } from './engine.js';
3
- export { createAIStreamEngine, getAzureClient, getOpenAiClient } from './stream/index.js';
3
+ export { createAIStreamEngine, createJevPredictionChooser, getAzureClient, getOpenAiClient, } from './stream/index.js';
4
+ export type { JevPredictionChooserOptions } from './stream/index.js';
4
5
  export { predictionTemplates } from './stream/index.js';
5
6
  export type { StreamingWorkflowConfig } from './stream/index.js';
6
7
  export { ScheduleQuery, createScheduleQuery, delayFactory } from './schedule.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,QAAQ,EACR,cAAc,EACd,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,OAAO,EACP,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,2BAA2B,EAC3B,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,YAAY,GACf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAChF,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,YAAY,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAChF,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EACH,aAAa,EACb,UAAU,EACV,uBAAuB,EACvB,8BAA8B,EAC9B,oBAAoB,EACpB,sBAAsB,EACtB,UAAU,EACV,iBAAiB,GACpB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACR,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,mBAAmB,EACnB,oBAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,cAAc,GACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,cAAc,GACjB,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AACrF,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAClF,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,QAAQ,EACR,cAAc,EACd,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,OAAO,EACP,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP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AE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,cAAc,GACjB,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AACrF,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAClF,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  export { createAIEngine, createConversation, getStepBuilder } from './engine.js';
2
- export { createAIStreamEngine, getAzureClient, getOpenAiClient } from './stream/index.js';
2
+ export { createAIStreamEngine, createJevPredictionChooser, getAzureClient, getOpenAiClient, } from './stream/index.js';
3
3
  export { predictionTemplates } from './stream/index.js';
4
4
  export { ScheduleQuery, createScheduleQuery, delayFactory } from './schedule.js';
5
5
  export { createContext, createMock, createStubApiCallTracer, createStubConversationalTracer, createStubStepTracer, createTestAgentFactory, makeAction, makeActionWrapper, } from './bosun/index.js';
@@ -19,9 +19,32 @@ export interface StreamingEngineConfig {
19
19
  nunjucksEnv?: Environment;
20
20
  predictive?: {
21
21
  predictorModel: LlmAdapter;
22
- chooserModel: LlmAdapter;
22
+ chooser: PredictionChooser;
23
23
  };
24
24
  }
25
+ export interface PredictionCandidate {
26
+ userResponse: string;
27
+ agentResponse: string;
28
+ }
29
+ export interface PredictionChooserInput {
30
+ history: Message[];
31
+ actualUserResponse: string;
32
+ candidates: readonly PredictionCandidate[];
33
+ }
34
+ export interface PredictionChooserResult {
35
+ selectedIndex?: number;
36
+ scores: number[];
37
+ model?: string;
38
+ usage?: {
39
+ inputTokens: number;
40
+ outputTokens: number;
41
+ };
42
+ }
43
+ export interface PredictionChooser {
44
+ choose: (input: PredictionChooserInput) => Promise<PredictionChooserResult>;
45
+ getOptions: () => unknown;
46
+ getProviderInfo?: () => LlmProviderInfo;
47
+ }
25
48
  export interface StreamWorkflowConfig<CTX> {
26
49
  name: string;
27
50
  prompt: string | PromptFile;
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/engine/interfaces/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,MAAM,WAAW,cAAc,CAAC,GAAG,SAAS,MAAM;IAE9C,cAAc,EAAE,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAAG,CAAC,KAAK;QAOnD,GAAG,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAA;KACjF,CAAA;IAED,wBAAwB,EAAE,CACtB,MAAM,EAAE,wBAAwB,CAAC,GAAG,CAAC,KACpC,2BAA2B,CAAC,GAAG,CAAC,CAAA;CACxC;AAED,MAAM,WAAW,qBAAqB;IAElC,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,YAAY,CAAC,EAAE,YAAY,CAAA;IAE3B,UAAU,CAAC,EAAE,UAAU,CAAA;IAKvB,WAAW,CAAC,EAAE,WAAW,CAAA;IAEzB,WAAW,CAAC,EAAE,WAAW,CAAA;IAEzB,UAAU,CAAC,EAAE;QACT,cAAc,EAAE,UAAU,CAAA;QAC1B,YAAY,EAAE,UAAU,CAAA;KAC3B,CAAA;CACJ;AAED,MAAM,WAAW,oB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M7B,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;IAE3F,UAAU,EAAE,MAAM,OAAO,CAAA;IAKzB,eAAe,CAAC,EAAE,MAAM,eAAe,CAAA;CAC1C;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;CAChB"}
@@ -1,4 +1,6 @@
1
1
  export { createAIStreamEngine } from './engine.js';
2
- export { AIStreamEngine, LlmStreamAdapter, PredictiveStreamingWorkflow, PredictiveWorkflowConfig, ResponseChunk, SupplementalPrediction, Transcript, StreamingEngineConfig, StreamWorkflowConfig as StreamingWorkflowConfig, predictionTemplates, } from '../interfaces/stream.js';
2
+ export { AIStreamEngine, LlmStreamAdapter, PredictionCandidate, PredictionChooser, PredictionChooserInput, PredictionChooserResult, PredictiveStreamingWorkflow, PredictiveWorkflowConfig, ResponseChunk, SupplementalPrediction, Transcript, StreamingEngineConfig, StreamWorkflowConfig as StreamingWorkflowConfig, predictionTemplates, } from '../interfaces/stream.js';
3
3
  export { getAzureClient, getOpenAiClient } from './get-client.js';
4
+ export { createJevPredictionChooser } from './jev-prediction-chooser.js';
5
+ export type { JevPredictionChooserOptions } from './jev-prediction-chooser.js';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/stream/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,2BAA2B,EAC3B,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,IAAI,uBAAuB,EAC/C,mBAAmB,GACtB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/engine/stream/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,IAAI,uBAAuB,EAC/C,mBAAmB,GACtB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AACxE,YAAY,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA"}
@@ -1,3 +1,4 @@
1
1
  export { createAIStreamEngine } from './engine.js';
2
2
  export { predictionTemplates, } from '../interfaces/stream.js';
3
3
  export { getAzureClient, getOpenAiClient } from './get-client.js';
4
+ export { createJevPredictionChooser } from './jev-prediction-chooser.js';
@@ -0,0 +1,11 @@
1
+ import { type Fetch } from '@typesafe-ai/sdk';
2
+ import type { PredictionChooser } from '../interfaces/index.js';
3
+ export interface JevPredictionChooserOptions {
4
+ apiKey: string;
5
+ model: string;
6
+ matchThreshold: number;
7
+ timeoutMs: number;
8
+ fetch?: Fetch;
9
+ }
10
+ export declare function createJevPredictionChooser(options: JevPredictionChooserOptions): PredictionChooser;
11
+ //# sourceMappingURL=jev-prediction-chooser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jev-prediction-chooser.d.ts","sourceRoot":"","sources":["../../../src/engine/stream/jev-prediction-chooser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAA2C,MAAM,kBAAkB,CAAA;AAEtF,OAAO,KAAK,EAAE,iBAAiB,EAA2B,MAAM,wBAAwB,CAAA;AAGxF,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IAEjB,KAAK,CAAC,EAAE,KAAK,CAAA;CAChB;AAED,wBAAgB,0BAA0B,CACtC,OAAO,EAAE,2BAA2B,GACrC,iBAAiB,CAgEnB"}
@@ -0,0 +1,101 @@
1
+ import { TypeSafeClient, noul } from '@typesafe-ai/sdk';
2
+ import { chooserPrompt } from './predictive-prompts.js';
3
+ export function createJevPredictionChooser(options) {
4
+ validateOptions(options);
5
+ const client = new TypeSafeClient({
6
+ apiKey: options.apiKey,
7
+ defaultModel: options.model,
8
+ fetch: options.fetch,
9
+ logLevel: 'off',
10
+ timeout: options.timeoutMs,
11
+ });
12
+ return {
13
+ getOptions: () => ({
14
+ model: options.model,
15
+ matchThreshold: options.matchThreshold,
16
+ timeoutMs: options.timeoutMs,
17
+ }),
18
+ getProviderInfo: () => ({ provider: 'typesafe', model: options.model }),
19
+ async choose(input) {
20
+ if (input.candidates.length === 0) {
21
+ throw new Error('Jev prediction chooser requires at least one candidate.');
22
+ }
23
+ const questions = createQuestions(input.candidates.length);
24
+ const result = await client.systemOne({
25
+ model: options.model,
26
+ state: {
27
+ conversation_history: input.history.map((message) => ({
28
+ role: message.sender,
29
+ text: message.text,
30
+ })),
31
+ actual_user_response: input.actualUserResponse,
32
+ candidates: input.candidates.map((candidate) => ({
33
+ predicted_user_response: candidate.userResponse,
34
+ prepared_agent_response: candidate.agentResponse,
35
+ })),
36
+ },
37
+ questions,
38
+ });
39
+ const scores = input.candidates.map((_, index) => {
40
+ const answer = result.answers[questionId(index)];
41
+ if (!answer ||
42
+ answer.type !== 'noul' ||
43
+ !Number.isFinite(answer.noul) ||
44
+ answer.noul < 0 ||
45
+ answer.noul > 1) {
46
+ throw new Error(`Jev returned an invalid answer for candidate ${index + 1}.`);
47
+ }
48
+ return answer.noul;
49
+ });
50
+ const selectedIndex = selectCandidate(scores, options.matchThreshold);
51
+ return {
52
+ selectedIndex,
53
+ scores,
54
+ model: result.model,
55
+ usage: {
56
+ inputTokens: result.usage.input_tokens,
57
+ outputTokens: result.usage.output_tokens,
58
+ },
59
+ };
60
+ },
61
+ };
62
+ }
63
+ function createQuestions(candidateCount) {
64
+ return Object.fromEntries(Array.from({ length: candidateCount }, (_, index) => [
65
+ questionId(index),
66
+ noul(`${chooserPrompt}\n\nEvaluate \`candidates[${index}]\` against \`actual_user_response\` and \`conversation_history\`.`, {
67
+ true: 'The prepared agent response meets every safety and relevance condition.',
68
+ false: 'The prepared agent response violates one or more safety or relevance conditions.',
69
+ }),
70
+ ]));
71
+ }
72
+ function selectCandidate(scores, threshold) {
73
+ let selectedIndex;
74
+ let selectedScore = threshold;
75
+ for (const [index, score] of scores.entries()) {
76
+ if (score < selectedScore)
77
+ continue;
78
+ if (score === selectedScore && selectedIndex !== undefined)
79
+ continue;
80
+ selectedIndex = index;
81
+ selectedScore = score;
82
+ }
83
+ return selectedIndex;
84
+ }
85
+ function questionId(index) {
86
+ return `candidate_${index + 1}_reply_is_safe`;
87
+ }
88
+ function validateOptions(options) {
89
+ if (!options.apiKey.trim())
90
+ throw new Error('Jev prediction chooser requires an API key.');
91
+ if (!options.model.trim())
92
+ throw new Error('Jev prediction chooser requires a model.');
93
+ if (!Number.isFinite(options.matchThreshold) ||
94
+ options.matchThreshold < 0 ||
95
+ options.matchThreshold > 1) {
96
+ throw new Error('Jev matchThreshold must be between 0 and 1.');
97
+ }
98
+ if (!Number.isFinite(options.timeoutMs) || options.timeoutMs <= 0) {
99
+ throw new Error('Jev timeoutMs must be a positive number.');
100
+ }
101
+ }
@@ -1,3 +1,3 @@
1
1
  export declare const predictorPrompt = "# Response Structure\n\nResponse structure has been given in the JSON Schema. Your goal is to predict the next user message and the next agent message.\n\n{% if predictionCount %}The generated predicted user messages should be significantly different. Assume the prompt is correct and shows the variability of responses.\n{% endif %}\n\n{% if supplementalPredictions.length %}The following user replies are already covered by predefined pairs. Generate the agent response when the schema does not define it. Do not repeat these cases in the generated pairs:\n{% for prediction in supplementalPredictions %}- {{ prediction.userResponse }}\n{% endfor %}{% endif %}\nThe prompt is given below for reference.\n--- PROMPT for reference ---";
2
- export declare const chooserPrompt = "Determine whether two alternative final messages have equivalent meaning\nin a shared conversation.\n\nBoth alternatives are spoken by final speaker immediately after history.\nThey are alternatives, not consecutive messages.\n\nUse history to resolve references and omitted information independently\nfor each alternative. Compare only the meaning contributed by the final\nmessages, not the overall similarity of the conversations.\n\nAdditional substantive information makes the messages non-equivalent.\n\nDo not judge whether either message is correct, helpful or appropriate.\n\nReturn exactly one label:\nE = equivalent in this context\nN = not equivalent in this context\nU = the supplied context does not allow the equivalence to be determined\n\nHistory:\n\n{{ history }}\n\nReference:\n\n{{ reference }}\n\nAlternative: \n\n{{ alternative }}";
2
+ export declare const chooserPrompt = "Decide whether each prepared agent response is safe and natural to\nsend after the actual user response in the conversation.\n\nThe predicted user response explains the case that produced the prepared response. It does not\nreplace or override the actual user response.\n\nA safe response directly addresses the actual user response. It does not contradict the user,\nassume unsupported facts, or ignore a direct question. Every transfer, booking, schedule change,\nhang-up, or other side effect must remain supported by what the user actually said.";
3
3
  //# sourceMappingURL=predictive-prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"predictive-prompts.d.ts","sourceRoot":"","sources":["../../../src/engine/stream/predictive-prompts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,muBAWC,CAAA;AAE7B,eAAO,MAAM,aAAa,y1BA6BR,CAAA"}
1
+ {"version":3,"file":"predictive-prompts.d.ts","sourceRoot":"","sources":["../../../src/engine/stream/predictive-prompts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,muBAWC,CAAA;AAE7B,eAAO,MAAM,aAAa,0iBAQ0D,CAAA"}
@@ -10,33 +10,12 @@ Response structure has been given in the JSON Schema. Your goal is to predict th
10
10
  {% endfor %}{% endif %}
11
11
  The prompt is given below for reference.
12
12
  --- PROMPT for reference ---`;
13
- export const chooserPrompt = `Determine whether two alternative final messages have equivalent meaning
14
- in a shared conversation.
13
+ export const chooserPrompt = `Decide whether each prepared agent response is safe and natural to
14
+ send after the actual user response in the conversation.
15
15
 
16
- Both alternatives are spoken by final speaker immediately after history.
17
- They are alternatives, not consecutive messages.
16
+ The predicted user response explains the case that produced the prepared response. It does not
17
+ replace or override the actual user response.
18
18
 
19
- Use history to resolve references and omitted information independently
20
- for each alternative. Compare only the meaning contributed by the final
21
- messages, not the overall similarity of the conversations.
22
-
23
- Additional substantive information makes the messages non-equivalent.
24
-
25
- Do not judge whether either message is correct, helpful or appropriate.
26
-
27
- Return exactly one label:
28
- E = equivalent in this context
29
- N = not equivalent in this context
30
- U = the supplied context does not allow the equivalence to be determined
31
-
32
- History:
33
-
34
- {{ history }}
35
-
36
- Reference:
37
-
38
- {{ reference }}
39
-
40
- Alternative:
41
-
42
- {{ alternative }}`;
19
+ A safe response directly addresses the actual user response. It does not contradict the user,
20
+ assume unsupported facts, or ignore a direct question. Every transfer, booking, schedule change,
21
+ hang-up, or other side effect must remain supported by what the user actually said.`;
@@ -1 +1 @@
1
- {"version":3,"file":"predictive-workflow.d.ts","sourceRoot":"","sources":["../../../src/engine/stream/predictive-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAM/B,OAAO,KAAK,EAKR,2BAA2B,EAC3B,wBAAwB,EAExB,qBAAqB,EAExB,MAAM,wBAAwB,CAAA;AAgD/B,wBAAgB,wBAAwB,CAAC,GAAG,SAAS,MAAM,EACvD,MAAM,EAAE,wBAAwB,CAAC,GAAG,CAAC,EACrC,YAAY,EAAE,qBAAqB,EACnC,WAAW,EAAE,QAAQ,CAAC,WAAW,GAClC,2BAA2B,CAAC,GAAG,CAAC,CA6blC"}
1
+ {"version":3,"file":"predictive-workflow.d.ts","sourceRoot":"","sources":["../../../src/engine/stream/predictive-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAM/B,OAAO,KAAK,EAOR,2BAA2B,EAC3B,wBAAwB,EAExB,qBAAqB,EAExB,MAAM,wBAAwB,CAAA;AAgD/B,wBAAgB,wBAAwB,CAAC,GAAG,SAAS,MAAM,EACvD,MAAM,EAAE,wBAAwB,CAAC,GAAG,CAAC,EACrC,YAAY,EAAE,qBAAqB,EACnC,WAAW,EAAE,QAAQ,CAAC,WAAW,GAClC,2BAA2B,CAAC,GAAG,CAAC,CAoclC"}
@@ -9,7 +9,7 @@ export function createPredictiveWorkflow(config, engineConfig, nunjucksEnv) {
9
9
  if (!predictiveModels) {
10
10
  throw new Error('Predictive models are not configured.');
11
11
  }
12
- const { predictorModel, chooserModel } = predictiveModels;
12
+ const { predictorModel, chooser } = predictiveModels;
13
13
  if (!Number.isInteger(config.predictionCount) || config.predictionCount < 1) {
14
14
  throw new Error('predictionCount must be a positive integer.');
15
15
  }
@@ -81,7 +81,9 @@ export function createPredictiveWorkflow(config, engineConfig, nunjucksEnv) {
81
81
  throw createOperationError(error, config.model, mainTrace);
82
82
  });
83
83
  const firstProvisionalChunk = readFirstNonEmptyChunk(provisionalStream, mainTrace, config.model);
84
- const chooserResults = predictions.map((pair) => choosePrediction(pair, messages, ctx, runId, isCurrent));
84
+ const chooserResult = predictions.length
85
+ ? choosePrediction(predictions, messages, ctx, runId, isCurrent)
86
+ : new Promise(() => undefined);
85
87
  function isCurrent() {
86
88
  return active && !state.closed && state.requestGeneration === generation;
87
89
  }
@@ -163,7 +165,7 @@ export function createPredictiveWorkflow(config, engineConfig, nunjucksEnv) {
163
165
  }
164
166
  async function orchestrate(controller) {
165
167
  try {
166
- const winner = await Promise.race([firstProvisionalChunk, ...chooserResults]);
168
+ const winner = await Promise.race([firstProvisionalChunk, chooserResult]);
167
169
  if (!isCurrent())
168
170
  return;
169
171
  if (winner.kind === 'prediction') {
@@ -364,46 +366,47 @@ export function createPredictiveWorkflow(config, engineConfig, nunjucksEnv) {
364
366
  });
365
367
  return { pairs, trace };
366
368
  }
367
- async function choosePrediction(pair, messages, ctx, parentRunId, isActive) {
369
+ async function choosePrediction(pairs, messages, ctx, parentRunId, isActive) {
368
370
  const actualUserResponse = messages.at(-1)?.text ?? '';
369
- const history = stringifyMessages(messages.slice(0, -1));
370
- const rendered = nunjucksEnv.renderString(chooserPrompt, {
371
- history,
372
- reference: pair.userResponse,
373
- alternative: actualUserResponse,
374
- });
371
+ const history = messages.slice(0, -1);
372
+ const stringifiedHistory = stringifyMessages(history);
373
+ const input = { history, actualUserResponse, candidates: pairs };
375
374
  const trace = {
376
375
  workflowId: config.name,
377
376
  workflowRunId: parentRunId,
378
377
  name: 'chooser',
379
- model: JSON.stringify(chooserModel.getOptions()),
378
+ model: JSON.stringify(chooser.getOptions()),
380
379
  createdAt: Date.now(),
381
380
  response: '',
382
381
  receivedContext: ctx,
383
382
  receivedPrompt: chooserPrompt,
384
- renderedPrompt: rendered,
385
- stringifiedConversation: history,
383
+ renderedPrompt: JSON.stringify(input),
384
+ stringifiedConversation: stringifiedHistory,
386
385
  };
387
- let raw;
386
+ let result;
388
387
  try {
389
- raw = await chooserModel.generateResponse('', rendered);
388
+ result = await chooser.choose(input);
390
389
  }
391
390
  catch (error) {
392
- throw createOperationError(error, chooserModel, trace);
391
+ throw createOperationError(error, chooser, trace);
393
392
  }
394
393
  if (!isActive())
395
394
  return new Promise(() => undefined);
396
- const label = raw.trim();
397
- trace.response = label;
398
- if (label !== 'N' && label !== 'U') {
399
- if (label === 'E') {
400
- void addAndFlushTrace(stepTracer, trace, logger);
401
- return { kind: 'prediction', pair };
402
- }
403
- throw createOperationError(new Error(`Chooser returned an invalid label: ${label}`), chooserModel, trace);
395
+ trace.response = JSON.stringify(result);
396
+ if (result.scores.length !== pairs.length) {
397
+ throw createOperationError(new Error('Chooser returned the wrong number of candidate scores.'), chooser, trace);
398
+ }
399
+ if (result.selectedIndex === undefined) {
400
+ void addAndFlushTrace(stepTracer, trace, logger);
401
+ return new Promise(() => undefined);
402
+ }
403
+ if (!Number.isInteger(result.selectedIndex) ||
404
+ result.selectedIndex < 0 ||
405
+ result.selectedIndex >= pairs.length) {
406
+ throw createOperationError(new Error('Chooser returned an invalid candidate index.'), chooser, trace);
404
407
  }
405
408
  void addAndFlushTrace(stepTracer, trace, logger);
406
- return new Promise(() => undefined);
409
+ return { kind: 'prediction', pair: pairs[result.selectedIndex] };
407
410
  }
408
411
  return { run, prewarmForUsersHello, waitForPendingPrediction, clear };
409
412
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@recombine-ai/platform",
3
3
  "type": "module",
4
- "version": "0.9.1-test.1",
4
+ "version": "0.9.1-test.2",
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",
@@ -42,6 +42,7 @@
42
42
  "registry": "https://registry.npmjs.org"
43
43
  },
44
44
  "dependencies": {
45
+ "@typesafe-ai/sdk": "0.6.0",
45
46
  "dotenv": "17.4.2",
46
47
  "esbuild": "0.27.3",
47
48
  "fast-xml-parser": "5.7.3",
@@ -1 +0,0 @@
1
- import{a as r}from"../chunks/BP8LHuYi.js";import{y as t}from"../chunks/D7a3sSg2.js";export{t as load_css,r as start};